diff --git a/.changeset/36628-36611-skills-object-colour-create-forms.md b/.changeset/36628-36611-skills-object-colour-create-forms.md new file mode 100644 index 00000000000..129a622b3a3 --- /dev/null +++ b/.changeset/36628-36611-skills-object-colour-create-forms.md @@ -0,0 +1,12 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): the data skill picks an object's colour by business family and teaches `showOnCreate`; the automation skill routes a stepped single-object form to a named wizard form an action opens + +Clause-②: no +Metadata-protocol: none + +`skills/objectstack-data` told authors to give every object a colour and avoid repeats in one app. With nine palette names any app past nine objects must repeat one, and the platform's own objects are coloured by business family instead. The `color` row now says to group an app's objects into a few business families with one palette name each, gives the platform's families as the worked example (people `blue`, security `purple`, approvals and work `orange`, messaging `pink`, integrations `teal`, reference data and finance `green`, audit and settings `amber`), keeps `red` for an object that is an alert, and leaves an object nobody opens without one. The quick-start object example declares a `color`. + +The data skill's field rules now teach `showOnCreate: false` (a field left off every create surface, refused beside `required: true`), and its Relationships rule no longer points at the `subforms` overrides the UI skill dropped. `skills/objectstack-automation` routes a stepped form over one object that never branches to a named form view (`type: 'wizard'`) that a `type: 'form'` action opens. New text is paid for by cuts in the same files. No metadata shape changes. diff --git a/skills/objectstack-automation/SKILL.md b/skills/objectstack-automation/SKILL.md index b2d17dbe9a3..b6777d1790a 100644 --- a/skills/objectstack-automation/SKILL.md +++ b/skills/objectstack-automation/SKILL.md @@ -36,12 +36,12 @@ Also vendor-integration callbacks and **assignment rules**. | Type | When to Use | |:-----|:------------| | `autolaunched` | Runs without user interaction — triggered by events, APIs, or other flows | -| `screen` | Interactive — presents UI screens | +| `screen` | Presents UI screens | | `schedule` | Runs on a cron/interval cadence declared on the **start node's `config.schedule`** — or a **per-record date sweep** via `config.timeRelative` | -| `record_change` | Fires automatically on record create/update/delete. `autolaunched` + the same `record-*` binding behaves identically; `record_change` also opts into the trigger-readiness lint | +| `record_change` | Fires on record create/update/delete. `autolaunched` + the same `record-*` binding behaves identically; `record_change` also opts into the trigger-readiness lint | | `api` | Inbound **webhook** (*Inbound webhook triggers*); a flow only ever started explicitly is `autolaunched` | -**A stepped form over one object that never branches** is no flow: an **objectstack-ui** form view, `type: 'wizard'`. +**A stepped form over one object that never branches** is no flow: an **objectstack-ui** named form view (`type: 'wizard'`) a `type: 'form'` action opens. **A flow an installed package ships** is read-only. To change what it does, save a same-named flow in the base's paired `.custom` package declaring diff --git a/skills/objectstack-data/SKILL.md b/skills/objectstack-data/SKILL.md index 01667870333..dd53767e2e6 100644 --- a/skills/objectstack-data/SKILL.md +++ b/skills/objectstack-data/SKILL.md @@ -36,7 +36,7 @@ metadata: - **[Relationships](./rules/relationships.md)** — lookup vs master_detail, junction patterns, delete behaviors - **[Validation Rules](./rules/validation.md)** — All validation types, script inversion, severity levels - **[Index Strategy](./rules/indexing.md)** — btree/gin/gist/fulltext, composite indexes, partial indexes -- **[Data Lifecycle & Retention](./rules/lifecycle.md)** — `lifecycle` classes (record/audit/telemetry/transient/event), retention/TTL/rotation/archive policies (distinct from lifecycle *hooks* below); plus the **save notice** a hook hands the saver (`ctx.notice`) +- **[Data Lifecycle & Retention](./rules/lifecycle.md)** — `lifecycle` classes, retention/TTL/rotation/archive policies (not *hooks*); plus the **save notice** a hook hands the saver (`ctx.notice`) - **[Lifecycle Hooks](./references/data-hooks.md)** — the lifecycle events, the sandboxed `body` (ctx + capability contract; the inline `handler` is deprecated), registration, canonical patterns - **[Datasources & Federation](./rules/datasources.md)** — `defineDatasource`, external/federated objects (`remoteName`/`columnMap`), auto-connect gating, credentials; ❌ no `field.columnName` on external objects - **[Security & Access Control](./rules/security.md)** — permission sets, assignment rows, RLS policies, `secret` / `requiredPermissions`, `tenancy`, platform-global posture @@ -92,14 +92,14 @@ all (Relationship Patterns below). | `label` | Auto from `name` | Human-readable singular label | | `pluralLabel` | — | Plural form; author it alongside `label` | | `icon` | — | Icon for nav, list headers and lookup pickers; give every object one | -| `color` | `gray` | Tile colour, one of `gray` `blue` `teal` `green` `amber` `orange` `red` `pink` `purple` (no hex); the console draws `icon` white on it. Give every object one; avoid repeats in one app | +| `color` | `gray` | Tile colour behind the white `icon`: `gray` `blue` `teal` `green` `amber` `orange` `red` `pink` `purple` (no hex). Group the app's objects into a few business families, one name each, as the platform's own objects do: people `blue`, security `purple`, approvals and work `orange`, messaging `pink`, integrations `teal`, reference data and finance `green`, audit and settings `amber`. `red` only for an alert object; one nobody opens gets none | | `highlightFields` | derived | Ordered field keys used as a record's compact face: the columns a **related list** renders on the parent's detail page, and what a lookup picker shows. Declare it on the CHILD object (see [Relationships](./rules/relationships.md)) | -| `namespace` | — | **Not a schema key** — an unknown key is refused, so authoring it is a build error. Embed the prefix directly in `name` instead | +| `namespace` | — | **Not a schema key**: refused as unknown. Embed the prefix in `name` | | `datasource` | `'default'` | Target datasource ID for virtualized data | | `nameField` | derived (e.g. `'name'`/`'title'`) | **Canonical** record-title field — the stored field used as the record's display name. Use a single text/email field; a composite title to import, sort or search by is a stored computed field (a non-`formula` field with an `expression`); a text formula is display-only | -| `displayNameField` | — | **Deprecated** alias for `nameField` (still honored as a fallback) | -| `titleFormat` | — | **Refused (ADR-0079)**: a save and `os validate` refuse it (`title-format-retired`). Move it to `nameField`; a composite title follows the `nameField` row | -| `enable` | — | Capability flags (trackHistory, searchable, apiEnabled, etc.) | +| `displayNameField` | — | **Deprecated** alias for `nameField`, still read | +| `titleFormat` | — | **Refused** by a save and `os validate` (`title-format-retired`): use `nameField` | +| `enable` | — | Capability flags (next section) | | `fieldGroups` | — | Ordered list of logical field groups for forms/detail pages (see [Field Groups](./references/examples-objects.md#field-groups-mvp)) | | `lifecycle` | `record` semantics (permanent) | Data retention/rotation/archival contract. **Required for append-only, high-write-rate objects** (see [Data Lifecycle & Retention](./rules/lifecycle.md)) | @@ -174,8 +174,7 @@ one-off backfill. See [Lifecycle Hooks](./references/data-hooks.md). Put conditional UI/data-entry rules on the **field definition** when the rule belongs to the data model and should apply everywhere the field is edited: -default forms, Studio-authored forms, inline master-detail grids, public forms, -and API-backed writes. +New and Edit, named and public forms, inline master-detail grids, API writes. ```typescript @@ -206,6 +205,8 @@ export const Invoice = ObjectSchema.create({ ``` - Use `visibleWhen` to hide irrelevant fields in ObjectUI forms. +- `showOnCreate: false` keeps a field off every create surface; edit, the + record page and lists keep it. Refused beside `required: true`. - Use `readonlyWhen` for state-locked fields; the ObjectQL write path ignores incoming changes when the predicate is `TRUE` (for everyone; per permission set → field permission `when`, rules/security.md). @@ -217,8 +218,8 @@ export const Invoice = ObjectSchema.create({ and DO write it. Keep the field `readonly` when automation maintains it; the flow side: [objectstack-automation → Failure routing & `runAs`](../objectstack-automation/SKILL.md#failure-routing--runas). - Use `requiredWhen` for conditional requiredness; the ObjectQL validator - enforces it on submit. The `conditionalRequired` alias was REMOVED in - protocol 17 — emitting it is a parse error. + enforces it on submit. The removed `conditionalRequired` alias is a parse + error. - **Choose by intent — invariant or transition gate.** A fact true of *every stored record* is an invariant: a `validations[]` `script` rule. A row that violates it is refused on any edit until repaired. A *transition* condition @@ -276,9 +277,8 @@ lowercase option values — examples: [rules/naming.md](./rules/naming.md). ### Field Type Selection -Three to get right here (the rest: [rules/field-types.md](./rules/field-types.md)): credentials are `secret` (**encrypted-at-rest**, ADR-0100) — -never `password`, which on a generic object is **plaintext at rest**; `user` is the person -picker; `formula` takes CEL in `expression` (a `{ dialect: 'cel', source }` envelope — +Two to get right here (the rest: [rules/field-types.md](./rules/field-types.md)): credentials are `secret` (**encrypted-at-rest**, ADR-0100) — +never `password`, which on a generic object is **plaintext at rest**; `formula` takes CEL in `expression` (a `{ dialect: 'cel', source }` envelope — `F\`...\`` in TypeScript; see **objectstack-formula**). - A yes/no flag (`is_*`, `has_*`, "done?", "active?") is `{ type: 'boolean', defaultValue: false }`. @@ -309,8 +309,7 @@ picker; `formula` takes CEL in `expression` (a `{ dialect: 'cel', source }` enve | Approval, review, routing, audit trail | not objects: an approval is a flow node (**objectstack-automation**) and its trail is platform history; model only the people it references (approver, reviewer), as `user` fields beside the owner | | Record owner | the platform's `owner_id` (`ownership: 'user'`, the default), also when the request says assignee, 负责人 or 处理人 — never a hand-added owner field, a second owner that owner-scoped visibility and "My records" views never read. A handler the request names apart from the owner is a `user` field that grants no access, with a label no other visible field carries, injected ones included: `owner_id` (Owner, 负责人), `created_by` (创建人), `updated_by` (更新人), `created_at` (创建时间), `updated_at` (更新时间). `ownership: 'none'` only for a shared catalog or a pure junction table | -> **`multiple: true` lookup ≠ junction object.** Its value is an **array of ids**: -> reference elements positionally (`{record.tags.0}` in flow values). +> A `multiple: true` lookup's ids are referenced positionally (`{record.tags.0}` in flow values). ### Validation Patterns @@ -341,7 +340,7 @@ indexes: [ ] ``` -See [rules/indexing.md](./rules/indexing.md) for composite indexes, unique scope +See [rules/indexing.md](./rules/indexing.md) for unique scope (on a declared index bare `unique: true` is refused), the retired `type` / `partial`, and partial / gin / gist indexes at the database layer. diff --git a/skills/objectstack-data/references/examples-objects.md b/skills/objectstack-data/references/examples-objects.md index 8649176f6a9..9319f6e1657 100644 --- a/skills/objectstack-data/references/examples-objects.md +++ b/skills/objectstack-data/references/examples-objects.md @@ -60,6 +60,7 @@ export default ObjectSchema.create({ pluralLabel: 'Support Cases', description: 'A customer-reported issue tracked to resolution.', icon: 'life-buoy', + color: 'orange', sharingModel: 'private', // required in practice highlightFields: ['subject', 'status', 'priority'], enable: { diff --git a/skills/objectstack-data/rules/relationships.md b/skills/objectstack-data/rules/relationships.md index 74c58fead6d..cc3304e9186 100644 --- a/skills/objectstack-data/rules/relationships.md +++ b/skills/objectstack-data/rules/relationships.md @@ -275,7 +275,7 @@ Name only true line-item / composition children (invoice lines, order items, expense lines); leave associations (comments, attachments, activity, audit) as tabs. -The rendering side, `subforms` overrides included: objectstack-ui → Master-Detail Forms. +The rendering side: objectstack-ui → Master-Detail Forms. #### Inline-edit form factor (`grid` vs `form`)