@firstdraft.com/cli 0.1.0 → 0.2.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/docs/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # First Draft CLI documentation
2
+
3
+ Use this page to find the narrowest authoritative document for a task. Runtime source and tests remain the final
4
+ evidence for implemented behavior; if they contradict a document, surface the contradiction instead of guessing.
5
+
6
+ | If the task concerns... | Read first |
7
+ | -------------------------------------------------------------------------------------- | --------------------------------------------- |
8
+ | Public installation, trust, or the shortest current journey | [Root README](../README.md) |
9
+ | Commands, options, environment variables, API behavior, output, or materialization | [Command reference](commands.md) |
10
+ | Stable errors, exit codes, retry safety, ambiguous outcomes, or local recovery | [Errors and recovery](errors.md) |
11
+ | Version policy, release preparation, publication, verification, rollback, or promotion | [Release policy and runbook](../RELEASING.md) |
12
+ | What was observed for an earlier tag, package, or dist-tag | [Release history](release-history.md) |
13
+ | Vulnerability reporting | [Security policy](../SECURITY.md) |
14
+
15
+ ## Authority boundaries
16
+
17
+ - [README.md](../README.md) owns public onboarding, the shortest supported journey, current trust claims, and routes.
18
+ - [commands.md](commands.md) owns detailed command semantics. Built-in `--help`, runtime source, and tests own exact
19
+ executable syntax and behavior.
20
+ - [errors.md](errors.md) owns handled-error interpretation and recovery guidance.
21
+ - [RELEASING.md](../RELEASING.md) owns living release policy and the operator runbook.
22
+ - [release-history.md](release-history.md) preserves dated release observations. Recheck live tags, package versions,
23
+ dist-tags, access, and trusted-publisher state before relying on them operationally.
24
+ - The source repository's `AGENTS.md` routes agent work; it should stay compact rather than duplicate these documents.
25
+
26
+ ## Retrieval quality
27
+
28
+ Start here, then load the one owning document for the task. Follow a cross-link only when the task crosses an
29
+ authority boundary, such as moving from successful command behavior to failure recovery. Prefer descriptive
30
+ headings, short paragraphs, command maps, and checklists; create another page only when it has a distinct audience,
31
+ task, or authority.
32
+
33
+ The documentation tests keep `AGENTS.md` at or below 2 KiB, the root README at or below 6 KiB, and this map at or
34
+ below 4 KiB. They also require every public topic to remain reachable from this map or the root README and verify
35
+ repository-local links and fragments. The package check separately verifies that every relative link in the
36
+ packaged Markdown resolves inside that exact package.
37
+
38
+ ## Work on the repository
39
+
40
+ Development uses Node.js 24.18.0 and npm 11.16.0, pinned in `.tool-versions`. From a fresh checkout:
41
+
42
+ ```sh
43
+ npm ci --ignore-scripts
44
+ npm audit
45
+ npm run check
46
+ ```
47
+
48
+ `npm run check` runs type checking, linting, formatting, tests, the exact package allowlist check, and a packed-package
49
+ smoke test. To inspect the package manifest without writing a tarball:
50
+
51
+ ```sh
52
+ npm pack --dry-run --json --ignore-scripts
53
+ ```
54
+
55
+ To reproduce the length-delimited SHA-256 used by external evidence to identify packaged JavaScript runtime inputs
56
+ (`package.json`, `bin/firstdraft.js`, and every `.js` file under `src/`), run:
57
+
58
+ ```sh
59
+ node scripts/runtime-digest.js
60
+ ```
@@ -0,0 +1,220 @@
1
+ # First Draft CLI command reference
2
+
3
+ This page owns the detailed public semantics of the current command surface. Run `firstdraft --help` or a command
4
+ group's `--help` for concise executable syntax. See [Errors and recovery](errors.md) before retrying a failed mutation.
5
+
6
+ The current `0.2.x` source line contains the auditable command shell, local Foundation Plan initialization, local
7
+ application-key and UUID generation, conditional whole-document push, whole-graph analysis status polling,
8
+ compile-and-publish orchestration, and read-only retained-Compilation download. CLI `0.2.x` requires the service's
9
+ `0.3.x` API contract. See the [release policy](../RELEASING.md) for versioning and channel semantics and
10
+ [release history](release-history.md) for the transition from prereleases.
11
+
12
+ ## Command map
13
+
14
+ | Command | Network | Purpose |
15
+ | ------------------------------------- | ------- | ---------------------------------------------------------- |
16
+ | `firstdraft plan init` | No | Create an empty local Foundation Plan and Project identity |
17
+ | `firstdraft generate application-key` | No | Preview deterministic name-to-key derivation |
18
+ | `firstdraft generate uuid` | No | Generate one or more Foundation Plan subject identities |
19
+ | `firstdraft plan push` | Yes | Conditionally submit the exact whole Plan |
20
+ | `firstdraft plan status` | Yes | Read or wait for the current whole-graph analysis |
21
+ | `firstdraft plan compile` | Yes | Push, analyze, compile, and publish the current Plan |
22
+ | `firstdraft compilation status` | Yes | Inspect a retained Compilation by ID |
23
+ | `firstdraft compilation download` | Yes | Verify and materialize a successful retained Compilation |
24
+
25
+ ## Authenticate API commands
26
+
27
+ Create an API token in First Draft and provide it only through the environment when running a network command:
28
+
29
+ ```sh
30
+ export FIRSTDRAFT_API_TOKEN="your-token"
31
+ firstdraft plan push
32
+ ```
33
+
34
+ `plan push`, `plan status`, `plan compile`, and `compilation` subcommands send the token as a Bearer credential on
35
+ every API request. The CLI does not save it in `.firstdraft`, print it, or require it for local commands such as
36
+ `plan init` and `generate`. Revoke the token in First Draft if it is exposed. A missing token, or First Draft's
37
+ validated `401` problem response with the `authentication_required` code, produces that stable CLI error.
38
+
39
+ ## Start a Foundation Plan
40
+
41
+ From the project that the Plan describes:
42
+
43
+ ```sh
44
+ firstdraft plan init --name "Oscar Party"
45
+ ```
46
+
47
+ This creates an empty `sketch/0.19` Plan and client-generated Project ID under `.firstdraft/`. A nested ignore file
48
+ keeps that local scratch area out of Git without changing the project's own `.gitignore`. Initialization makes no
49
+ network request and refuses to replace an existing `.firstdraft` path.
50
+
51
+ Provide either `--name`, `--application-key`, or both. Name-only initialization derives a lower-snake key. Key-only
52
+ initialization derives a humanized display name. Supplying both preserves both values exactly after validating them
53
+ against the Foundation Plan schema.
54
+
55
+ ### Generate an application key
56
+
57
+ To inspect the name-to-key derivation without initializing a project, run:
58
+
59
+ ```sh
60
+ firstdraft generate application-key --name "Oscar Party"
61
+ ```
62
+
63
+ The generated key is deterministic, starts with a letter, contains only lowercase ASCII letters, digits, and
64
+ underscores, and is at most 63 bytes so it can lower to the current iOS application identifier component. Names
65
+ without a readable ASCII form receive a stable digest-based key. Longer readable names are shortened to a readable
66
+ prefix plus a stable digest suffix. Explicit application keys retain the Foundation Plan's broader
67
+ `^[a-z][a-z0-9_]*$` boundary and are left for target analysis rather than silently rewritten.
68
+
69
+ ### Generate Foundation Plan subject identities
70
+
71
+ Generate an identity before adding each new independently mutable authored subject:
72
+
73
+ ```sh
74
+ firstdraft generate uuid
75
+ ```
76
+
77
+ The command prints one UUIDv7 for the subject's `subject_uuid`. It does not read or modify the Plan, reserve the
78
+ value, or make a network request. Preserve that UUID when renaming the subject or moving it to a different semantic
79
+ owner without changing its kind. Use a new UUID for a replacement concept. Readable keys and paths may change and
80
+ remain the document's links; the UUID preserves continuity between complete-document pushes.
81
+
82
+ Use `--count <n>` to print several independently generated UUIDv7 values, one per line.
83
+
84
+ ## Push a Foundation Plan
85
+
86
+ From the initialized project:
87
+
88
+ ```sh
89
+ firstdraft plan push
90
+ ```
91
+
92
+ The command sends the exact bytes in `.firstdraft/foundation-plan.json`. The first push conditionally creates the
93
+ Project; later pushes replay the complete ETag saved in `.firstdraft/state.json` so a stale writer cannot replace a
94
+ newer Plan. Successful responses and server diagnostics are printed as JSON for an agent to inspect.
95
+
96
+ The initial API origin defaults to `https://firstdraft.com`. Set `FIRSTDRAFT_API_URL` to use another HTTPS origin or
97
+ a loopback HTTP development server. The first successful push pins the normalized origin in local state, and a later
98
+ override must match it.
99
+
100
+ If a failure happens after sending the request, the CLI leaves local state unchanged. It never constructs an ETag
101
+ from the Plan digest or trusts an ETag from a response it could not fully verify. Follow
102
+ [ambiguous-mutation recovery](errors.md#ambiguous-mutations) rather than blindly retrying.
103
+
104
+ ## Read analysis status
105
+
106
+ After a successful push:
107
+
108
+ ```sh
109
+ firstdraft plan status
110
+ firstdraft plan status --wait
111
+ ```
112
+
113
+ Without `--wait`, the command makes one `GET` and prints the current analysis as one JSON object. With `--wait`, it
114
+ polls sequentially once per second for at most two minutes and stops at `valid`, `issues_found`, `analysis_failed`,
115
+ or `superseded`. Every validated analysis status is a successful read with exit 0; agents should branch on the
116
+ `analysis.status` value and inspect `analysis.diagnostics` rather than treating a completed analysis with issues as
117
+ a transport failure.
118
+
119
+ The projection includes the exact Head digest, Analyzer and Compiler releases, selected target, and
120
+ `analysis.gap_set` plus `analysis.gap_set_sha256`. A `valid` run always returns the complete parsed canonical
121
+ `firstdraft.foundation-gaps/2` object, including every ordered gap record and an empty `gaps` array when nothing is
122
+ missing. Both GapSet fields are `null` for every other status. The CLI validates the GapSet's Head, Project,
123
+ generation, releases, target, canonical digest, and complete record shapes, then prints the records without
124
+ truncating or rewriting them.
125
+
126
+ Status reads require the API origin pinned by a successful push. They never select an origin from the current
127
+ environment, expose the private ETag, follow redirects, or modify local state. Each request has a bounded timeout,
128
+ ordinary response reads retain a 2 MiB bound, while this potentially gap-heavy response has a dedicated 128 MiB
129
+ bound. Every response is fully validated, and polling will not silently switch to a replacement analysis. The wait
130
+ repeats only validated `processing` responses and stops on its first failed read. A network failure is safe to retry
131
+ a bounded number of times because the command sends only `GET` requests. See
132
+ [read-only failures](errors.md#read-only-status-failures) if the problem persists.
133
+
134
+ ## Compile and publish the current Plan
135
+
136
+ When the candidate is ready, run:
137
+
138
+ ```sh
139
+ firstdraft plan compile
140
+ ```
141
+
142
+ `plan compile` is the single terminal action. It first pushes the exact current bytes in
143
+ `.firstdraft/foundation-plan.json`, even when those bytes are unchanged, and saves the accepted ETag using the same
144
+ contract as `plan push`. It then waits up to two minutes for an analysis whose graph version and
145
+ `head_source_sha256` exactly match that accepted push, polling past a terminal result retained for an older Head.
146
+ Invalid JSON, schema diagnostics, semantic diagnostics, a failed analysis, a superseded analysis, or a recurring
147
+ diagnostic stop the command with structured output; no Compilation or Publication is requested.
148
+
149
+ Only a `valid` analysis proceeds to the internal GitHub Publication lifecycle. Invoking `plan compile` is the
150
+ authorization to request that lifecycle. Immediately before its conditional mutation, the CLI re-reads the local
151
+ Plan and requires its exact bytes to match the accepted Head, so bytes changed after analysis cannot be published.
152
+ It extracts the accepted source SHA-256 from the saved ETag, hashes the current local bytes, and sends that complete
153
+ ETag in `If-Match`.
154
+
155
+ The command writes stable human-readable progress to stderr, with every line prefixed by `First Draft:`. It reports
156
+ analysis, compilation completion or terminal failure or cancellation, the current GitHub phase, and an allowlisted
157
+ reason, retry count, and exact UTC retry time when a GitHub preflight check is delayed. A retained retry with no next
158
+ time is reported as paused and requiring operator recovery. Progress never includes IDs, hashes, repository names or
159
+ URLs, raw server projections, local paths, or environment values. Success writes exactly the validated private
160
+ GitHub repository URL plus a newline to stdout. If the command fails after progress has begun, its structured JSON
161
+ error envelope is the final stderr document after the progress lines.
162
+
163
+ The closed API `0.3.x` progress-reason allowlist is `github.configuration_missing`, `github.oauth_unavailable`,
164
+ `github.api_unavailable`, `github.reauthorization_required`, `github.account_mismatch`,
165
+ `github.installation_unavailable`, `github.installation_not_ready`, `github.preflight_unavailable`, the legacy-only
166
+ `github.preflight_unclassified`, and these stage-specific fallbacks: `github.preflight_unavailable.configuration`,
167
+ `github.preflight_unavailable.authorization`, `github.preflight_unavailable.repository_client`,
168
+ `github.preflight_unavailable.artifact_preparation`, `github.preflight_unavailable.installation_token`,
169
+ `github.preflight_unavailable.publication_preparation`, and `github.preflight_unavailable.repository_ref_client`.
170
+ Other values make the response invalid rather than becoming terminal output.
171
+
172
+ The internal Publication is a Project singleton in this release. A repeat safely receives the same Publication
173
+ instead of creating another. If the first conditional `PUT` has an ambiguous result, the CLI reconciles it with one
174
+ read-only singleton `GET` and never automatically repeats the mutation within that invocation. Publication polling
175
+ is sequential, bounded to ten minutes, and pinned to the retained Project Head, Compilation input, Publication
176
+ identity, and repository identity. Do not run concurrent Compile commands; use the
177
+ [publication recovery procedure](errors.md#publication-recovery) after an invocation exits.
178
+
179
+ This release cannot repoint a Project's Publication to a later accepted Head. The public CLI therefore has no
180
+ `plan publish` command and no local-start `plan compile --output` mode. It retains lower-level Compilation commands
181
+ for operational callers that acquire an ID separately, but they are intentionally not a continuation of the
182
+ URL-only `plan compile` journey.
183
+
184
+ ## Inspect a retained Compilation
185
+
186
+ These lower-level commands are for callers that already hold a retained Compilation ID from authenticated API
187
+ metadata or operational tooling; `plan compile` prints only the final repository URL:
188
+
189
+ ```sh
190
+ firstdraft compilation status 01900000-0000-7000-8000-000000000001
191
+ firstdraft compilation status 01900000-0000-7000-8000-000000000001 --wait
192
+ ```
193
+
194
+ Without `--wait`, the command makes exactly one metadata-only `GET`. With `--wait`, it polls that same Compilation
195
+ sequentially for at most ten minutes and rejects changes to its identity, Head provenance, target, or lifecycle
196
+ progression. `failed` and `cancelled` are successfully read terminal states with exit 0; branch on
197
+ `compilation.status` and inspect its validated `failure`.
198
+
199
+ ## Download a retained Compilation
200
+
201
+ Materialize an already successful Compilation into an absent path:
202
+
203
+ ```sh
204
+ firstdraft compilation download 01900000-0000-7000-8000-000000000001 --output ../movie-catalog
205
+ ```
206
+
207
+ The command validates the UUID and output path before network access, makes one status `GET`, requires `succeeded`,
208
+ and makes one artifact `GET`. It never starts work or polls. Historical artifact validation uses the retained
209
+ `compilation.head_source_sha256`, not the current local Plan or ETag, to pin the artifact's exact
210
+ `head_source_sha256`. The artifact's canonical `foundation_plan.sha256` may differ because it identifies the
211
+ normalized Compiler input. It is validated as a SHA-256 digest inside the exact artifact bytes authenticated by the
212
+ status response's `artifact.sha256`; it is not equated to the submitted Head digest.
213
+
214
+ Before materialization, the CLI verifies the artifact media type, declared and actual byte sizes, strong digest
215
+ ETag, exact-byte SHA-256, canonical UTF-8 JSON envelope, provenance, metadata-only manifest digest, portable paths,
216
+ strict Base64 contents, file digests, modes, owners, and source-subject UUIDs. It writes only into a uniquely created
217
+ sibling directory, verifies the complete tree, and atomically renames it into the still-absent destination. On
218
+ POSIX, directories use mode `0755` and files use artifact-declared `0644` or `0755`; Windows verifies structure,
219
+ contents, and digests without claiming POSIX mode bits. The declared and streamed artifact envelope is bounded at
220
+ 128 MiB.
package/docs/errors.md ADDED
@@ -0,0 +1,87 @@
1
+ # First Draft CLI errors and recovery
2
+
3
+ This page owns handled-error interpretation, retry safety, and recovery guidance. Read the
4
+ [command reference](commands.md) for successful command behavior.
5
+
6
+ ## Handled output contract
7
+
8
+ Every handled subcommand failure ends with exactly one JSON object on standard error. `plan compile` may first write
9
+ progress lines; machine consumers can remove only lines beginning with the exact `First Draft: ` prefix and parse the
10
+ remaining JSON document. Branch on the stable `error` value rather than the human-readable `detail`.
11
+
12
+ Handled output never includes command arguments, local Plan bytes, raw artifact bytes, raw filesystem or network
13
+ errors, or unvalidated response bodies. `local_state_not_saved` is the sole exception to private-state redaction:
14
+ its `recovery_state` is required to repair the accepted ETag locally. Root-level and command-group usage failures
15
+ remain human-readable text on standard error with exit 2. Unexpected programming defects remain loud.
16
+
17
+ ## Ambiguous mutations
18
+
19
+ `plan compile` supplies `phase: "push" | "publication"` when `request_outcome_unknown` requires phase-specific
20
+ recovery:
21
+
22
+ - `phase: "push"` means the Plan mutation may have been accepted. Stop and reconcile local Head state. Until First
23
+ Draft has a Foundation Plan Head reconciliation endpoint, an accepted request whose response cannot be verified
24
+ may require manual recovery. Do not construct an ETag from the Plan digest or trust an unverified response.
25
+ - `phase: "publication"` means the singleton Publication mutation was not resolved. Do not run concurrent Compile
26
+ commands. After the prior invocation exits, wait and rerun `plan compile` with unchanged Plan bytes to safely
27
+ reconcile or resume the retained singleton.
28
+
29
+ `plan push` also reports `request_outcome_unknown` if a failure happens after sending its request. Local state remains
30
+ unchanged. Stop and reconcile rather than assuming the request failed and repeating the mutation.
31
+
32
+ If a verified Plan response cannot replace local state, preserve the printed `recovery_state`; an adjacent `.tmp`
33
+ file may contain the same private recovery copy. Do not push again until the accepted ETag state is repaired.
34
+
35
+ ## Read-only status failures
36
+
37
+ A network failure from `plan status` is safe to retry a bounded number of times because the command sends only
38
+ `GET` requests. If `status_unavailable` persists, inspect the API origin pinned in `.firstdraft/state.json`.
39
+ `invalid_server_response` instead means the response violated the CLI/server contract; retrying the unchanged read
40
+ will not repair it.
41
+
42
+ The lower-level `compilation status` command is also read-only. `compilation_status_unavailable` is safe to retry;
43
+ `invalid_compilation_status` requires contract reconciliation. A wait stops rather than following a changed
44
+ analysis or Compilation identity.
45
+
46
+ ## Publication recovery
47
+
48
+ The Publication is a Project singleton. If its initial conditional `PUT` is ambiguous, the CLI attempts one
49
+ read-only singleton `GET` and never automatically repeats the mutation in that invocation.
50
+
51
+ After `publication_status_unavailable` or `publication_wait_timed_out`, retained work may still continue. Do not run
52
+ concurrent Compile commands. Wait, then rerun `plan compile` with unchanged Plan bytes; the conditional request
53
+ safely reconciles or resumes the same retained singleton without creating another Compilation, repository, or push.
54
+ The same recovery applies when an invocation exits after an unresolved Publication start.
55
+
56
+ A GitHub preflight retry with no `retry_at` is paused and requires operator recovery. `publication_failed` and
57
+ `publication_cancelled` are terminal; inspect the validated phase and failure information rather than blindly
58
+ retrying. `publication_changed` means the pinned Publication identity or provenance changed, so the CLI deliberately
59
+ stopped without following the replacement.
60
+
61
+ ## Error index
62
+
63
+ | Commands | `error` | Exit | Meaning |
64
+ | -------------------------------------------- | -------------------------------------------------------------------------------------------------- | ---: | -------------------------------------------------------------------------------------------------------------- |
65
+ | Any leaf command | `invalid_arguments` | 2 | Syntax was invalid; no request was made. |
66
+ | `plan init` | `local_initialization_failed` | 1 | Initialization failed without overwriting an existing path. |
67
+ | `plan push`, `plan compile` | `invalid_configuration` | 2 | API origin or saved Head state is incompatible. |
68
+ | Network commands | `authentication_required` | 1 | The token is missing or First Draft returned a validated authentication problem. |
69
+ | Plan commands, `compilation *` | `local_input_unreadable` | 1 | Required local Plan or private state could not be read. |
70
+ | Status, Compile, Compilation commands | `project_not_pushed` | 1 | No API origin is pinned for the local Project. |
71
+ | `plan push`, `plan compile` | `request_outcome_unknown` | 1 | A mutation or its response could not be verified; `plan compile` identifies its `push` or `publication` phase. |
72
+ | `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`. |
73
+ | `plan push`, `plan compile` | `server_rejected` | 1 | First Draft returned validated Plan diagnostics or rejected the request with a validated problem. |
74
+ | `plan status` | `server_rejected` | 1 | First Draft rejected the analysis status request with a validated non-authentication problem. |
75
+ | `plan status` | `status_unavailable`, `invalid_server_response` | 1 | The analysis read failed or violated its protocol. |
76
+ | `plan compile` | `analysis_status_unavailable`, `invalid_analysis_status`, `analysis_status_rejected` | 1 | The bounded analysis read failed, was invalid, or was rejected. |
77
+ | Analysis waits | `analysis_changed`, `wait_timed_out`, `analysis_wait_timed_out` | 1 | The pinned analysis changed or remained processing at the deadline. |
78
+ | `plan compile` | `plan_not_valid` | 1 | Analysis completed without `valid`; `current` contains diagnostics and status. |
79
+ | `plan compile` | `local_plan_changed` | 1 | Local bytes changed after acceptance or analysis, before Publication mutation. |
80
+ | `plan compile` | `publication_start_rejected`, `publication_status_unavailable`, `invalid_publication_status` | 1 | Publication start or status failed its validated transport contract. |
81
+ | `plan compile` | `publication_changed`, `publication_wait_timed_out`, `publication_failed`, `publication_cancelled` | 1 | The pinned Publication changed, timed out, or reached a non-success terminal state. |
82
+ | `compilation status`, `compilation download` | `compilation_status_unavailable`, `invalid_compilation_status` | 1 | The retained status could not be read or violated its exact contract. |
83
+ | `compilation status --wait` | `compilation_changed`, `compilation_wait_timed_out` | 1 | Retained identity/provenance changed or the wait ended. |
84
+ | `compilation download` | `compilation_not_succeeded` | 1 | Status was not `succeeded`; no artifact request was made. |
85
+ | `compilation download` | `artifact_unavailable`, `invalid_artifact` | 1 | Artifact transport or integrity validation failed before materialization. |
86
+ | `compilation download` | `invalid_output_path` | 2 | The destination was not an absent path beneath an existing real directory. |
87
+ | `compilation download` | `materialization_failed` | 1 | The output raced or the verified tree could not be atomically installed. |
@@ -0,0 +1,32 @@
1
+ # First Draft CLI release history
2
+
3
+ This page preserves dated release and registry observations. It is historical evidence, not a statement of current
4
+ npm, GitHub, service, or qualification state. Before acting, recheck the registry, protected tags, exact source SHA,
5
+ compatibility declarations, trusted-publisher relationship, and named release-specific qualification by following
6
+ the living [release policy and runbook](../RELEASING.md).
7
+
8
+ ## 0.1.0 alpha publications
9
+
10
+ - On July 31, 2026, npm rejected the unscoped `firstdraft` name for `v0.1.0-alpha.1` as too similar to the existing
11
+ `first-draft` package before creating a registry package. The tag records the first reviewed release candidate and
12
+ is immutable; neither its tag nor version may be moved or reused.
13
+ - On August 5, 2026, `v0.1.0-alpha.2` became the first organization-scoped publication,
14
+ `@firstdraft.com/cli@0.1.0-alpha.2`.
15
+ - As observed earlier on August 7, 2026, `0.1.0-alpha.2` was the only published scoped version and both npm's `next`
16
+ and `latest` dist-tags identified it.
17
+
18
+ ## 0.1.0 ordinary release and promotion
19
+
20
+ - Later on August 7, 2026, protected tag `v0.1.0` published ordinary version `0.1.0` under `next`, while `latest`
21
+ continued to identify `0.1.0-alpha.2`. The ordinary release intentionally superseded the alpha and required the
22
+ service's `0.2.x` API contract; the historical prerelease did not define an ordinary compatibility line.
23
+ - The first ordinary release established the npm trusted-publisher relationship used by the release workflow.
24
+ - On August 12, 2026, the selected bounded CLI `0.1.0` user-journey smoke passed and separate promotion approval was
25
+ granted. `latest` was promoted to `0.1.0`; both `next` and `latest` then identified ordinary version `0.1.0`. Full
26
+ v14 service qualification remained separate and incomplete.
27
+ - Requiring two-factor authentication while disallowing tokens at the package publishing-access layer was not a
28
+ `v0.1.0` release prerequisite and was not established by that release evidence.
29
+
30
+ The alpha versions remain immutable registry history but, as of the August 12 observation, neither distribution
31
+ channel selected them. Protected tag `v0.1.0` and package version `0.1.0` were consumed and immutable. Preparing
32
+ source or documentation does not mutate either dist-tag.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firstdraft.com/cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Command-line interface for First Draft",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,7 +9,10 @@
9
9
  },
10
10
  "files": [
11
11
  "bin",
12
- "src"
12
+ "docs",
13
+ "src",
14
+ "RELEASING.md",
15
+ "SECURITY.md"
13
16
  ],
14
17
  "engines": {
15
18
  "node": ">=22.0.0"
@@ -36,9 +36,9 @@ export async function sendRequest(fetchFunction, endpoint, request) {
36
36
  }
37
37
  }
38
38
 
39
- /** @param {Response} response */
40
- export async function readResponseBody(response) {
41
- const bytes = await readResponseBytes(response);
39
+ /** @param {Response} response @param {number} [maximumBytes] */
40
+ export async function readResponseBody(response, maximumBytes) {
41
+ const bytes = await readResponseBytes(response, maximumBytes);
42
42
 
43
43
  let text;
44
44
  try {
@@ -105,6 +105,9 @@ export async function compilePlan({
105
105
  const acceptedGraphVersion = /** @type {{graph_version: number}} */ (
106
106
  pushed.body.project
107
107
  ).graph_version;
108
+ const acceptedHeadSourceSha256 = /** @type {{source_sha256: string}} */ (
109
+ pushed.body.foundation_plan
110
+ ).source_sha256;
108
111
 
109
112
  let status;
110
113
  onProgress({ phase: "analysis", status: "waiting" });
@@ -133,7 +136,8 @@ export async function compilePlan({
133
136
  }
134
137
  if (
135
138
  status.body.project.graph_version !== acceptedGraphVersion ||
136
- status.body.analysis.graph_version !== acceptedGraphVersion
139
+ status.body.analysis.graph_version !== acceptedGraphVersion ||
140
+ status.body.analysis.head_source_sha256 !== acceptedHeadSourceSha256
137
141
  ) {
138
142
  throw new PlanStatusChangedError(status.body);
139
143
  }