@antelopejs/agent-skills 0.3.2 → 0.8.1
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 +7 -8
- package/skills/dms-best-practices/SKILL.md +29 -2
- package/skills/dms-builder-mcp/SKILL.md +3 -2
- package/skills/dms-external-database/REFERENCE.md +40 -1
- package/skills/dms-external-database/SKILL.md +76 -25
- package/skills/dms-mockup/SKILL.md +20 -13
- package/skills/dms-mockup/SPEC.md +514 -7
- package/skills/dms-mockup-build/SKILL.md +23 -11
- package/skills/dms-page-design/SKILL.md +96 -3
- package/skills/dms-pages/SKILL.md +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/agent-skills",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
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",
|
|
@@ -40,12 +40,6 @@
|
|
|
40
40
|
"provenance": true,
|
|
41
41
|
"registry": "https://registry.npmjs.org/"
|
|
42
42
|
},
|
|
43
|
-
"scripts": {
|
|
44
|
-
"typecheck": "tsc -p .",
|
|
45
|
-
"prepack": "node scripts/pack-skills.mjs",
|
|
46
|
-
"postpack": "node scripts/pack-skills.mjs --clean",
|
|
47
|
-
"release": "release-it"
|
|
48
|
-
},
|
|
49
43
|
"devDependencies": {
|
|
50
44
|
"@types/node": "^24.0.0",
|
|
51
45
|
"release-it": "^19.2.4",
|
|
@@ -54,5 +48,10 @@
|
|
|
54
48
|
},
|
|
55
49
|
"engines": {
|
|
56
50
|
"node": ">=20.19"
|
|
51
|
+
},
|
|
52
|
+
"gitHead": "801fced56cd007ab9cacd89dc7d1f7dde74d7383",
|
|
53
|
+
"scripts": {
|
|
54
|
+
"typecheck": "tsc -p .",
|
|
55
|
+
"release": "release-it"
|
|
57
56
|
}
|
|
58
|
-
}
|
|
57
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dms-best-practices
|
|
3
|
-
description: Enforces the rules for building AntelopeJS DMS pages (every page a tree of DMS blocks, custom code only for the missing block, `.meta()` on every custom block), decides when to leave DMS blocks and proposes that deviation to the user, and runs the design-fidelity protocol. Use when creating or changing any DMS page, dashboard or screen, before writing a CustomComponent or Vue for one, or when the user provides a design, mockup, Figma frame or screenshot to reproduce.
|
|
3
|
+
description: Enforces the rules for building AntelopeJS DMS pages (every page a tree of DMS blocks, custom code only for the missing block, `.meta()` on every custom block), finds the DMS module or block feature a need already has before anything is built (mails, tenants and SaaS, translated fields, archiving) and proposes installing a missing module, decides when to leave DMS blocks and proposes that deviation to the user, and runs the design-fidelity protocol. Use when creating or changing any DMS page, dashboard or screen, before building a feature or business logic in a DMS project (sending an email, tenants or subscriptions, translatable fields, archiving rows), before writing a CustomComponent or Vue for one, or when the user provides a design, mockup, Figma frame or screenshot to reproduce. Not for a question about one block option or DataType (dms-pages).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# DMS best practices
|
|
@@ -13,10 +13,31 @@ Three facts about the project change the steps below. **dms-builder-mcp** _Detec
|
|
|
13
13
|
- **Safe mode** is on (the builder tools are the only way to write), or not.
|
|
14
14
|
- **The asking tool**: `ask_user` in the dms-assistant chat, your harness's question tool elsewhere, else one closed question in chat.
|
|
15
15
|
|
|
16
|
+
## Before you build
|
|
17
|
+
|
|
18
|
+
Run this before any feature, a page or business logic alike. Most needs already have a DMS module or a block feature, and a home-made copy loses its admin pages, permissions and upgrades.
|
|
19
|
+
|
|
20
|
+
1. **List what the project has**: the `@antelopejs/*` dependencies of `package.json`, the modules of `antelope.config.*`, and the synced skills (**skills**). A table is `@RegisterTable("<table>", "<schema>") class X extends Table` with `@Field("<type>") declare <name>: <T>` fields and an inherited `_id` (no primary-key decorator), read and written through `GetModel(BasicDataModel(X))`. From `@antelopejs/interface-database-decorators`: `Table` and `Field` from `/table`, `RegisterTable` from `/schema`, `GetModel` and `BasicDataModel` from `/model`. **database-decorators-interface** has the rest.
|
|
21
|
+
2. **Match the need.** The table holds the needs most often rebuilt. For any other, the module catalog is the resolver's `list` (**interface**): each `dms-*` interface there is a module's contract.
|
|
22
|
+
|
|
23
|
+
| Need | Use |
|
|
24
|
+
| -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
25
|
+
| An email, its template, its sends | `@antelopejs/dms-mailing`: a mail is a template, sent with `SendTemplate` and shipped with `DeclareTemplate` (`@antelopejs/interface-dms-mailing`) |
|
|
26
|
+
| Tenants, workspaces, SaaS, plans, subscriptions, billing | `@antelopejs/dms-saas` |
|
|
27
|
+
| An image or file on a record | `@antelopejs/dms-media` (`AssetType`) |
|
|
28
|
+
| A procedure run on a schedule, a webhook or a data event | `@antelopejs/dms-automation` |
|
|
29
|
+
| Translated interface texts, translations for another app | `@antelopejs/dms-lang` |
|
|
30
|
+
| A field in several languages | `@Localized()` on a field of a `Table.with(LocalizationModifier)` (`@antelopejs/interface-database-decorators/modifiers/localization`); the DMS form edits each locale |
|
|
31
|
+
| Archive and restore rows instead of deleting them | `@ArchiveField()` on a `@Field("boolean")` of the `Table`, and `TableViewRoutes.Archive` / `Restore`: both from `@antelopejs/interface-dms/base`, not the decorators |
|
|
32
|
+
| Status tabs, saved views, kanban, footer totals | `TableView` options (**dms-page-design**) |
|
|
33
|
+
|
|
34
|
+
3. **Installed**: load that module's skill, or its contract through **interface**, and build on it. **Absent**: never build a copy. Open with one question, asked with the asking tool, whether you may install it, and show no code or command before it. On yes, run `ajs project modules add @antelopejs/<module>` and build on it.
|
|
35
|
+
4. **Before adding a field, column, route or custom code to a block**, read what the block already offers: `builder_catalog` with the builder MCP, else the block's TSDoc through **interface**: `contract dms base/<block>` (`base/table-view`) lists what it re-exports from each file, and `contract dms base/<block>/<file>` (`base/table-view/meta`, `base/table-view/routes`) prints that file.
|
|
36
|
+
|
|
16
37
|
## The rules
|
|
17
38
|
|
|
18
39
|
1. **A page is always blocks.** Describe every page on the backend as a tree of DMS blocks: `PeriodSelector`, `Grid` / `GridRow`, `KpiCard`, `TableView`, `Form`, … Each static field and each `.child()` is a line in the roles editor, a `.watch()` target, a `periodScope` subscriber and a node the builder can move. One block that draws the whole screen loses all of that.
|
|
19
|
-
2. **Custom = the missing block only.** When a part has no DMS equivalent, build **that block** as a `CustomComponent` and keep everything around it (toolbar, filters, stats, tables) as DMS blocks on the backend.
|
|
40
|
+
2. **Custom = the missing block only.** When a part has no DMS equivalent, build **that block** as a `CustomComponent` and keep everything around it (toolbar, filters, stats, tables) as DMS blocks on the backend. A whole custom page too, as _Custom pages are blocks_ says.
|
|
20
41
|
3. **Every custom block carries `.meta()`.** `.meta({ name, description, icon })` in its backend declaration, `name` and `description` as `$` i18n keys added to every locale file. Without it the roles editor shows the raw component name. Every other text (page names, titles, labels) is a `$` key too.
|
|
21
42
|
|
|
22
43
|
```ts
|
|
@@ -45,6 +66,12 @@ A custom block is a deviation, and you **propose** it: the user decides, after t
|
|
|
45
66
|
| The user asked for pixel perfect on **this** element | Another element of the page is custom: a custom block never pulls its neighbours along |
|
|
46
67
|
| A measured constraint (performance, data volume) the block cannot meet | The constraint is a guess, not a measurement |
|
|
47
68
|
|
|
69
|
+
## Custom pages are blocks
|
|
70
|
+
|
|
71
|
+
A **custom page** is a page the user designs rather than one a table generates: a mockup's `custom: true` sketch ([SPEC.md](../dms-mockup/SPEC.md) _Custom pages_) or a custom page asked for directly. Build it as a tree of DMS blocks (`TableView`, `KpiCard` / `StatGroup`, `Card`, `ResourceForm`, a `ChartCard`, …), and only the parts no block draws as `CustomComponent`s, each through the path below, with its `.meta()` and a permissioned `.action()` per action it takes. A page whose one block is a full-page `CustomComponent` is never the result.
|
|
72
|
+
|
|
73
|
+
An order details page, say, becomes a header with a status badge, a `TableView` of the items with a totals row (`footer.summary`), and `Card`s for the customer and the shipping. Only a timeline, when no block draws it, is a `CustomComponent`.
|
|
74
|
+
|
|
48
75
|
## Before any custom block
|
|
49
76
|
|
|
50
77
|
Run this path before writing a `CustomComponent` or its Vue, one element at a time:
|
|
@@ -7,7 +7,7 @@ description: Drives the AntelopeJS DMS builder MCP tools (builder_catalog, build
|
|
|
7
7
|
|
|
8
8
|
The DMS builder edits the project's own TypeScript: a page is a `PageController` class, a block a static field or `.child()` call, a resource a `Table` + `DataController` + model. Every builder operation is **atomic and typecheck-gated**: on success it returns the file changes; on `typecheck_failed` nothing is written.
|
|
9
9
|
|
|
10
|
-
Load **dms-best-practices** first and follow it: it decides what a page is made of and runs the design-fidelity protocol. This skill covers driving the builder tools.
|
|
10
|
+
Load **dms-best-practices** first and follow it: it decides what a page is made of and runs the design-fidelity protocol. A data page follows **dms-page-design**, which also picks where each table's details and forms open. This skill covers driving the builder tools.
|
|
11
11
|
|
|
12
12
|
## Detect what the project has
|
|
13
13
|
|
|
@@ -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 and
|
|
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.
|
|
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.
|
|
@@ -63,6 +63,7 @@ On the code path, edit the theme yourself in the `app/app.config.ts` of the proj
|
|
|
63
63
|
## Errors
|
|
64
64
|
|
|
65
65
|
- `typecheck_failed`: read `diagnostics`, fix the `config` or `type`, retry. Nothing was written.
|
|
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_.
|
|
66
67
|
- `invalid_config`, `duplicate_name`, `not_found`: fix the input.
|
|
67
68
|
- `stale`: the page changed under you; read it again with `builder_page_structure` and retry.
|
|
68
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.
|
|
@@ -60,6 +60,29 @@ integrator gave you:
|
|
|
60
60
|
}
|
|
61
61
|
]
|
|
62
62
|
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"op": "ConfigureModule",
|
|
66
|
+
"id": "dms-database",
|
|
67
|
+
"entry": {
|
|
68
|
+
"importOverrides": [
|
|
69
|
+
{
|
|
70
|
+
"interface": "@antelopejs/interface-database",
|
|
71
|
+
"source": "<project database module>"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"interface": "@antelopejs/interface-database",
|
|
75
|
+
"source": "postgres-erp",
|
|
76
|
+
"id": "erp"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"interface": "@antelopejs/interface-database-catalog",
|
|
80
|
+
"source": "postgres-erp",
|
|
81
|
+
"id": "erp"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"config": { "externalConnections": { "erp": { "access": "read" } } }
|
|
85
|
+
}
|
|
63
86
|
}
|
|
64
87
|
]
|
|
65
88
|
}
|
|
@@ -84,6 +107,11 @@ integrator gave you:
|
|
|
84
107
|
provided it before this call. When an `environments` entry of the configuration sets an
|
|
85
108
|
`exportPriority`, or a provider's priority is not a plain number, stop and ask the integrator
|
|
86
109
|
which module the DMS uses.
|
|
110
|
+
- **Step 5** registers the connection with `dms-database`, the module whose Data browser and
|
|
111
|
+
write routes read its access, under the same id, after the project's own database. `access` is
|
|
112
|
+
always `"read"`: `builder_configure_project` refuses to raise one, and SKILL.md _Connection
|
|
113
|
+
access_ raises it afterwards. Leave the step out when the project has no `dms-database`
|
|
114
|
+
module.
|
|
87
115
|
|
|
88
116
|
For MySQL, MariaDB, MongoDB and RethinkDB, step 1 changes, and the other steps name its id in
|
|
89
117
|
place of `postgres-erp`.
|
|
@@ -251,7 +279,7 @@ erp · postgresql 17.5 · role erp_reader (read only) · 42 relations: 9 TableVi
|
|
|
251
279
|
|
|
252
280
|
## Analytics pages
|
|
253
281
|
|
|
254
|
-
### Sales (sales.orders)
|
|
282
|
+
### Sales (sales.orders): the dashboard, first in the menu, outside the sections
|
|
255
283
|
|
|
256
284
|
- Period: by ordered_at, default last-90-days vs previous-period; presets last-30-days, last-90-days, ytd, last-year, custom
|
|
257
285
|
- Toolbar: PageToolbar › PeriodSelector
|
|
@@ -261,6 +289,12 @@ erp · postgresql 17.5 · role erp_reader (read only) · 42 relations: 9 TableVi
|
|
|
261
289
|
- ChartCard › ChartBar: top 10 countries by revenue
|
|
262
290
|
- TopListCard: top 10 cities by orders
|
|
263
291
|
|
|
292
|
+
## Sections
|
|
293
|
+
|
|
294
|
+
- Sales (i-ph-storefront): Orders, Payments, Coupons
|
|
295
|
+
- Catalog (i-ph-package): Products, Categories
|
|
296
|
+
- Customers (i-ph-users): Customers, Reviews, Support tickets
|
|
297
|
+
|
|
264
298
|
## Left open
|
|
265
299
|
|
|
266
300
|
- label:legacy.t_ord — no column names an order; the integrator picks one in the Builder
|
|
@@ -283,6 +317,7 @@ The proposal's values, without their rules, plus what you changed:
|
|
|
283
317
|
"relation": "sales.customers",
|
|
284
318
|
"label": "name",
|
|
285
319
|
"title": "Customers",
|
|
320
|
+
"category": "pages.customers",
|
|
286
321
|
"tableView": true,
|
|
287
322
|
"writable": true,
|
|
288
323
|
"fields": [
|
|
@@ -294,6 +329,8 @@ The proposal's values, without their rules, plus what you changed:
|
|
|
294
329
|
},
|
|
295
330
|
{
|
|
296
331
|
"relation": "sales.orders",
|
|
332
|
+
"title": "Orders",
|
|
333
|
+
"category": "pages.sales",
|
|
297
334
|
"tableView": true,
|
|
298
335
|
"writable": false,
|
|
299
336
|
"tabs": { "column": "status" },
|
|
@@ -332,6 +369,8 @@ The proposal's values, without their rules, plus what you changed:
|
|
|
332
369
|
change it: a price with a `currency` the schema or the integrator names, a badge only over a
|
|
333
370
|
native enum's labels. A proposed price with no `currency` draws euros: send it a `currency`,
|
|
334
371
|
or `null`. Send `tabs` as a column name (`{ "column": "status" }`). `null` turns either off.
|
|
372
|
+
- `category` is the ref `builder_create_category` answered for the page's section, made with
|
|
373
|
+
this call's `module`. Left out, a new page goes in the connection's category.
|
|
335
374
|
- Key columns are added for you.
|
|
336
375
|
- A relation column's target must be in the same call, with a `label`, or mapped in the module
|
|
337
376
|
before.
|
|
@@ -38,7 +38,8 @@ 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.
|
|
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.
|
|
42
43
|
- **An entry answers `error`**: say what it says (an owned instance, the catalog not enabled, a
|
|
43
44
|
role that cannot read) and stop.
|
|
44
45
|
- **A database tool answers `unreachable_connection`**: the DMS MCP reaches only the catalog
|
|
@@ -51,19 +52,20 @@ Call `database_connections`.
|
|
|
51
52
|
(`mysql-erp`, `mongodb-erp`, `rethinkdb-erp`), generated module `erp-tables`, variable
|
|
52
53
|
`ERP_DATABASE_URL`, and for MongoDB `ERP_DATABASE_NAME`. Ask the integrator for the version of
|
|
53
54
|
the engine's module to install (`@antelopejs/postgres`, `@antelopejs/mysql` for MySQL and
|
|
54
|
-
MariaDB alike, `@antelopejs/mongodb`, `@antelopejs/rethinkdb`): you cannot look it up.
|
|
55
|
-
|
|
56
|
-
off for this one call.
|
|
55
|
+
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
|
+
refuses `builder_configure_project`: ask the integrator to turn it off for this one call.
|
|
57
58
|
- Then tell the integrator to put the URL in `.env` (`ERP_DATABASE_URL=postgres://…`,
|
|
58
59
|
`mysql://…/<database>` for MySQL and MariaDB, `mongodb://…`, or `rethinkdb://…/<database>`;
|
|
59
60
|
for MongoDB also `ERP_DATABASE_NAME`), or in the builder's _Database_ workspace when the
|
|
60
61
|
project has one, which writes it there, and to restart the project. Every deployed
|
|
61
62
|
environment needs the same variables, set where that environment keeps its secrets, never in
|
|
62
63
|
git.
|
|
63
|
-
- Recommend an account that can only read
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
- Recommend an account that can only read: a PostgreSQL role with SELECT, a MySQL or MariaDB
|
|
65
|
+
account granted SELECT on the database directly (the module does not see a grant through a
|
|
66
|
+
role), a MongoDB user with the built-in `read` role, a RethinkDB user with `read`
|
|
67
|
+
permission. On read & write, the account also needs write privileges on the tables the
|
|
68
|
+
dashboard changes.
|
|
67
69
|
- Stop here: the connection exists only after the restart.
|
|
68
70
|
|
|
69
71
|
The builder and you each have a connection to the database, under the same id: the builder for
|
|
@@ -111,14 +113,17 @@ profile of the whole database again: the Builder did it.
|
|
|
111
113
|
never from the database. An embedded document is one field: its subfields are not mappable, and
|
|
112
114
|
neither is an array of ids as a relation.
|
|
113
115
|
- **Editable.** Every TableView is proposed read-only. Make one editable only where the integrator
|
|
114
|
-
wants it
|
|
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.
|
|
115
118
|
- **Pages people can work with.** Load the `dms-page-design` skill. For every TableView, plan
|
|
116
119
|
from its columns and their profiles (types, traits, distinct counts), as _Name every page_
|
|
117
120
|
and _Tables_ there say: a title, an icon and a description; the tabs, saved views, display
|
|
118
|
-
modes, footer totals and KPI cards its shape supports
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
modes, footer totals and KPI cards its shape supports; where its details and forms open, as
|
|
122
|
+
_Records, forms and links_ there picks. Decide each from that shape, and leave out what it
|
|
123
|
+
does not support. You never read a row's values.
|
|
124
|
+
- **The analytics dashboard,** which the analysis does not make. Every run plans and builds
|
|
125
|
+
one, even when the integrator only asked for the tables, as `dms-page-design` _The analytics
|
|
126
|
+
dashboard_ says. Plan it from the data:
|
|
122
127
|
1. **Inspect.** For each relation, read from the proposal its row count, its `time-axis`
|
|
123
128
|
columns, its `measure` columns, and its `enum-like` columns with their distinct counts
|
|
124
129
|
and, for a native enum, the labels its schema declares (`database_describe`). That shape
|
|
@@ -137,11 +142,14 @@ profile of the whole database again: the Builder did it.
|
|
|
137
142
|
_Period_ there sets it.
|
|
138
143
|
- **The minimum.** Your plan, and the pages you write, meet all of these:
|
|
139
144
|
- one analytics dashboard, first in the connection's menu (`order: 0`), opened by a toolbar
|
|
140
|
-
with a period selector when the data has dates
|
|
145
|
+
with a period selector when the data has dates, its KPI cards and charts each reading a
|
|
146
|
+
query over a mapped relation;
|
|
141
147
|
- every page with a title in the owner's words, an icon and a description, never the raw
|
|
142
148
|
relation name;
|
|
143
149
|
- every table given the tabs, views, display modes, footer totals and KPI cards its data
|
|
144
150
|
supports, as `dms-page-design` _Tables_ decides;
|
|
151
|
+
- 6 or more pages grouped into sections, as `dms-page-design` _Group pages into sections_
|
|
152
|
+
says;
|
|
145
153
|
- at least 3 different chart kinds on it when the data has the shapes for them;
|
|
146
154
|
- the default period `dms-page-design` _Period_ sets;
|
|
147
155
|
- every page built with one `builder_compose_page` call, previewed first, and every block whose
|
|
@@ -152,8 +160,8 @@ profile of the whole database again: the Builder did it.
|
|
|
152
160
|
never as pages.
|
|
153
161
|
|
|
154
162
|
Write your plan (`ExitPlanMode` in plan mode, a message otherwise) in the format of REFERENCE.md _Plan_: what you change in the
|
|
155
|
-
proposal and why, the questions and the analytics pages that answer them, the
|
|
156
|
-
leave, and what is not possible yet.
|
|
163
|
+
proposal and why, the questions and the analytics pages that answer them, the sections, the
|
|
164
|
+
open items you leave, and what is not possible yet.
|
|
157
165
|
|
|
158
166
|
## 4. Validate
|
|
159
167
|
|
|
@@ -162,36 +170,47 @@ again. Write nothing before they approve it (**Run** in the dms-assistant chat).
|
|
|
162
170
|
|
|
163
171
|
## 5. Apply
|
|
164
172
|
|
|
165
|
-
Work in this order, so the most visible result lands first:
|
|
166
|
-
dashboard and check it, then add KPI rows above tables, then any
|
|
173
|
+
Work in this order, so the most visible result lands first: create the sections, map the
|
|
174
|
+
tables into them, build the dashboard and check it, then add KPI rows above tables, then any
|
|
175
|
+
second analytics page.
|
|
167
176
|
|
|
168
|
-
1.
|
|
177
|
+
1. The sections you planned: one `builder_create_category` per section, `module` set to the
|
|
178
|
+
generated module (a category of another module cannot hold its pages). Keep each section's
|
|
179
|
+
ref.
|
|
180
|
+
2. `builder_map_resources` in batches of 3 or 4 relations per call, TableViews and stats-only
|
|
169
181
|
relations alike; the relations decided against go in `excluded` on the first call
|
|
170
182
|
(REFERENCE.md _Mapping_). One call with every relation of a large database can abort.
|
|
171
183
|
- Send the proposal's choices as they stand where you changed nothing, except `display`,
|
|
172
184
|
which you leave out (REFERENCE.md _Mapping_), plus per resource
|
|
173
|
-
the `title`, `icon`, `description` and `tableOptions` you planned
|
|
185
|
+
the `title`, `icon`, `description` and `tableOptions` you planned, and as `category` the
|
|
186
|
+
ref of its page's section.
|
|
174
187
|
- On `invalid_config`, fix the choice it names and call again: a refused call writes nothing.
|
|
175
188
|
When the same choice is refused twice, drop it (send the relation without that display or
|
|
176
189
|
option) and say so in your report, rather than trying more variants.
|
|
177
190
|
- It answers each relation's `ref`, which queries name it by, `category`, the connection's
|
|
178
191
|
category ref (`pages.<connection>`), and `leftOut`: carry those into your report.
|
|
179
|
-
|
|
192
|
+
3. Per analytics page, the dashboard first and never skipped, one `builder_compose_page` call with `create` (`name`, `displayName`,
|
|
180
193
|
`module` set to the generated module, `category` set to the `category` MapResources
|
|
181
194
|
answered, an icon, a description, and `order: 0` for the dashboard, 1, 2… for the next
|
|
182
195
|
ones) and every block in the order `dms-page-design` lays out, each data block with its
|
|
183
196
|
query inline. Preview first, then write, as `dms-page-design` _Build a page in one call_
|
|
184
197
|
says.
|
|
185
198
|
- Queries read the mapped resources by their refs (`<connection>/<schema>/<relation>`).
|
|
186
|
-
|
|
199
|
+
4. Per table page that gets KPI cards above its table, one `builder_compose_page` call with
|
|
187
200
|
`placement: { "before": "table" }`, previewed first. When MapResources answers `page_not_written`
|
|
188
201
|
for a relation's table options, none of them was written: send them all again with
|
|
189
202
|
`builder_configure_table_view`, the refused one fixed or left out. Tabs it dropped stay off:
|
|
190
203
|
say so in your report.
|
|
191
204
|
|
|
205
|
+
The main dashboard stays in the connection's category, outside every section; a section's own
|
|
206
|
+
dashboard takes that section's ref as `category`.
|
|
207
|
+
|
|
192
208
|
To change a relation later, read its current choices with `builder_mapping`, then call
|
|
193
209
|
`builder_map_resources` with that relation alone, its included columns as they are and only your
|
|
194
|
-
change made: a mapped relation is rewritten from the choices sent, and its page
|
|
210
|
+
change made: a mapped relation is rewritten from the choices sent, and its page is updated where
|
|
211
|
+
it is. A remap with no `title` keeps the page's current title: send `title` only to rename the
|
|
212
|
+
page. Send `category` only to move the page to another section:
|
|
213
|
+
its route changes (a `route_changed` warning), and nothing redirects the old one.
|
|
195
214
|
|
|
196
215
|
## 6. Check
|
|
197
216
|
|
|
@@ -209,13 +228,45 @@ change made: a mapped relation is rewritten from the choices sent, and its page
|
|
|
209
228
|
Then report:
|
|
210
229
|
|
|
211
230
|
- what the builder mapped by its rules, and what you changed;
|
|
212
|
-
- the
|
|
213
|
-
|
|
231
|
+
- the dashboard: its route, and each KPI card and chart with the aggregate it reads;
|
|
232
|
+
- the pages made, with each analytics page's default period, the section each table page
|
|
233
|
+
sits in, and per table the features you gave it and why;
|
|
214
234
|
- every block that still shows no data, and why;
|
|
215
235
|
- what was left out and why;
|
|
216
236
|
- the open items left, which the integrator finds in the builder's _Database_ workspace;
|
|
217
237
|
- the variable every deployment must set.
|
|
218
238
|
|
|
239
|
+
## Connection access
|
|
240
|
+
|
|
241
|
+
A connection's access is `"read"` (the default) or `"read-write"`: what the project lets the
|
|
242
|
+
dashboard write to the database. `builder_analyse_database` and `builder_mapping` answer it at
|
|
243
|
+
the top level as `access`, and each resource's `writes` (`{ insert, update, delete }`) says what
|
|
244
|
+
the database account may do in that relation. This holds in every flow over a connected
|
|
245
|
+
database: a mockup, a page built through the builder or in code.
|
|
246
|
+
|
|
247
|
+
- **On `read`**: propose no write action (add, edit, delete, archive, restore, duplicate,
|
|
248
|
+
`archiveMode`, a draggable kanban, a `ResourceForm` not in `mode: "view"`), and map every
|
|
249
|
+
relation `writable: false`. A mockup over the connection writes `data`, and the validator
|
|
250
|
+
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
|
+
- **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:
|
|
256
|
+
1. Call `builder_set_connection_access` with
|
|
257
|
+
`{ "connection": "<id>", "access": "read-write" }`. Its first call answers
|
|
258
|
+
`confirmation_required` and writes nothing; the same call repeated within 10 minutes runs
|
|
259
|
+
it. Safe mode refuses it: ask the integrator to turn Safe mode off for this one call.
|
|
260
|
+
2. Remap each relation with `writable: true` (a later change, as _5. Apply_ says), then add
|
|
261
|
+
the actions **dms-page-design** _Records, forms and links_ decides. In a mockup, set
|
|
262
|
+
`data.access` to `read-write` and add them to the spec.
|
|
263
|
+
- Refused because the account may write nothing (`invalid_config`): tell the integrator to
|
|
264
|
+
grant the account write privileges on those tables. A relation the account still cannot
|
|
265
|
+
write maps `writable: false` with a `relation_read_only` warning: report it.
|
|
266
|
+
- The builder reads the new access at once. The running backend applies it to the write
|
|
267
|
+
routes when it restarts, which `ajs project dev` does on its own.
|
|
268
|
+
- Raise an access only on the integrator's explicit OK.
|
|
269
|
+
|
|
219
270
|
## Guardrails
|
|
220
271
|
|
|
221
272
|
- Never write a URL, password or token into a tool call, the config or a page.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dms-mockup
|
|
3
|
-
description: Mocks up AntelopeJS DMS apps in mockups/<name>/spec.json before any page is built: interviews the user, matches every wish to a DMS block or a custom sketch, and applies the user's annotations on the mockup. Use when the user wants to mock up, sketch or prototype a DMS app or page,
|
|
3
|
+
description: Mocks up AntelopeJS DMS apps in mockups/<name>/spec.json before any page is built: interviews the user, matches every wish to a DMS block or a custom sketch, and applies the user's annotations on the mockup. Use when the user wants to mock up, sketch or prototype a DMS app or page, from scratch or over an existing database, or has commented on a mockup.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# DMS mockups
|
|
@@ -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`
|
|
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.
|
|
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
|
|
@@ -27,9 +27,9 @@ Collect the user's **wishes**: each thing a screen must show or let someone do.
|
|
|
27
27
|
- the actions: create, edit, approve, export, …;
|
|
28
28
|
- a reference: a screenshot, a Figma frame, another product. When there is one, frame it once as **dms-best-practices** _Design-fidelity protocol_ step 1 says.
|
|
29
29
|
|
|
30
|
-
When the project already has a database or resources (`builder_list_resources`, `database_connections`), read their names and fields first, never their rows, and ask only what they do not answer. Data pages follow **dms-page-design**: its shapes, layout and
|
|
30
|
+
When the project already has a database or resources (`builder_list_resources`, `database_connections`), read their names and fields first, never their rows, and ask only what they do not answer. Over a database, read the Builder's **proposal** too: `builder_mapping` for the relations a module maps, else `builder_analyse_database` (`detail` naming the relations you mock up), and its `access`. Data pages follow **dms-page-design**: its shapes, layout, naming and _Tables_ rules decide the blocks of an analytics or table page, and _Group pages into sections_ the menu. A mockup over a database always has the dashboard of **dms-page-design** _The analytics dashboard_, asked for or not: its KPI cards and charts read fixtures that stand for aggregates of the relations' measures, time axes and category columns.
|
|
31
31
|
|
|
32
|
-
The interview is done when every page has a purpose, its data and its actions,
|
|
32
|
+
The interview is done when every page has a purpose, its data and its actions, every wish names the page it lives on, and a mockup over a database lists its dashboard first.
|
|
33
33
|
|
|
34
34
|
## 2. Check every wish against the catalog
|
|
35
35
|
|
|
@@ -37,26 +37,33 @@ For each wish, find the closest DMS block or composition in the catalog, with th
|
|
|
37
37
|
|
|
38
38
|
- **A block covers it** (through its options or a composition): use it. A difference the theme or the options handle is no question.
|
|
39
39
|
- **Nothing covers it, or the user asked for exactly this look**: propose the choice as **dms-best-practices** _Before any custom block_ says, with the closest DMS option beside a **sketch** of the custom part, one closed question per element or batch: _Keep the DMS block_ / _Adjust it through its options_ / _Build a custom block_. Only _Build a custom block_ puts a sketch in the spec.
|
|
40
|
+
- **A whole page no arrangement of blocks draws** goes through the same choice, offering a **custom page** ([SPEC.md](SPEC.md) _Custom pages_) in place of a custom block. The mockup draws it as one sketch; the build splits it into blocks.
|
|
41
|
+
- **A sidebar part no module provides** (a plan card, a help box) is a **sidebar widget** ([SPEC.md](SPEC.md) _Sidebar widgets_).
|
|
40
42
|
|
|
41
43
|
This step is done when every wish maps to a block, a composition, or a sketch the user chose.
|
|
42
44
|
|
|
43
|
-
## 3. Write the spec
|
|
45
|
+
## 3. Write the spec live
|
|
44
46
|
|
|
45
|
-
|
|
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_:
|
|
46
48
|
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-
|
|
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.
|
|
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.
|
|
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.
|
|
52
57
|
|
|
53
|
-
|
|
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
|
+
|
|
60
|
+
Validate every save: `mockup_write_spec` and `mockup_patch_spec` answer their `errors`; otherwise `GET /api/mockup/<name>` answers every issue with the JSON pointer of its node ([SPEC.md](SPEC.md) _Validation_); without a running DMS, check the file against the schema. The step is done when the last save has no issue and every page of the interview exists, with its sub-pages and, over a database, the dashboard first with no `category`.
|
|
54
61
|
|
|
55
62
|
## 4. Iterate on annotations
|
|
56
63
|
|
|
57
64
|
When the user says they commented, or asks what is left, list the open annotations. For each one:
|
|
58
65
|
|
|
59
|
-
1. Find the node
|
|
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.
|
|
60
67
|
2. Change the spec. A request the DMS blocks cannot meet goes through step 2 again, never straight to a sketch.
|
|
61
68
|
3. Resolve the annotation, and note what changed for the report.
|
|
62
69
|
|