Skip to content

Commit c4a685c

Browse files
authored
feat(cli): hand over every generator and drop the docs command (#439)
* feat(typescript): hand the template modules over on eject, and make requirements and agent-docs ejectable `meta eject <name>` used to copy a thin generator that decided what to emit and called the package to write it. It now also copies the transitive closure of the template modules the generator calls into `codegen/templates/`, the way it already copies the HTTP adapter, and the owned generator imports them from there. The engine (generator base, model walks, naming and type-mapping tables, projection and report lowering) stays in the package; `ENGINE_MODULES` lists it and the shared eject manifest's engine surface carries the same list. `requirements` and `agent-docs` get reference templates, are listed in `docs.generators`, and `meta docs` runs an owned copy in place of the packaged one. `meta gen` skips the packaged factory of either, as it does for `docsFile()`. Every one of the 24 ejectable generators is ejected alone into an empty project by a test derived from the catalog: nothing it holds imports a packaged emit module, it typechecks as an adopter's project does, and it writes what the packaged generator writes over six models. The TypeScript entries are gone from the manifest's pending list. The repository's own owned copies (the test-generators package and the examples) carry their template modules, written by scripts/sync-owned-template-copies.ts and held by a test. The release checklist's assess block now fails the deploy. * feat(typescript)!: documentation is generators in `generators`; `meta docs` is removed ADR-0034 Amendment 9, the TypeScript half. Every page of documentation is an entry in `generators`, `meta gen` runs the list, `meta verify --codegen` checks it, and nothing is written that the list does not declare. - `meta docs` and `meta verify --docs` print the amendment's removal line and exit 2. A config with a `docs` block fails `meta gen` and `meta verify --codegen` before writing anything; `meta gen` with no metaobjects.config.ts fails with a pointer to the migration section. `meta init` writes no docs block. A config that declares no generator writes nothing, tool state included. - Docs factories write to the `docs` target and are refused by name when it is missing. New: `metamodelDocsFile()` (`metamodel-docs`, ejectable) and `docsSiteFile()` (`docs-site`); `meta eject docs-site` copies the site theme. The site prints no date, so its pages are checkable. The runner builds the model/api cross-link facts per target (`ctx.docs`) from `emitsModelDocs` / `emitsApiDocs`, and the agent schema on request. - `meta gen --generators <names>` narrows a run to declared entries and refuses others; a narrowed run reads run-level facts from the whole list. `meta gen` now passes the routes `expose` facts to the api reference, which it never did. - `meta verify --codegen` does not check documentation the repository git-ignores, says how many pages it skipped, and refuses a docs directory ignored whole (carried from `verify --docs`). - Owned generators and templates import the engine from the new `@metaobjectsdev/codegen-ts/engine` entry; zodEnumExpr, the primary-key and TPH walks moved into engine/template modules with forwarders where they were exported. - Removed from the package root: DocsConfig, ResolvedDocsConfig, DocsSurface, resolveDocsConfig. `apiDocsFile()` writes under `api/` by default. - Docs: the TypeScript section of docs-are-generators.md, CHANGELOG breaking notice and entries, ADR-0034 Amendment 9 TypeScript cells corrected, cli.md, ports/typescript.md, own-your-codegen.md, and the shipped agent context for all five ports. AGENTS.md no longer says 1.1.0 is released. * no-mistakes(review): Route owned docs copies to docs target; fix probe inputs * no-mistakes(review): Skip git-ignored docs dirs in verify; fix TS wiring row * no-mistakes(review): Name AGENT-API.md relative to the docs target * no-mistakes(review): Correct TypeScript package-only count and eject hand-over docs * no-mistakes(review): Fix package-only list in AGENTS.md, comment, CHANGELOG count * no-mistakes(review): Correct docs scope text; add agent schema drift test * no-mistakes(review): Ask git about ignored docs pages from the project root
1 parent 5230ec3 commit c4a685c

384 files changed

Lines changed: 23254 additions & 7939 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎AGENTS.md‎

Lines changed: 11 additions & 10 deletions
Large diffs are not rendered by default.

‎CHANGELOG.md‎

Lines changed: 171 additions & 98 deletions
Large diffs are not rendered by default.

‎agent-context/servers/csharp.meta.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"displayName": "C#",
33
"install": "install the MetaObjects .NET tool (dotnet tool install) + add the MetaObjects.Codegen package",
44
"codegenCommand": "dotnet meta gen",
5-
"docsCommand": "dotnet meta docs",
6-
"docsCondition": "",
7-
"docsMissing": "",
5+
"docsCommand": "dotnet meta gen",
6+
"docsCondition": " (when the project's generator list declares the ApiDocsGenerator)",
7+
"docsMissing": "Declare `ApiDocsGenerator` in the generator list in codegen/Generators.cs if it is missing",
88
"apiSubDir": "api/csharp"
99
}

‎agent-context/servers/python.meta.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"displayName": "Python",
33
"install": "pip install metaobjects",
44
"codegenCommand": "metaobjects gen",
5-
"docsCommand": "metaobjects docs",
6-
"docsCondition": "",
7-
"docsMissing": "",
5+
"docsCommand": "metaobjects gen",
6+
"docsCondition": " (when a target's generator list declares `api-docs`)",
7+
"docsMissing": "Declare `api-docs` in that target's `generators` in metaobjects.config.yaml if it is missing",
88
"apiSubDir": "api/python"
99
}

‎agent-context/servers/typescript.meta.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"displayName": "TypeScript",
33
"install": "npm install -D @metaobjectsdev/cli @metaobjectsdev/codegen-ts",
44
"codegenCommand": "npx meta gen",
5-
"docsCommand": "npx meta docs",
5+
"docsCommand": "npx meta gen",
66
"docsCondition": "",
77
"docsMissing": "",
88
"apiSubDir": "api"

‎agent-context/skills/metaobjects-audit/references/capability-checklist.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ classify it (using the classification scheme in `SKILL.md`) and route the cutove
8888
names artifact from the declaration, so a literal is a second source of truth even when it
8989
agrees with the naming strategy today. A typed ORM handle in its place is correct. **Check
9090
the artifact is emitted at all before scoring the literals: on every port the selection IS
91-
the complete list — the config's on TypeScript and the JVM, `--generators` on C# and Python —
91+
the complete list, documentation included — `generators: [...]` in `metaobjects.config.ts`
92+
(TypeScript), `codegen/Generators.cs` (C#), a target's `generators` in
93+
`metaobjects.config.yaml` (Python), `<generators>` in the pom (Java, Kotlin) —
9294
so an existing project emits none and the un-wired generator is the finding FIRST** (no port
93-
ships a default suite; ADR-0034 Amendment 2). **This entry is the physical-name INSTANCE of signature 11.** The rule that
95+
ships a default suite; ADR-0034 Amendments 2 and 9). **This entry is the physical-name INSTANCE of signature 11.** The rule that
9496
generates the rest — and the reason an enum member compared as a bare string is NOT one — is
9597
the Cross-cutting entry below.
9698
- **`@kind` = `view` / `materializedView`** — hunt hand-written SQL views where an authored
@@ -272,8 +274,8 @@ to nothing, and does not check that each claimed node complies).
272274
accepted.
273275
- **The doc slots behave differently on this node type** — do not audit them by the generic
274276
rule below. `title` is CHARTERED here (a requirement's `name` is an identifier, so the label
275-
lives in `title`) and is **rendered** by `meta docs`, heading each entry after its dotted
276-
path; `summary` is INERT (nothing reads it, and `@statement` is already the required
277+
lives in `title`) and is **rendered** by `meta gen`'s `requirementsFile()`, heading each
278+
entry after its dotted path; `summary` is INERT (nothing reads it, and `@statement` is already the required
277279
one-liner) and `meta verify` warns on one. So an absent `summary` is correct, a populated
278280
one is the finding, and a populated `title` is correct.
279281
- **CALIBRATION — entirely opt-in and warning-only where it counts.** A project declaring no

‎agent-context/skills/metaobjects-audit/references/csharp.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ Generated files are named `<Entity>.g.cs` and carry an `@generated` guard commen
2626
The metadata source directory is the first positional arg (`<metadataDir>`); `--out`
2727
is required (errors if absent, no default). The runner overwrites only files bearing
2828
this header; it refuses to touch files without it. Locate the output directory from
29-
how the team invokes `dotnet meta gen` (or a CI script) — the arg is explicit, there
30-
is no config file equivalent on the C# side.
29+
`codegen/Generators.cs` (the project's generator list, each entry's `OutDir` init
30+
property — scaffolded by `dotnet meta init`, new in 1.1.0) or, for a project that predates
31+
it, from how the team invokes `dotnet meta gen` (or a CI script).
3132

3233
---
3334

@@ -73,7 +74,7 @@ copies the helper runtime the generated routes call (`FilterParser`, `EfCoreFilt
7374
`codegen/runtime/` under the namespace `Codegen.Runtime`. That folder is owned code, not a
7475
hand-rolled filter parser: do not flag it. `dotnet meta gen --list` marks each owned copy
7576
`identical` or `DIFFERS`. A generator the project WRITES is an `IGenerator` listed in
76-
`codegen/Program.cs` the same way.
77+
`codegen/Generators.cs` the same way.
7778

7879
**A finding of the form "the built-ins do not emit the shape this project needs", or a
7980
hand-written layer the model fully describes, resolves to a generator the project writes**

‎agent-context/skills/metaobjects-audit/references/drift-signatures.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Per finding: `file:line` → what → generated-equivalent exists? → recommend
3939

4040
**Score only where a constant actually exists.** A fact declared in the project's CODEGEN CONFIG rather than in metadata — a bespoke route mount path, a hand-chosen JSON envelope key — is genuinely spelled twice when a client re-types it, but no generated constant holds it. That is a GENERATOR GAP, reported as one, never a literal-site finding: never invent a constant that the emitters do not emit.
4141

42-
**No verify subverb sees this** — `--codegen` diffs generated files, `--db` compares schema to metadata — so this audit is the only gate. Remedy: reference the constant — but **check the artifact is emitted at all before scoring the literals, because on ALL FIVE ports an existing project emits none until it asks**. ADR-0034 Amendment 2 made codegen opt-in everywhere: C# and Python require `--generators`, TypeScript's `generators: [...]` and the JVM's `<generators>` are each the COMPLETE list, and `meta init` scaffolds `generators: []` — so no port begins emitting this artifact merely because the package was upgraded. Where no artifact exists, the un-wired generator is the FIRST finding and the first remedy (`namesFile()` on TS after `meta eject names`; `SpringNamesGenerator` / `KotlinNamesGenerator` in the pom) — score the literals under it rather than as N independent findings, since one config line fixes the cause and generated code stops embedding the names too.
42+
**No verify subverb sees this** — `--codegen` diffs generated files, `--db` compares schema to metadata — so this audit is the only gate. Remedy: reference the constant — but **check the artifact is emitted at all before scoring the literals, because on ALL FIVE ports an existing project emits none until it asks**. ADR-0034 Amendment 2 made codegen opt-in everywhere, and on every port the project's own generator list is the COMPLETE list, documentation included (Amendment 9) — `generators: [...]` in `metaobjects.config.ts` (TypeScript), `codegen/Generators.cs` (C#), a target's `generators` in `metaobjects.config.yaml` (Python), `<generators>` in the pom (Java, Kotlin) — and `meta init` scaffolds `generators: []` — so no port begins emitting this artifact merely because the package was upgraded. Where no artifact exists, the un-wired generator is the FIRST finding and the first remedy (`namesFile()` on TS after `meta eject names`; `SpringNamesGenerator` / `KotlinNamesGenerator` in the pom) — score the literals under it rather than as N independent findings, since one config line fixes the cause and generated code stops embedding the names too.
4343

4444
**Report TWO numbers for this signature, always, and never just the first: (a) is the artifact EMITTED, and (b) how many of the literal sites actually IMPORT it — the adoption ratio, as `<adopted>/<total> sites`.** Emission is the cheap half and it is the half that gets done: measured on an adopter whose audit proved the artifact emitted correctly, ran the generator to show it, and then adopted it at **0 of 53 sites** (37 table + 16 column). Wiring the generator changes the scorecard; it changes nothing a reader of the code experiences, because the second spelling is still the one every query uses. An audit that reports only (a) makes the estate look upgraded while every literal it found is still there — so a project that emits the artifact and imports it nowhere scores WORSE than one that has not started, not better, because it now carries a third spelling that claims to be the source of truth.
4545

‎agent-context/skills/metaobjects-audit/references/requirements.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ functional one.
8282
model. If the tree is flat, or every entry is L3, the levels are carrying no information and
8383
should be simplified rather than defended.
8484

85-
**6. Titles that are not labels.** `title` is now **rendered** — `meta docs` heads each entry
86-
`## checkout.payment — Payment capture`, the path first and the label after it — so a slot
85+
**6. Titles that are not labels.** `title` is now **rendered** — `meta gen`'s
86+
`requirementsFile()` heads each entry `## checkout.payment — Payment capture`, the path
87+
first and the label after it — so a slot
8788
that used to be inert is read by every reader of the generated page. The lint catches only
8889
the id-shaped case (`FR-448 …`); it cannot tell a *useless* label from a good one. Read the
8990
titles: one that restates `@statement`, or repeats the path in prose, is now visible noise in

‎agent-context/skills/metaobjects-authoring/references/reporting.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ A concrete report whose read source is `@kind: view` is served by every port's g
167167
- **Every derived field with filter operators is filterable and sortable**, dimension and measure alike, with its type's own operators. You cannot narrow that set: a report has no field to put `@filterable` on. A field of the `@from` entity that the report does not expose is refused with a `400`.
168168
- A time dimension at `day` or coarser is `YYYY-MM-DD`; a null measure is `null` with the key present (a measure with `@default` is never null); `currency` is integer minor units.
169169
- **A decimal (`avg`, a ratio, a `sum` of a decimal) has no agreed JSON spelling**: each port sends its own (TypeScript a string). Do not compare one across backends as text.
170-
- `meta docs` writes a model page for every report (a sourceless one is marked "Not served") and an API page for a served one.
170+
- `meta gen` writes a model page for every report (`docsFile()`; a sourceless one is marked "Not served") and an API page for a served one (`apiDocsFile()`) — each an ordinary entry in `generators`.
171171

172172
The files each port generates are in the `metaobjects-codegen` skill's reference for that language ("Reports").
173173

0 commit comments

Comments
 (0)