Skip to content

Commit 54ea3c8

Browse files
feat(scaffold): the blank template starts with the Starter app's companies and contacts (#37428)
<!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgSsAHX9Ukuyz7NLhw4ncpC7)_ Fixes #36945 Clause-②: no Metadata-protocol: none ## 维护者速读 - 开发者用命令行新建项目后,不再带那个和平台「备忘」重名的示例对象,而是直接带上起步应用的「公司」「联系人」源码,菜单里是公司、联系人和平台自带的任务、备忘。 - 属于「起步应用与平台任务/备忘」专题,让开发者拿到的项目和云端装的起步应用是同一套定义,并有测试防止两边走样。 - 出错只影响此后新建的项目,已有项目不变;新建脚本的改名规则也扩大到了引用处,可以直接撤回。 - 无。 ## What changes **The blank template** (`packages/create-objectstack/src/templates/blank/`): - Removed the sample `note` object, its list view and `note.test.ts`. - Added `src/objects/company.object.ts` and `contact.object.ts`, and `src/views/company.view.ts` and `contact.view.ts`: the definitions of `examples/app-starter` (PR #37399), with `starter_` names spelled `blank_`. Comments are the template's own (what the org-wide default means, field groups, how to remove the objects), so the shipped-comment rationale pins move from `note.object.ts` to `company.object.ts`. - `src/apps/main.app.ts` keeps its identity (`blank_main_app`, label Main) and its navigation is the Starter's four object entries: companies, contacts, and `sys_task` / `sys_note` with `requiresObject` (the same form as the Starter, until #37404 lands). The Starter's dashboard entry is not carried: the template ships no dashboard, seed data or translations. - `starter.test.ts` replaces `note.test.ts`: it boots the project with `bootStack` and asserts that a company is refused without a name, that a contact's lookup holds its company, and that `GET /meta/app/NAME` serves the four entries in order. - README: a "What this project starts with" section replaces "The sample `note` object" (what each file is, that Tasks and Notes are the platform's, how to remove companies and contacts), and the Console, Layout, Verify and Next steps sections follow it. The template's `objectstack.config.ts` / `objectstack.manifest.json` descriptions (dropped at scaffold time) and the registry line say what the project starts with. **One source of truth: a consistency pin, not a build-time copy** (A2). `src/blank-template-starter-parity.test.ts` parses each template file and the Starter's with the TypeScript compiler and compares the printed definition (the argument of `ObjectSchema.create` / `defineView`, and each navigation entry) with comments removed, after spelling the Starter's `'starter_…'` literals as `'blank_…'`. Formatting and commentary are free; every key and value is held. Its CONTROL case changes one value (`maxLength: 120` to `121`) and requires the comparison to fail. A copy at build time was not chosen: the template under `src/` is what every other test in this package reads and what `npm create` users get, so it has to hold the files itself. **Scaffolder: every namespaced literal moves, references included** (DEVIATION, declared). `rewriteObjectNamePrefix` used to rewrite `name: 'blank_x'` literals only, so the old template had to reach its object as `Note.name`. Company and contact reference each other (the contact's lookup, the company's related list), so imported references would be circular, and the Starter spells references as literals. The rewrite (and its self-check `findStaleNamespacePrefixes`) now moves every WHOLE quoted literal under the template namespace prefix: `'blank_company'`, `"blank_company"` and the backtick form, wherever it stands. A literal that is not a whole namespaced name is left alone: a platform object (`'sys_task'`), a navigation id (`'nav_blank_tasks'`), a longer string containing the prefix, a literal under another namespace. New tests in `rewrite-identity.test.ts` pin both directions (five reference shapes moved; four non-name shapes untouched, byte for byte). Measured on a real scaffold (`my-app`): every `blank_` literal became `my_app_`, none survived. **Closing summary.** After "Environment created!", the scaffolder prints "Your project starts with:" (Companies and Contacts in `src/objects/`, Tasks and Notes from the platform in the menu of `src/apps/main.app.ts`), outside the "Next steps:" block that `scaffold-next-steps-pm.test.ts` reads. The parity test holds those lines to the template tree. **Fence additions, each approved by the zone (o5-P) for this card:** - `packages/cli/test/create-objectstack-wiring-parity.test.ts`: the views-barrel line it expects is now the two `company` / `contact` lines (the template keeps the generator's default-export barrel shape). - `packages/cli/test/starter-field-consumers.test.ts`: the control helper (`withoutPlacement`, was `withoutGroup`) un-places a field from every placement the starter wrote: its `group`, a field group's `fields` list (how the Starter places fields), `highlightFields`, and related-list `columns`. See Acceptance notes for why the last one is on every object. - `packages/cli/test/starter-field-consumers.e2e.test.ts` (nightly): the strip also removes field groups' `fields: [...]` lists, so the blank starter keeps a control. - `scripts/cross-package-test-inputs.mjs` + `turbo.json`: `create-objectstack` declares `examples/app-starter/src/**` (with a `heldBy` witness, the walked root) and `examples/app-starter/objectstack.config.ts` (the namespace line), so a Starter-only change re-runs the pin instead of replaying a cached green. - `content/docs/getting-started/your-first-project.mdx` and `build-with-claude-code.mdx`: the tree, the object code block, the Console callout, the curl examples, the "extend the model" block and the agent prompt describe companies and contacts; the validate transcript reads `3 Objects 18 Fields` and `3 Views` (2 objects and 14 fields measured on a fresh scaffold, plus the guide's ticket). **Two lines in `packages/platform-objects`, OK'd by the maintainer in the card thread (2026-11-26 08:58Z).** `managed-api-method-affordance-sweep.test.ts:146` and `platform-admin-affordance-standing.test.ts:82` listed the template's `note.object.ts` as the one scaffolding exemption and pinned it as still existing; they now list `company.object.ts` and `contact.object.ts` (commit 973207c). Measured: both sweeps 12/12 passed, `check:cross-package-test-inputs` exit 0. ## Tests - `create-objectstack`: `vitest run`, 26 files, 396 tests passed; `tsc --noEmit` exit 0. - New: `blank-template-starter-parity.test.ts` 9 tests; `rewrite-identity.test.ts` +2. - `@objectstack/cli` unit: `create-objectstack-wiring-parity.test.ts` and `starter-field-consumers.test.ts` green (25 tests). - A real scaffold (`create-objectstack my-app --skip-install --skip-skills`, resolved against workspace packages): `objectstack validate` passed (`2 Objects 14 Fields`, `1 Apps 2 Views`, no warning), `objectstack lint` all checks passed, `tsc --noEmit` exit 0, `vitest run` 3/3 (`starter.test.ts`). <details><summary>Ablations</summary> - Starter test: the scaffolded project's notes menu entry deleted, `starter.test.ts` red on the menu case (1 failed, 2 passed); restored, 3/3. - Parity pin: built-in CONTROL (one value changed in the template's contact object) fails the comparison. - `starter-field-consumers.test.ts` controls: old helper (`group` key only) on the new template, 12 of 12 blank controls red; the helper with `group` + field-group lists only, 7 red (the highlighted fields); the full helper, green. Old template (`note.object.ts` restored in place) with the new helper: 14/14 green. Helper made a no-op: 14 controls red (12 blank + 2 `os init -t app`). </details> ## Acceptance notes - Root `.github/workflows/scaffold-e2e.yml` is governed and not edited (A4). It runs `npm test` only (lines 143 to 147 and 568 to 570), never a filename, so the rename is safe; two comments there still name `note.test.ts` (line 139, "The starter's own test (`note.test.ts`)", and line 562, "older than the starter's `note.test.ts`"). They are stale prose for whoever next edits that file. - The scaffold E2E job installs the generated project from the registry (18.6.0). `sys_task` / `sys_note` do not exist there yet, but the two entries carry `requiresObject`, and `starter.test.ts` reads the served menu and writes no task or note. The job is still red at validate, for the reason in Landing ops §C. - The field-consumer rule credits a related list's `columns` to the object that DECLARES the list as well as to the listed object: the company's related list of contacts (`phone` column, the contact's field) keeps `company.phone` credited. Measured through the control above: a parent field that nothing displays stays silent when a child's related-list column has the same name, and `withoutPlacement` now strips those columns on every object, which hides it from the control. Carried by #37502 (fix the rule, then narrow the helper). - `packages/cli/src/commands/generate.ts` (~294) still cites `note.object.ts` as the starter's authoring style in a comment, and that comment is now partly false: `os g object` places a field with a per-field `group`, while the starter places fields through a group's `fields` list. That and the other stale `note` citations (including `content/docs/deployment/cli.mdx`) are carried by #37503. `packages/cli/src/utils/organization-ownership-inventory.ts` keeps `blank_note` as a census row fixed at its census commit, which is correct. ## Landing ops ### §C Expected reds on this head, what they cost, and what unblocks them One red is expected on this head; it is not a required context (`scripts/check-required-contexts.mjs` `REQUIRED_CONTEXTS`). 1. **Scaffold E2E · "Scaffold with repo dist"**, step 7 "Validate and build the generated project". Signature: `✗ ObjectSchema.create('e2e_app_company'): unknown key(s) — color.` The job installs the generated project from the registry at `^18.6.0` (also `latest`; main is in changeset pre mode). 18.6.0 rejects three shapes the Starter's source uses: object `color`, `fieldGroups[].fields`, and object-form `relatedLists` entries. Measured against a real registry install: with those three stripped, validate passes, so nothing else in the template is unreleased. - **What the red costs.** The job stops at step 7, so steps 8 to 14 are skipped: the template's own `starter.test.ts`, the boot probe, the skills boundary, the pinned shape and both Docker legs. No other CI job runs `starter.test.ts` (this package's vitest excludes `src/templates/`). Until #37441 lands or a 19 prerelease is published, no CI run executes the new template's test or boots a generated project, on this PR or on any later PR that touches `packages/create-objectstack/**` or `docker/**`; a second template regression in that window would be hidden behind the `color` refusal. The job has no push trigger, and the nightly leg runs only the registry canary. - **Unblocks when** #37441 lands (scaffold E2E installs packed tarballs of the repo's packages, ruling 7183516548), or a release publishes object `color`, `fieldGroups[].fields` and object-form `relatedLists`. The maintainer asked for this PR to land now (card thread, 2026-11-26 08:58Z). **Fixed in this PR so it does not go red: `publish-smoke / packed-tarballs`** (contract review 7187700473, M1; the claim amended to add `scripts/publish-smoke.sh`). The smoke's REST CRUD probe read `src/objects/note.object.ts` and wrote `title`; in pack mode the project now comes from the repo-built scaffolder, so the file was gone and the smoke would have stopped at "REST CRUD probes" after the next Release run. The probe now drives whichever starter object the scaffolder wrote: `company.object.ts` with the required `name` (pack mode, and registry mode once the companies template is published), else `note.object.ts` with `title` (registry mode until then), and fails by name when neither exists (commit 1079be7). Measured: - registry mode, the whole script: `SMOKE_MODE=registry bash scripts/publish-smoke.sh` exit 0, `Publish smoke passed (registry mode)`, the probe on `smoke_app_note` (`title`): create 201, read 200, update 200, delete 200. - the companies branch: the probe section, cut from the script, run against a project scaffolded by the repo-built `create-objectstack` and booted with `objectstack dev --fresh` on the workspace packages (a full pack-mode run needs `pnpm build` of every package, not run here), signed in as the seeded admin: `smoke_app_company` (`name`) create 201, read 200, update 200, delete 200. - control: the same harness with the probe section as it was before this commit, against the same project, exits 1 with `ENOENT … src/objects/note.object.ts`. Cleared at 973207c: the platform-objects gap (the two sweeps and Cross-package test inputs). ## Verification Files to read first: `src/rewrite-identity.ts` (the widened literal rule, `namespacedLiteralRe`), `src/blank-template-starter-parity.test.ts`, `src/templates/blank/src/apps/main.app.ts`. Two-minute check: `cd packages/create-objectstack && pnpm exec vitest run src/blank-template-starter-parity.test.ts src/rewrite-identity.test.ts`, expect every case green, then `npx tsx src/index.ts my-app --skip-install --skip-skills` in a scratch directory and read `my-app/src/apps/main.app.ts`: four entries, `my_app_company`, `my_app_contact`, `sys_task`, `sys_note`. --- _Generated by [Claude Code](https://claude.ai/code/session_01Utp6Cb7GD4hWCpfZKAZgDD)_ <!-- signed: repo:objectstack#5 · os-bill · session_01Utp6Cb7GD4hWCpfZKAZgDD --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 66452df commit 54ea3c8

39 files changed

Lines changed: 936 additions & 335 deletions
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'create-objectstack': patch
3+
---
4+
5+
feat(scaffold): new projects start with companies and contacts, with the platform's tasks and notes in the menu
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`npm create objectstack` no longer ships the sample `note` object, whose name clashed with the platform's own notes. A new project now starts with the companies and contacts of the platform's Starter app, as source it owns: `src/objects/company.object.ts` and `contact.object.ts`, a grid and a board for each in `src/views/`, and a menu in `src/apps/main.app.ts` listing Companies, Contacts, Tasks and Notes. Tasks and Notes are the platform's `sys_task` and `sys_note`: the project declares no copy of them, so a task or a note never changes who may see the record it is about. The starter test is now `starter.test.ts`, and it boots the project and checks that a company needs a name, that a contact belongs to a company, and that the menu carries the four entries.
11+
12+
Scaffolding now moves every quoted name under the template's namespace onto the project's, references included: a lookup's target, a related list, a view's object and a menu entry move with the object they name (`blank_company` becomes `my_app_company` everywhere). Before, only `name: '…'` literals moved. A literal that is not a whole namespaced name (a platform object, a navigation id, a longer string) is left alone.
13+
14+
The closing summary prints what the project starts with, and the README's "What this project starts with" section says how to reshape or remove companies and contacts.
15+
16+
Existing projects are not changed.

‎content/docs/getting-started/build-with-claude-code.mdx‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ The scaffolder does more than copy files. It:
7373
────────────────────────────────────────
7474
Environment: support-desk
7575
Namespace: support_desk
76-
Template: blank — Minimal starter — one object, REST API, ready to extend
76+
Template: blank — Companies and contacts, with platform tasks and notes in the menu — ready to extend
7777
…
7878
→ Installing AI skills for your coding agent from @objectstack/skills@<version>...
7979
…
@@ -274,11 +274,12 @@ filename-suffix magic: metadata exists in the app only if its barrel exports it,
274274
so if a freshly-authored action doesn't show up, its export line is the first
275275
thing to check.
276276

277-
What it does **not** touch is the starter `note` object the `blank` template
278-
scaffolded in step 1 (`src/objects/note.object.ts`, two fields). Nothing asked
279-
for it to go, so it stays in the project — which is why the counts below read
280-
**two** objects and **six** fields, not one and four. Delete it once the ticket
281-
object has replaced it and the same run reports `1 Objects 4 Fields`.
277+
What it does **not** touch is what the `blank` template scaffolded in step 1:
278+
the companies and contacts (`src/objects/company.object.ts` and
279+
`contact.object.ts`, seven fields each). Nothing asked for them to go, so they
280+
stay in the project — which is why the counts below read **three** objects and
281+
**eighteen** fields, not one and four. Delete them once the ticket object has
282+
replaced them and the same run reports `1 Objects 4 Fields`.
282283

283284
This is the same metadata that powers the REST API, the Console UI, **and the MCP
284285
tools exposed to AI** — define it once, and ObjectStack derives the rest.
@@ -340,8 +341,8 @@ Once it's clean:
340341
341342
Support Desk v0.1.0
342343
343-
Data: 2 Objects 6 Fields
344-
UI: 1 Apps 1 Views 1 Actions
344+
Data: 3 Objects 18 Fields
345+
UI: 1 Apps 3 Views 1 Actions
345346
Logic: 0 Flows
346347
Security: 0 Positions 0 Permissions
347348
Runtime: 3 plugins

‎content/docs/getting-started/your-first-project.mdx‎

Lines changed: 54 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ The scaffolder (`create-objectstack`) does four things:
5555
1. **Copies a template** into `my-app/` and rewrites its identity — the npm
5656
package name, the manifest `name`/`displayName`, and a **namespace** derived
5757
from your project name (`my-app` → `my_app`). Every object in the template is
58-
renamed to carry that prefix (`my_app_note`), which is what
59-
`os validate` later enforces.
58+
renamed to carry that prefix (`my_app_company`), and every reference to it
59+
with it, which is what `os validate` later enforces.
6060
2. **Installs dependencies** (pnpm if available, otherwise npm).
6161
3. **Installs the AI skills bundle for one coding agent** from the
6262
`@objectstack/skills` package, at your installed `@objectstack/spec`'s
@@ -107,19 +107,22 @@ my-app/
107107
├── objectstack.manifest.json # displayName, namespace — the package listing
108108
├── package.json
109109
├── tsconfig.json
110-
├── note.test.ts # the starter test `npm test` runs
110+
├── starter.test.ts # the starter test `npm test` runs
111111
├── vitest.config.ts # its test-runner config
112112
├── AGENTS.md # conventions for coding agents
113113
└── src/
114114
├── objects/
115115
│ ├── index.ts # barrel — re-exports every object
116-
│ └── note.object.ts # a sample object
116+
│ ├── company.object.ts # companies the organization works with
117+
│ └── contact.object.ts # the people at them
117118
├── views/
118119
│ ├── index.ts
119-
│ └── note.view.ts # the sample object's list view
120+
│ ├── company.view.ts # a grid and a board of companies
121+
│ └── contact.view.ts # a grid and a board of contacts
120122
├── apps/
121123
│ ├── index.ts
122-
│ └── main.app.ts # the starter app, listing the notes
124+
│ └── main.app.ts # the menu: companies, contacts, and the
125+
│ # platform's tasks and notes
123126
├── actions/index.ts # an empty barrel for each other directory
124127
├── flows/index.ts # `os generate` writes into, already
125128
├── dashboards/index.ts # wired into objectstack.config.ts
@@ -217,28 +220,39 @@ and add a `connectors:` entry naming its `provider`; the `automation`
217220
capability materializes it into a live connector at boot — see
218221
[Automation → Connectors](/docs/automation/connectors).
219222

220-
**`src/objects/note.object.ts`** is a complete data model — schema, validation,
221-
API surface, and searchability in one typed definition:
223+
**`src/objects/company.object.ts`** and **`contact.object.ts`** are the
224+
platform's Starter app — companies and the people at them — as source you own.
225+
Each is a complete data model — schema, validation, sharing and form layout in
226+
one typed definition (abridged):
222227

223-
```typescript title="src/objects/note.object.ts"
228+
```typescript title="src/objects/contact.object.ts"
224229
import { ObjectSchema, Field } from '@objectstack/spec/data';
225230

226-
export const Note = ObjectSchema.create({
227-
name: 'my_app_note', // namespace-prefixed, snake_case
228-
label: 'Note',
229-
pluralLabel: 'Notes',
230-
icon: 'sticky-note',
231+
export const Contact = ObjectSchema.create({
232+
name: 'my_app_contact', // namespace-prefixed, snake_case
233+
sharingModel: 'public_read_write', // org-wide default — an explicit, authored decision
234+
label: 'Contact',
235+
pluralLabel: 'Contacts',
231236

232237
fields: {
233-
title: Field.text({ label: 'Title', required: true, searchable: true, maxLength: 200 }),
234-
body: Field.textarea({ label: 'Body' }),
238+
name: Field.text({ label: 'Name', required: true, searchable: true, maxLength: 120 }),
239+
company: Field.lookup('my_app_company', { label: 'Company' }),
240+
email: Field.email({ label: 'Email', searchable: true }),
241+
// …title, influence, phone, notes
235242
},
236243

237-
sharingModel: 'private', // org-wide default — an explicit, authored decision
238-
enable: { apiEnabled: true, searchable: true },
244+
fieldGroups: [
245+
{ key: 'basic', label: 'Basic Information', fields: ['name', 'company', 'title', 'influence', 'owner_id'] },
246+
// …
247+
],
239248
});
240249
```
241250

251+
The menu's other two entries, **Tasks** and **Notes**, are the platform's own
252+
`sys_task` and `sys_note`, which every environment carries: the project
253+
declares no copy of them, so a task or a note never changes who may see the
254+
record it is about.
255+
242256
### The packages you depend on
243257

244258
A standalone project uses a handful of published packages — this is the entire
@@ -251,7 +265,7 @@ framework surface you install:
251265
| `@objectstack/plugin-hono-server` | The HTTP server that mounts the generated REST API. |
252266
| `@objectstack/connector-rest` · `-openapi` · `-mcp` | The three generic connector executors — register the `rest` / `openapi` / `mcp` provider factories so declarative `connectors:` entries materialize ([ADR-0097](/docs/automation/flows)). |
253267
| `@objectstack/cli` *(dev)* | The `os` / `objectstack` CLI: `dev`, `validate`, `build`, `start`. |
254-
| `@objectstack/verify` *(dev)* | The test harness: `bootStack` boots this app's own stack in-process, on an in-memory database and with no server port, and returns the handle a test asserts through. `npm test` runs the starter test `note.test.ts` with it. |
268+
| `@objectstack/verify` *(dev)* | The test harness: `bootStack` boots this app's own stack in-process, on an in-memory database and with no server port, and returns the handle a test asserts through. `npm test` runs the starter test `starter.test.ts` with it. |
255269

256270
No driver package is listed because none is installed directly: `@objectstack/runtime`
257271
depends on `driver-sql`, `driver-sqlite-wasm` and `driver-memory` and installs
@@ -276,8 +290,9 @@ Console — data browser, metadata explorer, API docs — is served at
276290
<Callout type="info">
277291
**The starter ships one app, so your project is in the Console from the first
278292
boot.** Next to the platform's own apps you will see **Main**, from
279-
`src/apps/main.app.ts`; its `Notes` entry opens the list that
280-
`src/views/note.view.ts` declares for `my_app_note`. **An object appears in
293+
`src/apps/main.app.ts`, with Companies, Contacts, Tasks and Notes in its menu;
294+
Companies opens the list `src/views/company.view.ts` declares for
295+
`my_app_company`. **An object appears in
281296
Console navigation only when an app lists it**, and a package whose manifest
282297
type is `app` holds at most one app, so `main.app.ts` is the one: for each
283298
object you add, add a navigation entry for it to that app (a `group` entry with
@@ -302,12 +317,12 @@ curl -c cookies.txt -X POST http://localhost:3000/api/v1/auth/sign-in/email \
302317
-d '{"email": "admin@objectos.ai", "password": "admin123"}'
303318

304319
# Create a record
305-
curl -b cookies.txt -X POST http://localhost:3000/api/v1/data/my_app_note \
320+
curl -b cookies.txt -X POST http://localhost:3000/api/v1/data/my_app_company \
306321
-H "Content-Type: application/json" \
307-
-d '{"title": "Hello ObjectStack", "body": "Created via the generated API"}'
322+
-d '{"name": "Northwind Trading", "type": "customer"}'
308323

309324
# Query records (filtering, sorting, pagination built in)
310-
curl -b cookies.txt "http://localhost:3000/api/v1/data/my_app_note?select=title&sort=-created_at&top=10"
325+
curl -b cookies.txt "http://localhost:3000/api/v1/data/my_app_company?select=name&sort=-created_at&top=10"
311326
```
312327

313328
See the [Data API](/docs/api/data-api) for the full CRUD, batch, and analytics
@@ -318,18 +333,23 @@ client (`@objectstack/client`).
318333

319334
Add a field and a second object by hand — the same edit an agent would make.
320335

321-
```typescript title="src/objects/note.object.ts"
336+
```typescript title="src/objects/company.object.ts"
322337
fields: {
323-
title: Field.text({ label: 'Title', required: true, searchable: true, maxLength: 200 }),
324-
body: Field.textarea({ label: 'Body' }),
325-
status: Field.select({
326-
label: 'Status',
338+
name: Field.text({ label: 'Company Name', required: true, searchable: true, maxLength: 200 }),
339+
// …type, industry, website, phone, address, description
340+
tier: Field.select({
341+
label: 'Tier',
327342
options: [
328-
{ label: 'Draft', value: 'draft', default: true },
329-
{ label: 'Published', value: 'published' },
343+
{ label: 'Standard', value: 'standard', default: true },
344+
{ label: 'Key Account', value: 'key_account' },
330345
],
331346
}),
332347
},
348+
349+
fieldGroups: [
350+
{ key: 'basic', label: 'Basic Information', fields: ['name', 'type', 'industry', 'tier', 'owner_id'] },
351+
// …
352+
],
333353
```
334354

335355
New objects follow the same pattern: create `src/objects/<name>.object.ts` with
@@ -376,8 +396,9 @@ prepared the project for that handoff: the **skills bundle** is installed (step
376396
validate gate. Open the project in Claude Code (or Cursor / Copilot) and
377397
describe the next feature instead of typing it:
378398

379-
> Add a `status` filter to the note list view, a dashboard with a metric of
380-
> published notes, and a daily flow that archives notes older than 90 days.
399+
> Add a `tier` filter to the company list view, a dashboard with a metric of
400+
> key-account companies, and a daily flow that creates a follow-up task for
401+
> every key account no one has contacted in 90 days.
381402
> Run `npm run validate` when done.
382403
383404
Each of those lands in a different metadata domain (UI, dashboards,

‎packages/cli/test/create-objectstack-stack-reach.test.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@
2626
* os g flow order_line --object order_line
2727
* → exit 0, reaches the stack, no wiring lines to add
2828
*
29-
* `--object` because the starter declares an object of its own: with two in
30-
* the stack, which one a flow binds is the author's to say (#21325).
31-
* os validate → exit 0, `Data: 2 Objects`, `Logic: 1 Flows`
29+
* `--object` because the starter declares objects of its own (companies and
30+
* contacts): with several in the stack, which one a flow binds is the author's
31+
* to say (#21325).
32+
* os validate → exit 0, `Data: 3 Objects`, `Logic: 1 Flows`
3233
*
3334
* Asserted: exit statuses, the named subjects, the absence of the wiring
3435
* lines `os g` prints for a scaffold that did not arrive (code an author
@@ -167,8 +168,8 @@ describe('[#20333] `npm create objectstack` → `os g flow` → `os validate`',
167168

168169
it('`os validate` exits 0 and counts the generated flow beside the control', () => {
169170
expect(validate.code, out(validate)).toBe(0);
170-
// The starter's own object plus the generated one.
171-
expect(validate.stdout).toMatch(/\bData: 2 Objects\b/);
171+
// The starter's two objects (company, contact) plus the generated one.
172+
expect(validate.stdout).toMatch(/\bData: 3 Objects\b/);
172173
expect(validate.stdout).toMatch(/\bLogic: 1 Flows\b/);
173174
});
174175
});

‎packages/cli/test/create-objectstack-wiring-parity.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ describe('[#20333] the blank template ships every wired barrel', () => {
171171
return readFileSync(join(BLANK, file), 'utf8').slice((b!.init as string).length).split('\n').filter(Boolean);
172172
};
173173
expect(appendedTo('src/apps/index.ts')).toEqual(["export { default as main } from './main.app';"]);
174-
expect(appendedTo('src/views/index.ts')).toEqual(["export { default as note } from './note.view';"]);
174+
expect(appendedTo('src/views/index.ts')).toEqual([
175+
"export { default as company } from './company.view';",
176+
"export { default as contact } from './contact.view';",
177+
]);
175178
});
176179
});

‎packages/cli/test/starter-field-consumers.e2e.test.ts‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
*
4242
* A zero alone cannot tell a placed field from a rule that never ran, or a
4343
* `--json` that stopped carrying warnings. So each leg whose starter places a
44-
* field then strips every `group` line from its `src/objects/*.object.ts` and
44+
* field then strips every `group` line and every field group's `fields` list
45+
* (#36945) from its `src/objects/*.object.ts` and
4546
* runs both commands again — with any view the STARTER ships unwired too, since
4647
* its columns display the same fields (#32152: the blank starter ships a list of
4748
* its sample object) — : each must now report `field-no-consumers`, and
@@ -98,10 +99,18 @@ type Gate = (typeof GATES)[number];
9899

99100
/** A `group: '<key>',` line exactly as the starters write one. */
100101
const GROUP_LINE = /^[ \t]*group: '[a-z_][a-z0-9_]*',\r?\n/gm;
102+
/**
103+
* A field group's own `fields: [...]` list, the other placement ADR-0085 §5
104+
* allows: how the platform's Starter app, and so the blank starter, places
105+
* every field (#36945). Stripped with the `group` lines, so the control
106+
* un-places the fields whichever way the starter wrote them.
107+
*/
108+
const FIELD_GROUP_FIELDS = /, fields: \[[^\]\n]*\]/g;
101109
/** A views-barrel line wiring one view file, as `os g view` appends it. */
102110
const VIEW_EXPORT = /^export \{ default as \w+ \} from '\.\/[\w.-]+';$/;
103111
/** Whether an object source places any field in a group (non-global: `test` keeps no state). */
104-
const placesAField = (source: string): boolean => new RegExp(GROUP_LINE.source, 'm').test(source);
112+
const placesAField = (source: string): boolean =>
113+
new RegExp(GROUP_LINE.source, 'm').test(source) || new RegExp(FIELD_GROUP_FIELDS.source).test(source);
105114

106115
interface Run {
107116
code: number;
@@ -237,7 +246,7 @@ beforeAll(async () => {
237246
for (const file of readdirSync(objectsDir).filter((f) => f.endsWith('.object.ts'))) {
238247
const path = join(objectsDir, file);
239248
const before = readFileSync(path, 'utf8');
240-
const after = before.replace(GROUP_LINE, '');
249+
const after = before.replace(GROUP_LINE, '').replace(FIELD_GROUP_FIELDS, '');
241250
if (after === before) continue;
242251
writeFileSync(path, after);
243252
stripped += after;

0 commit comments

Comments
 (0)