Repository navigation
feat(codegen-ts): make shared-model, docs and api-docs ejectable; remove mermaid-er - #431
Merged
Merged
Conversation
…; the standalone mermaid-er generator is removed
Every stock TypeScript generator can now be ejected except `template`, the
Mustache primitive, which has no emit logic of its own to own. ADR-0034
Amendment 7 records the rulings and the reasoning.
shared-model: the artifact a consumer's `meta deps sync` verifies stays in the
package. `buildSharedModel` (load, select, closure check, serialize,
core-vocabulary re-load) and `renderSharedModelFiles` (file names, hash,
manifest) are public; the reference template calls both and owns which source
files may contribute and where the published version comes from.
docs and api-docs: `meta docs` gained a seam. An owned copy is listed in the
docs door's own config, `docs: { generators: [...] }`, and carries a
`docsSurface` marker saying which surface it takes over. `meta docs` runs it in
place of the packaged generator and `meta verify --docs` checks against it. The
facts the door used to pass as factory options ride on `ctx.docsDoor`. A docs
generator placed in the top-level `generators` is skipped by `meta gen` with a
warning that names `docs.generators`; an entry with no marker, or two for one
surface, is refused by name. `meta eject docs` prints the docs block wiring and
never the array `meta gen` runs. `buildApiModelForRun(ctx)` gathers the run
facts the API model reads, so an owned copy picks up a new one on upgrade.
mermaid-er: removed, by maintainer ruling. The standalone generator was the
older home of a diagram `meta docs` still draws. `mermaidErDiagram()`, its
`/generators` export, its registry row and the cross-port manifest row are
gone; the diagrams `meta docs` writes are unchanged byte for byte. A config
that still names `"mermaid-er"` or imports `mermaidErDiagram` fails with a
message saying it was removed and that `meta docs` draws the diagram, whether
the import is in the config or in a module the config imports. ADR-0022 Part 2
D1 is amended to match.
The signals `meta gen`, `meta gen --list` and `meta verify` give about a doc
generator under `generators` cover an owned copy too, and tell its owner to
move it to the docs block where a packaged generator is removed: `runGen`
reports it in `skippedDocGenerators` and names it in the new
`skippedOwnedDocGenerators`, the next step and the `doc-generator-in-gen`
advisory say "move", and a copy listed in the docs block marks its catalog row
as wired there. The catalog withholds a `generators` import line by the
`docsSurface` marker, not by layer. `meta verify` reports the removed name
`"mermaid-er"` as refused, with the message `meta gen` fails with.
Fixed while proving the drift check: `meta verify --codegen` passed generators
neither the project's source files nor a way to read the project, so it failed
with "no source files to load" for any project wiring `sharedModelFile()`.
`runGen` takes `inputRoot` and generators read the project through
`ctx.inputRoot`; `ctx.projectRoot` keeps its meaning.
Packaged output is unchanged and gated to be: the byte-identity gate holds each
new reference to the packaged generator, and holds the packaged docs generators
to the same bytes under the door as from the same facts passed as options.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
shared-model,docsandapi-docscan now be ejected withmeta eject. The owned copies ofdocsandapi-docsare listed in a newdocs: { generators: [...] }key inmetaobjects.config.tsand run bymeta docs/meta verify --docsin place of the packaged generator.buildSharedModelandrenderSharedModelFilesare exported from@metaobjectsdev/codegen-tsso an ejectedshared-modelcopy keeps the same publish and verify behavior.templatestays package-only.mermaid-ergenerator is removed (mermaidErDiagram,MermaidErOptions, the"mermaid-er"name, and its registry and manifest entries).meta docsstill draws the same Mermaid diagrams on the overview and entity pages. A config that still wires it fails with a removal message.meta docsnow stops with exit 2 on ametaobjects.config.tsthat fails to load, instead of warning and writing model pages.ctx.inputRootis added so generators can read the project's own files.meta verify --codegennow passesshared-modelthe project source files it needs.Runs: 2. Run 1 passed after two review fix rounds (seven findings fixed). Run 2 re-validated the branch after
mainwas merged in to resolve aCHANGELOG.mdconflict, with no findings.Validation
Risk Assessment
mermaidErDiagram/"mermaid-er"), makesmeta docsfatal on a config that fails to load, and adds a newdocs.generatorsseam; all three are intent- or decision-authorized, documented in the CHANGELOG and covered by end-to-end tests through the built CLI.Testing
Drove the real TS meta CLI against a disposable project. Ejection of shared-model, docs and api-docs works. mermaid-er is removed and rejected as unknown. Docs still emits Mermaid diagrams. Owned docs copy runs when wired. A config that exists but fails to load is fatal with nothing written. An owned generator error is shown plainly. A commented-out import does not break config load. Regression suites: cli 1581 pass, codegen-ts 2633 pass, zero failures. Scratch project removed; worktree clean.
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchainsbun server/typescript/packages/cli/bin/meta.ts init (disposable project in /tmp, then removed)meta gen --list / meta eject --list --format json|text: shared-model, docs, api-docs listed ejectable; mermaid-er absentmeta eject mermaid-er -> exit 2, 'unknown name(s)', ejectable list excludes itmeta eject shared-model docs api-docs -> codegen/generators/*.ts written, exit 0meta eject docs --format json -> wire.into present, no door fieldmeta docs with owned docs wired into generators (marker run) -> owned copy executesmeta docs with owned docs throwing ENOENT -> 'meta: ENOENT: ...' exit 2, no template-layout advicemeta docs with metaobjects.config.ts syntax error -> exit 2, ParseError shown, docs/generated not writtenconfig with commented-out mermaidErDiagram import -> gen --list exit 0meta docs with no metaobjects.config.ts -> agent surface skipped note, exit 0meta docs generates Mermaid erDiagram block in docs/generated/README.mdbun test in server/typescript/packages/cli (1581 pass, 0 fail, 3 skip)bun test in server/typescript/packages/codegen-ts (2633 pass, 0 fail)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.