Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/36628-36611-skills-object-colour-create-forms.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 3 additions & 3 deletions skills/objectstack-automation/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 15 additions & 16 deletions skills/objectstack-data/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)) |

Expand Down Expand Up @@ -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.

<!-- os:check -->
```typescript
Expand Down Expand Up @@ -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).
Expand All @@ -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
Expand Down Expand Up @@ -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 }`.
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions skills/objectstack-data/references/examples-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion skills/objectstack-data/rules/relationships.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)

Expand Down
Loading