@firstdraft.com/cli 0.3.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -9
- package/RELEASING.md +93 -204
- package/SECURITY.md +2 -4
- package/docs/README.md +17 -10
- package/docs/commands.md +32 -19
- package/docs/errors.md +10 -10
- package/docs/release-history.md +16 -0
- package/package.json +2 -2
- package/src/cli.js +21 -19
- package/src/commands/plan-compile.js +3 -3
- package/src/compilation-artifact.js +1 -1
package/README.md
CHANGED
|
@@ -4,9 +4,13 @@ firstdraft is the command-line client shared by First Draft agents and automatio
|
|
|
4
4
|
files, calls the versioned Service API, exposes reviewed analysis and GapSets, materializes verified Compilations,
|
|
5
5
|
and coordinates private GitHub publication.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
Start with the [local development guide](https://gist.github.com/raghubetina/3d424a97a1eaa6de8c406e67f32a237e):
|
|
8
|
+
install the CLI and Skill, then compile into your current folder with `firstdraft plan compile --output .`. No Drawing Board
|
|
9
|
+
clone or GitHub push is required. The [Drawing Board guide](https://github.com/firstdraft/drawing-board#build-an-app-with-first-draft)
|
|
10
|
+
is the Codespaces fallback.
|
|
11
|
+
|
|
12
|
+
CLI 0.4 and later make `--output .` the default. Keep the explicit flag with CLI 0.3, whose zero-flag command selects GitHub
|
|
13
|
+
publication.
|
|
10
14
|
|
|
11
15
|
## What this repository owns
|
|
12
16
|
|
|
@@ -17,7 +21,7 @@ compatible CLI and Skill together.
|
|
|
17
21
|
- retained Compilation inspection and artifact download;
|
|
18
22
|
- terminal output, exit status, and recovery contracts;
|
|
19
23
|
- the dependency-free npm package; and
|
|
20
|
-
- package provenance and
|
|
24
|
+
- package provenance and publication.
|
|
21
25
|
|
|
22
26
|
The Service owns Foundation Plan meaning and server-side lifecycle. Skills own the agent conversation. This
|
|
23
27
|
repository owns the exact command and transport behavior between them.
|
|
@@ -29,7 +33,7 @@ repository owns the exact command and transport behavior between them.
|
|
|
29
33
|
| Change the CLI | [Agent instructions](https://github.com/firstdraft/cli/blob/main/AGENTS.md), then [documentation map](docs/README.md) |
|
|
30
34
|
| Find a command or output contract | [Command reference](docs/commands.md) |
|
|
31
35
|
| Interpret an error or recover safely | [Errors and recovery](docs/errors.md) |
|
|
32
|
-
| Prepare or
|
|
36
|
+
| Prepare or publish a package | [Release runbook](RELEASING.md) |
|
|
33
37
|
| Inspect dated package observations | [Release history](docs/release-history.md) |
|
|
34
38
|
| Report a vulnerability | [Security policy](SECURITY.md) |
|
|
35
39
|
|
|
@@ -84,7 +88,7 @@ npm install --global @firstdraft.com/cli
|
|
|
84
88
|
```
|
|
85
89
|
|
|
86
90
|
Pin an exact compatible version when a repeatable installation matters; [RELEASING.md](RELEASING.md) owns channel
|
|
87
|
-
and
|
|
91
|
+
and release meaning.
|
|
88
92
|
|
|
89
93
|
The published package:
|
|
90
94
|
|
|
@@ -101,6 +105,5 @@ including the release runbook and dated release history, ships with the package.
|
|
|
101
105
|
|
|
102
106
|
## Release boundary
|
|
103
107
|
|
|
104
|
-
Merging source is not package publication.
|
|
105
|
-
|
|
106
|
-
digest and Service compatibility before any promotion.
|
|
108
|
+
Merging source is not package publication. An approved coordinated release publishes directly to `latest`, reusing
|
|
109
|
+
successful CI for the exact source. [RELEASING.md](RELEASING.md) owns the short release and recovery procedure.
|
package/RELEASING.md
CHANGED
|
@@ -1,222 +1,111 @@
|
|
|
1
1
|
# Releasing First Draft CLI
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
because the compatibility check passes.
|
|
71
|
-
|
|
72
|
-
## Repository and registry controls
|
|
73
|
-
|
|
74
|
-
Before a release, a repository administrator must confirm:
|
|
75
|
-
|
|
76
|
-
1. Confirm `firstdraft/cli` is public. The release workflow deliberately removes checkout credentials and re-fetches
|
|
77
|
-
the public release refs anonymously.
|
|
78
|
-
2. Confirm `main` has pull-request and CI requirements and a `v*` tag ruleset restricts tag creation, update, and
|
|
79
|
-
deletion.
|
|
80
|
-
3. Confirm the GitHub environment named `npm` is restricted to release tags, requires an explicit reviewer, disables
|
|
81
|
-
administrator bypass, and defines `NPM_RELEASE_ENABLED=true`. The workflow fails before publishing when this
|
|
82
|
-
variable is absent.
|
|
83
|
-
4. Confirm that the `firstdraft.com` npm organization and `@firstdraft.com/cli` package still identify the intended
|
|
84
|
-
publisher and repository. The publisher account must have write-protecting 2FA enabled. Verify authenticated
|
|
85
|
-
identity, organization membership, package identity, and current tags:
|
|
86
|
-
|
|
87
|
-
```sh
|
|
88
|
-
npm whoami
|
|
89
|
-
npm org ls firstdraft.com --json
|
|
90
|
-
npm view '@firstdraft.com/cli' name repository.url versions dist-tags --json
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
5. Before creating a `v<package-version>` tag, verify [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/)
|
|
94
|
-
for the exact package, repository, workflow, protected environment, and allowed publish operation. No persistent
|
|
95
|
-
npm credential is permitted for a release workflow.
|
|
96
|
-
|
|
97
|
-
Use the repository-pinned Node.js 24.18.0 toolchain with npm 11.16.0 to verify the organization's durable read/write
|
|
98
|
-
access:
|
|
99
|
-
|
|
100
|
-
```sh
|
|
101
|
-
npm --version
|
|
102
|
-
npm access list packages firstdraft.com:developers '@firstdraft.com/cli' --json
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
Require the package to report `read-write` access for the `developers` team. If access is missing or changed, stop:
|
|
106
|
-
restoring it is a separate administrator and security mutation, not a routine release step.
|
|
107
|
-
|
|
108
|
-
For every release, inspect the existing trusted-publisher relationship read-only:
|
|
109
|
-
|
|
110
|
-
```sh
|
|
111
|
-
npm trust list '@firstdraft.com/cli'
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
Confirm `npm trust list` reports type `github`, repository `firstdraft/cli`, file `publish.yml`, environment `npm`,
|
|
115
|
-
and permission `createPackage`, which is npm's trust-list vocabulary for the allowed publish operation. npm does not
|
|
116
|
-
validate the saved relationship by attempting an exchange, so each case-sensitive value must be inspected. If the
|
|
117
|
-
relationship is missing or changed, stop: restoring it is a separate administrator and security mutation, not a
|
|
118
|
-
routine release step. The publish job must remain on a GitHub-hosted runner with `id-token: write` and must not read
|
|
119
|
-
`NODE_AUTH_TOKEN`, an npm token, or any GitHub Actions secret. Confirm the repository and `npm` environment secret
|
|
120
|
-
lists contain no npm automation secret. Trusted publishing's short-lived OIDC exchange is the sole workflow
|
|
121
|
-
publication credential; an authentication failure stops the release and must never fall back to a persistent token.
|
|
122
|
-
|
|
123
|
-
As optional defense-in-depth after trusted publication is operationally proven, an npm administrator may complete
|
|
124
|
-
the separate security-key ceremony and set package **Publishing access** to **Require two-factor authentication and
|
|
125
|
-
disallow tokens**. Do not report that setting as enabled until it is directly observed.
|
|
126
|
-
|
|
127
|
-
## Prepare a release
|
|
128
|
-
|
|
129
|
-
1. Update `package.json`, `package-lock.json`, and `release/compatibility.json` to the exact release version.
|
|
130
|
-
2. When that version changes, coordinate the matching explicit CLI comparator in `firstdraft/skills` before
|
|
131
|
-
qualification; a stale comparator intentionally makes the three-repository candidate ineligible.
|
|
132
|
-
3. Apply the pre-1.0 policy: use a minor increment for a breaking compatibility line and a patch increment for a
|
|
133
|
-
change that is otherwise backward-compatible. Keep the initial distribution under `next` independently of that
|
|
134
|
-
version choice. Do not move `latest` during release publication.
|
|
135
|
-
4. Confirm neither the exact package version nor its `v<package-version>` tag already exists. If both remain absent,
|
|
136
|
-
the unpublished candidate may retain its proposed version while its exact SHA and digests are revised.
|
|
137
|
-
5. Re-run `npm trust list '@firstdraft.com/cli'`, verify the exact `github`/repository/file/environment/`createPackage`
|
|
138
|
-
relationship described above, and confirm the workflow contains no persistent npm credential or GitHub Actions
|
|
139
|
-
secret.
|
|
140
|
-
6. Update user-facing documentation and release notes for behavior changes.
|
|
141
|
-
7. Run:
|
|
142
|
-
|
|
143
|
-
```sh
|
|
144
|
-
npm ci --ignore-scripts
|
|
145
|
-
npm audit
|
|
146
|
-
npm run check
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
8. Merge the reviewed pull request only after local and hosted checks pass.
|
|
150
|
-
|
|
151
|
-
## Publish
|
|
152
|
-
|
|
153
|
-
The manual boundary is creation of the version tag. From an up-to-date, clean `main`, verify the intended commit and
|
|
154
|
-
confirm that both the intended package version and `v<package-version>` tag are absent. If either identity is already
|
|
155
|
-
consumed, prepare the next version required by the pre-1.0 policy rather than moving or reusing it. Otherwise create
|
|
156
|
-
and push the tag. Push one release tag at a time; the workflow serializes publication, but GitHub retains at most one
|
|
157
|
-
pending run in a concurrency group.
|
|
158
|
-
|
|
159
|
-
The workflow rejects accidental or stale inputs unless they use a protected `v*` tag in `firstdraft/cli`, the tag
|
|
160
|
-
equals `v` plus the version in `package.json`, the remote tag still identifies the triggering commit, and that commit
|
|
161
|
-
appears in the first-parent history of `origin/main`. First-parent membership allows an older reviewed `main` state
|
|
162
|
-
after another change lands while rejecting intermediate commits from a merged side branch. The workflow reruns the
|
|
163
|
-
complete check, waits for approval in the `npm` environment, reverifies the remote refs, and publishes to the public
|
|
164
|
-
registry with provenance under `next`. It authenticates only through the exact npm trusted-publisher relationship and
|
|
165
|
-
the job's short-lived GitHub OIDC token; it reads no persistent npm credential or GitHub Actions secret.
|
|
166
|
-
|
|
167
|
-
The tag ruleset and `npm` environment approval are the external trust boundary because a tag-push run loads its
|
|
168
|
-
workflow from the tagged commit. Before approving the `npm` deployment, the reviewer must confirm:
|
|
169
|
-
|
|
170
|
-
- The tag, package version, and commit SHA are the intended release.
|
|
171
|
-
- The commit is a known reviewed state in protected `main` history and its required checks passed.
|
|
172
|
-
- `.github/workflows/publish.yml` at that commit is the reviewed workflow, still selects the `npm` environment, and
|
|
173
|
-
publishes the public `@firstdraft.com/cli` package only under `next` with provenance.
|
|
174
|
-
- npm lists the exact `github`/`firstdraft/cli`/`publish.yml`/`npm`/`createPackage` trusted-publisher relationship,
|
|
175
|
-
and the GitHub repository and `npm` environment contain no npm automation secret.
|
|
176
|
-
- The unprivileged verification job passed for that exact commit.
|
|
177
|
-
|
|
178
|
-
Do not move or reuse a release tag. If the tagged commit is not a first-parent state of `main`, merge the intended
|
|
179
|
-
change and prepare a new version rather than moving an already shared tag.
|
|
3
|
+
An approved coordinated release publishes directly to npm's `latest` channel. Tests and review belong before merge;
|
|
4
|
+
publication reuses successful CI for the exact source. It does not repeat the suite or require a second
|
|
5
|
+
`next`-to-`latest` promotion. Dated observations remain in [release history](docs/release-history.md).
|
|
6
|
+
|
|
7
|
+
A merge alone does not authorize publication. Obtain one approval for the intended coordinated release, or use the
|
|
8
|
+
approval already given for that scope. The existing GitHub `npm` environment protection still applies; its approval
|
|
9
|
+
executes the same release decision. Do not ask for another conversational approval between already-approved steps.
|
|
10
|
+
|
|
11
|
+
## Version and compatibility policy
|
|
12
|
+
|
|
13
|
+
Before `1.0.0`, use ordinary `0.MINOR.PATCH` versions: increase `MINOR` for a breaking compatibility-line change and
|
|
14
|
+
`PATCH` for a backward-compatible change within that line. Never reuse a published version or move a protected
|
|
15
|
+
release tag. An unpublished, untagged candidate can retain its proposed version while its source changes.
|
|
16
|
+
The published version may remain in source during documentation and test maintenance; recording its release history
|
|
17
|
+
does not require preparing another version. Choose an unused version when preparing the next publication.
|
|
18
|
+
|
|
19
|
+
CLI `0.6.x` requires API `0.6.x` and Plan `firstdraft.foundation-plan.sketch/0.22`. Plan `0.22` adds the optional
|
|
20
|
+
`application.pwa` boolean and replaces the sole accepted `0.21` input format. The new API and CLI minor
|
|
21
|
+
versions record that input and artifact compatibility break; they add no migration or compatibility bridge.
|
|
22
|
+
The target stays `rails-sketch/2026-09`.
|
|
23
|
+
|
|
24
|
+
Local output remains the default introduced in CLI `0.4.x`: `firstdraft plan compile` is equivalent to
|
|
25
|
+
`firstdraft plan compile --output .`, with GitHub publication selected by explicit `--github`. The root archive
|
|
26
|
+
remains `.firstdraft/design`. Existing applications and old Plans are not migrated.
|
|
27
|
+
|
|
28
|
+
`release/compatibility.json` declares the package version, accepted API-contract range, and accepted Plan formats.
|
|
29
|
+
It is source-only metadata, validated by the normal test suite and absent from the npm tarball. Coordinate the
|
|
30
|
+
explicit CLI comparator and bundled CLI pin in `firstdraft/skills` when this version changes. The service's
|
|
31
|
+
`script/release_compatibility_check` compares the three exact revisions; compatibility establishes eligibility,
|
|
32
|
+
not authorization or runtime proof. Its closed `firstdraft.release-compatibility/1` format rejects unknown keys.
|
|
33
|
+
|
|
34
|
+
## Prepare before merge
|
|
35
|
+
|
|
36
|
+
1. Update `package.json`, `package-lock.json`, and `release/compatibility.json`, and align the Skills CLI requirement.
|
|
37
|
+
2. Update the command, error, and Skill guidance affected by the change. Preserve dated release evidence.
|
|
38
|
+
3. Run focused checks while developing and the repository's required CI for the merge candidate. For a fresh
|
|
39
|
+
checkout, the complete local check is `npm ci --ignore-scripts`, `npm audit`, then `npm run check`.
|
|
40
|
+
4. Review and merge the change. Wait for the existing `CI` workflow to pass for the selected `main` SHA; publication
|
|
41
|
+
uses that run instead of starting another one.
|
|
42
|
+
|
|
43
|
+
Use existing smoke evidence when it covers the changed behavior. If changed CLI/Service/Skill behavior warrants a
|
|
44
|
+
live smoke, use a simple Plan, compile locally with `firstdraft plan compile --output .`, and boot the generated app locally
|
|
45
|
+
when runtime behavior changed. A CLI dispatch-only change can be covered by local command and packed-package tests.
|
|
46
|
+
Do not require Codespaces, GitHub Publication, native builds, or Revyl for a routine release. Codespaces is a fallback
|
|
47
|
+
development environment. Additional integration checks belong only to changes affecting those integrations.
|
|
48
|
+
|
|
49
|
+
## Publish the approved source
|
|
50
|
+
|
|
51
|
+
From a clean checkout of the selected `main` revision:
|
|
52
|
+
|
|
53
|
+
1. Confirm the exact package version and `v<package-version>` tag are both unused. If either identity is already
|
|
54
|
+
consumed, prepare the next version required by the pre-1.0 policy rather than moving or reusing it.
|
|
55
|
+
2. Confirm the intended three revisions are compatible and the coordinated release approval covers them.
|
|
56
|
+
3. Create and push `v<package-version>` at that source revision. Push one release tag at a time; the workflow
|
|
57
|
+
serializes publication and GitHub retains at most one pending run in a concurrency group.
|
|
58
|
+
4. Approve the existing `npm` environment deployment for that tag. The workflow publishes with provenance under
|
|
59
|
+
`latest`; no separate dist-tag mutation is needed.
|
|
60
|
+
|
|
61
|
+
The workflow requires a protected `v*` tag in `firstdraft/cli`, the matching `package.json` version, an unchanged
|
|
62
|
+
remote tag, and a commit in the first-parent history of protected `main`. It finds a successful `CI` push run for
|
|
63
|
+
that exact SHA using `gh run list`, checks the package file allowlist, then rechecks mutable refs after environment
|
|
64
|
+
approval. It does not install development dependencies, rerun tests or audit, or request interactive npm login.
|
|
65
|
+
Both source checks invoke `scripts/check-release-source.sh`; the postapproval invocation must remain before publish.
|
|
66
|
+
|
|
67
|
+
If CI is still running, let that run finish and rerun the failed publication verification job. Resolve failing
|
|
68
|
+
checks in CI itself; publication does not start a duplicate suite. A source fix after tagging requires a new version.
|
|
69
|
+
Do not retest unrelated surfaces merely because time has passed since merge.
|
|
180
70
|
|
|
181
71
|
## Verify and recover
|
|
182
72
|
|
|
183
|
-
After publication, inspect the registry before retrying
|
|
184
|
-
the tagged checkout, verify the exact version, `next` dist-tag, unchanged `latest` dist-tag, integrity metadata, and
|
|
185
|
-
provenance metadata:
|
|
73
|
+
After publication, inspect the registry before retrying a failed workflow; the immutable version may already exist:
|
|
186
74
|
|
|
187
75
|
```sh
|
|
188
76
|
FD_CLI_RELEASE_VERSION="$(node -p "require('./package.json').version")"
|
|
189
77
|
npm view "@firstdraft.com/cli@$FD_CLI_RELEASE_VERSION" \
|
|
190
|
-
version dist.integrity dist.shasum repository.url engines bin --json
|
|
78
|
+
version dist.integrity dist.shasum dist.attestations repository.url engines bin --json
|
|
191
79
|
npm dist-tag ls '@firstdraft.com/cli'
|
|
192
80
|
```
|
|
193
81
|
|
|
194
|
-
|
|
195
|
-
|
|
82
|
+
Confirm the intended version is `latest` and has integrity/provenance metadata. Install that exact version in a
|
|
83
|
+
temporary prefix, confirm `firstdraft --version`, and run `npm audit signatures` there to verify the published
|
|
84
|
+
artifact. This checks distribution; it does not repeat application qualification. Record the version, source,
|
|
85
|
+
package integrity, and any relevant smoke evidence in the dated release record.
|
|
196
86
|
|
|
197
|
-
If OIDC authentication fails, reconcile
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
the protected tag is immutable: prepare the next version rather than moving the tag. Never add a token fallback.
|
|
87
|
+
If OIDC authentication fails, reconcile the registry version and protected tag before retrying. Correct a broken
|
|
88
|
+
trusted-publisher relationship when necessary, then rerun failed jobs at the existing tag. If the tagged workflow
|
|
89
|
+
identity itself is wrong, prepare a new version; never move the tag or add a persistent-token fallback.
|
|
201
90
|
|
|
202
|
-
|
|
203
|
-
version
|
|
204
|
-
unpublishing as an exceptional incident response, not a routine rollback.
|
|
91
|
+
For a bad release, move `latest` to a known-good compatible version as an incident rollback, or deprecate the bad
|
|
92
|
+
version and publish a corrected higher version. Unpublishing is exceptional incident response, not routine rollback.
|
|
205
93
|
|
|
206
|
-
##
|
|
94
|
+
## Publisher configuration
|
|
207
95
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
to that exact version from the tagged checkout:
|
|
96
|
+
These are durable repository and npm controls, not a per-release account audit. Verify them when provisioning,
|
|
97
|
+
changing publisher configuration, or diagnosing an actual failure:
|
|
211
98
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
npm
|
|
216
|
-
|
|
99
|
+
- `firstdraft/cli` is public; `main` requires pull requests and CI, and a `v*` ruleset restricts tag mutation.
|
|
100
|
+
- The `npm` GitHub environment is limited to release tags, requires its existing reviewer, disables administrator
|
|
101
|
+
bypass, and defines `NPM_RELEASE_ENABLED=true`.
|
|
102
|
+
- npm trusted publishing identifies package `@firstdraft.com/cli`, repository `firstdraft/cli`, workflow
|
|
103
|
+
`publish.yml`, environment `npm`, and permission `createPackage`. The publishing account retains the intended
|
|
104
|
+
organization access and write-protecting 2FA. Configure these with an administrator only when needed.
|
|
105
|
+
- Publication runs on a GitHub-hosted runner with `id-token: write`, pinned Node.js 24.18.0 and npm 11.16.0. npm's
|
|
106
|
+
short-lived OIDC exchange is the only publication credential; no persistent npm token or Actions secret is used.
|
|
107
|
+
The CI lookup uses GitHub's read-only workflow token.
|
|
217
108
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
observed. Do not move `latest` merely because a release merged, published successfully, or passed candidate
|
|
222
|
-
compatibility checks, and do not use a dist-tag change to repair or disguise a bad immutable version.
|
|
109
|
+
Ordinary installation and use require no npm login. Ordinary trusted publication requires no local maintainer
|
|
110
|
+
login or per-release security-key ceremony. Request npm interaction only when npm requires it for a governance
|
|
111
|
+
change or an actual authentication failure. See [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/).
|
package/SECURITY.md
CHANGED
|
@@ -6,10 +6,8 @@ sensitive details in a public Issue.
|
|
|
6
6
|
|
|
7
7
|
## Supported versions
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
qualification; it does not displace the stable release before separate promotion approval. When `next` and `latest`
|
|
12
|
-
identify the same version, that release fills both roles.
|
|
9
|
+
The release currently identified by npm's `latest` tag receives security fixes. Approved releases publish directly
|
|
10
|
+
to `latest`; historical `next` tags do not establish a separate supported channel.
|
|
13
11
|
|
|
14
12
|
Distribution channels are independent of version syntax. Before `1.0.0`, increasing the minor version starts a
|
|
15
13
|
breaking compatibility line; increasing the patch version is otherwise backward-compatible within that line. All
|
package/docs/README.md
CHANGED
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
Use this page to find the narrowest authoritative document for a task. Runtime source and tests remain the final
|
|
4
4
|
evidence for implemented behavior; if they contradict a document, surface the contradiction instead of guessing.
|
|
5
5
|
|
|
6
|
-
|
|
|
7
|
-
|
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
6
|
+
| Task | Read first |
|
|
7
|
+
| -------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
8
|
+
| Local app development | [Local guide](https://gist.github.com/raghubetina/3d424a97a1eaa6de8c406e67f32a237e) |
|
|
9
|
+
| Codespaces fallback | [Drawing Board guide](https://github.com/firstdraft/drawing-board#build-an-app-with-first-draft) |
|
|
10
|
+
| Installation or package contract | [Root README](../README.md) |
|
|
11
|
+
| Commands, API, or output | [Command reference](commands.md) |
|
|
12
|
+
| Errors and recovery | [Errors and recovery](errors.md) |
|
|
13
|
+
| Versioning and publication | [Release policy and runbook](../RELEASING.md) |
|
|
14
|
+
| Dated release observations | [Release history](release-history.md) |
|
|
15
|
+
| Vulnerability reporting | [Security policy](../SECURITY.md) |
|
|
15
16
|
|
|
16
17
|
## Authority boundaries
|
|
17
18
|
|
|
@@ -21,7 +22,7 @@ evidence for implemented behavior; if they contradict a document, surface the co
|
|
|
21
22
|
- [errors.md](errors.md) owns handled-error interpretation and recovery guidance.
|
|
22
23
|
- [RELEASING.md](../RELEASING.md) owns living release policy and the operator runbook.
|
|
23
24
|
- [release-history.md](release-history.md) preserves dated release observations. Recheck live tags, package versions,
|
|
24
|
-
dist-tags
|
|
25
|
+
and dist-tags before relying on them operationally; publisher configuration is checked when it changes or fails.
|
|
25
26
|
- The source repository's `AGENTS.md` routes agent work; it should stay compact rather than duplicate these documents.
|
|
26
27
|
|
|
27
28
|
## Retrieval quality
|
|
@@ -51,6 +52,12 @@ smoke test. To inspect the package manifest without writing a tarball:
|
|
|
51
52
|
npm pack --dry-run --json --ignore-scripts
|
|
52
53
|
```
|
|
53
54
|
|
|
55
|
+
Pass Node test options through `npm test` to focus a run while retaining discovery under `test/`:
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
npm test -- --test-name-pattern="publication"
|
|
59
|
+
```
|
|
60
|
+
|
|
54
61
|
To reproduce the length-delimited SHA-256 used by external evidence to identify packaged JavaScript runtime inputs
|
|
55
62
|
(`package.json`, `bin/firstdraft.js`, and every `.js` file under `src/`), run:
|
|
56
63
|
|
package/docs/commands.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
This page owns the detailed public semantics of the current command surface. Run `firstdraft --help` or a command
|
|
4
4
|
group's `--help` for concise executable syntax. See [Errors and recovery](errors.md) before retrying a failed mutation.
|
|
5
5
|
|
|
6
|
-
The current `0.
|
|
6
|
+
The current `0.6.x` source line contains the auditable command shell, local Foundation Plan initialization, local
|
|
7
7
|
application-key and UUID generation, conditional whole-document push, whole-graph analysis status polling, direct
|
|
8
|
-
Compile-and-materialize and private publish orchestration, and retained-Compilation inspection. CLI `0.
|
|
9
|
-
requires the service's `0.
|
|
8
|
+
Compile-and-materialize and private publish orchestration, and retained-Compilation inspection. CLI `0.6.x`
|
|
9
|
+
requires the service's `0.6.x` API contract. See the [release policy](../RELEASING.md) for versioning and channel
|
|
10
10
|
semantics and [release history](release-history.md) for the transition from prereleases.
|
|
11
11
|
|
|
12
12
|
## Command map
|
|
@@ -18,7 +18,8 @@ semantics and [release history](release-history.md) for the transition from prer
|
|
|
18
18
|
| `firstdraft generate uuid` | No | Generate one or more Foundation Plan subject identities |
|
|
19
19
|
| `firstdraft plan push` | Yes | Conditionally submit the exact whole Plan |
|
|
20
20
|
| `firstdraft plan status` | Yes | Read or wait for the current whole-graph analysis |
|
|
21
|
-
| `firstdraft plan compile` | Yes | Push and analyze, then materialize
|
|
21
|
+
| `firstdraft plan compile` | Yes | Push and analyze, then materialize in the current folder |
|
|
22
|
+
| `firstdraft plan compile --github` | Yes | Push and analyze, then publish to private GitHub |
|
|
22
23
|
| `firstdraft compilation status` | Yes | Inspect a retained Compilation by ID |
|
|
23
24
|
| `firstdraft compilation download` | Yes | Verify and materialize a successful retained Compilation |
|
|
24
25
|
|
|
@@ -44,7 +45,7 @@ From the project that the Plan describes:
|
|
|
44
45
|
firstdraft plan init --name "Oscar Party"
|
|
45
46
|
```
|
|
46
47
|
|
|
47
|
-
This creates an empty `firstdraft.foundation-plan.sketch/0.
|
|
48
|
+
This creates an empty `firstdraft.foundation-plan.sketch/0.22` Plan targeting `rails-sketch/2026-09` and a
|
|
48
49
|
client-generated Project ID under `.firstdraft/`. A nested ignore file keeps that local scratch area out of Git
|
|
49
50
|
without changing the project's own `.gitignore`. Initialization makes no network request and refuses to replace an
|
|
50
51
|
existing `.firstdraft` path.
|
|
@@ -53,6 +54,12 @@ Provide either `--name`, `--application-key`, or both. Name-only initialization
|
|
|
53
54
|
initialization derives a humanized display name. Supplying both preserves both values exactly after validating them
|
|
54
55
|
against the Foundation Plan schema.
|
|
55
56
|
|
|
57
|
+
The initialized Plan omits `application.pwa`, which uses the Rails target's default of `true` for basic online
|
|
58
|
+
installation and Add to Home Screen support. Set `"pwa": false` within `application` to omit generated installation
|
|
59
|
+
metadata, or use `true` explicitly. The CLI sends the authored bytes unchanged, preserving omission versus either
|
|
60
|
+
boolean. This choice does not add offline caching, Web Push, or a native build; a browser may still save an ordinary
|
|
61
|
+
site when it is disabled. The CLI does not qualify browser or device installation.
|
|
62
|
+
|
|
56
63
|
### Generate an application key
|
|
57
64
|
|
|
58
65
|
To inspect the name-to-key derivation without initializing a project, run:
|
|
@@ -134,14 +141,20 @@ a bounded number of times because the command sends only `GET` requests. See
|
|
|
134
141
|
|
|
135
142
|
## Compile the current Plan
|
|
136
143
|
|
|
137
|
-
|
|
144
|
+
Compile into the current local folder:
|
|
138
145
|
|
|
139
146
|
```sh
|
|
140
|
-
firstdraft plan compile
|
|
147
|
+
firstdraft plan compile
|
|
141
148
|
```
|
|
142
149
|
|
|
150
|
+
This is equivalent to `firstdraft plan compile --output .`. Use `--output ./application` for another absent
|
|
151
|
+
directory, or `--github` to publish to a private GitHub repository. `--github` and `--output` are mutually exclusive.
|
|
152
|
+
No GitHub connection, repository clone, or push is required for local compilation. Compilation runs on the First
|
|
153
|
+
Draft service; output and the application runtime are local. CLI `0.3.x` used GitHub Publication as its default;
|
|
154
|
+
scripts that require that behavior must add `--github` when upgrading to `0.4.x` or later.
|
|
155
|
+
|
|
143
156
|
Both `plan compile` modes first push the exact current bytes in
|
|
144
|
-
`.firstdraft/foundation-plan.json`, even when those bytes are unchanged, and
|
|
157
|
+
`.firstdraft/foundation-plan.json`, even when those bytes are unchanged, and save the accepted ETag using the same
|
|
145
158
|
contract as `plan push`. It then waits up to two minutes for an analysis whose graph version and
|
|
146
159
|
`head_source_sha256` exactly match that accepted push, polling past a terminal result retained for an older Head.
|
|
147
160
|
Invalid JSON, schema diagnostics, semantic diagnostics, a failed analysis, a superseded analysis, or a recurring
|
|
@@ -154,21 +167,21 @@ the accepted source SHA-256 from the saved ETag, hashes the current local bytes,
|
|
|
154
167
|
|
|
155
168
|
### Materialize a direct Compilation
|
|
156
169
|
|
|
157
|
-
|
|
170
|
+
Without `--github`, the CLI accepts either an explicit absent destination beneath an existing real directory or a path
|
|
158
171
|
that resolves to the physical current directory. It validates either destination before pushing the Plan. An absent
|
|
159
172
|
destination is checked again after analysis; root adoption instead holds its owned lock and performs the exact
|
|
160
173
|
pre-move identity recheck described below. Other existing destinations remain invalid, so
|
|
161
174
|
`--output ./application` retains its absent-directory contract.
|
|
162
175
|
|
|
163
|
-
The nested archive layout below
|
|
176
|
+
The nested archive layout below is shared by CLI `0.3.x` and later.
|
|
164
177
|
[Published CLI `0.2.2`](release-history.md#022-publication-and-registry-observation) archives at top-level `design/`;
|
|
165
178
|
existing applications are not migrated automatically.
|
|
166
179
|
|
|
167
|
-
`--output .` is the noninteractive root-adoption mode. `./`, an absolute spelling of the current directory, and
|
|
180
|
+
The default `--output .` is the noninteractive root-adoption mode. `./`, an absolute spelling of the current directory, and
|
|
168
181
|
another spelling that resolves to that same physical directory select the same mode. It works at any real current
|
|
169
182
|
directory that meets the preconditions below and does not recognize Drawing Board or another repository layout
|
|
170
|
-
specially.
|
|
171
|
-
|
|
183
|
+
specially. Root adoption supports POSIX filesystems; on Windows, use `--output ./application` because current-folder
|
|
184
|
+
output returns `root_platform_unsupported`. Before starting Compilation, the CLI requires:
|
|
172
185
|
|
|
173
186
|
- the current directory to be a real, writable, non-filesystem-root directory;
|
|
174
187
|
- no existing `.firstdraft/design` archive or top-level `.firstdraft-root-output` transaction path, including
|
|
@@ -274,10 +287,10 @@ only.
|
|
|
274
287
|
|
|
275
288
|
### Publish through GitHub
|
|
276
289
|
|
|
277
|
-
|
|
290
|
+
Use the explicit GitHub option for the Publication journey:
|
|
278
291
|
|
|
279
292
|
```sh
|
|
280
|
-
firstdraft plan compile
|
|
293
|
+
firstdraft plan compile --github
|
|
281
294
|
```
|
|
282
295
|
|
|
283
296
|
Invoking this form authorizes the internal GitHub Publication lifecycle. The command writes stable human-readable
|
|
@@ -289,7 +302,7 @@ local paths, or environment values. Success writes exactly the validated private
|
|
|
289
302
|
newline to stdout. If the command fails after progress has begun, its structured JSON error envelope is the final
|
|
290
303
|
stderr document after the progress lines.
|
|
291
304
|
|
|
292
|
-
The closed API `0.
|
|
305
|
+
The closed API `0.6.x` progress-reason allowlist is `github.configuration_missing`, `github.oauth_unavailable`,
|
|
293
306
|
`github.api_unavailable`, `github.reauthorization_required`, `github.account_mismatch`,
|
|
294
307
|
`github.installation_unavailable`, `github.installation_not_ready`, `github.preflight_unavailable`, the legacy-only
|
|
295
308
|
`github.preflight_unclassified`, and these stage-specific fallbacks: `github.preflight_unavailable.configuration`,
|
|
@@ -312,8 +325,8 @@ exact Plan push and valid Analysis.
|
|
|
312
325
|
## Inspect a retained Compilation
|
|
313
326
|
|
|
314
327
|
These lower-level commands are for callers that already hold a retained Compilation ID from authenticated API
|
|
315
|
-
metadata or operational tooling.
|
|
316
|
-
`plan compile
|
|
328
|
+
metadata or operational tooling. `plan compile --github` prints only the final repository URL, while the default
|
|
329
|
+
`plan compile` form waits for and downloads its own direct Compilation:
|
|
317
330
|
|
|
318
331
|
```sh
|
|
319
332
|
firstdraft compilation status 01900000-0000-7000-8000-000000000001
|
|
@@ -338,7 +351,7 @@ when a retained direct Compilation succeeded but an earlier root materialization
|
|
|
338
351
|
never starts replacement work. An incomplete rollback leaves `.firstdraft-root-output` and requires journal
|
|
339
352
|
reconciliation before this command can run again.
|
|
340
353
|
|
|
341
|
-
Artifact validation accepts only Plan format `firstdraft.foundation-plan.sketch/0.
|
|
354
|
+
Artifact validation accepts only Plan format `firstdraft.foundation-plan.sketch/0.22` and target profile
|
|
342
355
|
`rails-sketch/2026-09`, in addition to matching the retained Compilation's provenance and verifying file integrity.
|
|
343
356
|
An earlier format or profile is rejected before materialization, even when the retained status names that profile.
|
|
344
357
|
|
package/docs/errors.md
CHANGED
|
@@ -22,11 +22,11 @@ phase-specific recovery:
|
|
|
22
22
|
- `phase: "push"` means the Plan mutation may have been accepted. Stop and reconcile local Head state. Until First
|
|
23
23
|
Draft has a Foundation Plan Head reconciliation endpoint, an accepted request whose response cannot be verified
|
|
24
24
|
may require manual recovery. Do not construct an ETag from the Plan digest or trust an unverified response.
|
|
25
|
-
- `phase: "compilation"` means a
|
|
25
|
+
- `phase: "compilation"` means a local Compilation (the default mode, with optional `--output`) may have started, but its retained identity is unknown.
|
|
26
26
|
The CLI never repeats that `POST`. Do not start another Compilation until the Project is reconciled through First
|
|
27
27
|
Draft or an operator can identify the retained work.
|
|
28
28
|
- `phase: "publication"` means the singleton Publication mutation was not resolved. Do not run concurrent Compile
|
|
29
|
-
commands. After the prior invocation exits, wait and rerun `plan compile` with unchanged Plan bytes to safely
|
|
29
|
+
commands. After the prior invocation exits, wait and rerun `plan compile --github` with unchanged Plan bytes to safely
|
|
30
30
|
reconcile or resume the retained singleton.
|
|
31
31
|
|
|
32
32
|
`plan push` also reports `request_outcome_unknown` if a failure happens after sending its request. Local state remains
|
|
@@ -45,12 +45,12 @@ will not repair it.
|
|
|
45
45
|
Only the lower-level `compilation status <compilation-id>` command is read-only. Its
|
|
46
46
|
`compilation_status_unavailable` result is safe to retry a bounded number of times;
|
|
47
47
|
`invalid_compilation_status` requires contract reconciliation. A wait stops rather than following a changed
|
|
48
|
-
analysis or Compilation identity. This read-only retry guidance does not apply to `plan compile
|
|
48
|
+
analysis or Compilation identity. This read-only retry guidance does not apply to `plan compile`, which
|
|
49
49
|
starts a new Compilation after analysis.
|
|
50
50
|
|
|
51
51
|
## Direct Compilation recovery
|
|
52
52
|
|
|
53
|
-
Do not blindly rerun `plan compile
|
|
53
|
+
Do not blindly rerun `plan compile` after its Compilation start was accepted or may have been accepted.
|
|
54
54
|
That command creates new work; it is not a retained-Compilation reconciliation command.
|
|
55
55
|
|
|
56
56
|
If `request_outcome_unknown` reports `phase: "compilation"`, the start request did not yield a validated retained
|
|
@@ -85,7 +85,7 @@ operation is safe to remove. After successful adoption, run retained status and
|
|
|
85
85
|
|
|
86
86
|
After `compilation_wait_timed_out`, retained work may still continue. Use
|
|
87
87
|
`firstdraft compilation status <current.compilation.id>` for one read-only status check; do not rerun
|
|
88
|
-
`plan compile
|
|
88
|
+
`plan compile`. `compilation_failed`, `compilation_cancelled`, and `compilation_changed` already carry the
|
|
89
89
|
validated `current` projection appropriate to their stopping boundary. Authentication recovery may refresh the
|
|
90
90
|
credential, but it must continue from the retained ID rather than starting another Compilation.
|
|
91
91
|
|
|
@@ -95,7 +95,7 @@ The Publication is a Project singleton. If its initial conditional `PUT` is ambi
|
|
|
95
95
|
read-only singleton `GET` and never automatically repeats the mutation in that invocation.
|
|
96
96
|
|
|
97
97
|
After `publication_status_unavailable` or `publication_wait_timed_out`, retained work may still continue. Do not run
|
|
98
|
-
concurrent Compile commands. Wait, then rerun `plan compile` with unchanged Plan bytes; the conditional request
|
|
98
|
+
concurrent Compile commands. Wait, then rerun `plan compile --github` with unchanged Plan bytes; the conditional request
|
|
99
99
|
safely reconciles or resumes the same retained singleton without creating another Compilation, repository, or push.
|
|
100
100
|
The same recovery applies when an invocation exits after an unresolved Publication start.
|
|
101
101
|
|
|
@@ -123,10 +123,10 @@ stopped without following the replacement.
|
|
|
123
123
|
| Analysis waits | `analysis_changed`, `wait_timed_out`, `analysis_wait_timed_out` | 1 | The pinned analysis changed or remained processing at the deadline. |
|
|
124
124
|
| `plan compile` | `plan_not_valid` | 1 | Analysis completed without `valid`; `current` contains diagnostics and status. |
|
|
125
125
|
| `plan compile` | `local_plan_changed` | 1 | Local bytes or saved state changed after acceptance, before the selected mutation. |
|
|
126
|
-
| `plan compile
|
|
127
|
-
| `plan compile
|
|
128
|
-
| `plan compile`
|
|
129
|
-
| `plan compile`
|
|
126
|
+
| `plan compile` | `compilation_start_rejected`, `compilation_status_unavailable`, `invalid_compilation_status` | 1 | Direct start was rejected or retained status failed; post-start errors include `current`. |
|
|
127
|
+
| `plan compile` | `compilation_changed`, `compilation_wait_timed_out`, `compilation_failed`, `compilation_cancelled` | 1 | The pinned direct Compilation changed, timed out, failed, or was cancelled. |
|
|
128
|
+
| `plan compile --github` | `publication_start_rejected`, `publication_status_unavailable`, `invalid_publication_status` | 1 | Publication start or status failed its validated transport contract. |
|
|
129
|
+
| `plan compile --github` | `publication_changed`, `publication_wait_timed_out`, `publication_failed`, `publication_cancelled` | 1 | The pinned Publication changed, timed out, or reached a non-success terminal state. |
|
|
130
130
|
| `compilation status`, `compilation download` | `compilation_status_unavailable`, `invalid_compilation_status` | 1 | The retained status could not be read or violated its exact contract. |
|
|
131
131
|
| `compilation status --wait` | `compilation_changed`, `compilation_wait_timed_out` | 1 | Retained identity/provenance changed or the wait ended. |
|
|
132
132
|
| `compilation download` | `compilation_not_succeeded` | 1 | Status was not `succeeded`; no artifact request was made. |
|
package/docs/release-history.md
CHANGED
|
@@ -5,6 +5,22 @@ npm, GitHub, service, or qualification state. Before acting, recheck the registr
|
|
|
5
5
|
compatibility declarations, trusted-publisher relationship, and named release-specific qualification by following
|
|
6
6
|
the living [release policy and runbook](../RELEASING.md).
|
|
7
7
|
|
|
8
|
+
## 0.4.0 local-output release
|
|
9
|
+
|
|
10
|
+
- On September 23, 2026 UTC, protected tag `v0.4.0` published CLI `0.4.0` from
|
|
11
|
+
`a555f8d39862109b8c28b392c0439470e88f4ba8` directly to `latest` through
|
|
12
|
+
[GitHub trusted publishing](https://github.com/firstdraft/cli/actions/runs/35807891432).
|
|
13
|
+
- `plan compile` now defaults to current-folder output, equivalent to `--output .`. GitHub Publication requires
|
|
14
|
+
`--github`. API compatibility remains `0.4.x`; this is a breaking CLI-default change from `0.3.x`.
|
|
15
|
+
- npm SHA-1 is `65b6b960b9029cb8f2352273db9fb551132f2ac9`. Public exact-version installation reported `0.4.0`, and
|
|
16
|
+
registry signature and provenance verification passed. `latest` selected `0.4.0`; `next` remained `0.3.0`.
|
|
17
|
+
- The packed candidate compiled a reviewed Reading List Plan against service `2bfdf6bf`, materialized 360 files at
|
|
18
|
+
the local root, and passed local Rails boot, browser creation, and source-edit refresh. Existing warnings and gaps
|
|
19
|
+
remained disclosed. No Codespace, GitHub Publication, native build, or Revyl session was part of this release smoke.
|
|
20
|
+
- Plugin `0.4.0` bundles this exact CLI source. Its publication workflow matched all 27 files with the registry CLI.
|
|
21
|
+
The [plugin release record](https://github.com/firstdraft/skills/blob/main/evidence/2026-09-22-plugin-0.4.0-release.md)
|
|
22
|
+
records the companion package, catalog, and post-publication Drawing Board follow-up.
|
|
23
|
+
|
|
8
24
|
## 0.1.0 alpha publications
|
|
9
25
|
|
|
10
26
|
- On July 31, 2026, npm rejected the unscoped `firstdraft` name for `v0.1.0-alpha.1` as too similar to the existing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firstdraft.com/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Command-line interface for First Draft",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"access": "public",
|
|
30
30
|
"provenance": true,
|
|
31
31
|
"registry": "https://registry.npmjs.org/",
|
|
32
|
-
"tag": "
|
|
32
|
+
"tag": "latest"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"check": "npm run typecheck && npm run lint && npm run format:check && npm test && npm run pack:check && npm run pack:smoke",
|
package/src/cli.js
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
PlanCompileAnalysisRejectedError,
|
|
39
39
|
PlanCompileAnalysisUnavailableError,
|
|
40
40
|
PlanCompilePushRejectedError,
|
|
41
|
-
|
|
41
|
+
compilePlanToGitHub,
|
|
42
42
|
compilePlanToDirectory,
|
|
43
43
|
} from "./commands/plan-compile.js";
|
|
44
44
|
import { initializePlan } from "./commands/plan-init.js";
|
|
@@ -182,9 +182,11 @@ const PLAN_COMPILE_HELP = `First Draft CLI
|
|
|
182
182
|
Usage:
|
|
183
183
|
firstdraft plan compile
|
|
184
184
|
firstdraft plan compile --output <absent-directory|.>
|
|
185
|
+
firstdraft plan compile --github
|
|
185
186
|
|
|
186
187
|
Options:
|
|
187
|
-
--output <absent-directory|.> Materialize
|
|
188
|
+
--output <absent-directory|.> Materialize here (default: .)
|
|
189
|
+
--github Publish to a private GitHub repository
|
|
188
190
|
-h, --help Show help
|
|
189
191
|
|
|
190
192
|
Environment:
|
|
@@ -192,12 +194,11 @@ Environment:
|
|
|
192
194
|
FIRSTDRAFT_API_URL Override the initial API origin
|
|
193
195
|
|
|
194
196
|
The command submits the exact current whole-file Plan, waits for its analysis,
|
|
195
|
-
and proceeds only when that analysis is valid.
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
starting GitHub Publication. Progress is written to stderr.
|
|
197
|
+
and proceeds only when that analysis is valid. By default it materializes the
|
|
198
|
+
verified application in the current directory, preserving existing root material
|
|
199
|
+
under .firstdraft/design. --output can select another absent directory.
|
|
200
|
+
--github selects the GitHub Publication lifecycle and prints the private repository
|
|
201
|
+
URL; it cannot be combined with --output. Progress is written to stderr.
|
|
201
202
|
`;
|
|
202
203
|
|
|
203
204
|
const COMPILATION_HELP = `First Draft CLI
|
|
@@ -329,7 +330,7 @@ const PLAN_COMPILE_ANALYSIS_NOT_VALID_DETAIL =
|
|
|
329
330
|
const PLAN_COMPILE_LOCAL_PLAN_CHANGED_DETAIL =
|
|
330
331
|
"The local Foundation Plan changed after validation. Run 'firstdraft plan compile' again to submit the current bytes.";
|
|
331
332
|
const PLAN_COMPILE_DIRECT_REQUEST_OUTCOME_UNKNOWN_DETAIL =
|
|
332
|
-
"A Compilation may have started, but its response could not be verified. Do not rerun 'firstdraft plan compile
|
|
333
|
+
"A Compilation may have started, but its response could not be verified. Do not rerun 'firstdraft plan compile' or start another Compilation until the current Project is reconciled.";
|
|
333
334
|
const PLAN_COMPILE_DIRECT_START_REJECTED_DETAIL =
|
|
334
335
|
"First Draft rejected the direct Compilation request.";
|
|
335
336
|
const PLAN_COMPILE_DIRECT_STATUS_UNAVAILABLE_DETAIL =
|
|
@@ -339,7 +340,7 @@ const PLAN_COMPILE_DIRECT_STATUS_INVALID_DETAIL =
|
|
|
339
340
|
const PLAN_COMPILE_DIRECT_CHANGED_DETAIL =
|
|
340
341
|
"The pinned Compilation changed while being polled. The command stopped without downloading an artifact.";
|
|
341
342
|
const PLAN_COMPILE_DIRECT_TIMEOUT_DETAIL =
|
|
342
|
-
"The retained Compilation is still processing after the bounded ten-minute wait. Use current.compilation.id with 'firstdraft compilation status'; do not rerun 'firstdraft plan compile
|
|
343
|
+
"The retained Compilation is still processing after the bounded ten-minute wait. Use current.compilation.id with 'firstdraft compilation status'; do not rerun 'firstdraft plan compile' or start another Compilation.";
|
|
343
344
|
const PLAN_COMPILE_DIRECT_FAILED_DETAIL =
|
|
344
345
|
"The pinned Compilation failed. No artifact was downloaded or materialized.";
|
|
345
346
|
const PLAN_COMPILE_DIRECT_CANCELLED_DETAIL =
|
|
@@ -349,19 +350,19 @@ const PLAN_PUBLISH_INCOMPATIBLE_STATE_DETAIL =
|
|
|
349
350
|
const PLAN_PUBLISH_NOT_PUSHED_DETAIL =
|
|
350
351
|
"The current Foundation Plan was not retained before the Publication request.";
|
|
351
352
|
const PLAN_PUBLISH_LOCAL_PLAN_CHANGED_DETAIL =
|
|
352
|
-
"The local Foundation Plan changed after validation. Run 'firstdraft plan compile' again to submit the current bytes.";
|
|
353
|
+
"The local Foundation Plan changed after validation. Run 'firstdraft plan compile --github' again to submit the current bytes.";
|
|
353
354
|
const PLAN_PUBLISH_REQUEST_OUTCOME_UNKNOWN_DETAIL =
|
|
354
|
-
"The Publication may have started, but its retained singleton status could not be verified. No mutation was retried. Do not run concurrent Compile commands. Wait, then rerun 'firstdraft plan compile' with unchanged Plan bytes to safely reconcile or resume the retained singleton.";
|
|
355
|
+
"The Publication may have started, but its retained singleton status could not be verified. No mutation was retried. Do not run concurrent Compile commands. Wait, then rerun 'firstdraft plan compile --github' with unchanged Plan bytes to safely reconcile or resume the retained singleton.";
|
|
355
356
|
const PLAN_PUBLISH_START_REJECTED_DETAIL =
|
|
356
357
|
"First Draft rejected the publication request.";
|
|
357
358
|
const PLAN_PUBLISH_STATUS_UNAVAILABLE_DETAIL =
|
|
358
|
-
"Could not read the retained Publication status. The command stopped without starting another Publication. Do not run concurrent Compile commands. Wait, then rerun 'firstdraft plan compile' with unchanged Plan bytes to safely resume the retained singleton.";
|
|
359
|
+
"Could not read the retained Publication status. The command stopped without starting another Publication. Do not run concurrent Compile commands. Wait, then rerun 'firstdraft plan compile --github' with unchanged Plan bytes to safely resume the retained singleton.";
|
|
359
360
|
const PLAN_PUBLISH_STATUS_INVALID_DETAIL =
|
|
360
361
|
"First Draft returned an invalid publication status response. Retrying unchanged will not repair this protocol mismatch.";
|
|
361
362
|
const PLAN_PUBLISH_CHANGED_DETAIL =
|
|
362
363
|
"The pinned Publication changed while being polled. The command stopped without following a replacement.";
|
|
363
364
|
const PLAN_PUBLISH_TIMEOUT_DETAIL =
|
|
364
|
-
"The retained Publication is still processing after the bounded ten-minute wait. This invocation stopped waiting, but retained work may continue. Do not run concurrent Compile commands. Wait, then rerun 'firstdraft plan compile' with unchanged Plan bytes to safely resume the retained singleton.";
|
|
365
|
+
"The retained Publication is still processing after the bounded ten-minute wait. This invocation stopped waiting, but retained work may continue. Do not run concurrent Compile commands. Wait, then rerun 'firstdraft plan compile --github' with unchanged Plan bytes to safely resume the retained singleton.";
|
|
365
366
|
const PLAN_PUBLISH_FAILED_DETAIL =
|
|
366
367
|
"The pinned Publication failed. Its validated status identifies the failed phase.";
|
|
367
368
|
const PLAN_PUBLISH_CANCELLED_DETAIL = "The pinned Publication was cancelled.";
|
|
@@ -1527,6 +1528,7 @@ async function runPlanCompile({
|
|
|
1527
1528
|
args: [...argv],
|
|
1528
1529
|
options: {
|
|
1529
1530
|
output: { type: "string" },
|
|
1531
|
+
github: { type: "boolean" },
|
|
1530
1532
|
help: { type: "boolean", short: "h" },
|
|
1531
1533
|
},
|
|
1532
1534
|
allowPositionals: false,
|
|
@@ -1548,8 +1550,8 @@ async function runPlanCompile({
|
|
|
1548
1550
|
return 0;
|
|
1549
1551
|
}
|
|
1550
1552
|
|
|
1551
|
-
const output = parsed.values
|
|
1552
|
-
if (output !== undefined && output.length === 0) {
|
|
1553
|
+
const { output, github } = parsed.values;
|
|
1554
|
+
if (output !== undefined && (output.length === 0 || github)) {
|
|
1553
1555
|
writeJson(stderr, {
|
|
1554
1556
|
error: "invalid_arguments",
|
|
1555
1557
|
detail: PLAN_COMPILE_INVALID_ARGUMENTS_DETAIL,
|
|
@@ -1577,11 +1579,11 @@ async function runPlanCompile({
|
|
|
1577
1579
|
readStatus: planCompileReadStatus,
|
|
1578
1580
|
onProgress: reportProgress,
|
|
1579
1581
|
};
|
|
1580
|
-
if (
|
|
1582
|
+
if (!github) {
|
|
1581
1583
|
try {
|
|
1582
1584
|
const result = await compilePlanToDirectory({
|
|
1583
1585
|
...shared,
|
|
1584
|
-
output,
|
|
1586
|
+
output: output ?? ".",
|
|
1585
1587
|
compilationSleep,
|
|
1586
1588
|
compilationNow,
|
|
1587
1589
|
compile: planCompileDownload,
|
|
@@ -1594,7 +1596,7 @@ async function runPlanCompile({
|
|
|
1594
1596
|
}
|
|
1595
1597
|
|
|
1596
1598
|
try {
|
|
1597
|
-
const result = await
|
|
1599
|
+
const result = await compilePlanToGitHub({
|
|
1598
1600
|
...shared,
|
|
1599
1601
|
publicationSleep: planPublishSleep,
|
|
1600
1602
|
publicationNow: planPublishNow,
|
|
@@ -80,7 +80,7 @@ export class PlanCompileAnalysisInvalidError extends Error {
|
|
|
80
80
|
*
|
|
81
81
|
* @param {CompilePlanOptions} options
|
|
82
82
|
*/
|
|
83
|
-
export async function
|
|
83
|
+
export async function compilePlanToGitHub({
|
|
84
84
|
cwd,
|
|
85
85
|
apiUrl,
|
|
86
86
|
fetchFunction,
|
|
@@ -134,8 +134,8 @@ export async function compilePlan({
|
|
|
134
134
|
/**
|
|
135
135
|
* Submit and analyze the exact current local Plan, then start one direct
|
|
136
136
|
* Compilation and materialize its verified artifact into an absent directory
|
|
137
|
-
* or the eligible current directory. GitHub Publication
|
|
138
|
-
* mode owned by
|
|
137
|
+
* or the eligible current directory. GitHub Publication is the explicit
|
|
138
|
+
* --github mode owned by compilePlanToGitHub.
|
|
139
139
|
*
|
|
140
140
|
* @param {CompilePlanToDirectoryOptions} options
|
|
141
141
|
*/
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
export const ARTIFACT_MEDIA_TYPE =
|
|
27
27
|
"application/vnd.firstdraft.compilation-artifact+json";
|
|
28
28
|
export const ARTIFACT_FORMAT = "firstdraft.compilation-artifact/1";
|
|
29
|
-
export const FOUNDATION_PLAN_FORMAT = "firstdraft.foundation-plan.sketch/0.
|
|
29
|
+
export const FOUNDATION_PLAN_FORMAT = "firstdraft.foundation-plan.sketch/0.22";
|
|
30
30
|
export const RAILS_TARGET_PROFILE = "rails-sketch/2026-09";
|
|
31
31
|
export const MAX_ARTIFACT_BYTES = 128 * 1024 * 1024;
|
|
32
32
|
|