code-foundry 1.20.2 → 1.25.3

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.
Files changed (50) hide show
  1. package/.github/CONTRIBUTING.md +5 -2
  2. package/.github/code-foundry.yml +1 -0
  3. package/.github/release-please-foundry.json +56 -0
  4. package/.github/workflows/cloudflare-delivery.yml +9 -0
  5. package/.github/workflows/cloudflare-deploy.yml +8 -1
  6. package/.github/workflows/eval.yml +116 -0
  7. package/.github/workflows/opencode-security_self-ci.yml +1 -1
  8. package/.github/workflows/qualified-foundry-publish.yml +6 -7
  9. package/.github/workflows/release.yml +58 -10
  10. package/.github/workflows/release_self-ci.yml +211 -8
  11. package/.github/workflows/validation-no-codeql.yml +34 -6
  12. package/.github/workflows/validation.yml +32 -5
  13. package/.github/workflows/validation_audit_self-ci.yml +1 -0
  14. package/.github/workflows/validation_self-ci.yml +1 -0
  15. package/.gitignore +1 -1
  16. package/AGENTS.md +5 -1
  17. package/CHANGELOG.md +95 -0
  18. package/README.md +23 -17
  19. package/docs/CONFIGURATION.md +189 -152
  20. package/docs/EVALS.md +139 -0
  21. package/docs/EXTENSIONS.md +28 -7
  22. package/docs/INITIALIZATION.md +13 -9
  23. package/docs/PERFORMANCE.md +67 -59
  24. package/docs/PUBLISHING.md +39 -14
  25. package/docs/README.md +37 -22
  26. package/docs/RELEASES.md +18 -9
  27. package/docs/WORKFLOWS.md +23 -4
  28. package/docs/agent-validation.md +6 -5
  29. package/docs/cloudflare-delivery.md +20 -8
  30. package/docs/consumer-qualification.md +11 -9
  31. package/docs/fleet-release-eligibility.md +14 -15
  32. package/docs/fleet-rollouts.md +3 -3
  33. package/docs/merge-queues.md +21 -21
  34. package/docs/product-quality.md +9 -10
  35. package/docs/qualified-publication.md +166 -93
  36. package/docs/release-integrity.md +7 -6
  37. package/docs/required-capabilities.md +24 -15
  38. package/package.json +1 -1
  39. package/src/commands/cloudflare-delivery.mjs +6 -1
  40. package/src/commands/qualified-publication.mjs +103 -12
  41. package/src/commands/release-integrity.mjs +46 -14
  42. package/src/commands/sync.mjs +30 -24
  43. package/src/lib/eval-envelope.mjs +234 -0
  44. package/src/lib/merge-queue.mjs +1 -0
  45. package/src/lib/product-quality.mjs +220 -16
  46. package/src/lib/task-policy.mjs +7 -0
  47. package/src/lib/validation-policy.mjs +10 -6
  48. package/src/runtime-core.mjs +166 -8
  49. package/src/runtime.mjs +3 -1
  50. package/src/templates/gitignore +3 -1
@@ -1,22 +1,25 @@
1
1
  # Initialization and synchronization
2
2
 
3
- ## The two-command workflow
3
+ ## Initialize, synchronize, and diagnose
4
4
 
5
5
  Run these commands from a repository root:
6
6
 
7
- ```bash
7
+ ```sh
8
8
  npx code-foundry init
9
+ # review or edit .github/code-foundry.yml
9
10
  npx code-foundry sync
10
- npx code-foundry doctor
11
+ npx code-foundry doctor # optional local/GitHub prerequisite check
11
12
  ```
12
13
 
13
- `init` detects supported languages, package manager, repository profile,
14
- release strategy, toolchain preference, and standard features. It writes the resolved
14
+ `init` detects supported languages, package manager, repository profile, release
15
+ strategy, toolchain preference, and standard features. It writes the resolved
15
16
  choices to `.github/code-foundry.yml`, initializes the local environment, and
16
17
  renders the standard baseline.
17
18
 
18
- After reviewing or editing the configuration, run `sync` to apply it. Sync can
19
- be run at any time to pull in a newer runtime configured by `runtime_ref`.
19
+ After reviewing or editing the configuration, run `sync` to apply it. Run sync
20
+ again whenever `runtime_ref` changes or a newer reviewed runtime should be
21
+ adopted. `doctor` is an optional diagnostic pass; use `npx code-foundry doctor
22
+ --github` when authenticated GitHub prerequisite checks are also needed.
20
23
 
21
24
  ## Detection
22
25
 
@@ -25,8 +28,9 @@ manifests, lockfiles, source extensions, workspace metadata, and existing
25
28
  project scripts. The generated values are explicit, so later syncs are stable
26
29
  until a maintainer changes the file.
27
30
 
28
- New repositories receive the GNU GPLv3. Existing repositories with an authored
29
- `LICENSE` keep that license unless the generated configuration is changed.
31
+ New repositories receive GPL-3.0-or-later. Existing repositories with an
32
+ authored `LICENSE` keep that license unless the generated configuration is
33
+ changed.
30
34
 
31
35
  ## Runtime selection
32
36
 
@@ -1,66 +1,74 @@
1
1
  # Performance budgets and baselines
2
2
 
3
- Code Foundry measures its source runtime with `bun run performance:check`. The
4
- check writes `performance-results.json` for CI artifact upload and fails when a
5
- budget is exceeded. Generated reports are ignored by Git because measurements
6
- belong to the run that produced them, not the source tree.
3
+ Code Foundry measures its own runtime with `bun run performance:check`. The
4
+ check writes `performance-results.json` for artifact upload and fails when a
5
+ budget is exceeded. Reports are generated-run evidence and are ignored by Git.
7
6
 
8
7
  ## Enforced budgets
9
8
 
10
- | Metric | Budget | Why it is bounded |
11
- | ----------------------------------- | -----: | ---------------------------------------------------- |
12
- | CLI help startup p95 | 250 ms | Detect eager imports and startup regressions |
13
- | Runtime mode startup p95 | 250 ms | Detect baseline runtime initialization regressions |
14
- | Focused runtime tests | 10 s | Keep the representative runtime contract inexpensive |
15
- | Format, lint, type-check, and build | 15 s | Bound the local CI feedback loop |
16
- | Runtime dependencies | 0 | Keep the installed CLI dependency-free |
17
- | Development dependencies | 4 | Prevent unreviewed toolchain growth |
18
- | Packed artifact | 255 kB | Bound registry transfer and install cost |
19
- | Unpacked artifact | 965 kB | Bound installed footprint |
20
- | Packed files | 115 | Detect accidental release contents |
9
+ | Metric | Budget | Why it is bounded |
10
+ | ----------------------------------- | -------: | ---------------------------------------------------- |
11
+ | CLI help startup p95 | 250 ms | Detect eager imports and startup regressions |
12
+ | Runtime mode startup p95 | 250 ms | Detect baseline runtime initialization regressions |
13
+ | Focused runtime tests | 10 s | Keep the representative runtime contract inexpensive |
14
+ | Format, lint, type-check, and build | 15 s | Bound the local CI feedback loop |
15
+ | Runtime dependencies | 0 | Keep the installed CLI dependency-free |
16
+ | Development dependencies | 4 | Prevent unreviewed toolchain growth |
17
+ | Packed artifact | 260 kB | Bound registry transfer and install cost |
18
+ | Unpacked artifact | 1,000 kB | Bound installed footprint |
19
+ | Packed files | 115 | Detect accidental release contents |
20
+
21
+ The source-of-truth budgets live in `scripts/performance-check.mjs`. When those
22
+ limits change, update this table and include before/after measurements in the
23
+ same change. The Cloudflare delivery and qualified-publication changes in this release
24
+ moved the measured artifact from 990,481 to 994,555 unpacked bytes (257,384 to
25
+ 258,647 packed bytes, with 112 files in both measurements). Draft protection
26
+ configuration, reusable-workflow inputs, documentation, and regression tests
27
+ increased the measured artifact to 998,348 unpacked bytes (259,532 packed bytes,
28
+ with 112 files). The unpacked budget is therefore 1,000 kB; the packed and
29
+ file-count budgets remain unchanged.
21
30
 
22
31
  The performance workflow disables build-cache reads and writes for this task.
23
- That makes timing comparisons independent of a warm protected-branch cache and
24
- prevents benchmark code from populating shared cache entries.
25
-
26
- The merged candidate includes the release-integrity verifier, fleet eligibility,
27
- consumer qualification harness, product-quality profiles, qualified publication
28
- workflow, and opt-in merge-queue verifier. It measured 248,464 packed bytes,
29
- 947,310 unpacked bytes, and 111 files on Node 24.18.0; the 255 kB, 965 kB, and
30
- 115-file limits retain a small margin while continuing to bound package growth.
31
-
32
- ## v1.6.1 baseline
33
-
34
- Measurements were taken on 2026-09-08 with Node 24.18.0. Process startup used
35
- 30 measured samples after four warmups; before and after samples were
36
- interleaved on the same host.
37
-
38
- | Measurement | Before | After | Change |
39
- | -------------------------- | -------: | ----------------------: | -------: |
40
- | CLI help median | 36.11 ms | 29.57 ms | -18.1% |
41
- | CLI help p95 | 38.11 ms | 31.56 ms | -17.2% |
42
- | Runtime mode median | - | 35.94 ms | baseline |
43
- | Focused runtime tests | - | 2.08 s | baseline |
44
- | Local CI checks | - | 0.50 s | baseline |
45
- | Packed / unpacked artifact | - | 160,114 / 616,887 bytes | baseline |
46
- | Packed files | - | 74 | baseline |
47
-
48
- The startup reduction comes from loading command implementations only after
49
- argument parsing selects a command. `--help` no longer imports sync, release,
50
- fleet, doctor, and CI command modules.
51
-
52
- The first isolated full hosted audit completed in 3 minutes 2 seconds. Its
53
- longest jobs were TypeScript CodeQL (66 s), dependency audit (62 s), and unit
54
- tests (46 s); all other suite jobs completed in 20 seconds or less. Those
55
- measurements identify the three lanes to optimize before adding more CI fanout.
56
-
57
- ## Release path
58
-
59
- Treat budget changes like source changes: explain the measured reason in a
60
- pull request, run the complete validation gate, and merge only when the new
61
- result artifact is available. A Release Please PR then carries the change into
62
- the next version. Never raise a budget solely to clear CI; include before/after
63
- measurements and the expected effect on local feedback, hosted runner time,
64
- package transfer, or installed footprint. The current budget covers the measured
65
- combined release-integrity, fleet, consumer-qualification, and product-quality
66
- package footprint described above.
32
+ Timing comparisons therefore do not depend on a warm protected-branch cache, and
33
+ benchmark code cannot populate shared cache entries.
34
+
35
+ ## Package profile
36
+
37
+ The reusable performance job also supports the opt-in `node-package` profile.
38
+ Configure it in `.github/code-foundry.yml`:
39
+
40
+ ```yaml
41
+ performance: true
42
+ performance_profile: node-package
43
+ performance_budget_file: performance-package-budgets.json
44
+ ```
45
+
46
+ The profile measures cold imports, memory, package size, file counts, and
47
+ production dependency count according to a repository-owned JSON budget file.
48
+ It writes `performance-results/node-package.json`. Every run also writes
49
+ `performance-results/summary.json`, which records repository-owned commands and
50
+ configured performance commands under one stable artifact contract.
51
+
52
+ ## Native Rust test batching
53
+
54
+ Each Rust test category invokes Cargo once with tracked targets: unit tests use
55
+ `--lib`/`--bin <package>`, while integration, E2E, and smoke tests use repeated
56
+ `--test <target>` arguments. Cargo shares setup without competing processes.
57
+
58
+ Discovery, category boundaries, fallback behavior, scripts, Python checks, flags,
59
+ and receipts remain unchanged. `--tests` and `--all-targets` stay avoided to
60
+ prevent broader or repeated coverage. Measure cold and warm runs, including
61
+ compilation and cache transfer, before claiming a speedup.
62
+
63
+ ## Changing a budget
64
+
65
+ Treat budget changes like source changes:
66
+
67
+ 1. capture before/after measurements;
68
+ 2. explain the effect on local feedback, runner time, package transfer, or
69
+ installed footprint;
70
+ 3. run the complete validation gate; and
71
+ 4. inspect the resulting performance artifact.
72
+
73
+ Never raise a limit solely to clear CI. Keep network-dependent checks, live
74
+ endpoints, and post-deployment probes in separate repository-owned workflows.
@@ -1,13 +1,21 @@
1
1
  # Publishing packages
2
2
 
3
- ## npm
3
+ Code Foundry separates versioning, GitHub Releases, and registry publication.
4
+ Choose the release path that matches the repository:
5
+
6
+ - **Generated consumer caller:** Release Please creates the GitHub Release and
7
+ the standard `release.yml` job can publish npm when `npm_publish: true`.
8
+ - **Code Foundry itself:** `release_self-ci.yml` qualifies the package, stages
9
+ the exact archive on an immutable draft release, and delegates final npm
10
+ publication to `qualified-foundry-publish.yml`.
11
+
12
+ ## npm publication for consumer repositories
4
13
 
5
14
  Set `npm_publish: true` only when the repository owns an npm package. Configure
6
- npm trusted publishing for the repository's `release.yml` workflow whenever
7
- possible. An `NPM_TOKEN` secret is the fallback for registries or repositories
8
- that cannot use trusted publishing.
15
+ npm trusted publishing for the generated `release.yml` workflow whenever
16
+ possible. Use an `NPM_TOKEN` secret only when trusted publishing is unavailable.
9
17
 
10
- The package should define its intended visibility explicitly:
18
+ Declare the package's intended visibility explicitly:
11
19
 
12
20
  ```json
13
21
  {
@@ -22,26 +30,43 @@ publish. The release workflow fails clearly when npm publication is enabled but
22
30
  neither trusted publishing nor a token is configured.
23
31
 
24
32
  After enabling publication, make one controlled release and verify both the
25
- registry version and the provenance link before treating the repository as
26
- fully configured.
33
+ registry version and its provenance link before treating the setup as complete.
34
+
35
+ ## Code Foundry's qualified publication
36
+
37
+ The self-hosted package follows a stricter contract than generated consumer
38
+ callers:
39
+
40
+ 1. Pack the candidate once and qualify that archive across Node 20, 22, and 24.
41
+ 2. Create a draft GitHub Release and attach the exact qualified archive plus its
42
+ qualification receipt.
43
+ 3. Publish the immutable GitHub Release after verifying the tag, source commit,
44
+ archive digest, immutable-release setting, and qualification reports.
45
+ 4. Publish the already-qualified archive through the qualified publisher using npm
46
+ trusted publishing or the optional token fallback.
47
+
48
+ The final publisher does not rebuild or reinstall the package. It publishes only
49
+ the bytes selected from the same workflow run and attempt. See [Consumer
50
+ qualification](consumer-qualification.md) and [Qualified publication](qualified-publication.md)
51
+ for the complete contract, retries, and recovery rules.
27
52
 
28
53
  ## GitHub Releases and GitHub Packages
29
54
 
30
- A GitHub Release is release metadata attached to a Git tag. It is independent
31
- of the npm registry and of GitHub Packages.
55
+ A GitHub Release is metadata attached to a Git tag. It is independent of npm and
56
+ of GitHub Packages.
32
57
 
33
- Publishing to npm does not populate the repository's GitHub Packages section.
34
- If a repository also needs a GitHub Container Registry or npm-compatible
35
- GitHub Package, add a repository-owned publishing workflow and credentials;
36
- that is an optional extension rather than part of the universal baseline.
58
+ Publishing to npm does not populate the repository's GitHub Packages section. If
59
+ a repository also needs GitHub Container Registry or an npm-compatible GitHub
60
+ Package, add a repository-owned publishing workflow and credentials.
37
61
 
38
62
  ## Provenance and verification
39
63
 
40
64
  Prefer trusted publishing because it provides short-lived credentials and
41
65
  provenance. After a release, verify:
42
66
 
43
- ```bash
67
+ ```sh
44
68
  npm view PACKAGE_NAME version dist-tags
69
+ # Replace VERSION with the published tag.
45
70
  gh release view vVERSION
46
71
  ```
47
72
 
package/docs/README.md CHANGED
@@ -1,27 +1,42 @@
1
1
  # Documentation
2
2
 
3
- These guides describe the reusable repository baseline in provider-neutral
4
- terms. They are suitable for copying into another repository and adapting with
5
- its own names, environments, and deployment details.
6
-
7
- ## Guides
8
-
9
- - [Initialization and synchronization](INITIALIZATION.md)
10
- - [Configuration reference](CONFIGURATION.md)
11
- - [Workflow and CI conventions](WORKFLOWS.md)
12
- - [Release management](RELEASES.md)
13
- - [Release integrity and build provenance](release-integrity.md)
14
- - [Publishing packages](PUBLISHING.md)
15
- - [Caching and remote caching](CACHING.md)
16
- - [Performance budgets and baselines](PERFORMANCE.md)
17
- - [Required capabilities and task evidence](required-capabilities.md)
18
- - [Product quality profiles](product-quality.md)
19
- - [Agent-facing validation commands](agent-validation.md)
20
- - [Declarative fleet inventory and staged rollouts](fleet-rollouts.md)
3
+ Code Foundry's documentation is organized by the job you are trying to do. Most
4
+ guides describe the reusable baseline; platform-specific guides call out their
5
+ provider assumptions. Adapt repository names, environments, and deployment
6
+ details before copying any guide elsewhere.
7
+
8
+ ## Start here
9
+
10
+ - [Initialization and synchronization](INITIALIZATION.md) — install, update, and diagnose a baseline.
11
+ - [Configuration reference](CONFIGURATION.md) — choose workflows, runtimes, validation, and release policy.
12
+ - [Workflow and CI conventions](WORKFLOWS.md) — understand triggers, checks, runners, caching, and branch protection.
13
+ - [Extension points](EXTENSIONS.md) — keep custom workflows and post-release delivery alongside the baseline.
14
+
15
+ ## Validation and quality
16
+
17
+ - [Agent-facing validation](agent-validation.md) — run local plans and checks with machine-readable evidence.
18
+ - [Required capabilities and task evidence](required-capabilities.md) — require tasks, coverage, and retained receipts.
19
+ - [Performance budgets](PERFORMANCE.md) — maintain runtime, CI, and package-size budgets.
20
+ - [Product quality profiles](product-quality.md) — add acceptance checks for sites, apps, Workers, and packages.
21
+ - [Merge queue validation](merge-queues.md) — validate GitHub merge-group commits.
22
+
23
+ ## Releases and publishing
24
+
25
+ - [Release management](RELEASES.md) — branch topologies, Release Please, and release permissions.
26
+ - [Publishing packages](PUBLISHING.md) — npm, GitHub Releases, and provenance guidance.
27
+ - [Release integrity and build provenance](release-integrity.md) — immutable releases, verification, and attestations.
28
+ - [Consumer qualification](consumer-qualification.md) — test the packaged release across consumer fixtures.
29
+ - [Qualified publication](qualified-publication.md) — publish the exact qualified Code Foundry archive.
30
+
31
+ ## Fleet and deployment operations
32
+
33
+ - [Declarative fleet rollouts](fleet-rollouts.md) — inventory, canaries, staged upgrades, and recovery.
34
+ - [Fleet release eligibility](fleet-release-eligibility.md) — require verified release evidence before upgrades.
35
+ - [Verified Cloudflare delivery](cloudflare-delivery.md) — build, verify, canary, and promote Worker versions.
36
+ - [Caching and remote caching](CACHING.md) — configure package, build, and Turborepo caching.
21
37
 
22
38
  ## Repository-specific documentation
23
39
 
24
- Add project-specific guides, architecture notes, runbooks, and deployment
25
- instructions to this directory. The Code Foundry initializer preserves `docs/`
26
- files during synchronization. Prefer clear, task-oriented filenames and link
27
- new documents from this index when they become part of the supported workflow.
40
+ Add architecture notes, runbooks, and deployment instructions to this directory.
41
+ The initializer preserves `docs/` during synchronization. Link supported guides
42
+ from this index and prefer task-oriented filenames.
package/docs/RELEASES.md CHANGED
@@ -25,13 +25,17 @@ the `staging` → `main` promotion PR merges with **rebase** (`merge_strategy:
25
25
  rebase`), and Release Please version PRs merge with **rebase**
26
26
  (`release_merge_strategy: rebase`). In the `direct` topology, feature and fix
27
27
  branches squash straight into `main` and Release Please version PRs squash into
28
- `main` (`release_merge_strategy: squash`). `merge_strategy` is not enforced. Release automation never defaults
29
- to a merge method and never merges with `--admin`: `staging-release` accepts
30
- only rebase for release PRs, while `direct` requires squash.
28
+ `main` (`release_merge_strategy: squash`). `sync`, `doctor`, and release
29
+ automation reject any other strategy. Release automation never defaults to a
30
+ merge method and never merges with `--admin`.
31
31
 
32
32
  The release workflow opens or updates a versioned PR after changes reach
33
- `main`. Merging that PR updates the changelog, creates the Git tag and GitHub
34
- Release, and triggers any configured package publication.
33
+ `main`. For generated consumer callers, merging that PR updates the changelog,
34
+ creates the Git tag and GitHub Release, and can trigger npm publication. Code
35
+ Foundry's own caller uses the qualified path: it qualifies the package first,
36
+ creates a draft release, stages the exact qualified archive, then publishes the
37
+ immutable release and package through the verified publisher. See [Qualified
38
+ publication](qualified-publication.md).
35
39
 
36
40
  For an explicit version, put `Release-As: 2.0.0` in a commit or pull request
37
41
  body. Existing `CHANGELOG.md` history remains repository-owned.
@@ -134,7 +138,12 @@ already passed).
134
138
  ## Operational checklist
135
139
 
136
140
  1. Merge tested changes into `main` (direct: feature PRs; staging-release: promote `staging` into `main`).
137
- 2. Review the generated Release Please PR and changelog.
138
- 3. Merge the release PR with squash in the direct topology (`release_merge_strategy: squash`).
139
- 4. Confirm the GitHub Release and any package publication.
140
- 5. staging-release only: synchronize `staging` with the new `main` release commit.
141
+ 2. Review the generated Release Please PR and changelog. A validated
142
+ `CODE_FOUNDRY_TOKEN` lets the release workflow merge it automatically after
143
+ required checks; without that token, merge it manually with the configured
144
+ topology method: squash for `direct`, rebase for `staging-release`.
145
+ 3. For a generated consumer caller, confirm the GitHub Release and any package
146
+ publication.
147
+ 4. For Code Foundry itself, confirm qualification, draft staging, immutable
148
+ publication, and the retained identity receipts.
149
+ 5. In `staging-release`, synchronize `staging` with the new `main` release commit.
package/docs/WORKFLOWS.md CHANGED
@@ -27,7 +27,9 @@ ready transition. Release Please version heads are excluded because the
27
27
  release workflow owns their state. A separate draft-control caller listens for
28
28
  `converted_to_draft` and cancels queued or running pull-request workflows.
29
29
  Marking a pull request ready starts validation, and each new commit on a ready
30
- pull request starts it again for the current head.
30
+ pull request starts it again for the current head. Audit-mode runs additionally
31
+ execute the eval lane (`Validation / Eval`) for repositories that ship an eval
32
+ harness; see [Evals](EVALS.md).
31
33
 
32
34
  The separate `validation-audit.yml` caller is pinned to the configured released
33
35
  runtime and handles scheduled and manual audits:
@@ -40,9 +42,15 @@ workflow_dispatch:
40
42
 
41
43
  In the `staging-release` topology, pull requests into `staging` run the fast
42
44
  tier, ordinary pull requests into `main` run the full audit tier, and exact
43
- Release Please pull requests into `main` run the full audit tier plus the
44
- release-diff policy. This keeps repository rulesets satisfiable for the release
45
- commit without exposing neutral or skipped suite checks. In the
45
+ Release Please pull requests into `main` run a lean release lane — CI, unit
46
+ tests, and CodeQL plus the release-diff policy. Their diff is version
47
+ metadata only: the content was fully audited on the pull requests that
48
+ merged into `main`, and the scheduled audit lane re-covers drift, so the
49
+ release lane keeps repository rulesets satisfiable without re-running the
50
+ runner-heavy suites. The managed branch rulesets require only the aggregate
51
+ `Validation / Gate` check, so skipped non-required jobs never deadlock the
52
+ release; do not hand-require individual job contexts on release branches.
53
+ In the
46
54
  `direct` topology (the default) every pull request targets `main` and runs the
47
55
  full audit tier, because there is no integration branch for a fast pass.
48
56
  Scheduled and manual runs select the audit tier in both topologies. Draft PR
@@ -52,6 +60,12 @@ opens those PRs as drafts. Promotion automation listens to `staging` pushes
52
60
  automation and default-branch CodeQL listen to `main` pushes.
53
61
  Custom deployment, indexing, search, Slither, or other workflows are
54
62
  repository-owned extensions and should use the same ready-transition policy.
63
+ Code Foundry's runner-heavy validation, security, qualification, and Cloudflare
64
+ reusable workflows also enforce draft protection at the job boundary. Generated
65
+ callers default to the `draft_protection: true` configuration; set it to `false`
66
+ to run generated gates for drafts. Cloudflare callers use their equivalent
67
+ `draft-protection: false` input. These opt-outs do not remove Draft Guard or
68
+ draft-PR automation; they only allow the protected gates to run for drafts.
55
69
 
56
70
  ## Billing pause
57
71
 
@@ -112,6 +126,11 @@ opt in or out without a code change.
112
126
  | Release PR | Promote `staging` into `main` (staging-release topology only) |
113
127
  | Release | Release Please, GitHub release, and optional npm publication |
114
128
 
129
+ Generated consumer callers use the standard Release workflow. Code Foundry's
130
+ own `release_self-ci.yml` adds consumer qualification, draft-release staging,
131
+ immutable-release verification, and qualified npm publication; see [Qualified
132
+ publication](qualified-publication.md).
133
+
115
134
  Use concise job names such as `CI / Format`, `Test / Unit`, and
116
135
  `CodeQL / Analyze (Python)`. Per-language CodeQL analyzers (Rust shards
117
136
  included) and security audits run through a detection-built matrix, so a
@@ -1,16 +1,17 @@
1
1
  # Agent-facing validation commands
2
2
 
3
- The public CLI now exposes a stable plan/check interface using the same discovery,
3
+ The public CLI exposes a stable plan/check interface using the same discovery,
4
4
  required-capability policy, ecosystem executor, and task receipts as reusable CI.
5
5
 
6
6
  ```sh
7
- code-foundry plan --changed --base origin/main --json
8
- code-foundry check --tier fast --json
9
- code-foundry check --tier audit --json
7
+ npx code-foundry plan --changed --base origin/main --json
8
+ npx code-foundry check --tier fast --json
9
+ npx code-foundry check --tier audit --json
10
10
  ```
11
11
 
12
12
  Both commands accept `--target PATH`. Use the Code Foundry version pinned by the
13
- repository, not an unreviewed floating installation. `plan` executes discovery
13
+ repository, not an unreviewed floating installation; use your package manager's
14
+ local binary when the package is installed as a dependency. `plan` executes discovery
14
15
  only: it does not install dependencies, run project checks, modify source files,
15
16
  or emit skip-receipt files. Required entrypoints are validated across the complete
16
17
  task set, including tasks deferred from the selected local tier.
@@ -50,7 +50,11 @@ Wrangler version supporting `WRANGLER_OUTPUT_FILE_PATH` and version-1
50
50
  Bun remains the installation path, consistent with the existing deploy workflow.
51
51
 
52
52
  The repository verification command receives `BASE_URL` and
53
- `FOUNDRY_DEPLOYMENT_PHASE` (`candidate`, `canary`, or `production`). It must check
53
+ `FOUNDRY_DEPLOYMENT_PHASE` (`candidate`, `canary`, or `production`). Preview
54
+ candidate jobs skip draft pull requests by default. To intentionally deploy
55
+ from drafts, pass `draft-protection: false` in the reusable-workflow call; this
56
+ changes only the CI/deployment gate, not Draft Guard or draft-PR automation. It
57
+ must check
54
58
  critical journeys, redirects, assets, and application-specific behavior. The
55
59
  built-in smoke probe requires a successful 2xx response and does not follow
56
60
  redirects. Deploy credentials are not supplied to verification steps and are
@@ -85,7 +89,10 @@ and new production workflows active.
85
89
  Outputs include preview URL, exact version ID, source SHA, declared build-tree
86
90
  SHA-256 digest, Cloudflare deployment ID, and GitHub application deployment ID.
87
91
  Explicit application deployment records receive in-progress and success/failure
88
- statuses, in addition to GitHub's environment-job records. Sanitized candidate and
92
+ statuses, in addition to GitHub's environment-job records. For pull requests,
93
+ the deployment record is associated with `github.event.pull_request.head.sha`,
94
+ not GitHub Actions' merge commit, so GitHub can display the preview in the PR's
95
+ Deployments section. Direct pushes use `github.sha`. Sanitized candidate and
89
96
  production JSON evidence is uploaded even on failure. Binding values, API bodies,
90
97
  and credentials are not copied into those reports. Forced runner termination may
91
98
  prevent final status steps; the GitHub job still reflects cancellation/failure.
@@ -164,13 +171,18 @@ the deployment API intentionally changes version routing only.
164
171
 
165
172
  ## Legacy workflow hardening
166
173
 
167
- `cloudflare-deploy.yml` now uses real job environments, non-cancelling concurrency,
174
+ `cloudflare-deploy.yml` uses real job environments, non-cancelling concurrency,
168
175
  structured Wrangler output, exact/local Wrangler selection, reusable outputs, and
169
- in-progress/failure deployment records. Its legacy-compatible default remains
170
- `latest`; callers should prefer `local` or an exact version for reproducibility. A
171
- production URL can be supplied with `deployment-url` when API output contains only
172
- route patterns. It is still a **direct, unverified deployment**; adopt
173
- `cloudflare-delivery.yml` for candidate verification and guarded promotion.
176
+ in-progress/failure deployment records. Its preview deployment records use the
177
+ pull request head SHA when called from a PR, so completed previews appear in that
178
+ PR's Deployments section; direct pushes use the workflow SHA. Its compatibility
179
+ default remains `latest`; callers should prefer `local` or an exact version for
180
+ reproducibility. A production URL can be supplied with `deployment-url` when API
181
+ output contains only route patterns. It is still a **direct, unverified deployment**;
182
+ adopt `cloudflare-delivery.yml` for candidate verification and
183
+ guarded promotion. Consumers pinned to an older Code Foundry release must update
184
+ their reusable workflow reference; existing deployments are not retroactively
185
+ re-associated with the PR head commit.
174
186
 
175
187
  ## References and testing
176
188
 
@@ -5,8 +5,9 @@ Release-candidate compatibility checks against the distributable package.
5
5
  **Status:** Opt-in reusable workflow; required by Code Foundry's own release caller.
6
6
  **Scope:** Package installation, CLI initialization/synchronization, generated workflow contracts.
7
7
 
8
- `consumer-qualification.yml` packs the checked-out candidate once, shares that archive across all supported
9
- Node majors using an artifact scoped to the same workflow run **and attempt**, installs it offline with lifecycle scripts disabled,
8
+ `consumer-qualification.yml` packs the checked-out candidate once, shares that
9
+ archive across Node 20, 22, and 24 using an artifact scoped to the same workflow
10
+ run **and attempt**, and installs it offline with lifecycle scripts disabled,
10
11
  and executes its public CLI from the installed package. The harness does not
11
12
  import the source checkout's initializer as a substitute for package testing.
12
13
 
@@ -39,13 +40,14 @@ member. Reports are evidence, not signatures or a substitute for release identit
39
40
  verification.
40
41
 
41
42
  The self release caller cannot start Release Please or npm publication until all
42
- qualification jobs and the aggregate `Gate` succeed. An explicit `release-while-paused` dispatch is passed
43
- through to the reusable workflow; ordinary calls remain blocked by the billing pause.
44
- Consumer-generated release callers do not inherit this Code Foundry-specific
45
- qualification job. This does not yet guarantee that its legacy publishing job uses
46
- this same archive; the verified-publication workflow handles that separate
47
- requirement. No branch protections, repository settings, credentials, or consumer
48
- runtimes are changed by this feature.
43
+ qualification jobs and the aggregate `Gate` succeed. An explicit
44
+ `release-while-paused` dispatch is passed through to the reusable workflow;
45
+ ordinary calls remain blocked by the billing pause. Consumer-generated release
46
+ callers do not inherit this Code Foundry-specific qualification job. Code
47
+ Foundry's self caller passes the qualified archive to the verified publication
48
+ workflow, which independently rechecks the same bytes before publishing. No
49
+ branch protections, repository settings, credentials, or consumer runtimes are
50
+ changed by this workflow.
49
51
 
50
52
  ## Verified handoff and reruns
51
53
 
@@ -2,14 +2,12 @@
2
2
 
3
3
  Require a verified, qualified runtime before any fleet upgrade mutates repositories.
4
4
 
5
- **Dependency:** Installed release-integrity verifier (#537).
6
- **Activation:** Consumer-owned `.code-foundry-release-policy.json` at the fleet root.
5
+ **Activation:** Add a consumer-owned `.code-foundry-release-policy.json` at the
6
+ fleet root.
7
7
 
8
- The public `upgradeFleet` entrypoint now applies an optional release eligibility
9
- guard before delegating to the unchanged legacy/manifest rollout implementation.
10
- The implementation was moved verbatim to `fleet-core.mjs`; discovery exports and
11
- existing callers retain their interface. No policy file means existing behavior.
12
- A malformed or symlinked policy is an error, not an opt-out. Dry runs use the same
8
+ The public fleet upgrade command applies an optional release-eligibility guard
9
+ before it mutates repositories. No policy file means existing fleet behavior. A
10
+ malformed or symlinked policy is an error, not an opt-out. Dry runs use the same
13
11
  guard, and `--force` cannot bypass source identity or qualification.
14
12
 
15
13
  ```json
@@ -30,8 +28,8 @@ This is a shape example, not a completed fleet policy. Populate canonical reposi
30
28
  identity, actual workflow path, and exact job names from the qualified release
31
29
  caller's Actions API results. Include the publication job when successful registry
32
30
  publication is required before adoption. Require every relevant job: a workflow's
33
- aggregate success alone can conceal skipped jobs. The qualification gate in #544
34
- and verified publisher in #547 provide the producer side of this policy.
31
+ aggregate success alone can conceal skipped jobs. The producer-side qualification
32
+ and verified-publication workflows provide the evidence this policy consumes.
35
33
 
36
34
  Keep the policy alongside the **consumer workspace's** fleet inventory. Do not put
37
35
  private repository names, local layouts, or deployment credentials into this
@@ -69,12 +67,13 @@ First release and validate the qualification/verification producer and confirm
69
67
  real workflow/job identities. Then opt a consumer workspace into this policy and
70
68
  exercise `fleet upgrade --dry-run --root <fleet-root> --source <clean-release-checkout>`.
71
69
  When `--source` is omitted, the installed package is used and an enabled policy
72
- will reject it unless that installation is itself a clean Git checkout. Older mutable
73
- releases or unavailable permissions should fail; do not weaken the policy just to
74
- make an old release eligible. No real fleet inventory is fabricated by this PR.
70
+ will reject it unless that installation is itself a clean Git checkout. Older
71
+ mutable releases or unavailable permissions should fail; do not weaken the policy
72
+ just to make an old release eligible. No real fleet inventory is created by the
73
+ eligibility guard.
75
74
 
76
75
  The focused suite verifies guard ordering and failure propagation with GitHub/CLI
77
76
  fixtures. Live authenticated verification, exact production job naming, and the
78
- full existing fleet-engine suite must pass before activation. The original fleet
79
- engine's Git blob is retained byte-for-byte; the source move still needs full
80
- repository import/type-check/packaging validation in CI.
77
+ full fleet-engine suite should pass before activation. The guard is not a
78
+ substitute for repository import, type-check, packaging, or deployment
79
+ validation.
@@ -54,9 +54,9 @@ Adopt those requirements in consumer repositories before requiring them here.
54
54
  ## Commands
55
55
 
56
56
  ```sh
57
- code-foundry fleet status --root /path/to/fleet
58
- code-foundry fleet upgrade --root /path/to/fleet --source /path/to/release-checkout --dry-run
59
- code-foundry fleet upgrade --root /path/to/fleet --source /path/to/release-checkout --create-pr
57
+ npx code-foundry fleet status --root /path/to/fleet
58
+ npx code-foundry fleet upgrade --root /path/to/fleet --source /path/to/release-checkout --dry-run
59
+ npx code-foundry fleet upgrade --root /path/to/fleet --source /path/to/release-checkout --create-pr
60
60
  ```
61
61
 
62
62
  Use `--source` to provide the clean Code Foundry release checkout used for the