From 4ffc329ff2e01dbce0ee7ce17c0611f630c8c155 Mon Sep 17 00:00:00 2001 From: Raghu Betina Date: Sat, 21 Nov 2026 08:27:54 -0600 Subject: [PATCH 1/5] Set version 0.10.0 and write its changelog entry The report commands, the version headers, and the rails-sketch/2026-11 profile are on main but unpublished, and the next plugin bundles this CLI. Before 1.0.0 a breaking change raises MINOR, and this one breaks 0.9.0 callers twice: it accepts only API 0.9.x and only artifacts for the new profile. The version script moved package.json, package-lock.json, and release/compatibility.json together. The command reference drops the sentence written for the unversioned development line. --- CHANGELOG.md | 56 ++++++++++++++++++++++++++++++++++++++ docs/commands.md | 12 ++++---- package-lock.json | 4 +-- package.json | 2 +- release/compatibility.json | 2 +- 5 files changed, 66 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 703f56b..67bcda7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,62 @@ carry no release status. The `v` tag and npm show whether a version is Entries start with the first version prepared after this file was added, and earlier versions have none. The repository's [tags](https://github.com/firstdraft/cli/tags) identify the source of each published version. +## 0.10.0 + +Lets First Draft tell a setup that it is out of date, and adds the account and report commands, so a person working +alone hears when to update and their agent can send the progress and failure reports the person agreed to. Moves the +Rails target to profile `rails-sketch/2026-11` and the accepted API contract to `0.9.x`. + +- `plan init` writes Plans that target `rails-sketch/2026-11`. `plan compile` and `compilation download` accept only + artifacts for that profile; an artifact for `rails-sketch/2026-10` reports `invalid_artifact`. The CLI sends a + Plan's bytes unchanged and does not check the Plan's target profile. +- The accepted API-contract range is `>= 0.9.0` and `< 0.10.0`. The CLI now reads `FirstDraft-API-Contract` on each + response, and a contract outside that range, including a prerelease, stops it as described below. +- Every request, to `/v1` and to `/oauth`, carries + `FirstDraft-Client: cli/; plugin/; agent/; os/`. `plugin` and `agent` come from + `FIRSTDRAFT_PLUGIN_VERSION` and `FIRSTDRAFT_AGENT`, and `os` from Node.js's `process.platform`; a part that is unset + or is not a plain version or name is left out. `login` no longer sends the computer's hostname. +- The CLI compares First Draft's version headers with this setup: `FirstDraft-Latest-Plugin` and + `FirstDraft-Minimum-Plugin` with `FIRSTDRAFT_PLUGIN_VERSION` when that is set, otherwise `FirstDraft-Latest-CLI` and + `FirstDraft-Minimum-CLI` with the CLI's own version. A pair counts only when both of its versions are readable. A + setup older than the latest gets one `First Draft: an update is available (...)` line on standard error, just before + the command's result, pointing to `https://firstdraft.com/update`. When `FIRSTDRAFT_PLUGIN_VERSION` is set but is not + a version, neither pair is compared; when First Draft names the plugin versions, the line says the CLI could not + tell whether the setup is current. +- When the setup is older than the minimum, or the contract is outside the range, the CLI finishes handling that + response and sends no further request. If that cut the command short, the command fails with `update_required` or + `api_contract_unsupported`, and `current`, when present, names a Compilation that had already started. Otherwise + the command keeps its result after one `First Draft: ... This command finished; ... before the next one.` line. A + stop never replaces the result of `logout`. +- A `429` on any command except `logout`, `login` included, fails with `rate_limited`. It carries `status` 429, + `retry_at` from `Retry-After` when that is readable, and First Draft's problem in `response` when it sent a valid + one. Its detail says to try again after `retry_at`, when `response.detail` says, or in a minute. +- `firstdraft account` prints `{"reports": "on"}` or `{"reports": "off"}` for the signed-in account, at the origin + that `login` would select. +- `firstdraft report progress` and `firstdraft report failure` first read the account at the Project's pinned origin, + and send no report unless it has reports on. With reports off, they print a line that says so and exit 0. With + reports on, they print the exact JSON report, send it once, and print `Sent.` only on First Draft's `201` + acknowledgment; a `403 reports_off` answer to the report prints the reports-off line and exits 0. `--step` is + `setup`, `specs_first_run`, `behavior_written`, `specs_passing`, or `preview_started`, with optional counts of at + most 1000000. `--kind` is `spec_failure`, `setup_failure`, `boot_error`, or `lint_failure`. A failure report keeps + each field only in its shape: an RSpec run of the application's specs, a Ruby constant, up to 20 application frames + sent as `path:LINE`, version numbers, and the plain words of the first line of the message (at most 300 characters) + and fix summary (at most 200). A `Left out:` line names what it dropped. Both commands find the Project from the + generated application's root after root adoption, or from the Project's directory. +- After an ambiguous push or Compile, `request_outcome_unknown` now says to run the same command once more with the + same options, and what a `412` or `compilation_active` answer then means, instead of telling the caller to stop. +- New `error` values, each with exit status 1: `update_required`, `api_contract_unsupported`, `rate_limited`, + `account_unavailable`, `report_rejected`, and `report_unavailable`. `account` and the report commands also report + `authentication_required` and `invalid_server_response` (exit status 1) and `invalid_arguments` and + `invalid_configuration` (exit status 2). The report commands also report `local_input_unreadable` and + `project_not_pushed` (exit status 1). + +Use CLI 0.10.0 with a Service that serves API `0.9.x`. With an origin that serves API `0.8.x`, it sends nothing after +the first response and says to use the CLI version that origin supports. A plugin's launcher should set +`FIRSTDRAFT_PLUGIN_VERSION` and `FIRSTDRAFT_AGENT`; without the first, the CLI compares its own version with the CLI +versions. Callers that parse standard error should drop the `First Draft: ` lines, which any network command may now +write before its result. + ## 0.9.0 Moves the Rails target to profile `rails-sketch/2026-10`. First Draft adopts Rails 8.1.4 under that new profile ID and diff --git a/docs/commands.md b/docs/commands.md index 5d1badd..bdfa881 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -3,12 +3,12 @@ This page owns the detailed public semantics of the current command surface. Run `firstdraft --help` or a command group's `--help` for concise executable syntax. See [Errors and recovery](errors.md) before retrying a failed mutation. -The current `0.9.x` source line contains the auditable command shell, browser and device login, local Foundation Plan initialization, local -application-key and UUID generation, conditional whole-document push, whole-graph analysis status polling, direct -Compile-and-materialize and private publish orchestration, retained-Compilation inspection and cancellation, the -account's report setting, and progress and failure reports. This development version requires -the service's `0.9.x` API contract; the release that carries it names its own version in the changelog. The [changelog](https://github.com/firstdraft/cli/blob/main/CHANGELOG.md) describes -each version. [What the CLI sends](#what-the-cli-sends) lists every request and what it carries. +The current `0.10.x` source line contains the auditable command shell, browser and device login, local Foundation Plan +initialization, local application-key and UUID generation, conditional whole-document push, whole-graph analysis +status polling, direct Compile-and-materialize and private publish orchestration, retained-Compilation inspection and +cancellation, the account's report setting, and progress and failure reports. It requires the service's `0.9.x` API +contract. The [changelog](https://github.com/firstdraft/cli/blob/main/CHANGELOG.md) describes each version. +[What the CLI sends](#what-the-cli-sends) lists every request and what it carries. ## Command map diff --git a/package-lock.json b/package-lock.json index 74dee13..64f3300 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@firstdraft.com/cli", - "version": "0.9.0", + "version": "0.10.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@firstdraft.com/cli", - "version": "0.9.0", + "version": "0.10.0", "license": "MIT", "bin": { "firstdraft": "bin/firstdraft.js" diff --git a/package.json b/package.json index d6871c9..757f11d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@firstdraft.com/cli", - "version": "0.9.0", + "version": "0.10.0", "description": "Command-line interface for First Draft", "license": "MIT", "type": "module", diff --git a/release/compatibility.json b/release/compatibility.json index b9a90d6..2002cc7 100644 --- a/release/compatibility.json +++ b/release/compatibility.json @@ -1,7 +1,7 @@ { "format": "firstdraft.release-compatibility/1", "component": "cli", - "version": "0.9.0", + "version": "0.10.0", "requires": { "api_contract": [">= 0.9.0", "< 0.10.0"], "foundation_plan_formats": ["firstdraft.foundation-plan.sketch/0.23"] From 504ff5600845acf0a0da2dec010552a3fcc19770 Mon Sep 17 00:00:00 2001 From: Raghu Betina Date: Sat, 21 Nov 2026 08:32:16 -0600 Subject: [PATCH 2/5] Qualify the 0.10.0 entry where the code does Several sentences promised more than the code does: the retry after an ambiguous outcome needs the same environment as well as the same options and does not cover an unconfirmed Publication, a contract stop needs a non-429 response that names the contract, a version or contract stop takes the place of the update line, and a stop on the account read keeps a report from being printed or sent. The header, the 429 problem, and the Left out line now state their limits. --- CHANGELOG.md | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67bcda7..7149c51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,18 +19,20 @@ Rails target to profile `rails-sketch/2026-11` and the accepted API contract to artifacts for that profile; an artifact for `rails-sketch/2026-10` reports `invalid_artifact`. The CLI sends a Plan's bytes unchanged and does not check the Plan's target profile. - The accepted API-contract range is `>= 0.9.0` and `< 0.10.0`. The CLI now reads `FirstDraft-API-Contract` on each - response, and a contract outside that range, including a prerelease, stops it as described below. + response. A response other than a `429` that names a contract outside that range, including a prerelease, stops it + as described below; a response without the header does not. - Every request, to `/v1` and to `/oauth`, carries `FirstDraft-Client: cli/; plugin/; agent/; os/`. `plugin` and `agent` come from - `FIRSTDRAFT_PLUGIN_VERSION` and `FIRSTDRAFT_AGENT`, and `os` from Node.js's `process.platform`; a part that is unset - or is not a plain version or name is left out. `login` no longer sends the computer's hostname. + `FIRSTDRAFT_PLUGIN_VERSION`, sent without build metadata, and `FIRSTDRAFT_AGENT`, lowercased, and `os` from Node.js's + `process.platform`. A part that is unset, longer than 40 characters, or not a plain version or name is left out. + `login` no longer sends the computer's hostname. - The CLI compares First Draft's version headers with this setup: `FirstDraft-Latest-Plugin` and `FirstDraft-Minimum-Plugin` with `FIRSTDRAFT_PLUGIN_VERSION` when that is set, otherwise `FirstDraft-Latest-CLI` and `FirstDraft-Minimum-CLI` with the CLI's own version. A pair counts only when both of its versions are readable. A setup older than the latest gets one `First Draft: an update is available (...)` line on standard error, just before the command's result, pointing to `https://firstdraft.com/update`. When `FIRSTDRAFT_PLUGIN_VERSION` is set but is not a version, neither pair is compared; when First Draft names the plugin versions, the line says the CLI could not - tell whether the setup is current. + tell whether the setup is current. A version or contract stop takes the place of either line. - When the setup is older than the minimum, or the contract is outside the range, the CLI finishes handling that response and sends no further request. If that cut the command short, the command fails with `update_required` or `api_contract_unsupported`, and `current`, when present, names a Compilation that had already started. Otherwise @@ -38,29 +40,33 @@ Rails target to profile `rails-sketch/2026-11` and the accepted API contract to stop never replaces the result of `logout`. - A `429` on any command except `logout`, `login` included, fails with `rate_limited`. It carries `status` 429, `retry_at` from `Retry-After` when that is readable, and First Draft's problem in `response` when it sent a valid - one. Its detail says to try again after `retry_at`, when `response.detail` says, or in a minute. + one of at most 64 KiB. Its detail says to try again after `retry_at`, when `response.detail` says, or in a minute. - `firstdraft account` prints `{"reports": "on"}` or `{"reports": "off"}` for the signed-in account, at the origin that `login` would select. - `firstdraft report progress` and `firstdraft report failure` first read the account at the Project's pinned origin, and send no report unless it has reports on. With reports off, they print a line that says so and exit 0. With - reports on, they print the exact JSON report, send it once, and print `Sent.` only on First Draft's `201` + reports on, unless the account response stopped the CLI, they print the exact JSON report, send it once, and print + `Sent.` only on First Draft's `201` acknowledgment; a `403 reports_off` answer to the report prints the reports-off line and exits 0. `--step` is `setup`, `specs_first_run`, `behavior_written`, `specs_passing`, or `preview_started`, with optional counts of at most 1000000. `--kind` is `spec_failure`, `setup_failure`, `boot_error`, or `lint_failure`. A failure report keeps each field only in its shape: an RSpec run of the application's specs, a Ruby constant, up to 20 application frames sent as `path:LINE`, version numbers, and the plain words of the first line of the message (at most 300 characters) - and fix summary (at most 200). A `Left out:` line names what it dropped. Both commands find the Project from the + and fix summary (at most 200). A `Left out:` line names each field and frame left out; the printed JSON is exactly + what is sent. Both commands find the Project from the generated application's root after root adoption, or from the Project's directory. -- After an ambiguous push or Compile, `request_outcome_unknown` now says to run the same command once more with the - same options, and what a `412` or `compilation_active` answer then means, instead of telling the caller to stop. +- After an ambiguous push, from `plan push` or `plan compile`, or an ambiguous direct Compilation start, + `request_outcome_unknown` now says to run the same command once more with the same options and environment, and + what a `412` or `compilation_active` answer then means, instead of telling the caller to stop. The recovery for an + unconfirmed Publication under `plan compile --github` is unchanged. - New `error` values, each with exit status 1: `update_required`, `api_contract_unsupported`, `rate_limited`, `account_unavailable`, `report_rejected`, and `report_unavailable`. `account` and the report commands also report `authentication_required` and `invalid_server_response` (exit status 1) and `invalid_arguments` and `invalid_configuration` (exit status 2). The report commands also report `local_input_unreadable` and `project_not_pushed` (exit status 1). -Use CLI 0.10.0 with a Service that serves API `0.9.x`. With an origin that serves API `0.8.x`, it sends nothing after -the first response and says to use the CLI version that origin supports. A plugin's launcher should set +Use CLI 0.10.0 with a Service that serves API `0.9.x`. Once a response from an origin names API `0.8.x`, the CLI sends +nothing more and says to use the CLI version that origin supports. A plugin's launcher should set `FIRSTDRAFT_PLUGIN_VERSION` and `FIRSTDRAFT_AGENT`; without the first, the CLI compares its own version with the CLI versions. Callers that parse standard error should drop the `First Draft: ` lines, which any network command may now write before its result. From 73f93e76935c024d4b73d287c7c40cfda888bd1d Mon Sep 17 00:00:00 2001 From: Raghu Betina Date: Sat, 21 Nov 2026 08:34:25 -0600 Subject: [PATCH 3/5] Rewrap the report bullet of the 0.10.0 entry The last edit left two short lines in the middle of the bullet; the words are unchanged. --- CHANGELOG.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7149c51..bf3cb7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,15 +46,14 @@ Rails target to profile `rails-sketch/2026-11` and the accepted API contract to - `firstdraft report progress` and `firstdraft report failure` first read the account at the Project's pinned origin, and send no report unless it has reports on. With reports off, they print a line that says so and exit 0. With reports on, unless the account response stopped the CLI, they print the exact JSON report, send it once, and print - `Sent.` only on First Draft's `201` - acknowledgment; a `403 reports_off` answer to the report prints the reports-off line and exits 0. `--step` is - `setup`, `specs_first_run`, `behavior_written`, `specs_passing`, or `preview_started`, with optional counts of at - most 1000000. `--kind` is `spec_failure`, `setup_failure`, `boot_error`, or `lint_failure`. A failure report keeps - each field only in its shape: an RSpec run of the application's specs, a Ruby constant, up to 20 application frames - sent as `path:LINE`, version numbers, and the plain words of the first line of the message (at most 300 characters) - and fix summary (at most 200). A `Left out:` line names each field and frame left out; the printed JSON is exactly - what is sent. Both commands find the Project from the - generated application's root after root adoption, or from the Project's directory. + `Sent.` only on First Draft's `201` acknowledgment; a `403 reports_off` answer to the report prints the reports-off + line and exits 0. `--step` is `setup`, `specs_first_run`, `behavior_written`, `specs_passing`, or + `preview_started`, with optional counts of at most 1000000. `--kind` is `spec_failure`, `setup_failure`, + `boot_error`, or `lint_failure`. A failure report keeps each field only in its shape: an RSpec run of the + application's specs, a Ruby constant, up to 20 application frames sent as `path:LINE`, version numbers, and the plain + words of the first line of the message (at most 300 characters) and fix summary (at most 200). A `Left out:` line + names each field and frame left out; the printed JSON is exactly what is sent. Both commands find the Project from + the generated application's root after root adoption, or from the Project's directory. - After an ambiguous push, from `plan push` or `plan compile`, or an ambiguous direct Compilation start, `request_outcome_unknown` now says to run the same command once more with the same options and environment, and what a `412` or `compilation_active` answer then means, instead of telling the caller to stop. The recovery for an From 2cd5c02ec661fa0ede43da58e7063da240af5d37 Mon Sep 17 00:00:00 2001 From: Raghu Betina Date: Sat, 21 Nov 2026 08:37:34 -0600 Subject: [PATCH 4/5] Name rails-sketch/2026-11 as the release profile The comment above RAILS_TARGET_PROFILE still called the value a working ID, but 0.10.0 ships it as the profile of this release. --- src/compilation-artifact.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compilation-artifact.js b/src/compilation-artifact.js index 64a5445..478c5ce 100644 --- a/src/compilation-artifact.js +++ b/src/compilation-artifact.js @@ -29,8 +29,7 @@ export const ARTIFACT_FORMAT = "firstdraft.compilation-artifact/1"; export const FOUNDATION_PLAN_FORMAT = "firstdraft.foundation-plan.sketch/0.23"; // The one place the CLI names the Rails target profile: plan init writes it, // artifact validation accepts only it, and the documentation test requires -// the docs to name only it. The value is a working ID until the release names -// the profile. +// the docs to name only it. The value is the profile of this release. export const RAILS_TARGET_PROFILE = "rails-sketch/2026-11"; export const MAX_ARTIFACT_BYTES = 128 * 1024 * 1024; From a73bb1203882231ba234ff671a82ecaefd2ccb3a Mon Sep 17 00:00:00 2001 From: Raghu Betina Date: Sat, 21 Nov 2026 08:52:08 -0600 Subject: [PATCH 5/5] Correct two sentences of the 0.10.0 entry A `Left out:` line names the fields left out but only counts frames, so a frame's path is never printed, and it appears only when something was left out. A 429 that arrives after a Compilation started also carries `current`, and its detail says to follow that Compilation; the entry named `current` only for the two stops. --- CHANGELOG.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf3cb7a..ed63413 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,8 +39,10 @@ Rails target to profile `rails-sketch/2026-11` and the accepted API contract to the command keeps its result after one `First Draft: ... This command finished; ... before the next one.` line. A stop never replaces the result of `logout`. - A `429` on any command except `logout`, `login` included, fails with `rate_limited`. It carries `status` 429, - `retry_at` from `Retry-After` when that is readable, and First Draft's problem in `response` when it sent a valid - one of at most 64 KiB. Its detail says to try again after `retry_at`, when `response.detail` says, or in a minute. + `retry_at` from `Retry-After` when that is readable, First Draft's problem in `response` when it sent a valid one + of at most 64 KiB, and `current` when a Compilation had already started. Its detail says to try again after + `retry_at`, when `response.detail` says, or in a minute. When `current` is present, the detail says to follow that + Compilation with `compilation status` instead of compiling again. - `firstdraft account` prints `{"reports": "on"}` or `{"reports": "off"}` for the signed-in account, at the origin that `login` would select. - `firstdraft report progress` and `firstdraft report failure` first read the account at the Project's pinned origin, @@ -51,9 +53,11 @@ Rails target to profile `rails-sketch/2026-11` and the accepted API contract to `preview_started`, with optional counts of at most 1000000. `--kind` is `spec_failure`, `setup_failure`, `boot_error`, or `lint_failure`. A failure report keeps each field only in its shape: an RSpec run of the application's specs, a Ruby constant, up to 20 application frames sent as `path:LINE`, version numbers, and the plain - words of the first line of the message (at most 300 characters) and fix summary (at most 200). A `Left out:` line - names each field and frame left out; the printed JSON is exactly what is sent. Both commands find the Project from - the generated application's root after root adoption, or from the Project's directory. + words of the first line of the message (at most 300 characters) and fix summary (at most 200). When anything is + left out, a `Left out:` line names each field left out, counts the frames that are not in the application's files + with a line number, and says when frames after the first 20 were dropped; the printed JSON is exactly what is + sent. Both commands find the Project from the generated application's root after root adoption, or from the + Project's directory. - After an ambiguous push, from `plan push` or `plan compile`, or an ambiguous direct Compilation start, `request_outcome_unknown` now says to run the same command once more with the same options and environment, and what a `412` or `compilation_active` answer then means, instead of telling the caller to stop. The recovery for an