@firstdraft.com/cli 0.9.0 → 0.11.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/README.md +10 -8
- package/docs/README.md +1 -1
- package/docs/commands.md +659 -132
- package/docs/errors.md +227 -73
- package/package.json +7 -1
- package/src/agent-sentences.js +210 -0
- package/src/api-authentication.js +25 -6
- package/src/api-response.js +110 -6
- package/src/cli.js +3143 -912
- package/src/commands/account.js +97 -0
- package/src/commands/compilation.js +57 -5
- package/src/commands/login.js +246 -42
- package/src/commands/maintain.js +662 -0
- package/src/commands/note.js +204 -0
- package/src/commands/plan-compile.js +44 -77
- package/src/commands/plan-init.js +14 -1
- package/src/commands/plan-push.js +26 -12
- package/src/commands/plan-status.js +1 -1
- package/src/commands/report.js +469 -0
- package/src/commands/sketches.js +388 -0
- package/src/commands/start.js +52 -0
- package/src/compilation-artifact.js +39 -4
- package/src/credentials.js +145 -7
- package/src/oauth.js +33 -25
- package/src/plan-compile-progress.js +8 -81
- package/src/plan-state.js +325 -5
- package/src/root-output.js +13 -1
- package/src/service-client.js +513 -0
- package/src/sketch-capture.js +449 -0
- package/src/commands/plan-publish.js +0 -1146
package/docs/errors.md
CHANGED
|
@@ -5,16 +5,70 @@ This page owns handled-error interpretation, retry safety, and recovery guidance
|
|
|
5
5
|
|
|
6
6
|
## Handled output contract
|
|
7
7
|
|
|
8
|
-
Every handled subcommand failure ends with exactly one JSON object on standard error.
|
|
9
|
-
|
|
8
|
+
Every handled subcommand failure ends with exactly one JSON object on standard error. Any network command may first
|
|
9
|
+
write one [update or stop line](commands.md#update-line-and-refusals), and `plan compile` may first write progress lines;
|
|
10
|
+
both begin with the exact `First Draft: ` prefix, so machine consumers can remove only those lines and parse the
|
|
10
11
|
remaining JSON document. `login` may first write its human-readable authorization instructions; its JSON object
|
|
11
|
-
starts on the line after them.
|
|
12
|
+
starts on the line after them. `report` and `note` print what they send on standard output before sending it, so
|
|
13
|
+
standard output may hold that preview when they fail. `start`, `login --no-wait`, and `login --finish` print their plain
|
|
14
|
+
sentences for the agent on standard output, which holds them when the command fails. Branch on the stable `error`
|
|
15
|
+
value rather than the human-readable `detail`.
|
|
12
16
|
|
|
13
17
|
Handled output never includes command arguments, local Plan bytes, raw artifact bytes, raw filesystem or network
|
|
14
18
|
errors, or unvalidated response bodies. `local_state_not_saved` is the sole exception to private-state redaction:
|
|
15
19
|
its `recovery_state` is required to repair the accepted ETag locally. Root-level and command-group usage failures
|
|
16
20
|
remain human-readable text on standard error with exit 2. Unexpected programming defects remain loud.
|
|
17
21
|
|
|
22
|
+
## Sketch review recovery
|
|
23
|
+
|
|
24
|
+
When a screen capture fails, the detail gives its screen ID and viewport dimensions. Correct the indicated Plan
|
|
25
|
+
binding, image, asset URL, or layout and publish again.
|
|
26
|
+
|
|
27
|
+
`sketch_review_failed` describes a Project-start, capture, publication or reviewed-source problem. Retry an interrupted
|
|
28
|
+
start from the same directory. A fresh publication refused with a client error other than an HTTP 408 clears its
|
|
29
|
+
pending request. Correct the rejected draft or login, or wait for the rate limit, then publish again.
|
|
30
|
+
|
|
31
|
+
After a timeout or another unknown outcome, the CLI retains the exact request privately. Run the same publish
|
|
32
|
+
command to settle that revision before sending edits. A refusal before the service can check the revision, such as
|
|
33
|
+
a 400 for an invalid ID, an access refusal, a size limit or a rate limit, retains the journal on replay. Restore
|
|
34
|
+
access or correct the service configuration and retry. A verified conflict, active Compilation, Project storage
|
|
35
|
+
quota, invalid review or Plan diagnostics after the revision check clears a refused replay. If local sources have
|
|
36
|
+
changed, a successful replay returns the recovered revision ID and a `next_step` to publish the current draft.
|
|
37
|
+
|
|
38
|
+
If replay keeps timing out or returning a server error, keep the planning folder and its pending request intact.
|
|
39
|
+
Reopen the Project URL to inspect the hosted board and continue the walkthrough using local HTML. To continue
|
|
40
|
+
publishing before the original submission can be resolved, start a separate Project with `project start` in a new
|
|
41
|
+
folder. Copy only the working Plan and `sketches/` there. Publish, share the new Project URL and obtain approval
|
|
42
|
+
for its new revision. The original Project and pending request remain available for recovery.
|
|
43
|
+
|
|
44
|
+
Hosted Plan pushes, Sketch publications and root adoption reserve the planning folder while they run. Wait for the
|
|
45
|
+
active command to finish and retry. After a killed hosted writer, check the PID in
|
|
46
|
+
`.firstdraft-root-output/hosted-writer.pid`. Once the process has exited, remove that file and the empty directory.
|
|
47
|
+
A stopped command can leave an empty reservation or an empty PID file. First ensure every writer, Compile and
|
|
48
|
+
download using this folder has stopped. If the directory is empty, remove it with `rmdir .firstdraft-root-output`.
|
|
49
|
+
If its only entry is an empty `hosted-writer.pid`, remove that file first. Preserve all journal or artifact files.
|
|
50
|
+
For a root-output journal, follow the root-adoption recovery instructions below.
|
|
51
|
+
|
|
52
|
+
The service problem appears in `response` when the CLI can verify its shape:
|
|
53
|
+
|
|
54
|
+
- `409 sketch_review_conflict` in `sketch_review_failed` means the submitted revision conflicts with the hosted
|
|
55
|
+
Project. Open the Project URL, inspect the current review and reconcile its changes locally. Then run
|
|
56
|
+
`firstdraft sketches publish --after <current-review-id> --head <current-head-sha256>` using the identities
|
|
57
|
+
returned in `response.current_review.id` and `response.head_sha256`. Use `none` for a missing review or Head.
|
|
58
|
+
An interrupted rebased publication accepts the same two options on replay.
|
|
59
|
+
- `412 sketch_review_changed` in `compilation_start_rejected` means the service declined to start Compile for the
|
|
60
|
+
requested review and Plan. Inspect the current revision and Head, reconcile and publish any changes, and obtain
|
|
61
|
+
approval for the revision before passing it to `plan compile --revision`. When graph versions differ, the Plan
|
|
62
|
+
passed through another generation even if its current bytes match an older review.
|
|
63
|
+
- `422 invalid_sketch_review` in `sketch_review_failed` means the service rejected the review bundle. Read
|
|
64
|
+
`response.detail`, correct the indicated board, capture or reference, and publish the corrected draft. A rejected Plan can instead return `response.diagnostics`; use those to fix the Plan.
|
|
65
|
+
- `413 sketch_quota_reached` in `sketch_review_failed` means the Project reached its stored review limit. A
|
|
66
|
+
smaller capture may fit if only the stored byte budget is limiting it. At the revision-count limit, continue
|
|
67
|
+
the walkthrough using local HTML.
|
|
68
|
+
|
|
69
|
+
Restore missing approved source from the planning folder or review a reconstruction. When an older service lacks
|
|
70
|
+
the hosted endpoint, use local HTML for the walkthrough until the service and CLI are matched.
|
|
71
|
+
|
|
18
72
|
## Environment and credential errors
|
|
19
73
|
|
|
20
74
|
`invalid_configuration` stops before a request when `--staging` conflicts with `FIRSTDRAFT_API_URL` or a Project's
|
|
@@ -29,13 +83,25 @@ used. The CLI never substitutes one environment's credential for another's. Run
|
|
|
29
83
|
environment (with `--staging` or the same `FIRSTDRAFT_API_URL`), or refresh the environment token, then follow the
|
|
30
84
|
command's recovery instructions below. If a saved login is rejected, run `firstdraft login` again.
|
|
31
85
|
|
|
86
|
+
From `start`, `authentication_required` means it is not ready: no token exists for the origin, so it made no
|
|
87
|
+
request, or First Draft rejected the token it sent. Its standard output says which and names the next step: the
|
|
88
|
+
[agent's two login steps](commands.md#log-in-from-an-agent), or, for a rejected environment token, asking the person
|
|
89
|
+
to replace or unset it. No handled error from `start` carries `response`, so none repeats text First Draft wrote.
|
|
90
|
+
|
|
32
91
|
## Login and logout errors
|
|
33
92
|
|
|
34
93
|
`login` and `logout` never print a token. A local credential failure can occur after the server has issued or revoked a token.
|
|
35
94
|
|
|
36
|
-
- `authorization_denied`: the approval was denied in the browser. Run `firstdraft login` again to retry.
|
|
37
|
-
|
|
38
|
-
|
|
95
|
+
- `authorization_denied`: the approval was denied in the browser. Run `firstdraft login` again to retry. After
|
|
96
|
+
`login --finish`, the person refused: ask them before starting another login with `login --no-wait`.
|
|
97
|
+
- `authorization_expired`: no loopback callback arrived within five minutes, or the device code expired before the
|
|
98
|
+
CLI received a token. Run `firstdraft login` again. Use `--interactive` if no browser on this machine can reach the printed URL.
|
|
99
|
+
After `login --finish`, start again with `login --no-wait`, which prints a new link and code.
|
|
100
|
+
- `authorization_pending`, from `login --finish`: First Draft has not confirmed an approval yet, and the CLI stopped after its
|
|
101
|
+
short wait. The link and the code still work until the time it prints; when the person says they approved, run
|
|
102
|
+
`login --finish` again.
|
|
103
|
+
- `login_not_started`, from `login --finish`: no waiting login started with `login --no-wait` exists for the
|
|
104
|
+
selected origin, or it already ended. Run `firstdraft start` to see whether this computer is logged in.
|
|
39
105
|
- `login_failed`: the login could not be completed. `reason`, when present, is the server's OAuth error code (for
|
|
40
106
|
example `invalid_grant` for a used, expired, or mismatched code), `loopback_unavailable` when the local listener
|
|
41
107
|
could not start, `credentials_invalid` / `credentials_unavailable` when the credentials file could not be read or
|
|
@@ -44,6 +110,11 @@ command's recovery instructions below. If a saved login is rejected, run `firstd
|
|
|
44
110
|
request was made; repair or remove the file and retry. With `phase: "write"`, First Draft issued a token but the
|
|
45
111
|
CLI could not save it. Revoke that new token on the selected origin's `/api-tokens` page, then repair the
|
|
46
112
|
credentials file and retry login. Any previously saved token remains unchanged when the replacement fails.
|
|
113
|
+
`device_login_invalid` or `device_login_unavailable` means the waiting device login, `device-login.json` at
|
|
114
|
+
`credentials_path`, was malformed or could not be read, written, or removed; it carries no `phase`. Remove that
|
|
115
|
+
file, then run `firstdraft start` to see whether this computer is logged in. From `login --finish`, `reason`
|
|
116
|
+
`invalid_grant` means the grant is spent and its file was removed: start again with `login --no-wait`. Any other
|
|
117
|
+
poll failure, such as a network failure or a server error, keeps the file, so `login --finish` can run again.
|
|
47
118
|
- `logout_failed`: the credentials file could not be read or updated. It carries `reason`, `credentials_path`,
|
|
48
119
|
and `phase`. With `phase: "read"`, no token was revoked or removed; repair or remove the file and retry. With
|
|
49
120
|
`phase: "write"`, local removal failed after the revocation attempt. `revoked: true` means First Draft confirmed
|
|
@@ -59,23 +130,56 @@ command's recovery instructions below. If a saved login is rejected, run `firstd
|
|
|
59
130
|
invalid. A logout whose server revocation is not confirmed still succeeds after removing the local entry. It
|
|
60
131
|
writes a note on standard error; revoke the token on `/api-tokens` if it may still be active.
|
|
61
132
|
|
|
133
|
+
## Update and limit errors
|
|
134
|
+
|
|
135
|
+
These errors replace a command's result when a First Draft response told the CLI to stop before the command
|
|
136
|
+
finished. The CLI finishes handling that response, so a push it accepted still saves its ETag, and then sends
|
|
137
|
+
nothing more. When the stopping response was the command's last, the command reports its own result instead, after
|
|
138
|
+
one `First Draft: ` line that names the required update ([update line and refusals](commands.md#update-line-and-refusals)).
|
|
139
|
+
`start` always reports the error, because a setup that must update is not ready.
|
|
140
|
+
|
|
141
|
+
- `update_required`: First Draft's `FirstDraft-Minimum-Plugin` is newer than this setup's plugin, or, when no plugin
|
|
142
|
+
version is set, its `FirstDraft-Minimum-CLI` is newer than this CLI. `plugin_version` and `minimum_plugin_version`,
|
|
143
|
+
or `minimum_cli_version`, name the versions, beside `cli_version`. Tell the person to update with the steps at `update_url` (`https://firstdraft.com/update`), then run the
|
|
144
|
+
same command again with the same options; the CLI saved the ETag of any push that First Draft accepted. When
|
|
145
|
+
`current` is present, a Compilation had already started: follow `current.compilation.id` with
|
|
146
|
+
`compilation status` instead of compiling again.
|
|
147
|
+
- `api_contract_unsupported`: First Draft serves an API contract outside `accepted_api_contract`. When `api_contract`
|
|
148
|
+
is newer, update and continue as above. When it is older, the CLI is newer than that origin's Service; use the CLI
|
|
149
|
+
that the origin supports.
|
|
150
|
+
- `rate_limited`: First Draft answered `429` because a limit was reached. The refused request did nothing.
|
|
151
|
+
`response.code`, when present, names the limit: `compilation_limit_reached` or `project_limit_reached` for the Compilations or
|
|
152
|
+
new Projects an account may start in a day, and `reports_rate_limited` for its reports in an hour.
|
|
153
|
+
`response.detail` says when the next one can start, and `retry_at`, when present, is that UTC time from
|
|
154
|
+
`Retry-After`. Wait until then and run the command again; without either, the detail says to wait a minute. `login --interactive` meets
|
|
155
|
+
a limit shared by every CLI that starts a device login at once. When `current` is present, follow that Compilation
|
|
156
|
+
as above instead.
|
|
157
|
+
|
|
158
|
+
A local failure while handling the stopping response, such as `local_state_not_saved` or `materialization_failed`,
|
|
159
|
+
is reported as itself, with its recovery data, after the stop line.
|
|
160
|
+
|
|
62
161
|
## Ambiguous mutations
|
|
63
162
|
|
|
64
|
-
`plan compile` supplies `phase: "push" | "compilation"
|
|
163
|
+
`plan compile` supplies `phase: "push" | "compilation"` when `request_outcome_unknown` requires
|
|
65
164
|
phase-specific recovery:
|
|
66
165
|
|
|
67
|
-
- `phase: "push"`
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
166
|
+
- `phase: "push"`, and `request_outcome_unknown` from `plan push`, mean the Plan may have been accepted, but the
|
|
167
|
+
response could not be verified, so local state was not changed. Run the same command once more, with the same
|
|
168
|
+
options and environment; a first push without a pinned origin otherwise goes to production. If First Draft accepts
|
|
169
|
+
it, carry on. If it answers `server_rejected` with status `412` (`precondition_failed`), its Plan is no longer the
|
|
170
|
+
one this folder last pushed: the first push may have landed, or another copy of the Project pushed. If another
|
|
171
|
+
copy holds newer work, continue from that copy. Otherwise start a new Project, which forks this one: run
|
|
172
|
+
`firstdraft plan init --name <name>` in a new folder, copy `.firstdraft/foundation-plan.json` from the old folder
|
|
173
|
+
over the new one, and push or compile from there with the same options and the old folder's origin: the `api_url`
|
|
174
|
+
in its `.firstdraft/state.json`, or, when a first push never saved one, the origin that push used. Select it with
|
|
175
|
+
`--staging` for staging, or the same `FIRSTDRAFT_API_URL` for a custom origin. A new folder has no pinned origin,
|
|
176
|
+
so without one the push goes to production. Never construct an ETag from the Plan
|
|
177
|
+
digest or edit `.firstdraft/state.json`.
|
|
178
|
+
- `phase: "compilation"` means the Compilation may have started, but its identity is unknown. The CLI never repeats that
|
|
179
|
+
`POST` itself. Run the same `plan compile` command, with the same options and environment, once more. If a Compilation
|
|
180
|
+
is still active, First Draft refuses with `compilation_active` and names it; follow
|
|
181
|
+
[stuck Compilation recovery](#stuck-compilation-recovery). Otherwise the rerun starts a new Compilation; one that the
|
|
182
|
+
first attempt may have started costs only service time and one of the day's Compilations.
|
|
79
183
|
|
|
80
184
|
If a verified Plan response cannot replace local state, preserve the printed `recovery_state`; an adjacent `.tmp`
|
|
81
185
|
file may contain the same private recovery copy. Do not push again until the accepted ETag state is repaired.
|
|
@@ -95,12 +199,12 @@ starts a new Compilation after analysis.
|
|
|
95
199
|
|
|
96
200
|
## Direct Compilation recovery
|
|
97
201
|
|
|
98
|
-
Do not
|
|
99
|
-
|
|
202
|
+
Do not rerun `plan compile` after its Compilation start was accepted: that command creates new work; it is not a
|
|
203
|
+
retained-Compilation reconciliation command.
|
|
100
204
|
|
|
101
205
|
If `request_outcome_unknown` reports `phase: "compilation"`, the start request did not yield a validated retained
|
|
102
|
-
ID. The CLI sent exactly one `POST` and did not retry it.
|
|
103
|
-
|
|
206
|
+
ID. The CLI sent exactly one `POST` and did not retry it. Rerun `plan compile` once, as
|
|
207
|
+
[ambiguous mutations](#ambiguous-mutations) describes.
|
|
104
208
|
|
|
105
209
|
Once the start response has yielded a validated retained Compilation, later status, artifact, authentication, and
|
|
106
210
|
materialization failure envelopes include that last validated projection as `current`. Preserve
|
|
@@ -143,11 +247,13 @@ replaced. `plan compile` can also meet it at the Compilation start, as `compilat
|
|
|
143
247
|
`response.detail` names the active Compilation's ID.
|
|
144
248
|
|
|
145
249
|
1. Read that Compilation once with `firstdraft compilation status <id>`. One that has reached `succeeded`, `failed`,
|
|
146
|
-
or `cancelled` no longer blocks
|
|
250
|
+
or `cancelled` no longer blocks. Rerun the original Compile command, including its approved `--revision` and
|
|
251
|
+
`--output` options when present.
|
|
147
252
|
2. If it is still `queued` or `running` well after a Compilation normally finishes, for example after a
|
|
148
253
|
`plan compile` wait timed out, cancel it with `firstdraft compilation cancel <id>`. Cancelling throws away any
|
|
149
254
|
work it is still doing.
|
|
150
|
-
3. After the cancel succeeds, rerun
|
|
255
|
+
3. After the cancel succeeds, rerun that same command. If the hosted revision has changed, obtain approval for
|
|
256
|
+
the new revision before starting another Compile.
|
|
151
257
|
|
|
152
258
|
Cancel never changes a succeeded or failed Compilation, and repeating it is safe:
|
|
153
259
|
|
|
@@ -161,61 +267,109 @@ Cancel never changes a succeeded or failed Compilation, and repeating it is safe
|
|
|
161
267
|
- `invalid_compilation_status` means the response violated the Compilation contract, so the cancellation may or may
|
|
162
268
|
not have happened. Check with `compilation status` rather than repeating the unchanged request.
|
|
163
269
|
|
|
164
|
-
##
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
270
|
+
## Report and note errors
|
|
271
|
+
|
|
272
|
+
`report progress`, `report failure`, and the `note` commands never stop an agent's work. Each reads the account first
|
|
273
|
+
and sends nothing unless it has reports on. With reports off, the command exits 0 with a line that says so; that is not
|
|
274
|
+
an error.
|
|
275
|
+
|
|
276
|
+
- `report_rejected`, `note_rejected`: First Draft refused the report or note and kept nothing. `response.code` says
|
|
277
|
+
why, for example `compilation_not_found` when the Compilation is not in this Project, `compilation_not_succeeded`
|
|
278
|
+
when it produced no code, or `invalid_report` or `invalid_note` when a field breaks its shape. Continue without it.
|
|
279
|
+
- `report_unavailable`, `note_unavailable`: a network failure, timeout, server error, or a success without First
|
|
280
|
+
Draft's `201` acknowledgment left the outcome unconfirmed, and First Draft may hold the report or note. Continue
|
|
281
|
+
without it rather than sending it again.
|
|
282
|
+
- `compilation_not_recorded`: a report, or a note about generated code, named no Compilation, and the CLI has none
|
|
283
|
+
[recorded](commands.md#record-the-compilation-whose-code-was-written) for this Project, so nothing was sent. Name the
|
|
284
|
+
Compilation the code came from: put `compilation.id` from `plan compile` right after `report progress` or
|
|
285
|
+
`report failure`, or pass it to a note with `--compilation-id`.
|
|
286
|
+
- `note_incomplete` (exit 2): a field the note needs had nothing left after shaping, so nothing was sent. `detail` names
|
|
287
|
+
each such field and why. Write the field again in plain words, or give a page or code in its shape.
|
|
288
|
+
- `account_unavailable`: `account` could not read the account. This read-only request is safe to retry.
|
|
289
|
+
`invalid_server_response` from `account` means the response broke its contract. From a report or note command,
|
|
290
|
+
either error means the account read failed, so nothing was sent; continue without it.
|
|
291
|
+
|
|
292
|
+
## Maintenance recovery
|
|
293
|
+
|
|
294
|
+
The index and `show` only read, so they are safe to retry a bounded number of times. A deferral, a question, and a
|
|
295
|
+
resolution are not. After an unconfirmed deferral or question, run `maintain` and reassess the item before sending it
|
|
296
|
+
again: a deferred item is left out of the index, and an item that reopened since is back without its deferral or
|
|
297
|
+
question. When a resolution's result is unconfirmed, it may have succeeded, and a newer error may since have reopened
|
|
298
|
+
the item; repeating it would dismiss that recurrence. Run `maintain show` and reassess the item before resolving
|
|
299
|
+
again. First Draft refuses to resolve an item that is still resolved, with `maintain_rejected` and
|
|
300
|
+
`409 item_already_resolved`.
|
|
301
|
+
|
|
302
|
+
- `maintain_rejected` means First Draft refused and nothing changed; `response.code` says why.
|
|
303
|
+
`404 environment_not_found` means this account has no Environment of that name in the Project: check
|
|
304
|
+
`--environment`, the directory, and that the environment and login match the Project's. `404 item_not_found` means
|
|
305
|
+
the Environment has no such item; take IDs from the index. `400 invalid_resolution_reason` names an unaccepted
|
|
306
|
+
reason, `400 invalid_resolution_cause` an unaccepted cause, and `400 invalid_resolution_detail` a detail over
|
|
307
|
+
1,000 characters. `400 invalid_deferral` means the `--until` time is past or more than 90 days ahead, and
|
|
308
|
+
`400 invalid_owner_question` a question over 500 characters. `409 item_already_resolved` from `defer` or
|
|
309
|
+
`ask-owner` means the item is resolved; read the index again.
|
|
310
|
+
- `maintain_unavailable` means a network failure, timeout, server error, or error response without a problem body
|
|
311
|
+
left the result unconfirmed. Retry a read. After a deferral or a question, run `maintain` and reassess the item
|
|
312
|
+
before sending it again. After a resolution, check the item with `maintain show` and reassess it before resolving
|
|
313
|
+
again. A `404` with no `response` usually means the Service at the origin the command used has no maintenance
|
|
314
|
+
routes: the pinned origin, or in a fresh clone the one `login` would select. Retrying will not help until that
|
|
315
|
+
Service is upgraded.
|
|
316
|
+
- `invalid_maintain_response` means a success response violated the contract; retrying the unchanged request will
|
|
317
|
+
not repair it. After a deferral or a question, check the index with `maintain`; after a resolution, check the
|
|
318
|
+
item with `maintain show`.
|
|
319
|
+
- The index reads the account first. When that read fails, it reads no items and ends with `account_unavailable`,
|
|
320
|
+
which is safe to retry, `invalid_server_response`, which retrying will not repair, or an error any request can give:
|
|
321
|
+
`authentication_required`, `rate_limited`, or an update refusal.
|
|
178
322
|
|
|
179
323
|
## Error index
|
|
180
324
|
|
|
181
|
-
| Commands
|
|
182
|
-
|
|
|
183
|
-
|
|
|
184
|
-
|
|
|
185
|
-
| Network commands
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
188
|
-
|
|
|
189
|
-
|
|
|
190
|
-
|
|
|
191
|
-
|
|
|
192
|
-
| `
|
|
193
|
-
|
|
|
194
|
-
| `
|
|
195
|
-
| `
|
|
196
|
-
| `plan
|
|
197
|
-
| `plan
|
|
198
|
-
|
|
|
199
|
-
| `plan
|
|
200
|
-
| `plan
|
|
201
|
-
| `plan compile`
|
|
202
|
-
|
|
|
203
|
-
| `plan compile
|
|
204
|
-
| `plan compile
|
|
205
|
-
| `
|
|
206
|
-
| `
|
|
207
|
-
| `compilation download`
|
|
208
|
-
| `compilation
|
|
209
|
-
| `compilation
|
|
210
|
-
| `compilation cancel`
|
|
211
|
-
|
|
|
212
|
-
|
|
|
213
|
-
| Download commands
|
|
325
|
+
| Commands | `error` | Exit | Meaning |
|
|
326
|
+
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | ---: | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
327
|
+
| Hosted Sketches commands and reviewed source handoff | `sketch_review_failed` | 1 | Repair the Project, capture, publication or source handoff ([recovery](#sketch-review-recovery)). |
|
|
328
|
+
| Any leaf command | `invalid_arguments` | 2 | Syntax was invalid; no request was made. |
|
|
329
|
+
| Network commands except `logout` | `update_required`, `api_contract_unsupported` | 1 | First Draft needs a newer plugin or CLI, or serves another API contract ([recovery](#update-and-limit-errors)). |
|
|
330
|
+
| Network commands except `logout` | `rate_limited` | 1 | First Draft refused a request at a limit; `retry_at` says when to try again. |
|
|
331
|
+
| `plan init` | `local_initialization_failed` | 1 | Initialization failed without overwriting an existing path. |
|
|
332
|
+
| Network commands | `invalid_configuration` | 2 | API origin or saved Head state is incompatible. |
|
|
333
|
+
| `login` | `authorization_denied`, `authorization_expired` | 1 | The approval was denied, or the callback wait or device code ended before the CLI received a token. |
|
|
334
|
+
| `login --finish` | `authorization_pending`, `login_not_started` | 1 | First Draft has not confirmed an approval yet, or no device login is waiting for the origin. |
|
|
335
|
+
| `login` | `login_failed` | 1 | Nothing was saved; `phase: "write"` means a token was issued ([recovery](#login-and-logout-errors)). |
|
|
336
|
+
| `logout` | `logout_failed` | 1 | Check `phase` and `revoked`; revocation may have happened ([recovery](#login-and-logout-errors)). |
|
|
337
|
+
| Network commands | `authentication_required` | 1 | No environment or saved token exists for the origin, or First Draft rejected it. |
|
|
338
|
+
| Plan, `compilation *`, `report`, `note`, `maintain` | `local_input_unreadable` | 1 | Required local Plan or private state, the Compilation record, or an application's `.firstdraft/gaps.json` could not be read. |
|
|
339
|
+
| Status, Compile, Compilation, `report`, `note`, `maintain` | `project_not_pushed` | 1 | The local Project has no accepted Plan recorded. |
|
|
340
|
+
| `plan push`, `plan compile` | `request_outcome_unknown` | 1 | A mutation or its response could not be verified; `plan compile` identifies its mutation phase. |
|
|
341
|
+
| `plan push`, `plan compile` | `local_state_not_saved` | 1 | The Plan was accepted but the private ETag state could not be replaced; includes `recovery_state`. |
|
|
342
|
+
| `plan push`, `plan compile` | `server_rejected` | 1 | First Draft returned validated Plan diagnostics or rejected the request with a validated problem. |
|
|
343
|
+
| `plan status` | `server_rejected` | 1 | First Draft rejected the analysis status request with a validated non-authentication problem. |
|
|
344
|
+
| `plan status` | `status_unavailable`, `invalid_server_response` | 1 | The analysis read failed or violated its protocol. |
|
|
345
|
+
| `plan compile` | `analysis_status_unavailable`, `invalid_analysis_status`, `analysis_status_rejected` | 1 | The bounded analysis read failed, was invalid, or was rejected. |
|
|
346
|
+
| Analysis waits | `analysis_changed`, `wait_timed_out`, `analysis_wait_timed_out` | 1 | The pinned analysis changed or remained processing at the deadline. |
|
|
347
|
+
| `plan compile` | `plan_not_valid` | 1 | Analysis completed without `valid`; `current` contains diagnostics and status. |
|
|
348
|
+
| `plan compile` | `local_plan_changed` | 1 | Local bytes or saved state changed after acceptance, before the selected mutation. |
|
|
349
|
+
| `plan compile` | `compilation_start_rejected`, `compilation_status_unavailable`, `invalid_compilation_status` | 1 | Direct start was rejected or retained status failed; post-start errors include `current`. |
|
|
350
|
+
| `plan compile` | `compilation_changed`, `compilation_wait_timed_out`, `compilation_failed`, `compilation_cancelled` | 1 | The pinned direct Compilation changed, timed out, failed, or was cancelled. |
|
|
351
|
+
| `compilation status`, `compilation download` | `compilation_status_unavailable`, `invalid_compilation_status` | 1 | The retained status could not be read or violated its exact contract. |
|
|
352
|
+
| `compilation status --wait` | `compilation_changed`, `compilation_wait_timed_out` | 1 | Retained identity/provenance changed or the wait ended. |
|
|
353
|
+
| `compilation download` | `compilation_not_succeeded` | 1 | Status was not `succeeded`; no artifact request was made. |
|
|
354
|
+
| `compilation cancel` | `compilation_cancel_rejected` | 1 | Nothing was cancelled; `response.code` says why ([recovery](#stuck-compilation-recovery)). |
|
|
355
|
+
| `compilation cancel` | `compilation_cancel_unavailable` | 1 | The cancellation could not be confirmed; repeating it is safe. |
|
|
356
|
+
| `compilation cancel` | `invalid_compilation_status` | 1 | The response violated the Compilation contract; check status before repeating. |
|
|
357
|
+
| Download commands | `artifact_unavailable`, `invalid_artifact` | 1 | Artifact transport or integrity validation failed; direct Compile post-start errors include `current`. |
|
|
358
|
+
| Download commands | `invalid_output_path` | 2 | The absent destination or root-adoption preconditions failed; `reason` identifies the stable refusal. |
|
|
359
|
+
| Download commands | `materialization_failed` | 1 | The output changed or its transaction failed; `reason` identifies incomplete rollback when applicable. |
|
|
360
|
+
| `account`, `start`, `maintain` | `account_unavailable`, `invalid_server_response` | 1 | The account read failed or violated its contract. |
|
|
361
|
+
| `report progress`, `report failure` | `report_rejected`, `report_unavailable`, `account_unavailable`, `invalid_server_response` | 1 | The report was refused or its outcome is unconfirmed, or the account read failed; continue without it. |
|
|
362
|
+
| `note <kind>` | `note_rejected`, `note_unavailable`, `account_unavailable`, `invalid_server_response` | 1 | The note was refused or its outcome is unconfirmed, or the account read failed; continue without it. |
|
|
363
|
+
| `report`, `note wrong_output` | `compilation_not_recorded` | 1 | No Compilation was given or recorded; nothing was sent ([recovery](#report-and-note-errors)). |
|
|
364
|
+
| `note <kind>` | `note_incomplete` | 2 | A field the note needs had nothing left after shaping; nothing was sent. |
|
|
365
|
+
| `maintain` commands | `maintain_rejected` | 1 | Refused with a validated problem; `response.code` says why ([recovery](#maintenance-recovery)). |
|
|
366
|
+
| `maintain` commands | `maintain_unavailable` | 1 | The request failed or its result is unconfirmed; retry a read, and reassess the item before any write again. |
|
|
367
|
+
| `maintain` commands | `invalid_maintain_response` | 1 | A success response violated the contract; retrying unchanged will not repair it. |
|
|
214
368
|
|
|
215
369
|
Root-output `invalid_output_path.reason` values are `destination_exists`, `root_not_real`, `root_not_writable`,
|
|
216
370
|
`root_platform_unsupported`, `root_reserved_path`, `root_entry_unsupported`, `root_enclosing_worktree`,
|
|
217
371
|
`root_git_unavailable`, `root_git_unsupported`, `root_git_dirty`, `root_ignore_not_preserved`, and `root_busy`. Git
|
|
218
372
|
refusing discovery, including a `safe.directory` refusal, is `root_git_unavailable`; a discovered but unsupported
|
|
219
373
|
Git shape such as a submodule is `root_git_unsupported`. Root-output `materialization_failed.reason` values are
|
|
220
|
-
`output_changed`, `root_artifact_collision`, `root_ignore_changed`, `root_transaction_failed`, and
|
|
374
|
+
`output_changed`, `reviewed_sources_changed`, `root_artifact_collision`, `root_ignore_changed`, `root_transaction_failed`, and
|
|
221
375
|
`root_rollback_incomplete`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firstdraft.com/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Command-line interface for First Draft",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -50,5 +50,11 @@
|
|
|
50
50
|
"globals": "17.8.0",
|
|
51
51
|
"prettier": "3.9.6",
|
|
52
52
|
"typescript": "7.0.2"
|
|
53
|
+
},
|
|
54
|
+
"overrides": {
|
|
55
|
+
"minimatch": "^11.0.5"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"playwright-core": "1.65.1"
|
|
53
59
|
}
|
|
54
60
|
}
|