diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b0b242..739937d 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.2 - `firstdraft sketches publish` now uploads the working Plan, screen HTML and declared assets. The Project diff --git a/docs/commands.md b/docs/commands.md index 48ca3c6..b09923e 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. The CLI accepts service API 0.10.x. Fresh live screen publication requires API 0.10.2 or a later patch on that 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 @@ -74,7 +74,7 @@ List the Plan development-record UUIDs shown on a screen in `sample_keys` and re working Plan into an element's text when the service renders the screen. Keep readable fallback text for directly opening the HTML. Use an optional stable element key such as `data-sketch-key="nominee-arrival"` for feedback across revisions. -API contract 0.10.2 introduced live screen publication. Before uploading source, the CLI checks for +Before uploading source for live screen publication, the CLI checks for `FirstDraft-Screen-Source-Files: 1` on the service’s review theme response. Run `firstdraft sketches publish` to send the exact Plan, declared screen HTML and declared assets to the Project. Use distinct paths relative to `sketches/` for each screen and asset. Assets may be CSS, PNG, JPEG, WebP, SVG or @@ -408,7 +408,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. @@ -725,9 +725,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 @@ -1081,7 +1082,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 CLI accepts API contract `0.10.0` or a later patch on the same minor line. A fresh `sketches publish` also checks the live screen capability introduced in API contract `0.10.2`. `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 b161550..39077cc 100644 --- a/docs/errors.md +++ b/docs/errors.md @@ -21,7 +21,7 @@ remain human-readable text on standard error with exit 2. Unexpected programming ## Screen review recovery -If the service does not advertise live screen files, update it to API 0.10.2 or a later patch on that API line. The CLI +If the service does not advertise live screen files, update it to API 0.11.0 or a later patch on that API line. The CLI stops before uploading a new board. A pending publication replays its saved request. `sketch_review_failed` describes a Project-start, publication or reviewed-source problem. Retry an interrupted @@ -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 736da7e..1a96253 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@firstdraft.com/cli", - "version": "0.12.2", + "version": "0.13.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@firstdraft.com/cli", - "version": "0.12.2", + "version": "0.13.0", "license": "MIT", "dependencies": { "jsonc-parser": "3.3.1" @@ -662,9 +662,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.1.2.tgz", + "integrity": "sha512-8BPK2r+sKWC8sDinRwLwrFMq2lXTBBwzYYEB9LiCznfMurOi4FOvQflq3XOLGG+HPdMSVpe+k/s96+AtDEOgPg==", "dev": true, "license": "MIT", "dependencies": { @@ -1085,9 +1085,9 @@ } }, "node_modules/minimatch": { - "version": "11.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.5.tgz", - "integrity": "sha512-snPlVppFcYWfLLFQGhDxUyBcHNtMlWmn3jtj7pEaO+DP8pqL0IvAzXhMYmn1z9ASNtgmwLBdFxSf4tMUB0OTKA==", + "version": "11.0.10", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.10.tgz", + "integrity": "sha512-L3/cjhQ5E6lft0VCp/2mO3Ic74RnutKy3rz7iGwp/6w1hKcO262g2rbfacFyw6eBig5OdI0nu5PpuA0/WQs9Tw==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { diff --git a/package.json b/package.json index d4b0e39..1104c02 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@firstdraft.com/cli", - "version": "0.12.2", + "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 c3f9fae..559407f 100644 --- a/release/compatibility.json +++ b/release/compatibility.json @@ -1,9 +1,9 @@ { "format": "firstdraft.release-compatibility/1", "component": "cli", - "version": "0.12.2", + "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/review-theme.js b/src/review-theme.js index 1303021..3bd0093 100644 --- a/src/review-theme.js +++ b/src/review-theme.js @@ -63,7 +63,7 @@ export async function publicationTheme( get.headers.get("FirstDraft-Screen-Source-Files") !== "1") ) throw new SketchError( - "Update the First Draft service to API 0.10.2 or a later 0.10.x version that supports live screen files, then publish again.", + "Update the First Draft service to API 0.11.0 or a later 0.11.x version that supports live screen files, then publish again.", ); if (get.status !== 200) throw new SketchError( 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 f590870..bf293f2 100644 --- a/test/sketches.test.js +++ b/test/sketches.test.js @@ -16,6 +16,7 @@ import { reviewedSources, } from "../src/commands/sketches.js"; import { digest, loadSources } from "../src/sketch-sources.js"; +import { FOUNDATION_PLAN_FORMAT } from "../src/compilation-artifact.js"; import { initializePlan } from "../src/commands/plan-init.js"; import { prepareRootOutput, releaseRootOutput } from "../src/root-output.js"; import { pushPlan } from "../src/commands/plan-push.js"; @@ -557,6 +558,7 @@ test("a selected theme reaches the Plan and the replayed revision", async (t) => preset, ); assert(body.plan_source.includes(sample)); + assert.equal(JSON.parse(body.plan_source).format, FOUNDATION_PLAN_FORMAT); assert.deepEqual( JSON.parse(body.plan_source).application.appearance.web_theme, { ...preset, overrides }, 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, }, },