@martini-film/cli 0.2.0 → 0.4.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 (46) hide show
  1. package/README.md +173 -56
  2. package/dist/api.js +69 -2
  3. package/dist/api.js.map +1 -1
  4. package/dist/approve.js +2 -1
  5. package/dist/approve.js.map +1 -1
  6. package/dist/args.js +31 -6
  7. package/dist/args.js.map +1 -1
  8. package/dist/cli.js +457 -110
  9. package/dist/cli.js.map +1 -1
  10. package/dist/commands/assets.js +297 -45
  11. package/dist/commands/assets.js.map +1 -1
  12. package/dist/commands/call.js +99 -0
  13. package/dist/commands/call.js.map +1 -0
  14. package/dist/commands/context.js +16 -3
  15. package/dist/commands/context.js.map +1 -1
  16. package/dist/commands/files.js +208 -83
  17. package/dist/commands/files.js.map +1 -1
  18. package/dist/commands/guide.js +67 -0
  19. package/dist/commands/guide.js.map +1 -0
  20. package/dist/commands/init.js +196 -0
  21. package/dist/commands/init.js.map +1 -0
  22. package/dist/commands/login.js +69 -15
  23. package/dist/commands/login.js.map +1 -1
  24. package/dist/commands/tools.js +63 -78
  25. package/dist/commands/tools.js.map +1 -1
  26. package/dist/commands/use.js +143 -0
  27. package/dist/commands/use.js.map +1 -0
  28. package/dist/config.js +87 -6
  29. package/dist/config.js.map +1 -1
  30. package/dist/generated/guide.json +104 -0
  31. package/dist/generated/manifest.json +3885 -241
  32. package/dist/guideCache.js +204 -0
  33. package/dist/guideCache.js.map +1 -0
  34. package/dist/help.js +391 -34
  35. package/dist/help.js.map +1 -1
  36. package/dist/manifest.js +34 -3
  37. package/dist/manifest.js.map +1 -1
  38. package/dist/manifestCache.js +196 -0
  39. package/dist/manifestCache.js.map +1 -0
  40. package/dist/output.js +251 -28
  41. package/dist/output.js.map +1 -1
  42. package/dist/schema.js +132 -15
  43. package/dist/schema.js.map +1 -1
  44. package/dist/wait.js +181 -8
  45. package/dist/wait.js.map +1 -1
  46. package/package.json +2 -2
package/README.md CHANGED
@@ -2,37 +2,105 @@
2
2
 
3
3
  The Martini command-line interface for agents and scripts. Every tool the Martini MCP server exposes is a
4
4
  command with the same name; on top, a handful of compound commands do what no single tool does — upload local
5
- files, download and measure assets, block until work settles, edit project memory files as a directory, and sign
6
- in. One HTTPS request per call, a static key, no MCP session.
5
+ files, download and measure assets, block until work settles, edit project memory files as a directory, print the
6
+ operator rules, set a repository up for agents, and sign in. One HTTPS request per call, a static key, no MCP
7
+ session.
8
+
9
+ A shell means the CLI: an agent that has one (Claude Code, Codex, Cursor, …) uses `martini` for every Martini
10
+ task, even with the MCP connector installed. The connector is for hosts without a shell (Claude Desktop, ChatGPT,
11
+ claude.ai). Both reach the same tools with the same names and arguments.
7
12
 
8
13
  ```bash
9
- npx @martini-film/cli --help # or: pnpm add -g @martini-film/cli → martini
14
+ npm install --global @martini-film/cli # puts martini on PATH; or run each command as npx @martini-film/cli <command>
10
15
  martini login # pair this device through the browser (90-day key); --no-wait to return at once, rerun to collect
11
- martini get_board_overview --project <id> # any MCP tool, flags from its arguments
16
+ martini guide # the operator rules an MCP agent gets at connect, by topic
17
+ martini init --write # install the agent skill and the AGENTS.md pointer in this repo
18
+ martini use "<project name or id>" # this directory now works in that project (and its canvas)
19
+ martini get_board_overview # any MCP tool, flags from its arguments
12
20
  martini get_asset --asset-id <id> --fields asset.status,asset.imageUrl
13
- martini upload ./ref.png ./take.mp4 --canvas <id>
14
- martini create_node_and_generate --canvas-id <id> --prompt "…" --reference-images <url> --wait
21
+ martini upload ./ref.png ./take.mp4
22
+ martini create_node_and_generate --prompt "…" --reference-images <url> --wait
15
23
  martini wait <asset-id…> # resume a wait; exit 4 with the pending ids on timeout
24
+ martini inspect_video --video-asset-ids <id> <id> --out-dir review # a contact sheet per shot, and which file is which
16
25
  martini files pull ./memory && martini files push ./memory
17
26
  martini probe <path|asset-id>… # duration, resolution, fps, codecs, sha256 (needs ffprobe)
27
+ martini tools # how the server's tool list differs from this build's
28
+ martini call <tool> --args @args.json # a tool by name, for one no tool list shows
18
29
  ```
19
30
 
20
31
  ## How commands are generated
21
32
 
22
- `martini <tool>` exists for every entry of the tool manifest the build carries — the same list the Martini
23
- MCP server publishes; `martini tools` says when the server has a newer one. Flags are derived from each tool's JSON Schema: `assetId` becomes `--asset-id`, arrays repeat the flag
24
- (or take a JSON list), objects take JSON, a `string | null` argument takes the literal `null` to clear it, a
33
+ `martini <tool>` exists for every entry of the tool manifest — the list the Martini MCP server publishes at
34
+ `GET /v1/tools`, filtered to what your key can call. The build carries one (the baked manifest, the offline
35
+ fallback). The CLI also keeps the server's list in a cache, one file per API URL and credential under
36
+ `$XDG_CACHE_HOME/martini/` (else `~/.cache/martini/`), named by a short sha256 fingerprint of the key (never the
37
+ key) and readable only by you; commands run with the cached list when there is one, so a tool or argument the
38
+ server added after this build works without an update.
39
+
40
+ The list is refreshed — one `GET /v1/tools` with `If-None-Match`, a 304 while it is unchanged — only where that
41
+ can change the answer, at most once per command: an unknown command (refreshed, then dispatched again), an
42
+ unknown flag on a known tool (refreshed, then parsed again), and `martini tools` (`--refresh` fetches it whole).
43
+ An ordinary command never waits on it. A refresh that fails keeps the list in use and prints one
44
+ `MANIFEST_REFRESH_FAILED` warning on stderr; a corrupt cache is ignored the same way. `MARTINI_MANIFEST_REFRESH=0`
45
+ turns every refresh off (CI, offline, tests); a cached list still applies. A workflow run key never caches or
46
+ refreshes: its tools are the run's own. `martini tools` names what the server has that this build lacks
47
+ (`serverOnly`), the reverse (`buildOnly`), and the tools whose arguments differ (`changed`); `martini version`
48
+ says which list is in use. A tool no list shows is still reachable: `martini call <tool> --args '{…}'` sends the
49
+ call by name with exactly those arguments — no flags, no local checks, no context beyond `--project` /
50
+ `--canvas` / `--run` typed on it. `--out` with a media name needs `--raw` there: by name, the CLI cannot tell a picture
51
+ from a result.
52
+
53
+ The operator guide — the rules an MCP agent receives when it connects, worded for the CLI — is kept the same way
54
+ and in the same directory: the build carries one (`src/generated/guide.json`), the server publishes the current
55
+ one at `GET /v1/guide?transport=cli`, and the last one the server gave a credential is cached as
56
+ `guide-<url hash>-<key fingerprint>.json` (0600, no key inside). Only `martini guide` reads or refreshes it — one
57
+ request with `If-None-Match` per run, `--refresh` for a whole fetch; no other command fetches it. Every tool
58
+ and manifest answer does carry `X-Martini-Guide-Hash`, the hash of the guide the server serves now: when it
59
+ differs from the copy this CLI has, the next command prints one `GUIDE_CHANGED` warning (once per server hash,
60
+ not per command) that says to run `martini guide` again; reading the guide ends the warning.
61
+ `MARTINI_MANIFEST_REFRESH=0` turns the request off (the cached guide, else the baked one, is printed); a failed
62
+ request prints the copy in use with one `GUIDE_REFRESH_FAILED` warning; with no key, or a workflow run key, the
63
+ baked guide is printed and nothing is asked or cached. One stderr line says which copy was printed.
64
+
65
+ Flags are derived from each tool's JSON Schema: `assetId` becomes `--asset-id`, arrays take the values
66
+ after the flag (`--node-ids a b`), a repeated flag, or a JSON list, objects take JSON, a `string | null` argument takes the literal `null` to clear it, a
25
67
  `"start" | "end" | {…}` union takes the bare word, and `--args '{…}'` / `--args @args.json` passes the whole
26
68
  arguments object (`--json` is an alias, except on a tool whose own argument is named `json`) — so a plan a script
27
- computed is submitted without retyping it. `--no-context` sends only what you typed, for tools that refuse a
28
- `projectId` next to another selector. `martini <tool> --help` prints the tool's own description, every flag with
29
- its type and whether it is required, the result fields when the tool declares them (as `--fields` paths), and one
30
- example.
69
+ computed is submitted without retyping it. A tool argument named like a global flag (`fields` on `get_models`) is
70
+ spelled `--tool-<name>`. `--no-context` sends only what you typed, for tools that refuse a
71
+ `projectId` next to another selector. A list of objects also reads a file (`--nodes @nodes.json`), and an
72
+ argument that names an asset (`--asset-id`, `--video-asset-ids`, …) takes either spelling a result prints: the
73
+ bare id, or the node id `asset-<id>`.
74
+
75
+ `martini <tool> --help` prints the tool's own description, every flag with its type and whether it is required,
76
+ the result fields when the tool declares them (as `--fields` paths), and an example built from the schema that
77
+ runs as written (`martini create_nodes --project <project-id> --canvas <canvas-id> --nodes '[{"nodeType":"video"}]'`).
78
+ Help is sized to a first call: a tool with more than a dozen flags lists its optional ones on a line each (name,
79
+ type, first sentence) and its result fields as deep as fit in thirty lines, and says at the end what it shortened;
80
+ `--help --all` prints the whole page (`create_node`: 9 KB instead of 16). A tool that answers with media
81
+ (`view_asset`, `inspect_video`, `render_timeline_frame`, …) gets an `Output:` block saying how to save it.
82
+
83
+ Under each JSON flag one line names the keys it takes — `shape: { x*, y*, width, height }` for an object (`*` marks
84
+ a required key), `each: { … }` for a list of objects, `one of:` for a union — and a `Rules:` block spells out the
85
+ tool's own `oneOf` / `anyOf` (`Exactly one of: --video-asset-id | --video-asset-ids`). Every key is named, and a
86
+ required key that is itself a small object shows its own (`source*: { assetIds, shotNumbers }`). `martini <tool>
87
+ --schema <flag>` prints that argument's full JSON Schema as indented JSON (`--schema` alone prints the whole input
88
+ schema), from the tool list in use, with no key and no request; `--schema <flag> --keys` prints one line per key
89
+ instead — name, type, first sentence — which is what a 20 KB schema says about names and types in about four.
31
90
 
32
91
  `projectId`, `canvasId`, and `runId` are filled from context when a tool takes them and the caller did not say:
33
- `--project` / `--canvas` / `--run`, else `MARTINI_PROJECT_ID` / `MARTINI_CANVAS_ID` / `MARTINI_RUN_ID`, else the
34
- config file. A typed selector that replaces one of them keeps it out (`get_board_overview --project-query`,
35
- `run_workflow --workflow-id`, which runs a saved workflow on a canvas of its own).
92
+ `--project` / `--canvas` / `--run`, else `MARTINI_PROJECT_ID` / `MARTINI_CANVAS_ID` / `MARTINI_RUN_ID`, else what
93
+ `martini use` set for the directory, else the config file. A typed selector that replaces one of them keeps it
94
+ out (`get_board_overview --project-query`, `run_workflow --workflow-id`, which runs a saved workflow on a canvas
95
+ of its own).
96
+
97
+ `martini use <project-id|name> [--canvas <id|name>]` is how an agent sets the project: it checks the project with
98
+ one read, and writes `.martini/context.json` in the working directory (`{ projectId, projectName, canvasId?,
99
+ canvasName?, apiUrl }`). Every later command run in that directory tree reads it. An agent's shell is new on every
100
+ command, so an exported variable does not last; a file beside the work does. The file holds no credential, is
101
+ ignored under another `--api-url` (with a `CONFIG_WARNING`), and a flag or variable that names another project
102
+ replaces it whole — its canvas is never sent with someone else's project. `martini use` alone prints it;
103
+ `--clear` removes it; `martini whoami` shows what is in effect.
36
104
 
37
105
  ## Credentials and context
38
106
 
@@ -40,34 +108,65 @@ Most specific first:
40
108
 
41
109
  1. Flags: `--api-key`, `--api-url`, `--profile`.
42
110
  2. Environment: `MARTINI_API_KEY`, `MARTINI_API_URL`, `MARTINI_PROFILE`, `MARTINI_CONFIG_FILE`.
43
- 3. The nearest `.martini/config.json` above the working directory — what a workflow run's sandbox has.
44
- 4. `~/.config/martini/config.json` — the profiles `martini login` saves, one per organization (named after it, `test-team`), with a default.
111
+ 3. The nearest `.martini/config.json` above the working directory — a Martini workflow run provides one. A file
112
+ there without a key adds its `projectId` / `canvasId` to the profile below instead of hiding it.
113
+ 4. `~/.config/martini/config.json` — the profiles `martini login` saves, with a default (the key `default`). Approving "as you" saves the profile `account`, a key that acts in every organization you belong to; approving for one organization saves a profile named after it (`test-team`). Tools run as you either way and the project you name decides who is billed; an organization key additionally reaches that organization's REST API and is listed in its Settings.
45
114
 
46
115
  `--project-id`, `--canvas-id`, and `--run-id` (the tools' spelling) are accepted wherever `--project`, `--canvas`,
47
116
  and `--run` are.
48
117
 
49
- A workflow run's sandbox therefore needs nothing but its working directory; a laptop needs one `martini login`;
50
- a script sets `MARTINI_API_KEY`. A raw Martini API key (`mtn_live_…`) always works.
118
+ Inside a workflow run the CLI is therefore already signed in; a laptop needs one `martini login`;
119
+ a script sets `MARTINI_API_KEY`. A raw Martini API key (`mtn_live_…`) always works. Signing in as you
120
+ needs CLI 0.3.0 or newer; the approval page offers only what the CLI that asked can collect.
51
121
 
52
122
  ## Output and exit codes
53
123
 
54
- Results are JSON on stdout — compact when piped, indented on a terminal. `--fields a,b.c` keeps only those
55
- dotted paths, applied on the server so a large listing never crosses the wire; a `*` segment steps into every value of
56
- an id-keyed map (`assets.*.status`) and is applied in the CLI. With `--wait` (including default
57
- waits), the CLI keeps the submission identifiers for polling and applies `--fields` to the final result.
58
- `--out <path>` writes the result
59
- (or, with `--raw`, the media bytes of tools like `view_asset`) to a file and prints one summary line. `--quiet`
60
- prints nothing on success. Errors are one JSON object on stderr: `{ "error": { "code", "message", "hint", "tool",
61
- "exitCode" } }`, with the tool's own MCP error code (`ASSET_NOT_READY`, `NODE_NOT_FOUND`, …).
62
-
63
- | Exit | Meaning |
64
- | ---- | -------------------------------------------- |
65
- | 0 | ok |
66
- | 1 | the tool failed |
67
- | 2 | usage: unknown command, missing or bad flags |
68
- | 3 | no key, or the key is invalid / expired |
69
- | 4 | not ready or timed out (pending ids named) |
70
- | 5 | insufficient olives |
124
+ **Exit 0 means the command did everything it was asked.** Anything else is non-zero, with one JSON object on
125
+ stderr — `{ "error": { "code", "message", "hint", "tool", "exitCode" } }`, the tool's own MCP error code where
126
+ there is one (`ASSET_NOT_READY`, `NODE_NOT_FOUND`, …). A command that did part of its work prints that part on
127
+ stdout as well, so nothing it produced is lost: a timed-out wait's `pending` ids, a push's `skipped` files, the
128
+ quote a cap refused.
129
+
130
+ Results are JSON on stdout — compact when piped, indented on a terminal — except the text commands (`guide`,
131
+ `init` without `--write`, `files cat`, `--help`), which print text. Warnings are JSON on stderr too
132
+ (`{ "warning": { "code", "message" } }`) and never change stdout or the exit code. `--quiet` prints nothing on
133
+ success.
134
+
135
+ `--fields a,b.c` keeps only those dotted paths. A field that is a map keyed by id is stepped into for you
136
+ (`assets.status` on `get_board_assets`), or explicitly with a `*` segment, quoted for the shell
137
+ (`'assets.*.status'`). A path that matches nothing while others match is named in a `FIELDS_NOT_FOUND` warning.
138
+ When no path matches, the answer depends on what the command did: a read exits 2 (`NO_FIELDS_MATCHED`, naming the
139
+ result's top-level fields) and prints nothing; a command that wrote something prints its whole result with the
140
+ warning and exits 0, because the ids it made must not be lost to a typo and it must not be run twice. The server
141
+ trims the result of a read whose result schema the CLI knows; everything else is trimmed here, after any wait.
142
+
143
+ `--out <path>` writes the result to a file and prints a one-line JSON receipt, `{ path, bytes, summary }`. When
144
+ the path has a media extension (`.jpg`, `.png`, `.webp`, `.mp3`, `.wav`, …) it writes the media bytes of a
145
+ one-media result instead (`view_asset`, `render_timeline_frame`), and the receipt carries the tool's own metadata:
146
+ `{ path, bytes, contentType, result }`. `--raw` asks for the bytes whatever the file is called, and streams them
147
+ to a pipe; to a terminal it is a usage error. A name whose extension contradicts the bytes (`still.png` for
148
+ `image/webp`) is written as asked, with an `EXTENSION_MISMATCH` warning; a name that claims no media type
149
+ (`--raw --out sheet.json`) is your choice and gets none. JSON is never saved under an image name: on a read, a
150
+ result without exactly one media block is a usage error; a tool that writes (`extract_video_frame`) is called once
151
+ and its picture taken from the result, and when it has none its result is printed whole with an `OUT_NOT_MEDIA`
152
+ warning. `--fields` trims the receipt (`--fields path,result.assetId`).
153
+
154
+ `--out-dir <dir>` (read-only tools) writes every media block to its own file and prints
155
+ `{ dir, files: [{ path, mimeType, bytes, about }], notes? }`. A file is named by the asset the text block beside
156
+ it names — `<i>-<id>.jpg` from a batch's `Asset <id> (i/n)` header, `<id>.png` from a JSON text block's `assetId`,
157
+ else `block-<n>.<ext>` — and `about` is that text block parsed (asset id, shot number, duration, …), so the review
158
+ needs no second call. A batch item that failed writes nothing and appears under `notes`. Printed without either
159
+ flag, a media block is a stub (`mimeType`, `bytes`, a hint), and `inspect_video` prints its ordered blocks, each
160
+ asset's text before its sheet, a text that is JSON as `{ "type": "text", "label", "json" }`.
161
+
162
+ | Exit | Meaning |
163
+ | ---- | ------------------------------------------------------------------- |
164
+ | 0 | done, all of it |
165
+ | 1 | the tool failed, part of the work did not land, or what was waited for failed (see stdout) |
166
+ | 2 | usage: unknown command, missing or bad flags, `--fields` on a read that matched nothing |
167
+ | 3 | no key, or the key is invalid / expired |
168
+ | 4 | not ready or timed out (pending ids named) |
169
+ | 5 | over budget: not enough olives, or a quote over `--max-olives` |
71
170
 
72
171
  ## Waiting
73
172
 
@@ -76,19 +175,25 @@ adds `waited` to the result; it is on by default for single-item generation and
76
175
  tools, where you fan out and then `martini wait <ids…>` once. `waited` has one shape whatever was waited on:
77
176
  `{ kind, status, assets? | job? | run? | delivery? }` — `status` is the terminal status (for assets, `failed` when
78
177
  any failed) and the settled records sit under the key that names them; `martini wait` prints the same object.
178
+ Exit 0 means what was waited for completed. A shot, job, render, or run that settles on `failed`, `cancelled`, or
179
+ `needs_revision` prints that same object and exits 1 (`ASSET_FAILED`, `JOB_FAILED`, `RUN_NEEDS_REVISION`, …), so a
180
+ script that goes on to review or cut never does it with a shot that is not there. `martini upload` follows the same
181
+ rule: a file storage refused (`UPLOAD_INCOMPLETE`) or one that failed processing exits 1 with the receipt on stdout.
79
182
  `--timeout <seconds>` (default `MARTINI_WAIT_TIMEOUT_SECONDS` when set, else 50; a malformed value is a usage error) ends the wait with exit 4: the
80
- result the command produced is still printed on stdout, with `pending` (and `settled`) ids, and the error on
81
- stderr names the `martini wait …` command that resumes it. Size `--timeout` to what your shell step allows — a
82
- video generation takes minutes.
183
+ result the command produced is still printed on stdout, with `pending` (and `settled`) ids — `martini wait` itself
184
+ prints `{ kind, status: "pending", pending, settled }` — and the error on stderr names the `martini wait …`
185
+ command that resumes it, project included, so it runs as written in a new shell. Size `--timeout` to what your
186
+ shell step allows — a video generation takes minutes.
83
187
 
84
188
  ## Approving a quote
85
189
 
86
190
  `generate_nodes`, `upscale_assets`, and `enhance_draft` answer a quote first (`approvalNeeded: true`, `planHash`,
87
191
  the estimated olives) and start nothing until called again with that `planHash` (plus `batchRequestId` for
88
192
  upscales) and the approval argument. `--approve --max-olives <n>` does both in one command: it takes the quote,
89
- refuses when the estimated total is over the cap (`PLAN_OVER_BUDGET`) or has no number (`PLAN_UNPRICED`), with
90
- the quote on stdout and nothing started, and otherwise re-calls the tool with exactly what it asked for; the
91
- result carries `approvedPlan`. The cap is required: an approval always states how much it is for. A tool with an
193
+ refuses when the estimated total is over the cap (`PLAN_OVER_BUDGET`) or has no number (`PLAN_UNPRICED`) — exit 5,
194
+ nothing started, the quote on stdout with `overCap: { quotedOlives, maxOlives }` — and otherwise re-calls the tool
195
+ with exactly what it asked for; the result carries `approvedPlan`. Exit 5 is the one refusal to take to the person:
196
+ they raise the cap, or the batch gets smaller. The cap is required: an approval always states how much it is for. A tool with an
92
197
  approval argument but no quote step (`create_nodes_and_generate`) is only attested by `--approve` and cannot be
93
198
  capped — for a capped batch, `create_nodes` then `generate_nodes --approve --max-olives <n>`.
94
199
 
@@ -96,26 +201,38 @@ capped — for a capped batch, `create_nodes` then `generate_nodes --approve --m
96
201
 
97
202
  | Command | Does |
98
203
  | ------------------------------------ | ----------------------------------------------------------------------------------------------------- |
99
- | `login`, `logout`, `whoami` | device-code pairing (a started pairing is resumed by running `login` again; `--no-wait` returns at once), forget a profile, who the CLI acts as |
100
- | `tools`, `models` | the manifest this build knows (and whether the server has a newer one); the cached model catalog |
101
- | `upload <paths…>` | prepare → PUT → complete from local files, then wait for processing |
204
+ | `login`, `logout`, `whoami` | device-code pairing (a started pairing is resumed by running `login` again, or replaced when under two minutes are left on it; `--no-wait` returns at once with `expiresInSeconds`), forget a profile, who the CLI acts as and in which project |
205
+ | `use [<project>] [--canvas <c>]` | the project and canvas for this directory (`.martini/context.json`), by id or name; `--clear` forgets it |
206
+ | `tools`, `models` | how the server's tool list differs from this build's (`--list` adds every tool, about 70 KB; `--refresh`); the cached model catalog |
207
+ | `call <tool> --args <json\|@file>` | a tool call by name with exactly those arguments, for a tool neither list shows |
208
+ | `upload <paths…>` | prepare → PUT → complete from local files, each declared as external material in its lineage where the server takes one (`--lineage <json\|@file>` overrides), then wait for processing |
102
209
  | `download <ids…>` | presigned URL → bytes → file |
103
210
  | `wait <ids…> \| --job \| --run \| --render` | block until assets, a job, a run, or a render settles |
104
- | `files ls\|cat\|write\|pull\|push` | project memory files as a directory; `push` refuses a file edited server-side since the pull |
211
+ | `files ls\|cat\|write\|pull\|push` | project memory files as a directory; neither direction loses an edit silently (below) |
105
212
  | `probe <path\|id>…` | ffprobe + sha256 in one JSON report |
106
- | `init [--write]` | the AGENTS.md snippet that teaches a repo's agents to use the CLI |
107
-
108
- ## Inside a workflow run
109
-
110
- The sandbox of a Martini workflow run carries a run key in `.martini/config.json`, written when the run's agent
111
- environment opens and revoked when it closes. Calls made with it go through the run's own supervisor — the same
112
- budgets, spend fences, and trace as the run's tool calls — and the tool set is the run's. A run that is not
113
- executing answers `RUN_NOT_ACTIVE` (exit 4).
213
+ | `guide [topic] [--list]` | the operator rules by topic (`orientation`, `library`, `timeline`, `generation`, `storage`, `support`, `shell`); `--list` gives each topic's size; read once per session |
214
+ | `init [--write] [--force] [--dir <repo>]` | the agent skill and a three-line AGENTS.md pointer; printed without `--write`, installed with it |
215
+
216
+ `martini files pull <dir>` writes every file plus `.martini/files.json` (path → `updatedAt`, sha256).
217
+ `martini files push <dir>` sends only what changed, each write guarded by the version it was pulled at. A file
218
+ that changed on the server meanwhile is refused (`PROJECT_FILE_CHANGED`, listed under `skipped`), and a push that
219
+ skipped anything exits 1 with its result on stdout. `behind` lists files the server has newer, or new, that were
220
+ not touched here (`null`, with a `BEHIND_UNKNOWN` warning, when listing them failed after the push). A pull never overwrites a file edited since the last one: it is kept (`kept`), and when the
221
+ server's copy changed too, that copy is written to `.martini/conflicts/<path>`, the file is listed under
222
+ `conflicts`, and the pull exits 1 (`PULL_CONFLICT`). Merge what you need, delete the copy, and push; until then
223
+ push skips that file (`UNRESOLVED_CONFLICT`). `--force` overwrites, in either direction.
224
+
225
+ `martini init --write` installs a short agent skill at `.agents/skills/martini/SKILL.md` (Codex, Cursor, and
226
+ other agents read it) and `.claude/skills/martini/SKILL.md` (Claude Code; skipped when `.claude/skills` links to
227
+ `.agents/skills`), and appends a three-line `## Martini CLI` pointer to `AGENTS.md` unless the section is there.
228
+ The skill routes the agent to the CLI and points at `martini guide` and `martini <tool> --help` for the detail. A
229
+ skill file with other content is kept unless `--force`; `--dir <repo>` installs into another directory; nothing
230
+ outside it is written. Run it again after an update to refresh the skill (`--force` replaces an older copy).
114
231
 
115
232
  ## Single-file binary
116
233
 
117
234
  `pnpm run build:binary` compiles `dist/bin.js` into `dist/martini-linux-x64` with Bun for environments without
118
- Node (the agent-environment sandbox). Bun is only needed on the build machine. Every release publishes it at `https://downloads.martini.film/cli-releases/<version>/martini-linux-x64`;
235
+ Node. Bun is only needed on the build machine. Every release publishes it at `https://downloads.martini.film/cli-releases/<version>/martini-linux-x64`;
119
236
  the npm package is published separately.
120
237
 
121
238
  Docs: <https://www.martini.film/docs/cli>.
package/dist/api.js CHANGED
@@ -1,24 +1,48 @@
1
1
  import { detectHostAgent } from './host.js';
2
- export const CLI_VERSION = '0.2.0';
2
+ export const CLI_VERSION = '0.4.0';
3
3
  export class CliApiError extends Error {
4
4
  code;
5
5
  status;
6
6
  tool;
7
7
  result;
8
+ hint;
8
9
  constructor(message, details) {
9
10
  super(message);
10
11
  this.name = 'CliApiError';
11
12
  this.code = details.code;
12
13
  this.status = details.status;
13
14
  this.tool = details.tool ?? null;
15
+ this.hint = details.hint;
14
16
  }
15
17
  }
18
+ export function isTextBlock(block) {
19
+ return block.type === 'text' && typeof block.text === 'string';
20
+ }
21
+ export function isMediaBlock(block) {
22
+ return block.type === 'image' || block.type === 'audio';
23
+ }
24
+ function isBlocksBody(body) {
25
+ if (!body || typeof body !== 'object' || Array.isArray(body))
26
+ return false;
27
+ const blocks = body.blocks;
28
+ return (Array.isArray(blocks) &&
29
+ blocks.every(block => block !== null &&
30
+ typeof block === 'object' &&
31
+ !Array.isArray(block) &&
32
+ typeof block.type === 'string'));
33
+ }
34
+ export const MANIFEST_FETCH_TIMEOUT_MS = 15_000;
16
35
  export function userAgent(env = process.env) {
17
36
  const host = detectHostAgent(env);
18
37
  return `martini-cli/${CLI_VERSION}${host ? ` (${host})` : ''}`;
19
38
  }
20
39
  export function createApiClient(config, options = {}) {
21
- const fetchImpl = options.fetch ?? fetch;
40
+ const baseFetch = options.fetch ?? fetch;
41
+ const fetchImpl = async (input, init) => {
42
+ const response = await baseFetch(input, init);
43
+ options.onResponse?.(response);
44
+ return response;
45
+ };
22
46
  const env = options.env ?? process.env;
23
47
  function headers(extra = {}) {
24
48
  const base = {
@@ -91,6 +115,32 @@ export function createApiClient(config, options = {}) {
91
115
  ...(options.signal ? { signal: options.signal } : {}),
92
116
  });
93
117
  },
118
+ async callToolBlocks(name, args, options) {
119
+ requireKey();
120
+ const query = new URLSearchParams({ format: 'blocks', media: options.media });
121
+ const response = await fetchImpl(`${config.apiUrl}/v1/tools/${encodeURIComponent(name)}?${query}`, {
122
+ method: 'POST',
123
+ headers: headers({ 'Content-Type': 'application/json' }),
124
+ body: JSON.stringify(args),
125
+ });
126
+ if (!response.ok)
127
+ throw await readError(response, name);
128
+ let body;
129
+ try {
130
+ body = await response.json();
131
+ }
132
+ catch {
133
+ body = undefined;
134
+ }
135
+ if (!isBlocksBody(body)) {
136
+ throw new CliApiError(`The API answered ${name} with format=blocks but no list of blocks.`, {
137
+ code: 'INVALID_RESPONSE',
138
+ status: response.status,
139
+ tool: name,
140
+ });
141
+ }
142
+ return body;
143
+ },
94
144
  async callToolRaw(name, args) {
95
145
  requireKey();
96
146
  const response = await fetchImpl(`${config.apiUrl}/v1/tools/${encodeURIComponent(name)}?format=raw`, {
@@ -120,6 +170,23 @@ export function createApiClient(config, options = {}) {
120
170
  requireKey();
121
171
  return requestJson('/v1/tools', { method: 'GET' });
122
172
  },
173
+ async fetchManifest(ifNoneMatch) {
174
+ requireKey();
175
+ const response = await fetchImpl(`${config.apiUrl}/v1/tools`, {
176
+ method: 'GET',
177
+ headers: headers(ifNoneMatch ? { 'If-None-Match': `"${ifNoneMatch}"` } : {}),
178
+ signal: AbortSignal.timeout(MANIFEST_FETCH_TIMEOUT_MS),
179
+ });
180
+ if (response.status === 304)
181
+ return { notModified: true };
182
+ if (!response.ok)
183
+ throw await readError(response);
184
+ const etag = response.headers
185
+ .get('etag')
186
+ ?.replace(/^W\//, '')
187
+ .replace(/^"(.*)"$/, '$1');
188
+ return { notModified: false, body: await response.json(), etag: etag ?? null };
189
+ },
123
190
  async me() {
124
191
  requireKey();
125
192
  return requestJson('/v1/me', { method: 'GET' });
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAG3C,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAA;AAElC,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,IAAI,CAAQ;IACZ,MAAM,CAAQ;IACd,IAAI,CAAe;IAE5B,MAAM,CAAU;IAChB,YAAY,OAAe,EAAE,OAA+D;QAC1F,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,aAAa,CAAA;QACzB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,IAAI,CAAA;IAClC,CAAC;CACF;AAmBD,MAAM,UAAU,SAAS,CAAC,MAAyB,OAAO,CAAC,GAAG;IAC5D,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,CAAC,CAAA;IACjC,OAAO,eAAe,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;AAChE,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAsB,EAAE,UAA4B,EAAE;IACpF,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAA;IACxC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAA;IAEtC,SAAS,OAAO,CAAC,QAAgC,EAAE;QACjD,MAAM,IAAI,GAA2B;YACnC,YAAY,EA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;QACzF,CAAC;QAGD,KAAK,CAAC,UAAU,CAAC,GAAW;YAC1B,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,GAAG,CAAC,CAAA;YACrC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,IAAI,WAAW,CAAC,oBAAoB,QAAQ,CAAC,MAAM,IAAI,EAAE;oBAC7D,IAAI,EAAE,iBAAiB;oBACvB,MAAM,EAAE,QAAQ,CAAC,MAAM;iBACxB,CAAC,CAAA;YACJ,CAAC;YACD,OAAO;gBACL,KAAK,EAAE,IAAI,UAAU,CAAC,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;gBACnD,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,0BAA0B;aAChF,CAAA;QACH,CAAC;QAGD,KAAK,CAAC,QAAQ,CAAC,GAAW,EAAE,KAAiB,EAAE,UAAkC;YAC/E,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,KAA4B,EAAE,CAAC,CAAA;YACjH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,IAAI,WAAW,CAAC,sBAAsB,QAAQ,CAAC,MAAM,IAAI,EAAE;oBAC/D,IAAI,EAAE,mBAAmB;oBACzB,MAAM,EAAE,QAAQ,CAAC,MAAM;iBACxB,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
package/dist/approve.js CHANGED
@@ -54,7 +54,8 @@ export async function runWithApproval(tool, client, args, support, options) {
54
54
  }
55
55
  if (total > maxOlives) {
56
56
  const error = new CliApiError(`${tool.name} quoted ${total} olives, over the --max-olives ${maxOlives} cap; nothing was started.`, { code: 'PLAN_OVER_BUDGET', status: 0, tool: tool.name });
57
- error.result = quote;
57
+ const { nextSteps: _nextSteps, ...plan } = quote;
58
+ error.result = { ...plan, overCap: { quotedOlives: total, maxOlives } };
58
59
  throw error;
59
60
  }
60
61
  const count = itemCount(quote, args);
@@ -1 +1 @@
1
- {"version":3,"file":"approve.js","sourceRoot":"","sources":["../src/approve.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAkB,MAAM,UAAU,CAAA;AAEtD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AASlD,MAAM,UAAU,eAAe,CAAC,IAAU;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,IAAI,EAAE,CAAA;IACpD,MAAM,QAAQ,GAAG,eAAe,IAAI,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,IAAI,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAA;IAC/G,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAA;IAC1B,OAAO;QACL,IAAI,EAAE,UAAU,IAAI,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ;QACnD,QAAQ;QACR,oBAAoB,EAAE,gBAAgB,IAAI,UAAU;KACrD,CAAA;AACH,CAAC;AAGD,MAAM,UAAU,OAAO,CAAC,MAAe;IACrC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAA;IAChF,MAAM,MAAM,GAAG,MAAiC,CAAA;IAChD,OAAO,MAAM,CAAC,cAAc,KAAK,IAAI,IAAI,MAAM,CAAC,SAAS,KAAK,KAAK,CAAA;AACrE,CAAC;AAED,SAAS,YAAY,CAAC,KAA8B;IAClD,MAAM,KAAK,GAAG,KAAK,CAAC,oBAAoB,IAAI,KAAK,CAAC,eAAe,CAAA;IACjE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CA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js CHANGED
@@ -1,8 +1,9 @@
1
- export function parseArgs(argv, isBoolean = () => false) {
1
+ export function parseArgs(argv, isBoolean = () => false, takesList = () => false) {
2
2
  const flags = new Map();
3
3
  const positionals = [];
4
4
  let command;
5
5
  let onlyPositionals = false;
6
+ const pendingNegations = [];
6
7
  const push = (name, value) => {
7
8
  const existing = flags.get(name);
8
9
  if (existing === undefined) {
@@ -17,6 +18,16 @@ export function parseArgs(argv, isBoolean = () => false) {
17
18
  }
18
19
  flags.set(name, Array.isArray(existing) ? [...existing, value] : [existing, value]);
19
20
  };
21
+ const takeListValues = (name, index) => {
22
+ if (command === undefined || !takesList(name, command))
23
+ return index;
24
+ let last = index;
25
+ while (last + 1 < argv.length && !argv[last + 1].startsWith('--')) {
26
+ last += 1;
27
+ push(name, argv[last]);
28
+ }
29
+ return last;
30
+ };
20
31
  for (let i = 0; i < argv.length; i += 1) {
21
32
  const arg = argv[i];
22
33
  if (onlyPositionals) {
@@ -31,29 +42,43 @@ export function parseArgs(argv, isBoolean = () => false) {
31
42
  const body = arg.slice(2);
32
43
  const eq = body.indexOf('=');
33
44
  if (eq >= 0) {
34
- push(body.slice(0, eq), body.slice(eq + 1));
45
+ const name = body.slice(0, eq);
46
+ push(name, body.slice(eq + 1));
47
+ i = takeListValues(name, i);
35
48
  continue;
36
49
  }
37
- if (body.startsWith('no-')) {
38
- push(body.slice(3), 'false');
50
+ if (body.startsWith('no-') && !isBoolean(body, command)) {
51
+ if (command === undefined)
52
+ pendingNegations.push(body);
53
+ else
54
+ push(body.slice(3), 'false');
39
55
  continue;
40
56
  }
41
57
  const next = argv[i + 1];
42
58
  const boolean = isBoolean(body, command);
43
59
  if (next !== undefined && !next.startsWith('--') && (!boolean || /^(true|false|1|0|yes|no)$/.test(next))) {
44
60
  push(body, next);
45
- i += 1;
61
+ i = takeListValues(body, i + 1);
46
62
  }
47
63
  else {
48
64
  push(body, true);
49
65
  }
50
66
  continue;
51
67
  }
52
- if (command === undefined)
68
+ if (command === undefined) {
53
69
  command = arg;
70
+ for (const body of pendingNegations.splice(0)) {
71
+ if (isBoolean(body, command))
72
+ push(body, true);
73
+ else
74
+ push(body.slice(3), 'false');
75
+ }
76
+ }
54
77
  else
55
78
  positionals.push(arg);
56
79
  }
80
+ for (const body of pendingNegations)
81
+ push(body.slice(3), 'false');
57
82
  return { command, positionals, flags };
58
83
  }
59
84
  export function flagString(flags, name) {
package/dist/args.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAaA,MAAM,UAAU,SAAS,CACvB,IAAuB,EACvB,YAAoE,GAAG,EAAE,CAAC,KAAK;IAE/E,MAAM,KAAK,GAAG,IAAI,GAAG,EAAqB,CAAA;IAC1C,MAAM,WAAW,GAAa,EAAE,CAAA;IAChC,IAAI,OAA2B,CAAA;IAC/B,IAAI,eAAe,GAAG,KAAK,CAAA;IAE3B,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,KAAoB,EAAE,EAAE;QAClD,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAChC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;YACtB,OAAM;QACR,CAAC;QACD,IAAI,KAAK,KAAK,IAAI;YAAE,OAAM;QAC1B,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtB,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;YACtB,OAAM;QACR,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAA;IACrF,CAAC,CAAA;IAED,KAAK,IAAI,CAAC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