@antelopejs/agent-skills 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/agent-skills",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Finds the agent skills that AntelopeJS packages ship, so every tool that loads them sees the same ones.",
5
5
  "keywords": [
6
6
  "agent-skills",
@@ -49,7 +49,7 @@
49
49
  "engines": {
50
50
  "node": ">=20.19"
51
51
  },
52
- "gitHead": "801fced56cd007ab9cacd89dc7d1f7dde74d7383",
52
+ "gitHead": "609c269e4e8002683baa84ca5e7d3fafc809a8a4",
53
53
  "scripts": {
54
54
  "typecheck": "tsc -p .",
55
55
  "release": "release-it"
@@ -38,6 +38,16 @@ installed engine doesn't support it — explain the limitation instead of retryi
38
38
  `list`, `select`, `count`, `new`, `edit`, `delete`, `archive`, `restore`,
39
39
  `exportStart`, `exportStatus`, `exportDownload`) are rejected with `invalid_config`.
40
40
 
41
+ ## Column presentation
42
+
43
+ `builder_add_field`, `builder_configure_field`, `builder_create_resource` `fields` and `builder_map_resources` `fields[]` also take, in Safe mode too:
44
+
45
+ - `display: { type, options? }`, a cell display: `identity`, `pills`, `relative_date`, `indicator`, `status_pill`, `two_line`, `progress`, `sparkline`, `duration`, `bytes`, `string` or `mono`. Options are checked per display: a bad one is `invalid_config` naming it (`builder_map_resources` skips the relation with a `relation_skipped` warning). On a mapped column it is a badge or a price, or a cell display over a column with neither.
46
+ - `group` (a form group id), `isVisible`, `size` (> 0), `cellWrap`, `description`.
47
+ - In `builder_configure_field`'s patch each may be `null` to remove it.
48
+
49
+ `builder_configure_column_groups { resource, groups }` writes the class's `@ColumnGroup`, the groups of the add, edit and details forms: `groups` is `{ [id]: { label, description?, orientation?, order? } | null }`, a group sent replaces its id, `null` removes it, a group left out stays. `builder_resource_structure` reads fields' presentation and `columnGroups` back.
50
+
41
51
  **Displaying a resource on a page is a builder step**: create and populate the
42
52
  resource, then `builder_add_block` a `TableView` with `controller` = the resource `ref`
43
53
  and display options in `config`. Relation columns work via `$ref` (see
@@ -24,7 +24,7 @@ Settle these three before the first edit. They decide every later branch.
24
24
 
25
25
  - **PageRef** = the page's route, e.g. `/charts/revenue`.
26
26
  - **BlockPath** = `<pageRef>#<name>[/<childId>...]`: `#<name>` is a top-level block; each `/<childId>` descends into a container's child.
27
- - **CategoryRef** = a dotted id, e.g. `pages.charts` (top-level pages under `pages.*`; module pages under `modules.<id>.*`). Take exact refs from `builder_list_pages`, never guess.
27
+ - **CategoryRef** = a dotted id, e.g. `pages.charts` (a category under the built-in Pages; module pages under `modules.<id>.*`). A sidebar section's ref is just its name, e.g. `sales`, not `pages.sales`. `builder_list_pages` answers `{ pages, categories }`: each page carries `section`, the ref of the section it shows under, and each section in `categories` carries `section: true`. Take exact refs from it, never guess.
28
28
  - **ResourceRef** = a data resource's id, its `/api/<name>` route segment. **FieldPath** = `<resourceRef>#<fieldName>`. Take refs from `builder_list_resources`.
29
29
  - **QueryRef** = `<pageRef>@<queryName>`, e.g. `/catalog/books@inStockCount`. Take refs from `builder_page_structure`'s `queries`.
30
30
 
@@ -41,7 +41,7 @@ Settle these three before the first edit. They decide every later branch.
41
41
  3. **Create a page** with `builder_create_page` (a real `CategoryRef`); it returns `{ ref, filepath }`. Then give the user the URL `navigate_to_page` answers for it, so they can watch it fill in.
42
42
  4. **Build the blocks.** A whole page, or a set of blocks, goes in one `builder_compose_page` call: the blocks as an ordered tree, each data block with its `query` inline. Preview it first (`"preview": true`), as **dms-page-design** _Build a page in one call_ says. For one block, `builder_add_block`: omit `parent` for a top-level block or pass a container's BlockPath; `name` unique among siblings. A controller-leading block (catalog `controllerArg: true`, e.g. `TableView`) takes `controller` = the resource `ref`; other types refuse it.
43
43
  5. **Configure or rearrange.** `builder_configure_block` merges options (`replace: true` overwrites); `builder_configure_table_view` sets a table's displays, views and footer. Children change only through `builder_add_block`, `builder_move_block` and `builder_remove_block` (which removes the subtree).
44
- 6. **Pages and categories.** `builder_configure_page` edits displayName, icon, order, description, `hidden` and `category` (a move changes the page's ref and route); `builder_delete_page` removes a page and its barrel import; `builder_create_category`, `builder_configure_category` and `builder_delete_category` manage categories. A category delete is refused with `referential_integrity` while a page references it.
44
+ 6. **Pages and categories.** `builder_configure_page` edits displayName, icon, order, description, `hidden` and `category` (a move changes the page's ref and route); `builder_delete_page` removes a page and its barrel import; `builder_create_category`, `builder_configure_category` and `builder_delete_category` manage categories; `builder_create_category` with `section: true` writes a sidebar section (a `RootCategory`, `type: "label"`), as a mockup's `categories` need, where a plain call writes a collapsible category. A category delete is refused with `referential_integrity` while a page references it.
45
45
  7. **Verify.** A typecheck-clean edit can still fail at runtime (a `fetchUrl` that 404s). Before the write, the `builder_compose_page` preview answers each block's data status. After it, `query_logs` shows the host's reload and runtime output, and `navigate_to_page` answers the page's dashboard URL (`unknown_route` until the reload registers the page); it drives no browser. Open that URL with your browser tool when you have one and look at every block; without one, give the URL to the user and ask them to check it. The step is done when every block the change touched shows data and the logs show no error from it.
46
46
 
47
47
  On the code path, verify with the project's typecheck (the `typecheck` MCP tool, or the project's own script), then open the page in the browser as **dms-pages** _Verify in the browser_ says.
@@ -52,7 +52,7 @@ A **resource** is the data a table or form shows: a `Table` + `Model` and a `Dat
52
52
 
53
53
  A **query** is a derived-data endpoint on a page: an aggregate or one point per group, backed by a generated model method. Its `response` matches the block: `value` for a `KpiCard`, `card` for a `ChartCard`, `items` for a `TopListCard`, `series` for a bare chart. Run `builder_query_templates` and `builder_preview_query` first, add it with `builder_add_query` on the page that shows it, and wire the returned `route` as the block's `fetchUrl`.
54
54
 
55
- [REFERENCE.md](REFERENCE.md) has the resource and query workflows, field rules, `$param` binding and opaque queries.
55
+ Fields take per-column presentation (`display`, `group`, `isVisible`, `size`, `cellWrap`, `description`) and `builder_configure_column_groups` writes form groups, in Safe mode too: see REFERENCE.md _Column presentation_. [REFERENCE.md](REFERENCE.md) has the resource and query workflows, field rules, `$param` binding and opaque queries.
56
56
 
57
57
  ## Theme and branding
58
58
 
@@ -64,7 +64,7 @@ On the code path, edit the theme yourself in the `app/app.config.ts` of the proj
64
64
 
65
65
  - `typecheck_failed`: read `diagnostics`, fix the `config` or `type`, retry. Nothing was written.
66
66
  - A refusal that names a read-only connection (a `writable: true` mapping, a `ResourceForm` in `new` or `edit` mode, a `TableView` that serves write routes): follow **dms-external-database** _Connection access_.
67
- - `invalid_config`, `duplicate_name`, `not_found`: fix the input.
67
+ - `invalid_config`, `duplicate_name`, `not_found`: fix the input. A value refused as not one of an enum's allowed values (the error lists them): pick the closest allowed value yourself, send it and mention the substitution in your reply (a badge tone `pink` becomes `warning`); ask the user only when none is close.
68
68
  - `stale`: the page changed under you; read it again with `builder_page_structure` and retry.
69
69
  - `builder_unavailable`, `request_failed`: the builder engine is unreachable or does not implement the operation (`HTTP 400` means `unknown_op`). Explain the limitation; retry nothing.
70
70
  - `opaque_target`, `unsupported`: the builder cannot make this change. Without Safe mode, make it in code with **dms-pages**, then call `builder_refresh` (scoped to the page): it clears the builder's caches, so it reads the file again. In Safe mode, ask the user whether to turn Safe mode off for that one step; never force it.
@@ -38,8 +38,9 @@ read only. Nothing is written before the integrator approves your plan.
38
38
 
39
39
  Call `database_connections`.
40
40
 
41
- - **A connection is listed** with an `engine`: use its id and go to 2. When the integrator chose
42
- read & write as they connected it, raise its access first, as _Connection access_ says.
41
+ - **A connection is listed** with an `engine`: use its id and go to 2. Its `access` is the one
42
+ the integrator chose, in dms-assistant's onboarding or as they connected it: read it from
43
+ `builder_mapping` or `builder_analyse_database`, as _Connection access_ says.
43
44
  - **An entry answers `error`**: say what it says (an owned instance, the catalog not enabled, a
44
45
  role that cannot read) and stop.
45
46
  - **A database tool answers `unreachable_connection`**: the DMS MCP reaches only the catalog
@@ -53,7 +54,7 @@ Call `database_connections`.
53
54
  `ERP_DATABASE_URL`, and for MongoDB `ERP_DATABASE_NAME`. Ask the integrator for the version of
54
55
  the engine's module to install (`@antelopejs/postgres`, `@antelopejs/mysql` for MySQL and
55
56
  MariaDB alike, `@antelopejs/mongodb`, `@antelopejs/rethinkdb`): you cannot look it up. Ask
56
- the read-or-write question of _Connection access_. The user approves the diff. Safe mode
57
+ the read-or-write question of _Connection access_ when it says to. The user approves the diff. Safe mode
57
58
  refuses `builder_configure_project`: ask the integrator to turn it off for this one call.
58
59
  - Then tell the integrator to put the URL in `.env` (`ERP_DATABASE_URL=postgres://…`,
59
60
  `mysql://…/<database>` for MySQL and MariaDB, `mongodb://…`, or `rethinkdb://…/<database>`;
@@ -112,9 +113,11 @@ profile of the whole database again: the Builder did it.
112
113
  catalog reads types from a sample, and every reference comes from a name and a `CheckReference`,
113
114
  never from the database. An embedded document is one field: its subfields are not mappable, and
114
115
  neither is an array of ids as a relation.
115
- - **Editable.** Every TableView is proposed read-only. Make one editable only where the integrator
116
- wants it and the connection's `access` is `read-write` (_Connection access_); show `writes`
117
- beside it, so a read-only role in this environment is visible.
116
+ - **Editable.** On `read`, every TableView is read-only. On `read-write`, propose each table's
117
+ write actions as **dms-page-design** _Records, forms and links_ decides from its `writes` and
118
+ its shape, and show them in the plan beside `writes` for the integrator to confirm or drop.
119
+ Map the relations that keep a write action `writable: true`. A relation whose `writes` forbids
120
+ the action stays `writable: false`, with the reason shown.
118
121
  - **Pages people can work with.** Load the `dms-page-design` skill. For every TableView, plan
119
122
  from its columns and their profiles (types, traits, distinct counts), as _Name every page_
120
123
  and _Tables_ there say: a title, an icon and a description; the tabs, saved views, display
@@ -248,11 +251,18 @@ database: a mockup, a page built through the builder or in code.
248
251
  `archiveMode`, a draggable kanban, a `ResourceForm` not in `mode: "view"`), and map every
249
252
  relation `writable: false`. A mockup over the connection writes `data`, and the validator
250
253
  refuses those options there ([SPEC.md](../dms-mockup/SPEC.md) _Connection access_).
251
- - **Connecting**: ask "only read, or also change rows?". The connect batch writes
252
- `access: "read"` either way. On read & write, raise it as below once `database_connections`
253
- lists the connection after the restart.
254
+ - **On `read-write`**: propose the write actions of each table, as **dms-page-design** _Records,
255
+ forms and links_ decides, in every flow: a mockup, a page built through the builder or in
256
+ code, with or without dms-assistant.
257
+ - **The access is already chosen** when the connection was made in dms-assistant's onboarding:
258
+ its popup asks "read only" or "read & write" when the pasted account can write, and writes
259
+ the answer as the connection's `access`. Read it from `builder_mapping` or
260
+ `builder_analyse_database`, and never ask again or lower it.
261
+ - **Connecting without that popup** (the MCP alone): ask "only read, or also change rows?". The
262
+ connect batch writes `access: "read"` either way. On read & write, raise it as below once
263
+ `database_connections` lists the connection after the restart.
254
264
  - **The integrator asks for add, edit or delete on a `read` connection**: say the connection is
255
- read-only, and ask for an explicit OK. On yes:
265
+ read-only, and ask for an explicit OK. Propose none unasked. On yes:
256
266
  1. Call `builder_set_connection_access` with
257
267
  `{ "connection": "<id>", "access": "read-write" }`. Its first call answers
258
268
  `confirmation_required` and writes nothing; the same call repeated within 10 minutes runs
@@ -14,7 +14,7 @@ The mockup is done when the user approves it. Building the real pages from it is
14
14
  - **The block catalog.** With the builder MCP (`builder_catalog` among your tools, see **dms-builder-mcp**), `builder_catalog`. Without it, the catalog of the running DMS (`GET /api/block-preview/types`, or the spec schema at `GET /api/mockup/schema`), else the schema file `@antelopejs/dms` ships ([SPEC.md](SPEC.md) _Schema_). The running DMS lists the blocks of the installed modules too; the file lists the core blocks only.
15
15
  - **The preview.** `/mockup?name=<name>` answers while `ajs project dev` runs. When it does not, write and validate the spec all the same, show the user each page as a text outline (one line per block, sketches marked _Custom_), and tell them `ajs project dev` turns it into a live preview.
16
16
  - **Annotations.** When `mockup_annotations` is among your tools, it lists them and `mockup_resolve_annotation` resolves one. Without them, use the HTTP API of the running DMS, else edit `mockups/<name>/annotations.json` directly ([SPEC.md](SPEC.md) _annotations.json_).
17
- - **Writing the spec.** When `mockup_write_spec` and `mockup_patch_spec` are among your tools, every write of the spec goes through them: `mockup_write_spec` creates the mockup (and rewrites it only when the user asks to start over), `mockup_patch_spec` (RFC 6902 operations) makes every other change. Both validate and write `spec.json` only, and Safe mode allows them, as it allows `mockup_resolve_annotation`. Without them, write the file directly.
17
+ - **Writing the spec.** When `mockup_write_spec` and `mockup_patch_spec` are among your tools, every write of the spec goes through them: `mockup_write_spec` creates the mockup (and rewrites it only when the user asks to start over), `mockup_patch_spec` (RFC 6902 operations) makes every other change. Both validate and write `spec.json` only, and Safe mode allows them, as it allows `mockup_resolve_annotation` and `mockup_read_spec`. `mockup_read_spec` (`{ mockup, path? }`, `path` a JSON pointer, the whole spec when left out) is read-only: read only the parts you need with it, and never probe the spec with JSON-patch `test` operations or temporary keys. Without them, write the file directly.
18
18
  - **The asking tool**: `ask_user` in the dms-assistant chat, your harness's question tool elsewhere (`AskUserQuestion` in Claude Code), else one closed question in chat. Batch questions: up to 4 per call.
19
19
 
20
20
  ## 1. Interview
@@ -46,14 +46,14 @@ This step is done when every wish maps to a block, a composition, or a sketch th
46
46
 
47
47
  The user watches the mockup fill in `/mockup?name=<name>`, so write it in small saves, never as one big spec: each save redraws the viewer in under a second, while one call that types the whole spec shows nothing until it ends and, when it fails validation, loses all of it. Follow [SPEC.md](SPEC.md) _Writing in steps_:
48
48
 
49
- 1. **Create it empty.** `mockup_write_spec` with `pages: []`, the `title`, the `categories` that **dms-page-design** _Group pages into sections_ gives the app, and the `source` (`claude-code` in Claude Code, `codex` in Codex, left out when you cannot tell which harness runs you). `<name>` is kebab case, from the app or the area: `crm`, `stock-dashboard`. Over a database, write `data` with the connection and the `access` the proposal answers ([SPEC.md](SPEC.md) _Connection access_). Give the user the link `/mockup?name=<name>` now, before any page exists.
50
- 2. **Add the pages one at a time**, each as a skeleton: one `mockup_patch_spec` with `add` at `/pages/-`, the page with its `category` and all its blocks in reading order, a sub-page right after its parent, each with an `id` and a title, and its data as `$generate` fixtures.
49
+ 1. **Create it empty.** `mockup_write_spec` with `pages: []`, the `title`, the `categories` that **dms-page-design** _Group pages into sections_ gives the app, and the `source` (`claude-code` in Claude Code, `codex` in Codex, left out when you cannot tell which harness runs you). `<name>` is kebab case, from the app or the area: `crm`, `stock-dashboard`. Over a database, write `data` with the connection and the `access` the proposal answers ([SPEC.md](SPEC.md) _Connection access_). Give the user the link `/mockup?name=<name>` now, before any page exists. A mockup of an existing app starts empty too, never from a copy of its pages: it holds only the pages you add or convert, its sidebar shows only those and their sections, and a page with no `category` shows under the default _PAGES_ heading.
50
+ 2. **Add the pages one at a time**, each as a skeleton: one `mockup_patch_spec` with `add` at `/pages/-`, the page with its `category` and all its blocks in reading order, a sub-page right after its parent, each with an `id` and a title, and its data as `$generate` fixtures. **To change an existing page**, call `mockup_from_page` with `{ pageRef, into: "<current mockup>" }` (`pageRef` as `builder_list_pages` lists it): it brings the live page into the mockup at its real section and order, with `livePage`, `liveRoutes` and samples shaped as each block reads them, on real data by default. Then edit it with `mockup_patch_spec`. Never copy an existing page into the spec by hand. It refuses a page already in the mockup unless `replace: true`. Without `into`, `mockup_from_page` makes the page's own single-page mockup, only when the user asks for just that page. It runs only while `ajs project dev` runs. Add a new page at its menu place (`/pages/<i>`, with its `category`), not at the end by default.
51
51
  3. **Fill each page section by section**: 2 or 3 related blocks per patch (the KPI row, then the table, then the form). Never one call per block, never the whole spec in one call.
52
- 4. **Data.** Use `$generate` with the default 8 rows. Write hand values only where a figure must read true: a KPI headline, a total repeated on another page. Date hand-written rows that should look recent in the last 30 days, as `$generate` dates are. Keep entities, names and figures coherent across pages, and over existing resources use the columns and types they declare.
53
- 5. **Tables.** Give each `TableView` its `caption` and every feature **dms-page-design** _Tables_ gives its data, written as [SPEC.md](SPEC.md) _Tables_ says: badges and prices as column `display`, status tabs as `tabsFrom`, the board, cards or groups with the default display, and the saved views. Over a database, write what the proposal holds: a column it draws as a badge is a badge, its relation's `tabs` are `tabsFrom`, a price is a price. The proposal shows how many values a badge draws, never which: write that many items, each a value of the column's fixture, toned as _Tables_ says, or a native enum's labels when the schema declares them.
54
- 6. **Links, sub-pages and forms.** The mockup clicks through like the app: write every detail page, form and link that **dms-page-design** _Records, forms and links_ decides, as [SPEC.md](SPEC.md) _Links and sub-pages_, _Table forms_ and _Archive mode_ say. On a `read` connection the tables write nothing, as **dms-external-database** _Connection access_ says.
52
+ 4. **Data.** Use `$generate` with the default 8 rows. Write hand values only where a figure must read true: a KPI headline, a total repeated on another page. Every block's data, hand-written or generated, sits in the page's `fixtures`, shaped as [SPEC.md](SPEC.md) _Fixture shapes_ says for its block, and the block reads it with `fetchUrl: "fixture:<key>"`: never inline a series or a list of items in a block's options (`staticItems`, `staticDataset`), which nests the payload deep enough to break its JSON, and never dig through `node_modules` for a block's data shape: the table says it. Date hand-written rows that should look recent in the last 30 days, as `$generate` dates are. A `KpiCard` or `ChartCard` fixture gets a `delta` or `previousValue` only on a page with a `PeriodSelector`: the built card shows no change figure elsewhere, so leave them out, or add a `PeriodSelector` when the user wants change figures. Keep entities, names and figures coherent across pages, and over existing resources use the columns and types they declare.
53
+ 5. **Tables.** Give each `TableView` its `caption` and every feature **dms-page-design** _Tables_ gives its data, written as [SPEC.md](SPEC.md) _Tables_ says: badges and prices as column `display` (a rating 1 to 5 is a `badge`, 1 and 2 `error`, 3 `warning`, 4 and 5 `success`, never a cell display), status tabs as `tabsFrom`, the board, cards or groups with the default display, and the saved views. Over a database, write what the proposal holds: a column it draws as a badge is a badge, its relation's `tabs` are `tabsFrom`, a price is a price. The proposal shows how many values a badge draws, never which: write that many items, each a value of the column's fixture, toned as _Tables_ says, or a native enum's labels when the schema declares them.
54
+ 6. **Links, sub-pages and forms.** The mockup clicks through like the app: write every detail page, form and link that **dms-page-design** _Records, forms and links_ decides, as [SPEC.md](SPEC.md) _Links and sub-pages_, _Table forms_ and _Archive mode_ say. On a `read` connection the tables write nothing; on `read-write`, propose each table's add, edit, delete or archive actions as **dms-page-design** _Records, forms and links_ decides from the proposal's `writes`, with the `formContainer` it picks, as **dms-external-database** _Connection access_ says.
55
55
  7. **Sketches.** One per custom part the user chose, kept to that element, as [SPEC.md](SPEC.md) _Sketches_ says. A sketch or a custom page that leads to another page links to it with `<a href="page:<id>">`. Draw each empty, error or loading design the part must handle as a state, so the build handles it too.
56
- 8. **A failed patch** costs only that patch: its `errors` name the nodes. Fix it and send it again, never rewrite the spec.
56
+ 8. **A failed patch** costs only that patch: its `errors` name the nodes. Fix it and send it again, never rewrite the spec. A value refused as not one of an enum's allowed values (the error lists them): pick the closest allowed value yourself, send it, and say in your reply which value you replaced with which (a `refunded` badge tone `pink` becomes `warning`); ask the user only when none is close. A call refused because its input "could not be parsed as JSON" never reached the mockup: never send that payload again as it was. Send the same change as two smaller patches, the page's `fixtures` in one and its blocks in the other, or half its blocks in each.
57
57
 
58
58
  Texts are in the user's language. Without `mockup_write_spec` and `mockup_patch_spec`, edit `spec.json` in the same order, one save per step: the file empty first, then each page, then each section.
59
59
 
@@ -63,7 +63,7 @@ Validate every save: `mockup_write_spec` and `mockup_patch_spec` answer their `e
63
63
 
64
64
  When the user says they commented, or asks what is left, list the open annotations. For each one:
65
65
 
66
- 1. Find the node it is pinned on, and the wish behind it. `mockup_annotations` answers each annotation's block with its JSON pointer and its node: patch from those, and read `spec.json` only for what they do not show. Read the spec with the mockup tools or the file tools, never with a shell command: Safe mode refuses shell commands.
66
+ 1. Find the node it is pinned on, and the wish behind it. `mockup_annotations` answers each annotation's block with its JSON pointer and its node: patch from those, and read only the parts of the spec you still need with `mockup_read_spec`, never the whole file and never by probing with `test` operations or temporary keys. Without it, use the file tools, never a shell command: Safe mode refuses shell commands.
67
67
  2. Change the spec. A request the DMS blocks cannot meet goes through step 2 again, never straight to a sketch.
68
68
  3. Resolve the annotation, and note what changed for the report.
69
69
 
@@ -105,7 +105,7 @@ Fallback with no running DMS: `@antelopejs/dms` ships the same files at `node_mo
105
105
  - `fixtures`: a key (`^[A-Za-z0-9_-]{1,64}$`) to any JSON value, the data the page's blocks read, or to a `$generate` object that the server turns into rows ([Generated fixtures](#generated-fixtures)).
106
106
  - `tree`: the page's blocks, top to bottom, in the `DmsBlockPreview` tree format below.
107
107
  - `menu`, `parent` and `route` (optional, per page): a sub-page, such as a list's detail page, as _Links and sub-pages_ says.
108
- - `livePage` and `liveRoutes` (optional, per page): set when the AI converts a live page into a mockup (`mockup_from_page`), which also fills `icon` and `description` from it, `livePage: { ref, version }` and `liveRoutes` a fixture key to the live route it stands for. **dms-mockup-build** reads them.
108
+ - `livePage` and `liveRoutes` (optional, per page): set when the AI converts a live page into a mockup (`mockup_from_page`, with `into` for an existing mockup), which also fills `icon` and `description` from it, `livePage: { ref, version }` and `liveRoutes` a fixture key to the live route it stands for. A converted page's data blocks read samples shaped as each block reads them, and the viewer draws it on live data by default (the _Real data_ switch picks samples). **dms-mockup-build** reads them.
109
109
  - `source` (optional): what created the spec: `claude-code` or `codex` for the harness, or `chat` for the host's chat. The host can override the value the harness sets.
110
110
  - `built` (optional): written by **dms-mockup-build** after a build, `{ at, pages }`: `at` an ISO date, `pages` one `{ path, title? }` per page built, `path` its dashboard path.
111
111
 
@@ -180,6 +180,7 @@ A `TableView` takes the features **dms-page-design** _Tables_ decides, in the na
180
180
  - **Column `display`**, one of:
181
181
  - a badge, `{ "kind": "badge", "items": [{ "value", "label", "tone" }] }`, on a `string` or `select` column: a `select` column carries its values this way. `tone` is `neutral`, `primary`, `secondary`, `success`, `warning`, `error` or `info`;
182
182
  - a price, `{ "kind": "price", "currency": "EUR" }`, on a `number` column, with an ISO 4217 code;
183
+ - a rating (1 to 5) is a badge, with a tone per value (1 and 2 `error`, 3 `warning`, 4 and 5 `success`), never a cell display;
183
184
  - a cell display, `{ "type", "options"? }`, `type` one of `identity`, `pills`, `relative_date`, `indicator`, `status_pill`, `two_line`, `progress`, `sparkline`, `duration`, `bytes`, `string` and `mono`, such as `{ "type": "identity", "options": { "subtitleField": "email" } }`.
184
185
  - **`tabsFrom`**, `{ "column" }`: "All", then one tab per badge item, in its tone. The column is `filterable` with a badge `display`, and the table has no `tabs`. Hand-written `tabs` colour a tab with `textColor` and `iconColor`; any other key, `color` included, is an issue.
185
186
  - **`kanban`**, `{ "groupByField", "columnMaxHeight"? }`, on a badge, `boolean` or `status` column. Its cards do not move in a mockup.
@@ -485,7 +486,7 @@ A mockup over a connected database names the connection and its access at the to
485
486
  }
486
487
  ```
487
488
 
488
- With `read`, each option that writes rows is an issue at its pointer, and the save is refused: on a `TableView`, `rowActions` `add`, `edit`, `delete`, `archive`, `restore` or `duplicate` turned on, `archiveMode: true` and `kanban.draggable: true`; a `ResourceForm` in any `mode` but `view`. `rowActions.details` and an action at `false` stay allowed. With `read-write`, or no `data`, nothing is restricted. **dms-external-database** _Connection access_ says when the access may change.
489
+ With `read`, each option that writes rows is an issue at its pointer, and the save is refused: on a `TableView`, `rowActions` `add`, `edit`, `delete`, `archive`, `restore` or `duplicate` turned on, `archiveMode: true` and `kanban.draggable: true`; a `ResourceForm` in any `mode` but `view`. `rowActions.details` and an action at `false` stay allowed. With `read-write`, or no `data`, nothing is restricted, and the mockup proposes the write actions that **dms-page-design** _Records, forms and links_ decides from each relation's `writes`. **dms-external-database** _Connection access_ says when the access may change.
489
490
 
490
491
  ## Sketches
491
492
 
@@ -607,21 +608,39 @@ A fixture value `{ "$generate": { "rows"?: number, "fields": { "<key>": <Kind> }
607
608
  }
608
609
  ```
609
610
 
610
- `fixture:orders` then reads 8 rows. A value that must read true (a KPI headline, a total another page repeats) is a plain JSON fixture or a `static*` option. A hand-written date stays as written.
611
+ `fixture:orders` then reads 8 rows. A value that must read true (a KPI headline, a total another page repeats) is a plain JSON fixture, read through `fixture:<key>` like generated rows; keep series and item lists out of `static*` options, so each block's options stay flat. A hand-written date stays as written.
612
+
613
+ ## Fixture shapes
614
+
615
+ A block reads the value of its `fixture:<key>` as written, so the value has the block's own shape. A `KpiCard` or `ChartCard` fixture's `delta` and `previousValue` show on the built page only when it has a `PeriodSelector`: give them only on a page that has one, and leave them out elsewhere. Only a `TableView` reads an array of rows (and so a `$generate` fixture); every other block below reads an object, and an array there draws no data.
616
+
617
+ | Block | Shape of the fixture | Example |
618
+ | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
619
+ | `KpiCard` | `{ value, delta?, previousValue?, sparkline?, caption? }` | `{ "value": 48210, "delta": 12.4, "previousValue": 42900, "sparkline": [5, 6, 8] }` |
620
+ | `ChartCard` (its chart child reads it) | `{ value?, delta?, previousValue?, series, comparisonSeries? }`, `series` a list of `{ name, data }`, never bare `{ x, y }` points; a donut or pie child draws the first series, `x` the slice label | `{ "value": 1512, "series": [{ "name": "Orders", "data": [{ "x": "Web", "y": 928 }, { "x": "Mobile app", "y": 354 }] }] }` |
621
+ | Chart blocks (`ChartArea`, `ChartDonut`, …) on their own, outside a `ChartCard` | `{ series }`: named series, or one `{ x, y }` point per group; a donut or pie reads one series, `x` the slice label | `{ "series": [{ "x": "Paid", "y": 62 }, { "x": "Pending", "y": 25 }, { "x": "Refunded", "y": 13 }] }` |
622
+ | `TopListCard` | `{ items }`, each `{ id, title, value, description?, valueLabel?, delta?, sparkline?, icon?, avatar?, to? }` | `{ "items": [{ "id": "p1", "title": "Pro plan", "value": 320, "description": "Subscriptions" }] }` |
623
+ | `StatGroup` | `{ items }`, each `{ eyebrow, value, detail?, detailTone?, icon?, tone?, to? }` | `{ "items": [{ "eyebrow": "Open orders", "value": 42, "detail": "+5 today", "icon": "i-ph-receipt" }] }` |
624
+ | `TableView` | an array of rows keyed by the column fields, each with an `_id` (or `id`); `$generate` fits | `[{ "_id": "o1", "customer": "Acme", "total": 120, "status": "paid" }]` |
625
+ | `ResourceForm` | one record object keyed by the form's field ids | `{ "customer": "Acme", "total": 120, "status": "paid" }` |
626
+ | `ActivityFeed` | `{ items, count? }`, each `{ title, date?, time?, meta?, detail?, icon?, tone?, unread?, to? }` | `{ "items": [{ "title": "Order paid", "date": "2026-01-06T09:30:00Z", "icon": "i-ph-check" }] }` |
627
+ | `KeyValueList` | `{ items }`, each `{ label, value, type?, detail?, tone?, to?, currency? }` | `{ "items": [{ "label": "Plan", "value": "Pro" }] }` |
628
+ | `NavCardGrid` | `{ items }`, each `{ title, icon, to, description?, state?, stateTone?, tag?, readout? }` | `{ "items": [{ "title": "Orders", "icon": "i-ph-receipt", "to": "page:orders" }] }` |
629
+ | `Meter` | `{ value, max?, segments?, hint?, valueLabel? }` | `{ "value": 7, "max": 10, "hint": "Seats used" }` |
611
630
 
612
631
  ## Writing in steps
613
632
 
614
633
  A mockup is written live, in saves small enough to show a change each. A save redraws the preview in under a second.
615
634
 
616
- 1. Create the mockup empty, with its menu sections when it has them: `mockup_write_spec` with `{ "mockup": "<name>", "spec": { "version": 1, "title": "Order desk", "source": "claude-code", "categories": [{ "id": "sales", "title": "Sales", "icon": "i-ph-storefront" }], "pages": [] } }`. Each page added then names its `category`.
617
- 2. Add a page as a skeleton, its blocks titled and its data generated: `mockup_patch_spec` with `{ "mockup": "<name>", "patch": [{ "op": "add", "path": "/pages/-", "value": { "id": "orders", "title": "Orders", "fixtures": { "orders": { "$generate": { "fields": { "customer": "company", "total": { "money": [40, 900] } } } } }, "tree": [{ "id": "orders-table", "type": "TableView", "options": { "fetchUrl": "fixture:orders", "caption": "Orders", "columns": { "customer": { "name": "Customer", "type": "string" }, "total": { "name": "Total", "type": "number" } } } }] } }] }`.
635
+ 1. Create the mockup empty, an existing app's included, with its menu sections when it has them: `mockup_write_spec` with `{ "mockup": "<name>", "spec": { "version": 1, "title": "Order desk", "source": "claude-code", "categories": [{ "id": "sales", "title": "Sales", "icon": "i-ph-storefront" }], "pages": [] } }`. Each page added then names its `category`.
636
+ 2. To change an existing page, `mockup_from_page` with `{ "pageRef": "/orders", "into": "<name>" }` converts it into the mockup at its real section and order (`replace: true` converts again a page already in it); never copy it by hand. Otherwise add a page as a skeleton, its blocks titled and its data generated: `mockup_patch_spec` with `{ "mockup": "<name>", "patch": [{ "op": "add", "path": "/pages/-", "value": { "id": "orders", "title": "Orders", "fixtures": { "orders": { "$generate": { "fields": { "customer": "company", "total": { "money": [40, 900] } } } } }, "tree": [{ "id": "orders-table", "type": "TableView", "options": { "fetchUrl": "fixture:orders", "caption": "Orders", "columns": { "customer": { "name": "Customer", "type": "string" }, "total": { "name": "Total", "type": "number" } } } }] } }] }`.
618
637
  3. Fill a section: one patch of 2 or 3 operations on the blocks that belong together, `replace` on a node's `options` or `add` at `/pages/<i>/tree/-`, `<i>` the page's index.
619
638
 
620
- A patch applies whole or not at all: a failed one leaves the spec as it was, so fix it and send it again. After an `add` or `remove` that shifts a node, re-read the pointers you still use.
639
+ A patch applies whole or not at all: a failed one leaves the spec as it was, so fix it and send it again. An input refused as not parseable JSON never reached the mockup: split it into two smaller patches instead of sending it again. After an `add` or `remove` that shifts a node, re-read the pointers you still use with `mockup_read_spec` (`{ "mockup": "<name>", "path": "/pages/0/tree" }`), never with a `test` operation or a temporary key.
621
640
 
622
641
  ## Validation
623
642
 
624
- `mockup_write_spec` with `{ "mockup": "<name>", "spec": { … } }`, or `mockup_patch_spec` with `{ "mockup": "<name>", "patch": [ RFC 6902 operations ] }`, validates the resulting spec, writes `spec.json` when it holds, and answers `{ ok, errors }`, each error `{ path, message }`. A refused spec answers `ok: false`; a bad name, a failed patch operation or a missing target answers a tool error. Nothing is written in either case. Without that tool, `GET /api/mockup/<name>` answers the compiled state: `pages`, a `revision` that grows on each good read, and `issues`, each `{ path, message }` with `path` a JSON pointer into `spec.json` (`/pages/0/tree/1/children/0/options/title`). The spec validates when `issues` is empty. A node with bad options still draws what it can, so a page that looks right can still hold issues: read them.
643
+ `mockup_write_spec` with `{ "mockup": "<name>", "spec": { … } }`, or `mockup_patch_spec` with `{ "mockup": "<name>", "patch": [ RFC 6902 operations ] }`, validates the resulting spec, writes `spec.json` when it holds, and answers `{ ok, errors }`, each error `{ path, message }`. A refused spec answers `ok: false`; a bad name, a failed patch operation or a missing target answers a tool error. Nothing is written in either case. Without that tool, `GET /api/mockup/<name>` answers the compiled state: `pages`, a `revision` that grows on each good read, and `issues`, each `{ path, message }` with `path` a JSON pointer into `spec.json` (`/pages/0/tree/1/children/0/options/title`). The spec validates when `issues` is empty. A node with bad options still draws what it can, so a page that looks right can still hold issues: read them. An issue that names a value outside an enum's allowed values lists them: use the closest one, say so in your reply (a badge tone `pink` becomes `warning`), and ask the user only when none is close.
625
644
 
626
645
  ## The preview
627
646
 
@@ -17,16 +17,17 @@ The spec is the contract: the pages it lists, their blocks in its order, their o
17
17
 
18
18
  ## 1. Read the mockup
19
19
 
20
- Read `mockups/<name>/spec.json` and its open annotations ([SPEC.md](../dms-mockup/SPEC.md) _annotations.json_). An open annotation is a change the user still wants: ask whether to apply it first with **dms-mockup**, or to build the spec as it stands.
20
+ Read the spec with `mockup_read_spec` (`{ mockup, path? }`, read-only, allowed in Safe mode; `path` a JSON pointer, the whole spec when left out), else `mockups/<name>/spec.json` with the file tools. After this first read, read only the parts you need, and never probe the spec with JSON-patch `test` operations or temporary keys. Read its open annotations ([SPEC.md](../dms-mockup/SPEC.md) _annotations.json_). An open annotation is a change the user still wants: ask whether to apply it first with **dms-mockup**, or to build the spec as it stands.
21
21
 
22
22
  ## 2. Plan
23
23
 
24
24
  Map every spec page and node, and present the plan before you write:
25
25
 
26
26
  - **Converted page:** a spec page with `livePage: { ref, version }` was converted from the live page at `livePage.ref` (a route). Read that page with `builder_page_structure` (without the builder MCP, its page class) and plan the changes that turn it into the spec page (blocks to configure, move, remove or add), not a new `PageController`; its fixtures whose key is in the spec page's `liveRoutes` keep reading those live routes (_Live route_ below). A **live sketch**, a Custom sketch whose `id` names a block of the live page, stands for code the conversion could not express: keep that block as it is, with no component to write and no Safe mode question. Check its version first, as _Pages converted from a live page_ says: a stale page goes in the plan as stopped, with no changes. With `mockup_apply_to_page` among your tools, the plan still lists every change and says that the tool writes the page first, and that you build only the changes its `wiring` answer lists.
27
+ - **New page** (no `livePage`): built as a new page, below. A converted page (`livePage`) is built into its live page, never as a new page.
27
28
  - **Page** → a `PageController` (with `RegisterPage`, from `@antelopejs/interface-dms/page`): `id`, title, `icon` and `description` from the spec page (pass `icon` and `description` to `builder_create_page`; when the spec page has none, choose them as **dms-page-design** _Name every page_ says), and the category its `category` names.
28
29
  - **Sub-page** (`parent`) → a page registered under its parent's route, its `route` as the parameter (`urlSlug: "orders/:id"`), with `parent` naming the parent's page class, in the parent's category; `menu: false` → `hidden: true`, left out of the menu. The builder writes neither a route parameter nor a `parent`: write the page class with **dms-pages**, then build its blocks as any page's. A `fixture:<key>` on it that reads an ancestor's rows reads the one record its parameter names (`{{params.id}}`).
29
- - **Sections** (`categories`) → one category per section, in the spec's order, its `name` the section's `id`, its `displayName`, `icon` and `order` from the spec: `builder_create_category` with the pages' `module`, or `Category(id, options)` with **dms-pages**. A section whose `title` is an existing category's (`builder_list_pages`), case and spaces aside, is that category: its pages go there and no category is created. A page with no `category` goes in the category the project's pages use already. A spec of 6 or more pages with no `categories` gets the sections **dms-page-design** _Group pages into sections_ gives it, listed in the plan.
30
+ - **Sections** (`categories`) → one sidebar section per mockup category, in the spec's order, its `name` the section's `id`, its `displayName`, `icon` and `order` from the spec: `builder_create_category` with `section: true` (and the pages' `module`), never a plain category, which loses the section; without the builder, a `RootCategory(id, { displayName, icon, order, type: "label" })` with **dms-pages**. A section whose `title` is an existing category's (`builder_list_pages`), case and spaces aside, is that category: its pages go there and no category is created. A page with no `category` goes in the category the project's pages use already. A spec of 6 or more pages with no `categories` gets the sections **dms-page-design** _Group pages into sections_ gives it, listed in the plan.
30
31
  - **Dashboard:** a build over a database always builds the dashboard **dms-page-design** _The analytics dashboard_ requires, from the spec's dashboard page, each KPI card and chart bound to a query over a mapped relation. A spec over a database with no dashboard gets one in the plan, laid out as that skill says.
31
32
  - **Header buttons** (`headerActions` of the spec page) → `DefaultLayout({ headerActions: [...] })` in the page TypeScript, each button's `label`, `icon`, `color` and `variant` from the spec plus a real `target` (a page link, a quick action, a drawer or an API call): the builder cannot write a page's layout. A target the spec and the conversation do not settle is a question for the user; never invent one. On a converted page, `mockup_apply_to_page` writes `title`, `icon` and `description` itself and lists the header buttons as a `wiring` entry (`reason: "header-actions"`); keep the live page's `hideHeader` as it is.
32
33
  - **Block** → the same `type` and options. Keep each child's `id` as the block's name; a child whose `id` names a block option (a `ChartCard`'s `chart`) becomes that option.
@@ -37,10 +38,10 @@ Map every spec page and node, and present the plan before you write:
37
38
  2. rows of one entity (a `$generate` fixture is one: its `fields` are the entity's fields): a new resource (`builder_create_resource`), its fields and types read from the fixture's rows or its `fields`, seeded with those rows only when the user wants sample data;
38
39
  3. a figure, a series or a ranking: a query on that resource (`builder_add_query`) whose `response` matches the block, as **dms-builder-mcp** _Data resources and queries_ says.
39
40
  A fixture none of these can serve goes in the plan as a question.
40
- - **`TableView` over a fixture** → a `TableView` bound to the resource (`controller` = its ref), its columns from the spec's `columns`, with every badge, price, tab, board, card and view the mockup shows. A table over a relation of a connected database is mapped with `builder_map_resources`, as **dms-external-database** _Apply_ says: leave out each badge the Builder proposes (it writes the real values and tones, where the spec's items are fixture values), send a price with its `currency`, and turn `tabsFrom` into the resource's `tabs` and the board, groups, cards, `defaultDisplay` and `views` into `tableOptions`, renamed as [SPEC.md](../dms-mockup/SPEC.md) _Tables_ says, with its section's ref as `category` and the spec page's `title`. Another table takes the spec's displays as they are, its board and views through `builder_configure_table_view`. A colour or display the builder cannot write (a badge the Builder does not propose over a column with no native enum, a cell display, a `mobileDisplay`) is a question in the plan, never dropped.
41
+ - **`TableView` over a fixture** → a `TableView` bound to the resource (`controller` = its ref), its columns from the spec's `columns`, with every badge, price, tab, board, card and view the mockup shows. A table over a relation of a connected database is mapped with `builder_map_resources`, as **dms-external-database** _Apply_ says: leave out each badge the Builder proposes (it writes the real values and tones, where the spec's items are fixture values), send a price with its `currency`, and turn `tabsFrom` into the resource's `tabs` and the board, groups, cards, `defaultDisplay` and `views` into `tableOptions`, renamed as [SPEC.md](../dms-mockup/SPEC.md) _Tables_ says, with its section's ref as `category` and the spec page's `title`. Another table takes the spec's displays as they are, its board and views through `builder_configure_table_view`. A colour or display the builder cannot write (a badge the Builder does not propose over a column with no native enum, a `mobileDisplay`) is a question in the plan, never dropped. Build a column's cell display (`display: { type, options }` such as `mono`, `two_line`, `identity`), `group`, `isVisible`, `size` and `cellWrap` through the builder in Safe mode too: in `builder_map_resources` `fields` at mapping time, else `builder_configure_field` (or `builder_add_field`, `builder_create_resource` `fields`), as **dms-builder-mcp** _Column presentation_ says. Build the spec's `columnGroups` with `builder_configure_column_groups`. A rating stays a badge, never a cell display. An `invalid_config` or `relation_skipped` on a display is a question in the plan, never dropped.
41
42
  - **Table forms** (`rowActions`, `formContainer`) → the same actions on the real table, and `false` for each of `add`, `edit` and `details` the spec leaves out: the real `TableView` turns an absent one on. A table with no `formContainer` showed a modal: write `{ "type": "modal" }`, as **dms-page-design** _Records, forms and links_ says. `modal` and `drawer` stay as written, `size` and `direction` included, `details: true` in them being the table's own read-only details view, with no page to build. With `page`, each `urlSlug: "page:<id>"` becomes that page's slug relative to the table's page (`new`, `:id/edit`, `:id`), `customPage: true` kept, and the form page is a _Sub-page_ registered at that slug (`orders/new`). The add and edit forms save through the table's data controller. Write them with `builder_configure_block` on the table, or in the page class.
42
43
  - **Archive mode** (`archiveMode`, `archivedCountLabel`) → the same options on the real table, its resource's archive field `isArchived` (`@ArchiveField`).
43
- - **Connection** (`data`) → the spec's `access` checked against the one `builder_mapping` answers for its `connection`. A spec at `read-write` over a `read` connection goes in the plan as a question, as **dms-external-database** _Connection access_ says; build no write action before it is settled.
44
+ - **Connection** (`data`) → the spec's `access` checked against the one `builder_mapping` answers for its `connection`. A spec at `read-write` over a `read` connection goes in the plan as a question, as **dms-external-database** _Connection access_ says; build no write action before it is settled. At `read-write`, the table's actions the spec draws are built on relations mapped `writable: true`, as **dms-external-database** _Editable_ says; one whose `writes` forbids an action the spec draws goes in the plan as a question.
44
45
  - **`ResourceForm` over a fixture** → a `ResourceForm` on the resource, with the spec's fields and `mode` (`view` on a details page, read-only).
45
46
  - **Sketch** → a `CustomComponent` (from `@antelopejs/interface-dms/base/custom`) with `.meta({ name, description, icon })`, its Vue drawn from the sketch's HTML and CSS with the DMS UI components and theme variables, its data from a route. It draws every one of the sketch's `states` where the page meets it (no rows, a failed request, loading) and the default `html` where the data is there; each `<a href="page:<id>">` is a link to that page's real route (_Page link_). In Safe mode this is out of reach: ask whether to turn Safe mode off for these components, or to leave each one as a `Placeholder` named after its caption.
46
47
  - **Custom page** (`custom: true`) → a _Page_ built as **dms-best-practices** _Custom pages are blocks_ says: split the page's `html` into its parts, each a block, and only a part no block draws a `CustomComponent`, built from its markup, `css` and `states` as a _Sketch_ is. Its title, icon, description and header buttons are the page's own. Safe mode as for a _Sketch_, each such part a `Placeholder` named after it.
@@ -95,7 +96,7 @@ Without the tool, write the page yourself. An existing block whose fixture key i
95
96
 
96
97
  Every write of yours to a converted page, a `wiring` entry included, updates the page at `livePage.ref`, never another: no `builder_create_page`. Move a live sketch's neighbours around it, never the block itself. A builder tool's `stale` answer (your read of the structure is outdated): read the page again with `builder_page_structure` and retry. A builder tool's `not_found` answer for the page: ask the user; never create it.
97
98
 
98
- After the last round of step 4, stamp each converted page you wrote yourself (a `wiring` entry, a fix, or the whole page without the tool) with its new version; a page only `mockup_apply_to_page` wrote, answering `stamped: true`, keeps the tool's stamp. Read the version with a fresh `builder_page_structure` and write it with `mockup_patch_spec`: `{ "mockup": "<name>", "patch": [{ "op": "replace", "path": "/pages/<i>/livePage/version", "value": "<version>" }] }`, `<i>` the page's index in the spec. Without `mockup_patch_spec`, set that field in `spec.json`. Without the builder MCP, stamp nothing.
99
+ After the last round of step 4, stamp each converted page you wrote yourself (a `wiring` entry, a fix, or the whole page without the tool) with its new version; a page only `mockup_apply_to_page` wrote, answering `stamped: true`, keeps the tool's stamp. Read the version with a fresh `builder_page_structure` and write it with `mockup_patch_spec`: `{ "mockup": "<name>", "patch": [{ "op": "replace", "path": "/pages/<i>/livePage/version", "value": "<version>" }] }`, `<i>` the page's index in the spec. Without `mockup_patch_spec`, set that field in `spec.json`. Without the builder MCP, stamp nothing. A patch refused for a value outside an enum's allowed values: pick the closest allowed value the error lists, send it, and mention the substitution in your report; ask the user only when none is close.
99
100
 
100
101
  ## 4. Verify and fix
101
102
 
@@ -144,7 +144,7 @@ A page that belongs in a section the project has already goes there: in a mockup
144
144
  that exact title, which the viewer draws as the app's own.
145
145
 
146
146
  A section is a menu category: `builder_create_category` (`name`, `displayName`, `icon`,
147
- `order`, `module`) answers its `ref`, which `builder_create_page` takes as `category`,
147
+ `order`, `module`, and `section: true` for a sidebar section, a `RootCategory`) answers its `ref`, which `builder_create_page` takes as `category`,
148
148
  `builder_map_resources` per resource as `category` (create the section first, in the tables'
149
149
  `module`), and `builder_configure_page` in `{ "category": "<ref>" }` to move a page there.
150
150
 
@@ -178,6 +178,7 @@ with none, send `"display": null`, which leaves it a number. A relation
178
178
  column (a `customer_id`, an `order_id`) is titled by its target ("Customer") and shows the
179
179
  target's label, never the raw number: map the target relation with a label first, then send
180
180
  the relation column as a relation. Raw id columns stay off the list. A `display` you do send, and the relation's `tabs`, go in `builder_map_resources`.
181
+ A cell display (`mono`, `two_line`, `identity`, `progress`...), `group`, `isVisible`, `size` and `cellWrap` go in the same `fields`, else `builder_configure_field`: no code needed, Safe mode included.
181
182
 
182
183
  **Tabs.** A single-choice column with 2 to 6 values that splits the rows into states people
183
184
  work through (a status, a stage) gives tabs when the column is drawn as a badge, by the
@@ -219,11 +220,11 @@ that number is what the reader checks ("Refunded"). Never sum a unit price, a ra
219
220
  amount, rows waiting, a share of a status, the last two over a native enum label), put a `GridRow` of 3 or 4 `KpiCard`s above the
220
221
  `TableView`, each answering one question the table's reader asks ("Revenue this month",
221
222
  "Awaiting shipment", "Refund rate"), with the series and `compare` rules above. A lookup list
222
- (a reference table, tags, settings) gets none.
223
+ (a reference table, tags, settings) gets none. A card's change figure (`delta`, `previousValue`) shows only on a page with a `PeriodSelector`: on a table page without one the card shows no change figure; add a `PeriodSelector` only when the user wants change figures.
223
224
 
224
225
  Set displays, views and footer per resource as `tableOptions` in `builder_map_resources`, or on
225
226
  an existing page with `builder_configure_table_view`. Through `builder_configure_table_view`
226
- a refused choice comes back as `invalid_config` with the setting it names: fix that one and
227
+ a refused choice comes back as `invalid_config` with the setting it names (for an enum value, the allowed ones: take the closest yourself and mention it in your reply, as **dms-builder-mcp** _Errors_ says): fix that one and
227
228
  send again. Through `builder_map_resources` it comes back as a `page_not_written` warning.
228
229
 
229
230
  ## Records, forms and links
@@ -267,12 +268,29 @@ An app clicks through: from a figure to its rows, from a row to its record, and
267
268
  sub-page of the list, left out of the menu, that opens on a click on its row, built as
268
269
  **dms-best-practices** _Custom pages are blocks_ says.
269
270
  - **Turn on only the actions the reader takes.** A connected database's table writes only on a
270
- `read-write` connection, as **dms-external-database** _Connection access_ says.
271
- - **Archive in place of delete** when records must not be erased (invoices, orders, people):
271
+ `read-write` connection, as **dms-external-database** _Connection access_ says. On one,
272
+ propose each table's write actions from its `writes` and its shape, and the integrator
273
+ confirms them in the plan:
274
+ - **Transactions are never erased.** Sales, orders and their lines, invoices, credit notes,
275
+ refunds, stock movements: no delete and no archive, whatever `writes` allows. Add and edit
276
+ where `writes` allows them and the reader records them by hand (an order's status, a
277
+ note).
278
+ - **Logs stay read-only.** Payments, log, event, history and audit tables: no write action.
279
+ - **Entities and lookups** (customers, products, categories, tags) get add and edit where
280
+ `writes.insert` and `writes.update` allow them.
281
+ - **Delete only a row nothing depends on**: where `writes.delete` allows it and no other
282
+ table references this one through a foreign key (an incoming relation in the analysis or
283
+ in `database_describe`). A referenced table gets no delete; it gets the archive below
284
+ when it has an archive column, and neither otherwise.
285
+ - An action `writes` forbids is not proposed; the plan says which and why, and why a table
286
+ gets no delete or archive.
287
+ - **Archive in place of delete** when records must not be erased but may leave the lists
288
+ (people, products, a referenced lookup), never on a transaction:
272
289
  `archiveMode: true` on the `TableView` gives Archive and Restore: archive, edit and duplicate
273
290
  on active rows, restore and delete on archived ones, behind a _Show archived_ toggle. The
274
291
  archive field is `isArchived` (`@ArchiveField` in code). Only on a table that writes rows, so
275
- over a connected database only with `read-write` access.
292
+ over a connected database only on `read-write`, and only where the table has an archive
293
+ column (`archived`, `is_archived`, `archived_at`). A table with none gets no archive.
276
294
  - **Link pages together.** Every summary links to what it summarises: a KPI or a card to the
277
295
  table it counts, a dashboard tile to its page, a detail page back to its list, a toolbar
278
296
  button to the page it opens. `KpiCard` takes no link: a figure that links is a `StatGroup`
@@ -31,7 +31,7 @@ export class RecipesPage extends PageController("recipes", {
31
31
  }) {}
32
32
  ```
33
33
 
34
- `options` is the `MenuOptions` shape: `displayName`, `icon`, `module` and/or `category` (at least one; a module page's explicit category descends from the module's root), `urlSlug` (defaults to the id), `order`, `description`, `hidden`, `type`, plus auth options (`publicAccess`, `authOnly`, `memberAccess`, `permission`, `noComponentPermissions`, `ownerOnly`; see **dms-auth**). `ownerOnly: true` opens the page to the platform owner only, as on a module page: no role can be granted it, and the Roles editor does not list it. `Category(id, options)` returns a `CategoryInfo` for a page's `category`; `RegisterModule({ id, … })` creates a module root that pages join with `module: "<id>"`. Module pages live under `/modules/<moduleId>/<urlSlug>` and are **owner-only by design**: a screen for regular users goes under `pagesCategory` or a normal `Category`.
34
+ `options` is the `MenuOptions` shape: `displayName`, `icon`, `module` and/or `category` (at least one; a module page's explicit category descends from the module's root), `urlSlug` (defaults to the id), `order`, `description`, `hidden`, `type`, plus auth options (`publicAccess`, `authOnly`, `memberAccess`, `permission`, `noComponentPermissions`, `ownerOnly`; see **dms-auth**). `ownerOnly: true` opens the page to the platform owner only, as on a module page: no role can be granted it, and the Roles editor does not list it. `Category(id, options)` returns a `CategoryInfo` for a page's `category`; `RootCategory(id, { displayName, icon, order, type: "label" })` returns one for a sidebar section, a heading of its own beside Pages, Modules and Settings (`pages`, `modules` and `settings` are reserved ids); `RegisterModule({ id, … })` creates a module root that pages join with `module: "<id>"`. Module pages live under `/modules/<moduleId>/<urlSlug>` and are **owner-only by design**: a screen for regular users goes under `pagesCategory` or a normal `Category`.
35
35
 
36
36
  ## Composing blocks
37
37