Repository navigation
Commit 0a46a26
fix(create-objectstack): the scaffolded AGENTS.md lists only the src directories the config loads (#29091)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XL51wryBuAmngcxc4MhBYSV)_
Fixes #28954
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:脚手架生成的 `AGENTS.md` 里「Project Structure」目录树,现在只列
`objectstack.config.ts` 真正加载的 8
个目录(objects、views、actions、flows、dashboards、apps、skills、picklists),去掉了从不加载的
`reports/`、`agents/`、`i18n/`、`handlers/`,并加一句:新目录必须在 config
里接线,否则既不加载也不被 validate 检查。另加一条包内测试,把这棵目录树和模板 config 的 barrel 导入对齐。
- **为什么改**:按「Build with Claude Code」路径的新手,coding agent 先读
AGENTS.md,再照着目录树写元数据;写进那四个死目录的东西不会加载,`npm run validate` 还照样通过,用户以为是 AI
写坏了。
- **风险与回滚**:极低。只改模板里的说明文字和一条测试,config 加载什么完全不变;已生成的项目不受影响。回滚即撤销本 PR。
- **先看**:`packages/create-objectstack/src/templates/AGENTS.md`(Project
Structure
一节);`packages/create-objectstack/src/agents-project-structure.test.ts`(新增的对齐测试)。
- **两分钟验证**:`pnpm --filter create-objectstack exec vitest run
src/agents-project-structure.test.ts`,预期 3/3 通过(main 上 2 条红:多出
agents/handlers/i18n/reports,缺 picklists/skills)。
- **需要你做的**:无,席位落地。
## Why
A newcomer on the "Build with Claude Code" path has a coding agent read
`AGENTS.md` before it writes any metadata. The block told the agent to
put reports in `src/reports/`, AI agents in `src/agents/`, translations
in `src/i18n/` and hooks in `src/handlers/`. The scaffolded
`objectstack.config.ts` imports none of those, so what the agent wrote
there was never loaded, and `npm run validate` neither counted nor
checked it (the card's repro: an invalid report there, `✓ Validation
passed`).
## What changes
- **`packages/create-objectstack/src/templates/AGENTS.md`, the Project
Structure block.** The `src/` tree now lists exactly the eight
directories the config wires, in the config's order: `objects/`,
`views/`, `actions/`, `flows/`, `dashboards/`, `apps/`, `skills/`,
`picklists/`. `reports/`, `agents/`, `i18n/` and `handlers/` are gone.
Below the tree, one paragraph: these are exactly the directories
`objectstack.config.ts` wires, and a new `src/` directory is never
loaded, and `npm run validate` neither counts nor checks what it holds,
until its `index.ts` barrel is imported in `objectstack.config.ts` and
handed to its stack key there (the config's own comment says the same).
- **New
`packages/create-objectstack/src/agents-project-structure.test.ts`.**
For every bundled template in `TEMPLATES` that has an
`objectstack.config.ts`, the block's `src/` directories equal the
config's `import * as X from './src/X'` barrels, as sets, both ways. A
third case pins that the section names `objectstack.config.ts` and says
"never loaded". A package test, not a gate script.
- **What any config loads is unchanged.** No template file other than
`AGENTS.md` is touched.
- **Changeset** `.changeset/scaffold-agents-md-wired-dirs.md`: `patch`
on `create-objectstack` (the templates ship inside its `dist`), with
both declaration lines and the one-line adoption note for an existing
project.
**Step 1 measurement (the order's ruling 2).** `TEMPLATES`
(`src/template-registry.ts`) has one bundled template, `blank`. All
templates share one `AGENTS.md` (`src/templates/AGENTS.md`, rendered by
`index.ts` into every project); no template carries its own.
`blank/objectstack.config.ts` imports eight barrels: objects, views,
actions, flows, dashboards, apps, skills, picklists. The old block named
ten `src/` directories: six of those eight, plus `reports/`, `agents/`,
`i18n/`, `handlers/`; `skills/` and `picklists/` were missing.
`blank/README.md` (its Layout section) already names exactly the eight,
so it is unchanged.
## Tests
- **Red on base `ee7518f9`** (`AGENTS.md` checked out from base, the new
test kept): 2 failed, 1 passed. The set case received `agents`,
`handlers`, `i18n`, `reports` and lacked `picklists`, `skills`; the
wiring-sentence case failed. Restored: `git status --porcelain` empty,
blob `8f0801f4fac0` equal to HEAD.
- **Green on head:** 3/3.
<details><summary>Ablation (one-off, from committed HEAD)</summary>
`node scripts/ablation-replace.mjs` inserted `│ ├── reports/ #
ABLATED-28954 Analytics reports` back into the tree (anchor `# BI
dashboards` + newline + the `apps/` line, 1 → 0; blob `8f0801f4fac0` →
`fad5dd511c4f`; the marker counted once on disk). The test: 1 failed, 2
passed, the set case receiving `+ "reports"`. The tool restored the file
and proved it: blob equal to HEAD `8f0801f4fac0`, `git diff HEAD` empty;
`git status --porcelain` empty after.
</details>
## Acceptance notes
- **Wiring the four directories instead.** Not done, by ruling: what the
config loads stays as it is. Reports, agents, translations and hooks
each have their own stack key, but whether a starter should wire them is
a product choice for its own card; this report names none.
- **Existing projects.** An already-scaffolded project keeps its
`AGENTS.md`. The changeset says how to adopt the fix by hand.
## Verification
<details><summary>Package tests and typecheck</summary>
All readings at head `499412ef` (base `ee7518f9`), after `pnpm install
--frozen-lockfile` and `pnpm --filter 'create-objectstack...' build`.
- `pnpm --filter create-objectstack test`: 20 files, 304 tests passed
(the new file included). Lock verdict `command-exit 0`.
- `pnpm --filter create-objectstack typecheck` (`tsc --noEmit`): exit 0;
`--listFiles` counts the new test file once, so the typecheck covers it.
- `eslint --no-inline-config packages/create-objectstack`: exit 0.
- Not done: a scaffold-and-validate run from the local package (the
order called it welcome, not required).
</details>
<details><summary>Derived gates</summary>
- `node scripts/pm/dispatch-gates.mjs --commands` at `499412ef`: 59
commands. The lane was wound down mid-run (the maintainer's call to wrap
up), so the record is partial: 55 ran, 4 NOT MEASURED because the run
was stopped before them (`check:type-check-debt`,
`check:undeclared-dep-imports`, `check:watch-hint-literal`,
`check:where-matcher`). CI runs all four.
- Of the 55: 53 exit 0. `check:dual-build-cjs-loads` exit 3,
PREREQUISITE NOT MET (needs a full repo build), NOT MEASURED, left to
CI. `check:lean-entry-closure` exit 3 in the loop (objectql `dist`
missing); after `pnpm --filter '@objectstack/objectql...' build` it
answered exit 0 ("Admitted set held exactly (15 packages)").
- Not run locally, as the os-dev scope says: `test:repo`, the repo-wide
lint, and the families outside the derivation. The PR's CI check-runs
carry them.
- No dogfood battery: the title has no `!`, and `Clause-②` has no
`(narrowing)` arm.
</details>
## Human Minimum
None: the seat reviews and lands it.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5nNCtq276yJtjqKq8B)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 87d6bae commit 0a46a26
3 files changed
Lines changed: 90 additions & 6 deletions
File tree
- .changeset
- packages/create-objectstack/src
- templates
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
70 | 68 | | |
| 69 | + | |
71 | 70 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
76 | 74 | | |
77 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
| |||
0 commit comments