diff --git a/CHANGELOG.md b/CHANGELOG.md index b2d96ea..cd35bd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,15 @@ 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.13.0 + +- `plan init` writes Plan `firstdraft.foundation-plan.sketch/0.25`, which supports the email and slug Fields. + Compile and download validate artifacts for that exact format. The CLI requires service API contract 0.11.0 or a + later patch on that minor line. Use CLI 0.12.x for API 0.10.x and Plan 0.24. +- To start a new Compile from an older Plan, republish it in Plan 0.25 in the same Project and approve the updated + Plan. Published screen reviews still open with their original Plan bytes, and `compilation status` can read + earlier terminal Compilations retained by the service. + ## 0.12.1 - Run `firstdraft sketches publish` in a hosted interview or in a Project that already has a pushed Plan. diff --git a/docs/commands.md b/docs/commands.md index 8265d11..3a16ca5 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.12.x` source line contains the auditable command shell, the agent's `start` check, browser and device +The CLI contains the auditable command shell, the agent's `start` check, browser and device login in one command or in two steps that an agent runs, local Foundation Plan initialization, hosted Project creation and screen review, local application-key and UUID generation, conditional whole-document push, whole-graph analysis status polling, direct Compile-and-materialize, retained-Compilation inspection and cancellation, the account's report setting, progress and failure reports, notes, and maintenance-item listing, -inspection, resolution, deferral, and owner questions. It requires API contract `0.10.0` or a later patch on the same minor line. The [changelog](https://github.com/firstdraft/cli/blob/main/CHANGELOG.md) describes each version. +inspection, resolution, deferral, and owner questions. It requires API contract `0.11.0` or a later patch on the same minor line. 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 @@ -414,7 +414,7 @@ From the project that the Plan describes: firstdraft plan init --name "Oscar Party" ``` -This creates an empty `firstdraft.foundation-plan.sketch/0.24` Plan targeting `rails-sketch/2026-11`. In a fresh +This creates an empty `firstdraft.foundation-plan.sketch/0.25` Plan targeting `rails-sketch/2026-11`. In a fresh folder it creates the Project ID and an ignored `.firstdraft/` directory. In a folder reserved by `project start`, it writes the Plan for the existing Project ID and origin. Initialization runs locally and preserves any existing Plan. @@ -731,9 +731,10 @@ when a retained direct Compilation succeeded but an earlier root materialization never starts replacement work. An incomplete rollback leaves `.firstdraft-root-output` and requires journal reconciliation before this command can run again. -Artifact validation accepts only Plan format `firstdraft.foundation-plan.sketch/0.24` and target profile +Artifact validation accepts only Plan format `firstdraft.foundation-plan.sketch/0.25` and target profile `rails-sketch/2026-11`, in addition to matching the retained Compilation's provenance and verifying file integrity. -An earlier format or profile is rejected before materialization, even when the retained status names that profile. +Use `compilation status` to read earlier terminal Compilations the service retains. A download whose artifact +uses an earlier format or profile is rejected before materialization, even when its status is `succeeded`. Successful root adoption is intentionally one-way. The original `.firstdraft` authoring state moves under `.firstdraft/design/.firstdraft`; run later Plan and Compilation commands from `.firstdraft/design`. Run ordinary @@ -1089,7 +1090,7 @@ The first push sends `If-None-Match: *`. Later pushes and the Compilation start `If-Match`. The cancel `POST` sends no precondition header. The resolution, deferral, and owner-question `POST`s send a JSON body and no precondition header. -The `/v1` routes require API contract `0.10.0` or a later patch on the same minor line. `API_CONTRACT_RANGE` in `src/service-client.js` declares that range, +The `/v1` routes require API contract `0.11.0` or a later patch on the same minor line. `API_CONTRACT_RANGE` in `src/service-client.js` declares that range, `release/compatibility.json` declares it for the Service's release compatibility check, and `test/release-compatibility.test.js` keeps the two equal. The CLI reads `FirstDraft-API-Contract` on every response and stops at a Service outside the range, as [update line and refusals](#update-line-and-refusals) describes: with diff --git a/docs/errors.md b/docs/errors.md index 4b7ca7a..5ba241b 100644 --- a/docs/errors.md +++ b/docs/errors.md @@ -260,6 +260,10 @@ format. Update the local Plan to the format named in `response.detail`. Republis check the new analysis and obtain approval for the updated Plan before compiling. For a screen review, use the new revision ID. A previously published screen review still opens with its original Plan. +If `compilation download` encounters an artifact in an earlier Plan format, it reports `invalid_artifact`. +`compilation status` can still show the retained result. To create an artifact in the current format, republish +the Plan and approve a new Compile as above. + A Project allows one active Compilation. While one is queued or running, `plan push` and `plan compile` report `server_rejected` with First Draft's `409 compilation_active` problem in `response`, because the Plan cannot be replaced. `plan compile` can also meet it at the Compilation start, as `compilation_start_rejected`. Either problem's diff --git a/package-lock.json b/package-lock.json index 1fcd18d..edbd5c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@firstdraft.com/cli", - "version": "0.12.1", + "version": "0.13.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@firstdraft.com/cli", - "version": "0.12.1", + "version": "0.13.0", "license": "MIT", "dependencies": { "jsonc-parser": "3.3.1", diff --git a/package.json b/package.json index 32104fb..1d7151e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@firstdraft.com/cli", - "version": "0.12.1", + "version": "0.13.0", "description": "Command-line interface for First Draft", "license": "MIT", "type": "module", diff --git a/release/compatibility.json b/release/compatibility.json index 4a39882..559407f 100644 --- a/release/compatibility.json +++ b/release/compatibility.json @@ -1,9 +1,9 @@ { "format": "firstdraft.release-compatibility/1", "component": "cli", - "version": "0.12.1", + "version": "0.13.0", "requires": { - "api_contract": [">= 0.10.0", "< 0.11.0"], - "foundation_plan_formats": ["firstdraft.foundation-plan.sketch/0.24"] + "api_contract": [">= 0.11.0", "< 0.12.0"], + "foundation_plan_formats": ["firstdraft.foundation-plan.sketch/0.25"] } } diff --git a/src/compilation-artifact.js b/src/compilation-artifact.js index 5c2812d..d8bf675 100644 --- a/src/compilation-artifact.js +++ b/src/compilation-artifact.js @@ -27,7 +27,7 @@ import { export const ARTIFACT_MEDIA_TYPE = "application/vnd.firstdraft.compilation-artifact+json"; export const ARTIFACT_FORMAT = "firstdraft.compilation-artifact/1"; -export const FOUNDATION_PLAN_FORMAT = "firstdraft.foundation-plan.sketch/0.24"; +export const FOUNDATION_PLAN_FORMAT = "firstdraft.foundation-plan.sketch/0.25"; // 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 the profile of this release. diff --git a/src/service-client.js b/src/service-client.js index fb38bb4..025b105 100644 --- a/src/service-client.js +++ b/src/service-client.js @@ -15,7 +15,7 @@ export const UPDATE_URL = "https://firstdraft.com/update"; * declares the same range for the release check, and * test/release-compatibility.test.js keeps the two equal. */ -export const API_CONTRACT_RANGE = Object.freeze([">= 0.10.0", "< 0.11.0"]); +export const API_CONTRACT_RANGE = Object.freeze([">= 0.11.0", "< 0.12.0"]); /** Set by the plugin's launcher; docs/commands.md names them for wrappers. */ export const PLUGIN_VERSION_VARIABLE = "FIRSTDRAFT_PLUGIN_VERSION"; @@ -424,7 +424,7 @@ const API_CONTRACT_FLOOR = /** @type {Version} */ ( /** * As in npm ranges, a prerelease contract is outside a range whose bounds - * name none, so `0.10.0-rc.1` is refused like `0.10.0`. + * name none. For example, `0.11.2-rc.1` is refused even though `0.11.2` is accepted. * * @param {Version} contract */ diff --git a/test/compilation-artifact.test.js b/test/compilation-artifact.test.js index bd6b1d4..c234623 100644 --- a/test/compilation-artifact.test.js +++ b/test/compilation-artifact.test.js @@ -263,7 +263,7 @@ test("pins external provenance identities and validates nested metadata", () => artifactFixture({ provenance: { foundation_plan: { - format: "firstdraft.foundation-plan.sketch/0.22", + format: "firstdraft.foundation-plan.sketch/0.24", sha256: FOUNDATION_PLAN_SHA256, }, }, diff --git a/test/compilation.test.js b/test/compilation.test.js index 8e0c2db..7163f5a 100644 --- a/test/compilation.test.js +++ b/test/compilation.test.js @@ -41,7 +41,7 @@ const ARTIFACT_PATH = `${STATUS_PATH}/artifact`; test("direct Compilation pins the reviewed Plan and materializes one retained artifact", async (context) => { const planSource = Buffer.from( - '{"format":"firstdraft.foundation-plan.sketch/0.24"}\n', + '{"format":"firstdraft.foundation-plan.sketch/0.25"}\n', ); const headSourceSha256 = sha256(planSource); const etag = `"sha256:${headSourceSha256}"`; diff --git a/test/plan-compile.test.js b/test/plan-compile.test.js index ab7033c..a404128 100644 --- a/test/plan-compile.test.js +++ b/test/plan-compile.test.js @@ -29,7 +29,7 @@ const STALE_ANALYSIS_ID = "01900000-0000-7000-8000-000000002005"; const COMPILATION_ID = "01900000-0000-7000-8000-000000002003"; const API_TOKEN = `fd_${"a".repeat(43)}`; const PLAN_SOURCE = Buffer.from( - '{"format":"firstdraft.foundation-plan.sketch/0.24","application":{"key":"movie_catalog","name":"Movie Catalog"}}\n', + '{"format":"firstdraft.foundation-plan.sketch/0.25","application":{"key":"movie_catalog","name":"Movie Catalog"}}\n', ); const HEAD_SHA256 = sha256(PLAN_SOURCE); const ETAG = `"sha256:${HEAD_SHA256}"`; @@ -1121,7 +1121,7 @@ function acceptedPlanBody(graphVersion = 1) { return { project: { id: PROJECT_ID, graph_version: graphVersion }, foundation_plan: { - format: "firstdraft.foundation-plan.sketch/0.24", + format: "firstdraft.foundation-plan.sketch/0.25", source_sha256: HEAD_SHA256, }, diagnostics: [], diff --git a/test/plan-push.test.js b/test/plan-push.test.js index 60b494d..09afc47 100644 --- a/test/plan-push.test.js +++ b/test/plan-push.test.js @@ -1302,7 +1302,7 @@ function acceptedBody(source, diagnostics = []) { return { project: { id: PROJECT_ID, graph_version: 1 }, foundation_plan: { - format: "firstdraft.foundation-plan.sketch/0.24", + format: "firstdraft.foundation-plan.sketch/0.25", source_sha256: sha256(source), }, diagnostics, diff --git a/test/service-client.test.js b/test/service-client.test.js index d174b59..5fd3d81 100644 --- a/test/service-client.test.js +++ b/test/service-client.test.js @@ -293,15 +293,15 @@ test("a stop that did not cut the command short keeps its result and names the s }); test("the CLI accepts only its declared API contract range", async () => { - assert.deepEqual(API_CONTRACT_RANGE, [">= 0.10.0", "< 0.11.0"]); + assert.deepEqual(API_CONTRACT_RANGE, [">= 0.11.0", "< 0.12.0"]); for (const contract of [ - "0.10.0", - "0.10.7", - " 0.10.0 ", - "0.10.2+build.7", + "0.11.0", + "0.11.7", + " 0.11.0 ", + "0.11.2+build.7", "unknown", - "0.10", + "0.11", ]) { const session = createServiceSession({ env: {}, @@ -315,15 +315,15 @@ test("the CLI accepts only its declared API contract range", async () => { } for (const [contract, kind] of /** @type {[string, string][]} */ ([ - ["0.11.0", "newer"], - ["0.11.0+build.7", "newer"], - ["0.11.0-rc.1", "newer"], + ["0.12.0", "newer"], + ["0.12.0+build.7", "newer"], + ["0.12.0-rc.1", "newer"], ["1.0.0", "newer"], ["0.8.1", "older"], ["0.9.0-rc.1", "older"], - ["0.9.1", "older"], - ["0.10.0-rc.1", "older"], - ["0.10.2-rc.1", "prerelease"], + ["0.10.0", "older"], + ["0.11.0-rc.1", "older"], + ["0.11.2-rc.1", "prerelease"], ])) { const session = createServiceSession({ env: {}, notify: () => undefined }); const request = session.fetch(async () => versionedResponse({ contract })); @@ -407,7 +407,7 @@ test("a 429 without Retry-After or a problem says to wait a minute", async () => test("a 429 reports the limit even when the response also requires an update", async () => { for (const headers of [ { "FirstDraft-Minimum-CLI": "99.0.0" }, - { "FirstDraft-API-Contract": "0.10.0" }, + { "FirstDraft-API-Contract": "0.12.0" }, ]) { const session = createServiceSession({ env: {}, @@ -433,7 +433,7 @@ test("a 429 reports the limit even when the response also requires an update", a test("the stop line for an older or prerelease contract does not advise updating", async () => { for (const [contract, sentence] of /** @type {[string, string][]} */ ([ ["0.8.7", "serves API contract 0.8.7, which is older than"], - ["0.10.2-rc.1", "serves prerelease API contract 0.10.2-rc.1, which"], + ["0.11.2-rc.1", "serves prerelease API contract 0.11.2-rc.1, which"], ])) { /** @type {string[]} */ const lines = []; @@ -650,15 +650,15 @@ test("a Service outside the API contract range is refused with both versions", a const cwd = await initializedProject(context); const result = await invoke(["plan", "compile", "--output", "application"], { cwd, - fetchFunction: async () => acceptedPush(cwd, { contract: "0.11.0" }), + fetchFunction: async () => acceptedPush(cwd, { contract: "0.12.0" }), }); assert.equal(result.status, 1); assert.deepEqual(errorEnvelope(result.stderr), { error: "api_contract_unsupported", - detail: `First Draft at ${ORIGIN} serves API contract 0.11.0, which is newer than CLI ${VERSION} accepts. The CLI stopped before the command finished and sent nothing more. Tell the person to update with the steps at ${UPDATE_URL}, then run the same command again, with the same options.`, - api_contract: "0.11.0", - accepted_api_contract: [">= 0.10.0", "< 0.11.0"], + detail: `First Draft at ${ORIGIN} serves API contract 0.12.0, which is newer than CLI ${VERSION} accepts. The CLI stopped before the command finished and sent nothing more. Tell the person to update with the steps at ${UPDATE_URL}, then run the same command again, with the same options.`, + api_contract: "0.12.0", + accepted_api_contract: [">= 0.11.0", "< 0.12.0"], cli_version: VERSION, update_url: UPDATE_URL, }); @@ -765,7 +765,7 @@ function acceptedPush(cwd, versions) { JSON.stringify({ project: { id: PROJECT_ID, graph_version: 1 }, foundation_plan: { - format: "firstdraft.foundation-plan.sketch/0.24", + format: "firstdraft.foundation-plan.sketch/0.25", source_sha256: createHash("sha256").update(source).digest("hex"), }, diagnostics: [], diff --git a/test/sketches.test.js b/test/sketches.test.js index b72982f..7669136 100644 --- a/test/sketches.test.js +++ b/test/sketches.test.js @@ -11,6 +11,7 @@ import { import path from "node:path"; import { tmpdir } from "node:os"; import test from "node:test"; +import { FOUNDATION_PLAN_FORMAT } from "../src/compilation-artifact.js"; import { startProject, publishSketches as publishWithTheme, @@ -1308,10 +1309,11 @@ test( acceptedSource = plan_source; const sha = digest(plan_source); assert.equal(manifest.plan_sha256, sha); - assert.deepEqual( - JSON.parse(plan_source).application.appearance.web_theme, - { overrides: selected }, - ); + const publishedPlan = JSON.parse(plan_source); + assert.equal(publishedPlan.format, FOUNDATION_PLAN_FORMAT); + assert.deepEqual(publishedPlan.application.appearance.web_theme, { + overrides: selected, + }); assert.equal(manifest.version, 3); for (const [device, width] of Object.entries({ desktop: 1280, diff --git a/test/start.test.js b/test/start.test.js index ddb88c0..9c4046a 100644 --- a/test/start.test.js +++ b/test/start.test.js @@ -296,7 +296,7 @@ test("below the minimum, start gives the handled refusal instead of ready", asyn }); test("an API contract outside the accepted range is not ready", async (context) => { - for (const contract of ["0.9.1", "0.11.0"]) { + for (const contract of ["0.10.0", "0.12.0"]) { const result = await invoke(context, ["start"], { saved: { [PRODUCTION]: SAVED_TOKEN }, fetchFunction: async () => @@ -433,7 +433,7 @@ test("a version refusal wins over a failed account read", async (context) => { status: 200, headers: { "Content-Type": "application/json", - "FirstDraft-API-Contract": "0.11.0", + "FirstDraft-API-Contract": "0.12.0", }, }), "api_contract_unsupported", @@ -516,7 +516,7 @@ function account(reports, headers = {}) { status: 200, headers: { "Content-Type": "application/json", - "FirstDraft-API-Contract": "0.10.0", + "FirstDraft-API-Contract": "0.11.0", ...headers, }, },