@firstdraft.com/cli 0.3.0 → 0.4.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 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
- Trying First Draft as a tester? Start with the
8
- [Drawing Board guide](https://github.com/firstdraft/drawing-board#build-an-app-with-first-draft), which installs a
9
- compatible CLI and Skill together.
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 makes `--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 release promotion.
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 promote a package | [Release runbook](RELEASING.md) |
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 promotion meaning.
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. Publishing a candidate, moving npm dist-tags, coordinating the Skills
105
- package, and promoting a stable release are distinct steps in [RELEASING.md](RELEASING.md). Verify the exact packed
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,107 @@
1
1
  # Releasing First Draft CLI
2
2
 
3
- This document owns living release policy and the operator runbook. Dated tag, package, qualification, and dist-tag
4
- observations belong in [release history](docs/release-history.md) and must be rechecked before an operation.
5
-
6
- Publishing is a separate, explicit action after a release-preparation pull request has merged. npm registry bytes
7
- and package versions cannot be replaced, so do not create or push a release tag as a dry run.
8
-
9
- Only a version that npm reports as published or a protected release tag that exists is immutable. Before either
10
- exists, an unpublished candidate may be revised without changing its proposed version; its exact source SHA and
11
- reviewed digests identify it. Reconcile the registry and remote tags before deciding that a version was consumed.
12
-
13
- ## Pre-1.0 version and channel policy
14
-
15
- Before `1.0.0`, First Draft CLI uses ordinary `0.MINOR.PATCH` versions. Increase `MINOR` for a breaking
16
- compatibility-line change. Increase `PATCH` for a change that is otherwise backward-compatible within the current
17
- minor line. Never reuse a published version to preserve compatibility; publish the next version required by this
18
- policy. Do not add aliases or shims solely to make a breaking compatibility line look patch-compatible. The policy
19
- applies to ordinary versions; historical prereleases do not establish an ordinary compatibility line.
20
-
21
- Version semantics and npm distribution channels are independent. An approved candidate is published first under
22
- the approval-gated `next` tag even when it has an ordinary version such as `0.1.0`. The release workflow does not
23
- move `latest`. Moving `latest` requires a later, separate approval after the exact `next` candidate has completed
24
- its explicitly named release-specific qualification. Candidate publication is not stable release completion. A
25
- stable CLI release is complete only when that separately approved candidate is selected by npm's `latest` dist-tag.
26
- Release-specific qualification means the exact gate named for that candidate; it does not imply unrelated or full
27
- service qualification. Until promotion, `latest` remains the supported stable release; a distinct `next` candidate
28
- is supported only for its named qualification. When both tags identify one version, that version fills both roles.
29
-
30
- ## Coordinated candidate eligibility
31
-
32
- `release/compatibility.json` declares this package's SemVer version, the First Draft API-contract range it accepts,
33
- and the exact Foundation Plan formats it accepts. It is source-only release metadata and is intentionally absent from
34
- the npm tarball. The normal test suite validates the manifest's shape, keeps its version equal to `package.json`, and
35
- binds its Foundation Plan format to the implemented CLI constant.
36
-
37
- The `script/release_compatibility_check` evaluator in `firstdraft/firstdraft` reads this declaration with the matching
38
- declarations from exact, clean checkouts of `firstdraft/firstdraft` and `firstdraft/skills`. It implements SemVer 2.0
39
- precedence. CLI `0.2.x` requires the service's `0.3.x` API contract because Analysis now returns the complete reviewed
40
- GapSet and digest. The released CLI `0.1.0` accepts only API `0.2.x`, uses a generic 2 MiB response bound for Analysis,
41
- and cannot safely consume every schema-valid API `0.3.x` result. CLI `0.2.x` retains that generic bound but gives
42
- Analysis and Compilation artifacts dedicated 128 MiB bounds. CLI `0.3.x` retains those bounds and requires API
43
- `0.4.x`, Plan `firstdraft.foundation-plan.sketch/0.20`, and target profile `rails-sketch/2026-09`. Its new minor line
44
- combines that contract transition with the incompatible root archive-path change to `.firstdraft/design`; Skills
45
- and other callers require the matching CLI line. Existing applications are not migrated.
46
-
47
- The API `0.4.x` transition keeps `/v1` paths, authentication, statuses, and ETag behavior. Its breaking boundary is
48
- the new Plan and target identity, including removal of record-wide Validation targets, normalization order,
49
- optional Home selection, and target realization changes. The Service owns those semantics. The CLI initializes
50
- the current identity, preserves authored bytes when pushing, and validates the current artifact identity; it does
51
- not translate earlier Plans or artifacts. The proposed CLI `0.3.0` may retain that version while unpublished and
52
- untagged under the policy above. This source declaration does not establish package availability or deployment.
53
-
54
- Comparator arrays form one conjunction, while
55
- `foundation_plan_formats` lists alternatives. A prerelease satisfies a comparator set only when a comparator
56
- explicitly names a prerelease with the same major, minor, and patch numbers. Skills names the candidate CLI version
57
- explicitly, so a stale comparator makes the three-repository candidate ineligible.
58
- `firstdraft.release-compatibility/1` is intentionally closed. The evaluator in `firstdraft/firstdraft` rejects an
59
- unrecognized format and unknown keys, so adding a key requires a coordinated compatibility-format bump rather than
60
- silently changing version 1.
61
-
62
- A compatible result establishes candidate eligibility, not authorization or runtime proof. Exact Git SHAs identify
63
- the three-repository candidate. A merge to `main` is integration only: report the merged SHA and ask the user whether
64
- to coordinate the three repositories and promote that candidate. If promotion is declined, record the SHA as
65
- unpromoted.
66
-
67
- Promotion is manual and approval-gated. One operator serializes mutations: qualify the exact candidate on staging,
68
- obtain human approval, and only then promote the approved service revision to production or authorize the
69
- corresponding npm and plugin releases. Do not publish npm, deploy either environment, or release the plugin merely
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.4.x` makes `firstdraft plan compile` equivalent to `firstdraft plan compile --output .`; the former GitHub
20
+ default becomes explicit `--github`. This is a breaking CLI change from `0.3.x`, without a Service API change.
21
+ Both lines use API `0.4.x`, Plan `firstdraft.foundation-plan.sketch/0.20`, target `rails-sketch/2026-09`, and the
22
+ `.firstdraft/design` root archive. Existing applications and old Plans are not migrated.
23
+
24
+ `release/compatibility.json` declares the package version, accepted API-contract range, and accepted Plan formats.
25
+ It is source-only metadata, validated by the normal test suite and absent from the npm tarball. Coordinate the
26
+ explicit CLI comparator and bundled CLI pin in `firstdraft/skills` when this version changes. The service's
27
+ `script/release_compatibility_check` compares the three exact revisions; compatibility establishes eligibility,
28
+ not authorization or runtime proof. Its closed `firstdraft.release-compatibility/1` format rejects unknown keys.
29
+
30
+ ## Prepare before merge
31
+
32
+ 1. Update `package.json`, `package-lock.json`, and `release/compatibility.json`, and align the Skills CLI requirement.
33
+ 2. Update the command, error, and Skill guidance affected by the change. Preserve dated release evidence.
34
+ 3. Run focused checks while developing and the repository's required CI for the merge candidate. For a fresh
35
+ checkout, the complete local check is `npm ci --ignore-scripts`, `npm audit`, then `npm run check`.
36
+ 4. Review and merge the change. Wait for the existing `CI` workflow to pass for the selected `main` SHA; publication
37
+ uses that run instead of starting another one.
38
+
39
+ Use existing smoke evidence when it covers the changed behavior. If changed CLI/Service/Skill behavior warrants a
40
+ live smoke, use a simple Plan, compile locally with `firstdraft plan compile --output .`, and boot the generated app locally
41
+ when runtime behavior changed. A CLI dispatch-only change can be covered by local command and packed-package tests.
42
+ Do not require Codespaces, GitHub Publication, native builds, or Revyl for a routine release. Codespaces is a fallback
43
+ development environment. Additional integration checks belong only to changes affecting those integrations.
44
+
45
+ ## Publish the approved source
46
+
47
+ From a clean checkout of the selected `main` revision:
48
+
49
+ 1. Confirm the exact package version and `v<package-version>` tag are both unused. If either identity is already
50
+ consumed, prepare the next version required by the pre-1.0 policy rather than moving or reusing it.
51
+ 2. Confirm the intended three revisions are compatible and the coordinated release approval covers them.
52
+ 3. Create and push `v<package-version>` at that source revision. Push one release tag at a time; the workflow
53
+ serializes publication and GitHub retains at most one pending run in a concurrency group.
54
+ 4. Approve the existing `npm` environment deployment for that tag. The workflow publishes with provenance under
55
+ `latest`; no separate dist-tag mutation is needed.
56
+
57
+ The workflow requires a protected `v*` tag in `firstdraft/cli`, the matching `package.json` version, an unchanged
58
+ remote tag, and a commit in the first-parent history of protected `main`. It finds a successful `CI` push run for
59
+ that exact SHA using `gh run list`, checks the package file allowlist, then rechecks mutable refs after environment
60
+ approval. It does not install development dependencies, rerun tests or audit, or request interactive npm login.
61
+ Both source checks invoke `scripts/check-release-source.sh`; the postapproval invocation must remain before publish.
62
+
63
+ If CI is still running, let that run finish and rerun the failed publication verification job. Resolve failing
64
+ checks in CI itself; publication does not start a duplicate suite. A source fix after tagging requires a new version.
65
+ Do not retest unrelated surfaces merely because time has passed since merge.
180
66
 
181
67
  ## Verify and recover
182
68
 
183
- After publication, inspect the registry before retrying any reported failure; the package may already exist. From
184
- the tagged checkout, verify the exact version, `next` dist-tag, unchanged `latest` dist-tag, integrity metadata, and
185
- provenance metadata:
69
+ After publication, inspect the registry before retrying a failed workflow; the immutable version may already exist:
186
70
 
187
71
  ```sh
188
72
  FD_CLI_RELEASE_VERSION="$(node -p "require('./package.json').version")"
189
73
  npm view "@firstdraft.com/cli@$FD_CLI_RELEASE_VERSION" \
190
- version dist.integrity dist.shasum repository.url engines bin --json
74
+ version dist.integrity dist.shasum dist.attestations repository.url engines bin --json
191
75
  npm dist-tag ls '@firstdraft.com/cli'
192
76
  ```
193
77
 
194
- Install that exact version into a fresh temporary prefix, confirm `firstdraft --version`, compare the
195
- packed file list with the release workflow, and run `npm audit signatures` after an exact installation.
78
+ Confirm the intended version is `latest` and has integrity/provenance metadata. Install that exact version in a
79
+ temporary prefix, confirm `firstdraft --version`, and run `npm audit signatures` there to verify the published
80
+ artifact. This checks distribution; it does not repeat application qualification. Record the version, source,
81
+ package integrity, and any relevant smoke evidence in the dated release record.
196
82
 
197
- If OIDC authentication fails, reconcile both the registry version and protected remote tag first. If only npm's
198
- listed relationship is wrong, correct it on npm and rerun the existing workflow's failed jobs without changing the
199
- tagged source. If the workflow filename, environment, permissions, or other identity at the tagged commit is wrong,
200
- the protected tag is immutable: prepare the next version rather than moving the tag. Never add a token fallback.
83
+ If OIDC authentication fails, reconcile the registry version and protected tag before retrying. Correct a broken
84
+ trusted-publisher relationship when necessary, then rerun failed jobs at the existing tag. If the tagged workflow
85
+ identity itself is wrong, prepare a new version; never move the tag or add a persistent-token fallback.
201
86
 
202
- A published version cannot be overwritten or reused. For a bad release, move `next` only to a known-good compatible
203
- version if one exists; otherwise deprecate the bad version and publish a corrected higher version. Treat
204
- unpublishing as an exceptional incident response, not a routine rollback.
87
+ For a bad release, move `latest` to a known-good compatible version as an incident rollback, or deprecate the bad
88
+ version and publish a corrected higher version. Unpublishing is exceptional incident response, not routine rollback.
205
89
 
206
- ## Promote the release-specific qualified candidate
90
+ ## Publisher configuration
207
91
 
208
- Publishing under `next` is not promotion to the default install channel. After the exact `next` version completes
209
- its named release-specific qualification and a human separately approves promotion, one operator may move `latest`
210
- to that exact version from the tagged checkout:
92
+ These are durable repository and npm controls, not a per-release account audit. Verify them when provisioning,
93
+ changing publisher configuration, or diagnosing an actual failure:
211
94
 
212
- ```sh
213
- FD_CLI_RELEASE_VERSION="$(node -p "require('./package.json').version")"
214
- npm dist-tag add "@firstdraft.com/cli@$FD_CLI_RELEASE_VERSION" latest
215
- npm dist-tag ls '@firstdraft.com/cli'
216
- ```
95
+ - `firstdraft/cli` is public; `main` requires pull requests and CI, and a `v*` ruleset restricts tag mutation.
96
+ - The `npm` GitHub environment is limited to release tags, requires its existing reviewer, disables administrator
97
+ bypass, and defines `NPM_RELEASE_ENABLED=true`.
98
+ - npm trusted publishing identifies package `@firstdraft.com/cli`, repository `firstdraft/cli`, workflow
99
+ `publish.yml`, environment `npm`, and permission `createPackage`. The publishing account retains the intended
100
+ organization access and write-protecting 2FA. Configure these with an administrator only when needed.
101
+ - Publication runs on a GitHub-hosted runner with `id-token: write`, pinned Node.js 24.18.0 and npm 11.16.0. npm's
102
+ short-lived OIDC exchange is the only publication credential; no persistent npm token or Actions secret is used.
103
+ The CI lookup uses GitHub's read-only workflow token.
217
104
 
218
- Verify both tags after the mutation, then append the exact dated observation and qualification boundary to
219
- [release history](docs/release-history.md). The stable CLI release is complete only after `next` and `latest` both
220
- name the exact release-specific qualified version. Do not call a candidate fully promoted before that equality is
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.
105
+ Ordinary installation and use require no npm login. Ordinary trusted publication requires no local maintainer
106
+ login or per-release security-key ceremony. Request npm interaction only when npm requires it for a governance
107
+ 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
- During coordinated trials, the stable release currently identified by npm's `latest` tag receives security fixes. A
10
- different version under the approval-gated `next` tag is supported only for its explicitly named release-specific
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
- | If the task concerns... | Read first |
7
- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
8
- | Beginner tester journey | [Drawing Board guide](https://github.com/firstdraft/drawing-board#build-an-app-with-first-draft) |
9
- | Direct CLI installation, repository orientation, or package contract | [Root README](../README.md) |
10
- | Commands, options, environment variables, API behavior, output, or materialization | [Command reference](commands.md) |
11
- | Stable errors, exit codes, retry safety, ambiguous outcomes, or local recovery | [Errors and recovery](errors.md) |
12
- | Version policy, release preparation, publication, verification, rollback, or promotion | [Release policy and runbook](../RELEASING.md) |
13
- | What was observed for an earlier tag, package, or dist-tag | [Release history](release-history.md) |
14
- | Vulnerability reporting | [Security policy](../SECURITY.md) |
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, access, and trusted-publisher state before relying on them operationally.
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,9 +3,9 @@
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.3.x` source line contains the auditable command shell, local Foundation Plan initialization, local
6
+ The current `0.4.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.3.x`
8
+ Compile-and-materialize and private publish orchestration, and retained-Compilation inspection. CLI `0.4.x`
9
9
  requires the service's `0.4.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
 
@@ -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 or publish |
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
 
@@ -134,14 +135,20 @@ a bounded number of times because the command sends only `GET` requests. See
134
135
 
135
136
  ## Compile the current Plan
136
137
 
137
- To compile into a local application directory, run:
138
+ Compile into the current local folder:
138
139
 
139
140
  ```sh
140
- firstdraft plan compile --output ./application
141
+ firstdraft plan compile
141
142
  ```
142
143
 
144
+ This is equivalent to `firstdraft plan compile --output .`. Use `--output ./application` for another absent
145
+ directory, or `--github` to publish to a private GitHub repository. `--github` and `--output` are mutually exclusive.
146
+ No GitHub connection, repository clone, or push is required for local compilation. Compilation runs on the First
147
+ Draft service; output and the application runtime are local. CLI `0.3.x` used GitHub Publication as its default;
148
+ scripts that require that behavior must add `--github` when upgrading to `0.4.x`.
149
+
143
150
  Both `plan compile` modes first push the exact current bytes in
144
- `.firstdraft/foundation-plan.json`, even when those bytes are unchanged, and saves the accepted ETag using the same
151
+ `.firstdraft/foundation-plan.json`, even when those bytes are unchanged, and save the accepted ETag using the same
145
152
  contract as `plan push`. It then waits up to two minutes for an analysis whose graph version and
146
153
  `head_source_sha256` exactly match that accepted push, polling past a terminal result retained for an older Head.
147
154
  Invalid JSON, schema diagnostics, semantic diagnostics, a failed analysis, a superseded analysis, or a recurring
@@ -154,21 +161,21 @@ the accepted source SHA-256 from the saved ETag, hashes the current local bytes,
154
161
 
155
162
  ### Materialize a direct Compilation
156
163
 
157
- With `--output`, the CLI accepts either an explicit absent destination beneath an existing real directory or a path
164
+ Without `--github`, the CLI accepts either an explicit absent destination beneath an existing real directory or a path
158
165
  that resolves to the physical current directory. It validates either destination before pushing the Plan. An absent
159
166
  destination is checked again after analysis; root adoption instead holds its owned lock and performs the exact
160
167
  pre-move identity recheck described below. Other existing destinations remain invalid, so
161
168
  `--output ./application` retains its absent-directory contract.
162
169
 
163
- The nested archive layout below describes the unreleased `0.3.0` candidate.
170
+ The nested archive layout below is shared by CLI `0.3.x` and `0.4.x`.
164
171
  [Published CLI `0.2.2`](release-history.md#022-publication-and-registry-observation) archives at top-level `design/`;
165
172
  existing applications are not migrated automatically.
166
173
 
167
- `--output .` is the noninteractive root-adoption mode. `./`, an absolute spelling of the current directory, and
174
+ The default `--output .` is the noninteractive root-adoption mode. `./`, an absolute spelling of the current directory, and
168
175
  another spelling that resolves to that same physical directory select the same mode. It works at any real current
169
176
  directory that meets the preconditions below and does not recognize Drawing Board or another repository layout
170
- specially. This first root-adoption contract supports POSIX filesystems; Windows retains absent-directory output
171
- and refuses root adoption as `root_platform_unsupported`. Before starting Compilation, the CLI requires:
177
+ specially. Root adoption supports POSIX filesystems; on Windows, use `--output ./application` because current-folder
178
+ output returns `root_platform_unsupported`. Before starting Compilation, the CLI requires:
172
179
 
173
180
  - the current directory to be a real, writable, non-filesystem-root directory;
174
181
  - no existing `.firstdraft/design` archive or top-level `.firstdraft-root-output` transaction path, including
@@ -274,10 +281,10 @@ only.
274
281
 
275
282
  ### Publish through GitHub
276
283
 
277
- Without `--output`, the existing GitHub Publication journey remains unchanged:
284
+ Use the explicit GitHub option for the Publication journey:
278
285
 
279
286
  ```sh
280
- firstdraft plan compile
287
+ firstdraft plan compile --github
281
288
  ```
282
289
 
283
290
  Invoking this form authorizes the internal GitHub Publication lifecycle. The command writes stable human-readable
@@ -312,8 +319,8 @@ exact Plan push and valid Analysis.
312
319
  ## Inspect a retained Compilation
313
320
 
314
321
  These lower-level commands are for callers that already hold a retained Compilation ID from authenticated API
315
- metadata or operational tooling. The no-output `plan compile` form prints only the final repository URL, while
316
- `plan compile --output` waits for and downloads its own direct Compilation:
322
+ metadata or operational tooling. `plan compile --github` prints only the final repository URL, while the default
323
+ `plan compile` form waits for and downloads its own direct Compilation:
317
324
 
318
325
  ```sh
319
326
  firstdraft compilation status 01900000-0000-7000-8000-000000000001
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 direct `--output` Compilation may have started, but its retained identity is unknown.
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 --output`, which
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 --output` after its Compilation start was accepted or may have been accepted.
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 --output`. `compilation_failed`, `compilation_cancelled`, and `compilation_changed` already carry the
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 --output` | `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 --output` | `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` | `publication_start_rejected`, `publication_status_unavailable`, `invalid_publication_status` | 1 | Publication start or status failed its validated transport contract. |
129
- | `plan compile` | `publication_changed`, `publication_wait_timed_out`, `publication_failed`, `publication_cancelled` | 1 | The pinned Publication changed, timed out, or reached a non-success terminal state. |
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firstdraft.com/cli",
3
- "version": "0.3.0",
3
+ "version": "0.4.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": "next"
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
- compilePlan,
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 the generated application here
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. Without --output, it conditionally
196
- creates or replays the internal GitHub Publication lifecycle and prints the
197
- private repository URL. With --output, it starts one direct Compilation and
198
- atomically materializes the verified artifact into an absent directory, or
199
- preserves existing root material under .firstdraft/design when the output is ., without
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 --output' or start another Compilation until the current Project is reconciled.";
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 --output' or start another Compilation.";
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.output;
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 (output !== undefined) {
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 compilePlan({
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 compilePlan({
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 remains the no-output
138
- * mode owned by compilePlan.
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
  */