[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M699PP0G5QFYQ6TMEJXVKCCN":3,"skill-same:01M699PP0G5QFYQ6TMEJXVKCCN":84},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":51,"linkOnly":52,"markdownContent":53,"markdownBody":54,"frontMatter":55,"refName":61,"commitSha":62,"skillDirectory":63,"forksCount":64,"repositoryHtmlUrl":65,"repositoryHomepageUrl":66,"ownerHtmlUrl":67,"ownerBlogUrl":68,"ownerDescription":69,"updatedAt":70,"install":71,"resources":83},"01M699PP0G5QFYQ6TMEJXVKCCN","app-builder","模型驱动 Power Apps 应用构建","Builds and edits a model-driven Power Apps app from a natural-language intent — tables, columns, relationships, adaptive forms with sub-grids, views, Choice-column charts, business rules, business process flows, generative page intents for overview\u002Fdashboard surfaces, and an app module + sitemap. Runs an interactive authoring flow with plan approval and can download a deployed app back into an editable spec to change it. Use when the user says \"build an app for X\", \"create a model-driven app\", \"make me an app to manage Y\", \"add a business process flow\", or \"edit\u002Fadd to my app\". Do not use it for a generic web or React app or website, Power Pages, canvas apps, or Power Automate, or when the user rules out Power Platform, Dataverse, or model-driven apps (for example \"no Power Platform\"). This skill stands alone and does not require \u002Fgenpage — but for a standalone generative page added to an app that already exists, use \u002Fgenpage instead.","根据自然语言意图构建和编辑模型驱动（model-driven）的 Power Apps 应用——包括表、列、关系、带子网格的自适应表单、视图、Choice 列图表、业务规则、业务流程流、用于概览\u002F仪表板界面的生成式页面意图，以及应用模块和站点地图。运行包含计划审批的交互式创作流程，并可将已部署的应用下载回可编辑的规范（spec）以进行修改。当用户说“为 X 构建一个应用”“创建模型驱动应用”“给我做一个管理 Y 的应用”“添加业务流程流”或“编辑\u002F添加到我的应用”时使用。不要将其用于通用的 Web 或 React 应用、网站、Power Pages、画布应用（canvas apps）或 Power Automate，也不要在用户排除 Power Platform、Dataverse 或模型驱动应用时使用（例如“不使用 Power Platform”）。此技能可独立运行，不需要 \u002Fgenpage——但如果要向已有应用添加独立的生成式页面，请改用 \u002Fgenpage。","microsoft\u002Fpower-platform-skills","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M699JVYJFB75D9JM70BN4H0Q",1149,"MIT",null,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fmodel-apps\u002Fskills\u002Fapp-builder\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BWKS60NTYJHFE9FQSXGDKS","低代码应用开发","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50],"app","builder","app builder","apps","generative","edit","write","read","website","plan","todo","create","natural-language","search","Charts","power","react","dataverse","canvas","change","2026-11-10 10:12:30",false,"---\nname: app-builder\nversion: 1.0.0\ndescription: Builds and edits a model-driven Power Apps app from a natural-language intent — tables, columns, relationships, adaptive forms with sub-grids, views, Choice-column charts, business rules, business process flows, generative page intents for overview\u002Fdashboard surfaces, and an app module + sitemap. Runs an interactive authoring flow with plan approval and can download a deployed app back into an editable spec to change it. Use when the user says \"build an app for X\", \"create a model-driven app\", \"make me an app to manage Y\", \"add a business process flow\", or \"edit\u002Fadd to my app\". Do not use it for a generic web or React app or website, Power Pages, canvas apps, or Power Automate, or when the user rules out Power Platform, Dataverse, or model-driven apps (for example \"no Power Platform\"). This skill stands alone and does not require \u002Fgenpage — but for a standalone generative page added to an app that already exists, use \u002Fgenpage instead.\nauthor: Microsoft Corporation\nargument-hint: \"\u003Capp description>\"\nuser-invocable: true\nallowed-tools: Read, Write, Edit, Bash, Glob, Grep, Task, AskUserQuestion, EnterPlanMode, ExitPlanMode, TaskCreate, TaskUpdate, TaskList, read, edit, execute, search, agent, todo\n---\n\n> **Plugin check**: Run `node \"${PLUGIN_ROOT}\u002Fscripts\u002Fcheck-version.js\"` — if it outputs a message, show it to the user before proceeding.\n\n> **Model check (lightweight models only)**: If you are a lightweight model optimized for fast, simple tasks, tell the user in your first message that `\u002Fapp-builder` works best on a general-purpose coding model or an advanced reasoning model — designing the App Spec, reasoning about the dependencies between tables, relationships and artifacts, orchestrating the build and reconciling what already exists take multistep planning, tool use and validation — and recommend switching; then continue. On any other model, skip this note and say nothing about it.\n\n# app-builder — intent → model-driven app\n\nTurn a natural-language intent into a deployed model-driven app. You author a reviewable **App Spec**\n(JSON) with the user across confirmed turns, then a deterministic engine (`cds-maker-sdk`, vendored)\nbuilds it — tables\u002Fcolumns\u002Frelationships, sample data, views, Choice-column charts, adaptive forms\nwith sub-grids, **generative pages** for overview\u002Fdashboard surfaces, and the app module + sitemap.\nThe **same spec drives create and edit**: download a deployed app back into a spec, change it, and\nre-run the build (it's idempotent).\n\n## CRITICAL — run the interactive flow in THIS conversation (the main loop)\n\n> **You MUST run the authoring questions and the build narration yourself, in the main\n> conversation. Do NOT dispatch a subagent (`Task`) for the interactive steps.**\n>\n> A subagent is headless — `AskUserQuestion` and plan mode do not reach the user from inside one\n> (its only output is its final message). The whole point of this skill is the multi-turn,\n> propose-then-confirm experience, so every `AskUserQuestion`, `EnterPlanMode`, and live build\n> status line must originate here, in the main loop.\n\n## CRITICAL — the user sees your chat message, NOT tool output\n\n> **Shell\u002Ftool output — the result of running `preview-app.js`, a dry-run plan, or a lint —\n> is COLLAPSED BY DEFAULT in the UI. The user does NOT see it unless they manually expand the\n> tool panel.** Running the command is therefore NOT the same as showing the user. Every artifact\n> the user must **read, review, or approve** — the whole-app **preview wireframes**, the\n> **dry-run build plan**, and blocking **lint findings** — MUST be reproduced **verbatim in your\n> chat reply**, inside a fenced ` ``` ` code block. Never say \"the preview looks right\" and leave\n> the content buried in a collapsed panel: **paste it into your message.** This is the #1 cause of\n> \"the wireframes aren't visible\" — the preview ran, but its output stayed hidden.\n\n## Capabilities — the full toolbox (pick best-fit per requirement)\n\nYou are a **complete** model-driven app builder, not a single-surface tool. Everything below ships in\none App Spec and one build — choose what best serves the user's requirement to make a **useful,\nprod-ready** app; don't under-build (a bare table list) or over-build (surfaces nobody asked for):\n\n- **Data model** — tables (give each custom table a **meaningful Fluent-style SVG table icon by default**; propose what the glyph will **depict** in words — never a Fluent token name — and record it as `iconDescription` before drawing the SVG — see [`references\u002Fauthoring-flow.md`](..\u002F..\u002Freferences\u002Fauthoring-flow.md) → *Table icons*), columns (all types), relationships (1:N \u002F N:N + junctions), sample data\n- **Record UI** — forms (sub-grids, quick-create \u002F quick-view), views (with enriched default columns), charts\n- **Custom grid rendering** (preview) — `entities[].columns[].visualization`: render a column as a\n  `RadialDial`, `LineChart`, `HeatMap` or `StarRating` in **every** grid and view that shows it,\n  instead of plain text. Reach for it when a column is a *magnitude a user scans* (a score, a\n  utilization %, a rating, a priority) rather than a value they read exactly — it makes a list\n  scannable at a glance for one line of spec. It is per-*column*, so set it once on the column, not\n  on each view. **Preview:** on an environment where it is not provisioned the build skips it and\n  everything else still deploys, so it is always safe to include.\n- **Actions** — modern command-bar buttons (incl. flyout \u002F split menus), web resources (form JS \u002F HTML \u002F CSS).\n  Two rules when writing that JS, both learned from buttons that deployed perfectly and then did\n  nothing: a command handler is handed the record (`function doThing(primaryControl)`) — the build\n  supplies the parameter, so write that signature; and **never hardcode Choice values** like\n  `100000003`, because they are assigned per publisher. Resolve by label via `getOptions()`\n  (see `references\u002Fapp-spec-schema-advanced.md` → webResources). Note also that command and web-resource\n  **edits do not redeploy on rebuild** — the phases reuse what exists, so changing a button or a\n  script means deleting it first (only a button's hidden \u002F disabled state can be set in place, with\n  `commandStates[]` below; the build warns, and verify fails, when a web resource's deployed\n  content differs from the spec's). This does not apply to recovery of the build's own\n  `WEB_RESOURCE_UNVERIFIED` row: keep that row and the same build workspace, then follow its halt.\n  When the maker wants a rebuild to keep a web resource's content in step with the spec, mark that\n  resource `reconcile: \"declared\"` instead (`minimumPluginVersion: \"2.21.0\"`) — only when asked, one\n  resource at a time, never a shared (`external`) one, and never every resource of a downloaded or\n  older spec. A rebuild that would change one that exists stops before writing and names its approval\n  (`--authorize adopt:webresource:\u003Cweb resource name>`) with the components that depend on it: show them to the\n  maker and let them choose. Emptying its content also needs `--allow-destructive`; the halt says so.\n- **Show or hide an existing button** — `commandStates[]` (`minimumPluginVersion: \"2.24.0\"`, `app.uniqueName`):\n  only when the maker asks to show, hide, enable or disable a modern button that already exists. **Never invent a\n  row id**: run `node scripts\u002Flist-command-states.js --env \u003CenvUrl> --app \u003CuniqueName>` and pick the row by `rowId`\n  (never by caption) among `candidate: true` rows; write `scope: \"table\"` only (app-scoped buttons are refused in\n  this version) and only `hidden` \u002F `disabled` — a normal empty `visibilitytype` on a button `commands[]` built is\n  static and is never a reason to change it. Never write a command `key` in the same spec, and never create a\n  button with `commands[]` and set its state in the same build: create it in one build, add the state in the next.\n  The apply is a full build with `--publish`. Run a dry run first and show the maker every\n  `--authorize overwrite:command-state:…` (one per row change) and `--authorize publish:command-state-table:…`\n  token it prints — the table one publishes **all** saved customizations on that table, for every app that shows it —\n  and pass them exactly as printed. Never replay a row write by hand: on `command-state-write-unknown` or\n  `command-state-version-conflict`, list the row again, dry-run again and get the new approval (an ordinary phase\n  retry of the build re-plans from a fresh read). Report three things separately: the rows saved, the table\n  publication confirmed — or `command-state-publish-unconfirmed` (\"saved, not published\") — and what the maker sees\n  in the app, which neither the build nor `--verify` (stored flags only) checks. A table publish that was sent can\n  still complete after a halt or after the entry is removed; this release keeps no record of it across runs, and a\n  later publishing run requests the table again only because the spec still names it.\n- **Form logic without code** — `businessRules[]`: show\u002Fhide, lock\u002Funlock, set-required and\n  set-value, driven by a condition on the record. **Reach for a business rule before form JS** when\n  the requirement is field-level and declarative — it is visible in the maker, survives solution\n  export, and needs no web resource. Use form JS when the logic needs a real API call, cross-record\n  work, or anything beyond the four supported actions.\n- **Guided processes** — `businessProcessFlows[]`: the staged bar across the top of a record\n  (ordered stages, each with steps bound to that table's columns — **every step must bind a `field`**;\n  the platform rejects one without, so use a Boolean flag for a manual check-off). Reach for one when\n  the user describes work moving through **phases** — \"triage →\n  investigate → resolve\", \"lead → qualify → close\". Author it `Active` (the default) or the stage bar\n  does not appear at all. Who may run a flow is `securityRoles: { \"personas\": [...] }` (Active flows\n  only). v1 is single-entity and linear: cross-entity stages, branching and stage actions are\n  **rejected** by the spec gate, so offer Maker for those rather than writing them into the spec.\n- **Surfaces** — **generative pages** (modern dashboards \u002F overviews \u002F analytics \u002F landing — the default),\n  classic dashboards (opt-in), external URLs\n- **App shell** — the app module + sitemap, with per-subarea icons. Turn on the **modern shell** with\n  `app.newLook: true` unless the user asks for the classic one; it is opt-in and best-effort, so a\n  tenant without the setting still gets a working app. `app.headerNavigationRefresh` controls the\n  **Wave 2 header\u002Fnavigation refresh** — a *separate, independent* setting whose platform default is\n  **ON**, so set it to `false` only when the user explicitly wants the classic header.\n- **App theme and header logo (Preview, 2.21.0)** — `app.theme`. Add it **only when the maker explicitly asks\n  for branding** (brand colours, a header colour, a logo) or says yes to the branding question you ask of every new app\n  at the personas step (authoring-flow Level (a0)); an ordinary app gets **no** `app.theme` without one of those, and you never\n  invent a palette, a font or a logo. Offer the choices: a `basePaletteColor` (or explicit `palette` slots), the\n  `appHeader` colours, a `font` only if they name one, and a `logo` that is an **existing image web resource**\n  (or one you also declare in `webResources[]`), never a URL. Say before the build that the theme is published\n  with the **app**, and that an app publication publishes **every** pending change of the app, not only the theme.\n  The theme does not change the `newLook` \u002F header choices above — do not switch them to fit a theme. Omit the key\n  to leave the app's theme alone; `null` removes the app's override (the environment theme applies again). Theme\n  versions are never deleted, and a logo the theme only references is never touched by teardown. `--verify` reports the theme's **API state** (saved,\n  pending publish, live) — tell the maker to check the header in the app itself.\n- **App membership** — which forms, views and charts the app offers (`app.mainForms`, `app.tables`).\n  **Only these forms on an existing app.** `app.mainForms` adds the forms you list. To also take the table's other Main\n  forms **out of the app** on an update, set `\"mainFormsOnUpdate\": \"exact\"` — ask the maker first, it is a removal from the\n  app's membership (no form is deleted). It needs an unmanaged, published app; the build publishes only once Dataverse reads\n  back exactly your list, and otherwise stops with the change saved and the app's publication owed.\n\n  **Pin the artifacts the spec declares.** `\"pinDeclaredArtifacts\": true` adds the spec's own forms, views, charts and\n  dashboards to the app explicitly — use it for a chart or view of a table that is not in the navigation. It only adds.\n  When to use them: `\"exact\"` only on an explicit \"only these forms\" \u002F \"remove the other forms\" ask, after\n  showing the maker which tables it covers (the build refuses it on an existing app without\n  `--allow-destructive`); never for \"add the Summary form\", which `app.mainForms` alone does. Suggest\n  `pinDeclaredArtifacts: true` for a **new** app whose spec declares a chart, view or dashboard of a table\n  that is not in its navigation. Never turn either on by yourself for an existing app. Both need\n  `minimumPluginVersion: \"2.21.0\"`.\n- **Security & access** — one **security role per persona**, sized from that persona's jobs-to-be-done\n  (the entity access each job needs, unioned into the role), so the app **opens for non-admins**.\n- **Confidential columns** — `isSecured` + `fieldSecurityProfiles[]`. Reach for them when the design\n  names a value only some people may see or change (salary, medical notes, an identifier, private\n  comments): a security role cannot hide one column, a profile can. Name who gets each profile\n  (`assignTo` users or teams, by id) — never infer them from a persona — and say in the preview who\n  gains access, or that no assignment was requested. Tell the maker that System Administrators see\n  every secured column (test as a non-admin), that an open app may need a reload, to grant `read`\n  unless `update` is needed, that unsecuring a column deletes its permissions\n  (`--authorize isSecured:\u003Ctable>.\u003Ccolumn>`), and that a teardown keeps each declared profile and names it.\n- **Portable schema** — `{ \"value\", \"label\" }` options when an integration or another environment\n  depends on the option numbers; `dateTimeBehavior: \"DateOnly\"` for birthdays, due and renewal\n  dates, `\"TimeZoneIndependent\"` for a time that means the same clock everywhere (omit it for\n  timestamps); table `searchEnabled` \u002F `duplicateDetectionEnabled` only when the maker asks. Never\n  change an existing column's date behaviour or turn duplicate detection off unasked: both need\n  `--authorize`. All need `minimumPluginVersion: \"2.21.0\"` — see\n  [`references\u002Fapp-spec-schema-advanced.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema-advanced.md).\n- **Declared views, charts and search columns** (`minimumPluginVersion: \"2.21.0\"`) — write\n  `reconcile: \"declared\"` on each view or chart you author for a **new** app, and, when editing, on the\n  one existing view or chart the maker asks to change: a rebuild then applies its columns, filters, sort\n  and joins (`linkEntities`) instead of only adding columns. Never set `title` on a new declared chart,\n  and give a declared view its own name — not the stock `Active \u003Cplural>` or `Inactive \u003Cplural>`, which\n  every table already has, so changing one is an adoption. Two declared charts on one table need different\n  names, and so do two declared views unless each has its own `key`: a `viewId` pin does not tell them apart, and the build refuses the\n  pair (see Approvals in the advanced reference).\n  For a new table you create, propose `entities[].quickFind.findColumns` (the primary name plus what a\n  user types in the search box: a number, an email, a code) and confirm it with the maker; on an\n  existing table, only when the maker names what search should match. A change to a view or chart that\n  already exists stops the build with nothing written and names its approval\n  (`--authorize adopt:view:\u003Ctable>\u002F\u003Cname>` or `adopt:chart:`, `overwrite:` for changes made elsewhere, `--allow-destructive`\n  to remove columns): explain it and let the maker choose; never edit the spec to avoid it. A local copy\n  that differs from the server's stops it the same way (`workspace-copy-unsent-edits`) and is kept: ask\n  whether to put that change into the spec and refresh the local copy, or approve the `overwrite:` key\n  it prints (`overwrite:quickfind:\u003Ctable>` for search columns); pass a key exactly as printed. Never write\n  `reconcile` on a web resource except as the web-resource bullet above says, on a form, a dashboard, a business\n  rule or a business process flow except as their bullets below say, and never write a command `key` (keyed command bars are refused\n  in this version). Leave a downloaded or older spec without these fields as it is — see the advanced reference.\n- **Declared form layouts** (`minimumPluginVersion: \"2.21.0\"`) — write `reconcile: \"declared\"` on a form\n  only when the maker asked its layout to follow the spec (fields, spans, sections, field options, sub-grids,\n  handlers) or said yes when you offered it at Level (b); not for \"add a form\" or \"add a field\" with no layout. Tell the maker: controls the spec does not\n  declare stay where they are and nothing is deleted (so no `--allow-destructive` is needed for them); a layout the build cannot place safely stops before any\n  write; a table publish puts live every saved change on that table, not only this form, with or without\n  `--publish` (a declared dashboard is published after its write either way); and Dataverse does\n  not provide a working conditional-write guard for a form's saved layer, so the build re-checks it just\n  before writing, but an edit made in Maker at that instant cannot be detected. Never write `genPages`, `prune`, `isDefault`,\n  `deactivateOtherMainForms`, `securityRoles` or a `mainFormOrder` place on a declared form (refused).\n  An existing form is bound only with `--authorize \"adopt:form:\u003Ctable>\u002F\u003Cformtype>\u002F\u003Cname>\"` (lower case;\n  `overwrite:form:` for changes made elsewhere): explain it and let the maker choose. `--verify` checks a\n  declared form against the spec, sub-grid views included (a form whose publish is unconfirmed is unverified,\n  not passed). A download brings declared forms back only with `--include-managed --managed-manifest \u003Cstore\n  file>` (one with an event handler comes back with its handler library as an `external` web resource when\n  that library is this publisher's own unmanaged script; otherwise it is left out and named in\n  `managedForms.stale`, and its declaration is written ready to paste in the new file `managedFragments.file` names (`.maker-workspace\u002Fmanaged-fragments-\u003Ctime>-\u003Crandom>.json`)\n  with the library it needs, so tell the maker to add both from the spec it was built from); it carries no binding, so the first build that binds each form from the downloaded folder needs\n  `adopt:form:\u003Ckey>` (a rebuild that writes nothing may leave it unbound). A form removed from the spec and\n  then deleted in Maker is released by the next build, which names it (`managed-root-retired`); until then\n  `--verify` fails it. One whose publish is unconfirmed is not released (see the unconfirmed publish below). A\n  build that warns a form's or dashboard's retirement could not be confirmed stops before it writes anything\n  (`managed-not-settled`) and sends nothing more in that run, not even an earlier attempt's deferred publish;\n  running it again reads it afresh and publishes that. A plain form (by its name, `\u003Ctable> form` when it has\n  none, or its `formId`) that replaces a removed declared form with unfinished work (a lost create, an owed or\n  unconfirmed publish) is refused (`managed-form-unsettled`):\n  restore the declaration and let it settle, or run the build again later.\n- **Declared dashboards** (`minimumPluginVersion: \"2.21.0\"`) — write `reconcile: \"declared\"` on a global\n  dashboard only when the maker asked its tiles to follow the spec on rebuilds, or said yes when you offered it at Level (b); give it and every tile a\n  `key`. Tell the maker: tiles the spec omits stay (nothing is deleted), and settings a tile does not state are\n  kept; a new tile is added after the last row; in an environment with more than one language a new tile gets\n  its caption, with the same text, in every language the environment has (if the build cannot read those\n  languages, it stops before it writes the dashboard: `dashboard-languages-unreadable`, so run it again; the\n  platform keeps some of those captions and drops others, an iframe tile's for one, and a dropped one other\n  than the base-language caption is no change); an\n  unfinished dashboard of the same name is not taken over\n  and not deleted; a dashboard this build cannot finish is not published, including by the app publish; a\n  dashboard the build created and could not prove is named by id in the stop: when the build knows it created it,\n  delete it and run the build again, which creates it anew; when the stop says the build cannot tell who created\n  it, have the maker inspect it and do not delete it; `dashboard-languages-unreadable` after a lost answer means\n  run the build again; and\n  Dataverse does not version a dashboard's saved layer, so an edit made in Maker at the instant of the write\n  cannot be detected. An existing dashboard is bound only with `--authorize adopt:dashboard:\u003Ckey>`\n  (`overwrite:dashboard:\u003Ckey>` or `overwrite:dashboard:\u003Ckey>\u002F\u003Ctile>` for changes made elsewhere,\n  `--allow-destructive` to clear its description with `\"\"`): explain it and let the maker choose. `--verify`\n  holds a declared dashboard to its last build (a dashboard changed in Maker since fails until a build\n  settles it; one whose publish is unconfirmed is unverified, not passed). A download brings it back declared\n  only with `--include-managed --managed-manifest \u003Cstore file>` (otherwise it is an undeclared entry), with the\n  dashboard and tile ids it was proved on; its first binding needs `adopt:dashboard:\u003Ckey>`, because the\n  downloaded folder has no store.\n- **Declared business rules** (`minimumPluginVersion: \"2.21.0\"`) — write `reconcile: \"declared\"` on a rule only\n  when the maker accepts that the build manages the WHOLE rule (the offer at the personas step, or their own ask); give every condition, action and apply-action a\n  `key`. Tell the maker: conditions and actions are never matched by their text; a new rule is created Draft and\n  activated only if nobody changed it in between; a rule that already exists is never edited by the build\n  (change it in Maker, then re-adopt it); a rule changed outside the spec stops the build until it is re-adopted\n  whole with `--authorize adopt:rule:\u003Ctable>\u002F\u003Cname>` and a declaration naming its whole body; and an environment\n  that cannot host business rules skips them. Explain the approval and let the maker choose. `--verify` holds a\n  declared rule to its last build (a rule changed in Maker since fails until it is re-adopted). A download\n  brings it back declared only with `--include-managed --managed-manifest \u003Cstore file>` (otherwise it is left\n  out, as every business rule is); the first build that binds a rule that already exists needs\n  `adopt:rule:\u003Ctable>\u002F\u003Cname>`, because the downloaded folder has no store.\n- **Declared business process flows** (`minimumPluginVersion: \"2.21.0\"`) — write\n  `reconcile: \"declared\"` on a flow only when the maker accepts that the build manages the WHOLE flow (the offer at the personas step, or their own ask); give every\n  stage and step a `key`. Tell the maker: a key keeps a stage's or step's id, so a rename keeps the records on it;\n  a new flow is created Draft and activated only if nobody changed it in between; a flow that already exists is\n  never edited by the build (to change its body or status, change it in Maker, then re-adopt it, keeping every\n  stage and step in place); removing or reordering a stage or step is always refused, and no change in Maker or\n  re-adoption unlocks that; a flow changed outside the spec stops the build until it is re-adopted whole with\n  `--authorize adopt:bpf:\u003Ctable>\u002F\u003Cname>` and a declaration naming its whole body. Explain the approval and let\n  the maker choose. `--verify` holds a declared flow to its last build (a flow changed in Maker since fails until\n  it is re-adopted). A download brings it back declared, keys included, only with `--include-managed\n  --managed-manifest \u003Cstore file>` (otherwise it is left out); the first build that binds it from the downloaded folder\n  needs `adopt:bpf:\u003Ctable>\u002F\u003Cname>`, because that folder has no store. Changing only who may run a managed flow\n  (`securityRoles`) writes nothing to the flow; the build records it. A managed download restores a flow that has\n  `securityRoles` only when it can prove each persona the flow names from the role a build made for it, and then\n  writes that persona into `personas[]` (a NOTE names it). Tell the maker that persona now owns its role: a\n  privilege added to that role outside the spec is removed by the next build. When a persona cannot be proved,\n  the download leaves the flow out with a warning naming the personas and why (nothing is lost; the store and the\n  maker's own spec keep it) and writes the flow ready to paste in\n  the new file `managedFragments.file` names. Tell the maker to paste that flow and copy the\n  personas it names from the spec it was built from. Earlier fragments files are kept; never delete one\n  yourself. If the download stops with `managed-fragments-unwritable`, `.maker-workspace` is not a plain folder\n  or cannot be written: ask the maker to fix it, never move or delete it yourself. A\n  declared rule or flow removed from the spec whose row was deleted is no longer managed once the build reads it gone\n  by its id (a `managed-root-retired` warning, which never means it was activated); until then, a removed one whose\n  change is still waiting to be proved keeps the build incomplete. A retirement a build reports it could not\n  confirm also ends that build incomplete; tell the maker to run the build again, which reads the record afresh.\n- **An unconfirmed publish** — a build that stops naming `--authorize publication-risk:table:\u003Ctable>\u002F\u003Cdispatch>`\n  (or `publication-risk:dashboard:\u003Cid>\u002F\u003Cdispatch>`) lost the answer to a publish that may still complete.\n  Tell the maker to check what is live on that table; pass the key exactly as printed, from the latest stop,\n  only when they accept the risk, whichever step printed it. The key names that one lost publish: an older\n  key does not accept a later one, and a key that matches nothing is reported as not used. That run records\n  it before it writes anything and stops (`publication-risk-accepted`); the next build publishes after the\n  usual checks. A dashboard the spec no longer declares stays owed (`publication-withheld`) until its\n  declaration is restored. A run that cannot tell whether it recorded the key stops before any write\n  (`publication-risk-record-unconfirmed`): run the build again without the key. `--allow-destructive` never\n  gives it. When the stop says the saved layer is still the one the publish shipped yet the published layer\n  reads differently, the platform may read that form's two layers apart: have the maker compare what is\n  published with the spec; each later publish of that table can stop the same way.\n- **A saved change the build did not make** — a declared form's table is not published while its saved\n  layer holds a change made elsewhere. If the stop says that change is not published, tell the maker to\n  publish it in Maker if it should stay, or undo it and save, then run the build again.\n- **Stable create ids** (`minimumPluginVersion: \"2.21.0\"`) — write `createIdentity: \"stable-v1\"` on a\n  **new** app; never add it to an existing or downloaded spec (a managed download writes it back itself, only\n  with the declared views and charts it restores). Tell the maker: declared views and charts\n  get ids the spec fixes, so a retry after a lost answer binds the same row instead of creating a second;\n  configuration items, custom APIs, environment variables, field security, duplicate rules and pages keep\n  today's ids; and a local copy with an unsent edit stops the build (`create-completion-required`) —\n  running again does not merge it: put the change into the spec, then refresh the local copy.\n- **Configuration items** (`minimumPluginVersion: \"2.21.0\"`) — `environmentVariables[]`,\n  `connectionReferences[]`, `customApis[]`, `duplicateDetectionRules[]` and `solution.version`. Declare one\n  only when the maker asks for it, accepts your offer at the personas step, or a page of this app needs it (a page calling a connector needs its\n  connection reference; an action a page calls needs its Custom API). Never write a value that differs per\n  environment into the spec — a current value, a connection id, a secret: those go in a `--deployment-settings`\n  file (the solution deployment-settings shape), which the maker supplies, and a `secret` variable takes no\n  `defaultValue`. Tell the maker: a page that calls a declared reference or Custom API is not written until the\n  reference is bound to a connection and the Custom API has an implementation (a plug-in type) — a declared\n  Custom API alone is a scaffold; clearing a value, unbinding a reference or removing a parameter or condition\n  needs `--authorize \u003Ckind>:\u003Ckey>:\u003Cfield>` (the refusal names it); a teardown keeps these items and names them;\n  a plain download does not bring them back into the spec (a managed download of a `configurationIdentity:\n  \"stable-v1\"` app brings back the ones its store proves, never a value, default, connection, implementation or duplicate rule); and a whole-build retry after a lost answer can create\n  a second row, so check the environment before running a failed build again. See\n  [`references\u002Fapp-spec-schema.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema.md) → *Configuration items*.\n- **AI-first features** (admin-gated) — form-fill assist, natural-language grid\u002Fview search, NL chart\n  \u002F AI data visualization, M365 Copilot (opt-in); per-table Copilot row summaries (Insight Cards)\n  with tailored prompts, auto-selected for good-candidate tables\n\nAuthor the **smallest spec that fully satisfies the ask**, then let the user refine. The **Genpage-first\npolicy** below is the record-vs-dashboard rule; [`references\u002Fapp-spec-schema.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema.md)\ndocuments every field.\n\n## Genpage-first policy (surface classification)\n\nEvery app surface is one of two kinds — **enumerate the app's surfaces and classify each one**, don't\ndecide page-by-page in passing:\n\n- **Record surfaces** (create\u002Fread\u002Fupdate\u002Flist a table's rows) → a **model-driven form + view**.\n- **Everything else** — overview\u002Flanding, dashboard, KPIs, analytics, guided or wizard flow,\n  composite or comparison screen → a **generative page** (`pages[]`), **not** a classic dashboard.\n\nRules:\n\n- An app whose jobs include an overview, a queue, analytics or a guided flow but which proposes no\n  pages has missed a surface. Where the app genuinely is record-CRUD only, say so explicitly rather\n  than silently omitting pages.\n- A **traditional `dashboards[]`** is emitted **only on explicit request** (e.g. \"use a classic dashboard\").\n- A generative page is authored as a **design intent** (`source: { kind: \"intent\" }`,\n  `schemaVersion: 2`) during Phase 1 — its `.tsx` is written in **Phase 1.5 — Generate pages**, after\n  plan approval and after the data pre-build creates the tables so `genpage.js types`\n  can emit `RuntimeTypes.ts`. See [`references\u002Fauthoring-flow.md`](..\u002F..\u002Freferences\u002Fauthoring-flow.md) → *Pages*.\n- The build's `pages` phase writes each page through the SDK and never places it in the sitemap\n  itself — the SDK is the **single sitemap writer**, so a page's nav entry comes from a\n  `page` subarea in `appShell` (referenced by the page's **`key`**). See\n  [`references\u002Fapp-spec-schema.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema.md) → `pages[]`.\n- **Every page in `pages[]` must be sitemap-placed** — validation rejects any page absent from the\n  sitemap. A \"detail\" page that receives a caller-supplied id is a normal sitemap page; it reads its\n  input via `pageInput?.data?.\u003Cfield>`. Navigation-only (headless) pages are not supported.\n- **A page that declares `pageInput` MUST declare `directEntry`.** Because every page is\n  sitemap-placed, a detail page is also reachable straight from the app navigation with **no input**\n  — a state a user reaches by clicking. Say what happens then: `{ \"behavior\": \"selector\" }` shows a\n  picker and then the record, `{ \"behavior\": \"emptyState\" }` explains and renders nothing broken.\n  Prefer `selector` when the table is browsable; it is the more useful landing. Every key in\n  `pageInput.data` must also be produced by some page's `navigatesTo[].data`, or the generated page\n  reads a key nothing ever sets.\n- **Three-authority page identity** (build + download + verify all follow this): (1) **IDENTITY** —\n  the durable `\u003Capp>_pagemanifest` (`key → pageId`); a downloaded spec's own `pages[].pageId`\n  outranks it for that rebuild. (2) **EXISTENCE** — the env-wide page list read through the SDK, drafts\n  included (crash-safe; decides create-vs-reuse). (3) **MEMBERSHIP** — the app's sitemap `GenPageId` set (placement,\n  download enumeration, verify coverage). All matching is by id — never by display name.\n- **Multi-page navigation uses `PAGEREF_\u003Ckey>`** (the stable `pages[].key`) as the `pageId`\n  placeholder; the build resolves each to the real page GUID in a run-scoped staging copy (the\n  canonical `.tsx` is never mutated), then **verifies every nav edge** resolves to the deployed\n  page's `GenPageId`.\n\n## Workflow\n\n### Phase 0 — Working directory\n1. Derive a short kebab-case slug from `$ARGUMENTS` (e.g. \"Project Tracker\" → `project-tracker`).\n2. Create the directory (`mkdir -p \u003Cslug>` on bash\u002FPowerShell; `mkdir \u003Cslug>` on cmd, which has no\n   `-p` and errors if it exists) and resolve its absolute path. It holds `app-spec.json`,\n   `model-app-plan.md`, and `workflow-log.md`.\n\n### Phase 1 — Author the App Spec (interactive, main loop)\n\nFollow **[references\u002Fauthoring-flow.md](..\u002F..\u002Freferences\u002Fauthoring-flow.md)** step by step, running\nevery prompt yourself via `AskUserQuestion`. In short:\n\n#### Unattended runs (Copilot autopilot \u002F automation)\n\nResolve the interaction mode once before the first authoring question:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fresolve-interaction-mode.js\" [--non-interactive]\n```\n\n`POWER_PLATFORM_SKILLS_NONINTERACTIVE=1`\u002F`true` (or the equivalent\n`--non-interactive` invocation) means there is no user waiting for prompts. In\nthat mode:\n\n- do not call `AskUserQuestion`, `EnterPlanMode`, or `ExitPlanMode`;\n- use explicit requirements and supplied existing specs as authoritative, and\n  use documented defaults only where the request leaves a non-destructive\n  choice open;\n- record each skipped gate as\n  `Unattended default: \u003Cquestion> → \u003Canswer> (\u003Creason>)` in `workflow-log.md`;\n- treat the completed lint, preview, rendered design document, and build dry-run\n  as the approved plan, then continue with the normal approved path;\n- halt rather than guessing an ambiguous environment, app identity, or\n  destructive structural edit.\n\nSuppressing interaction never authorizes destructive work. An unattended\nexisting-app apply still requires `--allow-destructive` wherever the build\nnormally requires it; `POWER_PLATFORM_SKILLS_NONINTERACTIVE` only suppresses\nprompts.\n\nCarry the resolved mode through subprocesses: when it is unattended, append\n`--non-interactive` to every `build-model-app.js` invocation (dry-run, data\npre-build, recovery rerun, and full apply). Do not append `--allow-destructive`\nunless destructive authority was supplied independently.\n\n1. **Prereqs** — `node --version`, `pac help` (> 2.10.0, the plugin's minimum).\n2. **Environment (PAC)** — `pac auth list`. If exactly one \u002F an active profile, **confirm it\n   (FYI), don't ask**. If several and none active, **ask** which to use. If none, ask the user\n   to `pac auth create`. Capture the org URL (`pac org who`).\n3. **Detect existing** — `scripts\u002Flist-tables.js --env \u003CenvUrl> --search … --exact` and\n   `scripts\u002Fapps.js list --env \u003CenvUrl>` (`\u003CenvUrl>` is the org URL from step 2) to find\n   tables\u002Fapps already present; build *around* them. `--exact` keeps only the tables whose\n   logical name is a search term and lists the terms with none in `missing`. A failed read\n   (exit 1) is reported and ends the step — never read it as \"nothing exists\".\n4. **Levelled authoring** — **first read the App Spec format** so you author to the exact\n   shape (do this once; don't go spelunking through scripts):\n   [`references\u002Fapp-spec-schema.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema.md) and the worked sample\n   [`samples\u002Fapp-spec.support-desk.json`](..\u002F..\u002Fsamples\u002Fapp-spec.support-desk.json). That document\n   covers everything an app always has. **Additionally read\n   [`references\u002Fapp-spec-schema-advanced.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema-advanced.md) once your\n   design calls for a conditional feature** — business rules, a business process flow, command-bar\n   buttons, web resources, global choices, classic dashboards, or `roleGrants[]`. Its pointer table\n   is in the main schema, and the toolbox above tells you when to reach for each; read the detail\n   only for the ones you are actually using, and never skip a capability just to avoid the read.\n   Phase 1 is\n   **design-only**: never emit page `.tsx` here. Each level is confirmed via `AskUserQuestion` before\n   the next begins, and `app-spec.json` is persisted after each — full prompts in the playbook.\n   - **Level (a0) — personas & jobs-to-be-done** (`personas[]`): **before proposing any tables**, ask\n     who will use the app and what each needs to get done. Jobs drive everything that follows — a\n     table exists because a job needs its data, a surface because a job needs to act on it. Deriving\n     the data model first reliably misses surfaces. Privileges come later; capture the jobs now.\n   - **Level (a) — data model**: entities\u002Fcolumns\u002Frelationships **derived from those jobs**; run the\n     **early data-model lint** (catches e.g. the relationship-vs-lookup collision before forms are\n     authored on top).\n   - **Descriptions are part of authoring, not a cleanup pass.** Every table, column, view, chart,\n     form, dashboard and business rule takes an optional `description`, and you should **write one as\n     you create the artifact** — never as a backfill. A name says what a thing is called; a\n     description says what it is *for*, and it is the only intent an app carries that an agent can\n     read back later when it inspects an app it did not build. Describe the purpose, not the shape:\n     `\"Severity 1-5; drives the escalation rule and the SLA clock\"`, not `\"The priority column\"`.\n     (`commands[]` and `Customer` columns accept one but the SDK cannot write it — you'll get a\n     warning; `personas[]` does not take one at all. See the schema reference for why.)\n     The app itself takes two: `app.description` is the short tile text, and `app.aiDescription` is\n     the **routing description** an orchestrator reads to choose between apps — who the app is for,\n     what it covers and excludes, and how to tell it from a sibling app over the same tables. Write\n     it whenever such a sibling exists or is planned.\n   - **Level (b) — artifacts + page-intents + design**: **enumerate every surface each job needs and\n     classify it** per the genpage-first policy above — record CRUD → form + view; anything else\n     (overview\u002Flanding, dashboard, KPIs, analytics, guided\u002Fwizard flow, composite or comparison\n     screen) → a page **intent** (`source: { kind: \"intent\" }`). State each classification out loud;\n     if the app needs no pages, say so and why rather than silently omitting them. Then forms + views\n     + charts + sample data and the optional `design` contract, mapping each job to its surfaces via\n     `jobs[].surfaces[]`. **No page `.tsx` here.** `dashboards[]` only on explicit request.\n   - **Level (c) — access** (`personas[].jobs[].privileges[]`): personas and jobs already exist from\n     (a0) and the entities now exist, so **only add the privileges each job needs** — don't re-ask who\n     the users are. The builder unions them into one role per persona and grants the app to it so it\n     **opens for that persona, not just sysadmins**. **Render the roles + per-entity access as a table\n     in your chat reply** (the user can't approve an access model they can't see — see the CRITICAL\n     note above). If they want no roles, tell them jobs live in `personas[]` so dropping the roles\n     drops the recorded jobs too; offer read-only privileges to keep the record. If a column is\n     confidential, add `isSecured` + a field security profile and name who gets it — see the\n     *Confidential columns* bullet in the toolbox. (Access teams are not yet supported — see\n     *Notes & limits*.)\n   - **Whole-app preview** (design gate for Level (b)): `node \"${PLUGIN_ROOT}\u002Fscripts\u002Fpreview-app.js\" --spec @\u003Cworking-dir>\u002Fapp-spec.json`\n     renders data-model + sitemap + form wireframes + page-intents + design contract. **Reproduce the\n     ENTIRE rendered output verbatim in your chat reply, inside a fenced ` ``` ` code block — do NOT\n     leave it in the (collapsed, invisible) tool output, and do NOT just summarize \"the preview looks\n     right\" (see the CRITICAL note above).** The user must be able to SEE each form, the sitemap, and\n     the page intents they are approving. For a single form only: `node \"${PLUGIN_ROOT}\u002Fscripts\u002Fpreview-form.js\" --spec @\u003Cworking-dir>\u002Fapp-spec.json`.\n   - **Don't pre-create tables\u002Fcolumns** — the build does it idempotently.\n5. **Guardrail lint (hard gate)** — run the **full** lint on the complete spec; **errors block**, warnings teach. If it blocks (or warns), **paste the findings into your chat reply** — tool output is collapsed and invisible to the user (see the CRITICAL note above), so the user can't fix what they can't see:\n   ```bash\n   node \"${PLUGIN_ROOT}\u002Fscripts\u002Flint-app-spec.js\" --spec @\u003Cworking-dir>\u002Fapp-spec.json --json\n   ```\n   This runs migration and `validateAppSpec` — the gates the build itself runs on load — plus the `lintAppSpec` authoring guardrails, which the builder does **not** run. It exits non-zero on errors. It validates under the `plan` profile (which allows not-yet-generated intent pages), matching Step 6's dry run.\n6. **Plan-mode approval (the single build approval)** — present the plan **including the build\n   dry-run's phase-grouped plan** (run `build-model-app.js` without `--apply`, using the `plan`\n   profile that allows intent pages) inside `EnterPlanMode`, then `ExitPlanMode` to get the user's\n   go-ahead. On approval, **Phase 1.5** (generate-pages) runs first, then **Phase 2** applies\n   directly (no second dry-run\u002Fgo-ahead). Render the design document — never hand-write it:\n   ```bash\n   node \"${PLUGIN_ROOT}\u002Fscripts\u002Fwrite-app-spec-doc.js\" --spec @\u003Cworking-dir>\u002Fapp-spec.json --env \u003CenvUrl>\n   ```\n   It writes `\u003Cworking-dir>\u002Fmodel-app-plan.md` (jobs → surfaces traceability, data model, every\n   surface, navigation, access model, sample data) and prints `{ ok, docPath, bytes, warnings }`.\n   **Surface those `warnings`** — they name design gaps such as a job with no covering surface, an\n   app with no generative pages, or a new table that no persona and no `roleGrants[]` entry grants a\n   privilege on. With `--env` the document also lists, read-only, the roles the app already has\n   associated with it, apart from the privileges on the tables the spec adds (opening the app and using\n   a table are two questions); a read that fails is reported in the document as \"not checked\" and does\n   not fail the command. Tell the user where the document is; it's theirs to keep, and it's\n   regenerable after any spec edit.\n\n### Phase 1.5 — Generate pages (main loop, headless workers)\n\nAfter plan-mode approval (before the full build):\n\n1. **Data pre-build** — schema-only build so `genpage.js types` can resolve real column names:\n   ```bash\n   node \"${PLUGIN_ROOT}\u002Fscripts\u002Fbuild-model-app.js\" \\\n     --env \u003CenvUrl> --spec @\u003Cworking-dir>\u002Fapp-spec.json --stage data --apply\n   ```\n   `--stage data` applies solution + data-model only — **no `--sample-data`** (rows are created\n   once in the full build). Only `--stage data` is apply-safe; all other `--stage` selectors\n   and legacy `--from\u002F--to\u002F--only\u002F--skip` selectors are dry-run inspection only.\n\n2. **Types** — generate Dataverse type bindings for the entities the pages read:\n   ```bash\n   node \"${PLUGIN_ROOT}\u002Fscripts\u002Fgenpage.js\" types --env \u003CenvUrl> --data-sources \"\u003Centity1,entity2,…>\" --output-file \u003Cworking-dir>\u002FRuntimeTypes.ts\n   ```\n   `--data-sources` is the union of every intent page's `dataSources`. Skip this step entirely when\n   every intent page is mock-only. On Windows use forward slashes in the path. The script prints\n   `{ \"ok\": true, \"outputFile\", \"dataSources\", \"detail\", \"bytes\" }`; a failure (exit 1, `\"ok\": false`)\n   stops the step — report why, since the page workers must not guess column names.\n\n3. **Page plan (adapter)** — the page worker's input contract is a *plan document*, not an App Spec,\n   so project the spec into one. This also echoes the per-page dispatch parameters:\n   ```bash\n   node \"${PLUGIN_ROOT}\u002Fscripts\u002Fwrite-page-plan.js\" \\\n     --spec @\u003Cworking-dir>\u002Fapp-spec.json --working-dir \u003Cworking-dir> --env \u003CenvUrl> \\\n     --app \"\u003Capp name>\" --languages \"\u003Clanguages from the environment probe>\"\n   ```\n   It writes `\u003Cworking-dir>\u002Fapp-builder-page-plan.md` and prints\n   `{ ok, planPath, pages: [{ name, key, file, dataMode, intent }] }`. Pass `--languages` through\n   from the environment probe — omitting it silently defaults every plan to English-only and drops\n   the localization pattern. The command fails (before writing) if the plan would name a sample that\n   doesn't exist, or if a page a worker will write is not a safe target in the working directory — a\n   link at its path, a folder that links outside the directory, or a page already there under another\n   spelling — or if a link, a hard link or a folder is already at the plan's own path. Stop and fix\n   what it names; do not dispatch any worker.\n\n4. **Generate** — for each page from step 3 with `intent: true`, dispatch the **headless**\n   `genpage-page-builder` worker via `Task`. Use its documented input contract verbatim — a missing\n   field is why a page silently never becomes `.tsx`:\n\n   > You are the genpage-page-builder agent. Generate the **[name from step 3]** page.\n   >\n   > - Target file: [file from step 3 — already includes .tsx; do NOT append another]\n   > - Plan document: [absolute path to the app-builder-page-plan.md written in step 3]\n   > - Data mode: **[dataMode from step 3 — `dataverse` or `mock`]**\n   > - Connectors: **none**\n   > - Telemetry: **disabled**\n   > - RuntimeTypes: [absolute path to RuntimeTypes.ts]   ← omit this line when Data mode is `mock`\n   > - Working directory: [absolute working-dir path]\n   > - Plugin root: ${PLUGIN_ROOT}\n   >\n   > Follow the instructions in your agent file. Write [file] and return your result when done.\n\n   The plan's `## Environment` carries `Mode: app-builder` and every page row carries a **Key**, so\n   the worker emits `\"PAGEREF_\u003Ckey>\"` for cross-page navigation (never a file-derived token — a\n   downloaded page's `codeFile` is a path, not its identity). Custom nav ids go in `data:` — never\n   `recordId`. `Connectors: none` and `Telemetry: disabled` are constants here: `\u002Fapp-builder` writes no\n   connector code (the App Spec's `connectorBindings` \u002F `actionBindings` are lists a downloaded page already\n   holds, carried through a rebuild and never authored here, so the projected plan always says\n   `No connector bindings.`), and `\u002Fapp-builder` never runs the Phase 4.7 `custom-telemetry` probe. Both are stated explicitly\n   rather than omitted — the page-builder treats a missing line as the same fail-closed value, but\n   an explicit line is what makes the dispatch contract checkable.\n\n5. **Check styles, then validate + commit the transition (transactional)** — the workers have no\n   shell, so first check every generated page for the Griffel shorthands that `makeStyles` drops at\n   runtime, one command per page (`\u003Cfile>` is the page's file from step 3):\n   ```bash\n   node \"${PLUGIN_ROOT}\u002Fscripts\u002Fcheck-griffel-styles.js\" --file \u003Cworking-dir>\u002F\u003Cfile>\n   ```\n   Griffel does not support ten CSS shorthands, and `makeStyles` drops them at runtime: the page\n   type-checks, transpiles and deploys, then renders without the border, color or reset. They are\n   `all`, `borderColor`, `borderStyle`, `borderWidth`, `borderBlock`, `borderBlockStart`,\n   `borderBlockEnd`, `borderInline`, `borderInlineStart` and `borderInlineEnd`. Write longhands\n   instead: `borderColor`, `borderStyle` and `borderWidth` become one longhand per side, `border` +\n   `Top`, `Right`, `Bottom` or `Left` + `Color`, `Style` or `Width` (`borderWidth` →\n   `borderTopWidth`, `borderRightWidth`, `borderBottomWidth`, `borderLeftWidth`); `borderBlock`,\n   `borderInline` and their `Start` and `End` forms become the `Width`, `Style` and `Color` longhands\n   of the sides they name (`borderBlockStart` → `borderBlockStartWidth`, `borderBlockStartStyle`,\n   `borderBlockStartColor`; `borderBlock` → those and the three `borderBlockEnd…` ones); `all` has no\n   longhands, so set the properties you need one by one. Every other shorthand (`padding`, `margin`,\n   `border`, `borderRadius`, `gap`, `outline`) is supported, and an inline `style={{ … }}` is not\n   Griffel at all.\n\n   `check-griffel-styles.js` prints each problem it finds — a key Griffel drops in a `makeStyles`\n   call, at any depth, with its line, column and longhands, or a call or a style object it cannot\n   read, with what to change — and exits 3 while any is left: fix what it reports and run it again,\n   and do not transpile or upload the page until it exits 0. It reads the style objects written\n   inline in the call, `makeStyles({ … })`, so write them there: one passed or spread in from\n   elsewhere (`makeStyles(styles)`, `...base`) is reported, because the check cannot see its keys,\n   and so is a key computed from an expression (`[key]: …`), whose name it cannot see (a template\n   that starts with `--`, `&`, `:` or `@` is read); Fluent's `...shorthands.*(…)` and\n   `...typographyStyles.*` may be spread as they are.\n\n   The same command checks that each page establishes a scroll context (`references\u002Frules.md`,\n   **Page Layout**): the host shows a page in a container of fixed height and never scrolls it, so a\n   page with none is cut off below the fold. `no-scroll-context`, `scroll-context-unproven` and\n   `scroll-context-padding` are problems like any other, each with the edit that fixes it: apply it\n   and run the check again.\n\n   Review every generated page for iteration that another page compiler can lose as well:\n\n   Pages this plugin uploads are compiled with iterator support (ES5 with `downlevelIteration`), so a\n   spread, a `for...of` loop or an array destructure of a Map, Set, iterator, generator or string\n   reads it as modern JavaScript does. A tool that compiles the page again without that support — an\n   older maker portal, or `pac` — reads length and indices instead: values disappear, defaults replace\n   them, and rest destructuring or a string spread throws, all with a clean compile. Keep the page\n   correct under every compiler: convert with `Array.from(...)` before spreading, looping or\n   destructuring, for example `[...new Set(xs)]`, `[...m.values()]`, `[...seen.values()]`, `for (const\n   [k, v] of m)`, `new Set([...prev, id])`, `[...selected]` and `[...text.matchAll(re)]`; copy a Set\n   with `new Set(prev)` then `.add(id)`. Ordinary array spreads and loops remain valid. `Object.keys`,\n   `Object.values` and `Object.entries` return arrays. Rest destructuring of a non-iterable array-like without\n   `slice` throws under every compiler. A destructuring default must not write to the array being\n   destructured: `const [a = (values[1] = 3), b] = values` leaves `b` at its old value here, unlike\n   modern JavaScript. See **Common Errors > 5. Iteration that another page compiler can lose** in\n   `references\u002Frules.md` for the pairs.\n\n   Then validate and commit the transition — never flip `source` by hand, and never\n   flip pages one at a time as workers return. Run:\n   ```bash\n   node \"${PLUGIN_ROOT}\u002Fscripts\u002Fpromote-intent-pages.js\" \\\n     --spec @\u003Cworking-dir>\u002Fapp-spec.json --working-dir \u003Cworking-dir>\n   ```\n   It checks every generated page (file written, structurally a module, `PAGEREF_` tokens\n   canonical and in exact parity with the spec's `navigatesTo` edges) and only then flips **all**\n   of them `intent → { kind: \"tsx\", codeFile }` in a single atomic write. On any failure it\n   **exits 3 and leaves `app-spec.json` untouched**, printing which page failed and why —\n   regenerate just those pages and re-run. All-or-nothing on purpose: a half-flipped spec would\n   claim a `.tsx` that was never written, and Phase 2's `deploy` profile fails fast on any\n   remaining `source.kind === \"intent\"`.\n\n6. Proceed to **Phase 2** (full idempotent build).\n\n> ⚠️ The interactive author **never** runs inside a `Task` subagent. Only pure, headless\n> code-gen workers are dispatched here — all user-facing prompts originate in the main loop.\n\n### Phase 2 — Build (narrated, main loop)\n\n> **Always use `scripts\u002Fbuild-model-app.js`. Never hand-write a builder.** It's idempotent\n> (skips existing solution\u002Ftables\u002Fcolumns\u002Frelationships — so new, existing, and mixed envs all\n> just work), so you don't pre-create anything or special-case existing tables.\n\n**The build plan was already presented and approved in plan mode** (Phase 1 Step 6 shows the engine's\nreal dry-run plan), so on approval **apply directly** — one build approval, no second go-ahead. Add\n`--verify` so the build self-checks after applying (see Phase 3):\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fbuild-model-app.js\" \\\n  --env \u003CenvUrl> --spec @\u003Cworking-dir>\u002Fapp-spec.json --apply --verify [--sample-data] [--publish]\n```\n\nEach step streams its status live (`[n\u002Ftotal] ✓ created` \u002F `⊘ skipped` \u002F `✗ failed — \u003Cerror>`) and a\nclosing `✓ build complete — X created, Y skipped, Z failed` summary.\n\n> **Keep the build's progress visible.** A full build runs for several minutes. Let its output\n> **stream** — do NOT pipe it through `Select-Object -First\u002F-Last N` or `Select-String` head-limits,\n> which buffer and hide progress until the run ends (and can truncate a still-running pipe). To\n> capture the log use `Tee-Object -FilePath \u003Clog>` (no head-limit). The build also prints a\n> `▸ live progress:` line pointing at `\u003Cworkspace>\u002F.maker-workspace\u002Fbuild-status.json` — a snapshot\n> (`state`, `steps`, `lastPhase`, `lastLabel`) overwritten every step. Read it (or tail\n> `build-log.jsonl`) any time to report where a long build is, even if stdout is buffered.\n\n(**Reaching Phase 2 without a fresh plan-mode approval** — resuming a failed build, or a quick edit\nre-run — do a **dry-run first** (drop `--apply`), **paste the phase-grouped plan verbatim into your\nchat reply** (tool output is collapsed — see the CRITICAL note above), and get a go-ahead\nbefore applying.)\n\n**Push preview (`--preview-push`, dry run only).** For a complex change to an existing app (managed or\ndestructive features, many views), run the dry run with `--preview-push` to see, per artifact, whether a\npush would create, update or change nothing, and what would stop it (refused, stale, unknown), with its\nsolution layers and publication scope. It reads only. \"ready\" is not approval or a lock, and while a\ndirect SDK push can still write a \"noChange\" artifact, this build skips the push of an existing view it\nwould not change. It previews an existing view with the column and\ndescription changes the build would make, and a chart the build would create. Everything else (an\nexisting form, chart or the app, a view or form the build would create, a command bar) is listed as not\nevaluated, because the build works those changes out only while it runs: say so, never report the\npreview as complete. A preview that fails prints its code and the dry run stands. Do not use it on every\napply; it is refused with `--apply` and with `--no-live-plan`.\n\n**Stage selector (`--stage \u003Cdata|ui|app|publish>`)** maps to its phase range. On `--apply`, ONLY\n`--stage data` is accepted (solution + data-model, no rows in run 1; run 2 is a full build). All\nother stages and the legacy `--from\u002F--to\u002F--only\u002F--skip` selectors are dry-run inspection only —\ntheir phase ranges are not dependency-closed and are rejected on `--apply`.\n\n**Language (`--language-code` \u002F `--languageCode \u003Clcid>`)** — you normally do **not** pass this.\nData-model labels are\nstamped with the organization's own base language, read once per build. Pass it only to author\nlabels in a different **provisioned** language, or if the build warns that it could not determine\nthe base language and fell back to 1033.\n\nIf you pass an LCID the organization has **not** provisioned, the build now stops in the data-model\nphase, before any label is written, and lists the ones it does have. That check exists because\nDataverse handles this **inconsistently**: table and choice labels are accepted (HTTP 204) and\nsilently stored under the organization's base language, while `DateTime` and `Memo` columns are\nrejected with *\"The language code N is not a valid language for this organization\"*. Without the\ncheck a build therefore creates the table with the wrong labels and then dies partway through the\ncolumns, phases away from the flag that caused it — which reads like an environment fault. List the\nprovisioned set with\n`node \"${PLUGIN_ROOT}\u002Fscripts\u002Fdataverse-request.js\" \u003CenvUrl> GET RetrieveProvisionedLanguages`.\nThe check is best-effort: if that read fails the build proceeds unchanged.\n\nThe App Spec field `languageCode` pins the same value across runs. It now covers the **whole** build:\ndata-model labels, and form, dashboard and sitemap labels — the SDK serializers that used to hardcode\n1033 take the authoring language as an option.\n\n**Verify with the same flag.** A build run with `--language-code \u003Clcid>` writes a form's tab and section\ncaptions in that language, so run the standalone verifier with the **same** `--language-code \u003Clcid>` (or pin\n`languageCode` in the spec): without it, `--verify` looks for the captions in the organization's base language and\ncannot confirm a correctly published form's captions (it lists them as unverified or reports them missing). The\nbuild's own `--verify` is told the language automatically. If verify cannot establish the language at all (the\norganization cannot be read), it lists those captions as **unverified** — neither passed nor failed — with the\nreason: re-run it with the flag.\n\n**A language the environment's form read does not show.** The platform decides which languages' labels the form's\nFormXML carries, and it can return fewer than the form stores: a form built with Spanish (`3082`) captions in an\nEnglish-language organization reads back, with the Spanish captions stored, with its labels in English only. Verify\nnever calls a caption missing in a language the read does not carry, as long as the read carries labels in other\nlanguages — it reads those captions from **one translation export of the app's solution** instead (a single extra request,\nmade only when there is such a caption: 7–11 s for a solution of one table, more as the solution grows; it shows the\npublished layer), so a right caption passes and a stale or empty one fails like any other, and a\n`{ \"1033\": …, \"3082\": … }` label map is compared language by language the same way. When the export fails or cannot say (a\nfailed request, an archive it cannot read, no row for the form), verify lists the labels compared in that language as\n**unverified** (neither passed nor failed; the run's result and exit status are unchanged), with the reason and the\nlanguages the read does carry. Say so, and ask the user to check those captions in Power Apps with that language; do not\nrebuild to \"fix\" them. A language the read does carry is still compared strictly, from the read: a stale caption in it\nfails. A form whose read carries no label at all is not such a case: the captions the spec declares for it are missing, and fail.\n\nNarrate progress as it runs. Transient env errors (a 429 or 503, a customization lock, a concurrent-operation\nguard or a SQL timeout the service names by its error code, a timeout or reset of the connection) are\n**auto-retried** with backoff on `--apply` (the build is idempotent, so a retry reuses what's already created).\nA throttled service is waited for as long as it asks (`Retry-After`) — by the HTTP client's re-sends of a throttled read or service-protection-limited publish, by the page writes and by the build's own re-runs of a phase — inside one budget of five minutes per run for all the waiting\na throttle costs: when the next wait does not fit, the build stops with a `throttle-budget-exhausted`\nhalt that says what the service asked — run it again later and it continues. (A 5xx, a reset connection or a deadlock is not a throttle: those keep their own, shorter schedule and are not counted in it.) If the build still **halts** (`BuildHalt`) on an\nunrecoverable error, surface it and ask the user how to proceed via `AskUserQuestion` (adjust the\nspec \u002F cancel), then re-run. Everything is scoped to a dedicated unmanaged solution; **`--publish`\ngates the final *bulk* publish**, which also carries the edits made to existing views and forms.\nWithout it those edits — and always an existing app's sitemap re-sync — still publish their one\ntargeted artifact so the change takes effect (see *Notes & limits*).\n\n**Sensitive configuration in the workspace.** An earlier plugin version wrote environment-variable and\nconnection-reference copies (which can hold values, defaults, Key Vault secret references and connection ids) into\nthe workspace's `environment-variables` and `connection-references` folders and their `.metadata` folders. This\nversion never deletes them for you. While such files remain, every command that opens that workspace prints one\n`WARNING:` naming the folders (never their content). A copy the plugin cannot prove is what the environment last\nheld (an edit never sent, a file with no partner, a locked file) stops the step that needs it with\n`WORKSPACE_LEGACY_CONFIGURATION_COPY`, naming its two files. To clear either: when no build is running, move any\nchange you still want into the App Spec or the deployment settings file (the build sends configuration only from\nthose), close any program holding the files, delete the `.json` files in those folders, and run again. Tell the user\nwhat the warning or the stop names before deleting anything.\n\n**Recovery from a failed or halted build: run the full build again.** The build is idempotent — every\nphase re-uses what's already created and only fills the gaps. SDK metadata is persisted under\n`\u003Cworking-dir>\u002F.maker-workspace\u002F` (override with `--workspace`); environment-variable and connection-reference values,\nsecret references and connection ids are never written there. There is no apply-safe\n`--from \u003Cphase>` shortcut; a full rerun is the correct and safe recovery path — after a `WEB_RESOURCE_UNVERIFIED`\nhalt too: a web resource was written but its publication could not be confirmed (often because another customization\nheld the environment's lock), the build recorded it, and a rerun using the **same writable workspace** writes it\nagain by its id (the page manifest only when its published copy does not already hold that content; otherwise the\nrerun keeps it); do not delete or rename it. If the halt says its recovery record could not be saved, or reports\na conflicting name\u002Fid, follow that explicit resolution instead — automatic retry is unsafe without the identity.\nOne exception: an\n`already-exists` halt recurs on a rerun until that workspace directory is deleted — follow its message.\nAnother: that workspace belongs to the environment it was first opened for. Only `--apply` opens it — a dry\nrun works in a temporary workspace, so it binds nothing, previews from any folder, and warns when an `--apply`\nthere would be stopped. A build pointed at a different `--env` **halts before reading or writing anything in\nit** and names both environments. It is never cleared or re-bound for you — that discards the SDK's saved copies\nof the other environment's artifacts, including any edit made in them that was never pushed, and the\npage-ownership receipts and baseline kept beside them are that environment's too. Build against the\nenvironment the halt names, or use a fresh app folder (copy `app-spec.json` and the files it names) or a new\n`--workspace`. Only if that environment's copy of the app is no longer wanted, tear it down there with the\n`--clear-workspace` command the halt prints, which keeps the folder while a page-ownership receipt remains. The\nhalt prints the folder on a line of its own, and that command takes it as `--workspace` — pass it exactly as\nprinted, quoted for your shell (inside double quotes PowerShell and bash expand a `$` in the path). A folder that\nholds nothing a build saved — the SDK's empty folders only, which an earlier preview or a build that stopped at\nits start leaves — is described as exactly that: nothing was built in that environment, so there is nothing to go\nback to or tear down, and the folder can simply be deleted or moved aside. A folder whose `manifest.json` names\nno usable environment, or is not valid JSON, halts too: move it aside (rename it rather than delete it — it can\nhold page-ownership receipts and the baseline) and run again. The same environment under its other host name\n(`\u003Corg>.api.crm…` against `\u003Corg>.crm…`) also halts: re-run with the host the halt names. The standalone verifier\nnever opens that workspace either, so it verifies any environment the app is deployed to.\n\nRun only one apply command for an app in its workspace at a time, including its data stage and full build. If another build holds the build or pages lock, let it finish and then rerun the same full command; do not repeatedly launch retries, use a second workspace to bypass it, or delete the workspace. A lock refusal is on stderr with exit 1 and no stdout JSON; do not treat empty stdout as an unknown crash or a reason to reset the workspace. A teardown, download, standalone `\u002Fgenpage` or `apps.js` mutation, or workspace clear is not stopped by this lock; do not run one against the same app\u002Fworkspace beside the apply. A lock is abandoned only after its owner is confirmed no longer running; age alone is never sufficient. If automatic reclaim cannot complete, inspect the owner evidence and consider removing only the named lock\u002Freclaim file manually after that confirmation. Keep the workspace and its recovery records. For concurrent-build protection, all overlapping build commands must use the new version. During a mixed-version transition, finish older builds first and keep the downloaded app unique name's spelling unchanged.\n\nWith `--publish`, the tables the build changed, and the tables whose forms or charts the app holds or is about to hold, are published in one\nrequest before the build writes or publishes the app: the tables whose existing views and forms the build edited, the tables of the\ncharts it wrote, the navigation's tables whenever the build pushes the app (the SDK adds their active Main forms to it on every push the build\nmakes, so a form that is live with a label saved and not published would otherwise be pinned and published with the app before its table was:\nthe first build and the build that pins a form are covered the same way; a changed-only re-upload of a page that has to pin a default view\nthe app lost pushes and publishes the app through the page backend, whose push adds the view it pins and no form, so it names no table of\nthe navigation), and — for an app that already exists — the tables of the form and\nchart components its saved component list names, whether or not the spec names the table (a form a maker added to it, say, one never\npublished included). A label someone saved and did not publish on a form of one of them would otherwise stay unpublished once the app\nis published. A table the app is not known to hold a form or chart of is not published by it, so what a maker left unfinished there\nstays unfinished: a table only declared in `entities` (the target of a lookup column, say), one that only a page reads, or one that\nonly `app.tables` pins. If the app's components cannot be read completely, or a read of them is ambiguous (a row of the component\nlist that cannot be placed included), the build publishes only the tables it changed and the navigation's, and says which read failed; run it again once the cause is cleared. That is one more\npublish for a build that edits no existing view or form (a first build included); the final publish covers the tables the build has\nartifacts of.\nIf that request is refused the build goes on, and says so: it names what it saved on those tables, the forms the app holds\nthere, or its write adds, whose labels someone else may have saved, and what the app's publish may leave out as a result.\nA build that **halts with an error** publishes the views and forms it had deferred (best effort), then — when it stopped\nbefore the publish phase — lists the forms, views and charts of the spec's tables (the tables its pages read included) that\nare still saved but not published, what it created and anything anyone saved there, or says it could not read them and names\nthe tables to publish. Columns and other kinds of change are not in that list. A halt after the publish phase says nothing of\nthe kind.\nOne that is **killed** — Ctrl-C, a crash, a closed terminal — after those edits are saved but before\nthat publish cannot, so they stay saved but not live until the next build. Run the same full build\nagain: it publishes them without writing them again.\n\n### Phase 3 — Verify & iterate\n**`--apply --verify` already reconciled the spec against what deployed** (Phase 2) — the build appends a\n`verify PASS` \u002F `verify FAIL — N missing` line and **exits non-zero on a silent partial** (an artifact\ncreated but not wired, or a phase that quietly produced nothing). To **re-check later** — e.g. after a\nMaker change, without rebuilding — run the standalone read-only verifier (entities\u002Fcolumns\u002Fviews\u002Fcharts\u002F\nforms and sitemap subareas + icons; exits non-zero and lists anything missing):\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fverify-model-app.js\" --env \u003CenvUrl> --spec @\u003Cworking-dir>\u002Fapp-spec.json [--language-code \u003Clcid>]\n```\n\nPass `--language-code` only if the build was run with it. A line starting `⊘` under the verdict is a check verify\ncould **not decide** (it is in the JSON result's `unverified` list): it is neither a pass nor a failure, so say what it\nwas and what settles it — the language of the captions, which `--language-code` gives, or captions in a language the environment's\nform read does not carry that the translation export could not settle (the line says why), which only Power Apps can show — never report the run as \"everything deployed\" while\none is listed.\n\nA `WARNING:` line on stderr — each one is repeated in the JSON result's `warnings` list, which is absent when there is\nnone — is advice, not a verdict: a spec an earlier release accepted that the build would now refuse (it names the column\nor relationship and the fix for the next build), or a page workspace the run could not remove (it names the folder to\ndelete by hand). It changes neither `ok` nor the exit status, so a run that passes can still carry one: pass each on to\nthe user. A run that stops on an unexpected error prints that error and no JSON.\n\n**Command buttons (`--inspect-components`).** When a command button misbehaves, or after changing\ncommands, run verify with `--inspect-components`. It checks each declared control by its recorded row on\nthe surface you declared (a `MainTab` button on the form, `HomeTab` on the main grid, `ContextualTab` on\na subgrid). Caption-only matches, hidden or disabled controls, and controls on another surface or app do\nnot pass. It checks the stored definition, not what a browser renders. Today the build records no row\nid for a control, so every control it finds is reported `UNVERIFIED … found by caption only` and the\nrun fails: tell the user which lines say `FAIL` (missing, on another surface, several matches) — those\nare real problems — and that a caption-only line means the button could not be proved to be the app's\nown, and may also hide a problem with it: a hidden control (or one under a hidden parent) found by\ncaption is reported caption-only, not `FAIL`, while a disabled one still fails (`stored disabled`). No\n`FAIL` line does not prove a button is visible.\n\nThen open the app in the browser. Refine `app-spec.json` and re-run Phase 2 to iterate.\n\n**Teardown (cleanup).** To remove everything an App Spec built — e.g. a live-verification probe or a\nfailed build — run the classifier-safe teardown. It deletes only the artifacts the spec declares, in\ndependency order (**app module → dashboards → command bars → forms → security roles → charts → views\n→ reset enriched default views to drop parent lookups → relationships → AI row summaries → tables\n[children-first] → web resources (generated app icon + page manifest + declared) → global choices →\nsolution**). Forms\u002Fcharts\u002Fviews\u002Frelationships are deleted **explicitly before tables** (a table\ndelete does not reliably cascade cross-references; it does remove the table's own columns). A built\ntable's only Main form is refused by Dataverse (\"You must have at least one active Main form\"); the table's\ndelete removes it, and the run counts it as removed only when a fresh read of its id shows it gone —\notherwise the refusal stays a failure. Security\nroles come **after forms** because a form assigned to a role names it inside its own formxml, which\nthe platform counts as a dependency, and **before** relationships\u002Ftables because a role holding a\ntable's privileges can block that table's delete. Command\nteardown removes the whole command bar for any entity the spec authored commands on. **Teardown only\ndeletes tables this build created** — a **system\u002Fstandard table** (account, contact, …) is\nauto-detected and **skipped**, and a **reused custom table** is skipped when its entity is flagged\n`\"existing\": true`, so pre-existing data survives. The same flag protects **relationships and global\nchoices** — a download sets it on every one it recovers, so tearing down a downloaded spec never removes\na lookup column from a retained table or deletes a shared option set. Dashboards are found by name, so\nteardown deletes only those the app's solution holds, never another app's namesake — and none when the spec\nhas no real solution to ask (the `Default` a download may leave); it keeps the solution itself while any step\nfailed, so a re-run can still tell, keeps the page manifest while the generative-pages step failed, so a\nre-run still finds the pages the app authored, and keeps a table — with its icon web resource and a global choice its\ncolumns bind, which the platform refuses to delete while the table exists, and its relationship to itself — while a\nbusiness rule on it could not be deleted (the rule's activated copy can never be deleted once its table is gone), so\na re-run deletes the rule first, then the table and what was kept with it. It never deletes the solution's\n**publisher** (the build reuses one by prefix, and other solutions may share it); its closing summary says so in one line,\nso tell the user the publisher stays and can be removed in Maker once nothing uses it. It also keeps every declared\n**field security profile** and names each one (users and teams may hold it beyond this app). **Generative pages on forms:** teardown keeps a page a\nform still embeds (the `MscrmControls.UxAgentControl` control) and stops with an error that names the form, before it deletes\nanything; the dry run names the same form and reports itself as failed. Tell the user, have them take the page off that form\n(or delete the form, if it is theirs), then run teardown again. **Dry-run by default**; add `--apply\n--allow-destructive` to actually delete (`--clear-workspace` also prunes `.maker-workspace\u002F`).\n**`--allow-destructive` is required for `teardown --apply`** — without it teardown refuses and\ntouches nothing.\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fteardown-model-app.js\" \\\n  --env \u003CenvUrl> --spec @\u003Cworking-dir>\u002Fapp-spec.json [--apply] [--allow-destructive] [--clear-workspace]\n```\n\n**Safety flags (build + teardown).** The apply path is fail-closed against destructive operations:\n\n- **`--allow-destructive`** — authorize destructive operations. For `build --apply`: authorizes\n  overwriting an existing app in unattended mode, and allows explicit-layout form-field removals or\n  sitemap-target drops; also authorizes DETACHING a `pages-removed` page's nav subarea (the page\n  record is left deployed — it is not deleted). For form and sitemap removals, the authority covers\n  the removals the last refusal or approved run recorded; if live state would lose anything more,\n  the apply halts, lists only the newly destructive removals, and records that new list for review.\n  A field or sitemap target that appears during a run is kept or halted before push, never removed\n  unseen. The record is consumed only after a full successful build that ran the removal phases and\n  kept nothing; it is kept on failures, partial runs, changed-only runs, unreadable records, and\n  failed discovery. For `teardown --apply`: **required** — all deletes\n  are destructive by construction, so teardown without this flag halts before touching anything.\n- **Pages-phase safety HALTs.** The build halts on identity or safety violations rather than\n  proceeding with potentially wrong state. Surface the HALT reason and follow the recovery hint:\n  - `pages-identity-conflict` — spec `pageId` and manifest disagree on a key, or a duplicate id\n    spans two keys. Resolve the conflict manually (re-download or delete the manifest).\n  - `pages-manifest-corrupt` — the manifest cannot be parsed (two keys map to the same id). Delete\n    the manifest web resource and rebuild from scratch.\n  - `pages-removed` — a live page was dropped from the spec. Re-add it, or pass `--allow-destructive`\n    to detach it from the nav (the page record stays deployed; rebuild finalizes the sitemap).\n  - `pages-shared-across-apps` — the page appears in another app's sitemap, published or only saved (not yet\n    published — an app that was never published counts). Detach it from that app — ask the user first, since this\n    changes another app. The halt names the app and prints the command with the app's `id` filled in (`\u003Cid of app …>` stands where the id could not be read, and\n    `scripts\u002Fapps.js list --env \u003CenvUrl> --search \u003Cname>` gives it); `node \"${PLUGIN_ROOT}\u002Fscripts\u002Fgenpage.js\" remove-from-app --env \u003CenvUrl> --app-id \u003Cthat app's id> --page-id \u003Cpage id>`\n    takes the page out of that app's navigation and publishes that app (everything it has saved goes live with\n    it; the page itself stays). Or detach it in Maker. `--allow-destructive` does **not** bypass this halt.\n    The build checks again right before it updates pages in place, so a page another app takes in while the build runs halts it\n    there too (\"became shared across apps while this build ran\"); one taken in while the pages upload is reported after them as a\n    warning naming the app, since it is written by then.\n  - `pages-shared-check-failed` \u002F `pages-existence-failed` \u002F `pages-sitemap-read-failed` — a\n    prerequisite read failed; the build can't proceed safely. Retry on a transient error; check\n    permissions on a persistent one.\n  - `pages-griffel-shorthand` — a page's `makeStyles` writes a CSS shorthand Griffel drops at runtime, so the page\n    would deploy without its border, color or reset. The message names the page, each key's line and column, and the\n    longhands to write; fix the page's source and re-run. Nothing was uploaded. It is raised for a page the build would\n    create and for a page whose source changed since the last build; a page you did not touch that already has one is sent\n    again as it is, with a warning (it renders without the key today). Deleting a key keeps the page looking as it does;\n    writing the longhands makes the style start to render. The same halt reports a `makeStyles` call the check cannot read\n    for certain as that — not as CSS Griffel drops — and says what to change in the code.\n  - `pages-locked` — another build of this app, or a `genpage.js add-to-app` \u002F `remove-from-app` \u002F `genpage-upload.js --app-id`\n    edit run from this folder, holds the app's pages lease. No page was written. A build takes that lease only when it\n    reaches its pages phase, so its earlier phases (solution, tables, forms, app shell) may already have saved their\n    changes: tell the user so, never that nothing changed. Wait for the other build or edit to finish and run the build\n    again; that run reconciles what was already saved. (A standalone `genpage.js` \u002F `genpage-upload.js` edit that gets this\n    refusal takes the lease first, so it did write nothing. Such an edit holds the app's build lease too, so a build started\n    while it runs is refused at once with `build-locked`, having written nothing: run the build again once the edit ends.)\n    It is a single-machine lock in this folder's\n    `.maker-workspace`, not a guard against an edit from another machine.\n  - `form-page-embeds-incomplete` — a page the spec embeds in a form (`forms[].genPages`) was not embedded. The message names\n    each key and why (`halt.notApplied`); tell the user both and never report the build as done. **In this release the CLI\n    build cannot embed a page in a form** (it has no record of the embeds it made, so it fails closed with\n    `managed-bindings-unavailable` after building everything else): when a user asks for a page on a form, say so and offer\n    the page in the app's navigation instead (`placement` left as `sitemap`). The same code at preflight means the run had the\n    forms phase but not the pages phase — run both.\n- **`--non-interactive`** — suppress interactive prompts (for automation \u002F CI). A non-interactive\n  build that encounters an existing app **fails** instead of warning-and-proceeding, unless\n  `--allow-destructive` is also set. Does **not** grant destructive authority on its own — only\n  `--allow-destructive` does.\n- **`POWER_PLATFORM_SKILLS_NONINTERACTIVE=1`** (or `true`) — env-var equivalent of\n  `--non-interactive`. Same semantics: suppresses prompts only, never authorizes destructive ops.\n  Set this in CI job environments to avoid interactive-prompt hangs.\n- In **autopilot \u002F eval mode** (`--non-interactive` + `--allow-destructive`), `preview-app.js`\n  is written to disk as the design artifact before plan execution; interactive consent gates are\n  bypassed and the build is fail-closed against any destructive op not explicitly authorized.\n\n### AI-first features\n\nThe `ai` block in the App Spec controls four app-level features and per-table Copilot row\nsummaries. All features are **admin-gated**: they are enabled only where the environment\nadministrator has turned them on in Power Platform Admin Center (Environments → Settings →\nProduct → Features). The `ai-features` build phase preflights each setting via the SDK\n(`RetrieveSetting`) and, for anything off, **skips it with a warning** — it never fails the\nbuild and cannot flip admin or tenant switches itself.\n\n**Preflight (standalone):**\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fai-preflight.js\" --env \u003CenvUrl> [--app \u003CuniqueName>]\n```\nPrints each feature's on\u002Foff status and the exact admin action required for anything that is off.\nNever fails.\n\n**App-level features** (`ai.appFeatures`) — `formFill` (Copilot-assisted form fill), `nlSearch`\n(natural-language grid\u002Fview search), `nlChart` (NL chart \u002F AI data visualization), `m365` (M365\nCopilot). All default to on except `m365`, which is left at its platform default; `false` writes an\nexplicit Off for this app (each setting's values: `references\u002Fapp-spec-schema.md` → `ai`).\n\n**Per-table row summaries** (`ai.summaries`):\n- `default: \"auto\"` — the skill auto-selects good-candidate tables (skips lookup-only \u002F config \u002F\n  junction tables and the Dynamics 365-owned `incident`, `lead`, `opportunity`).\n- `default: \"off\"` — summaries disabled unless a table opts in explicitly.\n- Per-table overrides in `summaries.tables`: set `enabled`, a tailored `instruction`, and\n  `columns[]` (the fields the summary reads). A `{ \"enabled\": false }` entry opts a specific\n  table out.\n\n**Prompt authoring guidelines** (for `instruction`): write for meaningful insights — not field\u002Fvalue\nrepetition; never include record GUIDs; pull in recent activity where relevant; use\naudience-appropriate tone; aim for an explicit output shape (a short paragraph).\n\n**Teardown** removes the AI records created by the `ai-features` phase (summary config rows and\npublished AI models) in addition to the standard artifacts.\n\n---\n\n## Editing a deployed app (download → edit → rebuild)\n\nThe **same App Spec drives edit** — there is no separate edit path. When the user wants to change an\nexisting app (add a field\u002Fview\u002Fpage, edit a page's code, retitle\u002Freorder nav, swap an icon), **pull the\ndeployed app fresh into a spec first**, then edit that spec and re-run Phase 2:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fdownload-model-app.js\" --env \u003CenvUrl> --app \u003CappId|uniqueName|displayName> --out \u003Cworking-dir>\n```\n\n`--app` resolves in identity order: app id (GUID) → `uniquename` → display name. Prefer the **unique\nname** — it is immutable, while a display name can be renamed and is not unique. A display name that\nmatches more than one app is refused, listing the candidate unique names rather than guessing.\n\nThis reconstructs the app into `\u003Cworking-dir>\u002Fapp-spec.json`. **Round-trip scope — be precise, it is\nnot everything:**\n- **Round-trips:** the sitemap → `appShell` (all subareas + icons), **every** generative page (read\n  through the SDK; the pages are the sitemap's `GenPage` subareas, so Maker-added pages\n  are included, and each keeps its own name, model, and connector and Custom API bindings —\n  `connectorBindings` \u002F `actionBindings`) into `pages[]` + their `.tsx`, the referenced\n  entities (minimal — the build reuses existing tables), **classic dashboards** (id-passthrough tiles\n  carrying the deployed view\u002Fchart ids), the icon web resources, and the solution.\n- **Does NOT round-trip:** `forms[]`, `views[]`, `charts[]`, `commands[]` — they come back empty\n  (a declared form comes back only with `--include-managed --managed-manifest \u003Cstore file>`; see\n  **Declared form layouts**; so does a declared view a `createIdentity` build created and the store proves\n  unchanged while the app's solution holds it, with its `viewId` and `createIdentity` (a rebuild writes\n  nothing to it; the rest of the rebuild runs as usual), the rest named in `managedViews.omitted`, and such a\n  declared chart, with no id (only a build from the same folder's store binds it), the rest named in\n  `managedCharts.omitted`). `commandStates[]` is never written either: a button's hidden \u002F disabled\n  state stays on the live row.\n  All four **survive on the live app** (a rebuild preserves them by discovery), so a plain edit is\n  safe; they just aren't editable through the downloaded spec. Change them in Maker or a fresh spec.\n  The download names every one it leaves out — the command-bar buttons of the app's tables included —\n  in its `NOTE` and its result's `notRoundTripped`, and lists them under `descriptionInventory` in the\n  spec: tell the user before they rebuild the spec in another environment, which would not have them.\n- **Roles are not in the spec, and a rebuild leaves them as they are.** A download carries no\n  `personas[]`: the roles associated with the app stay as the environment has them. Keep `personas[]`\n  out when you extend an app whose roles somebody else owns — a persona's role is converged to exactly\n  the privileges declared, and a role the build did not author is refused. Give an existing role a new\n  table with a `roleGrants[]` entry (additive; it does not associate the role with the app). Lint and\n  the design document name each new table no persona and no grant covers, and `write-app-spec-doc.js\n  --env` lists the roles the app has.\n\n**Page bindings and another environment.** A page's connector and Custom API bindings are in the spec, by the\nproperties the references document — `logicalName`, `connectorId`, `dataset`, `tables`, `tableDisplayNames`,\n`operations` for a connector binding; `name`, `isFunction`, `boundEntityLogicalName`, `displayName`,\n`parameterKinds` for a Custom API binding — each with a value of a shape known to be safe, and by nothing else,\nso a rebuild writes them back into this environment and into another one. A list in which any binding holds\nanything else (a connection id, a credential, a property no spec states, a URL with a query) is **not** in the\nspec at all: the pull's `pageBindings.notCarried` names the page, the list and the entry's place (never a value),\nand the page keeps that list as it is. Tell the user, and that the page folder's own `config.json` still holds\neverything — they must not commit or share that folder if a value there is a credential. A spec that states such\na binding is refused. A rebuild cannot make what the bindings *name*. When the pull's result carries\n`pageBindings`, tell the user what it says before any rebuild into another environment: `neededInTarget` lists\nthe connection references (and the connections behind them), the Custom APIs and the service resources (a\nSharePoint site and its list ids, say) that environment must already have, and `notCarried` the lists the spec\ncould not state (a rebuild into the same environment leaves those as they are; into another one, they are bound\nwith `\u002Fgenpage`). The rebuild itself reads that environment's references before it writes anything: it **stops**\n(`pages-binding-reference-conflict`, nothing written) at a connection reference of that name that is for another\nconnector — give the binding the logical name of a reference that is for the right connector, or set the\nbinding's `connectorId` to the one that environment has, and never pick a reference for the user — and its\nwarnings say by name each reference or Custom API that is not there yet, a reference that has no connection, an\noperation the custom connector there does not define, and what it could NOT check (a row that did not say its\nconnector or connection, or operations no custom connector definition could prove): relay them. A binding named\nexactly `WhoAmI` or `RetrieveVersion` is a reviewed built-in Dataverse operation, not a Custom API: the pull lists it\nunder `neededInTarget.dataverseOperations` (nothing to deploy), and a rebuild reads nothing for it and says\n`These are reviewed built-in operation names; their availability in this environment or player and the signed-in\nuser's permissions were not checked.` — relay that too, never as \"missing\" and never as \"compatible\"\n(`references\u002Fdataverse-operations.md`). Do not write bindings into a\nspec yourself — they come from a page a pull read — and when you reset a page to `intent` to regenerate it, delete\nits bindings from the spec: the generator writes no connector code.\n\nThen:\n\n1. **Always pull fresh at the start of an edit session** — someone may have changed the app in Maker. The\n   build reads an etag when it hydrates, so a write against an artifact changed since the pull throws a\n   version conflict → **re-pull and retry**, never clobber. Pull into the **same `\u003Cworking-dir>`** every time:\n   a page keeps the `key` its earlier download gave it (read from the `app-spec.json` already there, when that\n   file names this app in `app.uniqueName`; matched by the page's id), and a copy of the spec deployed to\n   another environment is bound to the pages it built there by those keys — a key that changed would update a\n   different page. A new folder mints keys again. If the pull answers `\"code\": \"page-keys-ambiguous\"`, the\n   earlier `app-spec.json` gives one key to two pages (or one page two keys) and **nothing was written**: show\n   the user the message, which names the pages and keys, and either correct the file and pull again or —\n   only when the user says so, because fresh keys can make a copy deployed elsewhere update the wrong\n   pages — pull again with `--reset-page-keys`, which re-keys exactly those pages. If it answers\n   `\"code\": \"navigation-language-unknown\"`, the environment's base language could not be read, so the\n   language of the app's navigation titles is not known, and **nothing was written**: pull again, or pass\n   `--language-code \u003Clcid>` (the environment's base language — the flag the build takes; a spec already in\n   the folder that pins `languageCode` needs neither). Do not guess it: a spec whose titles were read in the\n   wrong language writes them over the right ones on the next build.\n2. Edit `app-spec.json` (and any page `.tsx`) for the requested change. A page you edit by hand is\n   checked like a generated one: run `node \"${PLUGIN_ROOT}\u002Fscripts\u002Fcheck-griffel-styles.js\" --file \u003Cpage.tsx> --existing`\n   on it before you rebuild (the rule and the ten shorthands are in Phase 1.5, step 5) and fix what it\n   reports. `--existing` reports the page's scroll context (`references\u002Frules.md`, **Page Layout**) in\n   `notes` without changing the exit code: tell the user about each note and offer the edit it gives. A key the page already had when it was downloaded is reported too: the deployed page renders\n   without it today, so deleting it keeps the page looking as it does, while writing the longhands makes\n   the style start to render — delete it unless the user wants that change. The build runs the same\n   check on every page it uploads that is new or that you changed since the last successful apply of this app, and halts as\n   `pages-griffel-shorthand` — naming the page, each key's line and column, and the longhands — so a page\n   you changed does not reach the app with one. \"Changed\" is measured against the source that apply recorded for the page in\n   `.maker-workspace\u002Flast-applied.json` (a successful full or changed-only apply, or a download, writes it; a failed or partial build records nothing).\n   A page you did not touch is sent again as it is, and a\n   key it already has only draws a warning — and so does a page you changed in a workspace that holds no record of it (a new or moved one, or\n   another environment), where the build cannot tell what was sent: run the checker on that page yourself.\n   A page you edit by hand also follows the iteration rule of Phase 1.5, step 5 (**Common Errors > 5.\n   Iteration that another page compiler can lose** in `references\u002Frules.md`): convert a Map, Set or\n   iterator with `Array.from` before spreading, looping over or destructuring it. An upload compiles the\n   changed page again with iterator support, so a form it already had now reads its values where an\n   earlier release lost them, converted or not; convert such a form only when the requested change needs it.\n3. **If the edit ADDS a page** (or resets a page's `source` back to `intent` to regenerate it),\n   **re-run Phase 1.5 before Phase 2** — a downloaded spec contains only `kind: \"tsx\"` pages, so an\n   added `intent` page has no code and Phase 2's `deploy` profile rejects it. Phase 1.5 is safe to\n   re-run: `write-page-plan.js` projects **all** pages (so the worker sees the real nav graph), a\n   worker is dispatched only where the echo says `intent: true`, and `promote-intent-pages.js`\n   leaves built pages untouched. Editing an *existing* page's `.tsx` by hand needs no regeneration.\n4. Re-run the **build** (Phase 2). It's idempotent: it reuses the existing app\u002Ftables\u002Fviews, **updates\n   each page in place** (matched by name → `--page-id`, so no duplicates), and **preserves the\n   existing `GenPage` subareas** (the download enumerated them into `pages[]`\u002F`appShell`, so the\n   full-replace sitemap write never drops them).\n5. **Verify** (Phase 3) to confirm only the intended change landed.\n\n> **Prefer generative pages over classic dashboards** per the genpage-first policy. Classic dashboards\n> do round-trip (id-passthrough tiles), but the views and charts their tiles point at do not, so they\n> can only be edited in Maker.\n\n## Fixing rows, listing a solution, moving an app\n\nThree explicit tools for asks that are not a build. None runs from the App Spec; use each only when the\nmaker asks for what it does.\n\n**Fix values in existing rows** (\"fix the status on these 30 rows\", \"set the missing region on old\nrecords\"). Plan the change:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fdata-fix.js\" plan --env \u003CenvUrl> --app-dir \u003Cdir> --table \u003Cname> --filter \u003Codata> --set \u003Cjson> --max-rows \u003Cn>\n```\n\nThe plan prints only counts, a plan id and a digest: OPEN the review file it names and show the maker\nthe before\u002Fafter values it lists, and the row count. Apply only after the maker approves those values:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fdata-fix.js\" apply --env \u003CenvUrl> --app-dir \u003Cdir> --plan-id \u003Cid> --approve \u003CplanDigest> --app \u003CappUniqueName>\n```\n\nAdd `--workspace \u003Cdir>` if the app's build uses one, and pass the same `--app`\u002F`--workspace` to `resume`\nand `revert`.\n- It waits for no build: if the app's build is running, it refuses (`DATA_FIX_BUSY`); try again after it.\n- A non-zero exit means not every change was made. Rows another maker changed after the plan are\n  reported as conflicts, never overwritten.\n- A partial run continues with `resume`, which retries only rows not attempted. Rows whose outcome is\n  unknown are never resent automatically and keep the run non-zero.\n- `revert` writes its own review file and asks for fresh approval of it. If it stops before writing, run\n  `revert` again for a fresh review of what is left.\n- A row whose outcome was unknown, or one written without what a revert needs, cannot be undone: the\n  revert review lists it, the revert leaves it as it is and exits non-zero. Check those rows by hand.\n  When NO applied row can be undone, the revert writes no review file and exits non-zero with only the\n  counts: the plan's journal (`\u003Capp-dir>\u002F.data-fix\u002F\u003CplanId>\u002F`) records which rows were written.\n- It is not atomic.\n\n**See what is in a solution** (\"what is in solution X\"):\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fsolutions.js\" inspect --env \u003CenvUrl> --solution \u003Cname>\n```\n\nIt lists supported artifacts by kind, tables whose subcomponents it did not expand, and components it\nskipped or could not read, with its request count. It is not everything the solution owns, and it is\nnot a portable set of components. A component it could not read carries a code and HTTP status, not\nthe service's message: there is none to pass on.\n\n**Check whether an app can move to another environment** (\"can I move this app to prod\"):\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fplan-app-promotion.js\" --source-env \u003CenvUrl> --target-env \u003CenvUrl> --package \u003Csolution.zip> --app \u003Cname>\n```\n\nIt only reads. It lists the components it cannot promote (most schema, forms, views, flows and similar\ncomponents today) and what the target needs.\n- There is no apply step. It never falls back to an import.\n- Pass `--acknowledge-non-atomic-import` only when the maker accepts that an import can partly succeed.\n- The existing solution export\u002Fimport remains a separate path with its own limits.\n\n## What the builder does (in order)\n\nsolution (idempotent) → data model — **discover** existing tables\u002Fcolumns\u002Frelationships via the SDK\n(`findTables` \u002F `findColumns` \u002F `fetchEntityMetadata`) and create only what's missing (`createTable`\n\u002F `createColumn` \u002F `createRelationship`) → **sample data** (opt-in; relational\u002Ftopological,\n`$parent`→`@odata.bind` using the entity-set name) → **web resources** (opt-in;\n`createWebResource` for form JS\u002FHTML\u002FCSS) → **views** → **charts** → **forms** (primary + columns\nlaid out, explicit `tabs` honored; sub-grids, quick-views, and form JS (`events[]`) applied as\ncanonical control cells \u002F the `\u002Fbag\u002Fc` events region via the SDK's generic `addElement` surface)\n→ **business rules** (`businessRules[]` — authored as the workflow object model through the bound\n`CreateProcessWithWfomJson` member and activated; **skipped with a warning** on an environment that\ndoes not declare that member or has it switched off — HTTP 400 `0x80040216`, common on production environments) →\n**business process flows** (`businessProcessFlows[]`; a category-4 process compiled from the\nauthored stages and activated — this goes through the SDK's generic artifact surface, a plain\n`workflows` row, so it is NOT subject to the bound-member gate above) →\n**command bar** (`commands[]`) → **classic dashboards** (opt-in)\n→ **app module + sitemap** → **generative pages** (each page's `.tsx` was generated in Phase 1.5;\nthe build writes each `pages[]` page through the SDK, without placing it; then\nthe SDK rewrites the sitemap once to add the `GenPage` subareas) → **AI features** (opt-in) →\n**security** (one role per `personas[]` entry, sized from its jobs' declared access; injects an\napp-module read privilege and associates the app to each role so it opens for that persona) →\npublish (opt-in). When the app has generative-page subareas the app module is created first WITHOUT\nthem (they can't resolve until the pages upload), then the pages phase rewrites the sitemap — except for a\nnew app whose navigation holds ONLY page subareas: its pages are created first, and then the app, with them\nalready in its first sitemap. All\nDataverse access goes through the SDK, so the downloaded metadata lands in `.maker-workspace\u002F`.\nIndependent ops (columns, views\u002Fcharts\u002Fforms) run with bounded parallelism; publish is one\nround-trip per entity + the app. Views\u002Fcharts build **before** forms so a sub-grid can reference the\nchild view id. Each step emits `[n\u002Ftotal]`.\n\n## Notes & limits\n\n- **Headless, no browser.** The SDK (`cds-maker-sdk`, vendored at `scripts\u002Fvendor\u002F`) generates\n  designer-grade FormXML\u002FFetchXML\u002Fsitemap by reusing the designer's own serializers, and writes via\n  the Web API using an `az`-token HttpClient. No relay, no designer tab.\n- **Dedicated unmanaged solution per app** (review \u002F teardown). **`--publish` gates the final\n  *bulk* publish** of the app's entity + app customizations (one `PublishXml` for every entity and the\n  app). With `--publish` that one publish also carries the default-view enrichment, and the tables the build\n  changed, with the tables whose forms or charts the app holds or is about to hold, are published together once\n  more, in one request before the app is: the tables touched by the reconcile of an existing form or view, form\n  events and quick-view placement, so none of them publishes on its own, the tables of the charts the build wrote\n  (a chart's description is saved on the unpublished layer), the navigation's tables whenever the build pushes the\n  app (the SDK adds their active Main forms to it, and a form that is live with a label saved and not published\n  would otherwise be pinned and published with the app before its table was; a table whose `app.mainForms` list\n  keeps no form adds none; a changed-only re-upload of a page that has to pin a default view the app lost is\n  covered too — its push adds the view and no form, so what it publishes ahead of the app is the tables of the forms and charts the app holds — and one that has nothing to pin publishes nothing), and — for an app that already exists — the tables of the form and chart components\n  its saved component list names, a form a maker added to it and never published included, so a label saved and\n  not published there is not held back by the app's publish. A table the app is not known to hold a form or chart\n  of is not named (declared only, a lookup column's target, read only by a page, or only pinned in `app.tables`):\n  a table's publish ships everything saved on it, whoever saved it. If the app's components cannot be read\n  completely the build publishes only what it changed and what its write adds, and says which read failed. It\n  does **not** suppress the small **targeted** publishes that edit\u002Ffinalize paths must run so the change\n  takes effect: without `--publish`, reconciling an existing form or view, wiring form events and\n  placing quick-views each publish that one artifact, and with or without it, re-syncing an existing\n  app's sitemap and finalizing the sitemap after generative pages publish the app, and repairing a\n  lookup column still labelled with an old default publishes its table (an unpublished edit\n  to a live artifact is invisible). A fresh build without `--publish` still leaves new\n  tables\u002Fcolumns\u002Frelationships staged-but-unpublished in the solution, except on a table a declared form\n  (`reconcile: \"declared\"`) is published on: that table publish puts live every saved change on the table,\n  its new columns included (a declared dashboard is likewise published after its write).\n- **Idempotent — but not full desired-state convergence.** Existing\n  solution\u002Ftables\u002Fcolumns\u002Frelationships\u002Fviews\u002Fcharts\u002Fforms\u002Fcommands\u002Fdashboards are detected and\n  **reused**, so re-runs and existing-table envs work without collisions. **The caveat for EDITS:** a\n  rebuild never removes an artifact you dropped from the spec, and re-applies only part of an edit to\n  one that already exists. A **form** converges its fields (added; for an explicit layout, dropped ones\n  pruned — see `prune: false` below), column counts and spans. A **view** only *adds* columns: a\n  column removed from the spec, or a new column order, does **not** apply, and neither do its filters\n  or sort. A changed column type, and an edited command or dashboard, are not re-applied at all; an\n  existing chart takes only a changed description, an existing app takes a changed name and description\n  (an app that was never published keeps its text and the build warns it was not applied, and so does one whose name or\n  description is localized — only that text is held back: the other text and a routing description are applied, the SDK\n  writes only what changed, and a text that is not plain is never sent, even when the SDK's own read of the header fails;\n  the icon is set when the app is created: a\n  different `app.icon` is reported as not applied), and an existing\n  business process flow takes the stage and step edits that cannot move a record — a stage added or renamed,\n  a step added, renamed, rebound or moved — and refuses, saying why, one that would remove a stage or a step\n  or reorder the stages (no stage or step edit is then applied; the requested Active\u002FDraft state is handled\n  independently).\n  **To apply one of those edits, change it in Maker, or `teardown --apply` then rebuild fresh.**\n  `--verify` catches what is **missing** — a spec view column, filter condition or sort key (authored\n  sort keys must also keep their order), a relationship, a table's command bar, a status reason, an alternate key\n  or a dashboard — as a loud `verify FAIL`. It tolerates **extra** deployed content, so\n  a view column, filter or sort key you removed from the spec still passes, just as one a maker added\n  by hand does. Individual command controls are not verified.\n- Not in scope (later): **conditional** command visibility (Power-Fx-only), **titled\n  command groups** (from-scratch — needs an SDK-synthesized parent row), lookup\u002Fassociated views,\n  multi-area sitemaps, and **access teams \u002F hierarchy security** (a tracked SDK follow-up). The\n  security surface today is role-per-persona, per-form role assignment and, from 2.21.0, column-level\n  security (`isSecured` + `fieldSecurityProfiles[]`). Also out of scope: the BPF knobs the spec gate rejects\n  (cross-entity stages, branching, stage actions).\n- **Environment-gated (may not work where you are running):**\n  - **Business rules** (`businessRules[]`). The SDK writes a rule through the bound\n    `CreateProcessWithWfomJson` member — the same one the modern business-rule designer uses — and\n    **has no fallback**: the client-side workflow-XAML compiler it used to fall back on was removed\n    upstream because it covered 4 of the 7 action types and a single clause, so it silently narrowed\n    a rule into something that did not say what the author wrote. Environments that do not declare\n    the member therefore **cannot host business rules at all** — and that is the common case, not an\n    edge case. **Production environments are the other common case**: they declare the member but\n    answer the first rule with HTTP 400 `0x80040216` (\"An unexpected error occurred.\"), a platform\n    limit, and nothing is created. The build **skips** the rules in both cases, warns once naming the\n    member or the code, and builds everything else normally, so an app is never left half-created. If rules are\n    essential, verify the environment first.\n    **Business process flows are NOT affected by this gate** — a BPF is written as an ordinary\n    `workflows` row through the SDK's generic artifact surface, with no bound member involved.\n- Supported: the full data model — all column types, **AutoNumber primary**, global choices, status\n  reasons, alternate keys, **N:N + junction-with-payload**; **`required` reconciled on existing\n  columns** (`true`, `false` or `\"recommended\"` — anything else is refused at validation; an explicit\n  `required` converges on rebuild; an omitted one never demotes) and **asked\n  of a new table's primary column in its create**, said applied only once the SDK confirms it;\n  **Boolean `defaultValue`**, whole-number **`integerFormat`** (incl. `Duration`), and per-column\n  **write permissions** (`isValidForCreate` \u002F `isValidForUpdate` \u002F `isValidForRead` — this is how you\n  make a column read-only), all applied on **create and on rebuild**; adaptive\n  main forms with **1:N \u002F N:N sub-grids** (placed between sections or in a tab \u002F form-column with\n  `tab` \u002F `column` \u002F `after` \u002F `before`, and moved into place on rebuild); **per-field form control** (`readOnly` \u002F `hidden` \u002F\n  `after` positioning, plus `prune: false` to edit a subset of a form non-destructively);\n  **quick-create \u002F quick-view forms** (`formType`) + **quick-view placement**\n  (`forms[].quickViews[]`); **per-form security roles** (`forms[].securityRoles` — name the\n  `personas[]` this form is offered to, or `everyone: true`; applied after the roles exist. A form\n  with no assignment is visible to **every** role, so this **restricts** a form rather than granting\n  it); **which form a table opens with** (`forms[].isDefault` \u002F `entities[].mainFormOrder` set the\n  table's Main Form Set order, on existing tables too — a user's remembered form still opens first for\n  that user; see app-spec-schema.md); Choice-column charts; **business rules** (`businessRules[]` — authored as the modern workflow\n  object model and activated; see the environment gate above); **security roles** (`personas[]` — one role per\n  persona sized from its jobs-to-be-done, with app access so the app opens for non-admins);\n  **dashboards** (`dashboards[]` — chart\u002Flist\u002Fiframe\u002Fwebresource tiles) + **dashboard sitemap\n  placement**; **generative pages** (`pages[]` — the genpage-first default, written through the SDK\n  and surfaced as `GenPage` sitemap subareas; full **create + edit**\n  round-trip via `download-model-app.js`); **modern command-bar buttons** (`commands[]`) incl.\n  **flyout \u002F split-button menus**; **rich view filters** (`eq-userid`\u002F`this-week`\u002F`in`\u002F`not-in`);\n  **custom grid rendering** (`entities[].columns[].visualization` — radial dial \u002F line chart \u002F\n  heat map \u002F star rating, preview); web resources + form JS event handlers; sample data with\n  **multi-parent `$parents`** + **`statusReason`**. See [`docs\u002Fapp-builder-capabilities.md`](..\u002F..\u002Fdocs\u002Fapp-builder-capabilities.md) and\n  [`references\u002Fapp-spec-schema.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema.md) (plus\n  [`app-spec-schema-advanced.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema-advanced.md) for the conditional\n  fields it points at) — author from those docs; you should not need to read the SDK, lint, or\n  engine to write a spec.\n","> **Plugin check**: Run `node \"${PLUGIN_ROOT}\u002Fscripts\u002Fcheck-version.js\"` — if it outputs a message, show it to the user before proceeding.\n\n> **Model check (lightweight models only)**: If you are a lightweight model optimized for fast, simple tasks, tell the user in your first message that `\u002Fapp-builder` works best on a general-purpose coding model or an advanced reasoning model — designing the App Spec, reasoning about the dependencies between tables, relationships and artifacts, orchestrating the build and reconciling what already exists take multistep planning, tool use and validation — and recommend switching; then continue. On any other model, skip this note and say nothing about it.\n\n# app-builder — intent → model-driven app\n\nTurn a natural-language intent into a deployed model-driven app. You author a reviewable **App Spec**\n(JSON) with the user across confirmed turns, then a deterministic engine (`cds-maker-sdk`, vendored)\nbuilds it — tables\u002Fcolumns\u002Frelationships, sample data, views, Choice-column charts, adaptive forms\nwith sub-grids, **generative pages** for overview\u002Fdashboard surfaces, and the app module + sitemap.\nThe **same spec drives create and edit**: download a deployed app back into a spec, change it, and\nre-run the build (it's idempotent).\n\n## CRITICAL — run the interactive flow in THIS conversation (the main loop)\n\n> **You MUST run the authoring questions and the build narration yourself, in the main\n> conversation. Do NOT dispatch a subagent (`Task`) for the interactive steps.**\n>\n> A subagent is headless — `AskUserQuestion` and plan mode do not reach the user from inside one\n> (its only output is its final message). The whole point of this skill is the multi-turn,\n> propose-then-confirm experience, so every `AskUserQuestion`, `EnterPlanMode`, and live build\n> status line must originate here, in the main loop.\n\n## CRITICAL — the user sees your chat message, NOT tool output\n\n> **Shell\u002Ftool output — the result of running `preview-app.js`, a dry-run plan, or a lint —\n> is COLLAPSED BY DEFAULT in the UI. The user does NOT see it unless they manually expand the\n> tool panel.** Running the command is therefore NOT the same as showing the user. Every artifact\n> the user must **read, review, or approve** — the whole-app **preview wireframes**, the\n> **dry-run build plan**, and blocking **lint findings** — MUST be reproduced **verbatim in your\n> chat reply**, inside a fenced ` ``` ` code block. Never say \"the preview looks right\" and leave\n> the content buried in a collapsed panel: **paste it into your message.** This is the #1 cause of\n> \"the wireframes aren't visible\" — the preview ran, but its output stayed hidden.\n\n## Capabilities — the full toolbox (pick best-fit per requirement)\n\nYou are a **complete** model-driven app builder, not a single-surface tool. Everything below ships in\none App Spec and one build — choose what best serves the user's requirement to make a **useful,\nprod-ready** app; don't under-build (a bare table list) or over-build (surfaces nobody asked for):\n\n- **Data model** — tables (give each custom table a **meaningful Fluent-style SVG table icon by default**; propose what the glyph will **depict** in words — never a Fluent token name — and record it as `iconDescription` before drawing the SVG — see [`references\u002Fauthoring-flow.md`](..\u002F..\u002Freferences\u002Fauthoring-flow.md) → *Table icons*), columns (all types), relationships (1:N \u002F N:N + junctions), sample data\n- **Record UI** — forms (sub-grids, quick-create \u002F quick-view), views (with enriched default columns), charts\n- **Custom grid rendering** (preview) — `entities[].columns[].visualization`: render a column as a\n  `RadialDial`, `LineChart`, `HeatMap` or `StarRating` in **every** grid and view that shows it,\n  instead of plain text. Reach for it when a column is a *magnitude a user scans* (a score, a\n  utilization %, a rating, a priority) rather than a value they read exactly — it makes a list\n  scannable at a glance for one line of spec. It is per-*column*, so set it once on the column, not\n  on each view. **Preview:** on an environment where it is not provisioned the build skips it and\n  everything else still deploys, so it is always safe to include.\n- **Actions** — modern command-bar buttons (incl. flyout \u002F split menus), web resources (form JS \u002F HTML \u002F CSS).\n  Two rules when writing that JS, both learned from buttons that deployed perfectly and then did\n  nothing: a command handler is handed the record (`function doThing(primaryControl)`) — the build\n  supplies the parameter, so write that signature; and **never hardcode Choice values** like\n  `100000003`, because they are assigned per publisher. Resolve by label via `getOptions()`\n  (see `references\u002Fapp-spec-schema-advanced.md` → webResources). Note also that command and web-resource\n  **edits do not redeploy on rebuild** — the phases reuse what exists, so changing a button or a\n  script means deleting it first (only a button's hidden \u002F disabled state can be set in place, with\n  `commandStates[]` below; the build warns, and verify fails, when a web resource's deployed\n  content differs from the spec's). This does not apply to recovery of the build's own\n  `WEB_RESOURCE_UNVERIFIED` row: keep that row and the same build workspace, then follow its halt.\n  When the maker wants a rebuild to keep a web resource's content in step with the spec, mark that\n  resource `reconcile: \"declared\"` instead (`minimumPluginVersion: \"2.21.0\"`) — only when asked, one\n  resource at a time, never a shared (`external`) one, and never every resource of a downloaded or\n  older spec. A rebuild that would change one that exists stops before writing and names its approval\n  (`--authorize adopt:webresource:\u003Cweb resource name>`) with the components that depend on it: show them to the\n  maker and let them choose. Emptying its content also needs `--allow-destructive`; the halt says so.\n- **Show or hide an existing button** — `commandStates[]` (`minimumPluginVersion: \"2.24.0\"`, `app.uniqueName`):\n  only when the maker asks to show, hide, enable or disable a modern button that already exists. **Never invent a\n  row id**: run `node scripts\u002Flist-command-states.js --env \u003CenvUrl> --app \u003CuniqueName>` and pick the row by `rowId`\n  (never by caption) among `candidate: true` rows; write `scope: \"table\"` only (app-scoped buttons are refused in\n  this version) and only `hidden` \u002F `disabled` — a normal empty `visibilitytype` on a button `commands[]` built is\n  static and is never a reason to change it. Never write a command `key` in the same spec, and never create a\n  button with `commands[]` and set its state in the same build: create it in one build, add the state in the next.\n  The apply is a full build with `--publish`. Run a dry run first and show the maker every\n  `--authorize overwrite:command-state:…` (one per row change) and `--authorize publish:command-state-table:…`\n  token it prints — the table one publishes **all** saved customizations on that table, for every app that shows it —\n  and pass them exactly as printed. Never replay a row write by hand: on `command-state-write-unknown` or\n  `command-state-version-conflict`, list the row again, dry-run again and get the new approval (an ordinary phase\n  retry of the build re-plans from a fresh read). Report three things separately: the rows saved, the table\n  publication confirmed — or `command-state-publish-unconfirmed` (\"saved, not published\") — and what the maker sees\n  in the app, which neither the build nor `--verify` (stored flags only) checks. A table publish that was sent can\n  still complete after a halt or after the entry is removed; this release keeps no record of it across runs, and a\n  later publishing run requests the table again only because the spec still names it.\n- **Form logic without code** — `businessRules[]`: show\u002Fhide, lock\u002Funlock, set-required and\n  set-value, driven by a condition on the record. **Reach for a business rule before form JS** when\n  the requirement is field-level and declarative — it is visible in the maker, survives solution\n  export, and needs no web resource. Use form JS when the logic needs a real API call, cross-record\n  work, or anything beyond the four supported actions.\n- **Guided processes** — `businessProcessFlows[]`: the staged bar across the top of a record\n  (ordered stages, each with steps bound to that table's columns — **every step must bind a `field`**;\n  the platform rejects one without, so use a Boolean flag for a manual check-off). Reach for one when\n  the user describes work moving through **phases** — \"triage →\n  investigate → resolve\", \"lead → qualify → close\". Author it `Active` (the default) or the stage bar\n  does not appear at all. Who may run a flow is `securityRoles: { \"personas\": [...] }` (Active flows\n  only). v1 is single-entity and linear: cross-entity stages, branching and stage actions are\n  **rejected** by the spec gate, so offer Maker for those rather than writing them into the spec.\n- **Surfaces** — **generative pages** (modern dashboards \u002F overviews \u002F analytics \u002F landing — the default),\n  classic dashboards (opt-in), external URLs\n- **App shell** — the app module + sitemap, with per-subarea icons. Turn on the **modern shell** with\n  `app.newLook: true` unless the user asks for the classic one; it is opt-in and best-effort, so a\n  tenant without the setting still gets a working app. `app.headerNavigationRefresh` controls the\n  **Wave 2 header\u002Fnavigation refresh** — a *separate, independent* setting whose platform default is\n  **ON**, so set it to `false` only when the user explicitly wants the classic header.\n- **App theme and header logo (Preview, 2.21.0)** — `app.theme`. Add it **only when the maker explicitly asks\n  for branding** (brand colours, a header colour, a logo) or says yes to the branding question you ask of every new app\n  at the personas step (authoring-flow Level (a0)); an ordinary app gets **no** `app.theme` without one of those, and you never\n  invent a palette, a font or a logo. Offer the choices: a `basePaletteColor` (or explicit `palette` slots), the\n  `appHeader` colours, a `font` only if they name one, and a `logo` that is an **existing image web resource**\n  (or one you also declare in `webResources[]`), never a URL. Say before the build that the theme is published\n  with the **app**, and that an app publication publishes **every** pending change of the app, not only the theme.\n  The theme does not change the `newLook` \u002F header choices above — do not switch them to fit a theme. Omit the key\n  to leave the app's theme alone; `null` removes the app's override (the environment theme applies again). Theme\n  versions are never deleted, and a logo the theme only references is never touched by teardown. `--verify` reports the theme's **API state** (saved,\n  pending publish, live) — tell the maker to check the header in the app itself.\n- **App membership** — which forms, views and charts the app offers (`app.mainForms`, `app.tables`).\n  **Only these forms on an existing app.** `app.mainForms` adds the forms you list. To also take the table's other Main\n  forms **out of the app** on an update, set `\"mainFormsOnUpdate\": \"exact\"` — ask the maker first, it is a removal from the\n  app's membership (no form is deleted). It needs an unmanaged, published app; the build publishes only once Dataverse reads\n  back exactly your list, and otherwise stops with the change saved and the app's publication owed.\n\n  **Pin the artifacts the spec declares.** `\"pinDeclaredArtifacts\": true` adds the spec's own forms, views, charts and\n  dashboards to the app explicitly — use it for a chart or view of a table that is not in the navigation. It only adds.\n  When to use them: `\"exact\"` only on an explicit \"only these forms\" \u002F \"remove the other forms\" ask, after\n  showing the maker which tables it covers (the build refuses it on an existing app without\n  `--allow-destructive`); never for \"add the Summary form\", which `app.mainForms` alone does. Suggest\n  `pinDeclaredArtifacts: true` for a **new** app whose spec declares a chart, view or dashboard of a table\n  that is not in its navigation. Never turn either on by yourself for an existing app. Both need\n  `minimumPluginVersion: \"2.21.0\"`.\n- **Security & access** — one **security role per persona**, sized from that persona's jobs-to-be-done\n  (the entity access each job needs, unioned into the role), so the app **opens for non-admins**.\n- **Confidential columns** — `isSecured` + `fieldSecurityProfiles[]`. Reach for them when the design\n  names a value only some people may see or change (salary, medical notes, an identifier, private\n  comments): a security role cannot hide one column, a profile can. Name who gets each profile\n  (`assignTo` users or teams, by id) — never infer them from a persona — and say in the preview who\n  gains access, or that no assignment was requested. Tell the maker that System Administrators see\n  every secured column (test as a non-admin), that an open app may need a reload, to grant `read`\n  unless `update` is needed, that unsecuring a column deletes its permissions\n  (`--authorize isSecured:\u003Ctable>.\u003Ccolumn>`), and that a teardown keeps each declared profile and names it.\n- **Portable schema** — `{ \"value\", \"label\" }` options when an integration or another environment\n  depends on the option numbers; `dateTimeBehavior: \"DateOnly\"` for birthdays, due and renewal\n  dates, `\"TimeZoneIndependent\"` for a time that means the same clock everywhere (omit it for\n  timestamps); table `searchEnabled` \u002F `duplicateDetectionEnabled` only when the maker asks. Never\n  change an existing column's date behaviour or turn duplicate detection off unasked: both need\n  `--authorize`. All need `minimumPluginVersion: \"2.21.0\"` — see\n  [`references\u002Fapp-spec-schema-advanced.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema-advanced.md).\n- **Declared views, charts and search columns** (`minimumPluginVersion: \"2.21.0\"`) — write\n  `reconcile: \"declared\"` on each view or chart you author for a **new** app, and, when editing, on the\n  one existing view or chart the maker asks to change: a rebuild then applies its columns, filters, sort\n  and joins (`linkEntities`) instead of only adding columns. Never set `title` on a new declared chart,\n  and give a declared view its own name — not the stock `Active \u003Cplural>` or `Inactive \u003Cplural>`, which\n  every table already has, so changing one is an adoption. Two declared charts on one table need different\n  names, and so do two declared views unless each has its own `key`: a `viewId` pin does not tell them apart, and the build refuses the\n  pair (see Approvals in the advanced reference).\n  For a new table you create, propose `entities[].quickFind.findColumns` (the primary name plus what a\n  user types in the search box: a number, an email, a code) and confirm it with the maker; on an\n  existing table, only when the maker names what search should match. A change to a view or chart that\n  already exists stops the build with nothing written and names its approval\n  (`--authorize adopt:view:\u003Ctable>\u002F\u003Cname>` or `adopt:chart:`, `overwrite:` for changes made elsewhere, `--allow-destructive`\n  to remove columns): explain it and let the maker choose; never edit the spec to avoid it. A local copy\n  that differs from the server's stops it the same way (`workspace-copy-unsent-edits`) and is kept: ask\n  whether to put that change into the spec and refresh the local copy, or approve the `overwrite:` key\n  it prints (`overwrite:quickfind:\u003Ctable>` for search columns); pass a key exactly as printed. Never write\n  `reconcile` on a web resource except as the web-resource bullet above says, on a form, a dashboard, a business\n  rule or a business process flow except as their bullets below say, and never write a command `key` (keyed command bars are refused\n  in this version). Leave a downloaded or older spec without these fields as it is — see the advanced reference.\n- **Declared form layouts** (`minimumPluginVersion: \"2.21.0\"`) — write `reconcile: \"declared\"` on a form\n  only when the maker asked its layout to follow the spec (fields, spans, sections, field options, sub-grids,\n  handlers) or said yes when you offered it at Level (b); not for \"add a form\" or \"add a field\" with no layout. Tell the maker: controls the spec does not\n  declare stay where they are and nothing is deleted (so no `--allow-destructive` is needed for them); a layout the build cannot place safely stops before any\n  write; a table publish puts live every saved change on that table, not only this form, with or without\n  `--publish` (a declared dashboard is published after its write either way); and Dataverse does\n  not provide a working conditional-write guard for a form's saved layer, so the build re-checks it just\n  before writing, but an edit made in Maker at that instant cannot be detected. Never write `genPages`, `prune`, `isDefault`,\n  `deactivateOtherMainForms`, `securityRoles` or a `mainFormOrder` place on a declared form (refused).\n  An existing form is bound only with `--authorize \"adopt:form:\u003Ctable>\u002F\u003Cformtype>\u002F\u003Cname>\"` (lower case;\n  `overwrite:form:` for changes made elsewhere): explain it and let the maker choose. `--verify` checks a\n  declared form against the spec, sub-grid views included (a form whose publish is unconfirmed is unverified,\n  not passed). A download brings declared forms back only with `--include-managed --managed-manifest \u003Cstore\n  file>` (one with an event handler comes back with its handler library as an `external` web resource when\n  that library is this publisher's own unmanaged script; otherwise it is left out and named in\n  `managedForms.stale`, and its declaration is written ready to paste in the new file `managedFragments.file` names (`.maker-workspace\u002Fmanaged-fragments-\u003Ctime>-\u003Crandom>.json`)\n  with the library it needs, so tell the maker to add both from the spec it was built from); it carries no binding, so the first build that binds each form from the downloaded folder needs\n  `adopt:form:\u003Ckey>` (a rebuild that writes nothing may leave it unbound). A form removed from the spec and\n  then deleted in Maker is released by the next build, which names it (`managed-root-retired`); until then\n  `--verify` fails it. One whose publish is unconfirmed is not released (see the unconfirmed publish below). A\n  build that warns a form's or dashboard's retirement could not be confirmed stops before it writes anything\n  (`managed-not-settled`) and sends nothing more in that run, not even an earlier attempt's deferred publish;\n  running it again reads it afresh and publishes that. A plain form (by its name, `\u003Ctable> form` when it has\n  none, or its `formId`) that replaces a removed declared form with unfinished work (a lost create, an owed or\n  unconfirmed publish) is refused (`managed-form-unsettled`):\n  restore the declaration and let it settle, or run the build again later.\n- **Declared dashboards** (`minimumPluginVersion: \"2.21.0\"`) — write `reconcile: \"declared\"` on a global\n  dashboard only when the maker asked its tiles to follow the spec on rebuilds, or said yes when you offered it at Level (b); give it and every tile a\n  `key`. Tell the maker: tiles the spec omits stay (nothing is deleted), and settings a tile does not state are\n  kept; a new tile is added after the last row; in an environment with more than one language a new tile gets\n  its caption, with the same text, in every language the environment has (if the build cannot read those\n  languages, it stops before it writes the dashboard: `dashboard-languages-unreadable`, so run it again; the\n  platform keeps some of those captions and drops others, an iframe tile's for one, and a dropped one other\n  than the base-language caption is no change); an\n  unfinished dashboard of the same name is not taken over\n  and not deleted; a dashboard this build cannot finish is not published, including by the app publish; a\n  dashboard the build created and could not prove is named by id in the stop: when the build knows it created it,\n  delete it and run the build again, which creates it anew; when the stop says the build cannot tell who created\n  it, have the maker inspect it and do not delete it; `dashboard-languages-unreadable` after a lost answer means\n  run the build again; and\n  Dataverse does not version a dashboard's saved layer, so an edit made in Maker at the instant of the write\n  cannot be detected. An existing dashboard is bound only with `--authorize adopt:dashboard:\u003Ckey>`\n  (`overwrite:dashboard:\u003Ckey>` or `overwrite:dashboard:\u003Ckey>\u002F\u003Ctile>` for changes made elsewhere,\n  `--allow-destructive` to clear its description with `\"\"`): explain it and let the maker choose. `--verify`\n  holds a declared dashboard to its last build (a dashboard changed in Maker since fails until a build\n  settles it; one whose publish is unconfirmed is unverified, not passed). A download brings it back declared\n  only with `--include-managed --managed-manifest \u003Cstore file>` (otherwise it is an undeclared entry), with the\n  dashboard and tile ids it was proved on; its first binding needs `adopt:dashboard:\u003Ckey>`, because the\n  downloaded folder has no store.\n- **Declared business rules** (`minimumPluginVersion: \"2.21.0\"`) — write `reconcile: \"declared\"` on a rule only\n  when the maker accepts that the build manages the WHOLE rule (the offer at the personas step, or their own ask); give every condition, action and apply-action a\n  `key`. Tell the maker: conditions and actions are never matched by their text; a new rule is created Draft and\n  activated only if nobody changed it in between; a rule that already exists is never edited by the build\n  (change it in Maker, then re-adopt it); a rule changed outside the spec stops the build until it is re-adopted\n  whole with `--authorize adopt:rule:\u003Ctable>\u002F\u003Cname>` and a declaration naming its whole body; and an environment\n  that cannot host business rules skips them. Explain the approval and let the maker choose. `--verify` holds a\n  declared rule to its last build (a rule changed in Maker since fails until it is re-adopted). A download\n  brings it back declared only with `--include-managed --managed-manifest \u003Cstore file>` (otherwise it is left\n  out, as every business rule is); the first build that binds a rule that already exists needs\n  `adopt:rule:\u003Ctable>\u002F\u003Cname>`, because the downloaded folder has no store.\n- **Declared business process flows** (`minimumPluginVersion: \"2.21.0\"`) — write\n  `reconcile: \"declared\"` on a flow only when the maker accepts that the build manages the WHOLE flow (the offer at the personas step, or their own ask); give every\n  stage and step a `key`. Tell the maker: a key keeps a stage's or step's id, so a rename keeps the records on it;\n  a new flow is created Draft and activated only if nobody changed it in between; a flow that already exists is\n  never edited by the build (to change its body or status, change it in Maker, then re-adopt it, keeping every\n  stage and step in place); removing or reordering a stage or step is always refused, and no change in Maker or\n  re-adoption unlocks that; a flow changed outside the spec stops the build until it is re-adopted whole with\n  `--authorize adopt:bpf:\u003Ctable>\u002F\u003Cname>` and a declaration naming its whole body. Explain the approval and let\n  the maker choose. `--verify` holds a declared flow to its last build (a flow changed in Maker since fails until\n  it is re-adopted). A download brings it back declared, keys included, only with `--include-managed\n  --managed-manifest \u003Cstore file>` (otherwise it is left out); the first build that binds it from the downloaded folder\n  needs `adopt:bpf:\u003Ctable>\u002F\u003Cname>`, because that folder has no store. Changing only who may run a managed flow\n  (`securityRoles`) writes nothing to the flow; the build records it. A managed download restores a flow that has\n  `securityRoles` only when it can prove each persona the flow names from the role a build made for it, and then\n  writes that persona into `personas[]` (a NOTE names it). Tell the maker that persona now owns its role: a\n  privilege added to that role outside the spec is removed by the next build. When a persona cannot be proved,\n  the download leaves the flow out with a warning naming the personas and why (nothing is lost; the store and the\n  maker's own spec keep it) and writes the flow ready to paste in\n  the new file `managedFragments.file` names. Tell the maker to paste that flow and copy the\n  personas it names from the spec it was built from. Earlier fragments files are kept; never delete one\n  yourself. If the download stops with `managed-fragments-unwritable`, `.maker-workspace` is not a plain folder\n  or cannot be written: ask the maker to fix it, never move or delete it yourself. A\n  declared rule or flow removed from the spec whose row was deleted is no longer managed once the build reads it gone\n  by its id (a `managed-root-retired` warning, which never means it was activated); until then, a removed one whose\n  change is still waiting to be proved keeps the build incomplete. A retirement a build reports it could not\n  confirm also ends that build incomplete; tell the maker to run the build again, which reads the record afresh.\n- **An unconfirmed publish** — a build that stops naming `--authorize publication-risk:table:\u003Ctable>\u002F\u003Cdispatch>`\n  (or `publication-risk:dashboard:\u003Cid>\u002F\u003Cdispatch>`) lost the answer to a publish that may still complete.\n  Tell the maker to check what is live on that table; pass the key exactly as printed, from the latest stop,\n  only when they accept the risk, whichever step printed it. The key names that one lost publish: an older\n  key does not accept a later one, and a key that matches nothing is reported as not used. That run records\n  it before it writes anything and stops (`publication-risk-accepted`); the next build publishes after the\n  usual checks. A dashboard the spec no longer declares stays owed (`publication-withheld`) until its\n  declaration is restored. A run that cannot tell whether it recorded the key stops before any write\n  (`publication-risk-record-unconfirmed`): run the build again without the key. `--allow-destructive` never\n  gives it. When the stop says the saved layer is still the one the publish shipped yet the published layer\n  reads differently, the platform may read that form's two layers apart: have the maker compare what is\n  published with the spec; each later publish of that table can stop the same way.\n- **A saved change the build did not make** — a declared form's table is not published while its saved\n  layer holds a change made elsewhere. If the stop says that change is not published, tell the maker to\n  publish it in Maker if it should stay, or undo it and save, then run the build again.\n- **Stable create ids** (`minimumPluginVersion: \"2.21.0\"`) — write `createIdentity: \"stable-v1\"` on a\n  **new** app; never add it to an existing or downloaded spec (a managed download writes it back itself, only\n  with the declared views and charts it restores). Tell the maker: declared views and charts\n  get ids the spec fixes, so a retry after a lost answer binds the same row instead of creating a second;\n  configuration items, custom APIs, environment variables, field security, duplicate rules and pages keep\n  today's ids; and a local copy with an unsent edit stops the build (`create-completion-required`) —\n  running again does not merge it: put the change into the spec, then refresh the local copy.\n- **Configuration items** (`minimumPluginVersion: \"2.21.0\"`) — `environmentVariables[]`,\n  `connectionReferences[]`, `customApis[]`, `duplicateDetectionRules[]` and `solution.version`. Declare one\n  only when the maker asks for it, accepts your offer at the personas step, or a page of this app needs it (a page calling a connector needs its\n  connection reference; an action a page calls needs its Custom API). Never write a value that differs per\n  environment into the spec — a current value, a connection id, a secret: those go in a `--deployment-settings`\n  file (the solution deployment-settings shape), which the maker supplies, and a `secret` variable takes no\n  `defaultValue`. Tell the maker: a page that calls a declared reference or Custom API is not written until the\n  reference is bound to a connection and the Custom API has an implementation (a plug-in type) — a declared\n  Custom API alone is a scaffold; clearing a value, unbinding a reference or removing a parameter or condition\n  needs `--authorize \u003Ckind>:\u003Ckey>:\u003Cfield>` (the refusal names it); a teardown keeps these items and names them;\n  a plain download does not bring them back into the spec (a managed download of a `configurationIdentity:\n  \"stable-v1\"` app brings back the ones its store proves, never a value, default, connection, implementation or duplicate rule); and a whole-build retry after a lost answer can create\n  a second row, so check the environment before running a failed build again. See\n  [`references\u002Fapp-spec-schema.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema.md) → *Configuration items*.\n- **AI-first features** (admin-gated) — form-fill assist, natural-language grid\u002Fview search, NL chart\n  \u002F AI data visualization, M365 Copilot (opt-in); per-table Copilot row summaries (Insight Cards)\n  with tailored prompts, auto-selected for good-candidate tables\n\nAuthor the **smallest spec that fully satisfies the ask**, then let the user refine. The **Genpage-first\npolicy** below is the record-vs-dashboard rule; [`references\u002Fapp-spec-schema.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema.md)\ndocuments every field.\n\n## Genpage-first policy (surface classification)\n\nEvery app surface is one of two kinds — **enumerate the app's surfaces and classify each one**, don't\ndecide page-by-page in passing:\n\n- **Record surfaces** (create\u002Fread\u002Fupdate\u002Flist a table's rows) → a **model-driven form + view**.\n- **Everything else** — overview\u002Flanding, dashboard, KPIs, analytics, guided or wizard flow,\n  composite or comparison screen → a **generative page** (`pages[]`), **not** a classic dashboard.\n\nRules:\n\n- An app whose jobs include an overview, a queue, analytics or a guided flow but which proposes no\n  pages has missed a surface. Where the app genuinely is record-CRUD only, say so explicitly rather\n  than silently omitting pages.\n- A **traditional `dashboards[]`** is emitted **only on explicit request** (e.g. \"use a classic dashboard\").\n- A generative page is authored as a **design intent** (`source: { kind: \"intent\" }`,\n  `schemaVersion: 2`) during Phase 1 — its `.tsx` is written in **Phase 1.5 — Generate pages**, after\n  plan approval and after the data pre-build creates the tables so `genpage.js types`\n  can emit `RuntimeTypes.ts`. See [`references\u002Fauthoring-flow.md`](..\u002F..\u002Freferences\u002Fauthoring-flow.md) → *Pages*.\n- The build's `pages` phase writes each page through the SDK and never places it in the sitemap\n  itself — the SDK is the **single sitemap writer**, so a page's nav entry comes from a\n  `page` subarea in `appShell` (referenced by the page's **`key`**). See\n  [`references\u002Fapp-spec-schema.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema.md) → `pages[]`.\n- **Every page in `pages[]` must be sitemap-placed** — validation rejects any page absent from the\n  sitemap. A \"detail\" page that receives a caller-supplied id is a normal sitemap page; it reads its\n  input via `pageInput?.data?.\u003Cfield>`. Navigation-only (headless) pages are not supported.\n- **A page that declares `pageInput` MUST declare `directEntry`.** Because every page is\n  sitemap-placed, a detail page is also reachable straight from the app navigation with **no input**\n  — a state a user reaches by clicking. Say what happens then: `{ \"behavior\": \"selector\" }` shows a\n  picker and then the record, `{ \"behavior\": \"emptyState\" }` explains and renders nothing broken.\n  Prefer `selector` when the table is browsable; it is the more useful landing. Every key in\n  `pageInput.data` must also be produced by some page's `navigatesTo[].data`, or the generated page\n  reads a key nothing ever sets.\n- **Three-authority page identity** (build + download + verify all follow this): (1) **IDENTITY** —\n  the durable `\u003Capp>_pagemanifest` (`key → pageId`); a downloaded spec's own `pages[].pageId`\n  outranks it for that rebuild. (2) **EXISTENCE** — the env-wide page list read through the SDK, drafts\n  included (crash-safe; decides create-vs-reuse). (3) **MEMBERSHIP** — the app's sitemap `GenPageId` set (placement,\n  download enumeration, verify coverage). All matching is by id — never by display name.\n- **Multi-page navigation uses `PAGEREF_\u003Ckey>`** (the stable `pages[].key`) as the `pageId`\n  placeholder; the build resolves each to the real page GUID in a run-scoped staging copy (the\n  canonical `.tsx` is never mutated), then **verifies every nav edge** resolves to the deployed\n  page's `GenPageId`.\n\n## Workflow\n\n### Phase 0 — Working directory\n1. Derive a short kebab-case slug from `$ARGUMENTS` (e.g. \"Project Tracker\" → `project-tracker`).\n2. Create the directory (`mkdir -p \u003Cslug>` on bash\u002FPowerShell; `mkdir \u003Cslug>` on cmd, which has no\n   `-p` and errors if it exists) and resolve its absolute path. It holds `app-spec.json`,\n   `model-app-plan.md`, and `workflow-log.md`.\n\n### Phase 1 — Author the App Spec (interactive, main loop)\n\nFollow **[references\u002Fauthoring-flow.md](..\u002F..\u002Freferences\u002Fauthoring-flow.md)** step by step, running\nevery prompt yourself via `AskUserQuestion`. In short:\n\n#### Unattended runs (Copilot autopilot \u002F automation)\n\nResolve the interaction mode once before the first authoring question:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fresolve-interaction-mode.js\" [--non-interactive]\n```\n\n`POWER_PLATFORM_SKILLS_NONINTERACTIVE=1`\u002F`true` (or the equivalent\n`--non-interactive` invocation) means there is no user waiting for prompts. In\nthat mode:\n\n- do not call `AskUserQuestion`, `EnterPlanMode`, or `ExitPlanMode`;\n- use explicit requirements and supplied existing specs as authoritative, and\n  use documented defaults only where the request leaves a non-destructive\n  choice open;\n- record each skipped gate as\n  `Unattended default: \u003Cquestion> → \u003Canswer> (\u003Creason>)` in `workflow-log.md`;\n- treat the completed lint, preview, rendered design document, and build dry-run\n  as the approved plan, then continue with the normal approved path;\n- halt rather than guessing an ambiguous environment, app identity, or\n  destructive structural edit.\n\nSuppressing interaction never authorizes destructive work. An unattended\nexisting-app apply still requires `--allow-destructive` wherever the build\nnormally requires it; `POWER_PLATFORM_SKILLS_NONINTERACTIVE` only suppresses\nprompts.\n\nCarry the resolved mode through subprocesses: when it is unattended, append\n`--non-interactive` to every `build-model-app.js` invocation (dry-run, data\npre-build, recovery rerun, and full apply). Do not append `--allow-destructive`\nunless destructive authority was supplied independently.\n\n1. **Prereqs** — `node --version`, `pac help` (> 2.10.0, the plugin's minimum).\n2. **Environment (PAC)** — `pac auth list`. If exactly one \u002F an active profile, **confirm it\n   (FYI), don't ask**. If several and none active, **ask** which to use. If none, ask the user\n   to `pac auth create`. Capture the org URL (`pac org who`).\n3. **Detect existing** — `scripts\u002Flist-tables.js --env \u003CenvUrl> --search … --exact` and\n   `scripts\u002Fapps.js list --env \u003CenvUrl>` (`\u003CenvUrl>` is the org URL from step 2) to find\n   tables\u002Fapps already present; build *around* them. `--exact` keeps only the tables whose\n   logical name is a search term and lists the terms with none in `missing`. A failed read\n   (exit 1) is reported and ends the step — never read it as \"nothing exists\".\n4. **Levelled authoring** — **first read the App Spec format** so you author to the exact\n   shape (do this once; don't go spelunking through scripts):\n   [`references\u002Fapp-spec-schema.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema.md) and the worked sample\n   [`samples\u002Fapp-spec.support-desk.json`](..\u002F..\u002Fsamples\u002Fapp-spec.support-desk.json). That document\n   covers everything an app always has. **Additionally read\n   [`references\u002Fapp-spec-schema-advanced.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema-advanced.md) once your\n   design calls for a conditional feature** — business rules, a business process flow, command-bar\n   buttons, web resources, global choices, classic dashboards, or `roleGrants[]`. Its pointer table\n   is in the main schema, and the toolbox above tells you when to reach for each; read the detail\n   only for the ones you are actually using, and never skip a capability just to avoid the read.\n   Phase 1 is\n   **design-only**: never emit page `.tsx` here. Each level is confirmed via `AskUserQuestion` before\n   the next begins, and `app-spec.json` is persisted after each — full prompts in the playbook.\n   - **Level (a0) — personas & jobs-to-be-done** (`personas[]`): **before proposing any tables**, ask\n     who will use the app and what each needs to get done. Jobs drive everything that follows — a\n     table exists because a job needs its data, a surface because a job needs to act on it. Deriving\n     the data model first reliably misses surfaces. Privileges come later; capture the jobs now.\n   - **Level (a) — data model**: entities\u002Fcolumns\u002Frelationships **derived from those jobs**; run the\n     **early data-model lint** (catches e.g. the relationship-vs-lookup collision before forms are\n     authored on top).\n   - **Descriptions are part of authoring, not a cleanup pass.** Every table, column, view, chart,\n     form, dashboard and business rule takes an optional `description`, and you should **write one as\n     you create the artifact** — never as a backfill. A name says what a thing is called; a\n     description says what it is *for*, and it is the only intent an app carries that an agent can\n     read back later when it inspects an app it did not build. Describe the purpose, not the shape:\n     `\"Severity 1-5; drives the escalation rule and the SLA clock\"`, not `\"The priority column\"`.\n     (`commands[]` and `Customer` columns accept one but the SDK cannot write it — you'll get a\n     warning; `personas[]` does not take one at all. See the schema reference for why.)\n     The app itself takes two: `app.description` is the short tile text, and `app.aiDescription` is\n     the **routing description** an orchestrator reads to choose between apps — who the app is for,\n     what it covers and excludes, and how to tell it from a sibling app over the same tables. Write\n     it whenever such a sibling exists or is planned.\n   - **Level (b) — artifacts + page-intents + design**: **enumerate every surface each job needs and\n     classify it** per the genpage-first policy above — record CRUD → form + view; anything else\n     (overview\u002Flanding, dashboard, KPIs, analytics, guided\u002Fwizard flow, composite or comparison\n     screen) → a page **intent** (`source: { kind: \"intent\" }`). State each classification out loud;\n     if the app needs no pages, say so and why rather than silently omitting them. Then forms + views\n     + charts + sample data and the optional `design` contract, mapping each job to its surfaces via\n     `jobs[].surfaces[]`. **No page `.tsx` here.** `dashboards[]` only on explicit request.\n   - **Level (c) — access** (`personas[].jobs[].privileges[]`): personas and jobs already exist from\n     (a0) and the entities now exist, so **only add the privileges each job needs** — don't re-ask who\n     the users are. The builder unions them into one role per persona and grants the app to it so it\n     **opens for that persona, not just sysadmins**. **Render the roles + per-entity access as a table\n     in your chat reply** (the user can't approve an access model they can't see — see the CRITICAL\n     note above). If they want no roles, tell them jobs live in `personas[]` so dropping the roles\n     drops the recorded jobs too; offer read-only privileges to keep the record. If a column is\n     confidential, add `isSecured` + a field security profile and name who gets it — see the\n     *Confidential columns* bullet in the toolbox. (Access teams are not yet supported — see\n     *Notes & limits*.)\n   - **Whole-app preview** (design gate for Level (b)): `node \"${PLUGIN_ROOT}\u002Fscripts\u002Fpreview-app.js\" --spec @\u003Cworking-dir>\u002Fapp-spec.json`\n     renders data-model + sitemap + form wireframes + page-intents + design contract. **Reproduce the\n     ENTIRE rendered output verbatim in your chat reply, inside a fenced ` ``` ` code block — do NOT\n     leave it in the (collapsed, invisible) tool output, and do NOT just summarize \"the preview looks\n     right\" (see the CRITICAL note above).** The user must be able to SEE each form, the sitemap, and\n     the page intents they are approving. For a single form only: `node \"${PLUGIN_ROOT}\u002Fscripts\u002Fpreview-form.js\" --spec @\u003Cworking-dir>\u002Fapp-spec.json`.\n   - **Don't pre-create tables\u002Fcolumns** — the build does it idempotently.\n5. **Guardrail lint (hard gate)** — run the **full** lint on the complete spec; **errors block**, warnings teach. If it blocks (or warns), **paste the findings into your chat reply** — tool output is collapsed and invisible to the user (see the CRITICAL note above), so the user can't fix what they can't see:\n   ```bash\n   node \"${PLUGIN_ROOT}\u002Fscripts\u002Flint-app-spec.js\" --spec @\u003Cworking-dir>\u002Fapp-spec.json --json\n   ```\n   This runs migration and `validateAppSpec` — the gates the build itself runs on load — plus the `lintAppSpec` authoring guardrails, which the builder does **not** run. It exits non-zero on errors. It validates under the `plan` profile (which allows not-yet-generated intent pages), matching Step 6's dry run.\n6. **Plan-mode approval (the single build approval)** — present the plan **including the build\n   dry-run's phase-grouped plan** (run `build-model-app.js` without `--apply`, using the `plan`\n   profile that allows intent pages) inside `EnterPlanMode`, then `ExitPlanMode` to get the user's\n   go-ahead. On approval, **Phase 1.5** (generate-pages) runs first, then **Phase 2** applies\n   directly (no second dry-run\u002Fgo-ahead). Render the design document — never hand-write it:\n   ```bash\n   node \"${PLUGIN_ROOT}\u002Fscripts\u002Fwrite-app-spec-doc.js\" --spec @\u003Cworking-dir>\u002Fapp-spec.json --env \u003CenvUrl>\n   ```\n   It writes `\u003Cworking-dir>\u002Fmodel-app-plan.md` (jobs → surfaces traceability, data model, every\n   surface, navigation, access model, sample data) and prints `{ ok, docPath, bytes, warnings }`.\n   **Surface those `warnings`** — they name design gaps such as a job with no covering surface, an\n   app with no generative pages, or a new table that no persona and no `roleGrants[]` entry grants a\n   privilege on. With `--env` the document also lists, read-only, the roles the app already has\n   associated with it, apart from the privileges on the tables the spec adds (opening the app and using\n   a table are two questions); a read that fails is reported in the document as \"not checked\" and does\n   not fail the command. Tell the user where the document is; it's theirs to keep, and it's\n   regenerable after any spec edit.\n\n### Phase 1.5 — Generate pages (main loop, headless workers)\n\nAfter plan-mode approval (before the full build):\n\n1. **Data pre-build** — schema-only build so `genpage.js types` can resolve real column names:\n   ```bash\n   node \"${PLUGIN_ROOT}\u002Fscripts\u002Fbuild-model-app.js\" \\\n     --env \u003CenvUrl> --spec @\u003Cworking-dir>\u002Fapp-spec.json --stage data --apply\n   ```\n   `--stage data` applies solution + data-model only — **no `--sample-data`** (rows are created\n   once in the full build). Only `--stage data` is apply-safe; all other `--stage` selectors\n   and legacy `--from\u002F--to\u002F--only\u002F--skip` selectors are dry-run inspection only.\n\n2. **Types** — generate Dataverse type bindings for the entities the pages read:\n   ```bash\n   node \"${PLUGIN_ROOT}\u002Fscripts\u002Fgenpage.js\" types --env \u003CenvUrl> --data-sources \"\u003Centity1,entity2,…>\" --output-file \u003Cworking-dir>\u002FRuntimeTypes.ts\n   ```\n   `--data-sources` is the union of every intent page's `dataSources`. Skip this step entirely when\n   every intent page is mock-only. On Windows use forward slashes in the path. The script prints\n   `{ \"ok\": true, \"outputFile\", \"dataSources\", \"detail\", \"bytes\" }`; a failure (exit 1, `\"ok\": false`)\n   stops the step — report why, since the page workers must not guess column names.\n\n3. **Page plan (adapter)** — the page worker's input contract is a *plan document*, not an App Spec,\n   so project the spec into one. This also echoes the per-page dispatch parameters:\n   ```bash\n   node \"${PLUGIN_ROOT}\u002Fscripts\u002Fwrite-page-plan.js\" \\\n     --spec @\u003Cworking-dir>\u002Fapp-spec.json --working-dir \u003Cworking-dir> --env \u003CenvUrl> \\\n     --app \"\u003Capp name>\" --languages \"\u003Clanguages from the environment probe>\"\n   ```\n   It writes `\u003Cworking-dir>\u002Fapp-builder-page-plan.md` and prints\n   `{ ok, planPath, pages: [{ name, key, file, dataMode, intent }] }`. Pass `--languages` through\n   from the environment probe — omitting it silently defaults every plan to English-only and drops\n   the localization pattern. The command fails (before writing) if the plan would name a sample that\n   doesn't exist, or if a page a worker will write is not a safe target in the working directory — a\n   link at its path, a folder that links outside the directory, or a page already there under another\n   spelling — or if a link, a hard link or a folder is already at the plan's own path. Stop and fix\n   what it names; do not dispatch any worker.\n\n4. **Generate** — for each page from step 3 with `intent: true`, dispatch the **headless**\n   `genpage-page-builder` worker via `Task`. Use its documented input contract verbatim — a missing\n   field is why a page silently never becomes `.tsx`:\n\n   > You are the genpage-page-builder agent. Generate the **[name from step 3]** page.\n   >\n   > - Target file: [file from step 3 — already includes .tsx; do NOT append another]\n   > - Plan document: [absolute path to the app-builder-page-plan.md written in step 3]\n   > - Data mode: **[dataMode from step 3 — `dataverse` or `mock`]**\n   > - Connectors: **none**\n   > - Telemetry: **disabled**\n   > - RuntimeTypes: [absolute path to RuntimeTypes.ts]   ← omit this line when Data mode is `mock`\n   > - Working directory: [absolute working-dir path]\n   > - Plugin root: ${PLUGIN_ROOT}\n   >\n   > Follow the instructions in your agent file. Write [file] and return your result when done.\n\n   The plan's `## Environment` carries `Mode: app-builder` and every page row carries a **Key**, so\n   the worker emits `\"PAGEREF_\u003Ckey>\"` for cross-page navigation (never a file-derived token — a\n   downloaded page's `codeFile` is a path, not its identity). Custom nav ids go in `data:` — never\n   `recordId`. `Connectors: none` and `Telemetry: disabled` are constants here: `\u002Fapp-builder` writes no\n   connector code (the App Spec's `connectorBindings` \u002F `actionBindings` are lists a downloaded page already\n   holds, carried through a rebuild and never authored here, so the projected plan always says\n   `No connector bindings.`), and `\u002Fapp-builder` never runs the Phase 4.7 `custom-telemetry` probe. Both are stated explicitly\n   rather than omitted — the page-builder treats a missing line as the same fail-closed value, but\n   an explicit line is what makes the dispatch contract checkable.\n\n5. **Check styles, then validate + commit the transition (transactional)** — the workers have no\n   shell, so first check every generated page for the Griffel shorthands that `makeStyles` drops at\n   runtime, one command per page (`\u003Cfile>` is the page's file from step 3):\n   ```bash\n   node \"${PLUGIN_ROOT}\u002Fscripts\u002Fcheck-griffel-styles.js\" --file \u003Cworking-dir>\u002F\u003Cfile>\n   ```\n   Griffel does not support ten CSS shorthands, and `makeStyles` drops them at runtime: the page\n   type-checks, transpiles and deploys, then renders without the border, color or reset. They are\n   `all`, `borderColor`, `borderStyle`, `borderWidth`, `borderBlock`, `borderBlockStart`,\n   `borderBlockEnd`, `borderInline`, `borderInlineStart` and `borderInlineEnd`. Write longhands\n   instead: `borderColor`, `borderStyle` and `borderWidth` become one longhand per side, `border` +\n   `Top`, `Right`, `Bottom` or `Left` + `Color`, `Style` or `Width` (`borderWidth` →\n   `borderTopWidth`, `borderRightWidth`, `borderBottomWidth`, `borderLeftWidth`); `borderBlock`,\n   `borderInline` and their `Start` and `End` forms become the `Width`, `Style` and `Color` longhands\n   of the sides they name (`borderBlockStart` → `borderBlockStartWidth`, `borderBlockStartStyle`,\n   `borderBlockStartColor`; `borderBlock` → those and the three `borderBlockEnd…` ones); `all` has no\n   longhands, so set the properties you need one by one. Every other shorthand (`padding`, `margin`,\n   `border`, `borderRadius`, `gap`, `outline`) is supported, and an inline `style={{ … }}` is not\n   Griffel at all.\n\n   `check-griffel-styles.js` prints each problem it finds — a key Griffel drops in a `makeStyles`\n   call, at any depth, with its line, column and longhands, or a call or a style object it cannot\n   read, with what to change — and exits 3 while any is left: fix what it reports and run it again,\n   and do not transpile or upload the page until it exits 0. It reads the style objects written\n   inline in the call, `makeStyles({ … })`, so write them there: one passed or spread in from\n   elsewhere (`makeStyles(styles)`, `...base`) is reported, because the check cannot see its keys,\n   and so is a key computed from an expression (`[key]: …`), whose name it cannot see (a template\n   that starts with `--`, `&`, `:` or `@` is read); Fluent's `...shorthands.*(…)` and\n   `...typographyStyles.*` may be spread as they are.\n\n   The same command checks that each page establishes a scroll context (`references\u002Frules.md`,\n   **Page Layout**): the host shows a page in a container of fixed height and never scrolls it, so a\n   page with none is cut off below the fold. `no-scroll-context`, `scroll-context-unproven` and\n   `scroll-context-padding` are problems like any other, each with the edit that fixes it: apply it\n   and run the check again.\n\n   Review every generated page for iteration that another page compiler can lose as well:\n\n   Pages this plugin uploads are compiled with iterator support (ES5 with `downlevelIteration`), so a\n   spread, a `for...of` loop or an array destructure of a Map, Set, iterator, generator or string\n   reads it as modern JavaScript does. A tool that compiles the page again without that support — an\n   older maker portal, or `pac` — reads length and indices instead: values disappear, defaults replace\n   them, and rest destructuring or a string spread throws, all with a clean compile. Keep the page\n   correct under every compiler: convert with `Array.from(...)` before spreading, looping or\n   destructuring, for example `[...new Set(xs)]`, `[...m.values()]`, `[...seen.values()]`, `for (const\n   [k, v] of m)`, `new Set([...prev, id])`, `[...selected]` and `[...text.matchAll(re)]`; copy a Set\n   with `new Set(prev)` then `.add(id)`. Ordinary array spreads and loops remain valid. `Object.keys`,\n   `Object.values` and `Object.entries` return arrays. Rest destructuring of a non-iterable array-like without\n   `slice` throws under every compiler. A destructuring default must not write to the array being\n   destructured: `const [a = (values[1] = 3), b] = values` leaves `b` at its old value here, unlike\n   modern JavaScript. See **Common Errors > 5. Iteration that another page compiler can lose** in\n   `references\u002Frules.md` for the pairs.\n\n   Then validate and commit the transition — never flip `source` by hand, and never\n   flip pages one at a time as workers return. Run:\n   ```bash\n   node \"${PLUGIN_ROOT}\u002Fscripts\u002Fpromote-intent-pages.js\" \\\n     --spec @\u003Cworking-dir>\u002Fapp-spec.json --working-dir \u003Cworking-dir>\n   ```\n   It checks every generated page (file written, structurally a module, `PAGEREF_` tokens\n   canonical and in exact parity with the spec's `navigatesTo` edges) and only then flips **all**\n   of them `intent → { kind: \"tsx\", codeFile }` in a single atomic write. On any failure it\n   **exits 3 and leaves `app-spec.json` untouched**, printing which page failed and why —\n   regenerate just those pages and re-run. All-or-nothing on purpose: a half-flipped spec would\n   claim a `.tsx` that was never written, and Phase 2's `deploy` profile fails fast on any\n   remaining `source.kind === \"intent\"`.\n\n6. Proceed to **Phase 2** (full idempotent build).\n\n> ⚠️ The interactive author **never** runs inside a `Task` subagent. Only pure, headless\n> code-gen workers are dispatched here — all user-facing prompts originate in the main loop.\n\n### Phase 2 — Build (narrated, main loop)\n\n> **Always use `scripts\u002Fbuild-model-app.js`. Never hand-write a builder.** It's idempotent\n> (skips existing solution\u002Ftables\u002Fcolumns\u002Frelationships — so new, existing, and mixed envs all\n> just work), so you don't pre-create anything or special-case existing tables.\n\n**The build plan was already presented and approved in plan mode** (Phase 1 Step 6 shows the engine's\nreal dry-run plan), so on approval **apply directly** — one build approval, no second go-ahead. Add\n`--verify` so the build self-checks after applying (see Phase 3):\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fbuild-model-app.js\" \\\n  --env \u003CenvUrl> --spec @\u003Cworking-dir>\u002Fapp-spec.json --apply --verify [--sample-data] [--publish]\n```\n\nEach step streams its status live (`[n\u002Ftotal] ✓ created` \u002F `⊘ skipped` \u002F `✗ failed — \u003Cerror>`) and a\nclosing `✓ build complete — X created, Y skipped, Z failed` summary.\n\n> **Keep the build's progress visible.** A full build runs for several minutes. Let its output\n> **stream** — do NOT pipe it through `Select-Object -First\u002F-Last N` or `Select-String` head-limits,\n> which buffer and hide progress until the run ends (and can truncate a still-running pipe). To\n> capture the log use `Tee-Object -FilePath \u003Clog>` (no head-limit). The build also prints a\n> `▸ live progress:` line pointing at `\u003Cworkspace>\u002F.maker-workspace\u002Fbuild-status.json` — a snapshot\n> (`state`, `steps`, `lastPhase`, `lastLabel`) overwritten every step. Read it (or tail\n> `build-log.jsonl`) any time to report where a long build is, even if stdout is buffered.\n\n(**Reaching Phase 2 without a fresh plan-mode approval** — resuming a failed build, or a quick edit\nre-run — do a **dry-run first** (drop `--apply`), **paste the phase-grouped plan verbatim into your\nchat reply** (tool output is collapsed — see the CRITICAL note above), and get a go-ahead\nbefore applying.)\n\n**Push preview (`--preview-push`, dry run only).** For a complex change to an existing app (managed or\ndestructive features, many views), run the dry run with `--preview-push` to see, per artifact, whether a\npush would create, update or change nothing, and what would stop it (refused, stale, unknown), with its\nsolution layers and publication scope. It reads only. \"ready\" is not approval or a lock, and while a\ndirect SDK push can still write a \"noChange\" artifact, this build skips the push of an existing view it\nwould not change. It previews an existing view with the column and\ndescription changes the build would make, and a chart the build would create. Everything else (an\nexisting form, chart or the app, a view or form the build would create, a command bar) is listed as not\nevaluated, because the build works those changes out only while it runs: say so, never report the\npreview as complete. A preview that fails prints its code and the dry run stands. Do not use it on every\napply; it is refused with `--apply` and with `--no-live-plan`.\n\n**Stage selector (`--stage \u003Cdata|ui|app|publish>`)** maps to its phase range. On `--apply`, ONLY\n`--stage data` is accepted (solution + data-model, no rows in run 1; run 2 is a full build). All\nother stages and the legacy `--from\u002F--to\u002F--only\u002F--skip` selectors are dry-run inspection only —\ntheir phase ranges are not dependency-closed and are rejected on `--apply`.\n\n**Language (`--language-code` \u002F `--languageCode \u003Clcid>`)** — you normally do **not** pass this.\nData-model labels are\nstamped with the organization's own base language, read once per build. Pass it only to author\nlabels in a different **provisioned** language, or if the build warns that it could not determine\nthe base language and fell back to 1033.\n\nIf you pass an LCID the organization has **not** provisioned, the build now stops in the data-model\nphase, before any label is written, and lists the ones it does have. That check exists because\nDataverse handles this **inconsistently**: table and choice labels are accepted (HTTP 204) and\nsilently stored under the organization's base language, while `DateTime` and `Memo` columns are\nrejected with *\"The language code N is not a valid language for this organization\"*. Without the\ncheck a build therefore creates the table with the wrong labels and then dies partway through the\ncolumns, phases away from the flag that caused it — which reads like an environment fault. List the\nprovisioned set with\n`node \"${PLUGIN_ROOT}\u002Fscripts\u002Fdataverse-request.js\" \u003CenvUrl> GET RetrieveProvisionedLanguages`.\nThe check is best-effort: if that read fails the build proceeds unchanged.\n\nThe App Spec field `languageCode` pins the same value across runs. It now covers the **whole** build:\ndata-model labels, and form, dashboard and sitemap labels — the SDK serializers that used to hardcode\n1033 take the authoring language as an option.\n\n**Verify with the same flag.** A build run with `--language-code \u003Clcid>` writes a form's tab and section\ncaptions in that language, so run the standalone verifier with the **same** `--language-code \u003Clcid>` (or pin\n`languageCode` in the spec): without it, `--verify` looks for the captions in the organization's base language and\ncannot confirm a correctly published form's captions (it lists them as unverified or reports them missing). The\nbuild's own `--verify` is told the language automatically. If verify cannot establish the language at all (the\norganization cannot be read), it lists those captions as **unverified** — neither passed nor failed — with the\nreason: re-run it with the flag.\n\n**A language the environment's form read does not show.** The platform decides which languages' labels the form's\nFormXML carries, and it can return fewer than the form stores: a form built with Spanish (`3082`) captions in an\nEnglish-language organization reads back, with the Spanish captions stored, with its labels in English only. Verify\nnever calls a caption missing in a language the read does not carry, as long as the read carries labels in other\nlanguages — it reads those captions from **one translation export of the app's solution** instead (a single extra request,\nmade only when there is such a caption: 7–11 s for a solution of one table, more as the solution grows; it shows the\npublished layer), so a right caption passes and a stale or empty one fails like any other, and a\n`{ \"1033\": …, \"3082\": … }` label map is compared language by language the same way. When the export fails or cannot say (a\nfailed request, an archive it cannot read, no row for the form), verify lists the labels compared in that language as\n**unverified** (neither passed nor failed; the run's result and exit status are unchanged), with the reason and the\nlanguages the read does carry. Say so, and ask the user to check those captions in Power Apps with that language; do not\nrebuild to \"fix\" them. A language the read does carry is still compared strictly, from the read: a stale caption in it\nfails. A form whose read carries no label at all is not such a case: the captions the spec declares for it are missing, and fail.\n\nNarrate progress as it runs. Transient env errors (a 429 or 503, a customization lock, a concurrent-operation\nguard or a SQL timeout the service names by its error code, a timeout or reset of the connection) are\n**auto-retried** with backoff on `--apply` (the build is idempotent, so a retry reuses what's already created).\nA throttled service is waited for as long as it asks (`Retry-After`) — by the HTTP client's re-sends of a throttled read or service-protection-limited publish, by the page writes and by the build's own re-runs of a phase — inside one budget of five minutes per run for all the waiting\na throttle costs: when the next wait does not fit, the build stops with a `throttle-budget-exhausted`\nhalt that says what the service asked — run it again later and it continues. (A 5xx, a reset connection or a deadlock is not a throttle: those keep their own, shorter schedule and are not counted in it.) If the build still **halts** (`BuildHalt`) on an\nunrecoverable error, surface it and ask the user how to proceed via `AskUserQuestion` (adjust the\nspec \u002F cancel), then re-run. Everything is scoped to a dedicated unmanaged solution; **`--publish`\ngates the final *bulk* publish**, which also carries the edits made to existing views and forms.\nWithout it those edits — and always an existing app's sitemap re-sync — still publish their one\ntargeted artifact so the change takes effect (see *Notes & limits*).\n\n**Sensitive configuration in the workspace.** An earlier plugin version wrote environment-variable and\nconnection-reference copies (which can hold values, defaults, Key Vault secret references and connection ids) into\nthe workspace's `environment-variables` and `connection-references` folders and their `.metadata` folders. This\nversion never deletes them for you. While such files remain, every command that opens that workspace prints one\n`WARNING:` naming the folders (never their content). A copy the plugin cannot prove is what the environment last\nheld (an edit never sent, a file with no partner, a locked file) stops the step that needs it with\n`WORKSPACE_LEGACY_CONFIGURATION_COPY`, naming its two files. To clear either: when no build is running, move any\nchange you still want into the App Spec or the deployment settings file (the build sends configuration only from\nthose), close any program holding the files, delete the `.json` files in those folders, and run again. Tell the user\nwhat the warning or the stop names before deleting anything.\n\n**Recovery from a failed or halted build: run the full build again.** The build is idempotent — every\nphase re-uses what's already created and only fills the gaps. SDK metadata is persisted under\n`\u003Cworking-dir>\u002F.maker-workspace\u002F` (override with `--workspace`); environment-variable and connection-reference values,\nsecret references and connection ids are never written there. There is no apply-safe\n`--from \u003Cphase>` shortcut; a full rerun is the correct and safe recovery path — after a `WEB_RESOURCE_UNVERIFIED`\nhalt too: a web resource was written but its publication could not be confirmed (often because another customization\nheld the environment's lock), the build recorded it, and a rerun using the **same writable workspace** writes it\nagain by its id (the page manifest only when its published copy does not already hold that content; otherwise the\nrerun keeps it); do not delete or rename it. If the halt says its recovery record could not be saved, or reports\na conflicting name\u002Fid, follow that explicit resolution instead — automatic retry is unsafe without the identity.\nOne exception: an\n`already-exists` halt recurs on a rerun until that workspace directory is deleted — follow its message.\nAnother: that workspace belongs to the environment it was first opened for. Only `--apply` opens it — a dry\nrun works in a temporary workspace, so it binds nothing, previews from any folder, and warns when an `--apply`\nthere would be stopped. A build pointed at a different `--env` **halts before reading or writing anything in\nit** and names both environments. It is never cleared or re-bound for you — that discards the SDK's saved copies\nof the other environment's artifacts, including any edit made in them that was never pushed, and the\npage-ownership receipts and baseline kept beside them are that environment's too. Build against the\nenvironment the halt names, or use a fresh app folder (copy `app-spec.json` and the files it names) or a new\n`--workspace`. Only if that environment's copy of the app is no longer wanted, tear it down there with the\n`--clear-workspace` command the halt prints, which keeps the folder while a page-ownership receipt remains. The\nhalt prints the folder on a line of its own, and that command takes it as `--workspace` — pass it exactly as\nprinted, quoted for your shell (inside double quotes PowerShell and bash expand a `$` in the path). A folder that\nholds nothing a build saved — the SDK's empty folders only, which an earlier preview or a build that stopped at\nits start leaves — is described as exactly that: nothing was built in that environment, so there is nothing to go\nback to or tear down, and the folder can simply be deleted or moved aside. A folder whose `manifest.json` names\nno usable environment, or is not valid JSON, halts too: move it aside (rename it rather than delete it — it can\nhold page-ownership receipts and the baseline) and run again. The same environment under its other host name\n(`\u003Corg>.api.crm…` against `\u003Corg>.crm…`) also halts: re-run with the host the halt names. The standalone verifier\nnever opens that workspace either, so it verifies any environment the app is deployed to.\n\nRun only one apply command for an app in its workspace at a time, including its data stage and full build. If another build holds the build or pages lock, let it finish and then rerun the same full command; do not repeatedly launch retries, use a second workspace to bypass it, or delete the workspace. A lock refusal is on stderr with exit 1 and no stdout JSON; do not treat empty stdout as an unknown crash or a reason to reset the workspace. A teardown, download, standalone `\u002Fgenpage` or `apps.js` mutation, or workspace clear is not stopped by this lock; do not run one against the same app\u002Fworkspace beside the apply. A lock is abandoned only after its owner is confirmed no longer running; age alone is never sufficient. If automatic reclaim cannot complete, inspect the owner evidence and consider removing only the named lock\u002Freclaim file manually after that confirmation. Keep the workspace and its recovery records. For concurrent-build protection, all overlapping build commands must use the new version. During a mixed-version transition, finish older builds first and keep the downloaded app unique name's spelling unchanged.\n\nWith `--publish`, the tables the build changed, and the tables whose forms or charts the app holds or is about to hold, are published in one\nrequest before the build writes or publishes the app: the tables whose existing views and forms the build edited, the tables of the\ncharts it wrote, the navigation's tables whenever the build pushes the app (the SDK adds their active Main forms to it on every push the build\nmakes, so a form that is live with a label saved and not published would otherwise be pinned and published with the app before its table was:\nthe first build and the build that pins a form are covered the same way; a changed-only re-upload of a page that has to pin a default view\nthe app lost pushes and publishes the app through the page backend, whose push adds the view it pins and no form, so it names no table of\nthe navigation), and — for an app that already exists — the tables of the form and\nchart components its saved component list names, whether or not the spec names the table (a form a maker added to it, say, one never\npublished included). A label someone saved and did not publish on a form of one of them would otherwise stay unpublished once the app\nis published. A table the app is not known to hold a form or chart of is not published by it, so what a maker left unfinished there\nstays unfinished: a table only declared in `entities` (the target of a lookup column, say), one that only a page reads, or one that\nonly `app.tables` pins. If the app's components cannot be read completely, or a read of them is ambiguous (a row of the component\nlist that cannot be placed included), the build publishes only the tables it changed and the navigation's, and says which read failed; run it again once the cause is cleared. That is one more\npublish for a build that edits no existing view or form (a first build included); the final publish covers the tables the build has\nartifacts of.\nIf that request is refused the build goes on, and says so: it names what it saved on those tables, the forms the app holds\nthere, or its write adds, whose labels someone else may have saved, and what the app's publish may leave out as a result.\nA build that **halts with an error** publishes the views and forms it had deferred (best effort), then — when it stopped\nbefore the publish phase — lists the forms, views and charts of the spec's tables (the tables its pages read included) that\nare still saved but not published, what it created and anything anyone saved there, or says it could not read them and names\nthe tables to publish. Columns and other kinds of change are not in that list. A halt after the publish phase says nothing of\nthe kind.\nOne that is **killed** — Ctrl-C, a crash, a closed terminal — after those edits are saved but before\nthat publish cannot, so they stay saved but not live until the next build. Run the same full build\nagain: it publishes them without writing them again.\n\n### Phase 3 — Verify & iterate\n**`--apply --verify` already reconciled the spec against what deployed** (Phase 2) — the build appends a\n`verify PASS` \u002F `verify FAIL — N missing` line and **exits non-zero on a silent partial** (an artifact\ncreated but not wired, or a phase that quietly produced nothing). To **re-check later** — e.g. after a\nMaker change, without rebuilding — run the standalone read-only verifier (entities\u002Fcolumns\u002Fviews\u002Fcharts\u002F\nforms and sitemap subareas + icons; exits non-zero and lists anything missing):\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fverify-model-app.js\" --env \u003CenvUrl> --spec @\u003Cworking-dir>\u002Fapp-spec.json [--language-code \u003Clcid>]\n```\n\nPass `--language-code` only if the build was run with it. A line starting `⊘` under the verdict is a check verify\ncould **not decide** (it is in the JSON result's `unverified` list): it is neither a pass nor a failure, so say what it\nwas and what settles it — the language of the captions, which `--language-code` gives, or captions in a language the environment's\nform read does not carry that the translation export could not settle (the line says why), which only Power Apps can show — never report the run as \"everything deployed\" while\none is listed.\n\nA `WARNING:` line on stderr — each one is repeated in the JSON result's `warnings` list, which is absent when there is\nnone — is advice, not a verdict: a spec an earlier release accepted that the build would now refuse (it names the column\nor relationship and the fix for the next build), or a page workspace the run could not remove (it names the folder to\ndelete by hand). It changes neither `ok` nor the exit status, so a run that passes can still carry one: pass each on to\nthe user. A run that stops on an unexpected error prints that error and no JSON.\n\n**Command buttons (`--inspect-components`).** When a command button misbehaves, or after changing\ncommands, run verify with `--inspect-components`. It checks each declared control by its recorded row on\nthe surface you declared (a `MainTab` button on the form, `HomeTab` on the main grid, `ContextualTab` on\na subgrid). Caption-only matches, hidden or disabled controls, and controls on another surface or app do\nnot pass. It checks the stored definition, not what a browser renders. Today the build records no row\nid for a control, so every control it finds is reported `UNVERIFIED … found by caption only` and the\nrun fails: tell the user which lines say `FAIL` (missing, on another surface, several matches) — those\nare real problems — and that a caption-only line means the button could not be proved to be the app's\nown, and may also hide a problem with it: a hidden control (or one under a hidden parent) found by\ncaption is reported caption-only, not `FAIL`, while a disabled one still fails (`stored disabled`). No\n`FAIL` line does not prove a button is visible.\n\nThen open the app in the browser. Refine `app-spec.json` and re-run Phase 2 to iterate.\n\n**Teardown (cleanup).** To remove everything an App Spec built — e.g. a live-verification probe or a\nfailed build — run the classifier-safe teardown. It deletes only the artifacts the spec declares, in\ndependency order (**app module → dashboards → command bars → forms → security roles → charts → views\n→ reset enriched default views to drop parent lookups → relationships → AI row summaries → tables\n[children-first] → web resources (generated app icon + page manifest + declared) → global choices →\nsolution**). Forms\u002Fcharts\u002Fviews\u002Frelationships are deleted **explicitly before tables** (a table\ndelete does not reliably cascade cross-references; it does remove the table's own columns). A built\ntable's only Main form is refused by Dataverse (\"You must have at least one active Main form\"); the table's\ndelete removes it, and the run counts it as removed only when a fresh read of its id shows it gone —\notherwise the refusal stays a failure. Security\nroles come **after forms** because a form assigned to a role names it inside its own formxml, which\nthe platform counts as a dependency, and **before** relationships\u002Ftables because a role holding a\ntable's privileges can block that table's delete. Command\nteardown removes the whole command bar for any entity the spec authored commands on. **Teardown only\ndeletes tables this build created** — a **system\u002Fstandard table** (account, contact, …) is\nauto-detected and **skipped**, and a **reused custom table** is skipped when its entity is flagged\n`\"existing\": true`, so pre-existing data survives. The same flag protects **relationships and global\nchoices** — a download sets it on every one it recovers, so tearing down a downloaded spec never removes\na lookup column from a retained table or deletes a shared option set. Dashboards are found by name, so\nteardown deletes only those the app's solution holds, never another app's namesake — and none when the spec\nhas no real solution to ask (the `Default` a download may leave); it keeps the solution itself while any step\nfailed, so a re-run can still tell, keeps the page manifest while the generative-pages step failed, so a\nre-run still finds the pages the app authored, and keeps a table — with its icon web resource and a global choice its\ncolumns bind, which the platform refuses to delete while the table exists, and its relationship to itself — while a\nbusiness rule on it could not be deleted (the rule's activated copy can never be deleted once its table is gone), so\na re-run deletes the rule first, then the table and what was kept with it. It never deletes the solution's\n**publisher** (the build reuses one by prefix, and other solutions may share it); its closing summary says so in one line,\nso tell the user the publisher stays and can be removed in Maker once nothing uses it. It also keeps every declared\n**field security profile** and names each one (users and teams may hold it beyond this app). **Generative pages on forms:** teardown keeps a page a\nform still embeds (the `MscrmControls.UxAgentControl` control) and stops with an error that names the form, before it deletes\nanything; the dry run names the same form and reports itself as failed. Tell the user, have them take the page off that form\n(or delete the form, if it is theirs), then run teardown again. **Dry-run by default**; add `--apply\n--allow-destructive` to actually delete (`--clear-workspace` also prunes `.maker-workspace\u002F`).\n**`--allow-destructive` is required for `teardown --apply`** — without it teardown refuses and\ntouches nothing.\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fteardown-model-app.js\" \\\n  --env \u003CenvUrl> --spec @\u003Cworking-dir>\u002Fapp-spec.json [--apply] [--allow-destructive] [--clear-workspace]\n```\n\n**Safety flags (build + teardown).** The apply path is fail-closed against destructive operations:\n\n- **`--allow-destructive`** — authorize destructive operations. For `build --apply`: authorizes\n  overwriting an existing app in unattended mode, and allows explicit-layout form-field removals or\n  sitemap-target drops; also authorizes DETACHING a `pages-removed` page's nav subarea (the page\n  record is left deployed — it is not deleted). For form and sitemap removals, the authority covers\n  the removals the last refusal or approved run recorded; if live state would lose anything more,\n  the apply halts, lists only the newly destructive removals, and records that new list for review.\n  A field or sitemap target that appears during a run is kept or halted before push, never removed\n  unseen. The record is consumed only after a full successful build that ran the removal phases and\n  kept nothing; it is kept on failures, partial runs, changed-only runs, unreadable records, and\n  failed discovery. For `teardown --apply`: **required** — all deletes\n  are destructive by construction, so teardown without this flag halts before touching anything.\n- **Pages-phase safety HALTs.** The build halts on identity or safety violations rather than\n  proceeding with potentially wrong state. Surface the HALT reason and follow the recovery hint:\n  - `pages-identity-conflict` — spec `pageId` and manifest disagree on a key, or a duplicate id\n    spans two keys. Resolve the conflict manually (re-download or delete the manifest).\n  - `pages-manifest-corrupt` — the manifest cannot be parsed (two keys map to the same id). Delete\n    the manifest web resource and rebuild from scratch.\n  - `pages-removed` — a live page was dropped from the spec. Re-add it, or pass `--allow-destructive`\n    to detach it from the nav (the page record stays deployed; rebuild finalizes the sitemap).\n  - `pages-shared-across-apps` — the page appears in another app's sitemap, published or only saved (not yet\n    published — an app that was never published counts). Detach it from that app — ask the user first, since this\n    changes another app. The halt names the app and prints the command with the app's `id` filled in (`\u003Cid of app …>` stands where the id could not be read, and\n    `scripts\u002Fapps.js list --env \u003CenvUrl> --search \u003Cname>` gives it); `node \"${PLUGIN_ROOT}\u002Fscripts\u002Fgenpage.js\" remove-from-app --env \u003CenvUrl> --app-id \u003Cthat app's id> --page-id \u003Cpage id>`\n    takes the page out of that app's navigation and publishes that app (everything it has saved goes live with\n    it; the page itself stays). Or detach it in Maker. `--allow-destructive` does **not** bypass this halt.\n    The build checks again right before it updates pages in place, so a page another app takes in while the build runs halts it\n    there too (\"became shared across apps while this build ran\"); one taken in while the pages upload is reported after them as a\n    warning naming the app, since it is written by then.\n  - `pages-shared-check-failed` \u002F `pages-existence-failed` \u002F `pages-sitemap-read-failed` — a\n    prerequisite read failed; the build can't proceed safely. Retry on a transient error; check\n    permissions on a persistent one.\n  - `pages-griffel-shorthand` — a page's `makeStyles` writes a CSS shorthand Griffel drops at runtime, so the page\n    would deploy without its border, color or reset. The message names the page, each key's line and column, and the\n    longhands to write; fix the page's source and re-run. Nothing was uploaded. It is raised for a page the build would\n    create and for a page whose source changed since the last build; a page you did not touch that already has one is sent\n    again as it is, with a warning (it renders without the key today). Deleting a key keeps the page looking as it does;\n    writing the longhands makes the style start to render. The same halt reports a `makeStyles` call the check cannot read\n    for certain as that — not as CSS Griffel drops — and says what to change in the code.\n  - `pages-locked` — another build of this app, or a `genpage.js add-to-app` \u002F `remove-from-app` \u002F `genpage-upload.js --app-id`\n    edit run from this folder, holds the app's pages lease. No page was written. A build takes that lease only when it\n    reaches its pages phase, so its earlier phases (solution, tables, forms, app shell) may already have saved their\n    changes: tell the user so, never that nothing changed. Wait for the other build or edit to finish and run the build\n    again; that run reconciles what was already saved. (A standalone `genpage.js` \u002F `genpage-upload.js` edit that gets this\n    refusal takes the lease first, so it did write nothing. Such an edit holds the app's build lease too, so a build started\n    while it runs is refused at once with `build-locked`, having written nothing: run the build again once the edit ends.)\n    It is a single-machine lock in this folder's\n    `.maker-workspace`, not a guard against an edit from another machine.\n  - `form-page-embeds-incomplete` — a page the spec embeds in a form (`forms[].genPages`) was not embedded. The message names\n    each key and why (`halt.notApplied`); tell the user both and never report the build as done. **In this release the CLI\n    build cannot embed a page in a form** (it has no record of the embeds it made, so it fails closed with\n    `managed-bindings-unavailable` after building everything else): when a user asks for a page on a form, say so and offer\n    the page in the app's navigation instead (`placement` left as `sitemap`). The same code at preflight means the run had the\n    forms phase but not the pages phase — run both.\n- **`--non-interactive`** — suppress interactive prompts (for automation \u002F CI). A non-interactive\n  build that encounters an existing app **fails** instead of warning-and-proceeding, unless\n  `--allow-destructive` is also set. Does **not** grant destructive authority on its own — only\n  `--allow-destructive` does.\n- **`POWER_PLATFORM_SKILLS_NONINTERACTIVE=1`** (or `true`) — env-var equivalent of\n  `--non-interactive`. Same semantics: suppresses prompts only, never authorizes destructive ops.\n  Set this in CI job environments to avoid interactive-prompt hangs.\n- In **autopilot \u002F eval mode** (`--non-interactive` + `--allow-destructive`), `preview-app.js`\n  is written to disk as the design artifact before plan execution; interactive consent gates are\n  bypassed and the build is fail-closed against any destructive op not explicitly authorized.\n\n### AI-first features\n\nThe `ai` block in the App Spec controls four app-level features and per-table Copilot row\nsummaries. All features are **admin-gated**: they are enabled only where the environment\nadministrator has turned them on in Power Platform Admin Center (Environments → Settings →\nProduct → Features). The `ai-features` build phase preflights each setting via the SDK\n(`RetrieveSetting`) and, for anything off, **skips it with a warning** — it never fails the\nbuild and cannot flip admin or tenant switches itself.\n\n**Preflight (standalone):**\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fai-preflight.js\" --env \u003CenvUrl> [--app \u003CuniqueName>]\n```\nPrints each feature's on\u002Foff status and the exact admin action required for anything that is off.\nNever fails.\n\n**App-level features** (`ai.appFeatures`) — `formFill` (Copilot-assisted form fill), `nlSearch`\n(natural-language grid\u002Fview search), `nlChart` (NL chart \u002F AI data visualization), `m365` (M365\nCopilot). All default to on except `m365`, which is left at its platform default; `false` writes an\nexplicit Off for this app (each setting's values: `references\u002Fapp-spec-schema.md` → `ai`).\n\n**Per-table row summaries** (`ai.summaries`):\n- `default: \"auto\"` — the skill auto-selects good-candidate tables (skips lookup-only \u002F config \u002F\n  junction tables and the Dynamics 365-owned `incident`, `lead`, `opportunity`).\n- `default: \"off\"` — summaries disabled unless a table opts in explicitly.\n- Per-table overrides in `summaries.tables`: set `enabled`, a tailored `instruction`, and\n  `columns[]` (the fields the summary reads). A `{ \"enabled\": false }` entry opts a specific\n  table out.\n\n**Prompt authoring guidelines** (for `instruction`): write for meaningful insights — not field\u002Fvalue\nrepetition; never include record GUIDs; pull in recent activity where relevant; use\naudience-appropriate tone; aim for an explicit output shape (a short paragraph).\n\n**Teardown** removes the AI records created by the `ai-features` phase (summary config rows and\npublished AI models) in addition to the standard artifacts.\n\n---\n\n## Editing a deployed app (download → edit → rebuild)\n\nThe **same App Spec drives edit** — there is no separate edit path. When the user wants to change an\nexisting app (add a field\u002Fview\u002Fpage, edit a page's code, retitle\u002Freorder nav, swap an icon), **pull the\ndeployed app fresh into a spec first**, then edit that spec and re-run Phase 2:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fdownload-model-app.js\" --env \u003CenvUrl> --app \u003CappId|uniqueName|displayName> --out \u003Cworking-dir>\n```\n\n`--app` resolves in identity order: app id (GUID) → `uniquename` → display name. Prefer the **unique\nname** — it is immutable, while a display name can be renamed and is not unique. A display name that\nmatches more than one app is refused, listing the candidate unique names rather than guessing.\n\nThis reconstructs the app into `\u003Cworking-dir>\u002Fapp-spec.json`. **Round-trip scope — be precise, it is\nnot everything:**\n- **Round-trips:** the sitemap → `appShell` (all subareas + icons), **every** generative page (read\n  through the SDK; the pages are the sitemap's `GenPage` subareas, so Maker-added pages\n  are included, and each keeps its own name, model, and connector and Custom API bindings —\n  `connectorBindings` \u002F `actionBindings`) into `pages[]` + their `.tsx`, the referenced\n  entities (minimal — the build reuses existing tables), **classic dashboards** (id-passthrough tiles\n  carrying the deployed view\u002Fchart ids), the icon web resources, and the solution.\n- **Does NOT round-trip:** `forms[]`, `views[]`, `charts[]`, `commands[]` — they come back empty\n  (a declared form comes back only with `--include-managed --managed-manifest \u003Cstore file>`; see\n  **Declared form layouts**; so does a declared view a `createIdentity` build created and the store proves\n  unchanged while the app's solution holds it, with its `viewId` and `createIdentity` (a rebuild writes\n  nothing to it; the rest of the rebuild runs as usual), the rest named in `managedViews.omitted`, and such a\n  declared chart, with no id (only a build from the same folder's store binds it), the rest named in\n  `managedCharts.omitted`). `commandStates[]` is never written either: a button's hidden \u002F disabled\n  state stays on the live row.\n  All four **survive on the live app** (a rebuild preserves them by discovery), so a plain edit is\n  safe; they just aren't editable through the downloaded spec. Change them in Maker or a fresh spec.\n  The download names every one it leaves out — the command-bar buttons of the app's tables included —\n  in its `NOTE` and its result's `notRoundTripped`, and lists them under `descriptionInventory` in the\n  spec: tell the user before they rebuild the spec in another environment, which would not have them.\n- **Roles are not in the spec, and a rebuild leaves them as they are.** A download carries no\n  `personas[]`: the roles associated with the app stay as the environment has them. Keep `personas[]`\n  out when you extend an app whose roles somebody else owns — a persona's role is converged to exactly\n  the privileges declared, and a role the build did not author is refused. Give an existing role a new\n  table with a `roleGrants[]` entry (additive; it does not associate the role with the app). Lint and\n  the design document name each new table no persona and no grant covers, and `write-app-spec-doc.js\n  --env` lists the roles the app has.\n\n**Page bindings and another environment.** A page's connector and Custom API bindings are in the spec, by the\nproperties the references document — `logicalName`, `connectorId`, `dataset`, `tables`, `tableDisplayNames`,\n`operations` for a connector binding; `name`, `isFunction`, `boundEntityLogicalName`, `displayName`,\n`parameterKinds` for a Custom API binding — each with a value of a shape known to be safe, and by nothing else,\nso a rebuild writes them back into this environment and into another one. A list in which any binding holds\nanything else (a connection id, a credential, a property no spec states, a URL with a query) is **not** in the\nspec at all: the pull's `pageBindings.notCarried` names the page, the list and the entry's place (never a value),\nand the page keeps that list as it is. Tell the user, and that the page folder's own `config.json` still holds\neverything — they must not commit or share that folder if a value there is a credential. A spec that states such\na binding is refused. A rebuild cannot make what the bindings *name*. When the pull's result carries\n`pageBindings`, tell the user what it says before any rebuild into another environment: `neededInTarget` lists\nthe connection references (and the connections behind them), the Custom APIs and the service resources (a\nSharePoint site and its list ids, say) that environment must already have, and `notCarried` the lists the spec\ncould not state (a rebuild into the same environment leaves those as they are; into another one, they are bound\nwith `\u002Fgenpage`). The rebuild itself reads that environment's references before it writes anything: it **stops**\n(`pages-binding-reference-conflict`, nothing written) at a connection reference of that name that is for another\nconnector — give the binding the logical name of a reference that is for the right connector, or set the\nbinding's `connectorId` to the one that environment has, and never pick a reference for the user — and its\nwarnings say by name each reference or Custom API that is not there yet, a reference that has no connection, an\noperation the custom connector there does not define, and what it could NOT check (a row that did not say its\nconnector or connection, or operations no custom connector definition could prove): relay them. A binding named\nexactly `WhoAmI` or `RetrieveVersion` is a reviewed built-in Dataverse operation, not a Custom API: the pull lists it\nunder `neededInTarget.dataverseOperations` (nothing to deploy), and a rebuild reads nothing for it and says\n`These are reviewed built-in operation names; their availability in this environment or player and the signed-in\nuser's permissions were not checked.` — relay that too, never as \"missing\" and never as \"compatible\"\n(`references\u002Fdataverse-operations.md`). Do not write bindings into a\nspec yourself — they come from a page a pull read — and when you reset a page to `intent` to regenerate it, delete\nits bindings from the spec: the generator writes no connector code.\n\nThen:\n\n1. **Always pull fresh at the start of an edit session** — someone may have changed the app in Maker. The\n   build reads an etag when it hydrates, so a write against an artifact changed since the pull throws a\n   version conflict → **re-pull and retry**, never clobber. Pull into the **same `\u003Cworking-dir>`** every time:\n   a page keeps the `key` its earlier download gave it (read from the `app-spec.json` already there, when that\n   file names this app in `app.uniqueName`; matched by the page's id), and a copy of the spec deployed to\n   another environment is bound to the pages it built there by those keys — a key that changed would update a\n   different page. A new folder mints keys again. If the pull answers `\"code\": \"page-keys-ambiguous\"`, the\n   earlier `app-spec.json` gives one key to two pages (or one page two keys) and **nothing was written**: show\n   the user the message, which names the pages and keys, and either correct the file and pull again or —\n   only when the user says so, because fresh keys can make a copy deployed elsewhere update the wrong\n   pages — pull again with `--reset-page-keys`, which re-keys exactly those pages. If it answers\n   `\"code\": \"navigation-language-unknown\"`, the environment's base language could not be read, so the\n   language of the app's navigation titles is not known, and **nothing was written**: pull again, or pass\n   `--language-code \u003Clcid>` (the environment's base language — the flag the build takes; a spec already in\n   the folder that pins `languageCode` needs neither). Do not guess it: a spec whose titles were read in the\n   wrong language writes them over the right ones on the next build.\n2. Edit `app-spec.json` (and any page `.tsx`) for the requested change. A page you edit by hand is\n   checked like a generated one: run `node \"${PLUGIN_ROOT}\u002Fscripts\u002Fcheck-griffel-styles.js\" --file \u003Cpage.tsx> --existing`\n   on it before you rebuild (the rule and the ten shorthands are in Phase 1.5, step 5) and fix what it\n   reports. `--existing` reports the page's scroll context (`references\u002Frules.md`, **Page Layout**) in\n   `notes` without changing the exit code: tell the user about each note and offer the edit it gives. A key the page already had when it was downloaded is reported too: the deployed page renders\n   without it today, so deleting it keeps the page looking as it does, while writing the longhands makes\n   the style start to render — delete it unless the user wants that change. The build runs the same\n   check on every page it uploads that is new or that you changed since the last successful apply of this app, and halts as\n   `pages-griffel-shorthand` — naming the page, each key's line and column, and the longhands — so a page\n   you changed does not reach the app with one. \"Changed\" is measured against the source that apply recorded for the page in\n   `.maker-workspace\u002Flast-applied.json` (a successful full or changed-only apply, or a download, writes it; a failed or partial build records nothing).\n   A page you did not touch is sent again as it is, and a\n   key it already has only draws a warning — and so does a page you changed in a workspace that holds no record of it (a new or moved one, or\n   another environment), where the build cannot tell what was sent: run the checker on that page yourself.\n   A page you edit by hand also follows the iteration rule of Phase 1.5, step 5 (**Common Errors > 5.\n   Iteration that another page compiler can lose** in `references\u002Frules.md`): convert a Map, Set or\n   iterator with `Array.from` before spreading, looping over or destructuring it. An upload compiles the\n   changed page again with iterator support, so a form it already had now reads its values where an\n   earlier release lost them, converted or not; convert such a form only when the requested change needs it.\n3. **If the edit ADDS a page** (or resets a page's `source` back to `intent` to regenerate it),\n   **re-run Phase 1.5 before Phase 2** — a downloaded spec contains only `kind: \"tsx\"` pages, so an\n   added `intent` page has no code and Phase 2's `deploy` profile rejects it. Phase 1.5 is safe to\n   re-run: `write-page-plan.js` projects **all** pages (so the worker sees the real nav graph), a\n   worker is dispatched only where the echo says `intent: true`, and `promote-intent-pages.js`\n   leaves built pages untouched. Editing an *existing* page's `.tsx` by hand needs no regeneration.\n4. Re-run the **build** (Phase 2). It's idempotent: it reuses the existing app\u002Ftables\u002Fviews, **updates\n   each page in place** (matched by name → `--page-id`, so no duplicates), and **preserves the\n   existing `GenPage` subareas** (the download enumerated them into `pages[]`\u002F`appShell`, so the\n   full-replace sitemap write never drops them).\n5. **Verify** (Phase 3) to confirm only the intended change landed.\n\n> **Prefer generative pages over classic dashboards** per the genpage-first policy. Classic dashboards\n> do round-trip (id-passthrough tiles), but the views and charts their tiles point at do not, so they\n> can only be edited in Maker.\n\n## Fixing rows, listing a solution, moving an app\n\nThree explicit tools for asks that are not a build. None runs from the App Spec; use each only when the\nmaker asks for what it does.\n\n**Fix values in existing rows** (\"fix the status on these 30 rows\", \"set the missing region on old\nrecords\"). Plan the change:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fdata-fix.js\" plan --env \u003CenvUrl> --app-dir \u003Cdir> --table \u003Cname> --filter \u003Codata> --set \u003Cjson> --max-rows \u003Cn>\n```\n\nThe plan prints only counts, a plan id and a digest: OPEN the review file it names and show the maker\nthe before\u002Fafter values it lists, and the row count. Apply only after the maker approves those values:\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fdata-fix.js\" apply --env \u003CenvUrl> --app-dir \u003Cdir> --plan-id \u003Cid> --approve \u003CplanDigest> --app \u003CappUniqueName>\n```\n\nAdd `--workspace \u003Cdir>` if the app's build uses one, and pass the same `--app`\u002F`--workspace` to `resume`\nand `revert`.\n- It waits for no build: if the app's build is running, it refuses (`DATA_FIX_BUSY`); try again after it.\n- A non-zero exit means not every change was made. Rows another maker changed after the plan are\n  reported as conflicts, never overwritten.\n- A partial run continues with `resume`, which retries only rows not attempted. Rows whose outcome is\n  unknown are never resent automatically and keep the run non-zero.\n- `revert` writes its own review file and asks for fresh approval of it. If it stops before writing, run\n  `revert` again for a fresh review of what is left.\n- A row whose outcome was unknown, or one written without what a revert needs, cannot be undone: the\n  revert review lists it, the revert leaves it as it is and exits non-zero. Check those rows by hand.\n  When NO applied row can be undone, the revert writes no review file and exits non-zero with only the\n  counts: the plan's journal (`\u003Capp-dir>\u002F.data-fix\u002F\u003CplanId>\u002F`) records which rows were written.\n- It is not atomic.\n\n**See what is in a solution** (\"what is in solution X\"):\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fsolutions.js\" inspect --env \u003CenvUrl> --solution \u003Cname>\n```\n\nIt lists supported artifacts by kind, tables whose subcomponents it did not expand, and components it\nskipped or could not read, with its request count. It is not everything the solution owns, and it is\nnot a portable set of components. A component it could not read carries a code and HTTP status, not\nthe service's message: there is none to pass on.\n\n**Check whether an app can move to another environment** (\"can I move this app to prod\"):\n\n```bash\nnode \"${PLUGIN_ROOT}\u002Fscripts\u002Fplan-app-promotion.js\" --source-env \u003CenvUrl> --target-env \u003CenvUrl> --package \u003Csolution.zip> --app \u003Cname>\n```\n\nIt only reads. It lists the components it cannot promote (most schema, forms, views, flows and similar\ncomponents today) and what the target needs.\n- There is no apply step. It never falls back to an import.\n- Pass `--acknowledge-non-atomic-import` only when the maker accepts that an import can partly succeed.\n- The existing solution export\u002Fimport remains a separate path with its own limits.\n\n## What the builder does (in order)\n\nsolution (idempotent) → data model — **discover** existing tables\u002Fcolumns\u002Frelationships via the SDK\n(`findTables` \u002F `findColumns` \u002F `fetchEntityMetadata`) and create only what's missing (`createTable`\n\u002F `createColumn` \u002F `createRelationship`) → **sample data** (opt-in; relational\u002Ftopological,\n`$parent`→`@odata.bind` using the entity-set name) → **web resources** (opt-in;\n`createWebResource` for form JS\u002FHTML\u002FCSS) → **views** → **charts** → **forms** (primary + columns\nlaid out, explicit `tabs` honored; sub-grids, quick-views, and form JS (`events[]`) applied as\ncanonical control cells \u002F the `\u002Fbag\u002Fc` events region via the SDK's generic `addElement` surface)\n→ **business rules** (`businessRules[]` — authored as the workflow object model through the bound\n`CreateProcessWithWfomJson` member and activated; **skipped with a warning** on an environment that\ndoes not declare that member or has it switched off — HTTP 400 `0x80040216`, common on production environments) →\n**business process flows** (`businessProcessFlows[]`; a category-4 process compiled from the\nauthored stages and activated — this goes through the SDK's generic artifact surface, a plain\n`workflows` row, so it is NOT subject to the bound-member gate above) →\n**command bar** (`commands[]`) → **classic dashboards** (opt-in)\n→ **app module + sitemap** → **generative pages** (each page's `.tsx` was generated in Phase 1.5;\nthe build writes each `pages[]` page through the SDK, without placing it; then\nthe SDK rewrites the sitemap once to add the `GenPage` subareas) → **AI features** (opt-in) →\n**security** (one role per `personas[]` entry, sized from its jobs' declared access; injects an\napp-module read privilege and associates the app to each role so it opens for that persona) →\npublish (opt-in). When the app has generative-page subareas the app module is created first WITHOUT\nthem (they can't resolve until the pages upload), then the pages phase rewrites the sitemap — except for a\nnew app whose navigation holds ONLY page subareas: its pages are created first, and then the app, with them\nalready in its first sitemap. All\nDataverse access goes through the SDK, so the downloaded metadata lands in `.maker-workspace\u002F`.\nIndependent ops (columns, views\u002Fcharts\u002Fforms) run with bounded parallelism; publish is one\nround-trip per entity + the app. Views\u002Fcharts build **before** forms so a sub-grid can reference the\nchild view id. Each step emits `[n\u002Ftotal]`.\n\n## Notes & limits\n\n- **Headless, no browser.** The SDK (`cds-maker-sdk`, vendored at `scripts\u002Fvendor\u002F`) generates\n  designer-grade FormXML\u002FFetchXML\u002Fsitemap by reusing the designer's own serializers, and writes via\n  the Web API using an `az`-token HttpClient. No relay, no designer tab.\n- **Dedicated unmanaged solution per app** (review \u002F teardown). **`--publish` gates the final\n  *bulk* publish** of the app's entity + app customizations (one `PublishXml` for every entity and the\n  app). With `--publish` that one publish also carries the default-view enrichment, and the tables the build\n  changed, with the tables whose forms or charts the app holds or is about to hold, are published together once\n  more, in one request before the app is: the tables touched by the reconcile of an existing form or view, form\n  events and quick-view placement, so none of them publishes on its own, the tables of the charts the build wrote\n  (a chart's description is saved on the unpublished layer), the navigation's tables whenever the build pushes the\n  app (the SDK adds their active Main forms to it, and a form that is live with a label saved and not published\n  would otherwise be pinned and published with the app before its table was; a table whose `app.mainForms` list\n  keeps no form adds none; a changed-only re-upload of a page that has to pin a default view the app lost is\n  covered too — its push adds the view and no form, so what it publishes ahead of the app is the tables of the forms and charts the app holds — and one that has nothing to pin publishes nothing), and — for an app that already exists — the tables of the form and chart components\n  its saved component list names, a form a maker added to it and never published included, so a label saved and\n  not published there is not held back by the app's publish. A table the app is not known to hold a form or chart\n  of is not named (declared only, a lookup column's target, read only by a page, or only pinned in `app.tables`):\n  a table's publish ships everything saved on it, whoever saved it. If the app's components cannot be read\n  completely the build publishes only what it changed and what its write adds, and says which read failed. It\n  does **not** suppress the small **targeted** publishes that edit\u002Ffinalize paths must run so the change\n  takes effect: without `--publish`, reconciling an existing form or view, wiring form events and\n  placing quick-views each publish that one artifact, and with or without it, re-syncing an existing\n  app's sitemap and finalizing the sitemap after generative pages publish the app, and repairing a\n  lookup column still labelled with an old default publishes its table (an unpublished edit\n  to a live artifact is invisible). A fresh build without `--publish` still leaves new\n  tables\u002Fcolumns\u002Frelationships staged-but-unpublished in the solution, except on a table a declared form\n  (`reconcile: \"declared\"`) is published on: that table publish puts live every saved change on the table,\n  its new columns included (a declared dashboard is likewise published after its write).\n- **Idempotent — but not full desired-state convergence.** Existing\n  solution\u002Ftables\u002Fcolumns\u002Frelationships\u002Fviews\u002Fcharts\u002Fforms\u002Fcommands\u002Fdashboards are detected and\n  **reused**, so re-runs and existing-table envs work without collisions. **The caveat for EDITS:** a\n  rebuild never removes an artifact you dropped from the spec, and re-applies only part of an edit to\n  one that already exists. A **form** converges its fields (added; for an explicit layout, dropped ones\n  pruned — see `prune: false` below), column counts and spans. A **view** only *adds* columns: a\n  column removed from the spec, or a new column order, does **not** apply, and neither do its filters\n  or sort. A changed column type, and an edited command or dashboard, are not re-applied at all; an\n  existing chart takes only a changed description, an existing app takes a changed name and description\n  (an app that was never published keeps its text and the build warns it was not applied, and so does one whose name or\n  description is localized — only that text is held back: the other text and a routing description are applied, the SDK\n  writes only what changed, and a text that is not plain is never sent, even when the SDK's own read of the header fails;\n  the icon is set when the app is created: a\n  different `app.icon` is reported as not applied), and an existing\n  business process flow takes the stage and step edits that cannot move a record — a stage added or renamed,\n  a step added, renamed, rebound or moved — and refuses, saying why, one that would remove a stage or a step\n  or reorder the stages (no stage or step edit is then applied; the requested Active\u002FDraft state is handled\n  independently).\n  **To apply one of those edits, change it in Maker, or `teardown --apply` then rebuild fresh.**\n  `--verify` catches what is **missing** — a spec view column, filter condition or sort key (authored\n  sort keys must also keep their order), a relationship, a table's command bar, a status reason, an alternate key\n  or a dashboard — as a loud `verify FAIL`. It tolerates **extra** deployed content, so\n  a view column, filter or sort key you removed from the spec still passes, just as one a maker added\n  by hand does. Individual command controls are not verified.\n- Not in scope (later): **conditional** command visibility (Power-Fx-only), **titled\n  command groups** (from-scratch — needs an SDK-synthesized parent row), lookup\u002Fassociated views,\n  multi-area sitemaps, and **access teams \u002F hierarchy security** (a tracked SDK follow-up). The\n  security surface today is role-per-persona, per-form role assignment and, from 2.21.0, column-level\n  security (`isSecured` + `fieldSecurityProfiles[]`). Also out of scope: the BPF knobs the spec gate rejects\n  (cross-entity stages, branching, stage actions).\n- **Environment-gated (may not work where you are running):**\n  - **Business rules** (`businessRules[]`). The SDK writes a rule through the bound\n    `CreateProcessWithWfomJson` member — the same one the modern business-rule designer uses — and\n    **has no fallback**: the client-side workflow-XAML compiler it used to fall back on was removed\n    upstream because it covered 4 of the 7 action types and a single clause, so it silently narrowed\n    a rule into something that did not say what the author wrote. Environments that do not declare\n    the member therefore **cannot host business rules at all** — and that is the common case, not an\n    edge case. **Production environments are the other common case**: they declare the member but\n    answer the first rule with HTTP 400 `0x80040216` (\"An unexpected error occurred.\"), a platform\n    limit, and nothing is created. The build **skips** the rules in both cases, warns once naming the\n    member or the code, and builds everything else normally, so an app is never left half-created. If rules are\n    essential, verify the environment first.\n    **Business process flows are NOT affected by this gate** — a BPF is written as an ordinary\n    `workflows` row through the SDK's generic artifact surface, with no bound member involved.\n- Supported: the full data model — all column types, **AutoNumber primary**, global choices, status\n  reasons, alternate keys, **N:N + junction-with-payload**; **`required` reconciled on existing\n  columns** (`true`, `false` or `\"recommended\"` — anything else is refused at validation; an explicit\n  `required` converges on rebuild; an omitted one never demotes) and **asked\n  of a new table's primary column in its create**, said applied only once the SDK confirms it;\n  **Boolean `defaultValue`**, whole-number **`integerFormat`** (incl. `Duration`), and per-column\n  **write permissions** (`isValidForCreate` \u002F `isValidForUpdate` \u002F `isValidForRead` — this is how you\n  make a column read-only), all applied on **create and on rebuild**; adaptive\n  main forms with **1:N \u002F N:N sub-grids** (placed between sections or in a tab \u002F form-column with\n  `tab` \u002F `column` \u002F `after` \u002F `before`, and moved into place on rebuild); **per-field form control** (`readOnly` \u002F `hidden` \u002F\n  `after` positioning, plus `prune: false` to edit a subset of a form non-destructively);\n  **quick-create \u002F quick-view forms** (`formType`) + **quick-view placement**\n  (`forms[].quickViews[]`); **per-form security roles** (`forms[].securityRoles` — name the\n  `personas[]` this form is offered to, or `everyone: true`; applied after the roles exist. A form\n  with no assignment is visible to **every** role, so this **restricts** a form rather than granting\n  it); **which form a table opens with** (`forms[].isDefault` \u002F `entities[].mainFormOrder` set the\n  table's Main Form Set order, on existing tables too — a user's remembered form still opens first for\n  that user; see app-spec-schema.md); Choice-column charts; **business rules** (`businessRules[]` — authored as the modern workflow\n  object model and activated; see the environment gate above); **security roles** (`personas[]` — one role per\n  persona sized from its jobs-to-be-done, with app access so the app opens for non-admins);\n  **dashboards** (`dashboards[]` — chart\u002Flist\u002Fiframe\u002Fwebresource tiles) + **dashboard sitemap\n  placement**; **generative pages** (`pages[]` — the genpage-first default, written through the SDK\n  and surfaced as `GenPage` sitemap subareas; full **create + edit**\n  round-trip via `download-model-app.js`); **modern command-bar buttons** (`commands[]`) incl.\n  **flyout \u002F split-button menus**; **rich view filters** (`eq-userid`\u002F`this-week`\u002F`in`\u002F`not-in`);\n  **custom grid rendering** (`entities[].columns[].visualization` — radial dial \u002F line chart \u002F\n  heat map \u002F star rating, preview); web resources + form JS event handlers; sample data with\n  **multi-parent `$parents`** + **`statusReason`**. See [`docs\u002Fapp-builder-capabilities.md`](..\u002F..\u002Fdocs\u002Fapp-builder-capabilities.md) and\n  [`references\u002Fapp-spec-schema.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema.md) (plus\n  [`app-spec-schema-advanced.md`](..\u002F..\u002Freferences\u002Fapp-spec-schema-advanced.md) for the conditional\n  fields it points at) — author from those docs; you should not need to read the SDK, lint, or\n  engine to write a spec.\n",{"name":5,"author":56,"version":57,"description":7,"allowed-tools":58,"argument-hint":59,"user-invocable":60},"Microsoft Corporation","1.0.0","Read, Write, Edit, Bash, Glob, Grep, Task, AskUserQuestion, EnterPlanMode, ExitPlanMode, TaskCreate, TaskUpdate, TaskList, read, edit, execute, search, agent, todo","\u003Capp description>",true,"main","cb07d811d384ebec4ef29be589539c08f2db7833","plugins\u002Fmodel-apps\u002Fskills\u002Fapp-builder",232,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills","https:\u002F\u002Fmicrosoft.github.io\u002Fpower-platform-skills\u002F","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-14 21:46:39",{"source":9,"skillName":5,"commands":72,"prompt":82,"zipAvailable":60},[73,76,79],{"tool":74,"command":75},"npx","npx skills add microsoft\u002Fpower-platform-skills --skill app-builder",{"tool":77,"command":78},"bunx","bunx skills add microsoft\u002Fpower-platform-skills --skill app-builder",{"tool":80,"command":81},"pnpm","pnpm dlx skills add microsoft\u002Fpower-platform-skills --skill app-builder","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fmodel-apps\u002Fskills\u002Fapp-builder\u002FSKILL.md",[],[85,93,122,148,172,190],{"skillNo":86,"name":87,"nameZh":17,"description":88,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":92},"01M78JN2BFRRV1J54Q6WKZQ08D","compare-site-configurations","Compare Power Pages site configurations between two environments, such as dev, test and production, or between a local download and the live site, and explain which differences change site behavior. Use when a site works in one environment but not another (for example, works in dev but fails in test), to check configuration drift before promoting or deploying, or to see what changed between two sites. Produces a shareable HTML report and a JSON file that VS Code can import.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fpower-pages\u002Fskills\u002Fcompare-site-configurations\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":94,"name":95,"nameZh":96,"description":97,"descriptionZh":98,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":99,"categories":100,"keywords":107,"publishedAt":51},"01M699WVHX0XN59EPBTTPEKYPG","setup","Process Intelligence 配置与登录","Use when Process Intelligence needs building, explicit cloud\u002Faccount\u002Fenvironment configuration, sign-in, connection diagnostics, or recovery from an authentication error.","当 Process Intelligence 需要搭建、显式的云\u002F账户\u002F环境配置、登录、连接诊断，或从认证错误中恢复时使用。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fprocess-intelligence\u002Fskills\u002Fsetup\u002FSKILL.md",[101,104],{"categoryNo":102,"categoryName":103,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD4WETX0HM3SM9QKQ15B","SRE 工程师",{"categoryNo":105,"categoryName":106,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BSTR9G4A4GZ0VB2DFN9490","开发环境与工具链管理",[95,108,109,110,111,112,113,114,115,116,117,118,119,120,38,121],"configuration","diagnostics","error","environment","cloud","when","connection","authentication","use","Bash","recovery","process","sign","intelligence",{"skillNo":123,"name":124,"nameZh":125,"description":126,"descriptionZh":127,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":128,"categories":129,"keywords":136,"publishedAt":51},"01M699WSR9EX55YY1WD9J22FEG","report-issue","流程智能问题报告撰写","Use when the user wants a Process Intelligence bug-report draft or support summary for a failed operation.","当用户需要针对失败操作起草流程智能（Process Intelligence）缺陷报告或支持摘要时使用。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fprocess-intelligence\u002Fskills\u002Freport-issue\u002FSKILL.md",[130,133],{"categoryNo":131,"categoryName":132,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD5CX980XNXCJKQF70BY","数据分析师",{"categoryNo":134,"categoryName":135,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BRSRYQ3M8N5063NNQPF2B1","调试与故障排查",[137,138,139,140,116,113,141,142,119,143,121,144,145,146,147],"issue","report","report issue","bug-report","operation","draft","bug","summary","user","for","support",{"skillNo":149,"name":150,"nameZh":151,"description":152,"descriptionZh":153,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":154,"categories":155,"keywords":160,"publishedAt":51},"01M699WR26YQ9Q21KE6MJF5B2G","investigate-process","流程挖掘问题调查","Use when a broad Process Mining business question, observed pattern or competing explanation needs investigation across analytical perspectives.","当需要从多个分析视角调查宽泛的流程挖掘（Process Mining）业务问题、观察到的模式或相互竞争的解释时使用。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fprocess-intelligence\u002Fskills\u002Finvestigate-process\u002FSKILL.md",[156,159],{"categoryNo":157,"categoryName":158,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQGD4CMBM6B4PWSM1NXGT9","数据分析与报告",{"categoryNo":131,"categoryName":132,"taxonomyType":23,"taxonomyTypeDesc":24},[161,119,162,163,116,164,165,113,166,167,168,38,169,170,171],"investigate","investigate process","question","process mining","business","across","perspectives","mining","pattern","investigation","analytical",{"skillNo":173,"name":174,"nameZh":175,"description":176,"descriptionZh":177,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":178,"categories":179,"keywords":182,"publishedAt":51},"01M699WP9SDG5ZR12P8VYNXKTN","derive-metric","派生指标计算","Use when a requested measure is missing, a saved custom metric needs reuse, or an ephemeral formula or derived scalar is needed.","当所需的度量指标缺失、需要复用已保存的自定义指标，或需要临时公式或派生标量时使用。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fprocess-intelligence\u002Fskills\u002Fderive-metric\u002FSKILL.md",[180,181],{"categoryNo":157,"categoryName":158,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":131,"categoryName":132,"taxonomyType":23,"taxonomyTypeDesc":24},[183,184,185,186,187,188,116,113,189,38],"metric","derive metric","missing","formula","custom","reuse","saved",{"skillNo":191,"name":192,"nameZh":193,"description":194,"descriptionZh":195,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":196,"categories":197,"keywords":200,"publishedAt":51},"01M699WMG5R8P6SMTDAS1TKF9E","compare-cohorts","流程队列对比分析","Use when comparing process cohorts, departments, periods or before-and-after results under matched definitions.","用于在统一的定义下比较流程队列（cohort）、部门、时间段或前后结果。","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fprocess-intelligence\u002Fskills\u002Fcompare-cohorts\u002FSKILL.md",[198,199],{"categoryNo":157,"categoryName":158,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":131,"categoryName":132,"taxonomyType":23,"taxonomyTypeDesc":24},[201,202,116,113,203,119,38],"compare","compare cohorts","results"]