[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M711KBER1KD9NQQ1NSDMF8F1":3,"skill-same:01M711KBER1KD9NQQ1NSDMF8F1":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":48,"repositoryHtmlUrl":49,"repositoryHomepageUrl":6,"ownerHtmlUrl":50,"ownerBlogUrl":51,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M711KBER1KD9NQQ1NSDMF8F1","eval-generator-gen-pages",null,"Generate a three-layer eval suite (presence checks + unit tests + security analysis) for Power Apps Generative Pages in Model-Driven Apps. Generative pages are single-file React\u002FTypeScript components using Fluent UI V9 and the dataApi prop for Dataverse operations — NOT Code Apps, NOT PCF components. Code may be generated by the App Agent in make.powerapps.com or by AI code generation tools (Claude Code, GitHub Copilot CLI) using the \u002Fgenpage skill. Always produces: evals\u002Fmanifest.json, evals\u002Fpresence\u002F\u003Cid>.check.ts, evals\u002Funit\u002F\u003Cfeature>.test.tsx, evals\u002Frunner\u002Frun-evals.ts, evals\u002Frunner\u002Fpresence-runner.ts, evals\u002Frunner\u002Fsecurity-runner.ts, and evals\u002Fdashboard\u002Findex.html. Triggers: 'eval my generative page', 'generate evals for gen page', 'review my genpage code', 'test my generative page', 'check my model driven app page', 'eval generator gen pages'.","microsoft\u002Fpower-cat-skills","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M711HNR06SENTW4XRAD4QG81",70,"MIT","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-cat-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fpowercat-procode-eval\u002Fskills\u002Feval-generator-gen-pages\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"generator","eval generator","eval generator gen pages","pages","eval","run","eval suite","generate","github copilot cli","react","fluent","components","dataverse","URL","apps","generative","power","tsx","app","unit","2026-11-10 10:12:30",false,"---\nname: \"eval-generator-gen-pages\"\nargument-hint: \"[path to your .tsx generative page file] [optional: BRD file or OneDrive URL]\"\ndescription: \"Generate a three-layer eval suite (presence checks + unit tests + security analysis) for Power Apps Generative Pages in Model-Driven Apps. Generative pages are single-file React\u002FTypeScript components using Fluent UI V9 and the dataApi prop for Dataverse operations — NOT Code Apps, NOT PCF components. Code may be generated by the App Agent in make.powerapps.com or by AI code generation tools (Claude Code, GitHub Copilot CLI) using the \u002Fgenpage skill. Always produces: evals\u002Fmanifest.json, evals\u002Fpresence\u002F\u003Cid>.check.ts, evals\u002Funit\u002F\u003Cfeature>.test.tsx, evals\u002Frunner\u002Frun-evals.ts, evals\u002Frunner\u002Fpresence-runner.ts, evals\u002Frunner\u002Fsecurity-runner.ts, and evals\u002Fdashboard\u002Findex.html. Triggers: 'eval my generative page', 'generate evals for gen page', 'review my genpage code', 'test my generative page', 'check my model driven app page', 'eval generator gen pages'.\"\n---\n\n# Eval Generator — Power Apps Generative Pages\n\n## Purpose\n\nAnswer: **\"Is this Generative Page correctly structured, does the logic work, and are there security risks?\"**\n\nThree eval layers are always generated:\n1. **Presence** — static checks that assert code artifacts exist and follow Generative Page conventions\n2. **Unit** — Vitest tests for business logic using a mocked `dataApi`\n3. **Security** — static analysis across 14 security categories specific to gen page patterns\n\nAll three are mandatory.\n\n---\n\n## Generative Page Stack — Critical Assumptions\n\nGenerative Pages are **single-file React\u002FTypeScript components** embedded in Model-Driven Apps. They are NOT Code Apps, NOT PCF components. The architecture is fundamentally different from both.\n\n| Concern | Technology |\n|---|---|\n| Runtime | React 17 + TypeScript, compiled and hosted by Power Apps |\n| UI components | **Fluent UI V9** — `@fluentui\u002Freact-components` |\n| Data access | **`dataApi` prop** — passed into the component by the Power Apps host |\n| Data operations | `dataApi.queryTable()`, `dataApi.retrieveRow()`, `dataApi.createRow()`, `dataApi.updateRow()`, `dataApi.deleteRow()`, `dataApi.getChoices()` |\n| Data source | **Dataverse only** (up to 6 tables per page) |\n| Input params | `props.recordId`, `props.entityName`, `props.data` (optional, configured in page definition) |\n| File structure | **Single `.tsx` file** — `export default GeneratedComponent` |\n| Type generation | `pac model genpage generate-types` → local `*.d.ts` files |\n| Deployment | `pac model genpage upload` via PAC CLI |\n| Generated by | App Agent (make.powerapps.com) **or** AI code generation tools (Claude Code \u002F GitHub Copilot CLI with `\u002Fgenpage` skill) |\n| Package manager | npm (for local development and eval harness) |\n| Test runner | Vitest + @testing-library\u002Freact |\n\n> ⚠️ **NEVER look for**: `power.config.json`, `src\u002Fgenerated\u002Fservices\u002F`, `@microsoft\u002Fpower-apps`, `@microsoft\u002Fpowerapps-component-framework`, `context.webAPI.*`, `context.parameters`, `initialize()`, `PowerProvider`. These are Code App or PCF patterns — they do not exist in Generative Pages.\n\n> ⚠️ **ALWAYS look for**: `props.dataApi` or `dataApi` usage, `@fluentui\u002Freact-components` imports, `export default` component with React TSX, Dataverse operation patterns via `dataApi.*`.\n\n---\n\n## Step 0 — Snapshot Previous Results\n\n> **Run this first, before collecting inputs or writing any files.**\n\n1. Check if `evals\u002Fresults\u002Flatest.json` exists relative to the project directory.\n2. If it **does** exist:\n   - Read it.\n   - Count files matching `evals\u002Fresults\u002Fsnapshots\u002Fiter-*.json` to determine N (next iteration = count + 1).\n   - Write a copy to `evals\u002Fresults\u002Fsnapshots\u002Fiter-\u003CN>-\u003CISO-timestamp>.json`.\n   - Update `evals\u002Fresults\u002Fsnapshots\u002Findex.json` (create if absent, append if present).\n3. If it does **not** exist — skip silently. This is the first invocation.\n\n---\n\n## Step 0b — Collect Inputs\n\nAsk the user (via `m_ask_user` for structured choices) for:\n\n1. **Generative Page file or directory** — one of:\n   - Path to a single `.tsx` file (the gen page)\n   - Path to a directory containing one or more `.tsx` gen page files\n   - Current working directory (default if already in the right place)\n\n2. **Requirements document** — OPTIONAL. One of:\n   - Local file path (`.md`, `.txt`, `.docx`)\n   - OneDrive \u002F SharePoint URL\n   - Paste \u002F describe in chat\n   - **None \u002F Skip** — features will be derived from code review (Step 1b)\n\n3. **Eval output mode** (optional):\n   - `scaffold+write` — write all eval files into an `evals\u002F` directory (default ✅)\n   - `describe-only` — print what would be generated, no file writes\n\n> ⚠️ Ask ALL questions in a SINGLE `m_ask_user` call before doing any file work.\n\n**Determine project directory:** If user provided a single file, `PROJECT_DIR` = the file's parent directory. If a directory was given, `PROJECT_DIR` = that directory. All `evals\u002F` output goes into `PROJECT_DIR\u002Fevals\u002F`.\n\n---\n\n## Step 1 — Read Requirements Document (if provided)\n\n> **If no requirements document was provided, skip to Step 1b.**\n\n### Local `.md` or `.txt`\nUse the `view` tool.\n\n### Local `.docx`\nUse the `docx` skill. Call `m_get_skill('docx')` first.\n\n### OneDrive \u002F SharePoint URL\nUse `m365_download_file` (resolve file ID with `m365_search_files` first).\n\n---\n\n## Step 1b — Code-Review Fallback (No BRD)\n\n> **Run this step when no requirements document was provided, AND on every re-run.**\n\nRead all `.tsx` files in the project directory (non-recursively first, then `src\u002F` if present).\n\nFor each gen page file, use `view` and `grep` to identify:\n\n| Signal | Derived Feature |\n|---|---|\n| `dataApi.queryTable('tableName', ...)` | One feature per distinct `tableName` — data list\u002Fgrid |\n| `dataApi.retrieveRow('tableName', ...)` | Detail\u002Frecord view feature |\n| `dataApi.createRow('tableName', ...)` | Create\u002Fform feature |\n| `dataApi.updateRow('tableName', ...)` | Edit\u002Fupdate feature |\n| `dataApi.deleteRow('tableName', ...)` | Delete\u002Fremove feature |\n| `dataApi.getChoices(...)` | Choice field rendering feature |\n| `props.recordId` or `props.entityName` | Input parameter handling feature |\n| Named React sections \u002F major UI blocks | UI composition features (dashboards, cards, grids) |\n| `useState` \u002F `useEffect` clusters | State management features |\n| Localization \u002F translation dictionary | Localization feature |\n| `loadMoreRows` \u002F pagination | Pagination feature |\n| Filter\u002Fsearch inputs | Search\u002Ffilter feature |\n| Chart \u002F visualization components | Data visualization feature |\n\nSynthesize a feature entry per logical unit with `id`, `title`, `description`, `acceptance_criteria`, `priority`, and `tables` (Dataverse table names involved).\n\nSet `manifest.generatedFrom = \"code-review\"`.\n\n**Re-runs:** Repeat Step 1b to pick up new components or new dataApi calls. Match features by `id` — preserve `presence_status` for any existing `id`.\n\n---\n\n## Step 2 — Parse Requirements → Feature Manifest\n\nExtract a structured feature list from the requirements document (Step 1) **or** use the code-derived list from Step 1b.\n\nFor each feature, capture:\n- **id** — slugified identifier (e.g. `account-list`, `contact-detail`, `opportunity-create`)\n- **title** — short label\n- **description** — what the feature does\n- **acceptance_criteria** — array of verifiable statements\n- **priority** — `high` \u002F `medium` \u002F `low` (default `medium`)\n- **tables** — Dataverse table logical names involved (e.g. `[\"account\", \"contact\"]`)\n- **operations** — dataApi operations expected: `[\"queryTable\", \"retrieveRow\", \"createRow\"]`\n\nTrack in SQL:\n```sql\nCREATE TABLE IF NOT EXISTS features (\n  id TEXT PRIMARY KEY,\n  title TEXT,\n  description TEXT,\n  acceptance_criteria TEXT,\n  priority TEXT DEFAULT 'medium',\n  tables TEXT,\n  operations TEXT,\n  presence_status TEXT DEFAULT 'pending',\n  mapped_file TEXT\n);\n```\n\nWrite `evals\u002Fmanifest.json`:\n\n```json\n{\n  \"generated\": \"\u003CISO timestamp>\",\n  \"project\": \"\u003Cpage file name or directory basename>\",\n  \"generatedFrom\": \"brd | code-review\",\n  \"features\": [\n    {\n      \"id\": \"account-list\",\n      \"title\": \"Account List\",\n      \"description\": \"Display a paginated list of Account records using dataApi.queryTable\",\n      \"acceptance_criteria\": [\n        \"Calls dataApi.queryTable('account', { select: [...], pageSize: N })\",\n        \"Shows loading state while data fetches\",\n        \"Shows empty state when no records returned\",\n        \"Handles dataApi errors with a user-friendly message\"\n      ],\n      \"priority\": \"high\",\n      \"tables\": [\"account\"],\n      \"operations\": [\"queryTable\"],\n      \"layers\": { \"presence\": true, \"unit\": true }\n    }\n  ]\n}\n```\n\n---\n\n## Step 3 — Audit the Generative Page File(s)\n\n### 3a. Verify Generative Page structure\n\nUse `glob` and `view` to confirm:\n\n- At least one `.tsx` file exists with `export default` — the gen page component\n- The file imports from `@fluentui\u002Freact-components` (Fluent UI V9)\n- The component uses `props.dataApi` or destructures `dataApi` from props\n- The component does NOT import from `@microsoft\u002Fpower-apps` or `@microsoft\u002Fpowerapps-component-framework`\n\nIf `@microsoft\u002Fpower-apps` or `power.config.json` is found → stop and warn:\n> \"This appears to be a Code App, not a Generative Page. Use the `eval-generator-code-app` skill instead.\"\n\nIf `ComponentFramework` or `context.webAPI` is found → stop and warn:\n> \"This appears to be a PCF component. This skill only supports Power Apps Generative Pages.\"\n\n### 3b. Map the gen page structure\n\nUse `grep` on the `.tsx` file(s) to identify:\n\n| Pattern | Role |\n|---|---|\n| `export default function \\|export default const ` | Root component (required) |\n| `import { .* } from '@fluentui\u002Freact-components'` | Fluent UI V9 components in use |\n| `props\\.dataApi\\|const { dataApi }` | dataApi access pattern |\n| `dataApi\\.queryTable\\s*\\(` | Table query operations |\n| `dataApi\\.retrieveRow\\s*\\(` | Single record retrieval |\n| `dataApi\\.createRow\\s*\\(` | Record creation |\n| `dataApi\\.updateRow\\s*\\(` | Record update |\n| `dataApi\\.deleteRow\\s*\\(` | Record deletion |\n| `dataApi\\.getChoices\\s*\\(` | Choice column lookup |\n| `props\\.recordId\\|props\\.entityName\\|props\\.data` | Input parameter handling |\n| `hasMoreRows\\|loadMoreRows` | Pagination |\n| `useState.*[Ll]oading\\|isLoading` | Loading state |\n| `useState.*[Ee]rror\\|setError` | Error state |\n| `\\.length === 0\\|rows\\.length === 0` | Empty state |\n| `try\\s*{` | Error handling |\n| `useEffect\\s*\\(` | Side effects \u002F data fetching triggers |\n\nRecord matched line numbers in the SQL `features` table (`mapped_file`, `operations` columns).\n\n### 3c. Flag structural issues\n\nA feature is **Not Implemented** if its expected `dataApi.*` call is not found. Mark `presence_status = 'not_found'`.\n\nFlag these as warnings (not blockers) if found:\n- `dataApi.queryTable` called **without** a `select` array → performance risk (fetches all columns)\n- `dataApi.*` calls **outside** a `try\u002Fcatch` block → unhandled async errors\n- No loading state detected → poor UX\n- No empty state detected → poor UX\n\n---\n\n## Step 4 — Generate Presence Checks\n\nCreate `evals\u002Fpresence\u002F\u003Cfeature-id>.check.ts` for each feature.\n\n### Presence check template\n\n```typescript\n\u002F\u002F evals\u002Fpresence\u002F\u003Cfeature-id>.check.ts\n\u002F\u002F AUTO-GENERATED by eval-generator-gen-pages\n\u002F\u002F Feature: \u003Cfeature title>\n\u002F\u002F Description: \u003Cfeature description>\n\nimport { readFileSync, existsSync } from 'fs';\nimport { join, dirname } from 'path';\nimport { fileURLToPath } from 'url';\nimport { globSync } from 'glob';\n\n\u002F\u002F Path-anchored to this file's location — works correctly from any working directory\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst PROJECT_DIR = join(__dirname, '..', '..');  \u002F\u002F evals\u002Fpresence → evals → project dir\n\ninterface PresenceResult {\n  featureId: string;\n  checks: Array\u003C{ name: string; passed: boolean; detail?: string }>;\n}\n\nexport function check(): PresenceResult {\n  const checks: PresenceResult['checks'] = [];\n\n  \u002F\u002F Locate gen page .tsx files (non-recursive, then src\u002F if present)\n  const tsxFiles = [\n    ...globSync(`${PROJECT_DIR}\u002F*.tsx`),\n    ...globSync(`${PROJECT_DIR}\u002Fsrc\u002F**\u002F*.tsx`),\n  ];\n\n  if (tsxFiles.length === 0) {\n    checks.push({ name: 'gen page .tsx file exists', passed: false,\n      detail: 'No .tsx file found in project directory. Expected a generative page component file.' });\n    return { featureId: '\u003Cfeature-id>', checks };\n  }\n\n  const allSource = tsxFiles.map(f => readFileSync(f, 'utf-8')).join('\\n');\n\n  \u002F\u002F ── Check: dataApi is accessed ──\n  const dataApiUsed = \u002Fprops\\.dataApi|const\\s*\\{[^}]*dataApi\u002F.test(allSource);\n  checks.push({\n    name: 'dataApi prop accessed',\n    passed: dataApiUsed,\n    detail: dataApiUsed ? undefined : 'dataApi not found in props. Generative pages receive dataApi as a prop from the Power Apps host.',\n  });\n\n  \u002F\u002F ── Check: dataApi.queryTable called for this feature's table ──\n  const queryFound = \u002FdataApi\\.queryTable\\s*\\(\\s*['\"]\u003Ctable-name>['\"]\u002F.test(allSource);\n  checks.push({\n    name: 'dataApi.queryTable called for \u003Ctable-name>',\n    passed: queryFound,\n    detail: queryFound ? undefined : 'dataApi.queryTable(\"' + '\u003Ctable-name>' + '\", ...) not found. Feature may not be fetching data.',\n  });\n\n  \u002F\u002F ── Check: select columns specified (performance best practice) ──\n  const selectFound = \u002FdataApi\\.queryTable\\s*\\([^)]*select\\s*:\u002F.test(allSource);\n  checks.push({\n    name: 'select columns specified in queryTable (performance)',\n    passed: selectFound,\n    detail: selectFound ? undefined : 'queryTable called without select property — fetches ALL columns. Always specify select: [\\'col1\\', \\'col2\\'] for performance.',\n  });\n\n  \u002F\u002F ── Check: try\u002Fcatch around dataApi call ──\n  \u002F\u002F Strategy: find dataApi.queryTable and check for surrounding try block\n  const tryCatchFound = \u002Ftry\\s*\\{[^}]*dataApi\\.|dataApi\\.[^;]*;\\s*}\\s*catch\u002F.test(allSource.replace(\u002F\\n\u002Fg, ' '));\n  checks.push({\n    name: 'dataApi calls wrapped in try\u002Fcatch',\n    passed: tryCatchFound,\n    detail: tryCatchFound ? undefined : 'No try\u002Fcatch detected around dataApi calls. Unhandled promise rejections will crash the page.',\n  });\n\n  \u002F\u002F ── Check: loading state ──\n  const loadingState = \u002FuseState.*[Ll]oading|isLoading|isPending\u002F.test(allSource);\n  checks.push({\n    name: 'loading state handled',\n    passed: loadingState,\n    detail: loadingState ? undefined : 'No loading state found. Users see blank content while data fetches.',\n  });\n\n  \u002F\u002F ── Check: error state ──\n  const errorState = \u002FuseState.*[Ee]rror|setError|errorMessage\u002F.test(allSource);\n  checks.push({\n    name: 'error state handled',\n    passed: errorState,\n    detail: errorState ? undefined : 'No error state found. Connector failures will be silently swallowed.',\n  });\n\n  \u002F\u002F ── Check: empty state ──\n  const emptyState = \u002F\\.length\\s*===\\s*0|rows\\.length\\s*===\\s*0|!rows\\.length\u002F.test(allSource);\n  checks.push({\n    name: 'empty state handled',\n    passed: emptyState,\n    detail: emptyState ? undefined : 'No empty-state check found. An empty result set may render a blank or broken UI.',\n  });\n\n  \u002F\u002F ── Check: Fluent UI V9 imported ──\n  const fluentV9 = \u002F@fluentui\\\u002Freact-components\u002F.test(allSource);\n  checks.push({\n    name: 'Fluent UI V9 (@fluentui\u002Freact-components) imported',\n    passed: fluentV9,\n    detail: fluentV9 ? undefined : 'Fluent UI V9 not imported. Generative pages should use @fluentui\u002Freact-components for consistent MDA styling.',\n  });\n\n  return { featureId: '\u003Cfeature-id>', checks };\n}\n```\n\n### Generative Page-specific presence patterns\n\n| Feature type | Checks to generate |\n|---|---|\n| **Data list \u002F grid** | `dataApi.queryTable('tableName', {...})` called AND `select:` specified AND loading state AND empty state AND try\u002Fcatch |\n| **Detail \u002F single record** | `dataApi.retrieveRow('tableName', { id: ..., select: [...] })` AND input param (`props.recordId`) handled |\n| **Create form** | `dataApi.createRow('tableName', {...})` AND form validation AND submit disabled during save |\n| **Edit form** | `dataApi.updateRow('tableName', rowId, {...})` AND rowId sourced from `props.recordId` or state |\n| **Delete action** | `dataApi.deleteRow('tableName', rowId)` AND confirmation UI (dialog\u002Fbutton) AND error handling |\n| **Choice fields** | `dataApi.getChoices('tableName-columnName')` AND choices rendered as dropdown or display label |\n| **Input params** | `props.recordId`, `props.entityName`, or `props.data` destructured AND used in `useEffect` or initialization |\n| **Pagination** | `hasMoreRows` checked AND `loadMoreRows()` callable AND loading state for next-page fetch |\n| **Localization** | Translation dictionary or `useEffect` for language detection AND date\u002Fnumber locale formatting |\n| **Search \u002F filter** | Filter state connected to `dataApi.queryTable` `filter` option AND no raw user input in filter string |\n| **Data visualization** | Chart component found AND data mapped from `dataApi.queryTable` result |\n| **Error disclosure** | No `e.message` or `String(e)` set directly into user-visible state |\n\n> ⚠️ Never generate presence checks that grep for `context.webAPI`, `initialize()`, `PowerProvider`, `src\u002Fgenerated\u002F`, or `result.value` — these are Code App \u002F PCF patterns and will never appear in a Generative Page.\n\n---\n\n## Step 5 — Generate Vitest Unit Tests\n\n> ⛔ **This step is MANDATORY on every invocation.** Write real unit tests grounded in actual source code. Use `it.todo()` stubs only when a feature has no testable logic. Never skip this step — even on re-runs.\n\n### Re-run behaviour\nIf `evals\u002Funit\u002F` already exists, **merge** — add tests for new features, preserve passing tests for existing ones. Never delete existing passing test files.\n\n### File layout\n\n```\nevals\u002Funit\u002F\n  helpers\u002F\n    setup.ts          → @testing-library\u002Fjest-dom matchers, global mocks\n    mocks.ts          → mockDataApi factory (vi.fn() for all 6 methods)\n    factories.ts      → createMock\u003CTableName>Row() helpers for Dataverse rows\n  \u003CFeature>.test.tsx  → one file per logical feature group\n```\n\n### evals\u002Funit\u002Fhelpers\u002Fsetup.ts\n\n```typescript\n\u002F\u002F evals\u002Funit\u002Fhelpers\u002Fsetup.ts\nimport '@testing-library\u002Fjest-dom';\nimport { vi } from 'vitest';\n\n\u002F\u002F Suppress FluentUI console warnings in tests\nvi.spyOn(console, 'warn').mockImplementation(() => {});\n```\n\n### evals\u002Funit\u002Fhelpers\u002Fmocks.ts\n\n```typescript\n\u002F\u002F evals\u002Funit\u002Fhelpers\u002Fmocks.ts\nimport { vi } from 'vitest';\n\n\u002F\u002F mockDataApi — the dataApi prop passed by Power Apps host, fully mocked\nexport function createMockDataApi() {\n  return {\n    queryTable: vi.fn().mockResolvedValue({ rows: [], hasMoreRows: false }),\n    retrieveRow: vi.fn().mockResolvedValue({}),\n    createRow: vi.fn().mockResolvedValue('new-row-id'),\n    updateRow: vi.fn().mockResolvedValue(undefined),\n    deleteRow: vi.fn().mockResolvedValue(undefined),\n    getChoices: vi.fn().mockResolvedValue([]),\n  };\n}\n```\n\n### evals\u002Funit\u002Fhelpers\u002Ffactories.ts\n\n> ⚠️ **CRITICAL:** Before writing this file, read the actual gen page source to find what fields each `dataApi.queryTable` result is used for. Factory fields must match the actual column names the component reads from rows. Never invent field names.\n\n```typescript\n\u002F\u002F evals\u002Funit\u002Fhelpers\u002Ffactories.ts\n\u002F\u002F Grounded in actual source: fields match what the component reads from dataApi results\n\n\u002F\u002F Example — replace with actual fields from source\nexport function createMockAccountRow(overrides: Partial\u003CRecord\u003Cstring, unknown>> = {}) {\n  return {\n    accountid: 'acc-001',\n    name: 'Contoso Ltd',\n    emailaddress1: 'info@contoso.com',\n    telephone1: '555-0100',\n    statecode: 0,\n    ...overrides,\n  };\n}\n```\n\n### Unit test template — per feature\n\n```typescript\n\u002F\u002F evals\u002Funit\u002F\u003Cfeature>.test.tsx\n\u002F\u002F Feature: \u003Cfeature title>\n\u002F\u002F Tests grounded in actual source: \u003Cgen page file name>\n\nimport { describe, it, expect, vi, beforeEach } from 'vitest';\nimport { render, screen, waitFor, fireEvent } from '@testing-library\u002Freact';\nimport { createMockDataApi } from '.\u002Fhelpers\u002Fmocks';\nimport { createMockAccountRow } from '.\u002Fhelpers\u002Ffactories';\n\n\u002F\u002F Import the default export from the gen page file\n\u002F\u002F Adjust path relative to evals\u002Funit\u002F — typically ..\u002F..\u002FPageName.tsx\nimport GeneratedComponent from '..\u002F..\u002F\u003CPageName>.tsx';\n\ndescribe('\u003Cfeature-id>', () => {\n  let dataApi: ReturnType\u003Ctypeof createMockDataApi>;\n\n  beforeEach(() => {\n    dataApi = createMockDataApi();\n  });\n\n  it('\u003Cfeature-id>: renders loading state while data fetches', async () => {\n    \u002F\u002F Delay resolution so we can catch the loading state\n    dataApi.queryTable.mockReturnValue(new Promise(() => {}));\n    render(\u003CGeneratedComponent dataApi={dataApi} \u002F>);\n    \u002F\u002F queryBy* returns null instead of throwing — safe to use with || fallback\n    \u002F\u002F Adjust selectors to match the actual loading indicator in the component\n    const loadingIndicator =\n      screen.queryByRole('progressbar') ??\n      screen.queryByText(\u002Floading\u002Fi) ??\n      screen.queryByLabelText(\u002Floading\u002Fi);\n    expect(loadingIndicator).toBeInTheDocument();\n  });\n\n  it('\u003Cfeature-id>: renders account rows returned by dataApi.queryTable', async () => {\n    const rows = [createMockAccountRow(), createMockAccountRow({ accountid: 'acc-002', name: 'Fabrikam Inc' })];\n    dataApi.queryTable.mockResolvedValue({ rows, hasMoreRows: false });\n    render(\u003CGeneratedComponent dataApi={dataApi} \u002F>);\n    await waitFor(() => {\n      expect(screen.getByText('Contoso Ltd')).toBeInTheDocument();\n      expect(screen.getByText('Fabrikam Inc')).toBeInTheDocument();\n    });\n  });\n\n  it('\u003Cfeature-id>: renders empty state when no rows returned', async () => {\n    dataApi.queryTable.mockResolvedValue({ rows: [], hasMoreRows: false });\n    render(\u003CGeneratedComponent dataApi={dataApi} \u002F>);\n    await waitFor(() => {\n      \u002F\u002F Adjust text to match actual empty-state message in the component\n      expect(screen.getByText(\u002Fno records|no data|no results\u002Fi)).toBeInTheDocument();\n    });\n  });\n\n  it('\u003Cfeature-id>: renders error state when dataApi.queryTable rejects', async () => {\n    dataApi.queryTable.mockRejectedValue(new Error('Dataverse unavailable'));\n    render(\u003CGeneratedComponent dataApi={dataApi} \u002F>);\n    await waitFor(() => {\n      \u002F\u002F Adjust to match actual error message shown in component (should be generic, not e.message)\n      expect(screen.getByText(\u002Ferror|failed|unable\u002Fi)).toBeInTheDocument();\n    });\n  });\n\n  it('\u003Cfeature-id>: calls dataApi.queryTable with correct table name and select columns', async () => {\n    dataApi.queryTable.mockResolvedValue({ rows: [], hasMoreRows: false });\n    render(\u003CGeneratedComponent dataApi={dataApi} \u002F>);\n    await waitFor(() => {\n      expect(dataApi.queryTable).toHaveBeenCalledWith(\n        'account',   \u002F\u002F table logical name — verify from source\n        expect.objectContaining({ select: expect.arrayContaining(['name']) })\n      );\n    });\n  });\n});\n```\n\n### it() naming convention — CRITICAL for dashboard traceability\n\nEvery `it()` description **MUST** begin with the exact feature `id` from `manifest.json`, followed by a colon:\n\n```typescript\nit('account-list: renders loading state while data fetches', ...)    \u002F\u002F ✅ correct\nit('account list: renders loading state', ...)                        \u002F\u002F ❌ wrong — space not hyphen\nit('renders loading state', ...)                                      \u002F\u002F ❌ wrong — no feature ID prefix\n```\n\nThe runner extracts the feature ID using `\u002F([\\w-]+):\\s*(.+)$\u002F` and uses it to map test results to dashboard rows. A mismatch causes tests to pass but show \"⏭ No tests\" per feature in the dashboard.\n\n### Post-generation verification (MANDATORY)\n\nAfter writing all test files, grep each test file for each manifest feature ID to confirm traceability:\n\n```\nFor each feature.id in manifest.json:\n  grep -c \"it\\('\" + feature.id + \":\" in evals\u002Funit\u002F**\u002F*.test.tsx\n  → If count === 0: traceability broken — fix the it() names before proceeding\n```\n\n---\n\n## Step 5b — Eval Package Setup\n\nThe gen page project may not have a `package.json` with test dependencies. Check:\n\n1. Does `PROJECT_DIR\u002Fpackage.json` exist?\n2. If yes, does it have `vitest`, `@testing-library\u002Freact`, `jsdom` in dev dependencies?\n3. If no to either: create or patch `package.json` with the minimal eval harness.\n\n### Minimal package.json for evals (create only if needed)\n\n```json\n{\n  \"name\": \"\u003Cproject-basename>-evals\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"eval\": \"tsx evals\u002Frunner\u002Frun-evals.ts\",\n    \"eval:presence\": \"tsx evals\u002Frunner\u002Fpresence-runner.ts\",\n    \"eval:security\": \"tsx evals\u002Frunner\u002Fsecurity-runner.ts\",\n    \"eval:unit\": \"vitest run --config evals\u002Fvitest.config.ts\"\n  },\n  \"devDependencies\": {\n    \"@testing-library\u002Fjest-dom\": \"^6.0.0\",\n    \"@testing-library\u002Freact\": \"^16.0.0\",\n    \"@fluentui\u002Freact-components\": \"^9.0.0\",\n    \"jsdom\": \"^25.0.0\",\n    \"react\": \"^17.0.0\",\n    \"react-dom\": \"^17.0.0\",\n    \"@types\u002Freact\": \"^17.0.0\",\n    \"@types\u002Freact-dom\": \"^17.0.0\",\n    \"tsx\": \"^4.0.0\",\n    \"vitest\": \"^2.0.0\",\n    \"glob\": \"^11.0.0\"\n  }\n}\n```\n\n> If `package.json` already exists, **append** only the missing dev dependencies and scripts — never overwrite existing ones.\n\nAfter writing `package.json`, run `npm install` to install dependencies.\n\n### evals\u002Fvitest.config.ts\n\n```typescript\n\u002F\u002F evals\u002Fvitest.config.ts\nimport { defineConfig } from 'vitest\u002Fconfig';\nimport { resolve, dirname } from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst PROJECT_ROOT = resolve(__dirname, '..');   \u002F\u002F evals\u002F → project root\n\nexport default defineConfig({\n  root: PROJECT_ROOT,   \u002F\u002F CRITICAL: anchors all paths to project root, not evals\u002F\n  test: {\n    environment: 'jsdom',\n    globals: true,\n    setupFiles: [resolve(__dirname, 'unit\u002Fhelpers\u002Fsetup.ts')],\n    include: ['evals\u002Funit\u002F**\u002F*.test.{ts,tsx}'],\n    reporters: ['json'],\n    outputFile: resolve(__dirname, 'results\u002Funit-results.json'),\n  },\n  resolve: {\n    alias: {\n      \u002F\u002F Allow tests to import from the project root without relative ..\u002F..\u002F\n      '@': PROJECT_ROOT,\n    },\n  },\n});\n```\n\n> ⚠️ `root: PROJECT_ROOT` is mandatory. Without it, Vitest defaults `root` to `evals\u002F`, causing all `setupFiles` and `include` paths to resolve from `evals\u002Fevals\u002F...` — a path that doesn't exist.\n\n---\n\n## Step 6 — Generate Security Runner\n\nWrite `evals\u002Frunner\u002Fsecurity-runner.ts`:\n\n```typescript\n#!\u002Fusr\u002Fbin\u002Fenv tsx\n\u002F\u002F evals\u002Frunner\u002Fsecurity-runner.ts\n\u002F\u002F Static security analysis for Power Apps Generative Pages\n\nimport { readFileSync } from 'fs';\nimport { join, dirname } from 'path';\nimport { fileURLToPath } from 'url';\nimport { globSync } from 'glob';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst ROOT = join(__dirname, '..', '..');   \u002F\u002F evals\u002Frunner → evals → project root\n\ntype Severity = 'critical' | 'high' | 'medium' | 'low';\n\ninterface SecurityFinding {\n  id: string; category: string; severity: Severity;\n  file: string; line: number; snippet: string; detail: string;\n}\n\ninterface SecurityResult {\n  layer: 'security';\n  passed: number; failed: number; skipped: number;\n  findings: SecurityFinding[];\n}\n\nconst findings: SecurityFinding[] = [];\n\u002F\u002F Scan all .tsx\u002F.ts files in the project (excluding evals\u002F itself)\nconst srcFiles = globSync(`${ROOT}\u002F**\u002F*.ts?(x)`, { ignore: `${ROOT}\u002Fevals\u002F**` });\n\nfunction scan(id: string, category: string, severity: Severity, pattern: RegExp, detail: string, exclude?: RegExp) {\n  for (const file of srcFiles) {\n    let content: string;\n    try { content = readFileSync(file, 'utf-8'); } catch { continue; }\n    const lines = content.split('\\n');\n    lines.forEach((line, i) => {\n      if (pattern.test(line) && !(exclude && exclude.test(line))) {\n        findings.push({ id, category, severity,\n          file: file.replace(ROOT + '\\\\', '').replace(ROOT + '\u002F', ''),\n          line: i + 1, snippet: line.trim().slice(0, 120), detail });\n      }\n    });\n  }\n}\n\n\u002F\u002F GP-SEC-001: OData Injection — filter string built from user input\nscan('GP-SEC-001', 'OData Injection', 'critical',\n  \u002Ffilter\\s*:\\s*[^,}]*['\"`]\\s*\\+|filter\\s*:\\s*[^,}]*\\$\\{\u002F,\n  'OData filter string built by concatenation or template literal. User input in filter strings is an injection risk. Use fixed filter strings or validate\u002Fsanitize inputs.');\n\n\u002F\u002F GP-SEC-002: XSS — dangerouslySetInnerHTML or .innerHTML\nscan('GP-SEC-002', 'XSS', 'critical',\n  \u002FdangerouslySetInnerHTML|\\.innerHTML\\s*=\u002F,\n  'Direct HTML injection. Use React text rendering or sanitize with DOMPurify. Fluent UI components handle escaping automatically — prefer those over raw HTML.');\n\n\u002F\u002F GP-SEC-003: Hardcoded secrets\n\u002F\u002F Exclude: (1) comment lines, (2) values that are purely alphabetical\u002Fkebab-case — real credentials\n\u002F\u002F always contain digits or special chars. This prevents false positives on TypeScript object maps\n\u002F\u002F where property keys like `token` hold UI label strings like 'skipToken' or 'badge-token'.\nscan('GP-SEC-003', 'Hardcoded Secret', 'critical',\n  \u002F(?:apikey|api_key|password|secret|token|client_secret)\\s*[:=]\\s*['\"`][^'\"`\\s]{6,}\u002Fi,\n  'Possible hardcoded credential in source. Move secrets to environment variables. In Generative Pages, use Dataverse environment variables or Azure Key Vault references.',\n  \u002F^\\s*\\\u002F\\\u002F|(?:apikey|api_key|password|secret|token|client_secret)\\s*[:=]\\s*['\"`][a-zA-Z$_][a-zA-Z$_\\-]*['\"`]\u002Fi);\n\n\u002F\u002F GP-SEC-004: PII in console logs\n\u002F\u002F Exclude: single-string-only console.log calls (e.g. \"Email field is required\") — UI messages, not variable dumps.\nscan('GP-SEC-004', 'PII in Logs', 'high',\n  \u002Fconsole\\.(log|warn|error|debug)\\b.*\\b(email|mail|userId|phone|address|password|token|DisplayName|firstname|lastname)\u002Fi,\n  'Sensitive data written to the browser console. Remove PII from log statements — model-driven app users can open DevTools.',\n  \u002Fconsole\\.(log|warn|error|debug)\\s*\\(\\s*(?:'[^']*'|\"[^\"]*\"|`[^`]*`)\\s*\\)\u002Fi);\n\n\u002F\u002F GP-SEC-005: Raw error surfaced to UI state\nscan('GP-SEC-005', 'Error Disclosure', 'high',\n  \u002Fset\\w+\\(\\s*(e\\.message|String\\(e\\)|e\\.toString\\(\\)|error\\.message)\u002F,\n  'Raw error message surfaced directly to UI state. Show a generic user-friendly message instead (e.g., \"Something went wrong. Please try again.\"). Technical details may reveal system internals.');\n\n\u002F\u002F GP-SEC-006: fetch() to non-Microsoft external URLs\nscan('GP-SEC-006', 'Unsafe fetch() Call', 'high',\n  \u002Ffetch\\s*\\(\\s*['\"`]https?:\\\u002F\\\u002F\u002F,\n  'fetch() to an external URL. Generative pages should use dataApi methods for all Dataverse operations. External fetch calls bypass Power Platform governance and connector policies.',\n  \u002F\\.dynamics\\.com|\\.microsoft\\.com|\\.microsoftonline\\.com|\\.sharepoint\\.com\u002F);\n\n\u002F\u002F GP-SEC-007: Client-side auth bypass\nscan('GP-SEC-007', 'Client-Side Auth Bypass', 'high',\n  \u002F\\b(isAdmin|userRole|hasPermission|canEdit|canDelete|isOwner)\\b.*&&.*dataApi\\.(create|update|delete)\u002Fi,\n  'Role check in UI code but no server-side guard before dataApi write. Power Apps security roles should be the authoritative gate — UI checks alone can be bypassed.');\n\n\u002F\u002F GP-SEC-008: PII in browser storage\n\u002F\u002F Removed bare 'user' — too generic (matches user-preferences, user-theme etc.)\nscan('GP-SEC-008', 'PII in Browser Storage', 'medium',\n  \u002F(localStorage|sessionStorage)\\.setItem\\s*\\([^,]*(?:email|userId|userEmail|userName|token|auth|authToken|mail|profile|password|DisplayName)\u002Fi,\n  'PII or auth data stored in localStorage\u002FsessionStorage. This data persists across sessions and is accessible to any script on the page. Use Dataverse or in-memory state instead.');\n\n\u002F\u002F GP-SEC-009: Unvalidated user input in dataApi filter\n\u002F\u002F Removed 'value' and 'text' — too generic.\nscan('GP-SEC-009', 'Unvalidated Input in Filter', 'medium',\n  \u002FdataApi\\.(queryTable|retrieveRow)\\s*\\([^)]*\\b(input|userInput|searchTerm|searchQuery|filterValue|rawInput)\\b\u002Fi,\n  'User input variable passed directly to dataApi query. Validate and sanitize before using in queries — while Dataverse has server-side guards, defence-in-depth is best practice.');\n\n\u002F\u002F GP-SEC-010: Sensitive data in React state\nscan('GP-SEC-010', 'Sensitive Data in State', 'low',\n  \u002FuseState[^)]*\\b(password|token|secret|apiKey|api_key)\\b\u002Fi,\n  'Sensitive data stored in React component state. State is accessible via React DevTools. Consider alternatives like Dataverse secure columns or environment variables.');\n\n\u002F\u002F GP-SEC-011: Dynamic code execution\nscan('GP-SEC-011', 'Dynamic Code Execution', 'critical',\n  \u002F\\beval\\s*\\(\u002F,\n  'eval() executes a string as code. If user-controlled content can reach this call, it is a code injection vulnerability. Replace with a safer pattern.');\n\nscan('GP-SEC-011', 'Dynamic Code Execution', 'critical',\n  \u002Fnew\\s+Function\\s*\\(\u002F,\n  'new Function() constructs executable code from a string — equivalent to eval(). Avoid or ensure the source string is never user-controlled.');\n\nscan('GP-SEC-011', 'Dynamic Code Execution', 'high',\n  \u002F(setTimeout|setInterval)\\s*\\(\\s*['\"`]\u002F,\n  'setTimeout\u002FsetInterval with a string argument evaluates it like eval(). Pass a function reference instead: setTimeout(() => doSomething(), delay).');\n\n\u002F\u002F GP-SEC-012: Broader external HTTP clients\nscan('GP-SEC-012', 'Unsafe External HTTP Client', 'high',\n  \u002Faxios\\s*\\.\\s*(get|post|put|patch|delete|request)\\s*\\(\\s*['\"`]https?:\\\u002F\\\u002F\u002Fi,\n  'axios call to an external URL. Use dataApi methods for Dataverse access. External HTTP calls bypass Power Platform governance.',\n  \u002F\\.dynamics\\.com|\\.microsoft\\.com|\\.microsoftonline\\.com\u002F);\n\nscan('GP-SEC-012', 'Unsafe External HTTP Client', 'high',\n  \u002Fnew\\s+XMLHttpRequest\\s*\\(\\s*\\)\u002F,\n  'XMLHttpRequest instantiation in a generative page. Dataverse access should always go through dataApi methods, not raw HTTP calls.');\n\n\u002F\u002F GP-SEC-013: Sensitive data in URL parameters\nscan('GP-SEC-013', 'Sensitive URL Parameters', 'high',\n  \u002FuseSearchParams[^;]*\\b(token|auth|apikey|secret|password|credential)\\b\u002Fi,\n  'Sensitive parameter read from URL query string. Tokens and credentials must never appear in URLs — they are logged by browsers, proxies, and servers.');\n\nscan('GP-SEC-013', 'Sensitive URL Parameters', 'high',\n  \u002F[?&](token|auth|apikey|api_key|secret|password|userId|user_id|credential)=\u002Fi,\n  'Sensitive parameter embedded in a URL string. Use Dataverse record context (props.recordId, props.entityName) for passing identifiers — never URL query strings.');\n\n\u002F\u002F GP-SEC-014: queryTable without select (excessive data retrieval)\nscan('GP-SEC-014', 'Excessive Data Retrieval', 'medium',\n  \u002FdataApi\\.queryTable\\s*\\(\\s*['\"`]\\w+['\"`]\\s*,\\s*\\{(?![^}]*select\\s*:)\u002F,\n  'dataApi.queryTable called without a select property — retrieves ALL columns from the table. This is a performance risk and may expose columns the UI does not need. Always specify select: [\\'col1\\', \\'col2\\'].');\n\nconst ALL_CATEGORIES = [\n  'GP-SEC-001','GP-SEC-002','GP-SEC-003','GP-SEC-004','GP-SEC-005','GP-SEC-006',\n  'GP-SEC-007','GP-SEC-008','GP-SEC-009','GP-SEC-010','GP-SEC-011','GP-SEC-012',\n  'GP-SEC-013','GP-SEC-014',\n];\n\nconst hitIds = new Set(findings.map(f => f.id));\nconst result: SecurityResult = {\n  layer: 'security',\n  passed: ALL_CATEGORIES.filter(c => !hitIds.has(c)).length,\n  failed: hitIds.size,\n  skipped: 0,\n  findings,\n};\nprocess.stdout.write(JSON.stringify(result));\n```\n\n---\n\n## Step 7 — Generate the Eval Runners\n\n### evals\u002Frunner\u002Fpresence-runner.ts\n\n```typescript\n#!\u002Fusr\u002Fbin\u002Fenv tsx\n\u002F\u002F evals\u002Frunner\u002Fpresence-runner.ts\n\nimport { join, dirname } from 'path';\nimport { fileURLToPath } from 'url';\nimport { pathToFileURL } from 'url';\nimport { globSync } from 'glob';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst PRESENCE_DIR = join(__dirname, '..', 'presence');\n\ninterface LayerResult {\n  layer: 'presence';\n  passed: number; failed: number; skipped: number;\n  details: Array\u003C{ featureId: string; name: string; status: 'pass' | 'fail' | 'skip'; detail?: string }>;\n}\n\nconst checkFiles = globSync(`${PRESENCE_DIR}\u002F*.check.ts`).sort();\nconst details: LayerResult['details'] = [];\nlet passed = 0, failed = 0;\n\nfor (const file of checkFiles) {\n  const mod = await import(pathToFileURL(file).href);\n  const result = mod.check();\n  for (const c of result.checks) {\n    const status = c.passed ? 'pass' : 'fail';\n    if (c.passed) passed++; else failed++;\n    details.push({ featureId: result.featureId, name: c.name, status, detail: c.detail });\n  }\n}\n\nconst output: LayerResult = { layer: 'presence', passed, failed, skipped: 0, details };\nprocess.stdout.write(JSON.stringify(output));\n```\n\n### evals\u002Frunner\u002Frun-evals.ts\n\n> ⚠️ CRITICAL: Copy the code below EXACTLY. Do not simplify or restructure.\n\n```typescript\n#!\u002Fusr\u002Fbin\u002Fenv tsx\n\u002F\u002F evals\u002Frunner\u002Frun-evals.ts\n\u002F\u002F Orchestrates all three eval layers and bakes results into the dashboard.\n\nimport { execSync, execFileSync } from 'child_process';\nimport { readFileSync, writeFileSync, mkdirSync, existsSync, copyFileSync } from 'fs';\nimport { join, dirname, resolve } from 'path';\nimport { fileURLToPath, pathToFileURL } from 'url';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst ROOT = join(__dirname, '..', '..');  \u002F\u002F evals\u002Frunner → evals → project root\nconst RESULTS_DIR = join(ROOT, 'evals', 'results');\nmkdirSync(RESULTS_DIR, { recursive: true });\n\nfunction run(cmd: string, label: string): string {\n  try {\n    return execSync(cmd, { cwd: ROOT, encoding: 'utf-8', stdio: 'pipe' });\n  } catch (e: any) {\n    \u002F\u002F Some runners exit 1 on findings (security) or failures (vitest) — capture output anyway\n    return e.stdout || e.output?.[1] || '';\n  }\n}\n\nconsole.log('▶ Running presence checks...');\nconst presOut = run('npx tsx evals\u002Frunner\u002Fpresence-runner.ts', 'presence');\n\nconsole.log('▶ Running unit tests...');\nconst unitRawOut = run('npx vitest run --config evals\u002Fvitest.config.ts --reporter=json', 'unit');\n\nconsole.log('▶ Running security scan...');\nconst secOut = run('npx tsx evals\u002Frunner\u002Fsecurity-runner.ts', 'security');\n\n\u002F\u002F Parse presence\nlet presLayer: any = { layer: 'presence', passed: 0, failed: 0, skipped: 0, details: [] };\ntry { presLayer = JSON.parse(presOut); } catch { console.warn('Could not parse presence output'); }\n\n\u002F\u002F Parse unit (Vitest JSON format)\nlet unitLayer: any = { layer: 'unit', passed: 0, failed: 0, skipped: 0, details: [] };\ntry {\n  const vitestJson = JSON.parse(unitRawOut);\n  const details: any[] = [];\n  let p = 0, f = 0, s = 0;\n  \u002F\u002F Vitest JSON: testResults[].assertionResults[]\n  for (const suite of vitestJson.testResults || []) {\n    for (const t of suite.assertionResults || []) {\n      const m = t.fullName?.match(\u002F([\\w-]+):\\s*(.+)$\u002F);\n      const featureId = m ? m[1] : 'unknown';\n      const name = t.fullName || t.title;\n      const status = t.status === 'passed' ? 'pass' : t.status === 'pending' ? 'skip' : 'fail';\n      const detail = t.failureMessages?.join('\\n').slice(0, 500) || undefined;\n      details.push({ featureId, name, status, detail });\n      if (status === 'pass') p++; else if (status === 'skip') s++; else f++;\n    }\n  }\n  unitLayer = { layer: 'unit', passed: p, failed: f, skipped: s, details };\n} catch { console.warn('Could not parse vitest output'); }\n\n\u002F\u002F Parse security\nlet secLayer: any = { layer: 'security', passed: 0, failed: 0, skipped: 0, findings: [] };\ntry { secLayer = JSON.parse(secOut); } catch { console.warn('Could not parse security output'); }\n\n\u002F\u002F Load manifest for feature count\nlet manifest: any = { features: [] };\nconst manifestPath = join(ROOT, 'evals', 'manifest.json');\ntry { manifest = JSON.parse(readFileSync(manifestPath, 'utf-8')); } catch {}\n\n\u002F\u002F Load snapshots for iteration history\nconst SNAP_DIR = join(RESULTS_DIR, 'snapshots');\nlet snapshots: any[] = [];\ntry {\n  const idx = JSON.parse(readFileSync(join(SNAP_DIR, 'index.json'), 'utf-8'));\n  snapshots = idx.map((s: any) => {\n    try { return JSON.parse(readFileSync(join(SNAP_DIR, s.file), 'utf-8')); } catch { return null; }\n  }).filter(Boolean);\n} catch {}\n\nconst timestamp = new Date().toISOString();\nconst evalResults = {\n  timestamp,\n  project: manifest.project || 'Generative Page',\n  iteration: snapshots.length + 1,\n  layers: [presLayer, unitLayer, secLayer],\n  snapshots,\n  summary: {\n    totalFeatures: manifest.features.length,\n    openBRDGaps: manifest.openBRDGaps || [],\n    blockers: manifest.blockers || [],\n    securityFindings: secLayer.findings || [],\n  },\n};\n\n\u002F\u002F Write latest.json\nwriteFileSync(join(RESULTS_DIR, 'latest.json'), JSON.stringify(evalResults, null, 2));\n\n\u002F\u002F Bake results into dashboard\nconst dashPath = join(ROOT, 'evals', 'dashboard', 'index.html');\nif (existsSync(dashPath)) {\n  let html = readFileSync(dashPath, 'utf-8');\n  const dataBlock = `\u002F* BAKED DATA — replaced by npm run eval — do not edit manually *\u002F\\nvar DATA = ${JSON.stringify(evalResults)};\\n\u002F* END BAKED DATA *\u002F`;\n  html = html.replace(\u002F\\\u002F\\* BAKED DATA[\\s\\S]*?END BAKED DATA \\*\\\u002F\u002Fm, dataBlock);\n  writeFileSync(dashPath, html);\n  console.log(`\\n✅ Dashboard updated: evals\u002Fdashboard\u002Findex.html`);\n}\n\n\u002F\u002F Summary\nconst totalFailed = presLayer.failed + unitLayer.failed;\nconsole.log(`\\nPresence: ${presLayer.passed} passed, ${presLayer.failed} failed`);\nconsole.log(`Unit:     ${unitLayer.passed} passed, ${unitLayer.failed} failed, ${unitLayer.skipped} todo`);\nconsole.log(`Security: ${secLayer.findings?.length || 0} findings`);\nif (totalFailed > 0) { console.error(`\\n❌ ${totalFailed} eval(s) failed.`); process.exit(1); }\nconsole.log('\\n✅ All evals passed.');\n```\n\n---\n\n## Step 8 — Generate the Dashboard\n\n### Step 8a — Read template\n\nRead the dashboard template from:\n```\npath: ~\u002F.copilot\u002Fm-skills\u002Feval-generator-gen-pages\u002Fdashboard-template.html\n```\n\nExpand `~` to the user's actual home directory. Use PowerShell if needed: `(Resolve-Path ~).Path`.\n\n### Step 8b — Adapt security categories for gen pages\n\nThe dashboard template's `CATEGORIES` array in `renderSecurity()` must be replaced with the gen-page-specific categories:\n\n```javascript\nvar CATEGORIES=[\n  {id:'GP-SEC-001',label:'OData Injection',          severity:'critical', what:'filter strings built from user input — injection risk for Dataverse queries'},\n  {id:'GP-SEC-002',label:'XSS',                      severity:'critical', what:'dangerouslySetInnerHTML or .innerHTML= — prefer Fluent UI components which escape automatically'},\n  {id:'GP-SEC-003',label:'Hardcoded Secret',          severity:'critical', what:'API keys, passwords, or tokens assigned as string literals in source'},\n  {id:'GP-SEC-004',label:'PII in Logs',               severity:'high',     what:'Sensitive fields (email, userId, DisplayName) written to the browser console'},\n  {id:'GP-SEC-005',label:'Error Disclosure',          severity:'high',     what:'Raw e.message or error.message surfaced directly to UI state'},\n  {id:'GP-SEC-006',label:'Unsafe fetch() Call',       severity:'high',     what:'fetch() to non-Microsoft URLs — use dataApi for all Dataverse operations'},\n  {id:'GP-SEC-007',label:'Client-Side Auth Bypass',   severity:'high',     what:'Role check in UI before dataApi write without a server-side guard'},\n  {id:'GP-SEC-008',label:'PII in Browser Storage',    severity:'medium',   what:'PII or auth data in localStorage\u002FsessionStorage — XSS-exfiltrable'},\n  {id:'GP-SEC-009',label:'Unvalidated Filter Input',  severity:'medium',   what:'User input variables in dataApi query options without sanitisation'},\n  {id:'GP-SEC-010',label:'Sensitive Data in State',   severity:'low',      what:'password, token, or secret held in React component state'},\n  {id:'GP-SEC-011',label:'Dynamic Code Execution',    severity:'critical', what:'eval(), new Function(), or setTimeout\u002FsetInterval with string argument'},\n  {id:'GP-SEC-012',label:'Unsafe External HTTP Client',severity:'high',    what:'axios, XMLHttpRequest calls to non-Microsoft URLs'},\n  {id:'GP-SEC-013',label:'Sensitive URL Parameters',  severity:'high',     what:'token\u002Fauth\u002Fsecret\u002FuserId exposed as URL query parameters'},\n  {id:'GP-SEC-014',label:'Excessive Data Retrieval',  severity:'medium',   what:'dataApi.queryTable without select — fetches ALL columns, performance + data exposure risk'},\n];\n```\n\n### Step 8c — Make exactly three substitutions in the template\n\n1. Replace every occurrence of `PROJECT_NAME` with the gen page file\u002Fdirectory name\n2. Replace `ITERATION_NUMBER` with the current iteration number\n3. Replace the FEATURES placeholder:\n   ```\n     \u002F* GENERATED — replace with actual features: { id, title, priority, note? } *\u002F\n   ```\n   with the actual feature array from the manifest:\n   ```javascript\n   { id: 'account-list', title: 'Account List', priority: 'high' },\n   { id: 'contact-detail', title: 'Contact Detail', priority: 'high' },\n   ```\n\n4. Replace the `CATEGORIES` array in `renderSecurity()` with the gen-page categories above.\n\n### Step 8d — Write `evals\u002Fdashboard\u002Findex.html`\n\n### Step 8e — Self-verify (THREE checks, all mandatory)\n\nAfter writing, verify all three:\n1. Grep for `fetch(` — if found: delete and repeat from 8a\n2. Grep for `FEATURES = [` → confirm next non-whitespace line is NOT `\u002F* GENERATED` — if placeholder present: delete and repeat\n3. Grep for `PROJECT_NAME` — if still present: delete and repeat\n\n---\n\n## Step 9 — Package.json Script\n\nEnsure `package.json` has these scripts (add if missing, never overwrite existing):\n\n```json\n{\n  \"scripts\": {\n    \"eval\": \"tsx evals\u002Frunner\u002Frun-evals.ts\",\n    \"eval:presence\": \"tsx evals\u002Frunner\u002Fpresence-runner.ts\",\n    \"eval:security\": \"tsx evals\u002Frunner\u002Fsecurity-runner.ts\",\n    \"eval:unit\": \"vitest run --config evals\u002Fvitest.config.ts\"\n  }\n}\n```\n\n---\n\n## Step 10 — Run Evals\n\nRun:\n```\nnpm run eval\n```\n\nfrom `PROJECT_DIR`. Capture output. If failures are reported, summarise them for the user with specific file and line references.\n\nAfter a successful run, tell the user to open `evals\u002Fdashboard\u002Findex.html` in their browser.\n\n---\n\n## Re-run Guard\n\nWhen `evals\u002F` already exists:\n\n| Artifact | Rule |\n|---|---|\n| `manifest.json` | Regenerated (may have new features from code changes) |\n| `presence\u002F*.check.ts` | Regenerated for all features |\n| `unit\u002Fhelpers\u002F` | Preserved — never overwritten |\n| `unit\u002F*.test.tsx` | **Merged** — add tests for new features, preserve passing tests |\n| `runner\u002F*.ts` | Regenerated |\n| `dashboard\u002Findex.html` | Regenerated (FEATURES + CATEGORIES updated) |\n| `results\u002Flatest.json` | Overwritten after snapshot |\n\n> ⚠️ Unit tests are **ALWAYS merged, never skipped** on re-runs. Any interpretation of \"merge\" as \"skip unit test generation\" is incorrect.\n\n---\n\n## Mandatory Checklist (verify before delivering)\n\n- [ ] `evals\u002Fmanifest.json` written with correct feature IDs\n- [ ] One `.check.ts` per feature in `evals\u002Fpresence\u002F`\n- [ ] `evals\u002Funit\u002Fhelpers\u002Fsetup.ts`, `mocks.ts`, `factories.ts` written\n- [ ] Factory fields grounded in actual source column names (never invented)\n- [ ] One `.test.tsx` per feature group in `evals\u002Funit\u002F`\n- [ ] Every `it()` name starts with exact `manifest.json` feature ID + colon\n- [ ] Post-generation grep confirms traceability for all feature IDs\n- [ ] `evals\u002Frunner\u002Fsecurity-runner.ts` written with GP-SEC-001 through GP-SEC-014\n- [ ] `evals\u002Frunner\u002Fpresence-runner.ts` and `run-evals.ts` written\n- [ ] `evals\u002Fvitest.config.ts` has `root: PROJECT_ROOT` set explicitly\n- [ ] `evals\u002Fdashboard\u002Findex.html` written, FEATURES substituted, CATEGORIES substituted\n- [ ] Dashboard self-verify: no `fetch(`, no placeholder, no `PROJECT_NAME`\n- [ ] `npm run eval` runs successfully (or failures reported to user)\n- [ ] Dashboard baked with real results\n\n---\n\n## Quality Rules\n\n1. **Never invent dataApi call patterns** — grep the actual source to confirm what tables and operations are used\n2. **Never reference Code App patterns** — no `power.config.json`, `src\u002Fgenerated\u002F`, `@microsoft\u002Fpower-apps`, `result.value`, `result.success`, `initialize()`\n3. **Never reference PCF patterns** — no `context.webAPI`, `context.parameters`, `ComponentFramework`\n4. **Factory fields must come from source** — read the `.tsx` file to see what fields the component accesses from rows before writing factories\n5. **Feature IDs are immutable** — once assigned in `manifest.json`, every downstream artifact must use them verbatim\n6. **Error handling in every dataApi call** — always generate presence checks that verify try\u002Fcatch exists\n7. **select: is always best practice** — flag absence of `select` in `queryTable` as GP-SEC-014\n\n---\n\n## Error Handling\n\n| Situation | Action |\n|---|---|\n| No `.tsx` file found | Ask user to confirm the path; offer to search recursively |\n| `@microsoft\u002Fpower-apps` found | Stop: redirect to `eval-generator-code-app` skill |\n| `ComponentFramework` found | Stop: this is a PCF component, wrong skill |\n| `npm install` fails | Show error; user may need to resolve peer deps manually |\n| `npm run eval` fails (unit) | Report specific test names and failure messages |\n| Dashboard FEATURES still shows placeholder after write | Delete and re-write; never deliver empty dashboard |\n| Feature ID mismatch detected in post-generation grep | Fix `it()` names before running evals |\n| evals\u002F already exists | Merge (never skip unit tests), snapshot first |\n","# Eval Generator — Power Apps Generative Pages\n\n## Purpose\n\nAnswer: **\"Is this Generative Page correctly structured, does the logic work, and are there security risks?\"**\n\nThree eval layers are always generated:\n1. **Presence** — static checks that assert code artifacts exist and follow Generative Page conventions\n2. **Unit** — Vitest tests for business logic using a mocked `dataApi`\n3. **Security** — static analysis across 14 security categories specific to gen page patterns\n\nAll three are mandatory.\n\n---\n\n## Generative Page Stack — Critical Assumptions\n\nGenerative Pages are **single-file React\u002FTypeScript components** embedded in Model-Driven Apps. They are NOT Code Apps, NOT PCF components. The architecture is fundamentally different from both.\n\n| Concern | Technology |\n|---|---|\n| Runtime | React 17 + TypeScript, compiled and hosted by Power Apps |\n| UI components | **Fluent UI V9** — `@fluentui\u002Freact-components` |\n| Data access | **`dataApi` prop** — passed into the component by the Power Apps host |\n| Data operations | `dataApi.queryTable()`, `dataApi.retrieveRow()`, `dataApi.createRow()`, `dataApi.updateRow()`, `dataApi.deleteRow()`, `dataApi.getChoices()` |\n| Data source | **Dataverse only** (up to 6 tables per page) |\n| Input params | `props.recordId`, `props.entityName`, `props.data` (optional, configured in page definition) |\n| File structure | **Single `.tsx` file** — `export default GeneratedComponent` |\n| Type generation | `pac model genpage generate-types` → local `*.d.ts` files |\n| Deployment | `pac model genpage upload` via PAC CLI |\n| Generated by | App Agent (make.powerapps.com) **or** AI code generation tools (Claude Code \u002F GitHub Copilot CLI with `\u002Fgenpage` skill) |\n| Package manager | npm (for local development and eval harness) |\n| Test runner | Vitest + @testing-library\u002Freact |\n\n> ⚠️ **NEVER look for**: `power.config.json`, `src\u002Fgenerated\u002Fservices\u002F`, `@microsoft\u002Fpower-apps`, `@microsoft\u002Fpowerapps-component-framework`, `context.webAPI.*`, `context.parameters`, `initialize()`, `PowerProvider`. These are Code App or PCF patterns — they do not exist in Generative Pages.\n\n> ⚠️ **ALWAYS look for**: `props.dataApi` or `dataApi` usage, `@fluentui\u002Freact-components` imports, `export default` component with React TSX, Dataverse operation patterns via `dataApi.*`.\n\n---\n\n## Step 0 — Snapshot Previous Results\n\n> **Run this first, before collecting inputs or writing any files.**\n\n1. Check if `evals\u002Fresults\u002Flatest.json` exists relative to the project directory.\n2. If it **does** exist:\n   - Read it.\n   - Count files matching `evals\u002Fresults\u002Fsnapshots\u002Fiter-*.json` to determine N (next iteration = count + 1).\n   - Write a copy to `evals\u002Fresults\u002Fsnapshots\u002Fiter-\u003CN>-\u003CISO-timestamp>.json`.\n   - Update `evals\u002Fresults\u002Fsnapshots\u002Findex.json` (create if absent, append if present).\n3. If it does **not** exist — skip silently. This is the first invocation.\n\n---\n\n## Step 0b — Collect Inputs\n\nAsk the user (via `m_ask_user` for structured choices) for:\n\n1. **Generative Page file or directory** — one of:\n   - Path to a single `.tsx` file (the gen page)\n   - Path to a directory containing one or more `.tsx` gen page files\n   - Current working directory (default if already in the right place)\n\n2. **Requirements document** — OPTIONAL. One of:\n   - Local file path (`.md`, `.txt`, `.docx`)\n   - OneDrive \u002F SharePoint URL\n   - Paste \u002F describe in chat\n   - **None \u002F Skip** — features will be derived from code review (Step 1b)\n\n3. **Eval output mode** (optional):\n   - `scaffold+write` — write all eval files into an `evals\u002F` directory (default ✅)\n   - `describe-only` — print what would be generated, no file writes\n\n> ⚠️ Ask ALL questions in a SINGLE `m_ask_user` call before doing any file work.\n\n**Determine project directory:** If user provided a single file, `PROJECT_DIR` = the file's parent directory. If a directory was given, `PROJECT_DIR` = that directory. All `evals\u002F` output goes into `PROJECT_DIR\u002Fevals\u002F`.\n\n---\n\n## Step 1 — Read Requirements Document (if provided)\n\n> **If no requirements document was provided, skip to Step 1b.**\n\n### Local `.md` or `.txt`\nUse the `view` tool.\n\n### Local `.docx`\nUse the `docx` skill. Call `m_get_skill('docx')` first.\n\n### OneDrive \u002F SharePoint URL\nUse `m365_download_file` (resolve file ID with `m365_search_files` first).\n\n---\n\n## Step 1b — Code-Review Fallback (No BRD)\n\n> **Run this step when no requirements document was provided, AND on every re-run.**\n\nRead all `.tsx` files in the project directory (non-recursively first, then `src\u002F` if present).\n\nFor each gen page file, use `view` and `grep` to identify:\n\n| Signal | Derived Feature |\n|---|---|\n| `dataApi.queryTable('tableName', ...)` | One feature per distinct `tableName` — data list\u002Fgrid |\n| `dataApi.retrieveRow('tableName', ...)` | Detail\u002Frecord view feature |\n| `dataApi.createRow('tableName', ...)` | Create\u002Fform feature |\n| `dataApi.updateRow('tableName', ...)` | Edit\u002Fupdate feature |\n| `dataApi.deleteRow('tableName', ...)` | Delete\u002Fremove feature |\n| `dataApi.getChoices(...)` | Choice field rendering feature |\n| `props.recordId` or `props.entityName` | Input parameter handling feature |\n| Named React sections \u002F major UI blocks | UI composition features (dashboards, cards, grids) |\n| `useState` \u002F `useEffect` clusters | State management features |\n| Localization \u002F translation dictionary | Localization feature |\n| `loadMoreRows` \u002F pagination | Pagination feature |\n| Filter\u002Fsearch inputs | Search\u002Ffilter feature |\n| Chart \u002F visualization components | Data visualization feature |\n\nSynthesize a feature entry per logical unit with `id`, `title`, `description`, `acceptance_criteria`, `priority`, and `tables` (Dataverse table names involved).\n\nSet `manifest.generatedFrom = \"code-review\"`.\n\n**Re-runs:** Repeat Step 1b to pick up new components or new dataApi calls. Match features by `id` — preserve `presence_status` for any existing `id`.\n\n---\n\n## Step 2 — Parse Requirements → Feature Manifest\n\nExtract a structured feature list from the requirements document (Step 1) **or** use the code-derived list from Step 1b.\n\nFor each feature, capture:\n- **id** — slugified identifier (e.g. `account-list`, `contact-detail`, `opportunity-create`)\n- **title** — short label\n- **description** — what the feature does\n- **acceptance_criteria** — array of verifiable statements\n- **priority** — `high` \u002F `medium` \u002F `low` (default `medium`)\n- **tables** — Dataverse table logical names involved (e.g. `[\"account\", \"contact\"]`)\n- **operations** — dataApi operations expected: `[\"queryTable\", \"retrieveRow\", \"createRow\"]`\n\nTrack in SQL:\n```sql\nCREATE TABLE IF NOT EXISTS features (\n  id TEXT PRIMARY KEY,\n  title TEXT,\n  description TEXT,\n  acceptance_criteria TEXT,\n  priority TEXT DEFAULT 'medium',\n  tables TEXT,\n  operations TEXT,\n  presence_status TEXT DEFAULT 'pending',\n  mapped_file TEXT\n);\n```\n\nWrite `evals\u002Fmanifest.json`:\n\n```json\n{\n  \"generated\": \"\u003CISO timestamp>\",\n  \"project\": \"\u003Cpage file name or directory basename>\",\n  \"generatedFrom\": \"brd | code-review\",\n  \"features\": [\n    {\n      \"id\": \"account-list\",\n      \"title\": \"Account List\",\n      \"description\": \"Display a paginated list of Account records using dataApi.queryTable\",\n      \"acceptance_criteria\": [\n        \"Calls dataApi.queryTable('account', { select: [...], pageSize: N })\",\n        \"Shows loading state while data fetches\",\n        \"Shows empty state when no records returned\",\n        \"Handles dataApi errors with a user-friendly message\"\n      ],\n      \"priority\": \"high\",\n      \"tables\": [\"account\"],\n      \"operations\": [\"queryTable\"],\n      \"layers\": { \"presence\": true, \"unit\": true }\n    }\n  ]\n}\n```\n\n---\n\n## Step 3 — Audit the Generative Page File(s)\n\n### 3a. Verify Generative Page structure\n\nUse `glob` and `view` to confirm:\n\n- At least one `.tsx` file exists with `export default` — the gen page component\n- The file imports from `@fluentui\u002Freact-components` (Fluent UI V9)\n- The component uses `props.dataApi` or destructures `dataApi` from props\n- The component does NOT import from `@microsoft\u002Fpower-apps` or `@microsoft\u002Fpowerapps-component-framework`\n\nIf `@microsoft\u002Fpower-apps` or `power.config.json` is found → stop and warn:\n> \"This appears to be a Code App, not a Generative Page. Use the `eval-generator-code-app` skill instead.\"\n\nIf `ComponentFramework` or `context.webAPI` is found → stop and warn:\n> \"This appears to be a PCF component. This skill only supports Power Apps Generative Pages.\"\n\n### 3b. Map the gen page structure\n\nUse `grep` on the `.tsx` file(s) to identify:\n\n| Pattern | Role |\n|---|---|\n| `export default function \\|export default const ` | Root component (required) |\n| `import { .* } from '@fluentui\u002Freact-components'` | Fluent UI V9 components in use |\n| `props\\.dataApi\\|const { dataApi }` | dataApi access pattern |\n| `dataApi\\.queryTable\\s*\\(` | Table query operations |\n| `dataApi\\.retrieveRow\\s*\\(` | Single record retrieval |\n| `dataApi\\.createRow\\s*\\(` | Record creation |\n| `dataApi\\.updateRow\\s*\\(` | Record update |\n| `dataApi\\.deleteRow\\s*\\(` | Record deletion |\n| `dataApi\\.getChoices\\s*\\(` | Choice column lookup |\n| `props\\.recordId\\|props\\.entityName\\|props\\.data` | Input parameter handling |\n| `hasMoreRows\\|loadMoreRows` | Pagination |\n| `useState.*[Ll]oading\\|isLoading` | Loading state |\n| `useState.*[Ee]rror\\|setError` | Error state |\n| `\\.length === 0\\|rows\\.length === 0` | Empty state |\n| `try\\s*{` | Error handling |\n| `useEffect\\s*\\(` | Side effects \u002F data fetching triggers |\n\nRecord matched line numbers in the SQL `features` table (`mapped_file`, `operations` columns).\n\n### 3c. Flag structural issues\n\nA feature is **Not Implemented** if its expected `dataApi.*` call is not found. Mark `presence_status = 'not_found'`.\n\nFlag these as warnings (not blockers) if found:\n- `dataApi.queryTable` called **without** a `select` array → performance risk (fetches all columns)\n- `dataApi.*` calls **outside** a `try\u002Fcatch` block → unhandled async errors\n- No loading state detected → poor UX\n- No empty state detected → poor UX\n\n---\n\n## Step 4 — Generate Presence Checks\n\nCreate `evals\u002Fpresence\u002F\u003Cfeature-id>.check.ts` for each feature.\n\n### Presence check template\n\n```typescript\n\u002F\u002F evals\u002Fpresence\u002F\u003Cfeature-id>.check.ts\n\u002F\u002F AUTO-GENERATED by eval-generator-gen-pages\n\u002F\u002F Feature: \u003Cfeature title>\n\u002F\u002F Description: \u003Cfeature description>\n\nimport { readFileSync, existsSync } from 'fs';\nimport { join, dirname } from 'path';\nimport { fileURLToPath } from 'url';\nimport { globSync } from 'glob';\n\n\u002F\u002F Path-anchored to this file's location — works correctly from any working directory\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst PROJECT_DIR = join(__dirname, '..', '..');  \u002F\u002F evals\u002Fpresence → evals → project dir\n\ninterface PresenceResult {\n  featureId: string;\n  checks: Array\u003C{ name: string; passed: boolean; detail?: string }>;\n}\n\nexport function check(): PresenceResult {\n  const checks: PresenceResult['checks'] = [];\n\n  \u002F\u002F Locate gen page .tsx files (non-recursive, then src\u002F if present)\n  const tsxFiles = [\n    ...globSync(`${PROJECT_DIR}\u002F*.tsx`),\n    ...globSync(`${PROJECT_DIR}\u002Fsrc\u002F**\u002F*.tsx`),\n  ];\n\n  if (tsxFiles.length === 0) {\n    checks.push({ name: 'gen page .tsx file exists', passed: false,\n      detail: 'No .tsx file found in project directory. Expected a generative page component file.' });\n    return { featureId: '\u003Cfeature-id>', checks };\n  }\n\n  const allSource = tsxFiles.map(f => readFileSync(f, 'utf-8')).join('\\n');\n\n  \u002F\u002F ── Check: dataApi is accessed ──\n  const dataApiUsed = \u002Fprops\\.dataApi|const\\s*\\{[^}]*dataApi\u002F.test(allSource);\n  checks.push({\n    name: 'dataApi prop accessed',\n    passed: dataApiUsed,\n    detail: dataApiUsed ? undefined : 'dataApi not found in props. Generative pages receive dataApi as a prop from the Power Apps host.',\n  });\n\n  \u002F\u002F ── Check: dataApi.queryTable called for this feature's table ──\n  const queryFound = \u002FdataApi\\.queryTable\\s*\\(\\s*['\"]\u003Ctable-name>['\"]\u002F.test(allSource);\n  checks.push({\n    name: 'dataApi.queryTable called for \u003Ctable-name>',\n    passed: queryFound,\n    detail: queryFound ? undefined : 'dataApi.queryTable(\"' + '\u003Ctable-name>' + '\", ...) not found. Feature may not be fetching data.',\n  });\n\n  \u002F\u002F ── Check: select columns specified (performance best practice) ──\n  const selectFound = \u002FdataApi\\.queryTable\\s*\\([^)]*select\\s*:\u002F.test(allSource);\n  checks.push({\n    name: 'select columns specified in queryTable (performance)',\n    passed: selectFound,\n    detail: selectFound ? undefined : 'queryTable called without select property — fetches ALL columns. Always specify select: [\\'col1\\', \\'col2\\'] for performance.',\n  });\n\n  \u002F\u002F ── Check: try\u002Fcatch around dataApi call ──\n  \u002F\u002F Strategy: find dataApi.queryTable and check for surrounding try block\n  const tryCatchFound = \u002Ftry\\s*\\{[^}]*dataApi\\.|dataApi\\.[^;]*;\\s*}\\s*catch\u002F.test(allSource.replace(\u002F\\n\u002Fg, ' '));\n  checks.push({\n    name: 'dataApi calls wrapped in try\u002Fcatch',\n    passed: tryCatchFound,\n    detail: tryCatchFound ? undefined : 'No try\u002Fcatch detected around dataApi calls. Unhandled promise rejections will crash the page.',\n  });\n\n  \u002F\u002F ── Check: loading state ──\n  const loadingState = \u002FuseState.*[Ll]oading|isLoading|isPending\u002F.test(allSource);\n  checks.push({\n    name: 'loading state handled',\n    passed: loadingState,\n    detail: loadingState ? undefined : 'No loading state found. Users see blank content while data fetches.',\n  });\n\n  \u002F\u002F ── Check: error state ──\n  const errorState = \u002FuseState.*[Ee]rror|setError|errorMessage\u002F.test(allSource);\n  checks.push({\n    name: 'error state handled',\n    passed: errorState,\n    detail: errorState ? undefined : 'No error state found. Connector failures will be silently swallowed.',\n  });\n\n  \u002F\u002F ── Check: empty state ──\n  const emptyState = \u002F\\.length\\s*===\\s*0|rows\\.length\\s*===\\s*0|!rows\\.length\u002F.test(allSource);\n  checks.push({\n    name: 'empty state handled',\n    passed: emptyState,\n    detail: emptyState ? undefined : 'No empty-state check found. An empty result set may render a blank or broken UI.',\n  });\n\n  \u002F\u002F ── Check: Fluent UI V9 imported ──\n  const fluentV9 = \u002F@fluentui\\\u002Freact-components\u002F.test(allSource);\n  checks.push({\n    name: 'Fluent UI V9 (@fluentui\u002Freact-components) imported',\n    passed: fluentV9,\n    detail: fluentV9 ? undefined : 'Fluent UI V9 not imported. Generative pages should use @fluentui\u002Freact-components for consistent MDA styling.',\n  });\n\n  return { featureId: '\u003Cfeature-id>', checks };\n}\n```\n\n### Generative Page-specific presence patterns\n\n| Feature type | Checks to generate |\n|---|---|\n| **Data list \u002F grid** | `dataApi.queryTable('tableName', {...})` called AND `select:` specified AND loading state AND empty state AND try\u002Fcatch |\n| **Detail \u002F single record** | `dataApi.retrieveRow('tableName', { id: ..., select: [...] })` AND input param (`props.recordId`) handled |\n| **Create form** | `dataApi.createRow('tableName', {...})` AND form validation AND submit disabled during save |\n| **Edit form** | `dataApi.updateRow('tableName', rowId, {...})` AND rowId sourced from `props.recordId` or state |\n| **Delete action** | `dataApi.deleteRow('tableName', rowId)` AND confirmation UI (dialog\u002Fbutton) AND error handling |\n| **Choice fields** | `dataApi.getChoices('tableName-columnName')` AND choices rendered as dropdown or display label |\n| **Input params** | `props.recordId`, `props.entityName`, or `props.data` destructured AND used in `useEffect` or initialization |\n| **Pagination** | `hasMoreRows` checked AND `loadMoreRows()` callable AND loading state for next-page fetch |\n| **Localization** | Translation dictionary or `useEffect` for language detection AND date\u002Fnumber locale formatting |\n| **Search \u002F filter** | Filter state connected to `dataApi.queryTable` `filter` option AND no raw user input in filter string |\n| **Data visualization** | Chart component found AND data mapped from `dataApi.queryTable` result |\n| **Error disclosure** | No `e.message` or `String(e)` set directly into user-visible state |\n\n> ⚠️ Never generate presence checks that grep for `context.webAPI`, `initialize()`, `PowerProvider`, `src\u002Fgenerated\u002F`, or `result.value` — these are Code App \u002F PCF patterns and will never appear in a Generative Page.\n\n---\n\n## Step 5 — Generate Vitest Unit Tests\n\n> ⛔ **This step is MANDATORY on every invocation.** Write real unit tests grounded in actual source code. Use `it.todo()` stubs only when a feature has no testable logic. Never skip this step — even on re-runs.\n\n### Re-run behaviour\nIf `evals\u002Funit\u002F` already exists, **merge** — add tests for new features, preserve passing tests for existing ones. Never delete existing passing test files.\n\n### File layout\n\n```\nevals\u002Funit\u002F\n  helpers\u002F\n    setup.ts          → @testing-library\u002Fjest-dom matchers, global mocks\n    mocks.ts          → mockDataApi factory (vi.fn() for all 6 methods)\n    factories.ts      → createMock\u003CTableName>Row() helpers for Dataverse rows\n  \u003CFeature>.test.tsx  → one file per logical feature group\n```\n\n### evals\u002Funit\u002Fhelpers\u002Fsetup.ts\n\n```typescript\n\u002F\u002F evals\u002Funit\u002Fhelpers\u002Fsetup.ts\nimport '@testing-library\u002Fjest-dom';\nimport { vi } from 'vitest';\n\n\u002F\u002F Suppress FluentUI console warnings in tests\nvi.spyOn(console, 'warn').mockImplementation(() => {});\n```\n\n### evals\u002Funit\u002Fhelpers\u002Fmocks.ts\n\n```typescript\n\u002F\u002F evals\u002Funit\u002Fhelpers\u002Fmocks.ts\nimport { vi } from 'vitest';\n\n\u002F\u002F mockDataApi — the dataApi prop passed by Power Apps host, fully mocked\nexport function createMockDataApi() {\n  return {\n    queryTable: vi.fn().mockResolvedValue({ rows: [], hasMoreRows: false }),\n    retrieveRow: vi.fn().mockResolvedValue({}),\n    createRow: vi.fn().mockResolvedValue('new-row-id'),\n    updateRow: vi.fn().mockResolvedValue(undefined),\n    deleteRow: vi.fn().mockResolvedValue(undefined),\n    getChoices: vi.fn().mockResolvedValue([]),\n  };\n}\n```\n\n### evals\u002Funit\u002Fhelpers\u002Ffactories.ts\n\n> ⚠️ **CRITICAL:** Before writing this file, read the actual gen page source to find what fields each `dataApi.queryTable` result is used for. Factory fields must match the actual column names the component reads from rows. Never invent field names.\n\n```typescript\n\u002F\u002F evals\u002Funit\u002Fhelpers\u002Ffactories.ts\n\u002F\u002F Grounded in actual source: fields match what the component reads from dataApi results\n\n\u002F\u002F Example — replace with actual fields from source\nexport function createMockAccountRow(overrides: Partial\u003CRecord\u003Cstring, unknown>> = {}) {\n  return {\n    accountid: 'acc-001',\n    name: 'Contoso Ltd',\n    emailaddress1: 'info@contoso.com',\n    telephone1: '555-0100',\n    statecode: 0,\n    ...overrides,\n  };\n}\n```\n\n### Unit test template — per feature\n\n```typescript\n\u002F\u002F evals\u002Funit\u002F\u003Cfeature>.test.tsx\n\u002F\u002F Feature: \u003Cfeature title>\n\u002F\u002F Tests grounded in actual source: \u003Cgen page file name>\n\nimport { describe, it, expect, vi, beforeEach } from 'vitest';\nimport { render, screen, waitFor, fireEvent } from '@testing-library\u002Freact';\nimport { createMockDataApi } from '.\u002Fhelpers\u002Fmocks';\nimport { createMockAccountRow } from '.\u002Fhelpers\u002Ffactories';\n\n\u002F\u002F Import the default export from the gen page file\n\u002F\u002F Adjust path relative to evals\u002Funit\u002F — typically ..\u002F..\u002FPageName.tsx\nimport GeneratedComponent from '..\u002F..\u002F\u003CPageName>.tsx';\n\ndescribe('\u003Cfeature-id>', () => {\n  let dataApi: ReturnType\u003Ctypeof createMockDataApi>;\n\n  beforeEach(() => {\n    dataApi = createMockDataApi();\n  });\n\n  it('\u003Cfeature-id>: renders loading state while data fetches', async () => {\n    \u002F\u002F Delay resolution so we can catch the loading state\n    dataApi.queryTable.mockReturnValue(new Promise(() => {}));\n    render(\u003CGeneratedComponent dataApi={dataApi} \u002F>);\n    \u002F\u002F queryBy* returns null instead of throwing — safe to use with || fallback\n    \u002F\u002F Adjust selectors to match the actual loading indicator in the component\n    const loadingIndicator =\n      screen.queryByRole('progressbar') ??\n      screen.queryByText(\u002Floading\u002Fi) ??\n      screen.queryByLabelText(\u002Floading\u002Fi);\n    expect(loadingIndicator).toBeInTheDocument();\n  });\n\n  it('\u003Cfeature-id>: renders account rows returned by dataApi.queryTable', async () => {\n    const rows = [createMockAccountRow(), createMockAccountRow({ accountid: 'acc-002', name: 'Fabrikam Inc' })];\n    dataApi.queryTable.mockResolvedValue({ rows, hasMoreRows: false });\n    render(\u003CGeneratedComponent dataApi={dataApi} \u002F>);\n    await waitFor(() => {\n      expect(screen.getByText('Contoso Ltd')).toBeInTheDocument();\n      expect(screen.getByText('Fabrikam Inc')).toBeInTheDocument();\n    });\n  });\n\n  it('\u003Cfeature-id>: renders empty state when no rows returned', async () => {\n    dataApi.queryTable.mockResolvedValue({ rows: [], hasMoreRows: false });\n    render(\u003CGeneratedComponent dataApi={dataApi} \u002F>);\n    await waitFor(() => {\n      \u002F\u002F Adjust text to match actual empty-state message in the component\n      expect(screen.getByText(\u002Fno records|no data|no results\u002Fi)).toBeInTheDocument();\n    });\n  });\n\n  it('\u003Cfeature-id>: renders error state when dataApi.queryTable rejects', async () => {\n    dataApi.queryTable.mockRejectedValue(new Error('Dataverse unavailable'));\n    render(\u003CGeneratedComponent dataApi={dataApi} \u002F>);\n    await waitFor(() => {\n      \u002F\u002F Adjust to match actual error message shown in component (should be generic, not e.message)\n      expect(screen.getByText(\u002Ferror|failed|unable\u002Fi)).toBeInTheDocument();\n    });\n  });\n\n  it('\u003Cfeature-id>: calls dataApi.queryTable with correct table name and select columns', async () => {\n    dataApi.queryTable.mockResolvedValue({ rows: [], hasMoreRows: false });\n    render(\u003CGeneratedComponent dataApi={dataApi} \u002F>);\n    await waitFor(() => {\n      expect(dataApi.queryTable).toHaveBeenCalledWith(\n        'account',   \u002F\u002F table logical name — verify from source\n        expect.objectContaining({ select: expect.arrayContaining(['name']) })\n      );\n    });\n  });\n});\n```\n\n### it() naming convention — CRITICAL for dashboard traceability\n\nEvery `it()` description **MUST** begin with the exact feature `id` from `manifest.json`, followed by a colon:\n\n```typescript\nit('account-list: renders loading state while data fetches', ...)    \u002F\u002F ✅ correct\nit('account list: renders loading state', ...)                        \u002F\u002F ❌ wrong — space not hyphen\nit('renders loading state', ...)                                      \u002F\u002F ❌ wrong — no feature ID prefix\n```\n\nThe runner extracts the feature ID using `\u002F([\\w-]+):\\s*(.+)$\u002F` and uses it to map test results to dashboard rows. A mismatch causes tests to pass but show \"⏭ No tests\" per feature in the dashboard.\n\n### Post-generation verification (MANDATORY)\n\nAfter writing all test files, grep each test file for each manifest feature ID to confirm traceability:\n\n```\nFor each feature.id in manifest.json:\n  grep -c \"it\\('\" + feature.id + \":\" in evals\u002Funit\u002F**\u002F*.test.tsx\n  → If count === 0: traceability broken — fix the it() names before proceeding\n```\n\n---\n\n## Step 5b — Eval Package Setup\n\nThe gen page project may not have a `package.json` with test dependencies. Check:\n\n1. Does `PROJECT_DIR\u002Fpackage.json` exist?\n2. If yes, does it have `vitest`, `@testing-library\u002Freact`, `jsdom` in dev dependencies?\n3. If no to either: create or patch `package.json` with the minimal eval harness.\n\n### Minimal package.json for evals (create only if needed)\n\n```json\n{\n  \"name\": \"\u003Cproject-basename>-evals\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"scripts\": {\n    \"eval\": \"tsx evals\u002Frunner\u002Frun-evals.ts\",\n    \"eval:presence\": \"tsx evals\u002Frunner\u002Fpresence-runner.ts\",\n    \"eval:security\": \"tsx evals\u002Frunner\u002Fsecurity-runner.ts\",\n    \"eval:unit\": \"vitest run --config evals\u002Fvitest.config.ts\"\n  },\n  \"devDependencies\": {\n    \"@testing-library\u002Fjest-dom\": \"^6.0.0\",\n    \"@testing-library\u002Freact\": \"^16.0.0\",\n    \"@fluentui\u002Freact-components\": \"^9.0.0\",\n    \"jsdom\": \"^25.0.0\",\n    \"react\": \"^17.0.0\",\n    \"react-dom\": \"^17.0.0\",\n    \"@types\u002Freact\": \"^17.0.0\",\n    \"@types\u002Freact-dom\": \"^17.0.0\",\n    \"tsx\": \"^4.0.0\",\n    \"vitest\": \"^2.0.0\",\n    \"glob\": \"^11.0.0\"\n  }\n}\n```\n\n> If `package.json` already exists, **append** only the missing dev dependencies and scripts — never overwrite existing ones.\n\nAfter writing `package.json`, run `npm install` to install dependencies.\n\n### evals\u002Fvitest.config.ts\n\n```typescript\n\u002F\u002F evals\u002Fvitest.config.ts\nimport { defineConfig } from 'vitest\u002Fconfig';\nimport { resolve, dirname } from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst PROJECT_ROOT = resolve(__dirname, '..');   \u002F\u002F evals\u002F → project root\n\nexport default defineConfig({\n  root: PROJECT_ROOT,   \u002F\u002F CRITICAL: anchors all paths to project root, not evals\u002F\n  test: {\n    environment: 'jsdom',\n    globals: true,\n    setupFiles: [resolve(__dirname, 'unit\u002Fhelpers\u002Fsetup.ts')],\n    include: ['evals\u002Funit\u002F**\u002F*.test.{ts,tsx}'],\n    reporters: ['json'],\n    outputFile: resolve(__dirname, 'results\u002Funit-results.json'),\n  },\n  resolve: {\n    alias: {\n      \u002F\u002F Allow tests to import from the project root without relative ..\u002F..\u002F\n      '@': PROJECT_ROOT,\n    },\n  },\n});\n```\n\n> ⚠️ `root: PROJECT_ROOT` is mandatory. Without it, Vitest defaults `root` to `evals\u002F`, causing all `setupFiles` and `include` paths to resolve from `evals\u002Fevals\u002F...` — a path that doesn't exist.\n\n---\n\n## Step 6 — Generate Security Runner\n\nWrite `evals\u002Frunner\u002Fsecurity-runner.ts`:\n\n```typescript\n#!\u002Fusr\u002Fbin\u002Fenv tsx\n\u002F\u002F evals\u002Frunner\u002Fsecurity-runner.ts\n\u002F\u002F Static security analysis for Power Apps Generative Pages\n\nimport { readFileSync } from 'fs';\nimport { join, dirname } from 'path';\nimport { fileURLToPath } from 'url';\nimport { globSync } from 'glob';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst ROOT = join(__dirname, '..', '..');   \u002F\u002F evals\u002Frunner → evals → project root\n\ntype Severity = 'critical' | 'high' | 'medium' | 'low';\n\ninterface SecurityFinding {\n  id: string; category: string; severity: Severity;\n  file: string; line: number; snippet: string; detail: string;\n}\n\ninterface SecurityResult {\n  layer: 'security';\n  passed: number; failed: number; skipped: number;\n  findings: SecurityFinding[];\n}\n\nconst findings: SecurityFinding[] = [];\n\u002F\u002F Scan all .tsx\u002F.ts files in the project (excluding evals\u002F itself)\nconst srcFiles = globSync(`${ROOT}\u002F**\u002F*.ts?(x)`, { ignore: `${ROOT}\u002Fevals\u002F**` });\n\nfunction scan(id: string, category: string, severity: Severity, pattern: RegExp, detail: string, exclude?: RegExp) {\n  for (const file of srcFiles) {\n    let content: string;\n    try { content = readFileSync(file, 'utf-8'); } catch { continue; }\n    const lines = content.split('\\n');\n    lines.forEach((line, i) => {\n      if (pattern.test(line) && !(exclude && exclude.test(line))) {\n        findings.push({ id, category, severity,\n          file: file.replace(ROOT + '\\\\', '').replace(ROOT + '\u002F', ''),\n          line: i + 1, snippet: line.trim().slice(0, 120), detail });\n      }\n    });\n  }\n}\n\n\u002F\u002F GP-SEC-001: OData Injection — filter string built from user input\nscan('GP-SEC-001', 'OData Injection', 'critical',\n  \u002Ffilter\\s*:\\s*[^,}]*['\"`]\\s*\\+|filter\\s*:\\s*[^,}]*\\$\\{\u002F,\n  'OData filter string built by concatenation or template literal. User input in filter strings is an injection risk. Use fixed filter strings or validate\u002Fsanitize inputs.');\n\n\u002F\u002F GP-SEC-002: XSS — dangerouslySetInnerHTML or .innerHTML\nscan('GP-SEC-002', 'XSS', 'critical',\n  \u002FdangerouslySetInnerHTML|\\.innerHTML\\s*=\u002F,\n  'Direct HTML injection. Use React text rendering or sanitize with DOMPurify. Fluent UI components handle escaping automatically — prefer those over raw HTML.');\n\n\u002F\u002F GP-SEC-003: Hardcoded secrets\n\u002F\u002F Exclude: (1) comment lines, (2) values that are purely alphabetical\u002Fkebab-case — real credentials\n\u002F\u002F always contain digits or special chars. This prevents false positives on TypeScript object maps\n\u002F\u002F where property keys like `token` hold UI label strings like 'skipToken' or 'badge-token'.\nscan('GP-SEC-003', 'Hardcoded Secret', 'critical',\n  \u002F(?:apikey|api_key|password|secret|token|client_secret)\\s*[:=]\\s*['\"`][^'\"`\\s]{6,}\u002Fi,\n  'Possible hardcoded credential in source. Move secrets to environment variables. In Generative Pages, use Dataverse environment variables or Azure Key Vault references.',\n  \u002F^\\s*\\\u002F\\\u002F|(?:apikey|api_key|password|secret|token|client_secret)\\s*[:=]\\s*['\"`][a-zA-Z$_][a-zA-Z$_\\-]*['\"`]\u002Fi);\n\n\u002F\u002F GP-SEC-004: PII in console logs\n\u002F\u002F Exclude: single-string-only console.log calls (e.g. \"Email field is required\") — UI messages, not variable dumps.\nscan('GP-SEC-004', 'PII in Logs', 'high',\n  \u002Fconsole\\.(log|warn|error|debug)\\b.*\\b(email|mail|userId|phone|address|password|token|DisplayName|firstname|lastname)\u002Fi,\n  'Sensitive data written to the browser console. Remove PII from log statements — model-driven app users can open DevTools.',\n  \u002Fconsole\\.(log|warn|error|debug)\\s*\\(\\s*(?:'[^']*'|\"[^\"]*\"|`[^`]*`)\\s*\\)\u002Fi);\n\n\u002F\u002F GP-SEC-005: Raw error surfaced to UI state\nscan('GP-SEC-005', 'Error Disclosure', 'high',\n  \u002Fset\\w+\\(\\s*(e\\.message|String\\(e\\)|e\\.toString\\(\\)|error\\.message)\u002F,\n  'Raw error message surfaced directly to UI state. Show a generic user-friendly message instead (e.g., \"Something went wrong. Please try again.\"). Technical details may reveal system internals.');\n\n\u002F\u002F GP-SEC-006: fetch() to non-Microsoft external URLs\nscan('GP-SEC-006', 'Unsafe fetch() Call', 'high',\n  \u002Ffetch\\s*\\(\\s*['\"`]https?:\\\u002F\\\u002F\u002F,\n  'fetch() to an external URL. Generative pages should use dataApi methods for all Dataverse operations. External fetch calls bypass Power Platform governance and connector policies.',\n  \u002F\\.dynamics\\.com|\\.microsoft\\.com|\\.microsoftonline\\.com|\\.sharepoint\\.com\u002F);\n\n\u002F\u002F GP-SEC-007: Client-side auth bypass\nscan('GP-SEC-007', 'Client-Side Auth Bypass', 'high',\n  \u002F\\b(isAdmin|userRole|hasPermission|canEdit|canDelete|isOwner)\\b.*&&.*dataApi\\.(create|update|delete)\u002Fi,\n  'Role check in UI code but no server-side guard before dataApi write. Power Apps security roles should be the authoritative gate — UI checks alone can be bypassed.');\n\n\u002F\u002F GP-SEC-008: PII in browser storage\n\u002F\u002F Removed bare 'user' — too generic (matches user-preferences, user-theme etc.)\nscan('GP-SEC-008', 'PII in Browser Storage', 'medium',\n  \u002F(localStorage|sessionStorage)\\.setItem\\s*\\([^,]*(?:email|userId|userEmail|userName|token|auth|authToken|mail|profile|password|DisplayName)\u002Fi,\n  'PII or auth data stored in localStorage\u002FsessionStorage. This data persists across sessions and is accessible to any script on the page. Use Dataverse or in-memory state instead.');\n\n\u002F\u002F GP-SEC-009: Unvalidated user input in dataApi filter\n\u002F\u002F Removed 'value' and 'text' — too generic.\nscan('GP-SEC-009', 'Unvalidated Input in Filter', 'medium',\n  \u002FdataApi\\.(queryTable|retrieveRow)\\s*\\([^)]*\\b(input|userInput|searchTerm|searchQuery|filterValue|rawInput)\\b\u002Fi,\n  'User input variable passed directly to dataApi query. Validate and sanitize before using in queries — while Dataverse has server-side guards, defence-in-depth is best practice.');\n\n\u002F\u002F GP-SEC-010: Sensitive data in React state\nscan('GP-SEC-010', 'Sensitive Data in State', 'low',\n  \u002FuseState[^)]*\\b(password|token|secret|apiKey|api_key)\\b\u002Fi,\n  'Sensitive data stored in React component state. State is accessible via React DevTools. Consider alternatives like Dataverse secure columns or environment variables.');\n\n\u002F\u002F GP-SEC-011: Dynamic code execution\nscan('GP-SEC-011', 'Dynamic Code Execution', 'critical',\n  \u002F\\beval\\s*\\(\u002F,\n  'eval() executes a string as code. If user-controlled content can reach this call, it is a code injection vulnerability. Replace with a safer pattern.');\n\nscan('GP-SEC-011', 'Dynamic Code Execution', 'critical',\n  \u002Fnew\\s+Function\\s*\\(\u002F,\n  'new Function() constructs executable code from a string — equivalent to eval(). Avoid or ensure the source string is never user-controlled.');\n\nscan('GP-SEC-011', 'Dynamic Code Execution', 'high',\n  \u002F(setTimeout|setInterval)\\s*\\(\\s*['\"`]\u002F,\n  'setTimeout\u002FsetInterval with a string argument evaluates it like eval(). Pass a function reference instead: setTimeout(() => doSomething(), delay).');\n\n\u002F\u002F GP-SEC-012: Broader external HTTP clients\nscan('GP-SEC-012', 'Unsafe External HTTP Client', 'high',\n  \u002Faxios\\s*\\.\\s*(get|post|put|patch|delete|request)\\s*\\(\\s*['\"`]https?:\\\u002F\\\u002F\u002Fi,\n  'axios call to an external URL. Use dataApi methods for Dataverse access. External HTTP calls bypass Power Platform governance.',\n  \u002F\\.dynamics\\.com|\\.microsoft\\.com|\\.microsoftonline\\.com\u002F);\n\nscan('GP-SEC-012', 'Unsafe External HTTP Client', 'high',\n  \u002Fnew\\s+XMLHttpRequest\\s*\\(\\s*\\)\u002F,\n  'XMLHttpRequest instantiation in a generative page. Dataverse access should always go through dataApi methods, not raw HTTP calls.');\n\n\u002F\u002F GP-SEC-013: Sensitive data in URL parameters\nscan('GP-SEC-013', 'Sensitive URL Parameters', 'high',\n  \u002FuseSearchParams[^;]*\\b(token|auth|apikey|secret|password|credential)\\b\u002Fi,\n  'Sensitive parameter read from URL query string. Tokens and credentials must never appear in URLs — they are logged by browsers, proxies, and servers.');\n\nscan('GP-SEC-013', 'Sensitive URL Parameters', 'high',\n  \u002F[?&](token|auth|apikey|api_key|secret|password|userId|user_id|credential)=\u002Fi,\n  'Sensitive parameter embedded in a URL string. Use Dataverse record context (props.recordId, props.entityName) for passing identifiers — never URL query strings.');\n\n\u002F\u002F GP-SEC-014: queryTable without select (excessive data retrieval)\nscan('GP-SEC-014', 'Excessive Data Retrieval', 'medium',\n  \u002FdataApi\\.queryTable\\s*\\(\\s*['\"`]\\w+['\"`]\\s*,\\s*\\{(?![^}]*select\\s*:)\u002F,\n  'dataApi.queryTable called without a select property — retrieves ALL columns from the table. This is a performance risk and may expose columns the UI does not need. Always specify select: [\\'col1\\', \\'col2\\'].');\n\nconst ALL_CATEGORIES = [\n  'GP-SEC-001','GP-SEC-002','GP-SEC-003','GP-SEC-004','GP-SEC-005','GP-SEC-006',\n  'GP-SEC-007','GP-SEC-008','GP-SEC-009','GP-SEC-010','GP-SEC-011','GP-SEC-012',\n  'GP-SEC-013','GP-SEC-014',\n];\n\nconst hitIds = new Set(findings.map(f => f.id));\nconst result: SecurityResult = {\n  layer: 'security',\n  passed: ALL_CATEGORIES.filter(c => !hitIds.has(c)).length,\n  failed: hitIds.size,\n  skipped: 0,\n  findings,\n};\nprocess.stdout.write(JSON.stringify(result));\n```\n\n---\n\n## Step 7 — Generate the Eval Runners\n\n### evals\u002Frunner\u002Fpresence-runner.ts\n\n```typescript\n#!\u002Fusr\u002Fbin\u002Fenv tsx\n\u002F\u002F evals\u002Frunner\u002Fpresence-runner.ts\n\nimport { join, dirname } from 'path';\nimport { fileURLToPath } from 'url';\nimport { pathToFileURL } from 'url';\nimport { globSync } from 'glob';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst PRESENCE_DIR = join(__dirname, '..', 'presence');\n\ninterface LayerResult {\n  layer: 'presence';\n  passed: number; failed: number; skipped: number;\n  details: Array\u003C{ featureId: string; name: string; status: 'pass' | 'fail' | 'skip'; detail?: string }>;\n}\n\nconst checkFiles = globSync(`${PRESENCE_DIR}\u002F*.check.ts`).sort();\nconst details: LayerResult['details'] = [];\nlet passed = 0, failed = 0;\n\nfor (const file of checkFiles) {\n  const mod = await import(pathToFileURL(file).href);\n  const result = mod.check();\n  for (const c of result.checks) {\n    const status = c.passed ? 'pass' : 'fail';\n    if (c.passed) passed++; else failed++;\n    details.push({ featureId: result.featureId, name: c.name, status, detail: c.detail });\n  }\n}\n\nconst output: LayerResult = { layer: 'presence', passed, failed, skipped: 0, details };\nprocess.stdout.write(JSON.stringify(output));\n```\n\n### evals\u002Frunner\u002Frun-evals.ts\n\n> ⚠️ CRITICAL: Copy the code below EXACTLY. Do not simplify or restructure.\n\n```typescript\n#!\u002Fusr\u002Fbin\u002Fenv tsx\n\u002F\u002F evals\u002Frunner\u002Frun-evals.ts\n\u002F\u002F Orchestrates all three eval layers and bakes results into the dashboard.\n\nimport { execSync, execFileSync } from 'child_process';\nimport { readFileSync, writeFileSync, mkdirSync, existsSync, copyFileSync } from 'fs';\nimport { join, dirname, resolve } from 'path';\nimport { fileURLToPath, pathToFileURL } from 'url';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst ROOT = join(__dirname, '..', '..');  \u002F\u002F evals\u002Frunner → evals → project root\nconst RESULTS_DIR = join(ROOT, 'evals', 'results');\nmkdirSync(RESULTS_DIR, { recursive: true });\n\nfunction run(cmd: string, label: string): string {\n  try {\n    return execSync(cmd, { cwd: ROOT, encoding: 'utf-8', stdio: 'pipe' });\n  } catch (e: any) {\n    \u002F\u002F Some runners exit 1 on findings (security) or failures (vitest) — capture output anyway\n    return e.stdout || e.output?.[1] || '';\n  }\n}\n\nconsole.log('▶ Running presence checks...');\nconst presOut = run('npx tsx evals\u002Frunner\u002Fpresence-runner.ts', 'presence');\n\nconsole.log('▶ Running unit tests...');\nconst unitRawOut = run('npx vitest run --config evals\u002Fvitest.config.ts --reporter=json', 'unit');\n\nconsole.log('▶ Running security scan...');\nconst secOut = run('npx tsx evals\u002Frunner\u002Fsecurity-runner.ts', 'security');\n\n\u002F\u002F Parse presence\nlet presLayer: any = { layer: 'presence', passed: 0, failed: 0, skipped: 0, details: [] };\ntry { presLayer = JSON.parse(presOut); } catch { console.warn('Could not parse presence output'); }\n\n\u002F\u002F Parse unit (Vitest JSON format)\nlet unitLayer: any = { layer: 'unit', passed: 0, failed: 0, skipped: 0, details: [] };\ntry {\n  const vitestJson = JSON.parse(unitRawOut);\n  const details: any[] = [];\n  let p = 0, f = 0, s = 0;\n  \u002F\u002F Vitest JSON: testResults[].assertionResults[]\n  for (const suite of vitestJson.testResults || []) {\n    for (const t of suite.assertionResults || []) {\n      const m = t.fullName?.match(\u002F([\\w-]+):\\s*(.+)$\u002F);\n      const featureId = m ? m[1] : 'unknown';\n      const name = t.fullName || t.title;\n      const status = t.status === 'passed' ? 'pass' : t.status === 'pending' ? 'skip' : 'fail';\n      const detail = t.failureMessages?.join('\\n').slice(0, 500) || undefined;\n      details.push({ featureId, name, status, detail });\n      if (status === 'pass') p++; else if (status === 'skip') s++; else f++;\n    }\n  }\n  unitLayer = { layer: 'unit', passed: p, failed: f, skipped: s, details };\n} catch { console.warn('Could not parse vitest output'); }\n\n\u002F\u002F Parse security\nlet secLayer: any = { layer: 'security', passed: 0, failed: 0, skipped: 0, findings: [] };\ntry { secLayer = JSON.parse(secOut); } catch { console.warn('Could not parse security output'); }\n\n\u002F\u002F Load manifest for feature count\nlet manifest: any = { features: [] };\nconst manifestPath = join(ROOT, 'evals', 'manifest.json');\ntry { manifest = JSON.parse(readFileSync(manifestPath, 'utf-8')); } catch {}\n\n\u002F\u002F Load snapshots for iteration history\nconst SNAP_DIR = join(RESULTS_DIR, 'snapshots');\nlet snapshots: any[] = [];\ntry {\n  const idx = JSON.parse(readFileSync(join(SNAP_DIR, 'index.json'), 'utf-8'));\n  snapshots = idx.map((s: any) => {\n    try { return JSON.parse(readFileSync(join(SNAP_DIR, s.file), 'utf-8')); } catch { return null; }\n  }).filter(Boolean);\n} catch {}\n\nconst timestamp = new Date().toISOString();\nconst evalResults = {\n  timestamp,\n  project: manifest.project || 'Generative Page',\n  iteration: snapshots.length + 1,\n  layers: [presLayer, unitLayer, secLayer],\n  snapshots,\n  summary: {\n    totalFeatures: manifest.features.length,\n    openBRDGaps: manifest.openBRDGaps || [],\n    blockers: manifest.blockers || [],\n    securityFindings: secLayer.findings || [],\n  },\n};\n\n\u002F\u002F Write latest.json\nwriteFileSync(join(RESULTS_DIR, 'latest.json'), JSON.stringify(evalResults, null, 2));\n\n\u002F\u002F Bake results into dashboard\nconst dashPath = join(ROOT, 'evals', 'dashboard', 'index.html');\nif (existsSync(dashPath)) {\n  let html = readFileSync(dashPath, 'utf-8');\n  const dataBlock = `\u002F* BAKED DATA — replaced by npm run eval — do not edit manually *\u002F\\nvar DATA = ${JSON.stringify(evalResults)};\\n\u002F* END BAKED DATA *\u002F`;\n  html = html.replace(\u002F\\\u002F\\* BAKED DATA[\\s\\S]*?END BAKED DATA \\*\\\u002F\u002Fm, dataBlock);\n  writeFileSync(dashPath, html);\n  console.log(`\\n✅ Dashboard updated: evals\u002Fdashboard\u002Findex.html`);\n}\n\n\u002F\u002F Summary\nconst totalFailed = presLayer.failed + unitLayer.failed;\nconsole.log(`\\nPresence: ${presLayer.passed} passed, ${presLayer.failed} failed`);\nconsole.log(`Unit:     ${unitLayer.passed} passed, ${unitLayer.failed} failed, ${unitLayer.skipped} todo`);\nconsole.log(`Security: ${secLayer.findings?.length || 0} findings`);\nif (totalFailed > 0) { console.error(`\\n❌ ${totalFailed} eval(s) failed.`); process.exit(1); }\nconsole.log('\\n✅ All evals passed.');\n```\n\n---\n\n## Step 8 — Generate the Dashboard\n\n### Step 8a — Read template\n\nRead the dashboard template from:\n```\npath: ~\u002F.copilot\u002Fm-skills\u002Feval-generator-gen-pages\u002Fdashboard-template.html\n```\n\nExpand `~` to the user's actual home directory. Use PowerShell if needed: `(Resolve-Path ~).Path`.\n\n### Step 8b — Adapt security categories for gen pages\n\nThe dashboard template's `CATEGORIES` array in `renderSecurity()` must be replaced with the gen-page-specific categories:\n\n```javascript\nvar CATEGORIES=[\n  {id:'GP-SEC-001',label:'OData Injection',          severity:'critical', what:'filter strings built from user input — injection risk for Dataverse queries'},\n  {id:'GP-SEC-002',label:'XSS',                      severity:'critical', what:'dangerouslySetInnerHTML or .innerHTML= — prefer Fluent UI components which escape automatically'},\n  {id:'GP-SEC-003',label:'Hardcoded Secret',          severity:'critical', what:'API keys, passwords, or tokens assigned as string literals in source'},\n  {id:'GP-SEC-004',label:'PII in Logs',               severity:'high',     what:'Sensitive fields (email, userId, DisplayName) written to the browser console'},\n  {id:'GP-SEC-005',label:'Error Disclosure',          severity:'high',     what:'Raw e.message or error.message surfaced directly to UI state'},\n  {id:'GP-SEC-006',label:'Unsafe fetch() Call',       severity:'high',     what:'fetch() to non-Microsoft URLs — use dataApi for all Dataverse operations'},\n  {id:'GP-SEC-007',label:'Client-Side Auth Bypass',   severity:'high',     what:'Role check in UI before dataApi write without a server-side guard'},\n  {id:'GP-SEC-008',label:'PII in Browser Storage',    severity:'medium',   what:'PII or auth data in localStorage\u002FsessionStorage — XSS-exfiltrable'},\n  {id:'GP-SEC-009',label:'Unvalidated Filter Input',  severity:'medium',   what:'User input variables in dataApi query options without sanitisation'},\n  {id:'GP-SEC-010',label:'Sensitive Data in State',   severity:'low',      what:'password, token, or secret held in React component state'},\n  {id:'GP-SEC-011',label:'Dynamic Code Execution',    severity:'critical', what:'eval(), new Function(), or setTimeout\u002FsetInterval with string argument'},\n  {id:'GP-SEC-012',label:'Unsafe External HTTP Client',severity:'high',    what:'axios, XMLHttpRequest calls to non-Microsoft URLs'},\n  {id:'GP-SEC-013',label:'Sensitive URL Parameters',  severity:'high',     what:'token\u002Fauth\u002Fsecret\u002FuserId exposed as URL query parameters'},\n  {id:'GP-SEC-014',label:'Excessive Data Retrieval',  severity:'medium',   what:'dataApi.queryTable without select — fetches ALL columns, performance + data exposure risk'},\n];\n```\n\n### Step 8c — Make exactly three substitutions in the template\n\n1. Replace every occurrence of `PROJECT_NAME` with the gen page file\u002Fdirectory name\n2. Replace `ITERATION_NUMBER` with the current iteration number\n3. Replace the FEATURES placeholder:\n   ```\n     \u002F* GENERATED — replace with actual features: { id, title, priority, note? } *\u002F\n   ```\n   with the actual feature array from the manifest:\n   ```javascript\n   { id: 'account-list', title: 'Account List', priority: 'high' },\n   { id: 'contact-detail', title: 'Contact Detail', priority: 'high' },\n   ```\n\n4. Replace the `CATEGORIES` array in `renderSecurity()` with the gen-page categories above.\n\n### Step 8d — Write `evals\u002Fdashboard\u002Findex.html`\n\n### Step 8e — Self-verify (THREE checks, all mandatory)\n\nAfter writing, verify all three:\n1. Grep for `fetch(` — if found: delete and repeat from 8a\n2. Grep for `FEATURES = [` → confirm next non-whitespace line is NOT `\u002F* GENERATED` — if placeholder present: delete and repeat\n3. Grep for `PROJECT_NAME` — if still present: delete and repeat\n\n---\n\n## Step 9 — Package.json Script\n\nEnsure `package.json` has these scripts (add if missing, never overwrite existing):\n\n```json\n{\n  \"scripts\": {\n    \"eval\": \"tsx evals\u002Frunner\u002Frun-evals.ts\",\n    \"eval:presence\": \"tsx evals\u002Frunner\u002Fpresence-runner.ts\",\n    \"eval:security\": \"tsx evals\u002Frunner\u002Fsecurity-runner.ts\",\n    \"eval:unit\": \"vitest run --config evals\u002Fvitest.config.ts\"\n  }\n}\n```\n\n---\n\n## Step 10 — Run Evals\n\nRun:\n```\nnpm run eval\n```\n\nfrom `PROJECT_DIR`. Capture output. If failures are reported, summarise them for the user with specific file and line references.\n\nAfter a successful run, tell the user to open `evals\u002Fdashboard\u002Findex.html` in their browser.\n\n---\n\n## Re-run Guard\n\nWhen `evals\u002F` already exists:\n\n| Artifact | Rule |\n|---|---|\n| `manifest.json` | Regenerated (may have new features from code changes) |\n| `presence\u002F*.check.ts` | Regenerated for all features |\n| `unit\u002Fhelpers\u002F` | Preserved — never overwritten |\n| `unit\u002F*.test.tsx` | **Merged** — add tests for new features, preserve passing tests |\n| `runner\u002F*.ts` | Regenerated |\n| `dashboard\u002Findex.html` | Regenerated (FEATURES + CATEGORIES updated) |\n| `results\u002Flatest.json` | Overwritten after snapshot |\n\n> ⚠️ Unit tests are **ALWAYS merged, never skipped** on re-runs. Any interpretation of \"merge\" as \"skip unit test generation\" is incorrect.\n\n---\n\n## Mandatory Checklist (verify before delivering)\n\n- [ ] `evals\u002Fmanifest.json` written with correct feature IDs\n- [ ] One `.check.ts` per feature in `evals\u002Fpresence\u002F`\n- [ ] `evals\u002Funit\u002Fhelpers\u002Fsetup.ts`, `mocks.ts`, `factories.ts` written\n- [ ] Factory fields grounded in actual source column names (never invented)\n- [ ] One `.test.tsx` per feature group in `evals\u002Funit\u002F`\n- [ ] Every `it()` name starts with exact `manifest.json` feature ID + colon\n- [ ] Post-generation grep confirms traceability for all feature IDs\n- [ ] `evals\u002Frunner\u002Fsecurity-runner.ts` written with GP-SEC-001 through GP-SEC-014\n- [ ] `evals\u002Frunner\u002Fpresence-runner.ts` and `run-evals.ts` written\n- [ ] `evals\u002Fvitest.config.ts` has `root: PROJECT_ROOT` set explicitly\n- [ ] `evals\u002Fdashboard\u002Findex.html` written, FEATURES substituted, CATEGORIES substituted\n- [ ] Dashboard self-verify: no `fetch(`, no placeholder, no `PROJECT_NAME`\n- [ ] `npm run eval` runs successfully (or failures reported to user)\n- [ ] Dashboard baked with real results\n\n---\n\n## Quality Rules\n\n1. **Never invent dataApi call patterns** — grep the actual source to confirm what tables and operations are used\n2. **Never reference Code App patterns** — no `power.config.json`, `src\u002Fgenerated\u002F`, `@microsoft\u002Fpower-apps`, `result.value`, `result.success`, `initialize()`\n3. **Never reference PCF patterns** — no `context.webAPI`, `context.parameters`, `ComponentFramework`\n4. **Factory fields must come from source** — read the `.tsx` file to see what fields the component accesses from rows before writing factories\n5. **Feature IDs are immutable** — once assigned in `manifest.json`, every downstream artifact must use them verbatim\n6. **Error handling in every dataApi call** — always generate presence checks that verify try\u002Fcatch exists\n7. **select: is always best practice** — flag absence of `select` in `queryTable` as GP-SEC-014\n\n---\n\n## Error Handling\n\n| Situation | Action |\n|---|---|\n| No `.tsx` file found | Ask user to confirm the path; offer to search recursively |\n| `@microsoft\u002Fpower-apps` found | Stop: redirect to `eval-generator-code-app` skill |\n| `ComponentFramework` found | Stop: this is a PCF component, wrong skill |\n| `npm install` fails | Show error; user may need to resolve peer deps manually |\n| `npm run eval` fails (unit) | Report specific test names and failure messages |\n| Dashboard FEATURES still shows placeholder after write | Delete and re-write; never deliver empty dashboard |\n| Feature ID mismatch detected in post-generation grep | Fix `it()` names before running evals |\n| evals\u002F already exists | Merge (never skip unit tests), snapshot first |\n",{"name":5,"description":7,"argument-hint":44},"[path to your .tsx generative page file] [optional: BRD file or OneDrive URL]","main","30bfe45d279a77276e71a3ac58c35119fc194365","plugins\u002Fpowercat-procode-eval\u002Fskills\u002Feval-generator-gen-pages",20,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-cat-skills","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-14 00:21:20",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add microsoft\u002Fpower-cat-skills --skill eval-generator-gen-pages",{"tool":60,"command":61},"bunx","bunx skills add microsoft\u002Fpower-cat-skills --skill eval-generator-gen-pages",{"tool":63,"command":64},"pnpm","pnpm dlx skills add microsoft\u002Fpower-cat-skills --skill eval-generator-gen-pages","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-cat-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fpowercat-procode-eval\u002Fskills\u002Feval-generator-gen-pages\u002FSKILL.md",true,[68],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"dashboard-template.html","REFERENCE","参考文档",20061,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-cat-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fpowercat-procode-eval\u002Fskills\u002Feval-generator-gen-pages\u002Fdashboard-template.html",[75,83,107,123,146,165],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":82},"01M7B9WDWXCJZVAFM8MVEZSMWK","create-pcf","Create or extend Power Apps Component Framework (PCF) controls for model-driven apps (model apps). Use when building custom field editors, ratings, toggles, sliders, pickers, or dataset controls with virtual React controls and platform-provided Fluent UI v9. Includes null-to-default behavior, accessibility, keyboard navigation, form lifecycle, and host-runtime validation.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-cat-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fpowercat-pcf\u002Fskills\u002Fcreate-pcf\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":39},"01M711KHT2PNDCPT1AJ06PRTAD","powercat-skills-router","Route Microsoft Power Platform requests to the best-fit specialist skill across microsoft\u002Fpower-cat-skills and microsoft\u002Fpower-platform-skills. Use when a user asks which skill can help, wants to find or use a Power Platform skill, or requests work involving Power Apps, Power Automate, Power Pages, Dataverse, Copilot Studio, or Power Platform administration. Discover candidates, reconcile installation and updates, obtain approval for changes, load the selected skill, and continue the original task.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-cat-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fpowercat-skills-router\u002Fskills\u002Fpowercat-skills-router\u002FSKILL.md",[],[90,91,92,93,94,95,96,97,98,99,100,101,31,102,103,33,104,35,105,106],"router","powercat skills router","fit","updates","for","platform","automate","reconcile","work","route","across","studio","copilot studio","when","copilot","discover","which",{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":39},"01M711K4VSKBM85NYF3C5QQZQF","eval-generator-code-app","Generate a two-layer eval suite (presence checks + static security analysis) for a Power Apps Code App. Code Apps use @microsoft\u002Fpower-apps SDK with generated service classes in src\u002Fgenerated\u002Fservices\u002F — NOT @microsoft\u002Fpowerapps-component-framework or context.webAPI.*. BRD is optional — if absent, features are derived from a code review of the project. Always produces: evals\u002Fmanifest.json, evals\u002Fpresence\u002F\u003Cid>.check.ts files, evals\u002Frunner\u002Frun-evals.ts, evals\u002Frunner\u002Fpresence-runner.ts, evals\u002Frunner\u002Fsecurity-runner.ts, and evals\u002Fdashboard\u002Findex.html. Triggers: 'generate code app evals', 'eval my code app', 'generate tests for code app', 'code app eval generator', 'check feature completeness code app'.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-cat-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fpowercat-procode-eval\u002Fskills\u002Feval-generator-code-app\u002FSKILL.md",[],[114,115,20,19,23,37,26,116,32,33,117,118,119,120,35,25,94,121,122,24],"eval generator code app","code","component","files","code review","static","project","context","security",{"skillNo":124,"name":125,"nameZh":6,"description":126,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":127,"categories":128,"keywords":129,"publishedAt":39},"01M711JZEWX0N2D7EA74YBCJ9G","powercat-overpage","Reviews the Power Pages site(s) inside a Power Platform solution .zip against best practices across Security, Performance, Accessibility, Maintainability, Architecture and Reliability — by reading the pages, web templates, custom JS\u002FCSS, settings and table permissions and reasoning about them. Optionally also ingests a browser HAR capture (recommended) to investigate real performance bottlenecks and map them to code. Produces a [SolutionName].findings.json (validated against findings.schema.json) with solution-level, per-site and per-component findings, each with a description, a suggested fix, and (where relevant) a code or HAR anchor. Then opens the PowerCAT OverPage viewer with the solution, findings and HAR loaded so the user can explore findings overlaid on a live page preview, on the actual code, and on the network waterfall. Triggers: 'powercat overpage', 'overpage my site', 'review my power pages site', 'review this portal solution', 'evaluate this power pages solution', 'audit power pages site', 'overpage', 'power pages solution review', 'analyze power pages performance', 'review power pages with har'.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-cat-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fpowercat-overpage\u002Fskills\u002Fpowercat-overpage\u002FSKILL.md",[],[130,116,100,131,132,133,134,135,136,115,137,138,139,140,141,35,142,143,144,145],"powercat overpage","analyze","browser","permissions","audit","reviews","architecture","preview","map","fix","explore","performance","css","relevant","reliability","review",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":152,"publishedAt":39},"01M711JWDD22RDQ4HG6XD3V96F","powercat-overflow","Reviews every Power Automate cloud flow inside a Power Platform solution (.zip) against Microsoft's coding guidelines and produces a [SolutionName].findings.json next to the uploaded solution, then opens the hosted PowerCAT-Overflow viewer at https:\u002F\u002Fmicrosoft.github.io\u002Fpower-cat-skills\u002FPowerCAT-Overflow.html and uploads both files so the user can explore the results. Triggers: 'powercat overflow', 'overflow my solution', 'review my solution', 'evaluate flows in this solution', 'audit Power Auto","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-cat-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fpowercat-overflow\u002Fskills\u002Fpowercat-overflow\u002FSKILL.md",[],[153,154,145,155,117,156,140,35,135,157,95,158,159,96,160,161,162,163,164,134],"powercat overflow","io","auto","flows","next","zip","viewer","html","coding","my","flow","at",{"skillNo":166,"name":167,"nameZh":6,"description":168,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":169,"categories":170,"keywords":171,"publishedAt":39},"01M711JRDNTWN8E2JXEE5GHB9A","dev-environment-deprecation-report","Builds a \"Developer Environments Deprecation Report\" (HTML) for any Power Platform tenant: days left until\nunmanaged developer environments are suspended, which ones are unmanaged, the apps, flows and agents at risk,\nenvironments created on behalf of other makers, and makers over the one-per-maker limit. Uses the Power\nPlatform for Admins connectors and a bundled generator script. Use when the user asks for a \"developer\nenvironment report\", \"unmanaged developer environments\", \"dev environment deprecation\", \"created on behalf\nof developer environments\", \"one PDE per maker\" or \"days left until developer environment suspension\".\nDo NOT use for production, sandbox, default or Teams environment reports, or general\ninventory\u002Fusage questions — use ask-power-platform-advisor instead.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-cat-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fpowercat-governance\u002Fskills\u002Fdev-environment-deprecation-report\u002FSKILL.md",[],[172,173,174,175,176,177,178,164,179,180,181,103,33,182,156,183,184,35,106,185],"dev environment deprecation report","deprecation","report","dev environment","dev","environment","analysis","advisor","reports","ask","default","inventory","maker","tenant"]