From 95b8d6a006b76a369ad229cf52d083f0ca1d7c65 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Nov 2026 00:35:13 +0000 Subject: [PATCH 1/5] docs(skills): objectstack-ui SKILL.md becomes a router (wip: text moves) SKILL.md keeps the first checks, the run-time traps and the routing list; the form, master-detail, app-cap and action-body text moves into rules/. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz --- skills/objectstack-ui/SKILL.md | 368 +++++++--------------- skills/objectstack-ui/rules/actions.md | 14 + skills/objectstack-ui/rules/dashboards.md | 3 +- skills/objectstack-ui/rules/forms.md | 77 +++++ skills/objectstack-ui/rules/list-views.md | 9 + skills/objectstack-ui/rules/navigation.md | 26 ++ skills/objectstack-ui/rules/pages.md | 2 +- 7 files changed, 240 insertions(+), 259 deletions(-) create mode 100644 skills/objectstack-ui/rules/forms.md diff --git a/skills/objectstack-ui/SKILL.md b/skills/objectstack-ui/SKILL.md index 5639025b606..eeaabd84388 100644 --- a/skills/objectstack-ui/SKILL.md +++ b/skills/objectstack-ui/SKILL.md @@ -25,157 +25,130 @@ metadata: # UI Design — ObjectStack UI Protocol ---- - -## View Types - -### List Views - -| Type | When to Use | -|:-----|:------------| -| `grid` | Standard data table — default for most objects | -| `kanban` | Visual board with columns (status-driven workflows) | -| `gallery` | Card-based masonry layout (visual catalogues, contacts) | -| `calendar` | Date-based scheduling (events, tasks, bookings) | -| `timeline` | Chronological activity stream | -| `gantt` | Project management with dependency tracking | -| `map` | Geospatial records with `location` fields | -| `chart` | Aggregate visualisation over the object (mini chart view) | -| `tree` | Self-referencing hierarchy (tree-grid) | - -**Keep the kind the request names.** A photo wall, card wall or catalogue of -covers is `gallery` (an image, avatar or file field as `gallery.coverField`), -a schedule or timeline over a start/end date pair is `gantt`, a board is -`kanban`; never downgrade a named kind to `grid`: the file parses and the user -opens a table where they asked for a board. Adding one beside the list, and -the empty board over a field added in the same change: -[List Views](./rules/list-views.md#adding-a-board-calendar-gallery-or-gantt-beside-the-list). - -### Form Views - -| Type | When to Use | -|:-----|:------------| -| `simple` | Stacked sections on one scrolling page — the default, at any field count | -| `tabbed` | One tab per section — only for sections read apart; a required field on another tab is flagged only on its tab, and the tab strip overflows on a phone | -| `wizard` | Step-by-step flow — guided data entry (onboarding, applications) | - -**A long form stays `simple`: collapse what is rarely filled** with -`collapse: 'collapsed'` on the object's `fieldGroups` entry, or `collapsed: true` -on a form section listing its own `fields`. `columns` (form or section) is a -per-row ceiling a narrow screen lowers; unset, a section draws two, so set `3` -for a wide data-entry form. `modalSize` (`sm` to `full`) sizes the New / Edit -dialog; unset, the field count picks `lg` or `xl`. - -### Master-Detail Forms (parent + child line items) - -To let users enter a record **together with its child line items** (invoice + -lines, project + tasks) and save them **atomically**, you almost never need a -custom page or form config. Prefer, in order: - -1. **Relationship `inlineEdit` (default, zero UI config).** Declare it in the - DATA MODEL — set `inlineEdit` on the child's `master_detail` field that - references the parent. Every standard New/Edit form for the parent (modal, - drawer, full-page) then auto-renders the children and saves parent + children - in one atomic `/api/v1/batch`. **No view metadata needed.** A parent or child - declaring `enable.apiMethods` must list `'bulk'`, or that save is refused - `405 OBJECT_API_METHOD_NOT_ALLOWED`. The - `true` / `'grid'` / `'form'` ladder and what each value picks: - **objectstack-data → Relationships → Inline Editing**. - -2. **Form view `subforms` (override / tuning).** Add to a form view only when you - need to override the derived columns/order, or expose a child the - relationship didn't mark inline: - - ```typescript - form: { - type: 'simple', - sections: [{ group: 'invoice_header' }], // a declared fieldGroup - subforms: [ - { childObject: 'invoice_line', // set `columns` only to override - title: 'Line Items', addLabel: 'Add line' }, - ], - }, - ``` - -3. **`object-master-detail-form` page block (bespoke layout).** Use a page only - for free-form layouts. Same `details: [{ childObject }]` shorthand. - -**Line-item grid behaviors (`grid` mode).** The editable grid is a real -spreadsheet-style line editor, and -every behaviour is derived from the DATA MODEL — computed columns, catalog -typeahead auto-fill, persisted drag-reorder, and the live Subtotal → Tax → Total -stack: **objectstack-data → Relationships → Inline Editing**. Three things are -authored on this side: a trailing **ghost** row always exists, so never add an -"Add line" button to the grid (typing in the ghost materialises a row; an -untouched one is never persisted; a record-header action that inserts a priced -line is [Actions](./rules/actions.md)); `autofill: false` opts one column out of the typeahead copy; -and the form's `taxRateField` overrides which parent field drives the totals. - -**Read side — the record page.** Child relationships are related lists on the -parent's record page by default; the flags, slots and open mode: [Record Page](./rules/record-page.md). - -### Field Conditional Rules in Forms - -Conditions that belong to a field's lifecycle — `visibleWhen`, `readonlyWhen`, -`requiredWhen` — are declared on the **DATA MODEL field**, not in the form view; -ObjectUI forms consume them. Their semantics and server behaviour: -[objectstack-data → Conditional Field Rules](../objectstack-data/SKILL.md#conditional-field-rules). - ---- - -## Detailed Rules - -- [List, Kanban & Gantt Views](./rules/list-views.md) — `defineView`, `data`, columns, filtering, `userFilters`, toolbar search, sorting, kanban, gantt. -- [Navigation & Run Modes](./rules/navigation.md) — `App.create`, the three run modes, record presentation. -- [Dashboards, Reports & Cubes](./rules/dashboards.md) — widgets, dataset binding, filters, `compareTo`, bucketing, `options`, drilldown, report config, cubes. -- [Pages & Docs](./rules/pages.md) — page types, regions, components, print pages, the html/react source tiers, styling, package docs. -- [Record Page](./rules/record-page.md) — declarations → page, relationship flags, slotted / full overrides, drawer vs `page`, the reader's own choices. -- [Actions](./rules/actions.md) — `locations`, visibility, examples, `ctx`, new tab, params. - ---- +This page routes; keys and option lists live in the contract (first check 3). + +## First checks + +1. **Version.** This skill targets the `@objectstack/spec` major in its + `compatibility` line. Read the installed one + (`node_modules/@objectstack/spec/package.json`); where they differ, the + installed contract is right (objectstack-upgrade moves a project across). +2. **Read what exists.** Read the object's declaration (fields, `fieldGroups`, + relationships) and the project's own files for it (the globs under Where to + go). Add beside what is there; reuse a declared dataset, field group or view. +3. **Read the type's contract.** [references/_index.md](./references/_index.md) + points at each type's Zod source in `node_modules/@objectstack/spec/src/`. + `Read` it for exact keys, enum members and refusals; do not rely on memory + of property names. A running environment serves the same contract as JSON + Schema: `GET /api/v1/meta/types`, `entries[].schema`. +4. **Verify before reporting done.** `os validate` (`npm run validate` in a + scaffolded project; `os build` runs the same gates). It + catches a bare field ref in a predicate (`done` for `record.done`) and a + widget `dataset` / `dimensions` / `values` that resolves to nothing declared + (an empty chart). The traps below pass it. + +## Traps — each parses, then fails at run time + +1. **Keep the view kind the request names.** A photo wall, card wall or + catalogue of covers is `gallery` (an image, avatar or file field as + `gallery.coverField`), a schedule or timeline over a start/end date pair is + `gantt`, a board is `kanban`; never downgrade a named kind to `grid`: the + file parses and the user opens a table. "Add a board" is a NEW `listViews` + entry, never `list` retyped, and a board over a field added in the same + change opens empty: + [List Views](./rules/list-views.md#adding-a-board-calendar-gallery-or-gantt-beside-the-list). +2. **A long form stays `simple`**, at any field count: collapse what is rarely + filled and size it with `columns` and `modalSize`. `tabbed` flags a required + field only on its own tab and overflows on a phone + ([Forms](./rules/forms.md)). +3. **A record entered with its line items is `inlineEdit` on the child's + `master_detail` field**, before any custom page, and its grid needs no "Add + line" button. A parent or child declaring `enable.apiMethods` must list + `'bulk'`, or the save is refused `405` ([Forms](./rules/forms.md)). +4. **An operation is an `action`, never a view, and a write button must + write.** "Mark as done", "approve", "set status to X" is `defineAction` with + `objectName` and `locations`; with neither `locations` nor a view naming it, + it renders nowhere. `ctx.record` is a read-only snapshot and the body's + return value is applied to nothing: a body that returns or assigns the new + values reports success and changes nothing. Call the API: + `type: 'script'`, + `body: { language: 'js', source: "await ctx.api.object('task').update({ id: ctx.recordId, status: 'done' });", capabilities: ['api.write'] }`, + with the option `value`, never its label ([Actions](./rules/actions.md)). +5. **A persisted chart binds a declared dataset.** A widget or report names a + `defineDataset` and selects its `dimensions` / `values` by name; an object + without one has no analytics face. A dataset is narrow: a window, a to-many + rollup or a computed dimension is a stored field or app code, never forced + into one; an ad-hoc chart in a `kind: 'react'` page needs none. Read + [Dashboards](./rules/dashboards.md#dataset-bound-widgets) before writing any + widget, dataset or chart. +6. **A filter token is presentation scope, not security.** `{current_user_id}`, + `{today}` and the rest (vocabulary: objectstack-query → `rules/filters.md`, + load it before writing one; an unrecognised token is a build error) decide + what a surface *shows*; RLS decides what a caller may *read*. Removing a + `{current_user_id}` filter only widens a view. +7. **The object declares its record page.** Related lists, their order and + filter, and how a record opens are flags on the object and its fields, not a + page file; the reader's own display choices are never metadata + ([Record Page](./rules/record-page.md)). + +## Where to go + +Open the file before writing: the rules and examples are there. + +| Authoring | In | Open | +|:--|:--|:--| +| A list, board, calendar, gallery or gantt: columns, `filter`, quick filters, toolbar search, sorting, grouping | `src/views/*.view.ts` | [List Views](./rules/list-views.md) | +| A form (`simple` / `tabbed` / `wizard`), master-detail (a parent with its line items), a public form, field conditional rules | `src/views/*.view.ts` | [Forms](./rules/forms.md) | +| An app and its navigation; who sees or opens it; object nav, a `filters` slice or an interface page; form width, columns and `sections` | `src/apps/*.app.ts` | [Navigation](./rules/navigation.md) | +| What a record page shows: related lists, a slotted or full page, drawer or page | the object | [Record Page](./rules/record-page.md) | +| A button or operation: `locations`, visibility, dialog and toast copy, params, new tab, the body's `ctx` | `src/actions/*.actions.ts` | [Actions](./rules/actions.md) | +| A number, chart, KPI or report over records: datasets, widgets, dashboard filters, `compareTo`, date bucketing, drilldown, cubes | `src/datasets/*.dataset.ts`, `src/dashboards/*.dashboard.ts`, `src/reports/*.report.ts` | [Dashboards](./rules/dashboards.md) | +| A page (regions, components, print, `kind: 'html'` / `'react'` source, styling) or package docs | `*.page.ts`, `src/docs/*.md` | [Pages & Docs](./rules/pages.md) | +| The props of a block in a `kind: 'react'` page | | [react-blocks.md](./references/react-blocks.md) | ## App Navigation -Build an App with `App.create({...})` from -`@objectstack/spec/ui` and register under `defineStack({ apps: [...] })`. +One App per package: `defineStack` refuses a second, so audiences sharing a +product are `requiredPermissions`-gated groups inside it. Hiding an app +(`tabPermissions`) is not gating it: its URL still opens +([Navigation](./rules/navigation.md#who-sees-or-opens-an-app)). -⛔ **At most one App per package** (ADR-0019 (app-as-consumer-unit) D3 as -amended): `defineStack` refuses a second app in a `type: 'app'` and a -`type: 'module'` package alike. A suite (an app package plus its modules) may -surface more apps: each further app goes in a module of its own with the -objects it shows (gone when it is disabled), and the suite composes with -`composeStacks(stacks, { manifest: 'preserve' })`, which serves each app under -its own package id; a flat composition puts them under one and is refused. -Audiences sharing one product and its objects stay -`requiredPermissions`-gated groups **inside** one app. +### Navigation Item Types -Who sees an app (`tabPermissions`) and who may open it (app -`requiredPermissions`): [Navigation](./rules/navigation.md#who-sees-or-opens-an-app). +| Type | Purpose | +|:--|:--| +| `group` | Collapsible group of items | +| `object` | An object list, a named view, a record deep-link, or a `filters` slice | +| `dashboard` | A dashboard | +| `report` | A report; no `reportName` = the app's report index | +| `page` | A custom Page | +| `url` | External or custom URL | +| `action` | Run an action instead of navigating | +| `component` | Built-in platform component; `componentRef` is a colon-joined registry key (`metadata:resource`) | +| `doc` | Package docs; inherits the docs audience | +| `separator` | Visual separator | + +Each type's keys: [Navigation](./rules/navigation.md). -### Navigation Item Types +## Actions -| Type | Properties | Purpose | -|:-----|:-----------|:--------| -| `group` | `label`, `icon`, `expanded`, `children[]` | Collapsible group of items | -| `object` | `objectName`, `viewName?`, `recordId?`, `filters?`, `label`, `icon` | Link to an object list, a named view, a record deep-link, or a `filters` slice on the bare data surface | -| `dashboard` | `dashboardName`, `label`, `icon` | Link to a dashboard | -| `report` | `reportName?`, `label`, `icon` | A report; no `reportName` = the app's report index | -| `page` | `pageName`, `label`, `icon` | Link to a custom Page | -| `url` | `url`, `label`, `icon` | External or custom URL | -| `action` | `actionDef` (`{ actionName, params? }`), `label`, `icon` | Run an action instead of navigating | -| `component` | `componentRef`, `params?`, `label`, `icon` | Built-in platform component; `componentRef` is a colon-joined registry key (`metadata:resource`) | -| `doc` | `book?` / `doc?` (one required), `label`, `icon` | Package docs; inherits docs audience | -| `separator` | — | Visual separator | +### Action Types -> **`requiresObject` / `requiresService`** hide an item whose optional -> system object or kernel service is missing — never hard-code conditional UI. +| `type` | Purpose | +|:--|:--| +| `script` | Run an inline L2 hook body (sandboxed JS) on the server: `body`, or `target` naming a registered function | +| `url` | Navigate to an internal route or external URL | +| `modal` | Open the page named by `target`; a `body` runs only on `script` | +| `flow` | Launch a screen/auto-launched flow by name; a multi-step operation is this, with a flow you also author | +| `api` | Call a registered API endpoint | +| `form` | Open a FormView by name (routed to `/_console/forms/:name`) | ---- +Every type but `script` requires `target`. ## Report Types | Type | When to Use | -|:-----|:------------| +|:--|:--| | `tabular` | Flat data table with columns and filters | | `summary` | Grouped data with subtotals (e.g., revenue by region) | | `matrix` | Cross-tab / pivot table (`rows` down × `columns` across) | @@ -183,122 +156,3 @@ Who sees an app (`tabPermissions`) and who may open it (app There is no `chart` report type — a report *visualizes* via its embedded `chart:` config. - ---- - -## CRM UI Blueprint (Metadata-First) - -| UI Surface | Typical Location | Pattern to Follow | -|:--|:--|:--| -| Multi-view object UI | `src/views/*.view.ts` | Define default `list` + `form`, then named `listViews` / `formViews` for scenarios | -| **Public form** | `src/views/*.view.ts` (formView with `sharing: { enabled: true, allowAnonymous: true, publicLink: 'slug' }`) | Web-to-Lead at `GET/POST /api/v1/forms/:slug` | -| App navigation | `src/apps/*.app.ts` | Grouped nav trees, `viewName` shortcuts, `requiresObject` | -| **Analytics dataset** | `src/datasets/*.dataset.ts` | One per object you want reportable — dashboards and reports bind a **declared** dataset by name, so an object without one has no analytics face | -| Dashboards | `src/dashboards/*.dashboard.ts` | Combine KPI + chart + table widgets with shared `dateRange` and `globalFilters` | -| Reports | `src/reports/*.report.ts` | Select `rows` (dimensions) + `values` (measures) from that dataset; tabular/summary/matrix/joined | -| Record pages | — (synthesized) | The object's declarations produce the page ([Record Page](./rules/record-page.md)) | -| User actions | `src/actions/*.actions.ts` | Use `flow` for orchestration and `script` for parameterized bulk mutations | - ---- - -## Date Macros — Filter Placeholders - -Filter values in list views, dashboards, reports and pages accept relative-date -tokens (`{today}`, `{current_month_start}`, `{30_days_ago}`) and the two session -tokens `{current_user_id}` / `{current_org_id}`. **The vocabulary, both accepted -spellings, the two resolvers and the near-miss list are owned by -objectstack-query → `rules/filters.md` — load it before writing a filter token.** -An unrecognised token is a build error and a runtime throw, never a silent -literal. - -Two rules this package owns, because they are about UI surfaces rather than the -token vocabulary: - -* A filter token is **presentation scope, not security**. It decides what a - surface *shows*; RLS decides what a caller may *read*. Removing a - `{current_user_id}` filter widens a view — it must never be the thing standing - between a user and someone else's data. -* `AppContextSelector` ids (e.g. `{active_package}`) resolve in navigation - `recordId` / `params` only. Filters are not evaluated with the sidebar's - selector state. - ---- - -## Actions - -Actions are user-triggered operations attached to an object or a view. -Register them under `defineStack({ actions: [...] })`. - -### Action Types - -| `type` | Purpose | Required field | -|:---------|:-------------------------------------------------------------------|:---------------| -| `script` | Run an inline L2 hook body (sandboxed JS) on the server | `body` (or `target` = registered function name) | -| `url` | Navigate to an internal route or external URL | `target` | -| `modal` | Open the page named by `target`; a `body` runs only on `script` | `target` | -| `flow` | Launch a screen/auto-launched flow by name | `target` | -| `api` | Call a registered API endpoint | `target` | -| `form` | Open a FormView by name (routed to `/_console/forms/:name`) | `target` | - -**An operation is an `action`, never a view.** "Mark as done", "approve", -"submit", "set status to X" — anything that DOES something to a record — is -`defineAction` metadata; a view only displays. A record button carries -`objectName` (what folds it into that object's record surfaces) and -`locations`; with neither `locations` nor a view naming it in `rowActions` / -`bulkActions` it renders nowhere (`action-no-placement`). **A write button must -write:** `ctx.record` is a read-only snapshot and the body's return value is -applied to nothing, so a body that only returns the new values or assigns to -`ctx.record` changes nothing and still reports success -(`action-record-write-discarded`). Write with `type: 'script'` and -`body: { language: 'js', source: "await ctx.api.object('task').update({ id: ctx.recordId, status: 'done' });", capabilities: ['api.write'] }`: -`js`, because an `expression` body is a pure formula with no I/O; `api.write`, -because the sandbox throws on `ctx.api…update` / `insert` / `delete` without -it; the option `value`, never its label. A multi-step operation is -`type: 'flow'` with `target` naming a flow you also author. - ---- - -## Common Pitfalls - -1. **Too many default columns, or no `link: true` on the primary one.** 6–8 - visible columns is plenty (`hidden` the rest); the name/subject column is - the record link ([Columns](./rules/list-views.md#column-features)). - -2. **Putting widget grid placement in `position`.** - The grid-placement field is `layout: { x, y, w, h }` — `position` is not a - widget key and the closed schema REJECTS it by name. - `layout` is optional: omit it and the widget - auto-flows. - ---- - -## Verify your work - -After authoring any `*.view.ts` / `*.action.ts` / `*.dashboard.ts`, run the -author-time gate before reporting done: - -```bash -os validate # CEL predicates (record.) + widget bindings + schema -# or: os build # the same gates, plus emits dist/ -``` - -Two UI-specific traps it catches, otherwise met only at runtime: - -- **Action / field predicate** — a bare field ref in an action `visible` / - `disabled` or a field `visibleWhen` (`done` instead of `record.done`) - faults on *every* record: the action hides (`visible`) or greys out - (`disabled`), the field shows; the console logs the fault. -- **Dashboard widget binding** — a widget `dataset` / `dimensions` / `values` - that doesn't resolve to a declared dataset/field renders an empty chart - (ADR-0021). - -In a scaffolded project the gate is `npm run validate`. - ---- - -## References - -See [references/_index.md](./references/_index.md) for the full list of Zod -schemas (with one-line descriptions) — pointers into -`node_modules/@objectstack/spec/src/`. Always `Read` the source for exact field -shapes; do not rely on memory of property names. diff --git a/skills/objectstack-ui/rules/actions.md b/skills/objectstack-ui/rules/actions.md index e4020ec62ec..27f5120771c 100644 --- a/skills/objectstack-ui/rules/actions.md +++ b/skills/objectstack-ui/rules/actions.md @@ -1,5 +1,19 @@ # Actions +Actions are user-triggered operations attached to an object or a view. +Register them under `defineStack({ actions: [...] })`; the six `type` values: +[Action Types](../SKILL.md#action-types). + +**A record button needs a placement and a body that writes.** `objectName` +folds the action into that object's record surfaces; with neither `locations` +nor a view naming it in `rowActions` / `bulkActions` it renders nowhere +(`action-no-placement`). A body that only returns the new values or assigns to +`ctx.record` changes nothing and still reports success +(`action-record-write-discarded`): it calls `ctx.api.object(...).update(...)` +in `language: 'js'`, because an `expression` body is a pure formula with no +I/O, with `capabilities: ['api.write']`, because the sandbox throws on +`ctx.api…update` / `insert` / `delete` without it. + ## Where Actions Appear (`locations`) | Value | Surface | diff --git a/skills/objectstack-ui/rules/dashboards.md b/skills/objectstack-ui/rules/dashboards.md index 530549890ee..c4de0b71de4 100644 --- a/skills/objectstack-ui/rules/dashboards.md +++ b/skills/objectstack-ui/rules/dashboards.md @@ -10,7 +10,8 @@ Dashboards are a grid of widgets (`columns` × `rowHeight`) sharing a `dateRange` scrubber and `globalFilters`. Each widget binds a `dataset` -(below), picks a chart `type`, and sets a `layout: {x,y,w,h}`. +(below), picks a chart `type`, and sets a `layout: {x,y,w,h}` (omitted, the +widget auto-flows; `position` is not a widget key). ### Widget Types diff --git a/skills/objectstack-ui/rules/forms.md b/skills/objectstack-ui/rules/forms.md new file mode 100644 index 00000000000..db11b66d2c2 --- /dev/null +++ b/skills/objectstack-ui/rules/forms.md @@ -0,0 +1,77 @@ +# Form Views & Master-Detail Forms + +`form` and the named `formViews` live in the object's `defineView` container +([List Views](./list-views.md)). Field width, column count and the `sections` +ladder: +[Record Presentation](./navigation.md#record-presentation--surface-width--columns-are-auto-derived). + +## Form Views + +| Type | When to Use | +|:-----|:------------| +| `simple` | Stacked sections on one scrolling page — the default, at any field count | +| `tabbed` | One tab per section — only for sections read apart; a required field on another tab is flagged only on its tab, and the tab strip overflows on a phone | +| `wizard` | Step-by-step flow — guided data entry (onboarding, applications) | + +**A long form stays `simple`: collapse what is rarely filled** with +`collapse: 'collapsed'` on the object's `fieldGroups` entry, or `collapsed: true` +on a form section listing its own `fields`. `columns` (form or section) is a +per-row ceiling a narrow screen lowers; unset, a section draws two, so set `3` +for a wide data-entry form. `modalSize` (`sm` to `full`) sizes the New / Edit +dialog; unset, the field count picks `lg` or `xl`. + +**A public form** is a form view with +`sharing: { enabled: true, allowAnonymous: true, publicLink: 'slug' }`: +Web-to-Lead at `GET/POST /api/v1/forms/:slug`. + +## Master-Detail Forms (parent + child line items) + +To let users enter a record **together with its child line items** (invoice + +lines, project + tasks) and save them **atomically**, you almost never need a +custom page or form config. Prefer, in order: + +1. **Relationship `inlineEdit` (default, zero UI config).** Declare it in the + DATA MODEL — set `inlineEdit` on the child's `master_detail` field that + references the parent. Every standard New/Edit form for the parent (modal, + drawer, full-page) then auto-renders the children and saves parent + children + in one atomic `/api/v1/batch`. **No view metadata needed.** A parent or child + declaring `enable.apiMethods` must list `'bulk'`, or that save is refused + `405 OBJECT_API_METHOD_NOT_ALLOWED`. The + `true` / `'grid'` / `'form'` ladder and what each value picks: + **objectstack-data → Relationships → Inline Editing**. + +2. **Form view `subforms` (override / tuning).** Add to a form view only when you + need to override the derived columns/order, or expose a child the + relationship didn't mark inline: + + ```typescript + form: { + type: 'simple', + sections: [{ group: 'invoice_header' }], // a declared fieldGroup + subforms: [ + { childObject: 'invoice_line', // set `columns` only to override + title: 'Line Items', addLabel: 'Add line' }, + ], + }, + ``` + +3. **`object-master-detail-form` page block (bespoke layout).** Use a page only + for free-form layouts. Same `details: [{ childObject }]` shorthand. + +**Line-item grid behaviors (`grid` mode).** The editable grid is a real +spreadsheet-style line editor, and +every behaviour is derived from the DATA MODEL — computed columns, catalog +typeahead auto-fill, persisted drag-reorder, and the live Subtotal → Tax → Total +stack: **objectstack-data → Relationships → Inline Editing**. Three things are +authored on this side: a trailing **ghost** row always exists, so never add an +"Add line" button to the grid (typing in the ghost materialises a row; an +untouched one is never persisted; a record-header action that inserts a priced +line is [Actions](./actions.md)); `autofill: false` opts one column out of the typeahead copy; +and the form's `taxRateField` overrides which parent field drives the totals. + +## Field Conditional Rules in Forms + +Conditions that belong to a field's lifecycle — `visibleWhen`, `readonlyWhen`, +`requiredWhen` — are declared on the **DATA MODEL field**, not in the form view; +ObjectUI forms consume them. Their semantics and server behaviour: +[objectstack-data → Conditional Field Rules](../../objectstack-data/SKILL.md#conditional-field-rules). diff --git a/skills/objectstack-ui/rules/list-views.md b/skills/objectstack-ui/rules/list-views.md index 5357aeb80ed..c69313bf55f 100644 --- a/skills/objectstack-ui/rules/list-views.md +++ b/skills/objectstack-ui/rules/list-views.md @@ -8,6 +8,12 @@ ## Configuring a List View +A list view's `type`: `grid` (the default table), `kanban` (a board by status), +`gallery` (cards over an image, avatar or file field), `calendar`, `timeline` +(a chronological stream), `gantt` (start/end bars with dependencies), `map` +(`location` fields), `chart` (an aggregate over the object), `tree` (a +self-referencing hierarchy). + ### The `defineView` container (`*.view.ts` file shape) Views ship **inside a `defineView` container** — one per object, aggregating @@ -81,6 +87,9 @@ columns: [ | `link` | Make this the primary navigation link | | `summary` | Footer aggregation: `count`, `sum`, `avg`, `min`, `max`, etc. | +6–8 visible columns is plenty (`hidden` the rest); the name/subject column +carries `link: true`. + **Inline editing is on by default**, under the permission gate: a user who may `update` the object edits a cell in place. A list whose records are read-only by nature — a log, an audit trail, a history, a report roll-up — declares diff --git a/skills/objectstack-ui/rules/navigation.md b/skills/objectstack-ui/rules/navigation.md index d7952a24ec7..addb77099d8 100644 --- a/skills/objectstack-ui/rules/navigation.md +++ b/skills/objectstack-ui/rules/navigation.md @@ -1,5 +1,31 @@ # App Navigation & Run Modes +Build an App with `App.create({...})` from +`@objectstack/spec/ui` and register under `defineStack({ apps: [...] })`. + +⛔ **At most one App per package** (ADR-0019 (app-as-consumer-unit) D3 as +amended): `defineStack` refuses a second app in a `type: 'app'` and a +`type: 'module'` package alike. A suite (an app package plus its modules) may +surface more apps: each further app goes in a module of its own with the +objects it shows (gone when it is disabled), and the suite composes with +`composeStacks(stacks, { manifest: 'preserve' })`, which serves each app under +its own package id; a flat composition puts them under one and is refused. +Audiences sharing one product and its objects stay +`requiredPermissions`-gated groups **inside** one app. + +Keys by item type ([the ten types](../SKILL.md#navigation-item-types); each +takes `label`, `icon`): `group` `expanded`, `children[]`; `object` +`objectName`, `viewName?`, `recordId?`, `filters?`; `dashboard` +`dashboardName`; `report` `reportName?`; `page` `pageName`; `url` `url`; +`action` `actionDef` (`{ actionName, params? }`); `component` `componentRef`, +`params?`; `doc` `book?` / `doc?` (one required). + +> **`requiresObject` / `requiresService`** hide an item whose optional +> system object or kernel service is missing — never hard-code conditional UI. +> `AppContextSelector` ids (e.g. `{active_package}`) resolve in navigation +> `recordId` / `params` only: filters are not evaluated with the sidebar's +> selector state. + ```typescript import { App } from '@objectstack/spec/ui'; diff --git a/skills/objectstack-ui/rules/pages.md b/skills/objectstack-ui/rules/pages.md index 92ddc1595f8..e2817e29133 100644 --- a/skills/objectstack-ui/rules/pages.md +++ b/skills/objectstack-ui/rules/pages.md @@ -59,7 +59,7 @@ A `slotted` record page has no `tabs` slot — see [Record Page](./record-page.m > `{current_quarter_start}` etc. resolve from the page's `variables` block, > the bound record, and the runtime context. Declare `variables: [...]` at > the page root for any non-record value; relative-date placeholders: -> [Date Macros](../SKILL.md#date-macros--filter-placeholders). +> objectstack-query → `rules/filters.md`. ### Print pages From 999673c9f02d36d93b7388456baa1395b3057963 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Nov 2026 00:38:42 +0000 Subject: [PATCH 2/5] docs(skills): the ui form text lands in the views rules file, no new file The form view, master-detail and field-conditional sections sit under rules/list-views.md, the file that already teaches the defineView container; the router links them by anchor. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz --- skills/objectstack-ui/SKILL.md | 39 ++++++------ skills/objectstack-ui/rules/forms.md | 77 ----------------------- skills/objectstack-ui/rules/list-views.md | 77 +++++++++++++++++++++++ 3 files changed, 96 insertions(+), 97 deletions(-) delete mode 100644 skills/objectstack-ui/rules/forms.md diff --git a/skills/objectstack-ui/SKILL.md b/skills/objectstack-ui/SKILL.md index eeaabd84388..1837d87e225 100644 --- a/skills/objectstack-ui/SKILL.md +++ b/skills/objectstack-ui/SKILL.md @@ -32,7 +32,7 @@ This page routes; keys and option lists live in the contract (first check 3). 1. **Version.** This skill targets the `@objectstack/spec` major in its `compatibility` line. Read the installed one (`node_modules/@objectstack/spec/package.json`); where they differ, the - installed contract is right (objectstack-upgrade moves a project across). + installed contract is right. 2. **Read what exists.** Read the object's declaration (fields, `fieldGroups`, relationships) and the project's own files for it (the globs under Where to go). Add beside what is there; reuse a declared dataset, field group or view. @@ -42,10 +42,10 @@ This page routes; keys and option lists live in the contract (first check 3). of property names. A running environment serves the same contract as JSON Schema: `GET /api/v1/meta/types`, `entries[].schema`. 4. **Verify before reporting done.** `os validate` (`npm run validate` in a - scaffolded project; `os build` runs the same gates). It - catches a bare field ref in a predicate (`done` for `record.done`) and a - widget `dataset` / `dimensions` / `values` that resolves to nothing declared - (an empty chart). The traps below pass it. + scaffolded project; `os build` runs the same gates). It catches a bare field + ref in a predicate (`done` for `record.done`) and a widget `dataset` / + `dimensions` / `values` that resolves to nothing declared (an empty chart). + The traps below pass it. ## Traps — each parses, then fails at run time @@ -57,14 +57,15 @@ This page routes; keys and option lists live in the contract (first check 3). entry, never `list` retyped, and a board over a field added in the same change opens empty: [List Views](./rules/list-views.md#adding-a-board-calendar-gallery-or-gantt-beside-the-list). -2. **A long form stays `simple`**, at any field count: collapse what is rarely - filled and size it with `columns` and `modalSize`. `tabbed` flags a required - field only on its own tab and overflows on a phone - ([Forms](./rules/forms.md)). +2. **A long form stays `simple`**: collapse what is rarely filled and size it + with `columns` and `modalSize`. `tabbed` flags a required field only on its + own tab and overflows on a phone + ([Form Views](./rules/list-views.md#form-views)). 3. **A record entered with its line items is `inlineEdit` on the child's `master_detail` field**, before any custom page, and its grid needs no "Add line" button. A parent or child declaring `enable.apiMethods` must list - `'bulk'`, or the save is refused `405` ([Forms](./rules/forms.md)). + `'bulk'`, or the save is refused `405` + ([Master-Detail Forms](./rules/list-views.md#master-detail-forms-parent--child-line-items)). 4. **An operation is an `action`, never a view, and a write button must write.** "Mark as done", "approve", "set status to X" is `defineAction` with `objectName` and `locations`; with neither `locations` nor a view naming it, @@ -84,12 +85,12 @@ This page routes; keys and option lists live in the contract (first check 3). 6. **A filter token is presentation scope, not security.** `{current_user_id}`, `{today}` and the rest (vocabulary: objectstack-query → `rules/filters.md`, load it before writing one; an unrecognised token is a build error) decide - what a surface *shows*; RLS decides what a caller may *read*. Removing a - `{current_user_id}` filter only widens a view. + what a surface *shows*; RLS decides what a caller may *read*. Such a filter + must never be what keeps a user from someone else's data. 7. **The object declares its record page.** Related lists, their order and - filter, and how a record opens are flags on the object and its fields, not a - page file; the reader's own display choices are never metadata - ([Record Page](./rules/record-page.md)). + filter are flags on the object and its fields, not a page file; how a record + opens is one list-view key, and the reader's own display choices are never + metadata ([Record Page](./rules/record-page.md)). ## Where to go @@ -98,7 +99,7 @@ Open the file before writing: the rules and examples are there. | Authoring | In | Open | |:--|:--|:--| | A list, board, calendar, gallery or gantt: columns, `filter`, quick filters, toolbar search, sorting, grouping | `src/views/*.view.ts` | [List Views](./rules/list-views.md) | -| A form (`simple` / `tabbed` / `wizard`), master-detail (a parent with its line items), a public form, field conditional rules | `src/views/*.view.ts` | [Forms](./rules/forms.md) | +| A form (`simple` / `tabbed` / `wizard`), master-detail (a parent with line items), a public form, field conditional rules | `src/views/*.view.ts` | [Form Views](./rules/list-views.md#form-views) | | An app and its navigation; who sees or opens it; object nav, a `filters` slice or an interface page; form width, columns and `sections` | `src/apps/*.app.ts` | [Navigation](./rules/navigation.md) | | What a record page shows: related lists, a slotted or full page, drawer or page | the object | [Record Page](./rules/record-page.md) | | A button or operation: `locations`, visibility, dialog and toast copy, params, new tab, the body's `ctx` | `src/actions/*.actions.ts` | [Actions](./rules/actions.md) | @@ -110,8 +111,8 @@ Open the file before writing: the rules and examples are there. One App per package: `defineStack` refuses a second, so audiences sharing a product are `requiredPermissions`-gated groups inside it. Hiding an app -(`tabPermissions`) is not gating it: its URL still opens -([Navigation](./rules/navigation.md#who-sees-or-opens-an-app)). +(`tabPermissions`) is not gating it: its URL still opens. Both, and each item +type's keys: [Navigation](./rules/navigation.md). ### Navigation Item Types @@ -128,8 +129,6 @@ product are `requiredPermissions`-gated groups inside it. Hiding an app | `doc` | Package docs; inherits the docs audience | | `separator` | Visual separator | -Each type's keys: [Navigation](./rules/navigation.md). - ## Actions ### Action Types diff --git a/skills/objectstack-ui/rules/forms.md b/skills/objectstack-ui/rules/forms.md deleted file mode 100644 index db11b66d2c2..00000000000 --- a/skills/objectstack-ui/rules/forms.md +++ /dev/null @@ -1,77 +0,0 @@ -# Form Views & Master-Detail Forms - -`form` and the named `formViews` live in the object's `defineView` container -([List Views](./list-views.md)). Field width, column count and the `sections` -ladder: -[Record Presentation](./navigation.md#record-presentation--surface-width--columns-are-auto-derived). - -## Form Views - -| Type | When to Use | -|:-----|:------------| -| `simple` | Stacked sections on one scrolling page — the default, at any field count | -| `tabbed` | One tab per section — only for sections read apart; a required field on another tab is flagged only on its tab, and the tab strip overflows on a phone | -| `wizard` | Step-by-step flow — guided data entry (onboarding, applications) | - -**A long form stays `simple`: collapse what is rarely filled** with -`collapse: 'collapsed'` on the object's `fieldGroups` entry, or `collapsed: true` -on a form section listing its own `fields`. `columns` (form or section) is a -per-row ceiling a narrow screen lowers; unset, a section draws two, so set `3` -for a wide data-entry form. `modalSize` (`sm` to `full`) sizes the New / Edit -dialog; unset, the field count picks `lg` or `xl`. - -**A public form** is a form view with -`sharing: { enabled: true, allowAnonymous: true, publicLink: 'slug' }`: -Web-to-Lead at `GET/POST /api/v1/forms/:slug`. - -## Master-Detail Forms (parent + child line items) - -To let users enter a record **together with its child line items** (invoice + -lines, project + tasks) and save them **atomically**, you almost never need a -custom page or form config. Prefer, in order: - -1. **Relationship `inlineEdit` (default, zero UI config).** Declare it in the - DATA MODEL — set `inlineEdit` on the child's `master_detail` field that - references the parent. Every standard New/Edit form for the parent (modal, - drawer, full-page) then auto-renders the children and saves parent + children - in one atomic `/api/v1/batch`. **No view metadata needed.** A parent or child - declaring `enable.apiMethods` must list `'bulk'`, or that save is refused - `405 OBJECT_API_METHOD_NOT_ALLOWED`. The - `true` / `'grid'` / `'form'` ladder and what each value picks: - **objectstack-data → Relationships → Inline Editing**. - -2. **Form view `subforms` (override / tuning).** Add to a form view only when you - need to override the derived columns/order, or expose a child the - relationship didn't mark inline: - - ```typescript - form: { - type: 'simple', - sections: [{ group: 'invoice_header' }], // a declared fieldGroup - subforms: [ - { childObject: 'invoice_line', // set `columns` only to override - title: 'Line Items', addLabel: 'Add line' }, - ], - }, - ``` - -3. **`object-master-detail-form` page block (bespoke layout).** Use a page only - for free-form layouts. Same `details: [{ childObject }]` shorthand. - -**Line-item grid behaviors (`grid` mode).** The editable grid is a real -spreadsheet-style line editor, and -every behaviour is derived from the DATA MODEL — computed columns, catalog -typeahead auto-fill, persisted drag-reorder, and the live Subtotal → Tax → Total -stack: **objectstack-data → Relationships → Inline Editing**. Three things are -authored on this side: a trailing **ghost** row always exists, so never add an -"Add line" button to the grid (typing in the ghost materialises a row; an -untouched one is never persisted; a record-header action that inserts a priced -line is [Actions](./actions.md)); `autofill: false` opts one column out of the typeahead copy; -and the form's `taxRateField` overrides which parent field drives the totals. - -## Field Conditional Rules in Forms - -Conditions that belong to a field's lifecycle — `visibleWhen`, `readonlyWhen`, -`requiredWhen` — are declared on the **DATA MODEL field**, not in the form view; -ObjectUI forms consume them. Their semantics and server behaviour: -[objectstack-data → Conditional Field Rules](../../objectstack-data/SKILL.md#conditional-field-rules). diff --git a/skills/objectstack-ui/rules/list-views.md b/skills/objectstack-ui/rules/list-views.md index c69313bf55f..af8144a9345 100644 --- a/skills/objectstack-ui/rules/list-views.md +++ b/skills/objectstack-ui/rules/list-views.md @@ -5,6 +5,7 @@ - [End-User Quick Filters](#end-user-quick-filters-userfilters-adr-0047) · [Toolbar Search](#toolbar-search-searchablefields-adr-0061) - [Configuring Kanban Views](#configuring-kanban-views) - [Configuring Gantt Views](#configuring-gantt-views) +- [Form Views](#form-views) · [Master-Detail Forms](#master-detail-forms-parent--child-line-items) ## Configuring a List View @@ -341,3 +342,79 @@ const timeline: ListView = { Rows with children (or `type: 'summary'`) are **summary bars**: dragged as a group, **no resize handles**. Leaf tasks resize unless `locked: true`. + +--- + +## Form Views + +Field width, column count and the `sections` ladder: +[Record Presentation](./navigation.md#record-presentation--surface-width--columns-are-auto-derived). + +| Type | When to Use | +|:-----|:------------| +| `simple` | Stacked sections on one scrolling page — the default, at any field count | +| `tabbed` | One tab per section — only for sections read apart; a required field on another tab is flagged only on its tab, and the tab strip overflows on a phone | +| `wizard` | Step-by-step flow — guided data entry (onboarding, applications) | + +**A long form stays `simple`: collapse what is rarely filled** with +`collapse: 'collapsed'` on the object's `fieldGroups` entry, or `collapsed: true` +on a form section listing its own `fields`. `columns` (form or section) is a +per-row ceiling a narrow screen lowers; unset, a section draws two, so set `3` +for a wide data-entry form. `modalSize` (`sm` to `full`) sizes the New / Edit +dialog; unset, the field count picks `lg` or `xl`. + +**A public form** is a form view with +`sharing: { enabled: true, allowAnonymous: true, publicLink: 'slug' }`: +Web-to-Lead at `GET/POST /api/v1/forms/:slug`. + +## Master-Detail Forms (parent + child line items) + +To let users enter a record **together with its child line items** (invoice + +lines, project + tasks) and save them **atomically**, you almost never need a +custom page or form config. Prefer, in order: + +1. **Relationship `inlineEdit` (default, zero UI config).** Declare it in the + DATA MODEL — set `inlineEdit` on the child's `master_detail` field that + references the parent. Every standard New/Edit form for the parent (modal, + drawer, full-page) then auto-renders the children and saves parent + children + in one atomic `/api/v1/batch`. **No view metadata needed.** A parent or child + declaring `enable.apiMethods` must list `'bulk'`, or that save is refused + `405 OBJECT_API_METHOD_NOT_ALLOWED`. The + `true` / `'grid'` / `'form'` ladder and what each value picks: + **objectstack-data → Relationships → Inline Editing**. + +2. **Form view `subforms` (override / tuning).** Add to a form view only when you + need to override the derived columns/order, or expose a child the + relationship didn't mark inline: + + ```typescript + form: { + type: 'simple', + sections: [{ group: 'invoice_header' }], // a declared fieldGroup + subforms: [ + { childObject: 'invoice_line', // set `columns` only to override + title: 'Line Items', addLabel: 'Add line' }, + ], + }, + ``` + +3. **`object-master-detail-form` page block (bespoke layout).** Use a page only + for free-form layouts. Same `details: [{ childObject }]` shorthand. + +**Line-item grid behaviors (`grid` mode).** The editable grid is a real +spreadsheet-style line editor, and +every behaviour is derived from the DATA MODEL — computed columns, catalog +typeahead auto-fill, persisted drag-reorder, and the live Subtotal → Tax → Total +stack: **objectstack-data → Relationships → Inline Editing**. Three things are +authored on this side: a trailing **ghost** row always exists, so never add an +"Add line" button to the grid (typing in the ghost materialises a row; an +untouched one is never persisted; a record-header action that inserts a priced +line is [Actions](./actions.md)); `autofill: false` opts one column out of the typeahead copy; +and the form's `taxRateField` overrides which parent field drives the totals. + +## Field Conditional Rules in Forms + +Conditions that belong to a field's lifecycle — `visibleWhen`, `readonlyWhen`, +`requiredWhen` — are declared on the **DATA MODEL field**, not in the form view; +ObjectUI forms consume them. Their semantics and server behaviour: +[objectstack-data → Conditional Field Rules](../../objectstack-data/SKILL.md#conditional-field-rules). From ec50963b9de4de40cb8c382f7922c976ee9f36cc Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Nov 2026 00:50:08 +0000 Subject: [PATCH 3/5] docs(skills): re-lock the objectstack-ui ratchet rows at the router split and add the changeset SKILL.md 3921 -> 2241 tokens (15704 -> 8983 bytes). The receiving rules files rise by the measured bytes moved in: list-views.md 3451 -> 4532, navigation.md 2184 -> 2552, actions.md 2808 -> 3016, dashboards.md 6232 -> 6249; pages.md follows its file down, 5669 -> 5661. Each row's comment names what moved from where. Ratcheted authored total 191238 -> 191236 tokens. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz --- .changeset/34770-skill-router-ui.md | 26 +++++++++ scripts/check-skills-token-ratchet.mjs | 76 ++++++++++++++++++++++++-- 2 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 .changeset/34770-skill-router-ui.md diff --git a/.changeset/34770-skill-router-ui.md b/.changeset/34770-skill-router-ui.md new file mode 100644 index 00000000000..2cedb04bc20 --- /dev/null +++ b/.changeset/34770-skill-router-ui.md @@ -0,0 +1,26 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): objectstack-ui's SKILL.md is a router: first checks, run-time traps, where each rule lives + +Clause-②: no +Metadata-protocol: none + +`skills/objectstack-ui/SKILL.md` goes from 15.7 KB to 9.0 KB and now holds three things. No rule's teaching changes; text moved, and the page says where it went. + +- **First checks.** The installed `@objectstack/spec` version against the skill's `compatibility` line; the object's declaration and the project's own view, app, action and dataset files; the type's contract (`references/_index.md` points at the Zod source in `node_modules/@objectstack/spec/src/`, and a running environment serves the same contract as JSON Schema at `GET /api/v1/meta/types`); `os validate` before reporting done. +- **Seven traps that parse and then fail at run time.** Keep the view kind the request names; a long form stays `simple`; a record with its line items is `inlineEdit` on the child's `master_detail` field (and `enable.apiMethods` must list `'bulk'`); an operation is an `action` whose body calls the API; a persisted chart binds a declared dataset; a filter token is presentation scope, not security; the object declares its record page. +- **Where to go.** One table from the task to the file to open: list views, form views, navigation, record page, actions, dashboards and reports, pages and docs, and the React-tier block contract. + +The Navigation Item Types, Action Types and Report Types tables stay in `SKILL.md`, with the item and action keys behind their homes. + +Where the rest moved, each under its old heading text: + +- `rules/list-views.md` now carries **Form Views** (the three types, the long-form paragraph, the public form), **Master-Detail Forms (parent + child line items)** and **Field Conditional Rules in Forms**, plus the nine list kinds as one sentence and the column-count pitfall under Column Features. +- `rules/navigation.md` opens with `App.create`, the one-App-per-package rule, each navigation item type's keys, `requiresObject` / `requiresService` and the `AppContextSelector` note. +- `rules/actions.md` opens with what an action is, where it is registered, and why a record button needs a placement and a `js` body with `api.write`. +- `rules/dashboards.md` says an omitted widget `layout` auto-flows and `position` is not a widget key. +- `rules/pages.md` points at objectstack-query `rules/filters.md` for relative-date placeholders. + +A reader who linked `SKILL.md#date-macros--filter-placeholders`, `#master-detail-forms-parent--child-line-items`, `#view-types`, `#common-pitfalls` or `#verify-your-work` finds those headings gone from `SKILL.md`: the first is trap 6 and objectstack-query `rules/filters.md`, the second is in `rules/list-views.md`, the rest are the traps and first check 4. diff --git a/scripts/check-skills-token-ratchet.mjs b/scripts/check-skills-token-ratchet.mjs index 0d7cc4e5f80..060990512ad 100644 --- a/scripts/check-skills-token-ratchet.mjs +++ b/scripts/check-skills-token-ratchet.mjs @@ -917,7 +917,25 @@ export const CEILINGS = new Map([ // above; same standing ruling (record 6513306068). 15569 bytes (15549 priced) -> 15704 // (15684 priced) -> 3921 tokens, pinned AT the measurement, zero headroom. // ceil(($(wc -c < skills/objectstack-ui/SKILL.md) - 20) / 4) == ceil(15684 / 4) - ['skills/objectstack-ui/SKILL.md', 3921], + // 3921 -> 2241 (#34770 part 1, the entry file becomes a router; decision record + // 6943107981, S3 = A, whose target reads "a router-sized `SKILL.md` (6–9 KB, at most 500 + // lines)" with "pointers to the contract instead of restated lists"): LOWERED. The entry + // keeps four first checks (the installed version, what the project already has, the + // type's contract, `os validate`), seven traps that parse and then fail at run time, the + // routing table, and the three Leg 2 enumerations `check-skill-identifier-liveness` + // binds to this file by heading (`### Navigation Item Types`, `### Action Types`, + // `## Report Types`). What left, and its home: Form Views, Master-Detail Forms and Field + // Conditional Rules in Forms -> `rules/list-views.md`; the App intro, the one-App-per- + // package paragraph, the nav-item keys column and the `requiresObject` / + // `AppContextSelector` notes -> `rules/navigation.md`; the action intro and the + // placement / write-discarded detail -> `rules/actions.md`; the `layout` auto-flow + // clause -> `rules/dashboards.md`; the list-kind table -> one sentence in + // `rules/list-views.md`. The Detailed Rules list and the CRM blueprint are the routing + // table now, and Verify-your-work is first check 4. 15704 bytes (15684 priced) -> 8983 + // (8963 priced) -> 2241 tokens; the ceiling follows the file down to the measurement, + // the ratchet's ordinary direction. + // ceil(($(wc -c < skills/objectstack-ui/SKILL.md) - 20) / 4) == ceil(8963 / 4) + ['skills/objectstack-ui/SKILL.md', 2241], // 8333 -> 6193: RE-LOCK at the landed count after the #19715 split (decision // batch #213 item 1, maintainer 「1 2 4 同意」): the worked R1, the report // template and the v17-canonical shapes block moved VERBATIM into @@ -1314,7 +1332,20 @@ export const CEILINGS = new Map([ // half carries it: the file is 11106 -> 11231 bytes -> 2808 tokens, zero headroom before, // ceiling +31, pinned AT the measurement. // ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(11231 / 4) - ['skills/objectstack-ui/rules/actions.md', 2808], + // 2808 -> 3016 (#34770 part 1): RECEIVES text the router split moved out of SKILL.md + // § Actions, no new teaching: the two-sentence intro (what an action is, where it is + // registered, a link back to the Action Types table) and the placement / write detail + // the entry's trap 4 no longer spells (`objectName` folds the action into record + // surfaces, `rowActions` / `bulkActions` name it, the two lint codes, why the body is + // `js` and why it declares `api.write`). The file is 11231 -> 12061 bytes (+830) -> 3016 + // tokens, zero headroom before, ceiling +208, pinned AT the measurement. Authority: the + // ruling of record that orders the entry file down to router size, decision record + // 6943107981 S3 = A (this header: a ruling of record that orders text into a file + // authorises its own measured delta), quoted in the PR body beside the standing + // 2026-10-27 ruling 「A:先削重复,余额按实测提高」 (record 6513306068). The seven + // hand-authored objectstack-ui files net -18 bytes across the move (100990 -> 100972). + // ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(12061 / 4) + ['skills/objectstack-ui/rules/actions.md', 3016], // 6090 -> 6252 (#19715, card item 4): a 5-line table of contents at the top, // anchors to the file's existing headings, nothing else changed. +162 tokens, // zero headroom to absorb any of it, ceiling +162. Maintainer ruling @@ -1340,7 +1371,13 @@ export const CEILINGS = new Map([ // `DATASET_INVALID` at compile); paid by the `compareTo` paragraph's restated "no second // widget-side vocabulary" sentence and the `DatasetSchema` source pointer that // `references/_index.md` already carries; 24926 bytes -> 6232 tokens, zero headroom. - ['skills/objectstack-ui/rules/dashboards.md', 6232], + // 6232 -> 6249 (#34770 part 1): RECEIVES one clause from SKILL.md § Common Pitfalls 2 — + // an omitted widget `layout` auto-flows, and `position` is not a widget key (the closed + // schema refuses it by name, which is why the rest of that pitfall left the skill). The + // file is 24928 -> 24993 bytes (+65) -> 6249 tokens, zero headroom before, ceiling +17, + // pinned AT the measurement. Authority as the `rules/actions.md` row above. + // ceil($(wc -c < skills/objectstack-ui/rules/dashboards.md) / 4) == ceil(24993 / 4) + ['skills/objectstack-ui/rules/dashboards.md', 6249], // 3011 -> 3141 (#19715, card item 4): a 5-line table of contents at the top, // anchors to the file's existing headings, nothing else changed. +132 tokens, // of which the row's 2 tokens of headroom absorb 2; the CEILING moves 130. @@ -1369,7 +1406,21 @@ export const CEILINGS = new Map([ // SKILL.md row above: cloud#3659 letter A (6682024726) via record 6513306068, quoted // verbatim in the PR body. // ceil($(wc -c < skills/objectstack-ui/rules/list-views.md) / 4) == ceil(13802 / 4) - ['skills/objectstack-ui/rules/list-views.md', 3451], + // 3451 -> 4532 (#34770 part 1): RECEIVES the form half of SKILL.md § View Types, moved + // whole and no new teaching: `## Form Views` (the three-type table, the long-form + // paragraph, the public-form row of the CRM blueprint as one sentence), `## Master-Detail + // Forms (parent + child line items)` and `## Field Conditional Rules in Forms`, each + // under its SKILL.md heading text; one table-of-contents line for them; the nine list + // kinds as one sentence (was a nine-row table); and Common Pitfalls 1 as one sentence + // under Column Features. This file already teaches the `defineView` container the form + // views live in, so they did not need a file of their own. Dropped on the way, each + // with a home: the "Read side" pointer (the entry's routing table names Record Page) + // and the list-kind table's when-to-use column (the sentence keeps a gloss per kind). + // The file is 13776 -> 18125 bytes (+4349) -> 4532 tokens, the row's 7 tokens of + // headroom absorbed, ceiling +1081, pinned AT the measurement. Authority as the + // `rules/actions.md` row above. + // ceil($(wc -c < skills/objectstack-ui/rules/list-views.md) / 4) == ceil(18125 / 4) + ['skills/objectstack-ui/rules/list-views.md', 4532], // 2273 -> 2196 (#27059): LOWERED. The Surface bullet points at `rules/record-page.md`, // says create / edit is a modal or the `editMode: 'page'` route, and the Overlay-width // bullet moved there whole (the `size` bucket, the deprecated pixel keys); the ceiling @@ -1378,7 +1429,16 @@ export const CEILINGS = new Map([ // list are English (the shipped skill text is English-only), and the bullet's repeated // objectui ADR-0055 citation (the section heading carries it) is gone; the ceiling follows // the file down to the measurement (8734 bytes). - ['skills/objectstack-ui/rules/navigation.md', 2184], + // 2184 -> 2552 (#34770 part 1): RECEIVES SKILL.md § App Navigation, no new teaching: + // the `App.create` / `defineStack({ apps })` sentence, the one-App-per-package paragraph + // whole, the Navigation Item Types table's Properties column as one keys-by-type + // sentence (the type and purpose columns stay in SKILL.md, where the Leg 2 binding + // reads them), the `requiresObject` / `requiresService` callout, and the + // `AppContextSelector` bullet of § Date Macros. The file is 8727 -> 10205 bytes (+1478) + // -> 2552 tokens, the row's 2 tokens of headroom absorbed, ceiling +368, pinned AT the + // measurement. Authority as the `rules/actions.md` row above. + // ceil($(wc -c < skills/objectstack-ui/rules/navigation.md) / 4) == ceil(10205 / 4) + ['skills/objectstack-ui/rules/navigation.md', 2552], // 5501 -> 5692 (#19715, card item 4): a 5-line table of contents at the top, // anchors to the file's existing headings, nothing else changed. +191 tokens, // zero headroom to absorb any of it, ceiling +191. Maintainer ruling @@ -1386,7 +1446,11 @@ export const CEILINGS = new Map([ // 「1 2 4 同意」. // 5692 -> 5669 (#27059): LOWERED. The `tabs`-slot sentence is a one-line pointer at // `rules/record-page.md`; the ceiling follows the file down to the measurement (22673 bytes). - ['skills/objectstack-ui/rules/pages.md', 5669], + // 5669 -> 5661 (#34770 part 1): LOWERED. The variable-substitution note points at the + // owner of the relative-date vocabulary (objectstack-query `rules/filters.md`) in place + // of the SKILL.md § Date Macros anchor the router no longer has; the ceiling follows the + // file down to the measurement (22644 bytes). + ['skills/objectstack-ui/rules/pages.md', 5661], // objectstack-ui `rules/record-page.md` — the sixth rules file, ordered by card #27059 // (record-page epic #26676 child 8, dispatched by ui seat 1 2026-11-01, with the seat's // ruling that the record page gets its own rules file rather than rows in the files From 32fa1759a026a54e473e754d47d36c5ca227151e Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Nov 2026 02:02:15 +0000 Subject: [PATCH 4/5] docs(skills): the ui router keeps List Views and Actions as served sections; the served schema is the parsed shape First check 3 said a running environment serves "the same contract" as JSON Schema. It serves the parsed (output) shape: a defaulted key reads as required and a bare-string predicate as {}. The sentence says so, and the Zod source decides what to write. SKILL.md keeps a `### List Views` section (the nine kinds and the keep-the-kind rule) and puts the write-button rule directly under `## Actions`: the hosted cloud serves both sections by exact heading. Paid inside the file: the restating intro line, the routing lead (now the table header), three glosses and what `os validate` catches moved to rules/navigation.md, rules/actions.md and rules/dashboards.md, where the routing table reaches them. The kinds sentence leaves rules/list-views.md. Ratchet rows at the measurement: SKILL.md 2241 -> 2240, list-views.md 4532 -> 4448, actions.md 3016 -> 3032, dashboards.md 6249 -> 6274, navigation.md 2552 -> 2564. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz --- .changeset/34770-skill-router-ui.md | 12 +-- scripts/check-skills-token-ratchet.mjs | 111 ++++++++++++---------- skills/objectstack-ui/SKILL.md | 81 ++++++++-------- skills/objectstack-ui/rules/actions.md | 2 +- skills/objectstack-ui/rules/dashboards.md | 5 +- skills/objectstack-ui/rules/list-views.md | 6 -- skills/objectstack-ui/rules/navigation.md | 4 +- 7 files changed, 115 insertions(+), 106 deletions(-) diff --git a/.changeset/34770-skill-router-ui.md b/.changeset/34770-skill-router-ui.md index 2cedb04bc20..fa0f8e3857a 100644 --- a/.changeset/34770-skill-router-ui.md +++ b/.changeset/34770-skill-router-ui.md @@ -9,18 +9,18 @@ Metadata-protocol: none `skills/objectstack-ui/SKILL.md` goes from 15.7 KB to 9.0 KB and now holds three things. No rule's teaching changes; text moved, and the page says where it went. -- **First checks.** The installed `@objectstack/spec` version against the skill's `compatibility` line; the object's declaration and the project's own view, app, action and dataset files; the type's contract (`references/_index.md` points at the Zod source in `node_modules/@objectstack/spec/src/`, and a running environment serves the same contract as JSON Schema at `GET /api/v1/meta/types`); `os validate` before reporting done. -- **Seven traps that parse and then fail at run time.** Keep the view kind the request names; a long form stays `simple`; a record with its line items is `inlineEdit` on the child's `master_detail` field (and `enable.apiMethods` must list `'bulk'`); an operation is an `action` whose body calls the API; a persisted chart binds a declared dataset; a filter token is presentation scope, not security; the object declares its record page. +- **First checks.** The installed `@objectstack/spec` version against the skill's `compatibility` line; the object's declaration and the project's own view, app, action and dataset files; the type's contract (`references/_index.md` points at the Zod source in `node_modules/@objectstack/spec/src/`, which decides what to write; a running environment serves the parsed shape as JSON Schema at `GET /api/v1/meta/types`, where a defaulted key reads as required); `os validate` before reporting done. +- **Seven traps that parse and then fail at run time.** A long form stays `simple`; a record with its line items is `inlineEdit` on the child's `master_detail` field (and `enable.apiMethods` must list `'bulk'`); a persisted chart binds a declared dataset; a filter token is presentation scope, not security; the object declares its record page. Two keep their own headings: `List Views` (keep the view kind the request names, with the nine kinds) and `Actions` (an operation is an `action` whose body calls the API). - **Where to go.** One table from the task to the file to open: list views, form views, navigation, record page, actions, dashboards and reports, pages and docs, and the React-tier block contract. The Navigation Item Types, Action Types and Report Types tables stay in `SKILL.md`, with the item and action keys behind their homes. Where the rest moved, each under its old heading text: -- `rules/list-views.md` now carries **Form Views** (the three types, the long-form paragraph, the public form), **Master-Detail Forms (parent + child line items)** and **Field Conditional Rules in Forms**, plus the nine list kinds as one sentence and the column-count pitfall under Column Features. +- `rules/list-views.md` now carries **Form Views** (the three types, the long-form paragraph, the public form), **Master-Detail Forms (parent + child line items)** and **Field Conditional Rules in Forms**, plus the column-count pitfall under Column Features. - `rules/navigation.md` opens with `App.create`, the one-App-per-package rule, each navigation item type's keys, `requiresObject` / `requiresService` and the `AppContextSelector` note. -- `rules/actions.md` opens with what an action is, where it is registered, and why a record button needs a placement and a `js` body with `api.write`. -- `rules/dashboards.md` says an omitted widget `layout` auto-flows and `position` is not a widget key. +- `rules/actions.md` opens with what an action is, where it is registered, and why a record button needs a placement and a `js` body with `api.write`; its `visible` bullet says a bare field ref fails `os validate`. +- `rules/dashboards.md` says an omitted widget `layout` auto-flows, `position` is not a widget key, and a widget binding that resolves to nothing declared fails `os validate`. - `rules/pages.md` points at objectstack-query `rules/filters.md` for relative-date placeholders. -A reader who linked `SKILL.md#date-macros--filter-placeholders`, `#master-detail-forms-parent--child-line-items`, `#view-types`, `#common-pitfalls` or `#verify-your-work` finds those headings gone from `SKILL.md`: the first is trap 6 and objectstack-query `rules/filters.md`, the second is in `rules/list-views.md`, the rest are the traps and first check 4. +A reader who linked `SKILL.md#date-macros--filter-placeholders`, `#master-detail-forms-parent--child-line-items`, `#form-views`, `#common-pitfalls` or `#verify-your-work` finds those headings gone from `SKILL.md`: the first is trap 4 and objectstack-query `rules/filters.md`, the second and third are in `rules/list-views.md`, the rest are the traps and first check 4. diff --git a/scripts/check-skills-token-ratchet.mjs b/scripts/check-skills-token-ratchet.mjs index dbf636d3687..ec4f4fe1251 100644 --- a/scripts/check-skills-token-ratchet.mjs +++ b/scripts/check-skills-token-ratchet.mjs @@ -917,25 +917,27 @@ export const CEILINGS = new Map([ // above; same standing ruling (record 6513306068). 15569 bytes (15549 priced) -> 15704 // (15684 priced) -> 3921 tokens, pinned AT the measurement, zero headroom. // ceil(($(wc -c < skills/objectstack-ui/SKILL.md) - 20) / 4) == ceil(15684 / 4) - // 3921 -> 2241 (#34770 part 1, the entry file becomes a router; decision record + // 3921 -> 2240 (#34770 part 1, the entry file becomes a router; decision record // 6943107981, S3 = A, whose target reads "a router-sized `SKILL.md` (6–9 KB, at most 500 // lines)" with "pointers to the contract instead of restated lists"): LOWERED. The entry // keeps four first checks (the installed version, what the project already has, the - // type's contract, `os validate`), seven traps that parse and then fail at run time, the - // routing table, and the three Leg 2 enumerations `check-skill-identifier-liveness` - // binds to this file by heading (`### Navigation Item Types`, `### Action Types`, + // type's contract, `os validate`), the run-time traps, the routing table, the two + // sections the hosted cloud serves by exact heading (`### List Views`: the nine kinds and + // the keep-the-kind rule; `## Actions`: the write-button rule and the Action Types + // table), and the three Leg 2 enumerations `check-skill-identifier-liveness` binds to + // this file by heading (`### Navigation Item Types`, `### Action Types`, // `## Report Types`). What left, and its home: Form Views, Master-Detail Forms and Field // Conditional Rules in Forms -> `rules/list-views.md`; the App intro, the one-App-per- // package paragraph, the nav-item keys column and the `requiresObject` / // `AppContextSelector` notes -> `rules/navigation.md`; the action intro and the - // placement / write-discarded detail -> `rules/actions.md`; the `layout` auto-flow - // clause -> `rules/dashboards.md`; the list-kind table -> one sentence in - // `rules/list-views.md`. The Detailed Rules list and the CRM blueprint are the routing - // table now, and Verify-your-work is first check 4. 15704 bytes (15684 priced) -> 8983 - // (8963 priced) -> 2241 tokens; the ceiling follows the file down to the measurement, - // the ratchet's ordinary direction. - // ceil(($(wc -c < skills/objectstack-ui/SKILL.md) - 20) / 4) == ceil(8963 / 4) - ['skills/objectstack-ui/SKILL.md', 2241], + // placement / write-discarded detail -> `rules/actions.md`; what `os validate` catches + // (a bare field ref, an unresolved widget binding) -> `rules/actions.md` and + // `rules/dashboards.md`; the `layout` auto-flow clause -> `rules/dashboards.md`. The + // Detailed Rules list and the CRM blueprint are the routing table now. 15704 bytes + // (15684 priced) -> 8978 (8958 priced) -> 2240 tokens; the ceiling follows the file down + // to the measurement, the ratchet's ordinary direction. + // ceil(($(wc -c < skills/objectstack-ui/SKILL.md) - 20) / 4) == ceil(8958 / 4) + ['skills/objectstack-ui/SKILL.md', 2240], // 8333 -> 6193: RE-LOCK at the landed count after the #19715 split (decision // batch #213 item 1, maintainer 「1 2 4 同意」): the worked R1, the report // template and the v17-canonical shapes block moved VERBATIM into @@ -1347,20 +1349,22 @@ export const CEILINGS = new Map([ // half carries it: the file is 11106 -> 11231 bytes -> 2808 tokens, zero headroom before, // ceiling +31, pinned AT the measurement. // ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(11231 / 4) - // 2808 -> 3016 (#34770 part 1): RECEIVES text the router split moved out of SKILL.md - // § Actions, no new teaching: the two-sentence intro (what an action is, where it is + // 2808 -> 3032 (#34770 part 1): RECEIVES text the router split moved out of SKILL.md, + // no new teaching: from § Actions the two-sentence intro (what an action is, where it is // registered, a link back to the Action Types table) and the placement / write detail - // the entry's trap 4 no longer spells (`objectName` folds the action into record - // surfaces, `rowActions` / `bulkActions` name it, the two lint codes, why the body is - // `js` and why it declares `api.write`). The file is 11231 -> 12061 bytes (+830) -> 3016 - // tokens, zero headroom before, ceiling +208, pinned AT the measurement. Authority: the - // ruling of record that orders the entry file down to router size, decision record - // 6943107981 S3 = A (this header: a ruling of record that orders text into a file - // authorises its own measured delta), quoted in the PR body beside the standing - // 2026-10-27 ruling 「A:先削重复,余额按实测提高」 (record 6513306068). The seven - // hand-authored objectstack-ui files net -18 bytes across the move (100990 -> 100972). - // ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(12061 / 4) - ['skills/objectstack-ui/rules/actions.md', 3016], + // the entry's Actions section no longer spells (`objectName` folds the action into + // record surfaces, `rowActions` / `bulkActions` name it, the two lint codes, why the + // body is `js` and why it declares `api.write`); from § Verify your work one clause on + // the `visible` bullet (a bare field ref, `done` for `record.done`, fails + // `os validate`). The file is 11231 -> 12126 bytes (+895) -> 3032 tokens, zero headroom + // before, ceiling +224, pinned AT the measurement. Authority: the ruling of record that + // orders the entry file down to router size, decision record 6943107981 S3 = A (this + // header: a ruling of record that orders text into a file authorises its own measured + // delta), quoted in the PR body beside the standing 2026-10-27 ruling + // 「A:先削重复,余额按实测提高」 (record 6513306068). The seven hand-authored + // objectstack-ui files net -141 bytes across the move (100990 -> 100849). + // ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(12126 / 4) + ['skills/objectstack-ui/rules/actions.md', 3032], // 6090 -> 6252 (#19715, card item 4): a 5-line table of contents at the top, // anchors to the file's existing headings, nothing else changed. +162 tokens, // zero headroom to absorb any of it, ceiling +162. Maintainer ruling @@ -1386,13 +1390,16 @@ export const CEILINGS = new Map([ // `DATASET_INVALID` at compile); paid by the `compareTo` paragraph's restated "no second // widget-side vocabulary" sentence and the `DatasetSchema` source pointer that // `references/_index.md` already carries; 24926 bytes -> 6232 tokens, zero headroom. - // 6232 -> 6249 (#34770 part 1): RECEIVES one clause from SKILL.md § Common Pitfalls 2 — - // an omitted widget `layout` auto-flows, and `position` is not a widget key (the closed - // schema refuses it by name, which is why the rest of that pitfall left the skill). The - // file is 24928 -> 24993 bytes (+65) -> 6249 tokens, zero headroom before, ceiling +17, - // pinned AT the measurement. Authority as the `rules/actions.md` row above. - // ceil($(wc -c < skills/objectstack-ui/rules/dashboards.md) / 4) == ceil(24993 / 4) - ['skills/objectstack-ui/rules/dashboards.md', 6249], + // 6232 -> 6274 (#34770 part 1): RECEIVES two clauses from SKILL.md, no new teaching. + // From § Common Pitfalls 2: an omitted widget `layout` auto-flows, and `position` is not + // a widget key (the closed schema refuses it by name, which is why the rest of that + // pitfall left the skill). From § Verify your work: a widget naming a `dataset` / + // `dimensions` / `values` that resolves to nothing declared (an empty chart) fails + // `os validate`. The file is 24928 -> 25094 bytes (+166) -> 6274 tokens, zero headroom + // before, ceiling +42, pinned AT the measurement. Authority as the `rules/actions.md` + // row above. + // ceil($(wc -c < skills/objectstack-ui/rules/dashboards.md) / 4) == ceil(25094 / 4) + ['skills/objectstack-ui/rules/dashboards.md', 6274], // 3011 -> 3141 (#19715, card item 4): a 5-line table of contents at the top, // anchors to the file's existing headings, nothing else changed. +132 tokens, // of which the row's 2 tokens of headroom absorb 2; the CEILING moves 130. @@ -1421,21 +1428,20 @@ export const CEILINGS = new Map([ // SKILL.md row above: cloud#3659 letter A (6682024726) via record 6513306068, quoted // verbatim in the PR body. // ceil($(wc -c < skills/objectstack-ui/rules/list-views.md) / 4) == ceil(13802 / 4) - // 3451 -> 4532 (#34770 part 1): RECEIVES the form half of SKILL.md § View Types, moved + // 3451 -> 4448 (#34770 part 1): RECEIVES the form half of SKILL.md § View Types, moved // whole and no new teaching: `## Form Views` (the three-type table, the long-form // paragraph, the public-form row of the CRM blueprint as one sentence), `## Master-Detail // Forms (parent + child line items)` and `## Field Conditional Rules in Forms`, each - // under its SKILL.md heading text; one table-of-contents line for them; the nine list - // kinds as one sentence (was a nine-row table); and Common Pitfalls 1 as one sentence - // under Column Features. This file already teaches the `defineView` container the form - // views live in, so they did not need a file of their own. Dropped on the way, each - // with a home: the "Read side" pointer (the entry's routing table names Record Page) - // and the list-kind table's when-to-use column (the sentence keeps a gloss per kind). - // The file is 13776 -> 18125 bytes (+4349) -> 4532 tokens, the row's 7 tokens of - // headroom absorbed, ceiling +1081, pinned AT the measurement. Authority as the - // `rules/actions.md` row above. - // ceil($(wc -c < skills/objectstack-ui/rules/list-views.md) / 4) == ceil(18125 / 4) - ['skills/objectstack-ui/rules/list-views.md', 4532], + // under its SKILL.md heading text; one table-of-contents line for them; and Common + // Pitfalls 1 as one sentence under Column Features. This file already teaches the + // `defineView` container the form views live in, so they did not need a file of their + // own. The list half stays in SKILL.md under `### List Views`, the section the hosted + // cloud serves by that heading. Dropped on the way, with a home: the "Read side" pointer + // (the entry's routing table names Record Page). The file is 13776 -> 17790 bytes + // (+4014) -> 4448 tokens, the row's 7 tokens of headroom absorbed, ceiling +997, pinned + // AT the measurement. Authority as the `rules/actions.md` row above. + // ceil($(wc -c < skills/objectstack-ui/rules/list-views.md) / 4) == ceil(17790 / 4) + ['skills/objectstack-ui/rules/list-views.md', 4448], // 2273 -> 2196 (#27059): LOWERED. The Surface bullet points at `rules/record-page.md`, // says create / edit is a modal or the `editMode: 'page'` route, and the Overlay-width // bullet moved there whole (the `size` bucket, the deprecated pixel keys); the ceiling @@ -1444,16 +1450,17 @@ export const CEILINGS = new Map([ // list are English (the shipped skill text is English-only), and the bullet's repeated // objectui ADR-0055 citation (the section heading carries it) is gone; the ceiling follows // the file down to the measurement (8734 bytes). - // 2184 -> 2552 (#34770 part 1): RECEIVES SKILL.md § App Navigation, no new teaching: + // 2184 -> 2564 (#34770 part 1): RECEIVES SKILL.md § App Navigation, no new teaching: // the `App.create` / `defineStack({ apps })` sentence, the one-App-per-package paragraph // whole, the Navigation Item Types table's Properties column as one keys-by-type - // sentence (the type and purpose columns stay in SKILL.md, where the Leg 2 binding - // reads them), the `requiresObject` / `requiresService` callout, and the - // `AppContextSelector` bullet of § Date Macros. The file is 8727 -> 10205 bytes (+1478) - // -> 2552 tokens, the row's 2 tokens of headroom absorbed, ceiling +368, pinned AT the - // measurement. Authority as the `rules/actions.md` row above. - // ceil($(wc -c < skills/objectstack-ui/rules/navigation.md) / 4) == ceil(10205 / 4) - ['skills/objectstack-ui/rules/navigation.md', 2552], + // sentence with the `componentRef` registry-key gloss (the type and purpose columns stay + // in SKILL.md, where the Leg 2 binding reads them), the `requiresObject` / + // `requiresService` callout, and the `AppContextSelector` bullet of § Date Macros. The + // file is 8727 -> 10256 bytes (+1529) -> 2564 tokens, the row's 2 tokens of headroom + // absorbed, ceiling +380, pinned AT the measurement. Authority as the `rules/actions.md` + // row above. + // ceil($(wc -c < skills/objectstack-ui/rules/navigation.md) / 4) == ceil(10256 / 4) + ['skills/objectstack-ui/rules/navigation.md', 2564], // 5501 -> 5692 (#19715, card item 4): a 5-line table of contents at the top, // anchors to the file's existing headings, nothing else changed. +191 tokens, // zero headroom to absorb any of it, ceiling +191. Maintainer ruling diff --git a/skills/objectstack-ui/SKILL.md b/skills/objectstack-ui/SKILL.md index 1837d87e225..614fcf2a9c5 100644 --- a/skills/objectstack-ui/SKILL.md +++ b/skills/objectstack-ui/SKILL.md @@ -25,8 +25,6 @@ metadata: # UI Design — ObjectStack UI Protocol -This page routes; keys and option lists live in the contract (first check 3). - ## First checks 1. **Version.** This skill targets the `@objectstack/spec` major in its @@ -38,65 +36,47 @@ This page routes; keys and option lists live in the contract (first check 3). go). Add beside what is there; reuse a declared dataset, field group or view. 3. **Read the type's contract.** [references/_index.md](./references/_index.md) points at each type's Zod source in `node_modules/@objectstack/spec/src/`. - `Read` it for exact keys, enum members and refusals; do not rely on memory - of property names. A running environment serves the same contract as JSON - Schema: `GET /api/v1/meta/types`, `entries[].schema`. + `Read` it for exact keys, enum members and refusals, never from memory: it + decides what to write. A running environment serves the parsed shape as + JSON Schema (`GET /api/v1/meta/types`, `entries[].schema`): a defaulted + key reads as required and a bare-string predicate as `{}`. 4. **Verify before reporting done.** `os validate` (`npm run validate` in a - scaffolded project; `os build` runs the same gates). It catches a bare field - ref in a predicate (`done` for `record.done`) and a widget `dataset` / - `dimensions` / `values` that resolves to nothing declared (an empty chart). - The traps below pass it. + scaffolded project; `os build` runs the same gates). The traps below pass + it. ## Traps — each parses, then fails at run time -1. **Keep the view kind the request names.** A photo wall, card wall or - catalogue of covers is `gallery` (an image, avatar or file field as - `gallery.coverField`), a schedule or timeline over a start/end date pair is - `gantt`, a board is `kanban`; never downgrade a named kind to `grid`: the - file parses and the user opens a table. "Add a board" is a NEW `listViews` - entry, never `list` retyped, and a board over a field added in the same - change opens empty: - [List Views](./rules/list-views.md#adding-a-board-calendar-gallery-or-gantt-beside-the-list). -2. **A long form stays `simple`**: collapse what is rarely filled and size it +Two more: [List Views](#list-views), [Actions](#actions). + +1. **A long form stays `simple`**: collapse what is rarely filled and size it with `columns` and `modalSize`. `tabbed` flags a required field only on its own tab and overflows on a phone ([Form Views](./rules/list-views.md#form-views)). -3. **A record entered with its line items is `inlineEdit` on the child's +2. **A record entered with its line items is `inlineEdit` on the child's `master_detail` field**, before any custom page, and its grid needs no "Add line" button. A parent or child declaring `enable.apiMethods` must list `'bulk'`, or the save is refused `405` ([Master-Detail Forms](./rules/list-views.md#master-detail-forms-parent--child-line-items)). -4. **An operation is an `action`, never a view, and a write button must - write.** "Mark as done", "approve", "set status to X" is `defineAction` with - `objectName` and `locations`; with neither `locations` nor a view naming it, - it renders nowhere. `ctx.record` is a read-only snapshot and the body's - return value is applied to nothing: a body that returns or assigns the new - values reports success and changes nothing. Call the API: - `type: 'script'`, - `body: { language: 'js', source: "await ctx.api.object('task').update({ id: ctx.recordId, status: 'done' });", capabilities: ['api.write'] }`, - with the option `value`, never its label ([Actions](./rules/actions.md)). -5. **A persisted chart binds a declared dataset.** A widget or report names a +3. **A persisted chart binds a declared dataset.** A widget or report names a `defineDataset` and selects its `dimensions` / `values` by name; an object without one has no analytics face. A dataset is narrow: a window, a to-many rollup or a computed dimension is a stored field or app code, never forced into one; an ad-hoc chart in a `kind: 'react'` page needs none. Read [Dashboards](./rules/dashboards.md#dataset-bound-widgets) before writing any widget, dataset or chart. -6. **A filter token is presentation scope, not security.** `{current_user_id}`, +4. **A filter token is presentation scope, not security.** `{current_user_id}`, `{today}` and the rest (vocabulary: objectstack-query → `rules/filters.md`, load it before writing one; an unrecognised token is a build error) decide what a surface *shows*; RLS decides what a caller may *read*. Such a filter must never be what keeps a user from someone else's data. -7. **The object declares its record page.** Related lists, their order and +5. **The object declares its record page.** Related lists, their order and filter are flags on the object and its fields, not a page file; how a record opens is one list-view key, and the reader's own display choices are never metadata ([Record Page](./rules/record-page.md)). ## Where to go -Open the file before writing: the rules and examples are there. - -| Authoring | In | Open | +| Authoring | In | Open first | |:--|:--|:--| | A list, board, calendar, gallery or gantt: columns, `filter`, quick filters, toolbar search, sorting, grouping | `src/views/*.view.ts` | [List Views](./rules/list-views.md) | | A form (`simple` / `tabbed` / `wizard`), master-detail (a parent with line items), a public form, field conditional rules | `src/views/*.view.ts` | [Form Views](./rules/list-views.md#form-views) | @@ -107,6 +87,24 @@ Open the file before writing: the rules and examples are there. | A page (regions, components, print, `kind: 'html'` / `'react'` source, styling) or package docs | `*.page.ts`, `src/docs/*.md` | [Pages & Docs](./rules/pages.md) | | The props of a block in a `kind: 'react'` page | | [react-blocks.md](./references/react-blocks.md) | +## View Types + +### List Views + +A list view's `type`: `grid` (the default table), `kanban` (a board by status), +`gallery` (cards over an image, avatar or file field), `calendar`, `timeline` +(a chronological stream), `gantt` (start/end bars with dependencies), `map` +(`location` fields), `chart` (an aggregate over the object), `tree` (a +self-referencing hierarchy). + +**Keep the kind the request names.** A photo wall, card wall or catalogue of +covers is `gallery` (an image, avatar or file field as `gallery.coverField`), +a schedule or timeline over a start/end date pair is `gantt`, a board is +`kanban`; never downgrade a named kind to `grid`: the file parses and the user +opens a table. "Add a board" is a NEW `listViews` entry, never `list` retyped, +and a board over a field added in the same change opens empty: +[List Views](./rules/list-views.md#adding-a-board-calendar-gallery-or-gantt-beside-the-list). + ## App Navigation One App per package: `defineStack` refuses a second, so audiences sharing a @@ -121,16 +119,25 @@ type's keys: [Navigation](./rules/navigation.md). | `group` | Collapsible group of items | | `object` | An object list, a named view, a record deep-link, or a `filters` slice | | `dashboard` | A dashboard | -| `report` | A report; no `reportName` = the app's report index | +| `report` | A report | | `page` | A custom Page | | `url` | External or custom URL | | `action` | Run an action instead of navigating | -| `component` | Built-in platform component; `componentRef` is a colon-joined registry key (`metadata:resource`) | -| `doc` | Package docs; inherits the docs audience | +| `component` | Built-in platform component | +| `doc` | Package docs | | `separator` | Visual separator | ## Actions +**An operation is an `action`, never a view, and a write button must write.** +"Mark as done", "approve", "set status to X" is `defineAction` with +`objectName` and `locations`; with neither `locations` nor a view naming it, +it renders nowhere. `ctx.record` is a read-only snapshot and the body's return +value is applied to nothing: a body that returns or assigns the new values +reports success and changes nothing. Call the API: `type: 'script'`, +`body: { language: 'js', source: "await ctx.api.object('task').update({ id: ctx.recordId, status: 'done' });", capabilities: ['api.write'] }`, +with the option `value`, never its label ([Actions](./rules/actions.md)). + ### Action Types | `type` | Purpose | diff --git a/skills/objectstack-ui/rules/actions.md b/skills/objectstack-ui/rules/actions.md index 27f5120771c..9dedf8ce52e 100644 --- a/skills/objectstack-ui/rules/actions.md +++ b/skills/objectstack-ui/rules/actions.md @@ -27,7 +27,7 @@ I/O, with `capabilities: ['api.write']`, because the sandbox throws on ## Visibility, Disable & Feedback -- `visible` — a bare CEL predicate over the current record (prefer the `P\`...\`` template; `record.` resolves identically on every surface, never `${…}`- or `{…}`-wrapped — see `objectstack-formula`); when false the action is **hidden**. +- `visible` — a bare CEL predicate over the current record (prefer the `P\`...\`` template; `record.` resolves identically on every surface, never `${…}`- or `{…}`-wrapped — see `objectstack-formula`; a bare field ref, `done` for `record.done`, fails `os validate`); when false the action is **hidden**. - `disabled` — `boolean` **or** a CEL predicate; when true the action **shows but greys out**. - `disabledReason` — an I18nLabel (a sentence or an inline locale map) a greyed action shows as its hover title and accessible description. Display-only: never a predicate and never a gate (the hook or permission still refuses). Omit it to keep the console's default "Not available for this record"; a blank one is refused, and `disabledMessage` / `disabledTooltip` / `disabledHint` / `disabledText` are refused naming this key. The reason goes here, not in `description`. - `pressed` — a CEL predicate over the same scope as `visible` that marks the action as already done by this reader: while TRUE the record header draws it pressed (`aria-pressed`). Display-only, never a gate; a boolean literal is refused (a constant is a style, not a reader's state), and `active` / `activeWhen` / `pressedWhen` are refused naming this key. A per-reader fact (the reader's vote) is a block the object declares under `attachedOnRead`, filled per caller by a service or `afterFind` hook, read as `has(record.viewer) && record.viewer.vote == 'helpful'`. diff --git a/skills/objectstack-ui/rules/dashboards.md b/skills/objectstack-ui/rules/dashboards.md index c4de0b71de4..9ad6649b065 100644 --- a/skills/objectstack-ui/rules/dashboards.md +++ b/skills/objectstack-ui/rules/dashboards.md @@ -37,8 +37,9 @@ dashboard widget, a report, and a list `type:'chart'` view all **bind a `dataset and select named `dimensions` + `values`**; the dataset owns the base object, allowed joins, intrinsic filter, dimensions, and certified measures. A widget **requires `dataset` + `values`**; the closed schema rejects `object` / -`categoryField` / `valueField` / `aggregate` by name, and one lacking `dataset` -fails `os validate`. +`categoryField` / `valueField` / `aggregate` by name, and one lacking `dataset`, +or naming a `dataset` / `dimensions` / `values` that resolves to nothing +declared (an empty chart), fails `os validate`. A widget's presentation-scope `filter` flows into the query as the runtime filter; keep `filter` on the widget when binding a dataset. diff --git a/skills/objectstack-ui/rules/list-views.md b/skills/objectstack-ui/rules/list-views.md index af8144a9345..ff5e666d98d 100644 --- a/skills/objectstack-ui/rules/list-views.md +++ b/skills/objectstack-ui/rules/list-views.md @@ -9,12 +9,6 @@ ## Configuring a List View -A list view's `type`: `grid` (the default table), `kanban` (a board by status), -`gallery` (cards over an image, avatar or file field), `calendar`, `timeline` -(a chronological stream), `gantt` (start/end bars with dependencies), `map` -(`location` fields), `chart` (an aggregate over the object), `tree` (a -self-referencing hierarchy). - ### The `defineView` container (`*.view.ts` file shape) Views ship **inside a `defineView` container** — one per object, aggregating diff --git a/skills/objectstack-ui/rules/navigation.md b/skills/objectstack-ui/rules/navigation.md index addb77099d8..32e244a77b3 100644 --- a/skills/objectstack-ui/rules/navigation.md +++ b/skills/objectstack-ui/rules/navigation.md @@ -17,8 +17,8 @@ Keys by item type ([the ten types](../SKILL.md#navigation-item-types); each takes `label`, `icon`): `group` `expanded`, `children[]`; `object` `objectName`, `viewName?`, `recordId?`, `filters?`; `dashboard` `dashboardName`; `report` `reportName?`; `page` `pageName`; `url` `url`; -`action` `actionDef` (`{ actionName, params? }`); `component` `componentRef`, -`params?`; `doc` `book?` / `doc?` (one required). +`action` `actionDef` (`{ actionName, params? }`); `component` `componentRef` +(a colon-joined registry key, `metadata:resource`), `params?`; `doc` `book?` / `doc?` (one required). > **`requiresObject` / `requiresService`** hide an item whose optional > system object or kernel service is missing — never hard-code conditional UI. From 7fe6fb7ade48667184a0522aaf0e3b47e9453b56 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Nov 2026 02:25:07 +0000 Subject: [PATCH 5/5] docs(skills): the ui router's review fixes: separator takes no label, validate catches one trap, two clauses restored rules/navigation.md said every nav item type takes `label` and `icon`; `separator` is a strict {type, id, order} and rejects both. The keys sentence says so. SKILL.md: first check 4 says most traps pass `os validate` (the persisted-chart trap does not); the routing table files form width, columns and `sections` on the Form Views row, which owns them. rules/actions.md: the bare-field-ref rule covers `disabled` as well as `visible`, and a parameterized bulk mutation is `script`; both clauses were on main and had been dropped. Paid inside the file. The changeset points the old #common-pitfalls anchor at rules/list-views.md and rules/dashboards.md. Ratchet rows, none raised: SKILL.md 2240 -> 2239, actions.md 3032 -> 3031, navigation.md stays 2564. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufziunkXbDT7wUWqfmWz --- .changeset/34770-skill-router-ui.md | 6 ++--- scripts/check-skills-token-ratchet.mjs | 32 ++++++++++++----------- skills/objectstack-ui/SKILL.md | 6 ++--- skills/objectstack-ui/rules/actions.md | 21 ++++++++------- skills/objectstack-ui/rules/navigation.md | 9 ++++--- 5 files changed, 39 insertions(+), 35 deletions(-) diff --git a/.changeset/34770-skill-router-ui.md b/.changeset/34770-skill-router-ui.md index fa0f8e3857a..c7c94e25ccc 100644 --- a/.changeset/34770-skill-router-ui.md +++ b/.changeset/34770-skill-router-ui.md @@ -18,9 +18,9 @@ The Navigation Item Types, Action Types and Report Types tables stay in `SKILL.m Where the rest moved, each under its old heading text: - `rules/list-views.md` now carries **Form Views** (the three types, the long-form paragraph, the public form), **Master-Detail Forms (parent + child line items)** and **Field Conditional Rules in Forms**, plus the column-count pitfall under Column Features. -- `rules/navigation.md` opens with `App.create`, the one-App-per-package rule, each navigation item type's keys, `requiresObject` / `requiresService` and the `AppContextSelector` note. -- `rules/actions.md` opens with what an action is, where it is registered, and why a record button needs a placement and a `js` body with `api.write`; its `visible` bullet says a bare field ref fails `os validate`. +- `rules/navigation.md` opens with `App.create`, the one-App-per-package rule, each navigation item type's keys (`label` and `icon` on every type but `separator`), `requiresObject` / `requiresService` and the `AppContextSelector` note. +- `rules/actions.md` opens with what an action is, where it is registered, and why a record button needs a placement and a `js` body with `api.write`; a bare field ref in `visible` or `disabled` fails `os validate`, and a parameterized bulk mutation is `script`. - `rules/dashboards.md` says an omitted widget `layout` auto-flows, `position` is not a widget key, and a widget binding that resolves to nothing declared fails `os validate`. - `rules/pages.md` points at objectstack-query `rules/filters.md` for relative-date placeholders. -A reader who linked `SKILL.md#date-macros--filter-placeholders`, `#master-detail-forms-parent--child-line-items`, `#form-views`, `#common-pitfalls` or `#verify-your-work` finds those headings gone from `SKILL.md`: the first is trap 4 and objectstack-query `rules/filters.md`, the second and third are in `rules/list-views.md`, the rest are the traps and first check 4. +A reader who linked `SKILL.md#date-macros--filter-placeholders`, `#master-detail-forms-parent--child-line-items`, `#form-views`, `#common-pitfalls` or `#verify-your-work` finds those headings gone from `SKILL.md`: the first is trap 4 and objectstack-query `rules/filters.md`; the second and third are in `rules/list-views.md`; `#common-pitfalls` is in `rules/list-views.md` (Column Features) and `rules/dashboards.md`; `#verify-your-work` is first check 4, with what the gate catches in `rules/actions.md` and `rules/dashboards.md`. diff --git a/scripts/check-skills-token-ratchet.mjs b/scripts/check-skills-token-ratchet.mjs index ec4f4fe1251..8c2a1fef0c5 100644 --- a/scripts/check-skills-token-ratchet.mjs +++ b/scripts/check-skills-token-ratchet.mjs @@ -917,7 +917,7 @@ export const CEILINGS = new Map([ // above; same standing ruling (record 6513306068). 15569 bytes (15549 priced) -> 15704 // (15684 priced) -> 3921 tokens, pinned AT the measurement, zero headroom. // ceil(($(wc -c < skills/objectstack-ui/SKILL.md) - 20) / 4) == ceil(15684 / 4) - // 3921 -> 2240 (#34770 part 1, the entry file becomes a router; decision record + // 3921 -> 2239 (#34770 part 1, the entry file becomes a router; decision record // 6943107981, S3 = A, whose target reads "a router-sized `SKILL.md` (6–9 KB, at most 500 // lines)" with "pointers to the contract instead of restated lists"): LOWERED. The entry // keeps four first checks (the installed version, what the project already has, the @@ -934,10 +934,10 @@ export const CEILINGS = new Map([ // (a bare field ref, an unresolved widget binding) -> `rules/actions.md` and // `rules/dashboards.md`; the `layout` auto-flow clause -> `rules/dashboards.md`. The // Detailed Rules list and the CRM blueprint are the routing table now. 15704 bytes - // (15684 priced) -> 8978 (8958 priced) -> 2240 tokens; the ceiling follows the file down + // (15684 priced) -> 8974 (8954 priced) -> 2239 tokens; the ceiling follows the file down // to the measurement, the ratchet's ordinary direction. - // ceil(($(wc -c < skills/objectstack-ui/SKILL.md) - 20) / 4) == ceil(8958 / 4) - ['skills/objectstack-ui/SKILL.md', 2240], + // ceil(($(wc -c < skills/objectstack-ui/SKILL.md) - 20) / 4) == ceil(8954 / 4) + ['skills/objectstack-ui/SKILL.md', 2239], // 8333 -> 6193: RE-LOCK at the landed count after the #19715 split (decision // batch #213 item 1, maintainer 「1 2 4 同意」): the worked R1, the report // template and the v17-canonical shapes block moved VERBATIM into @@ -1349,22 +1349,23 @@ export const CEILINGS = new Map([ // half carries it: the file is 11106 -> 11231 bytes -> 2808 tokens, zero headroom before, // ceiling +31, pinned AT the measurement. // ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(11231 / 4) - // 2808 -> 3032 (#34770 part 1): RECEIVES text the router split moved out of SKILL.md, + // 2808 -> 3031 (#34770 part 1): RECEIVES text the router split moved out of SKILL.md, // no new teaching: from § Actions the two-sentence intro (what an action is, where it is // registered, a link back to the Action Types table) and the placement / write detail // the entry's Actions section no longer spells (`objectName` folds the action into // record surfaces, `rowActions` / `bulkActions` name it, the two lint codes, why the - // body is `js` and why it declares `api.write`); from § Verify your work one clause on - // the `visible` bullet (a bare field ref, `done` for `record.done`, fails - // `os validate`). The file is 11231 -> 12126 bytes (+895) -> 3032 tokens, zero headroom - // before, ceiling +224, pinned AT the measurement. Authority: the ruling of record that + // body is `js` and why it declares `api.write`); from § Verify your work one sentence + // on the `disabled` bullet (a bare field ref in `visible` or `disabled`, `done` for + // `record.done`, fails `os validate`); from the CRM blueprint's User actions row, that a + // parameterized bulk mutation is `script`. The file is 11231 -> 12123 bytes (+892) -> + // 3031 tokens, zero headroom before, ceiling +223, pinned AT the measurement. Authority: the ruling of record that // orders the entry file down to router size, decision record 6943107981 S3 = A (this // header: a ruling of record that orders text into a file authorises its own measured // delta), quoted in the PR body beside the standing 2026-10-27 ruling // 「A:先削重复,余额按实测提高」 (record 6513306068). The seven hand-authored - // objectstack-ui files net -141 bytes across the move (100990 -> 100849). - // ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(12126 / 4) - ['skills/objectstack-ui/rules/actions.md', 3032], + // objectstack-ui files net -149 bytes across the move (100990 -> 100841). + // ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(12123 / 4) + ['skills/objectstack-ui/rules/actions.md', 3031], // 6090 -> 6252 (#19715, card item 4): a 5-line table of contents at the top, // anchors to the file's existing headings, nothing else changed. +162 tokens, // zero headroom to absorb any of it, ceiling +162. Maintainer ruling @@ -1453,13 +1454,14 @@ export const CEILINGS = new Map([ // 2184 -> 2564 (#34770 part 1): RECEIVES SKILL.md § App Navigation, no new teaching: // the `App.create` / `defineStack({ apps })` sentence, the one-App-per-package paragraph // whole, the Navigation Item Types table's Properties column as one keys-by-type - // sentence with the `componentRef` registry-key gloss (the type and purpose columns stay + // sentence (`label` and `icon` on every type but `separator`, as that column had it) + // with the `componentRef` registry-key gloss (the type and purpose columns stay // in SKILL.md, where the Leg 2 binding reads them), the `requiresObject` / // `requiresService` callout, and the `AppContextSelector` bullet of § Date Macros. The - // file is 8727 -> 10256 bytes (+1529) -> 2564 tokens, the row's 2 tokens of headroom + // file is 8727 -> 10255 bytes (+1528) -> 2564 tokens, the row's 2 tokens of headroom // absorbed, ceiling +380, pinned AT the measurement. Authority as the `rules/actions.md` // row above. - // ceil($(wc -c < skills/objectstack-ui/rules/navigation.md) / 4) == ceil(10256 / 4) + // ceil($(wc -c < skills/objectstack-ui/rules/navigation.md) / 4) == ceil(10255 / 4) ['skills/objectstack-ui/rules/navigation.md', 2564], // 5501 -> 5692 (#19715, card item 4): a 5-line table of contents at the top, // anchors to the file's existing headings, nothing else changed. +191 tokens, diff --git a/skills/objectstack-ui/SKILL.md b/skills/objectstack-ui/SKILL.md index 614fcf2a9c5..b8413811154 100644 --- a/skills/objectstack-ui/SKILL.md +++ b/skills/objectstack-ui/SKILL.md @@ -41,7 +41,7 @@ metadata: JSON Schema (`GET /api/v1/meta/types`, `entries[].schema`): a defaulted key reads as required and a bare-string predicate as `{}`. 4. **Verify before reporting done.** `os validate` (`npm run validate` in a - scaffolded project; `os build` runs the same gates). The traps below pass + scaffolded project; `os build` runs the same gates). Most traps below pass it. ## Traps — each parses, then fails at run time @@ -79,8 +79,8 @@ Two more: [List Views](#list-views), [Actions](#actions). | Authoring | In | Open first | |:--|:--|:--| | A list, board, calendar, gallery or gantt: columns, `filter`, quick filters, toolbar search, sorting, grouping | `src/views/*.view.ts` | [List Views](./rules/list-views.md) | -| A form (`simple` / `tabbed` / `wizard`), master-detail (a parent with line items), a public form, field conditional rules | `src/views/*.view.ts` | [Form Views](./rules/list-views.md#form-views) | -| An app and its navigation; who sees or opens it; object nav, a `filters` slice or an interface page; form width, columns and `sections` | `src/apps/*.app.ts` | [Navigation](./rules/navigation.md) | +| A form (`simple` / `tabbed` / `wizard`): width, columns and `sections`; master-detail (a parent with line items), a public form, field conditional rules | `src/views/*.view.ts` | [Form Views](./rules/list-views.md#form-views) | +| An app and its navigation; who sees or opens it; object nav, a `filters` slice or an interface page | `src/apps/*.app.ts` | [Navigation](./rules/navigation.md) | | What a record page shows: related lists, a slotted or full page, drawer or page | the object | [Record Page](./rules/record-page.md) | | A button or operation: `locations`, visibility, dialog and toast copy, params, new tab, the body's `ctx` | `src/actions/*.actions.ts` | [Actions](./rules/actions.md) | | A number, chart, KPI or report over records: datasets, widgets, dashboard filters, `compareTo`, date bucketing, drilldown, cubes | `src/datasets/*.dataset.ts`, `src/dashboards/*.dashboard.ts`, `src/reports/*.report.ts` | [Dashboards](./rules/dashboards.md) | diff --git a/skills/objectstack-ui/rules/actions.md b/skills/objectstack-ui/rules/actions.md index 9dedf8ce52e..6da87a0d9fc 100644 --- a/skills/objectstack-ui/rules/actions.md +++ b/skills/objectstack-ui/rules/actions.md @@ -1,18 +1,19 @@ # Actions Actions are user-triggered operations attached to an object or a view. -Register them under `defineStack({ actions: [...] })`; the six `type` values: -[Action Types](../SKILL.md#action-types). +Register them under `defineStack({ actions: [...] })`; the six types: +[Action Types](../SKILL.md#action-types). A parameterized bulk mutation is +`script`. **A record button needs a placement and a body that writes.** `objectName` folds the action into that object's record surfaces; with neither `locations` nor a view naming it in `rowActions` / `bulkActions` it renders nowhere -(`action-no-placement`). A body that only returns the new values or assigns to -`ctx.record` changes nothing and still reports success -(`action-record-write-discarded`): it calls `ctx.api.object(...).update(...)` -in `language: 'js'`, because an `expression` body is a pure formula with no -I/O, with `capabilities: ['api.write']`, because the sandbox throws on -`ctx.api…update` / `insert` / `delete` without it. +(`action-no-placement`). A body that returns or assigns the new values writes +nothing (`action-record-write-discarded`): it calls +`ctx.api.object(...).update(...)` in `language: 'js'`, because an `expression` +body is a pure formula with no I/O, with `capabilities: ['api.write']`, +because the sandbox throws on `ctx.api…update` / `insert` / `delete` without +it. ## Where Actions Appear (`locations`) @@ -27,8 +28,8 @@ I/O, with `capabilities: ['api.write']`, because the sandbox throws on ## Visibility, Disable & Feedback -- `visible` — a bare CEL predicate over the current record (prefer the `P\`...\`` template; `record.` resolves identically on every surface, never `${…}`- or `{…}`-wrapped — see `objectstack-formula`; a bare field ref, `done` for `record.done`, fails `os validate`); when false the action is **hidden**. -- `disabled` — `boolean` **or** a CEL predicate; when true the action **shows but greys out**. +- `visible` — a bare CEL predicate over the current record (prefer the `P\`...\`` template; `record.` resolves identically on every surface, never `${…}`- or `{…}`-wrapped — see `objectstack-formula`); when false the action is **hidden**. +- `disabled` — `boolean` **or** a CEL predicate; when true the action **shows but greys out**. A bare field ref in either (`done` for `record.done`) fails `os validate`. - `disabledReason` — an I18nLabel (a sentence or an inline locale map) a greyed action shows as its hover title and accessible description. Display-only: never a predicate and never a gate (the hook or permission still refuses). Omit it to keep the console's default "Not available for this record"; a blank one is refused, and `disabledMessage` / `disabledTooltip` / `disabledHint` / `disabledText` are refused naming this key. The reason goes here, not in `description`. - `pressed` — a CEL predicate over the same scope as `visible` that marks the action as already done by this reader: while TRUE the record header draws it pressed (`aria-pressed`). Display-only, never a gate; a boolean literal is refused (a constant is a style, not a reader's state), and `active` / `activeWhen` / `pressedWhen` are refused naming this key. A per-reader fact (the reader's vote) is a block the object declares under `attachedOnRead`, filled per caller by a service or `afterFind` hook, read as `has(record.viewer) && record.viewer.vote == 'helpful'`. - `confirmText` — set for any destructive or irreversible operation; the confirm dialog of a param-less action. A registered action is refused it beside a non-empty `params` (put the question on `description`); a view's `bulkActionDefs` entry pairs the two by its own contract. diff --git a/skills/objectstack-ui/rules/navigation.md b/skills/objectstack-ui/rules/navigation.md index 32e244a77b3..22ecb750e17 100644 --- a/skills/objectstack-ui/rules/navigation.md +++ b/skills/objectstack-ui/rules/navigation.md @@ -13,12 +13,13 @@ its own package id; a flat composition puts them under one and is refused. Audiences sharing one product and its objects stay `requiredPermissions`-gated groups **inside** one app. -Keys by item type ([the ten types](../SKILL.md#navigation-item-types); each -takes `label`, `icon`): `group` `expanded`, `children[]`; `object` +Keys by type ([the ten](../SKILL.md#navigation-item-types); `label`, `icon` +on all but `separator`): `group` `expanded`, `children[]`; `object` `objectName`, `viewName?`, `recordId?`, `filters?`; `dashboard` `dashboardName`; `report` `reportName?`; `page` `pageName`; `url` `url`; -`action` `actionDef` (`{ actionName, params? }`); `component` `componentRef` -(a colon-joined registry key, `metadata:resource`), `params?`; `doc` `book?` / `doc?` (one required). +`action` `actionDef` (`{actionName, params?}`); `component` `componentRef` +(a colon-joined registry key, `metadata:resource`), `params?`; `doc` `book?` / +`doc?` (one required). > **`requiresObject` / `requiresService`** hide an item whose optional > system object or kernel service is missing — never hard-code conditional UI.