Skip to content

Commit 4d44ec9

Browse files
dmealingclaude
andcommitted
feat(cli): surface meta docs as a next-step command (not a meta gen generator)
Discoverability fix for the PM review's gap: neutral metadata docs were undiscoverable. The architecturally-correct fix per ADR-0021 D1 is NOT to add docsFile() to the metaobjects.config.ts generators array (docsFile() is @deprecated for meta gen — it is the internal engine of the `meta docs` command, the single door for neutral docs). Instead, surface `meta docs` in the init next-steps block + add a guard test that the scaffold does not route neutral docs through meta gen. apiDocsFile() (Tier-1 SDK reference) stays in the generators array; its comment now points at `meta docs` for neutral docs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e75482b commit 4d44ec9

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

server/typescript/packages/cli/src/commands/init.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default defineConfig({
4848
queriesFile(),
4949
routesFile(),
5050
barrel(),
51-
apiDocsFile(),
51+
apiDocsFile(), // SDK/API reference -> <outDir>/docs/api/ (for neutral model docs, run: meta docs)
5252
],
5353
});
5454
`;
@@ -60,6 +60,7 @@ Initialized metaobjects/ + .metaobjects/ + metaobjects.config.ts
6060
Next steps (when later sub-projects ship):
6161
meta ingest # propose entities from your existing TS code
6262
meta gen # codegen TS targets from entities
63+
meta docs # neutral model docs (entity + template pages, incl. linked template source)
6364
meta serve # local viewer
6465
meta install-hooks # register MCP server + Claude Code hooks
6566
`;

server/typescript/packages/cli/test/unit/init-scaffold-config.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, test, expect, beforeEach, afterEach } from "bun:test";
22
import { mkdtempSync, rmSync, existsSync, readFileSync, writeFileSync } from "node:fs";
33
import { tmpdir } from "node:os";
44
import { join } from "node:path";
5-
import { init } from "../../src/commands/init.js";
5+
import { init, nextStepsBlock } from "../../src/commands/init.js";
66

77
let tmp: string;
88
beforeEach(() => { tmp = mkdtempSync(join(tmpdir(), "forge-init-")); });
@@ -22,6 +22,18 @@ describe("meta init scaffolds metaobjects.config.ts", () => {
2222
expect(result.created).toContain("metaobjects.config.ts");
2323
});
2424

25+
test("does NOT route neutral docs through meta gen (ADR-0021 D1: meta docs is the single door)", async () => {
26+
// docsFile() is the INTERNAL engine of the `meta docs` command, not a `meta gen`
27+
// config generator. Scaffolding it into metaobjects.config.ts would resurrect the
28+
// exact second-door the @deprecated note on docsFile() forbids. Discoverability of
29+
// neutral docs is via the `meta docs` command (surfaced in the next-steps block),
30+
// not the generators array.
31+
await init({ cwd: tmp, quiet: true });
32+
const body = readFileSync(join(tmp, "metaobjects.config.ts"), "utf-8");
33+
expect(body).not.toContain("docsFile");
34+
expect(nextStepsBlock()).toContain("meta docs");
35+
});
36+
2537
test("does not overwrite an existing metaobjects.config.ts on subsequent runs", async () => {
2638
await init({ cwd: tmp, quiet: true });
2739
const before = readFileSync(join(tmp, "metaobjects.config.ts"), "utf-8");

0 commit comments

Comments
 (0)