@metamesh/cli 0.17.0 → 0.19.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.
- package/CHANGELOG.md +201 -0
- package/README.md +93 -51
- package/dist/authoring/artifacts.d.ts +2 -2
- package/dist/authoring/artifacts.d.ts.map +1 -1
- package/dist/authoring/artifacts.js +52 -40
- package/dist/authoring/artifacts.js.map +1 -1
- package/dist/authoring/check.d.ts.map +1 -1
- package/dist/authoring/check.js +9 -3
- package/dist/authoring/check.js.map +1 -1
- package/dist/authoring/documentation-manifest.d.ts +3 -0
- package/dist/authoring/documentation-manifest.d.ts.map +1 -0
- package/dist/authoring/documentation-manifest.js +23 -0
- package/dist/authoring/documentation-manifest.js.map +1 -0
- package/dist/authoring/documentation.d.ts +20 -0
- package/dist/authoring/documentation.d.ts.map +1 -0
- package/dist/authoring/documentation.js +94 -0
- package/dist/authoring/documentation.js.map +1 -0
- package/dist/authoring/environment.d.ts +1 -19
- package/dist/authoring/environment.d.ts.map +1 -1
- package/dist/authoring/environment.js +4 -110
- package/dist/authoring/environment.js.map +1 -1
- package/dist/authoring/{worker.d.ts → execution-process.d.ts} +3 -4
- package/dist/authoring/execution-process.d.ts.map +1 -0
- package/dist/authoring/{worker.js → execution-process.js} +18 -19
- package/dist/authoring/execution-process.js.map +1 -0
- package/dist/authoring/export-capture.d.ts +22 -0
- package/dist/authoring/export-capture.d.ts.map +1 -0
- package/dist/authoring/export-capture.js +76 -0
- package/dist/authoring/export-capture.js.map +1 -0
- package/dist/authoring/{capture/render-client.js → render/client-bundle.js} +196 -196
- package/dist/authoring/{capture/render-client.js.map → render/client-bundle.js.map} +4 -4
- package/dist/authoring/{render-client.d.ts → render/client.d.ts} +2 -2
- package/dist/authoring/render/client.d.ts.map +1 -0
- package/dist/authoring/{render-client.js → render/client.js} +2 -2
- package/dist/authoring/render/client.js.map +1 -0
- package/dist/authoring/{render.d.ts → render/render-capture.d.ts} +2 -2
- package/dist/authoring/render/render-capture.d.ts.map +1 -0
- package/dist/authoring/{render.js → render/render-capture.js} +4 -4
- package/dist/authoring/render/render-capture.js.map +1 -0
- package/dist/authoring/{render-scene.d.ts → render/scene.d.ts} +2 -2
- package/dist/authoring/render/scene.d.ts.map +1 -0
- package/dist/authoring/{render-scene.js → render/scene.js} +6 -10
- package/dist/authoring/render/scene.js.map +1 -0
- package/dist/authoring/{render-types.d.ts → render/types.d.ts} +3 -3
- package/dist/authoring/render/types.d.ts.map +1 -0
- package/dist/authoring/render/types.js +2 -0
- package/dist/authoring/render/types.js.map +1 -0
- package/dist/authoring/run.d.ts.map +1 -1
- package/dist/authoring/run.js +7 -4
- package/dist/authoring/run.js.map +1 -1
- package/dist/authoring/types.d.ts +21 -18
- package/dist/authoring/types.d.ts.map +1 -1
- package/dist/authoring/types.js.map +1 -1
- package/dist/authoring.d.ts +7 -4
- package/dist/authoring.d.ts.map +1 -1
- package/dist/authoring.js +4 -2
- package/dist/authoring.js.map +1 -1
- package/dist/docs/guides/agent-authoring.md +76 -54
- package/dist/docs/guides/package.md +93 -51
- package/dist/docs/manifest.json +57 -1
- package/dist/docs/reference/authoring/AUTHORING_PROTOCOL_VERSION.md +1 -1
- package/dist/docs/reference/authoring/AuthoringDiagnostic.md +1 -1
- package/dist/docs/reference/authoring/AuthoringEnvironment.md +1 -1
- package/dist/docs/reference/authoring/AuthoringError.md +1 -1
- package/dist/docs/reference/authoring/AuthoringFailure-type.md +1 -1
- package/dist/docs/reference/authoring/AuthoringKind.md +1 -1
- package/dist/docs/reference/authoring/AuthoringPhase.md +2 -2
- package/dist/docs/reference/authoring/CaptureExportFormat.md +10 -0
- package/dist/docs/reference/authoring/CaptureExportOptions.md +17 -0
- package/dist/docs/reference/authoring/CaptureExportResult.md +15 -0
- package/dist/docs/reference/authoring/CapturedBuffer.md +1 -1
- package/dist/docs/reference/authoring/CapturedGeometry.md +1 -1
- package/dist/docs/reference/authoring/CapturedPart.md +4 -6
- package/dist/docs/reference/authoring/CapturedResource.md +2 -2
- package/dist/docs/reference/authoring/CapturedRun.md +1 -1
- package/dist/docs/reference/authoring/CapturedRunManifest.md +3 -4
- package/dist/docs/reference/authoring/CheckOptions.md +1 -1
- package/dist/docs/reference/authoring/CheckSuccess.md +1 -1
- package/dist/docs/reference/authoring/DocumentationEntry.md +1 -1
- package/dist/docs/reference/authoring/DocumentationManifest.md +1 -1
- package/dist/docs/reference/authoring/DocumentationSearchResult.md +1 -1
- package/dist/docs/reference/authoring/InstalledAuthoringPackage.md +1 -1
- package/dist/docs/reference/authoring/RenderCamera.md +1 -1
- package/dist/docs/reference/authoring/RenderFormat.md +1 -1
- package/dist/docs/reference/authoring/RenderOptions.md +1 -1
- package/dist/docs/reference/authoring/RenderResult.md +1 -1
- package/dist/docs/reference/authoring/RenderView.md +1 -1
- package/dist/docs/reference/authoring/RenderedImage.md +1 -1
- package/dist/docs/reference/authoring/RunOptions.md +13 -7
- package/dist/docs/reference/authoring/RunSuccess.md +1 -1
- package/dist/docs/reference/authoring/authoringFailure-value.md +1 -1
- package/dist/docs/reference/authoring/checkAuthoringSource.md +1 -1
- package/dist/docs/reference/authoring/discoverAuthoringEnvironment.md +1 -1
- package/dist/docs/reference/authoring/exportCapturedRun.md +10 -0
- package/dist/docs/reference/authoring/inspectCapturedRun.md +1 -1
- package/dist/docs/reference/authoring/installAuthoringBrowser.md +1 -1
- package/dist/docs/reference/authoring/readCapturedRun.md +1 -1
- package/dist/docs/reference/authoring/renderCapturedRun.md +1 -1
- package/dist/docs/reference/authoring/runAuthoringSource.md +1 -1
- package/dist/docs/reference/authoring/searchAuthoringDocumentation.md +1 -1
- package/dist/docs/reference/authoring/showAuthoringDocumentation.md +1 -1
- package/dist/metamesh.js +35 -14
- package/dist/metamesh.js.map +1 -1
- package/package.json +9 -6
- package/dist/authoring/render-client.d.ts.map +0 -1
- package/dist/authoring/render-client.js.map +0 -1
- package/dist/authoring/render-scene.d.ts.map +0 -1
- package/dist/authoring/render-scene.js.map +0 -1
- package/dist/authoring/render-types.d.ts.map +0 -1
- package/dist/authoring/render-types.js +0 -2
- package/dist/authoring/render-types.js.map +0 -1
- package/dist/authoring/render.d.ts.map +0 -1
- package/dist/authoring/render.js.map +0 -1
- package/dist/authoring/worker.d.ts.map +0 -1
- package/dist/authoring/worker.js.map +0 -1
- /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
|
|
6
|
-
the
|
|
7
|
-
|
|
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.
|
|
23
|
-
|
|
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
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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-recipes#choose-a-technique) 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
|
|
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
|
|
76
|
-
virtual `@metamesh/project` module
|
|
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(
|
|
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
|
|
96
|
-
pnpm exec metamesh run model.ts --kind model
|
|
99
|
+
pnpm exec metamesh typecheck model.ts --kind model
|
|
100
|
+
pnpm exec metamesh run model.ts --kind model
|
|
97
101
|
```
|
|
98
102
|
|
|
99
|
-
Both commands
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
151
|
-
pnpm exec metamesh run generator.ts --kind generator --
|
|
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
|
|
@@ -167,15 +171,17 @@ run directory reported by that command as `RUN_DIRECTORY` below:
|
|
|
167
171
|
```bash
|
|
168
172
|
pnpm exec metamesh inspect RUN_DIRECTORY
|
|
169
173
|
pnpm exec metamesh inspect RUN_DIRECTORY --part plate
|
|
174
|
+
pnpm exec metamesh export RUN_DIRECTORY --format 3mf --output plate.3mf
|
|
170
175
|
pnpm exec metamesh browser install
|
|
171
176
|
pnpm exec metamesh render RUN_DIRECTORY
|
|
172
177
|
pnpm exec metamesh render RUN_DIRECTORY --views top --format webp --transparent
|
|
173
178
|
```
|
|
174
179
|
|
|
175
|
-
Inspection reads
|
|
176
|
-
provenance. Rendering uses the same captured buffers without rerunning the model
|
|
180
|
+
Inspection reads the completed model's part IDs, placements, colors, measurements, diagnostics,
|
|
181
|
+
and execution provenance. Rendering uses the same captured buffers without rerunning the model,
|
|
182
|
+
so the dimensions you inspect and the views you render belong to the same result. Captures remain
|
|
177
183
|
usable after the engine session is disposed or the directory moves. Corrupt or incomplete
|
|
178
|
-
artifacts
|
|
184
|
+
artifacts are rejected.
|
|
179
185
|
|
|
180
186
|
Rendering requires the separately installed pinned Chromium. It is never downloaded implicitly;
|
|
181
187
|
checking, generation, and inspection work without it. Standard orthographic views are isometric,
|
|
@@ -183,9 +189,10 @@ front, top, and right. The default is an isometric 1024 × 1024 PNG on a neutral
|
|
|
183
189
|
lossless; PNG and WebP both support explicit transparent output. Images record their run, camera,
|
|
184
190
|
renderer, and browser versions. Compare pixels only within the pinned capture environment.
|
|
185
191
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
192
|
+
`export` reads the completed capture and writes `3mf`, `stl`, or `glb` without rerunning source.
|
|
193
|
+
The required `--output` selects the destination file; the result reports format limitations as
|
|
194
|
+
structured diagnostics. A failed attempt never exposes an older successful result as its output.
|
|
195
|
+
Match the captured parameters and source fingerprint to the revision you intended to verify.
|
|
189
196
|
|
|
190
197
|
## Test models
|
|
191
198
|
|
|
@@ -195,35 +202,50 @@ Install Testkit separately when you want assertions and fixtures for your existi
|
|
|
195
202
|
pnpm add -D @metamesh/testkit
|
|
196
203
|
```
|
|
197
204
|
|
|
198
|
-
Use `
|
|
199
|
-
|
|
200
|
-
`
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
205
|
+
Use `await runModel(({ part }) => part("body", box({ size: 2 })))` for a one-off model, or
|
|
206
|
+
pass an existing program directly with `await runModel(program, parameters)`. Use
|
|
207
|
+
`await runModel({ definition, runtime }, parameters)` for a Generator. The returned result remains
|
|
208
|
+
usable after the helper releases its temporary session; no cleanup is required.
|
|
209
|
+
For cached Generators, exercise representative edits through
|
|
210
|
+
`createGeneratorTestRunner(definition, runtime, { verifyCache: true })` and its `run` method.
|
|
211
|
+
One-shot tests and declaration checks do not verify reuse across edits. Use `cache: false` for
|
|
212
|
+
an uncached output baseline; keep prepared services stable when testing reuse in the same session.
|
|
213
|
+
Callbacks run synchronously and return a part or an array of parts. Declare typed inline inputs
|
|
214
|
+
with `runModel<Parameters, Services>(callback, parameters, options)`, or reuse a
|
|
215
|
+
`GenerateCallback<Parameters, Services>`. Parameterless callbacks and Generator defaults can omit parameters. Options stay in the third
|
|
216
|
+
argument: use `undefined` for omitted parameters when supplying a test-owned engine, generation
|
|
217
|
+
policy, prepared model services, or a Generator's asynchronous `prepareServices` adapter.
|
|
218
|
+
|
|
219
|
+
For Generator integration tests, import the definition and default runtime from the real entry
|
|
220
|
+
point instead of repeating its input resolution and builder calls. Use direct callbacks to isolate
|
|
221
|
+
construction, reconstruct a mesh, or deliberately bypass schema validation.
|
|
204
222
|
|
|
205
|
-
Use `
|
|
206
|
-
|
|
207
|
-
|
|
223
|
+
Use `createGeneratorTestRunner(definition, runtime)` for a Generator's persistent generation
|
|
224
|
+
session. `runner.run(parameters)` normalizes inputs, prepares assets, and returns a discriminated
|
|
225
|
+
result. Handle `type: "invalid"`
|
|
226
|
+
before reading a generated `model`. Successful results remain usable after later runs and runner
|
|
227
|
+
disposal. Dispose the runner to release its session and caches. Use `engine.createSession(program, options)`
|
|
228
|
+
for repeated plain-model edits or cache tests and dispose the session in `finally`; its returned
|
|
229
|
+
results also remain usable. Unexpected execution or malformed-output errors reject.
|
|
208
230
|
|
|
209
231
|
The runner normalizes saved values. To probe deliberately invalid typed inputs without that
|
|
210
|
-
recovery, call `runner.
|
|
232
|
+
recovery, call `runner.check(parameters, { validateInput: false })`. Validation checks declarations
|
|
211
233
|
and reached assertions without finalizing output; execute representative valid combinations too.
|
|
212
234
|
The CLI's strict overrides serve a different purpose: they reject invalid or unknown values
|
|
213
235
|
before execution instead of recovering saved state.
|
|
214
236
|
|
|
215
|
-
| Helper
|
|
216
|
-
|
|
|
217
|
-
| `
|
|
218
|
-
| `
|
|
219
|
-
| `
|
|
220
|
-
| `
|
|
221
|
-
| `
|
|
222
|
-
|
|
223
|
-
Compare physical measurements with explicit absolute tolerances
|
|
224
|
-
square millimetres, and volume cubic millimetres. Component counts are exact.
|
|
225
|
-
|
|
226
|
-
wall thickness.
|
|
237
|
+
| Helper | What to check |
|
|
238
|
+
| ------------------------ | ------------------------------------------------------------------ |
|
|
239
|
+
| `assertValidDefinition` | Strict definition parsing and a canonical JSON round trip |
|
|
240
|
+
| `assertValidDefaults` | Strict parameter decoding and agreement with defaults |
|
|
241
|
+
| `assertValidPresets` | Serializable preset metadata; execute presets for domain rules |
|
|
242
|
+
| `assertValidParts` | Part metadata, closed oriented topology, and native reconstruction |
|
|
243
|
+
| `assertMeshMeasurements` | Bounds, area, signed volume, and connected-component count |
|
|
244
|
+
|
|
245
|
+
Compare physical measurements with explicit absolute tolerances: bounds use millimetres, area
|
|
246
|
+
square millimetres, and volume cubic millimetres. Component counts are exact. Use rendered views
|
|
247
|
+
alongside those assertions to check the shape. A valid solid alone doesn't prove a suitable fit or
|
|
248
|
+
manufacturable wall thickness.
|
|
227
249
|
|
|
228
250
|
For Font controls, supply the runner's `prepareServices` option using checked-in licensed bytes.
|
|
229
251
|
`prepareFontTestServices` from `@metamesh/testkit/fonts` verifies immutable font revisions and
|
|
@@ -1,71 +1,107 @@
|
|
|
1
1
|
# `@metamesh/cli`
|
|
2
2
|
|
|
3
|
-
Check
|
|
4
|
-
|
|
3
|
+
Check and run MetaMesh models from your terminal. Save generated geometry, inspect its dimensions,
|
|
4
|
+
and render previews from the same result. The `metamesh` command also reads documentation for
|
|
5
|
+
your installed packages, and its tools are available through a Node.js 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
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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 the [Generator SDK](https://github.com/JasonKoolman/metamesh/blob/main/packages/generator-sdk/README.md)
|
|
24
|
+
to author Generators, or [Testkit](https://github.com/JasonKoolman/metamesh/blob/main/packages/testkit/README.md)
|
|
25
|
+
to import testing helpers directly. Standalone models need neither as a direct dependency.
|
|
26
|
+
Only rendering needs Chromium; checking, generation, and inspection work without a browser.
|
|
23
27
|
|
|
24
28
|
## Local workflow
|
|
25
29
|
|
|
30
|
+
Save this plate with a through hole as `model.ts`:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { box, cylinder, generate } from "@metamesh/modeling";
|
|
34
|
+
|
|
35
|
+
export default generate(({ part }) => {
|
|
36
|
+
const plate = box({ size: [30, 20, 6] });
|
|
37
|
+
const bore = cylinder({ height: 8, radius: 3, sizing: "face" });
|
|
38
|
+
return part("plate", plate.subtract(bore));
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
From the same project, discover the installed packages, check the source, and capture a run:
|
|
43
|
+
|
|
26
44
|
```bash
|
|
27
45
|
pnpm exec metamesh environment --json
|
|
46
|
+
pnpm exec metamesh docs search "sweep"
|
|
28
47
|
pnpm exec metamesh docs show modeling/guide/concepts
|
|
29
|
-
pnpm exec metamesh
|
|
30
|
-
pnpm exec metamesh docs show TOPIC_ID
|
|
31
|
-
pnpm exec metamesh check model.ts --kind model
|
|
48
|
+
pnpm exec metamesh typecheck model.ts --kind model
|
|
32
49
|
pnpm exec metamesh run model.ts --kind model
|
|
33
50
|
pnpm exec metamesh inspect RUN_DIRECTORY
|
|
51
|
+
pnpm exec metamesh export RUN_DIRECTORY --format 3mf --output plate.3mf
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Replace `RUN_DIRECTORY` with the path reported by `run`. Export that capture as 3MF, STL, or GLB.
|
|
55
|
+
Commands resolve packages and paths from the current project; use `--project PATH`
|
|
56
|
+
to select another. `environment` reports package versions, local documentation, and the supported
|
|
57
|
+
authoring protocol. Version mismatches fail before generation.
|
|
58
|
+
|
|
59
|
+
Local model entries default-export a `ModelProgram` created with Modeling's `generate` helper.
|
|
60
|
+
For Generators, use `--kind generator` with a named `definition` export and a default Generator
|
|
61
|
+
module. Local entries import from the installed packages; Studio's virtual `@metamesh/project`
|
|
62
|
+
module is unavailable here.
|
|
63
|
+
|
|
64
|
+
Use `--params values.json` for a standalone model's complete input map, or
|
|
65
|
+
`--overrides values.json` for a Generator. Generator overrides merge with defaults and undergo
|
|
66
|
+
strict validation. Standalone model parameters pass through directly. The Node API uses the
|
|
67
|
+
matching `params` and `overrides` fields, selected by `kind`.
|
|
68
|
+
|
|
69
|
+
## Authoring tools
|
|
70
|
+
|
|
71
|
+
| Command | Purpose |
|
|
72
|
+
| --------------------------- | -------------------------------------------------------------------------- |
|
|
73
|
+
| `environment` | Discover project-local packages, capabilities, and documentation. |
|
|
74
|
+
| `docs search` / `docs show` | Find and read exact-version guides and API references offline. |
|
|
75
|
+
| `typecheck` | Check TypeScript and entry-point export types without executing the model. |
|
|
76
|
+
| `run` | Check and execute source, then capture geometry and diagnostics. |
|
|
77
|
+
| `export` | Save a capture as STL, 3MF, or GLB. |
|
|
78
|
+
| `inspect` | Read captured parts, bounds, measurements, and diagnostics. |
|
|
79
|
+
| `render` | Create standard views from a capture. |
|
|
80
|
+
| `setup` | Print skill installation and project-instruction guidance. |
|
|
81
|
+
|
|
82
|
+
`run` executes source in a disposable child process with a 30-second default deadline and saves
|
|
83
|
+
attempts under `.metamesh/runs`. Each capture records the source identity, effective parameters,
|
|
84
|
+
and geometry hashes. `inspect`, `export`, and `render` validate the saved buffers and read that same result
|
|
85
|
+
without rerunning the source.
|
|
86
|
+
|
|
87
|
+
Source runs with your account's permissions. The child process is not a security sandbox; run
|
|
88
|
+
source you trust. Use `--json` for structured stdout; author logs are bounded and sent to stderr.
|
|
89
|
+
Exit codes are 0 for success, 1 for source or generation failure, and 2 for invocation, environment,
|
|
90
|
+
artifact, or tooling failure. Each command's `--help` lists its options and limits.
|
|
91
|
+
|
|
92
|
+
## Render a capture
|
|
93
|
+
|
|
94
|
+
Install the CLI's pinned Chromium version, then choose views of the captured model:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
34
97
|
pnpm exec metamesh browser install
|
|
35
98
|
pnpm exec metamesh render RUN_DIRECTORY --views isometric,front,top,right
|
|
36
99
|
```
|
|
37
100
|
|
|
38
|
-
|
|
39
|
-
and
|
|
40
|
-
|
|
41
|
-
|
|
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
|
|
101
|
+
Rendering supports PNG and lossless WebP, transparent backgrounds, and standard orthographic views.
|
|
102
|
+
Checking and generation never download a browser.
|
|
103
|
+
|
|
104
|
+
## Node API and agent workflows
|
|
69
105
|
|
|
70
106
|
```ts
|
|
71
107
|
import { inspectCapturedRun, runAuthoringSource } from "@metamesh/cli/authoring";
|
|
@@ -76,16 +112,22 @@ if (result.success) {
|
|
|
76
112
|
}
|
|
77
113
|
```
|
|
78
114
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
115
|
+
`@metamesh/cli/authoring` also exposes environment discovery, documentation lookup, source checking,
|
|
116
|
+
export, and rendering.
|
|
117
|
+
|
|
118
|
+
For coding agents, `metamesh setup` prints skill installation and project-instruction guidance
|
|
119
|
+
without changing files. The portable `metamesh-developer` skill describes the authoring workflow
|
|
120
|
+
and uses installed package documentation for API details.
|
|
121
|
+
Install a reviewed skill snapshot from the canonical `metamesh-studio/metamesh-skills` repository
|
|
122
|
+
or its local checkout when public installation is unavailable.
|
|
123
|
+
|
|
124
|
+
## Documentation
|
|
85
125
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
126
|
+
Resolve `@metamesh/cli/docs/manifest.json` for exact-version Markdown guidance and API references,
|
|
127
|
+
or run `pnpm exec metamesh docs show cli/guide/agent-authoring`. The
|
|
128
|
+
[authoring guide](https://github.com/JasonKoolman/metamesh/blob/main/apps/web/content/docs/develop/agent-authoring.mdx)
|
|
129
|
+
covers entry contracts, parameters, fonts, captures, and rendering. See
|
|
130
|
+
[Contributing](https://github.com/JasonKoolman/metamesh/blob/main/CONTRIBUTING.md) for package development.
|
|
89
131
|
|
|
90
132
|
## License
|
|
91
133
|
|
package/dist/docs/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"formatVersion": 1,
|
|
3
3
|
"packageName": "@metamesh/cli",
|
|
4
|
-
"packageVersion": "0.
|
|
4
|
+
"packageVersion": "0.19.0",
|
|
5
5
|
"documents": [
|
|
6
6
|
{
|
|
7
7
|
"id": "cli/guide/agent-authoring",
|
|
@@ -236,6 +236,48 @@
|
|
|
236
236
|
"CapturedRunManifest"
|
|
237
237
|
]
|
|
238
238
|
},
|
|
239
|
+
{
|
|
240
|
+
"id": "cli/reference/authoring/CaptureExportFormat",
|
|
241
|
+
"title": "CaptureExportFormat",
|
|
242
|
+
"summary": "Supported completed-model file formats.",
|
|
243
|
+
"path": "reference/authoring/CaptureExportFormat.md",
|
|
244
|
+
"importPath": "@metamesh/cli/authoring",
|
|
245
|
+
"availability": "Local Node authoring",
|
|
246
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#install-and-discover-the-environment",
|
|
247
|
+
"keywords": [
|
|
248
|
+
"reference",
|
|
249
|
+
"authoring",
|
|
250
|
+
"CaptureExportFormat"
|
|
251
|
+
]
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"id": "cli/reference/authoring/CaptureExportOptions",
|
|
255
|
+
"title": "CaptureExportOptions",
|
|
256
|
+
"summary": "File delivery for one validated captured run; original author source is never executed.",
|
|
257
|
+
"path": "reference/authoring/CaptureExportOptions.md",
|
|
258
|
+
"importPath": "@metamesh/cli/authoring",
|
|
259
|
+
"availability": "Local Node authoring",
|
|
260
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#install-and-discover-the-environment",
|
|
261
|
+
"keywords": [
|
|
262
|
+
"reference",
|
|
263
|
+
"authoring",
|
|
264
|
+
"CaptureExportOptions"
|
|
265
|
+
]
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"id": "cli/reference/authoring/CaptureExportResult",
|
|
269
|
+
"title": "CaptureExportResult",
|
|
270
|
+
"summary": "Completed file plus source identity and structured serializer diagnostics.",
|
|
271
|
+
"path": "reference/authoring/CaptureExportResult.md",
|
|
272
|
+
"importPath": "@metamesh/cli/authoring",
|
|
273
|
+
"availability": "Local Node authoring",
|
|
274
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#install-and-discover-the-environment",
|
|
275
|
+
"keywords": [
|
|
276
|
+
"reference",
|
|
277
|
+
"authoring",
|
|
278
|
+
"CaptureExportResult"
|
|
279
|
+
]
|
|
280
|
+
},
|
|
239
281
|
{
|
|
240
282
|
"id": "cli/reference/authoring/checkAuthoringSource",
|
|
241
283
|
"title": "checkAuthoringSource",
|
|
@@ -334,6 +376,20 @@
|
|
|
334
376
|
"DocumentationSearchResult"
|
|
335
377
|
]
|
|
336
378
|
},
|
|
379
|
+
{
|
|
380
|
+
"id": "cli/reference/authoring/exportCapturedRun",
|
|
381
|
+
"title": "exportCapturedRun",
|
|
382
|
+
"summary": "Streams a captured model to an atomically published file using the public mesh writers.",
|
|
383
|
+
"path": "reference/authoring/exportCapturedRun.md",
|
|
384
|
+
"importPath": "@metamesh/cli/authoring",
|
|
385
|
+
"availability": "Local Node authoring",
|
|
386
|
+
"canonical": "https://metamesh.studio/docs/develop/agent-authoring#install-and-discover-the-environment",
|
|
387
|
+
"keywords": [
|
|
388
|
+
"reference",
|
|
389
|
+
"authoring",
|
|
390
|
+
"exportCapturedRun"
|
|
391
|
+
]
|
|
392
|
+
},
|
|
337
393
|
{
|
|
338
394
|
"id": "cli/reference/authoring/inspectCapturedRun",
|
|
339
395
|
"title": "inspectCapturedRun",
|
|
@@ -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.
|
|
5
|
+
Import from `@metamesh/cli/authoring` (@metamesh/cli@0.19.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.
|
|
5
|
+
Import from `@metamesh/cli/authoring` (@metamesh/cli@0.19.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.
|
|
5
|
+
Import from `@metamesh/cli/authoring` (@metamesh/cli@0.19.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.
|
|
5
|
+
Import from `@metamesh/cli/authoring` (@metamesh/cli@0.19.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.
|
|
5
|
+
Import from `@metamesh/cli/authoring` (@metamesh/cli@0.19.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.
|
|
5
|
+
Import from `@metamesh/cli/authoring` (@metamesh/cli@0.19.0).
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
/** Selects a standalone ModelProgram entry or an SDK Generator module with a definition. */
|
|
@@ -2,9 +2,9 @@
|
|
|
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.
|
|
5
|
+
Import from `@metamesh/cli/authoring` (@metamesh/cli@0.19.0).
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
/** The workflow stage that rejected an invocation, source, asset, or captured artifact. */
|
|
9
|
-
export type AuthoringPhase = "invocation" | "environment" | "check" | "parameters" | "assets" | "bundle" | "execute" | "artifact" | "render";
|
|
9
|
+
export type AuthoringPhase = "invocation" | "environment" | "check" | "parameters" | "assets" | "bundle" | "execute" | "artifact" | "render" | "export";
|
|
10
10
|
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# CaptureExportOptions
|
|
2
|
+
|
|
3
|
+
File delivery for one validated captured run; original author source is never executed.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/cli/authoring` (@metamesh/cli@0.19.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/** File delivery for one validated captured run; original author source is never executed. */
|
|
9
|
+
export interface CaptureExportOptions {
|
|
10
|
+
readonly format: CaptureExportFormat;
|
|
11
|
+
/** Destination with the selected format's extension; its parent directory must already exist. */
|
|
12
|
+
readonly output: string;
|
|
13
|
+
/** Optional document title; defaults to the output filename without its extension. */
|
|
14
|
+
readonly name?: string;
|
|
15
|
+
readonly signal?: AbortSignal;
|
|
16
|
+
}
|
|
17
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# CaptureExportResult
|
|
2
|
+
|
|
3
|
+
Completed file plus source identity and structured serializer diagnostics.
|
|
4
|
+
|
|
5
|
+
Import from `@metamesh/cli/authoring` (@metamesh/cli@0.19.0).
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
/** Completed file plus source identity and structured serializer diagnostics. */
|
|
9
|
+
export interface CaptureExportResult extends ExportReport {
|
|
10
|
+
readonly path: string;
|
|
11
|
+
readonly format: CaptureExportFormat;
|
|
12
|
+
readonly runId: string;
|
|
13
|
+
readonly sourceFingerprint: string;
|
|
14
|
+
}
|
|
15
|
+
```
|
|
@@ -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.
|
|
5
|
+
Import from `@metamesh/cli/authoring` (@metamesh/cli@0.19.0).
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
/** A captured file's relative path, byte length, and SHA-256 integrity digest. */
|