You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 54ea3c8
Browse filesBrowse the repository at this point in the historyBrowse 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>
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.
|`@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. |
255
269
256
270
No driver package is listed because none is installed directly: `@objectstack/runtime`
257
271
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
276
290
<Callouttype="info">
277
291
**The starter ships one app, so your project is in the Console from the first
278
292
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
281
296
Console navigation only when an app lists it**, and a package whose manifest
282
297
type is `app` holds at most one app, so `main.app.ts` is the one: for each
283
298
object you add, add a navigation entry for it to that app (a `group` entry with
0 commit comments