@kungfu-tech/buildchain 3.0.4-alpha.4 → 3.0.4-alpha.6

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 (34) hide show
  1. package/AGENTS.md +14 -5
  2. package/README.md +18 -0
  3. package/bin/buildchain.mjs +10 -1
  4. package/dist/site/buildchain-contract.json +5 -5
  5. package/dist/site/buildchain-site.json +1459 -58
  6. package/dist/site/capability-registry.json +8 -5
  7. package/dist/site/cli-registry.json +1869 -0
  8. package/dist/site/kfd-claims.json +79 -7
  9. package/dist/site/kfd-upstream-aggregate.json +1 -1
  10. package/dist/site/manual-registry.json +47 -4
  11. package/dist/site/node-api-registry.json +17761 -6
  12. package/dist/site/page-registry.json +1435 -58
  13. package/dist/site/public-surface-audit.json +2809 -352
  14. package/dist/site/publication-registry.json +4 -4
  15. package/dist/site/site-manifest.json +32 -8
  16. package/docs/MAP.md +20 -5
  17. package/docs/cli-reference.md +1936 -0
  18. package/docs/cli.md +13 -0
  19. package/docs/getting-started.md +167 -0
  20. package/docs/node-api-reference.md +1949 -0
  21. package/docs/site-bundle-contract.md +10 -4
  22. package/docs/versioning.md +5 -4
  23. package/package.json +8 -5
  24. package/packages/core/buildchain-agent-manuals.js +37 -0
  25. package/packages/core/buildchain-kfd-claims.js +3 -36
  26. package/packages/core/paper-agent-entry.js +8 -4
  27. package/packages/core/paper.js +1 -0
  28. package/packages/core/publication-package.js +7 -0
  29. package/scripts/check-inventory.mjs +2 -2
  30. package/scripts/generate-public-reference.mjs +68 -0
  31. package/scripts/generate-site-bundle.mjs +19 -34
  32. package/scripts/public-reference.mjs +557 -0
  33. package/scripts/site-reference-registry.mjs +174 -0
  34. package/scripts/verify-golden-path.mjs +169 -0
package/docs/cli.md CHANGED
@@ -111,6 +111,19 @@ Use `dist/site/manual-registry.json` to find the packaged operating manuals and
111
111
  their SHA-256 digests. Use `dist/site/buildchain-contract.json` to verify the
112
112
  floating-ref contract world for a runtime such as `@v3`.
113
113
 
114
+ For exhaustive lookup, use the generated references rather than scanning this
115
+ conceptual guide:
116
+
117
+ - [`cli-reference.md`](cli-reference.md) is projected from the governed usage
118
+ model and runtime command registry. `buildchain <path> --help` is intercepted
119
+ before dispatch at every listed path, exits zero, and has no command side
120
+ effects.
121
+ - [`node-api-reference.md`](node-api-reference.md) is projected from
122
+ `package.json#exports` and exact ESM export declarations. The packaged
123
+ `dist/site/node-api-registry.json` carries the same per-symbol signatures,
124
+ parameters, conservative return/error boundaries, side-effect classification,
125
+ maturity, example import, and source location.
126
+
114
127
  ## Commands
115
128
 
116
129
  `buildchain create github-artifact-attestation-policy` seals the expected
@@ -0,0 +1,167 @@
1
+ ---
2
+ status: active
3
+ period: ongoing
4
+ theme: buildchain-golden-path
5
+ doc_type: technical-guide
6
+ source_level: local-files
7
+ confidence: high
8
+ sensitivity: public
9
+ evidence_grade: A
10
+ review_state: self-reviewed
11
+ last_reviewed: 2026-08-01
12
+ ai_provenance:
13
+ model_family: GPT-5
14
+ product: Codex
15
+ generated_at: 2026-08-01
16
+ invisible_context: not asserted
17
+ ---
18
+
19
+ # Buildchain Golden Path
20
+
21
+ This path is for a repository maintainer adopting Buildchain for the first
22
+ time. It takes about 15–30 minutes and ends with five inspectable outcomes: an
23
+ exact package pin, a declared project type, a valid local configuration, a thin
24
+ reusable workflow caller, and a Release Passport inspection.
25
+
26
+ Use this page for the first successful pass. Move to the advanced manuals only
27
+ after the local checks below are green.
28
+
29
+ ## 1. Create a clean consumer and install an exact version
30
+
31
+ ```bash
32
+ consumer_dir="$(mktemp -d)"
33
+ cd "$consumer_dir"
34
+ npm init -y
35
+ buildchain_version="$(npm view @kungfu-tech/buildchain version)"
36
+ pnpm add -D "@kungfu-tech/buildchain@$buildchain_version"
37
+ pnpm exec buildchain --version
38
+ ```
39
+
40
+ The package manager records the exact resolved version in `package.json` and
41
+ the lockfile. Review that version before committing it; do not leave a floating
42
+ range in a release repository.
43
+
44
+ ## 2. Choose the project type and initialize
45
+
46
+ Start with `package` for a Node package. Other supported types are `native`,
47
+ `web-surface`, `infra-contract`, `publication-artifact`, and
48
+ `anchored-package`.
49
+
50
+ ```bash
51
+ pnpm exec buildchain init --type package --package-manager pnpm
52
+ ```
53
+
54
+ Inspect the two generated files before continuing:
55
+
56
+ ```bash
57
+ sed -n '1,220p' .buildchain/buildchain.toml
58
+ sed -n '1,220p' .github/workflows/build.yml
59
+ ```
60
+
61
+ `buildchain.toml` owns repository lifecycle declarations. The workflow is a
62
+ thin caller of Buildchain's reusable workflow; it is not a second release
63
+ implementation.
64
+
65
+ ## 3. Validate the local contract
66
+
67
+ ```bash
68
+ pnpm exec buildchain validate \
69
+ --require-version-state \
70
+ --require-lifecycle-stages install,build,verify
71
+ pnpm exec buildchain doctor --json
72
+ ```
73
+
74
+ If the generated lifecycle commands do not match the repository, edit only
75
+ `.buildchain/buildchain.toml`, then rerun both checks. See
76
+ [Lifecycle Protocol](lifecycle-protocol.md) for the normative fields.
77
+
78
+ ## 4. Inspect the reusable workflow and release dry-run
79
+
80
+ The generated caller should contain one reusable `uses:` edge and a manual
81
+ `buildchain-ref` input for bounded train validation:
82
+
83
+ ```bash
84
+ rg -n 'uses:|buildchain-ref:' .github/workflows/build.yml
85
+ pnpm exec buildchain release --dry-run \
86
+ --target-ref alpha/v3/v3.0 \
87
+ --json
88
+ ```
89
+
90
+ The dry-run explains legal source refs, tags, version state, and publication
91
+ effects. It does not move refs, edit files, or publish packages.
92
+
93
+ ## 5. Create and inspect a local Release Passport example
94
+
95
+ This example creates a source-bound local Passport through the public Node API,
96
+ then reads it through the CLI. It is learning evidence, not publication
97
+ authority.
98
+
99
+ ```bash
100
+ mkdir -p .buildchain/golden-path
101
+ node --input-type=module <<'EOF'
102
+ import fs from "node:fs";
103
+ import { createReleasePassport } from "@kungfu-tech/buildchain";
104
+
105
+ const passport = createReleasePassport({
106
+ repository: "example/consumer",
107
+ tag: "v0.1.0-alpha.0",
108
+ sourceSha: "a".repeat(40),
109
+ assets: [{ name: "consumer.tgz", sha256: "b".repeat(64) }],
110
+ });
111
+ fs.writeFileSync(
112
+ ".buildchain/golden-path/buildchain.release.json",
113
+ `${JSON.stringify(passport, null, 2)}\n`,
114
+ );
115
+ EOF
116
+
117
+ pnpm exec buildchain inspect release \
118
+ --passport .buildchain/golden-path/buildchain.release.json \
119
+ --json
120
+ ```
121
+
122
+ For a real release, the protected Buildchain workflow creates the Passport from
123
+ the exact source, artifact, controller, and publication evidence. See
124
+ [Release Passport](release-passport.md); do not promote this local example.
125
+
126
+ ## You are done when
127
+
128
+ - the dependency and lockfile contain one exact Buildchain version;
129
+ - `.buildchain/buildchain.toml` declares the intended project type and lifecycle;
130
+ - `validate` and `doctor` succeed;
131
+ - `.github/workflows/build.yml` remains a thin reusable-workflow caller;
132
+ - the release dry-run and local Passport inspection both return structured output.
133
+
134
+ The repository test `pnpm run check:golden-path` reproduces this path in a new
135
+ temporary consumer using the locally packed Buildchain package.
136
+
137
+ ## Choose the next manual
138
+
139
+ | Intent | Next page |
140
+ | --- | --- |
141
+ | Change lifecycle commands or version files | [Lifecycle Protocol](lifecycle-protocol.md) |
142
+ | Configure native matrices, runners, caches, or artifacts | [Reusable Build Surface](reusable-build-surface.md) |
143
+ | Look up a command | [Generated CLI Reference](cli-reference.md) |
144
+ | Import the Node toolkit | [Generated Node API Reference](node-api-reference.md) |
145
+ | Understand protected branches and tags | [Release Flow](release-flow.md) |
146
+ | Verify published evidence | [Release Passport](release-passport.md) |
147
+
148
+ ## Troubleshooting
149
+
150
+ - `already exists`: initialization is no-overwrite by default. Inspect the
151
+ existing files; use `--force` only for an intentional replacement.
152
+ - missing lifecycle stage: add the named stage to
153
+ `.buildchain/buildchain.toml`; do not weaken the validation command.
154
+ - package release-age policy: add a temporary, package-and-version-specific
155
+ `minimumReleaseAgeExclude`, then remove it after the normal window.
156
+ - unsure about syntax: run `buildchain <path> --help`. Help is intercepted
157
+ before command dispatch and is side-effect free at every governed path.
158
+
159
+ ## Small glossary
160
+
161
+ - **project type**: the repository shape selected by `buildchain init`.
162
+ - **lifecycle**: repository-owned install, build, verify, and publish commands.
163
+ - **reusable workflow**: Buildchain-owned GitHub Actions control plane called by
164
+ a thin consumer workflow.
165
+ - **Release Passport**: source- and artifact-bound release evidence, not a
166
+ release trigger.
167
+ - **train ref**: a temporary validation runtime; never a production dependency.