Skip to content

Commit d5d9cb9

Browse files
committed
site(getting-started): show the terminal output a human sees, not the piped format
The 1.0.4 rewrite captured `meta gen --list --probe`, `eject`, `gen` and `migrate` through a pipe, and the CLI's default format is TTY-aware, so the page showed the machine (TOON) format. Nobody following the page at a terminal sees that. The four blocks are now the `--format text` output from a published 1.0.4 run; the `meta gen` block goes back to the text shape the page had before. AGENTS.md says to capture with `--format text`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BHEQGNA9McKNBwDkesNMDC
1 parent 93e53b0 commit d5d9cb9

2 files changed

Lines changed: 45 additions & 48 deletions

File tree

AGENTS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ scaffold's authoritative source is the monorepo's
2929
`buildMetaobjectsConfigBody`, `SCAFFOLD_SUMMARY`, `NEXT_STEPS`). For the rest, **run the flow
3030
end to end against the published CLI in a scratch project OUTSIDE `/tmp`** and copy from what
3131
it prints. A stale `/tmp/node_modules` shadows packages the project did not install, so a run
32-
there can pass on a page that fails for a newcomer. Don't work from memory or the CHANGELOG.
32+
there can pass on a page that fails for a newcomer. **Capture with `--format text`**, or from a real
33+
terminal: the CLI's default format is TTY-aware, so a piped capture prints the machine format
34+
(TOON), which no human following the page will see. Don't work from memory or the CHANGELOG.
3335

3436
Since 1.0.4 (ADR-0034 Amendment 2) `meta init` scaffolds `codegen/generators/` EMPTY with
3537
`generators: []`, no dependencies, and no `src/db.ts`. The page's doctrinal claim is that the

www/getting-started.html

Lines changed: 42 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -179,45 +179,32 @@ <h2 class="section-label">5 · Choose your generators</h2>
179179
<p class="gs-note">Ask the catalog what your model can generate. <code>--probe</code> runs every generator against
180180
<em>your</em> metadata and reports how many files each would emit:</p>
181181
<pre class="gs-code">$ npx meta gen --list --probe
182-
[25]:
183-
- name: entity
184-
kind: generator
185-
layer: model
186-
<span class="c"></span>
187-
project:
188-
wired: false
189-
frameworkDetected: null
190-
wouldEmit: 1
191-
<span class="c"></span>
192-
- name: routes
193-
kind: generator
194-
layer: api
195-
framework: fastify
196-
<span class="c"></span>
197-
project:
198-
wired: false
199-
frameworkDetected: false
200-
wouldEmit: null
201-
probeError: "[routes-file] codegen config is missing dbImport — …"
202-
<span class="c"># … every generator, grouped by layer: model, persistence, api, client,</span>
203-
<span class="c"># docs, capability — plus the ai and iam libraries</span></pre>
204-
<p class="gs-note">The <code>routes</code> row is already telling you what it needs: a <code>dbImport</code>,
205-
which you'll add below. Take the ones you want. <code>meta eject</code> copies each into
182+
Generator catalog — nothing runs until you wire it in `generators: [...]`.
183+
184+
model — the entity modules and the constants beside them
185+
barrel — Single index.ts re-exporting every generated entity module. [would emit 1]
186+
requires: entity
187+
entity — Per-entity Drizzle table + typed model module (the entity module). [would emit 1]
188+
names — Per-entity physical database name constants (table/view, schema, columns). [would emit 1]
189+
persistence — how rows are read and written
190+
queries — Per-entity typed query helpers (findById/create/...). [would emit 1]
191+
requires: entity
192+
api — the HTTP surface — pick ONE framework
193+
routes — Per-entity Fastify CRUD routes (drizzle-fastify mountCrudRoutes). [fastify]
194+
requires: entity
195+
routes-hono — Per-entity Hono CRUD routes (runtime-ts/hono mountCrudRoutes). [hono, would emit 1]
196+
<span class="c"># … client, docs and capability generators, then the ai and iam libraries</span></pre>
197+
<p class="gs-note">Take the ones you want. <code>meta eject</code> copies each into
206198
<code>codegen/generators/</code> and tells you exactly how to wire it:</p>
207199
<pre class="gs-code">$ npx meta eject entity queries routes names barrel
208-
ejected[5]:
209-
- name: entity
210-
path: codegen/generators/entity.ts
211-
status: created
212-
wire:
213-
import: "import { entityFile } from \"./codegen/generators/entity.js\";"
214-
entry: entityFile()
215-
<span class="c"># … queries, routes, names, barrel</span>
216-
install:
217-
dev[1]: @metaobjectsdev/codegen-ts@^<span data-registry="npm">1.0.4</span>
218-
<span class="c"># … and the runtime packages the generated code imports</span>
219-
config:
220-
keys[9]: apiPrefix,collectionNameOverrides,columnNamingStrategy,dbImport,dialect,extStyle,…</pre>
200+
Ejected "entity" -> codegen/generators/entity.ts. You own it now (ADR-0034 scaffold-and-own).
201+
In metaobjects.config.ts, "entityFile" must resolve to this file:
202+
import { entityFile } from "./codegen/generators/entity.js";
203+
<span class="c"># … the same for queries, routes, names and barrel</span>
204+
205+
Install what the ejected generators and their output need:
206+
<span class="c"> # … the packages below</span>
207+
These generators read config: apiPrefix, collectionNameOverrides, columnNamingStrategy, dbImport, dialect, extStyle, …</pre>
221208
<p class="gs-note">Those five files are the point: they're plain TypeScript in your repo, and <strong>yours to
222209
edit</strong>. <code>meta gen</code> runs those local copies — not the ones inside the package — so changing
223210
the shape of the generated code is an ordinary edit to a file you own. Install what they import:</p>
@@ -255,13 +242,15 @@ <h2 class="section-label">5 · Choose your generators</h2>
255242
<section>
256243
<h2 class="section-label">6 · Generate</h2>
257244
<pre class="gs-code">$ npx meta gen
258-
gen[5]{file,status}:
259-
src/generated/Task.ts,<span class="n">new</span>
260-
src/generated/Task.queries.ts,<span class="n">new</span>
261-
src/generated/Task.routes.ts,<span class="n">new</span>
262-
src/generated/Task.names.ts,<span class="n">new</span>
263-
src/generated/index.ts,<span class="n">new</span>
264-
summary: 5 written</pre>
245+
meta gen — sqlite, src/generated
246+
247+
<span class="n">NEW</span> src/generated/Task.ts
248+
<span class="n">NEW</span> src/generated/Task.queries.ts
249+
<span class="n">NEW</span> src/generated/Task.routes.ts
250+
<span class="n">NEW</span> src/generated/Task.names.ts
251+
<span class="n">NEW</span> src/generated/index.ts
252+
253+
5 written</pre>
265254
<p class="gs-note">That's a real run. You get four things per entity (plus a barrel):</p>
266255
<ul class="gs-note">
267256
<li><code>Task.ts</code> — the <strong>entity</strong>: a Drizzle table, Zod insert/update schemas, a typed
@@ -310,9 +299,15 @@ <h2 class="section-label">7 · Wire your database</h2>
310299
generated queries</a>. Then create the tables. <code>meta migrate</code> diffs the live database against the
311300
model and writes a paired <code>up.sql</code>/<code>down.sql</code> under <code>.metaobjects/migrations/</code>:</p>
312301
<pre class="gs-code">$ npx meta migrate --from-db --db file:dev.sqlite --dialect sqlite --slug init --apply
313-
changes[1]{kind,count}:
314-
create-table,1
315-
summary: 1 create-table; applied 1 migration(s)</pre>
302+
meta migrate — sqlite, file:dev.sqlite
303+
304+
Changes: 1 create-table
305+
306+
Written:
307+
.metaobjects/migrations/&lt;timestamp&gt;-init/up.sql
308+
.metaobjects/migrations/&lt;timestamp&gt;-init/down.sql
309+
310+
migrate: applied 1 migration(s): &lt;timestamp&gt;-init</pre>
316311
</section>
317312

318313
<section>

0 commit comments

Comments
 (0)