@metamesh/cli 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/CHANGELOG.md +160 -0
  2. package/README.md +75 -52
  3. package/dist/authoring/artifacts.d.ts +2 -2
  4. package/dist/authoring/artifacts.d.ts.map +1 -1
  5. package/dist/authoring/artifacts.js +50 -32
  6. package/dist/authoring/artifacts.js.map +1 -1
  7. package/dist/authoring/check.d.ts.map +1 -1
  8. package/dist/authoring/check.js +9 -3
  9. package/dist/authoring/check.js.map +1 -1
  10. package/dist/authoring/documentation-manifest.d.ts +3 -0
  11. package/dist/authoring/documentation-manifest.d.ts.map +1 -0
  12. package/dist/authoring/documentation-manifest.js +23 -0
  13. package/dist/authoring/documentation-manifest.js.map +1 -0
  14. package/dist/authoring/documentation.d.ts +20 -0
  15. package/dist/authoring/documentation.d.ts.map +1 -0
  16. package/dist/authoring/documentation.js +94 -0
  17. package/dist/authoring/documentation.js.map +1 -0
  18. package/dist/authoring/environment.d.ts +1 -19
  19. package/dist/authoring/environment.d.ts.map +1 -1
  20. package/dist/authoring/environment.js +2 -110
  21. package/dist/authoring/environment.js.map +1 -1
  22. package/dist/authoring/{worker.d.ts → execution-process.d.ts} +2 -2
  23. package/dist/authoring/execution-process.d.ts.map +1 -0
  24. package/dist/authoring/{worker.js → execution-process.js} +17 -19
  25. package/dist/authoring/execution-process.js.map +1 -0
  26. package/dist/authoring/{capture/render-client.js → render/client-bundle.js} +196 -196
  27. package/dist/authoring/{capture/render-client.js.map → render/client-bundle.js.map} +4 -4
  28. package/dist/authoring/{render-client.d.ts → render/client.d.ts} +2 -2
  29. package/dist/authoring/render/client.d.ts.map +1 -0
  30. package/dist/authoring/{render-client.js → render/client.js} +2 -2
  31. package/dist/authoring/render/client.js.map +1 -0
  32. package/dist/authoring/{render.d.ts → render/render-capture.d.ts} +2 -2
  33. package/dist/authoring/render/render-capture.d.ts.map +1 -0
  34. package/dist/authoring/{render.js → render/render-capture.js} +4 -4
  35. package/dist/authoring/render/render-capture.js.map +1 -0
  36. package/dist/authoring/{render-scene.d.ts → render/scene.d.ts} +2 -2
  37. package/dist/authoring/render/scene.d.ts.map +1 -0
  38. package/dist/authoring/{render-scene.js → render/scene.js} +6 -10
  39. package/dist/authoring/render/scene.js.map +1 -0
  40. package/dist/authoring/{render-types.d.ts → render/types.d.ts} +3 -3
  41. package/dist/authoring/render/types.d.ts.map +1 -0
  42. package/dist/authoring/render/types.js +2 -0
  43. package/dist/authoring/render/types.js.map +1 -0
  44. package/dist/authoring/run.d.ts.map +1 -1
  45. package/dist/authoring/run.js +7 -3
  46. package/dist/authoring/run.js.map +1 -1
  47. package/dist/authoring/types.d.ts +20 -14
  48. package/dist/authoring/types.d.ts.map +1 -1
  49. package/dist/authoring/types.js.map +1 -1
  50. package/dist/authoring.d.ts +5 -4
  51. package/dist/authoring.d.ts.map +1 -1
  52. package/dist/authoring.js +3 -2
  53. package/dist/authoring.js.map +1 -1
  54. package/dist/docs/guides/agent-authoring.md +71 -51
  55. package/dist/docs/guides/package.md +75 -52
  56. package/dist/docs/manifest.json +1 -1
  57. package/dist/docs/reference/authoring/AUTHORING_PROTOCOL_VERSION.md +1 -1
  58. package/dist/docs/reference/authoring/AuthoringDiagnostic.md +1 -1
  59. package/dist/docs/reference/authoring/AuthoringEnvironment.md +1 -1
  60. package/dist/docs/reference/authoring/AuthoringError.md +1 -1
  61. package/dist/docs/reference/authoring/AuthoringFailure-type.md +1 -1
  62. package/dist/docs/reference/authoring/AuthoringKind.md +1 -1
  63. package/dist/docs/reference/authoring/AuthoringPhase.md +1 -1
  64. package/dist/docs/reference/authoring/CapturedBuffer.md +1 -1
  65. package/dist/docs/reference/authoring/CapturedGeometry.md +1 -1
  66. package/dist/docs/reference/authoring/CapturedPart.md +4 -6
  67. package/dist/docs/reference/authoring/CapturedResource.md +2 -2
  68. package/dist/docs/reference/authoring/CapturedRun.md +1 -1
  69. package/dist/docs/reference/authoring/CapturedRunManifest.md +3 -3
  70. package/dist/docs/reference/authoring/CheckOptions.md +1 -1
  71. package/dist/docs/reference/authoring/CheckSuccess.md +1 -1
  72. package/dist/docs/reference/authoring/DocumentationEntry.md +1 -1
  73. package/dist/docs/reference/authoring/DocumentationManifest.md +1 -1
  74. package/dist/docs/reference/authoring/DocumentationSearchResult.md +1 -1
  75. package/dist/docs/reference/authoring/InstalledAuthoringPackage.md +1 -1
  76. package/dist/docs/reference/authoring/RenderCamera.md +1 -1
  77. package/dist/docs/reference/authoring/RenderFormat.md +1 -1
  78. package/dist/docs/reference/authoring/RenderOptions.md +1 -1
  79. package/dist/docs/reference/authoring/RenderResult.md +1 -1
  80. package/dist/docs/reference/authoring/RenderView.md +1 -1
  81. package/dist/docs/reference/authoring/RenderedImage.md +1 -1
  82. package/dist/docs/reference/authoring/RunOptions.md +13 -5
  83. package/dist/docs/reference/authoring/RunSuccess.md +1 -1
  84. package/dist/docs/reference/authoring/authoringFailure-value.md +1 -1
  85. package/dist/docs/reference/authoring/checkAuthoringSource.md +1 -1
  86. package/dist/docs/reference/authoring/discoverAuthoringEnvironment.md +1 -1
  87. package/dist/docs/reference/authoring/inspectCapturedRun.md +1 -1
  88. package/dist/docs/reference/authoring/installAuthoringBrowser.md +1 -1
  89. package/dist/docs/reference/authoring/readCapturedRun.md +1 -1
  90. package/dist/docs/reference/authoring/renderCapturedRun.md +1 -1
  91. package/dist/docs/reference/authoring/runAuthoringSource.md +1 -1
  92. package/dist/docs/reference/authoring/searchAuthoringDocumentation.md +1 -1
  93. package/dist/docs/reference/authoring/showAuthoringDocumentation.md +1 -1
  94. package/dist/metamesh.js +22 -10
  95. package/dist/metamesh.js.map +1 -1
  96. package/package.json +9 -6
  97. package/dist/authoring/render-client.d.ts.map +0 -1
  98. package/dist/authoring/render-client.js.map +0 -1
  99. package/dist/authoring/render-scene.d.ts.map +0 -1
  100. package/dist/authoring/render-scene.js.map +0 -1
  101. package/dist/authoring/render-types.d.ts.map +0 -1
  102. package/dist/authoring/render-types.js +0 -2
  103. package/dist/authoring/render-types.js.map +0 -1
  104. package/dist/authoring/render.d.ts.map +0 -1
  105. package/dist/authoring/render.js.map +0 -1
  106. package/dist/authoring/worker.d.ts.map +0 -1
  107. package/dist/authoring/worker.js.map +0 -1
  108. /package/dist/authoring/{capture/render-client.js.LEGAL.txt → render/client-bundle.js.LEGAL.txt} +0 -0
@@ -2,12 +2,17 @@
2
2
 
3
3
  Use the CLI to find installed docs, check TypeScript, capture a model, and inspect measurements and rendered views.
4
4
 
5
- Use the `metamesh` CLI to look up the installed API, check TypeScript, generate a model, and inspect
6
- the captured result. It runs trusted local source with your ordinary Node permissions. Its
7
- disposable child process is not a security sandbox.
5
+ Use the `metamesh` CLI to build a model and check what it actually produced. You or your agent can
6
+ look up the installed API, check TypeScript, run the model, and inspect measurements and views of
7
+ the captured result. The CLI runs trusted local source with your ordinary Node permissions. Its
8
+ disposable child process isn't a security sandbox.
8
9
 
9
10
  ## Install and discover the environment
10
11
 
12
+ Use Node.js 24 or newer. The package APIs publish ES modules only. TypeScript API consumers
13
+ use TypeScript 6.0 or newer with `strict` checking and `NodeNext` or `Bundler` resolution;
14
+ the CLI includes its source-checking compiler.
15
+
11
16
  Install Modeling for your model code and the CLI for the local authoring workflow:
12
17
 
13
18
  ```bash
@@ -19,13 +24,12 @@ pnpm exec metamesh setup
19
24
 
20
25
  `environment` reports project-resolved versions, documentation locations, available capabilities,
21
26
  and `authoringProtocolVersion: 1`. An agent integration should check that protocol value before
22
- using the commands. Missing packages, mismatched releases, or an unsupported protocol need an
23
- environment fix before authoring.
27
+ using the commands. Fix missing packages, mismatched releases, or an unsupported protocol before
28
+ authoring.
24
29
 
25
30
  Add the Generator SDK as a direct dependency when defining Generators, and Testkit when writing
26
- automated tests.
27
- Ordinary models need only Modeling and the CLI as direct dependencies. Keep installed MetaMesh
28
- packages on matching releases.
31
+ automated tests. Ordinary models need only Modeling and the CLI as direct dependencies. Keep
32
+ installed MetaMesh packages on matching releases.
29
33
 
30
34
  | Component | Responsibility |
31
35
  | ------------------------- | --------------------------------------------------------------------------------------------- |
@@ -44,10 +48,10 @@ pnpm exec metamesh docs search "cylinder"
44
48
  pnpm exec metamesh docs show modeling/reference/model/cylinder
45
49
  ```
46
50
 
47
- The [standalone model example](https://metamesh.studio/docs/develop/standalone-model) is a short starting point.
48
- Use the [construction map](https://metamesh.studio/docs/develop/geometry-package#choose-a-modeling-path) to choose an
49
- approach, or search for a shape or symbol and read its recipe or reference. Search matches distinct
50
- words in titles, headings, keywords, and summaries. Exact titles, IDs, and imports take priority;
51
+ Start with the [standalone model example](https://metamesh.studio/docs/develop/standalone-model), or use the
52
+ [construction map](https://metamesh.studio/docs/develop/geometry-package#choose-a-modeling-path) to choose an approach
53
+ for your shape. You can also search for a shape or symbol and read its recipe or reference.
54
+ Search matches distinct words in titles, headings, keywords, and summaries. Exact titles, IDs, and imports take priority;
51
55
  equally complete intent matches favor guides.
52
56
 
53
57
  Documentation is resolved from the selected project through package exports. No global installation
@@ -63,7 +67,7 @@ covers authoring and verification; `metamesh-docs` covers documentation. Both ar
63
67
  Use a reviewed skill snapshot provided by your project or installed through your agent's skill
64
68
  tooling. The printed GitHub installation source must be published before that command can work;
65
69
  a skill is optional for the CLI workflow below. Skills teach the process. The installed npm
66
- documentation owns exact signatures, import paths, units, lifecycle, and availability.
70
+ documentation supplies exact signatures, import paths, units, execution rules, and availability.
67
71
 
68
72
  Project instructions should require environment discovery, relevant documentation lookup, source
69
73
  checking and execution, then measurement inspection and useful rendered views from that same run.
@@ -72,8 +76,8 @@ targeting another directory so every step resolves the same installation.
72
76
 
73
77
  ## Model entries
74
78
 
75
- A model entry default-exports an ordinary `ModelProgram`. It imports the real package; Studio's
76
- virtual `@metamesh/project` module is not available in local Node projects.
79
+ A model entry default-exports a `ModelProgram` and imports the installed package directly.
80
+ Studio's virtual `@metamesh/project` module isn't available in local Node projects.
77
81
 
78
82
 
79
83
 
@@ -83,7 +87,7 @@ import { box, cylinder, generate } from "@metamesh/modeling";
83
87
  export default generate<Record<never, never>>(({ part }) => {
84
88
  const body = box({ size: [30, 20, 6] });
85
89
  const bore = cylinder({ height: 8, radius: 3, sizing: "face" });
86
- return part("plate", body.subtract([bore]));
90
+ return part("plate", body.subtract(bore));
87
91
  });
88
92
  ```
89
93
 
@@ -92,27 +96,27 @@ export default generate<Record<never, never>>(({ part }) => {
92
96
  Save this as `model.ts`, then check and run it:
93
97
 
94
98
  ```bash
95
- pnpm exec metamesh check model.ts --kind model
99
+ pnpm exec metamesh typecheck model.ts --kind model
96
100
  pnpm exec metamesh run model.ts --kind model --export-3mf
97
101
  ```
98
102
 
99
- Both commands perform semantic TypeScript checking. They use the nearest project TypeScript
100
- configuration, or an explicit `--tsconfig`, with strict checking enforced. Ordinary local imports
101
- and installed dependencies are supported. `check` does not evaluate your source.
103
+ Both commands check TypeScript types using the nearest project TypeScript configuration, or an
104
+ explicit `--tsconfig`, with strict checking enforced. You can use ordinary local imports and
105
+ installed dependencies. `typecheck` doesn't evaluate your source.
102
106
 
103
107
  Use `--params values.json` for a model's JSON parameter map; the default is `{}`. Models do not
104
108
  receive injected Generator services. A standalone module can prepare licensed local fonts before
105
109
  constructing its synchronous generation program.
106
110
 
107
- For standalone font provenance, also pass `--font-fixtures fonts.json`. The CLI verifies those local
111
+ To record which local fonts you used, also pass `--font-fixtures fonts.json`. The CLI verifies those
108
112
  bytes and records their declared font selections and immutable revisions in the capture; the model
109
113
  still prepares its own fonts and receives no injected services. Arbitrary filesystem or network
110
- reads are not intercepted, so their asset identities cannot be inferred. The source fingerprint
114
+ reads aren't intercepted, so the CLI can't infer their asset identities. The source fingerprint
111
115
  covers bundled source, while fixture descriptors provide explicit asset provenance.
112
116
 
113
117
  ## Generator entries
114
118
 
115
- Install the Generator contract layer in addition to Modeling and the CLI:
119
+ Install the Generator SDK alongside Modeling and the CLI to define controls and package metadata:
116
120
 
117
121
  ```bash
118
122
  pnpm add @metamesh/generator-sdk
@@ -147,8 +151,8 @@ and assertion parameter IDs. It declares the ordinary Modeling program and packa
147
151
  the host still owns normalization, asset preparation, execution, and cleanup.
148
152
 
149
153
  ```bash
150
- pnpm exec metamesh check generator.ts --kind generator
151
- pnpm exec metamesh run generator.ts --kind generator --params values.json
154
+ pnpm exec metamesh typecheck generator.ts --kind generator
155
+ pnpm exec metamesh run generator.ts --kind generator --overrides values.json
152
156
  ```
153
157
 
154
158
  Generator runs merge declared defaults with explicit overrides, then validate strictly. Unknown
@@ -172,10 +176,11 @@ pnpm exec metamesh render RUN_DIRECTORY
172
176
  pnpm exec metamesh render RUN_DIRECTORY --views top --format webp --transparent
173
177
  ```
174
178
 
175
- Inspection reads finalized part IDs, placements, colors, measurements, diagnostics, and execution
176
- provenance. Rendering uses the same captured buffers without rerunning the model. Captures remain
179
+ Inspection reads the completed model's part IDs, placements, colors, measurements, diagnostics,
180
+ and execution provenance. Rendering uses the same captured buffers without rerunning the model,
181
+ so the dimensions you inspect and the views you render belong to the same result. Captures remain
177
182
  usable after the engine session is disposed or the directory moves. Corrupt or incomplete
178
- artifacts reject.
183
+ artifacts are rejected.
179
184
 
180
185
  Rendering requires the separately installed pinned Chromium. It is never downloaded implicitly;
181
186
  checking, generation, and inspection work without it. Standard orthographic views are isometric,
@@ -183,7 +188,7 @@ front, top, and right. The default is an isometric 1024 × 1024 PNG on a neutral
183
188
  lossless; PNG and WebP both support explicit transparent output. Images record their run, camera,
184
189
  renderer, and browser versions. Compare pixels only within the pinned capture environment.
185
190
 
186
- `--export-3mf` exports that run's finalized snapshot. A failed attempt never exposes an older
191
+ `--export-3mf` exports the completed model from that run. A failed attempt never exposes an older
187
192
  successful result as its output. Match the captured parameters and source fingerprint to the
188
193
  revision you intended to verify.
189
194
 
@@ -195,35 +200,50 @@ Install Testkit separately when you want assertions and fixtures for your existi
195
200
  pnpm add -D @metamesh/testkit
196
201
  ```
197
202
 
198
- Use `createGeneratorTestRunner(definition, runtime)` for a Generator's persistent generation
199
- session. `runner.withModel(parameters, callback)` awaits assertions and disposes its snapshot in
200
- `finally`; invalid output throws structured `GenerationError` diagnostics. Dispose the runner
201
- separately to release its session and caches. Testkit's `withModel(program, parameters, callback)`
202
- does the same for an ordinary `ModelProgram` and also disposes its temporary session; its optional
203
- fourth argument accepts session policy, prepared services, and a test-owned engine.
203
+ Use `await runModel(({ part }) => part("body", box({ size: 2 })))` for a one-off model, or
204
+ pass an existing program directly with `await runModel(program, parameters)`. Use
205
+ `await runModel({ definition, runtime }, parameters)` for a Generator. The returned result remains
206
+ usable after the helper releases its temporary session; no cleanup is required.
207
+ For cached Generators, exercise representative edits through
208
+ `createGeneratorTestRunner(definition, runtime, { verifyCache: true })` and its `run` method.
209
+ One-shot tests and declaration checks do not verify reuse across edits. Use `cache: false` for
210
+ an uncached output baseline; keep prepared services stable when testing reuse in the same session.
211
+ Callbacks run synchronously and return a part or an array of parts. Declare typed inline inputs
212
+ with `runModel<Parameters, Services>(callback, parameters, options)`, or reuse a
213
+ `GenerateCallback<Parameters, Services>`. Parameterless callbacks and Generator defaults can omit parameters. Options stay in the third
214
+ argument: use `undefined` for omitted parameters when supplying a test-owned engine, generation
215
+ policy, prepared model services, or a Generator's asynchronous `prepareServices` adapter.
216
+
217
+ For Generator integration tests, import the definition and default runtime from the real entry
218
+ point instead of repeating its input resolution and builder calls. Use direct callbacks to isolate
219
+ construction, reconstruct a mesh, or deliberately bypass schema validation.
204
220
 
205
- Use `runner.execute` when a test needs explicit snapshot ownership or the discriminated invalid
206
- result. Handle `type: "invalid"` before reading a generated `model`, and dispose each successful
207
- snapshot separately. Unexpected execution or malformed-output errors reject in either path.
221
+ Use `createGeneratorTestRunner(definition, runtime)` for a Generator's persistent generation
222
+ session. `runner.run(parameters)` normalizes inputs, prepares assets, and returns a discriminated
223
+ result. Handle `type: "invalid"`
224
+ before reading a generated `model`. Successful results remain usable after later runs and runner
225
+ disposal. Dispose the runner to release its session and caches. Use `engine.createSession(program, options)`
226
+ for repeated plain-model edits or cache tests and dispose the session in `finally`; its returned
227
+ results also remain usable. Unexpected execution or malformed-output errors reject.
208
228
 
209
229
  The runner normalizes saved values. To probe deliberately invalid typed inputs without that
210
- recovery, call `runner.validate(parameters, { normalize: false })`. Validation checks declarations
230
+ recovery, call `runner.check(parameters, { validateInput: false })`. Validation checks declarations
211
231
  and reached assertions without finalizing output; execute representative valid combinations too.
212
232
  The CLI's strict overrides serve a different purpose: they reject invalid or unknown values
213
233
  before execution instead of recovering saved state.
214
234
 
215
- | Helper | What to check |
216
- | ------------------------------ | ------------------------------------------------------------------ |
217
- | `expectSerializableDefinition` | Strict definition parsing and a canonical JSON round trip |
218
- | `expectValidDefaults` | Strict parameter decoding and agreement with defaults |
219
- | `expectValidPresets` | Serializable preset metadata; execute presets for domain rules |
220
- | `expectValidParts` | Part metadata, closed oriented topology, and native reconstruction |
221
- | `expectMeshMeasurements` | Bounds, area, signed volume, and connected-component count |
222
-
223
- Compare physical measurements with explicit absolute tolerances; bounds use millimetres, area
224
- square millimetres, and volume cubic millimetres. Component counts are exact. Rendered views
225
- complement those assertions. A valid solid alone does not prove a suitable fit or manufacturable
226
- wall thickness.
235
+ | Helper | What to check |
236
+ | ------------------------ | ------------------------------------------------------------------ |
237
+ | `assertValidDefinition` | Strict definition parsing and a canonical JSON round trip |
238
+ | `assertValidDefaults` | Strict parameter decoding and agreement with defaults |
239
+ | `assertValidPresets` | Serializable preset metadata; execute presets for domain rules |
240
+ | `assertValidParts` | Part metadata, closed oriented topology, and native reconstruction |
241
+ | `assertMeshMeasurements` | Bounds, area, signed volume, and connected-component count |
242
+
243
+ Compare physical measurements with explicit absolute tolerances: bounds use millimetres, area
244
+ square millimetres, and volume cubic millimetres. Component counts are exact. Use rendered views
245
+ alongside those assertions to check the shape. A valid solid alone doesn't prove a suitable fit or
246
+ manufacturable wall thickness.
227
247
 
228
248
  For Font controls, supply the runner's `prepareServices` option using checked-in licensed bytes.
229
249
  `prepareFontTestServices` from `@metamesh/testkit/fonts` verifies immutable font revisions and
@@ -1,71 +1,91 @@
1
1
  # `@metamesh/cli`
2
2
 
3
- Check, execute, inspect, and render trusted local MetaMesh source. The `metamesh` executable and
4
- Node-only `/authoring` functions use the production engine and version-matched installed documentation.
3
+ Check, run, inspect, and render local MetaMesh models. The `metamesh` executable brings
4
+ version-matched documentation, TypeScript checks, and captured geometry into one authoring workflow.
5
+ The same tools are available through a Node API.
5
6
 
6
7
  > **Preview:** `0.x` minor releases may break compatibility. Patches remain compatible within the
7
8
  > same minor line.
8
9
 
9
10
  ## Installation
10
11
 
11
- Install the same exact release of each MetaMesh package in the project where you author models:
12
+ Install matching Modeling and CLI releases in your authoring project:
12
13
 
13
14
  ```bash
14
15
  pnpm add @metamesh/modeling
15
16
  pnpm add -D @metamesh/cli
16
17
  ```
17
18
 
18
- Add `@metamesh/generator-sdk` when your source defines Generators. Add `@metamesh/testkit` as a
19
- development dependency when importing testing helpers. CLI internally reuses Testkit font fixtures
20
- and its SDK contracts; neither package needs to be directly declared for standalone model authoring.
21
- The compiler, bundler, Three renderer, and Playwright belong to CLI; Testkit does not install them.
22
- Chromium is installed separately and never downloaded by checking or generation.
19
+ The executable and Node API require Node.js 24 or newer. The API publishes ES modules only.
20
+ TypeScript source and API consumers need TypeScript 6.0 or newer with `strict` checking and
21
+ `NodeNext` or `Bundler` module resolution. The CLI includes its source-checking compiler.
22
+
23
+ Add Generator SDK for Generator source and Testkit when importing testing helpers directly.
24
+ Standalone model authoring needs neither as a direct dependency. Chromium setup is separate;
25
+ checking, generation, and inspection work without a browser.
23
26
 
24
27
  ## Local workflow
25
28
 
29
+ Save a model entry as `model.ts`, default-exporting a `ModelProgram` from Modeling. Then discover
30
+ the installed environment, look up the API, and build a captured result:
31
+
26
32
  ```bash
27
33
  pnpm exec metamesh environment --json
34
+ pnpm exec metamesh docs search "sweep"
28
35
  pnpm exec metamesh docs show modeling/guide/concepts
29
- pnpm exec metamesh docs search "extrude"
30
- pnpm exec metamesh docs show TOPIC_ID
31
- pnpm exec metamesh check model.ts --kind model
32
- pnpm exec metamesh run model.ts --kind model
36
+ pnpm exec metamesh typecheck model.ts --kind model
37
+ pnpm exec metamesh run model.ts --kind model --export-3mf
33
38
  pnpm exec metamesh inspect RUN_DIRECTORY
39
+ ```
40
+
41
+ Replace `RUN_DIRECTORY` with the path reported by `run`. Commands resolve packages and paths
42
+ from the current project; use `--project PATH` to select another. `environment` reports the
43
+ supported authoring protocol, package versions, and local documentation. Version mismatches fail
44
+ before generation.
45
+
46
+ For Generators, use `--kind generator` with a named `definition` export and a default Generator
47
+ module. Pass `--overrides parameters.json` for input values. Generator overrides merge with defaults
48
+ and undergo strict validation; standalone model parameters pass through directly. Studio's virtual
49
+ `@metamesh/project` import is unavailable in local entries.
50
+
51
+ ## Authoring tools
52
+
53
+ | Command | Purpose |
54
+ | --------------------------- | -------------------------------------------------------------------------------------- |
55
+ | `environment` | Discover project-local packages, capabilities, and documentation. |
56
+ | `docs search` / `docs show` | Find and read exact-version guides and API references offline. |
57
+ | `typecheck` | Check TypeScript and entry-point export types without executing the model. |
58
+ | `run` | Check and execute source, capture geometry and diagnostics, and optionally export 3MF. |
59
+ | `inspect` | Read captured parts, bounds, measurements, and diagnostics. |
60
+ | `render` | Create standard views from a capture. |
61
+ | `setup` | Print skill installation and project-instruction guidance. |
62
+
63
+ `run` uses a disposable child process with a 30-second default deadline and saves attempts under
64
+ `.metamesh/runs`. Captures retain source identity, effective parameters, and hashed geometry.
65
+ `inspect` and `render` validate those saved buffers without rerunning the source.
66
+
67
+ Source executes with your account's permissions; this is trusted local execution, not a security
68
+ sandbox. Use `--json` for structured stdout; bounded author logs go to stderr. Exit codes are
69
+ 0 for success, 1 for source or generation failure, and 2 for invocation, environment, artifact,
70
+ or tooling failure. Each command's `--help` lists its options and limits.
71
+
72
+ Use `--params values.json` for a standalone model's complete input map. For a Generator,
73
+ use `--overrides values.json`; those values merge with definition defaults before strict
74
+ validation. The Node API uses the matching `params` and `overrides` fields, discriminated by `kind`.
75
+
76
+ ## Render a capture
77
+
78
+ Install the pinned Chromium explicitly, then choose views of the captured model:
79
+
80
+ ```bash
34
81
  pnpm exec metamesh browser install
35
82
  pnpm exec metamesh render RUN_DIRECTORY --views isometric,front,top,right
36
83
  ```
37
84
 
38
- `environment` reports `authoringProtocolVersion: 1`, installed package versions, capabilities,
39
- and documentation manifest paths. Mixed package versions or stale documentation fail before
40
- generation. Commands resolve packages and relative paths from the current project; pass
41
- `--project PATH` to select another project explicitly. `TOPIC_ID` comes from documentation search;
42
- `RUN_DIRECTORY` comes from a successful run.
43
-
44
- The concepts guide starts with a compact construction map. Search matches distinct words in
45
- titles, guide headings, keywords, and summaries. Exact titles, topic IDs, and import paths take
46
- priority; equally complete intent matches favor guides over reference entries.
47
-
48
- `run` includes semantic TypeScript checking and executes in a disposable child process with a
49
- 30-second default deadline. It saves each attempt beneath `.metamesh/runs` with source identity,
50
- parameters, diagnostics, measurements, and hashed geometry buffers. `inspect` and `render` validate
51
- those captured buffers without importing the original source. Use `--json` for one structured stdout
52
- result; bounded author logs go to stderr. Exit codes are 0 for success, 1 for source or generation
53
- failure, and 2 for invocation, environment, artifact, or tooling failure. This executes trusted local
54
- code and is not a security sandbox.
55
-
56
- For Generators, use `--kind generator`. Entries named-export `definition` and default-export the
57
- Generator module envelope. Defaults merge with `--params parameters.json`, then strict validation
58
- rejects unknown or invalid overrides. Standalone model entries default-export a `ModelProgram` and
59
- receive no injected services. Both support normal local imports and installed dependencies; Studio's
60
- virtual `@metamesh/project` module is unavailable.
61
-
62
- Use `--help` on each command for parameters, fonts, resource limits, export, and image options.
63
- `metamesh setup` prints installation guidance for `metamesh-developer` from the canonical
64
- `metamesh-studio/metamesh-skills` repository and a project-instruction suggestion without modifying
65
- files. Its printed GitHub installation command becomes usable when that repository is published;
66
- the skill supplies the workflow, while installed package documentation supplies exact API facts.
67
-
68
- ## Programmatic API and documentation
85
+ Rendering supports PNG and lossless WebP, transparent backgrounds, and standard orthographic views.
86
+ Checking and generation never download a browser.
87
+
88
+ ## Node API and agent workflows
69
89
 
70
90
  ```ts
71
91
  import { inspectCapturedRun, runAuthoringSource } from "@metamesh/cli/authoring";
@@ -76,16 +96,19 @@ if (result.success) {
76
96
  }
77
97
  ```
78
98
 
79
- Resolve `@metamesh/cli/docs/manifest.json` for the installed Markdown reference, or run
80
- `pnpm exec metamesh docs show cli/guide/agent-authoring` for the complete authoring workflow.
81
- The [authoring guide source](https://github.com/JasonKoolman/metamesh/blob/main/apps/web/content/docs/develop/agent-authoring.mdx)
82
- also covers local font fixtures, artifacts, rendering, and agent integration. Until the public
83
- documentation site launches, use installed documentation, repository sources, or
84
- [run the docs locally](https://github.com/JasonKoolman/metamesh/blob/main/apps/web/README.md#local-use).
99
+ `@metamesh/cli/authoring` also exposes environment discovery, documentation lookup, source checking,
100
+ and rendering. `metamesh setup` prints guidance without changing project files. The portable
101
+ `metamesh-developer` skill supplies the workflow; installed package documentation supplies API facts.
102
+ Install a reviewed skill snapshot from the canonical `metamesh-studio/metamesh-skills` repository
103
+ or its local checkout when public installation is unavailable.
104
+
105
+ ## Documentation
85
106
 
86
- The reusable authoring functions and command implementation stay in this package; geometry and
87
- Generator contracts retain their existing owners. Testing assertions and font-fixture adapters
88
- remain in Testkit.
107
+ Resolve `@metamesh/cli/docs/manifest.json` for exact-version Markdown guidance and API references,
108
+ or run `pnpm exec metamesh docs show cli/guide/agent-authoring`. The
109
+ [authoring guide](https://github.com/JasonKoolman/metamesh/blob/main/apps/web/content/docs/develop/agent-authoring.mdx)
110
+ covers entry contracts, parameters, fonts, captures, and rendering. See
111
+ [Contributing](https://github.com/JasonKoolman/metamesh/blob/main/CONTRIBUTING.md) for package development.
89
112
 
90
113
  ## License
91
114
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "formatVersion": 1,
3
3
  "packageName": "@metamesh/cli",
4
- "packageVersion": "0.17.0",
4
+ "packageVersion": "0.18.0",
5
5
  "documents": [
6
6
  {
7
7
  "id": "cli/guide/agent-authoring",
@@ -2,7 +2,7 @@
2
2
 
3
3
  Version of the CLI authoring protocol, independent of package SemVer and engine compatibility.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  AUTHORING_PROTOCOL_VERSION = 1
@@ -2,7 +2,7 @@
2
2
 
3
3
  A structured issue with optional source location, parameter association, and geometry context.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** A structured issue with optional source location, parameter association, and geometry context. */
@@ -2,7 +2,7 @@
2
2
 
3
3
  The selected project's supported protocol, matching package releases, and available workflows.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** The selected project's supported protocol, matching package releases, and available workflows. */
@@ -2,7 +2,7 @@
2
2
 
3
3
  A classified authoring exception retaining its workflow phase, stable code, and exit status.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** A classified authoring exception retaining its workflow phase, stable code, and exit status. */
@@ -2,7 +2,7 @@
2
2
 
3
3
  An unsuccessful command outcome; a failure directory does not establish a complete capture.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** An unsuccessful command outcome; a failure directory does not establish a complete capture. */
@@ -2,7 +2,7 @@
2
2
 
3
3
  Selects a standalone ModelProgram entry or an SDK Generator module with a definition.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** Selects a standalone ModelProgram entry or an SDK Generator module with a definition. */
@@ -2,7 +2,7 @@
2
2
 
3
3
  The workflow stage that rejected an invocation, source, asset, or captured artifact.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** The workflow stage that rejected an invocation, source, asset, or captured artifact. */
@@ -2,7 +2,7 @@
2
2
 
3
3
  A captured file's relative path, byte length, and SHA-256 integrity digest.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** A captured file's relative path, byte length, and SHA-256 integrity digest. */
@@ -2,7 +2,7 @@
2
2
 
3
3
  Validated local-space mesh buffers loaded from a completed captured resource.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** Validated local-space mesh buffers loaded from a completed captured resource. */
@@ -2,18 +2,16 @@
2
2
 
3
3
  Semantic part identity and appearance referencing a shared mesh with separate placement.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** Semantic part identity and appearance referencing a shared mesh with separate placement. */
9
9
  export interface CapturedPart {
10
10
  readonly id: string;
11
11
  readonly resourceId: string;
12
- /** World translation in millimetres, applied after rotation. */
13
- readonly position: Vector3Data;
14
- /** Global XYZ rotation in degrees, applied once to local geometry. */
15
- readonly rotation: Vector3Data;
12
+ /** Rigid row-major local-to-world matrix, with translation in millimetres. */
13
+ readonly transform: Transform3Data;
16
14
  readonly color?: string;
17
- readonly measurements: SnapshotPart["measurements"];
15
+ readonly measurements: ModelPart["measurements"];
18
16
  }
19
17
  ```
@@ -2,7 +2,7 @@
2
2
 
3
3
  A shared local-space mesh resource and its measurements, before per-part placement.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** A shared local-space mesh resource and its measurements, before per-part placement. */
@@ -10,6 +10,6 @@ export interface CapturedResource {
10
10
  readonly id: string;
11
11
  readonly positions: CapturedBuffer;
12
12
  readonly indices: CapturedBuffer;
13
- readonly measurements: SnapshotPart["measurements"];
13
+ readonly measurements: ModelPart["measurements"];
14
14
  }
15
15
  ```
@@ -2,7 +2,7 @@
2
2
 
3
3
  A validated successful capture with its manifest and shared local geometry buffers.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** A validated successful capture with its manifest and shared local geometry buffers. */
@@ -2,12 +2,12 @@
2
2
 
3
3
  A completed attempt's provenance, effective inputs, diagnostics, and captured geometry.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** A completed attempt's provenance, effective inputs, diagnostics, and captured geometry. */
9
9
  export interface CapturedRunManifest {
10
- readonly formatVersion: 1;
10
+ readonly formatVersion: 2;
11
11
  readonly status: "complete";
12
12
  readonly runId: string;
13
13
  readonly createdAt: string;
@@ -31,7 +31,7 @@ export interface CapturedRunManifest {
31
31
  };
32
32
  readonly diagnostics: readonly GenerationDiagnostic[];
33
33
  readonly bounds: Bounds3Data;
34
- readonly stats: FinalizedModel["stats"];
34
+ readonly stats: ModelResult["stats"];
35
35
  readonly dependencies: ModelDependencies;
36
36
  readonly resources: readonly CapturedResource[];
37
37
  readonly parts: readonly CapturedPart[];
@@ -2,7 +2,7 @@
2
2
 
3
3
  Source entry contract and project-local resolution settings for semantic checking.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** Source entry contract and project-local resolution settings for semantic checking. */
@@ -2,7 +2,7 @@
2
2
 
3
3
  A successful semantic check; source has not been evaluated and no geometry is captured.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** A successful semantic check; source has not been evaluated and no geometry is captured. */
@@ -2,7 +2,7 @@
2
2
 
3
3
  Metadata for one installed Markdown guide or public API symbol.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** Metadata for one installed Markdown guide or public API symbol. */
@@ -2,7 +2,7 @@
2
2
 
3
3
  Exact-package-version index exposed through the package's docs/manifest.json export.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** Exact-package-version index exposed through the package's docs/manifest.json export. */
@@ -2,7 +2,7 @@
2
2
 
3
3
  An installed documentation match carrying the exact package identity that owns it.
4
4
 
5
- Import from `@metamesh/cli/authoring` (@metamesh/cli@0.17.0).
5
+ Import from `@metamesh/cli/authoring` (@metamesh/cli@0.18.0).
6
6
 
7
7
  ```ts
8
8
  /** An installed documentation match carrying the exact package identity that owns it. */