Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,71 @@ carry no release status. The `v<version>` 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/<version>; plugin/<version>; agent/<name>; os/<platform>`. `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
Expand Down
12 changes: 6 additions & 6 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion release/compatibility.json
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
3 changes: 1 addition & 2 deletions src/compilation-artifact.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading