diff --git a/CHANGELOG.md b/CHANGELOG.md index 703f56b..ed63413 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,71 @@ 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. 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`, 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. 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 + 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, 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, + 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). 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 + 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`. 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. + ## 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"] 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;