@kungfu-tech/buildchain 4.1.3-alpha.9 → 4.1.4-alpha.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/AGENTS.md +11 -13
- package/CONTRIBUTING.md +32 -9
- package/README.md +56 -140
- package/actions/release/promotion/ref/README.md +1 -1
- package/architecture/action-taxonomy.json +1 -1
- package/architecture/agent-change-map.md +32 -45
- package/architecture/build-orchestration.json +1 -1
- package/architecture/capability-state-machine-manifest.json +5 -5
- package/architecture/ci-lane-change-budget.json +92 -92
- package/architecture/code-layout.json +2 -12
- package/architecture/core-mechanisms.json +38 -39
- package/architecture/cross-platform-adopter-qualification.json +1 -1
- package/architecture/dev-delivery-orchestration.json +2 -2
- package/architecture/floating-consumer-policy.json +3 -3
- package/architecture/internal-capabilities.json +27 -28
- package/architecture/maintainability-debt.json +60 -94
- package/architecture/maintainability-policy.json +7 -13
- package/architecture/minimal-consumer-migration.json +43 -5014
- package/architecture/platform-stage-checkpoints.json +1 -1
- package/architecture/release-tail-contract.json +2 -2
- package/architecture/release-topology.json +33 -25
- package/architecture/stage-capsule-qualification.json +1 -1
- package/architecture/universal-workflow-bootstrap.json +60 -60
- package/architecture/universal-workflow-capability-policy.json +3 -3
- package/architecture/universal-workflow-fault-campaign.json +7 -7
- package/architecture/workflow-taxonomy.json +59 -60
- package/contracts/fixtures/v4-tail-reseal-v1/valid.json +1 -1
- package/dist/site/buildchain-contract.json +138 -66
- package/dist/site/buildchain-site.json +257 -331
- package/dist/site/capability-registry.json +4 -4
- package/dist/site/cli-registry.json +6 -142
- package/dist/site/controller-registry.json +19 -19
- package/dist/site/kfd-claims.json +481 -529
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +22 -22
- package/dist/site/node-api-registry.json +82 -339
- package/dist/site/page-registry.json +229 -304
- package/dist/site/public-surface-audit.json +544 -754
- package/dist/site/publication-authority-registry.json +316 -316
- package/dist/site/publication-registry.json +1 -1
- package/dist/site/site-manifest.json +23 -23
- package/dist/site/workflow-registry.json +1071 -1027
- package/docs/MAP.md +28 -20
- package/docs/auditable-demo.md +17 -49
- package/docs/bootstrap-recovery.md +46 -37
- package/docs/cli-reference.md +2 -46
- package/docs/cli.md +97 -186
- package/docs/code-organization.md +7 -5
- package/docs/dev-alpha-candidate-patrol.md +19 -42
- package/docs/dev-delivery-orchestration.md +15 -11
- package/docs/dev-delivery-qualification-landing-adr.md +10 -9
- package/docs/dev-delivery-warrant.md +17 -16
- package/docs/dev-qualification-patrol.md +25 -20
- package/docs/getting-started.md +80 -139
- package/docs/github-artifact-attestation.md +31 -81
- package/docs/install.md +66 -30
- package/docs/lifecycle-protocol.md +19 -57
- package/docs/migration-inventory.md +17 -45
- package/docs/next-development-transition.md +13 -13
- package/docs/node-api-reference.md +122 -138
- package/docs/oci-publication.md +13 -10
- package/docs/publication-artifacts.md +128 -486
- package/docs/publication-authority.md +15 -45
- package/docs/publish-transaction.md +13 -11
- package/docs/release-candidate.md +126 -355
- package/docs/release-discussions.md +36 -67
- package/docs/release-flow.md +80 -339
- package/docs/release-governance.md +114 -962
- package/docs/release-promotion-request.md +45 -43
- package/docs/release-propagation.md +13 -27
- package/docs/release-tail-provider-plane.md +38 -65
- package/docs/reusable-build-surface.md +78 -196
- package/docs/runtime-train-validation.md +8 -6
- package/docs/stable-candidate-patrol.md +13 -66
- package/docs/v4-adopter-delivery.md +15 -15
- package/docs/v4-declarative-release-tail-migration.md +19 -17
- package/docs/v4-production-release.md +11 -6
- package/docs/v4-publication-rehearsal.md +12 -27
- package/docs/v4-stage-capsule.md +14 -20
- package/docs/v4-tail-reseal.md +34 -20
- package/docs/web-surface-deployments.md +26 -264
- package/docs/workflow-catalog.md +31 -31
- package/docs/workflow-path-migration.md +10 -4
- package/package.json +5 -4
- package/packages/core/adoption/buildchain-kfd-claims.js +7 -7
- package/packages/core/adoption/cli/output.mjs +1 -9
- package/packages/core/adoption/cli/product-gate.mjs +1 -15
- package/packages/core/adoption/cli/project.mjs +9 -10
- package/packages/core/adoption/cli/standards.mjs +1 -14
- package/packages/core/adoption/cli/support.mjs +0 -2
- package/packages/core/adoption/cli/surface-register.mjs +0 -2
- package/packages/core/adoption/commands/init-repo.mjs +77 -485
- package/packages/core/adoption/consumer-init.js +279 -0
- package/packages/core/adoption/qualification/admission.js +1 -1
- package/packages/core/build/cli/cache.mjs +0 -2
- package/packages/core/build/cli/facts.mjs +0 -3
- package/packages/core/build/cli/homebrew.mjs +0 -4
- package/packages/core/build/cli/lifecycle.mjs +0 -3
- package/packages/core/build/github-artifact-attestation.js +2 -2
- package/packages/core/build/platform-stage-checkpoints.js +1 -1
- package/packages/core/build/signing/dispatch.js +1 -1
- package/packages/core/consumer/buildchain-config.js +9 -0
- package/packages/core/consumer/contract/inspection.js +351 -9
- package/packages/core/consumer/contract/javascript-syntax.js +439 -0
- package/packages/core/consumer/contract/javascript-values.js +61 -0
- package/packages/core/consumer/contract/javascript.js +555 -0
- package/packages/core/consumer/contract/local-validation.js +84 -0
- package/packages/core/contracts/buildchain-contract.js +39 -8
- package/packages/core/contracts/cli/introspection.mjs +1 -9
- package/packages/core/contracts/public-surface-cli.js +0 -1
- package/packages/core/dev-delivery/dev-delivery-contract-surface.js +2 -2
- package/packages/core/governance/buildchain-publication-authority.js +24 -24
- package/packages/core/governance/cli/doctor.mjs +58 -42
- package/packages/core/governance/commands/architecture.mjs +6 -1
- package/packages/core/governance/commands/audit-publication-control-plane.mjs +1 -1
- package/packages/core/governance/commands/workflow-friction-report.mjs +1 -1
- package/packages/core/governance/github-governance-authority.js +2 -2
- package/packages/core/governance/publication/collection.js +1 -1
- package/packages/core/index.js +1 -3
- package/packages/core/observability/cli/candidate.mjs +0 -2
- package/packages/core/observability/cli/context.mjs +0 -5
- package/packages/core/observability/cli/diagnostics.mjs +0 -7
- package/packages/core/observability/cli/events.mjs +2 -10
- package/packages/core/paper/commands/paper-work-fleet-cli.mjs +1 -1
- package/packages/core/paper/commands/paper.mjs +33 -422
- package/packages/core/paper/consumer-status.js +72 -0
- package/packages/core/paper/operations/identity.js +0 -3
- package/packages/core/paper/operations/migration.js +460 -0
- package/packages/core/paper/operations/preflight-checks.js +8 -68
- package/packages/core/paper/operations/scaffold.js +16 -326
- package/packages/core/paper/operations/status.js +27 -53
- package/packages/core/paper/paper-agent-entry.js +36 -147
- package/packages/core/paper/paper-fleet.js +24 -39
- package/packages/core/paper/paper-repository.js +16 -0
- package/packages/core/paper/paper-runtime-channels.js +1 -1
- package/packages/core/paper/paper-scaffold-content.js +153 -162
- package/packages/core/paper/paper-work.js +3 -10
- package/packages/core/paper/paper.js +43 -5
- package/packages/core/providers/github/artifact-attestation.js +1 -1
- package/packages/core/providers/github/pipeline-context-artifacts.js +172 -0
- package/packages/core/providers/github/pipeline-release-evidence.js +17 -98
- package/packages/core/providers/github/pipeline-stable-baseline.js +86 -0
- package/packages/core/providers/github/pipeline-stable-source.js +22 -4
- package/packages/core/providers/github/release-evidence-assets.js +97 -0
- package/packages/core/publication/authority/control-plane.js +2 -2
- package/packages/core/publication/authority/seal.js +1 -1
- package/packages/core/publication/cli/dispatch.mjs +1 -12
- package/packages/core/publication/pipeline/actions.js +16 -9
- package/packages/core/publication/pipeline/apply.js +17 -9
- package/packages/core/publication/pipeline/context.js +29 -0
- package/packages/core/publication/pipeline/journal.js +13 -1
- package/packages/core/publication/pipeline/prepare.js +15 -6
- package/packages/core/publication/pipeline/recovery-import.js +1 -1
- package/packages/core/publication/pipeline/recovery-materials.js +63 -1
- package/packages/core/publication/pipeline/recovery-prepare.js +21 -9
- package/packages/core/publication/pipeline/stable-entry.js +12 -3
- package/packages/core/publication/pipeline/stable-products.js +21 -19
- package/packages/core/publication/pipeline/version-actions.js +15 -6
- package/packages/core/publication/publication-rehearsal-projection.js +0 -9
- package/packages/core/release/cli/dispatch.mjs +1 -4
- package/packages/core/release/cli/inspection-handlers.mjs +1 -33
- package/packages/core/release/cli/release-handlers.mjs +2 -19
- package/packages/core/release/cli/verification-handlers.mjs +4 -25
- package/packages/core/release/next-development-projection.js +13 -13
- package/packages/core/release/passport/locations.js +13 -8
- package/packages/core/release/release-passport.js +70 -5
- package/packages/core/web/cli/badges.mjs +0 -4
- package/packages/core/web/publication-admission.js +1 -1
- package/packages/core/web/publication-capability.js +1 -1
- package/packages/core/web/readme-badges.js +1 -1
- package/packages/core/workflow/cli/main.mjs +1 -4
- package/packages/core/workflow/cli/process.mjs +1 -1
- package/packages/core/workflow/commands/buildchain-cli-help.mjs +2 -8
- package/packages/core/workflow/engine/conformance.js +1 -1
- package/packages/core/workflow/pipeline/build.js +21 -1
- package/packages/core/workflow/pipeline/delivery-observation.js +6 -2
- package/packages/core/workflow/workflow-taxonomy.mjs +61 -17
- package/scripts/check-code-layout.mjs +2 -0
- package/scripts/check-core-mechanism-inventory.mjs +29 -13
- package/scripts/check-floating-consumer-policy-contract.mjs +3 -3
- package/scripts/check-inventory.mjs +27 -27
- package/scripts/check-maintainability.mjs +28 -5
- package/scripts/check-public-dogfood-contract.mjs +3 -3
- package/scripts/check-release-topology.mjs +1 -1
- package/scripts/check-self-consumer-contract.mjs +7 -7
- package/scripts/check-universal-workflow-bootstrap.mjs +1 -1
- package/scripts/generate-channel-promotion-workflow.mjs +1 -1
- package/scripts/generate-minimal-consumer-contract.mjs +21 -1
- package/scripts/generate-site-bundle.mjs +2 -1
- package/scripts/generate-tail-reseal-fixture.mjs +3 -3
- package/scripts/inventory/promotion.mjs +1 -1
- package/scripts/next-development-self-dogfood-harness.mjs +1 -1
- package/scripts/next-development-self-dogfood.mjs +4 -4
- package/scripts/site-capability-metadata.mjs +2 -6
- package/scripts/source-metric-lineage.mjs +62 -7
- package/scripts/verify-golden-path.mjs +31 -35
- package/templates/native-dev-delivery.yml +1 -1
- package/templates/universal-buildchain-bootstrap.yml +1 -1
- package/packages/core/paper/operations/bootstrap.js +0 -75
- package/packages/core/paper/operations/plans.js +0 -213
- package/packages/core/paper/operations/provisioning.js +0 -113
- package/packages/core/paper/operations/scaffold-config.js +0 -77
- package/packages/core/paper/operations/scaffold-workflows.js +0 -116
- package/packages/core/paper/operations/workspace.js +0 -60
- package/packages/core/paper/paper-npm-bootstrap.js +0 -492
|
@@ -1,40 +1,22 @@
|
|
|
1
|
+
import { PAPER_PATHS } from "../paper-repository.js";
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
resolvePaperRepository,
|
|
7
|
-
} from "../paper-repository.js";
|
|
8
|
-
import path from "node:path";
|
|
9
|
-
import { createBuildchainContractLock } from "../../contracts/buildchain-contract.js";
|
|
10
|
-
import { paperAgentEntryFiles } from "../paper-agent-entry.js";
|
|
3
|
+
consumerAgentInstructions,
|
|
4
|
+
consumerConfiguration,
|
|
5
|
+
} from "../../adoption/consumer-init.js";
|
|
6
|
+
import { consumerWorkflows } from "../../consumer/contract/entries.js";
|
|
11
7
|
import {
|
|
12
8
|
scaffoldMakefile,
|
|
13
9
|
scaffoldPackageJson,
|
|
14
10
|
scaffoldReadme,
|
|
15
11
|
scaffoldMap,
|
|
16
12
|
scaffoldMainTex,
|
|
17
|
-
managedPaperPackageJson,
|
|
18
|
-
paperDependencyIgnore,
|
|
19
13
|
createPaperScaffoldOperations,
|
|
20
14
|
} from "../paper-scaffold-content.js";
|
|
21
15
|
import {
|
|
22
|
-
runtimeContractWorld,
|
|
23
|
-
runtimeAcceptedAt,
|
|
24
16
|
runtimeLicenseText,
|
|
25
17
|
normalizePackageName,
|
|
26
|
-
resolvePaperRuntimeGitSha,
|
|
27
18
|
buildchainPackageIdentity,
|
|
28
19
|
} from "./runtime.js";
|
|
29
|
-
import { jsonText } from "./files.js";
|
|
30
|
-
import {
|
|
31
|
-
scaffoldBuildWorkflow,
|
|
32
|
-
scaffoldReleaseWorkflow,
|
|
33
|
-
scaffoldVerifyWorkflow,
|
|
34
|
-
} from "./scaffold-workflows.js";
|
|
35
|
-
import { createPaperProvisioningAuthority } from "./provisioning.js";
|
|
36
|
-
import { scaffoldConfig } from "./scaffold-config.js";
|
|
37
|
-
import { paperPnpmWorkspace } from "./workspace.js";
|
|
38
20
|
import {
|
|
39
21
|
DEFAULT_TOOLCHAIN_IMAGE,
|
|
40
22
|
DEFAULT_TOOLCHAIN_DIGEST,
|
|
@@ -43,18 +25,11 @@ import {
|
|
|
43
25
|
PAPER_MIGRATION_CONTRACT,
|
|
44
26
|
PAPER_SCAFFOLD_CONTRACT,
|
|
45
27
|
} from "./identity.js";
|
|
46
|
-
import {
|
|
47
|
-
|
|
48
|
-
import { projectNextDevelopmentToml } from "../../release/next-development-projection.js";
|
|
49
|
-
import {
|
|
50
|
-
paperChannels,
|
|
51
|
-
bindPaperAuthority,
|
|
52
|
-
} from "../paper-runtime-channels.js";
|
|
28
|
+
import { migrationFiles } from "./migration.js";
|
|
29
|
+
|
|
53
30
|
export function scaffoldFiles({
|
|
54
31
|
buildchainRoot,
|
|
55
32
|
buildchainVersion,
|
|
56
|
-
buildchainRef,
|
|
57
|
-
buildchainSha,
|
|
58
33
|
cwd,
|
|
59
34
|
name,
|
|
60
35
|
title,
|
|
@@ -63,68 +38,11 @@ export function scaffoldFiles({
|
|
|
63
38
|
version,
|
|
64
39
|
siteBaseUrl,
|
|
65
40
|
}) {
|
|
66
|
-
const contractWorld = runtimeContractWorld(buildchainRoot);
|
|
67
|
-
const existingLock = readJson(
|
|
68
|
-
path.resolve(cwd, PAPER_PATHS.contractLock),
|
|
69
|
-
).value;
|
|
70
|
-
const acceptedAt =
|
|
71
|
-
existingLock?.buildchain?.acceptedAt ||
|
|
72
|
-
runtimeAcceptedAt(buildchainRoot, buildchainSha, buildchainVersion);
|
|
73
|
-
const contractLock = createBuildchainContractLock({
|
|
74
|
-
buildchainRef,
|
|
75
|
-
resolvedSha: buildchainSha,
|
|
76
|
-
contractWorld,
|
|
77
|
-
acceptedAt,
|
|
78
|
-
});
|
|
79
|
-
const contractLockText = jsonText(contractLock);
|
|
80
|
-
const buildWorkflow = scaffoldBuildWorkflow("v4-alpha", {
|
|
81
|
-
artifactName: name,
|
|
82
|
-
});
|
|
83
|
-
const releaseWorkflow = scaffoldReleaseWorkflow("v4-alpha", {
|
|
84
|
-
artifactPaths: "_build/main.pdf",
|
|
85
|
-
releasePassportProductName: title,
|
|
86
|
-
});
|
|
87
|
-
const verifyWorkflow = scaffoldVerifyWorkflow("v4-alpha");
|
|
88
|
-
const agentEntry = paperAgentEntryFiles({
|
|
89
|
-
cwd,
|
|
90
|
-
buildchainVersion,
|
|
91
|
-
buildchainSha,
|
|
92
|
-
developmentRef: `dev/v${parsePaperVersion(version).major}/v${
|
|
93
|
-
parsePaperVersion(version).major
|
|
94
|
-
}.${parsePaperVersion(version).minor}`,
|
|
95
|
-
});
|
|
96
|
-
const provisioningAuthority = createPaperProvisioningAuthority({
|
|
97
|
-
repository,
|
|
98
|
-
packageName,
|
|
99
|
-
buildchainVersion,
|
|
100
|
-
buildchainSha,
|
|
101
|
-
contractLock: contractLockText,
|
|
102
|
-
buildWorkflow,
|
|
103
|
-
verifyWorkflow,
|
|
104
|
-
releaseWorkflow,
|
|
105
|
-
agentEntry: agentEntry.get(PAPER_PATHS.agentEntry),
|
|
106
|
-
agentInstructions: agentEntry.get(PAPER_PATHS.agentInstructions),
|
|
107
|
-
});
|
|
108
41
|
const licenseText = runtimeLicenseText(buildchainRoot);
|
|
109
|
-
|
|
110
|
-
[
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
name,
|
|
114
|
-
title,
|
|
115
|
-
packageName,
|
|
116
|
-
version,
|
|
117
|
-
siteBaseUrl,
|
|
118
|
-
}),
|
|
119
|
-
],
|
|
120
|
-
[PAPER_PATHS.contractLock, contractLockText],
|
|
121
|
-
[PAPER_PATHS.versionPin, `${buildchainVersion}\n`],
|
|
122
|
-
[PAPER_PATHS.buildWorkflow, buildWorkflow],
|
|
123
|
-
[PAPER_PATHS.verifyWorkflow, verifyWorkflow],
|
|
124
|
-
[PAPER_PATHS.releaseWorkflow, releaseWorkflow],
|
|
125
|
-
[PAPER_PATHS.pnpmWorkspace, paperPnpmWorkspace("", buildchainVersion)],
|
|
126
|
-
[PAPER_PATHS.provisioningAuthority, jsonText(provisioningAuthority)],
|
|
127
|
-
...agentEntry,
|
|
42
|
+
return new Map([
|
|
43
|
+
[PAPER_PATHS.config, consumerConfiguration({ type: "paper", version })],
|
|
44
|
+
...Object.entries(consumerWorkflows()),
|
|
45
|
+
[PAPER_PATHS.agentInstructions, consumerAgentInstructions()],
|
|
128
46
|
[
|
|
129
47
|
"Makefile",
|
|
130
48
|
scaffoldMakefile({
|
|
@@ -137,8 +55,11 @@ export function scaffoldFiles({
|
|
|
137
55
|
"package.json",
|
|
138
56
|
scaffoldPackageJson({
|
|
139
57
|
name,
|
|
58
|
+
title,
|
|
140
59
|
packageName,
|
|
141
60
|
repository,
|
|
61
|
+
version,
|
|
62
|
+
siteBaseUrl,
|
|
142
63
|
buildchainVersion,
|
|
143
64
|
}),
|
|
144
65
|
],
|
|
@@ -147,149 +68,10 @@ export function scaffoldFiles({
|
|
|
147
68
|
["paper/main.tex", scaffoldMainTex(title)],
|
|
148
69
|
["paper/references.bib", "% Add reviewed bibliography entries here.\n"],
|
|
149
70
|
["LICENSE", licenseText],
|
|
150
|
-
[
|
|
151
|
-
".gitignore",
|
|
152
|
-
"node_modules/\n_build/\n.buildchain/publication/\n.buildchain/release-state/\n.buildchain/release-evidence/\n.buildchain/paper/npm-bootstrap.json\n.buildchain/paper/npm-trust.json\n",
|
|
153
|
-
],
|
|
71
|
+
[".gitignore", "node_modules/\n_build/\n"],
|
|
154
72
|
]);
|
|
155
|
-
return finalizePaperEntryFiles({
|
|
156
|
-
files,
|
|
157
|
-
cwd,
|
|
158
|
-
buildchainRoot,
|
|
159
|
-
buildchainVersion,
|
|
160
|
-
buildchainSha,
|
|
161
|
-
contractLock,
|
|
162
|
-
provisioningAuthority,
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
export function migrationFiles({
|
|
166
|
-
cwd,
|
|
167
|
-
buildchainRoot,
|
|
168
|
-
buildchainVersion,
|
|
169
|
-
buildchainSha,
|
|
170
|
-
stableBuildchainRoot,
|
|
171
|
-
alphaBuildchainRoot,
|
|
172
|
-
}) {
|
|
173
|
-
const configResult = paperConfig(cwd);
|
|
174
|
-
if (configResult.error) {
|
|
175
|
-
throw new Error(
|
|
176
|
-
`paper migration requires a valid publication config: ${configResult.error}`,
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
validateBuildchainConfig(cwd, { requireLifecycleStages: ["verify"] });
|
|
180
|
-
const config = configResult.loaded.config;
|
|
181
|
-
const repository = resolvePaperRepository(cwd);
|
|
182
|
-
if (!repository) {
|
|
183
|
-
throw new Error(
|
|
184
|
-
"paper migration requires an exact GitHub repository identity",
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
const packageName = normalizePackageName(
|
|
188
|
-
config.publish?.package || config.publish?.mainPackage || "",
|
|
189
|
-
"paper publish package",
|
|
190
|
-
);
|
|
191
|
-
const runtimeSha =
|
|
192
|
-
buildchainSha ||
|
|
193
|
-
resolvePaperRuntimeGitSha(buildchainRoot, buildchainVersion);
|
|
194
|
-
if (!GIT_SHA_PATTERN.test(runtimeSha)) {
|
|
195
|
-
throw new Error("paper migration requires an exact Buildchain source SHA");
|
|
196
|
-
}
|
|
197
|
-
const runtimeIdentity = buildchainPackageIdentity(
|
|
198
|
-
buildchainRoot,
|
|
199
|
-
buildchainVersion,
|
|
200
|
-
);
|
|
201
|
-
if (!runtimeIdentity.version) {
|
|
202
|
-
throw new Error(
|
|
203
|
-
"paper migration requires an exact Buildchain package version",
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
const existingLock = readJson(
|
|
207
|
-
path.resolve(cwd, PAPER_PATHS.contractLock),
|
|
208
|
-
).value;
|
|
209
|
-
const contractLock = migrationContractLock({
|
|
210
|
-
buildchainRoot,
|
|
211
|
-
existingLock,
|
|
212
|
-
runtimeIdentity,
|
|
213
|
-
runtimeSha,
|
|
214
|
-
});
|
|
215
|
-
const contractLockText = jsonText(contractLock);
|
|
216
|
-
const buildWorkflow = scaffoldBuildWorkflow("v4-alpha", {
|
|
217
|
-
artifactName: config.project.name,
|
|
218
|
-
});
|
|
219
|
-
const releaseWorkflow = scaffoldReleaseWorkflow("v4-alpha", {
|
|
220
|
-
artifactPaths: config.publication.artifactPaths.join(","),
|
|
221
|
-
releasePassportProductName: config.publication.title,
|
|
222
|
-
});
|
|
223
|
-
const verifyWorkflow = scaffoldVerifyWorkflow("v4-alpha");
|
|
224
|
-
const agentEntry = paperAgentEntryFiles({
|
|
225
|
-
cwd,
|
|
226
|
-
buildchainVersion: runtimeIdentity.version,
|
|
227
|
-
buildchainSha: runtimeSha,
|
|
228
|
-
});
|
|
229
|
-
const provisioningAuthority = createPaperProvisioningAuthority({
|
|
230
|
-
repository,
|
|
231
|
-
packageName,
|
|
232
|
-
buildchainVersion: runtimeIdentity.version,
|
|
233
|
-
buildchainSha: runtimeSha,
|
|
234
|
-
contractLock: contractLockText,
|
|
235
|
-
buildWorkflow,
|
|
236
|
-
verifyWorkflow,
|
|
237
|
-
releaseWorkflow,
|
|
238
|
-
agentEntry: agentEntry.get(PAPER_PATHS.agentEntry),
|
|
239
|
-
agentInstructions: agentEntry.get(PAPER_PATHS.agentInstructions),
|
|
240
|
-
});
|
|
241
|
-
const currentPackage = readJson(path.resolve(cwd, "package.json"));
|
|
242
|
-
if (!currentPackage.exists || currentPackage.error || !currentPackage.value) {
|
|
243
|
-
throw new Error("paper migration requires a valid package.json");
|
|
244
|
-
}
|
|
245
|
-
const packageJson = managedPaperPackageJson(
|
|
246
|
-
currentPackage.value,
|
|
247
|
-
runtimeIdentity.version,
|
|
248
|
-
);
|
|
249
|
-
const pnpmWorkspacePath = path.resolve(cwd, PAPER_PATHS.pnpmWorkspace);
|
|
250
|
-
const pnpmWorkspace = paperPnpmWorkspace(
|
|
251
|
-
fs.existsSync(pnpmWorkspacePath)
|
|
252
|
-
? fs.readFileSync(pnpmWorkspacePath, "utf8")
|
|
253
|
-
: "",
|
|
254
|
-
runtimeIdentity.version,
|
|
255
|
-
);
|
|
256
|
-
const files = new Map([
|
|
257
|
-
[
|
|
258
|
-
PAPER_PATHS.config,
|
|
259
|
-
projectNextDevelopmentToml(
|
|
260
|
-
fs.readFileSync(path.resolve(cwd, PAPER_PATHS.config), "utf8"),
|
|
261
|
-
),
|
|
262
|
-
],
|
|
263
|
-
[PAPER_PATHS.contractLock, contractLockText],
|
|
264
|
-
[PAPER_PATHS.versionPin, `${runtimeIdentity.version}\n`],
|
|
265
|
-
[PAPER_PATHS.buildWorkflow, buildWorkflow],
|
|
266
|
-
[PAPER_PATHS.verifyWorkflow, verifyWorkflow],
|
|
267
|
-
[PAPER_PATHS.releaseWorkflow, releaseWorkflow],
|
|
268
|
-
[PAPER_PATHS.pnpmWorkspace, pnpmWorkspace],
|
|
269
|
-
[PAPER_PATHS.provisioningAuthority, jsonText(provisioningAuthority)],
|
|
270
|
-
...agentEntry,
|
|
271
|
-
["package.json", jsonText(packageJson)],
|
|
272
|
-
[
|
|
273
|
-
".gitignore",
|
|
274
|
-
paperDependencyIgnore(
|
|
275
|
-
fs.existsSync(path.join(cwd, ".gitignore"))
|
|
276
|
-
? fs.readFileSync(path.join(cwd, ".gitignore"), "utf8")
|
|
277
|
-
: "",
|
|
278
|
-
),
|
|
279
|
-
],
|
|
280
|
-
]);
|
|
281
|
-
return finalizePaperEntryFiles({
|
|
282
|
-
files,
|
|
283
|
-
cwd,
|
|
284
|
-
buildchainRoot,
|
|
285
|
-
buildchainVersion: runtimeIdentity.version,
|
|
286
|
-
buildchainSha: runtimeSha,
|
|
287
|
-
contractLock,
|
|
288
|
-
provisioningAuthority,
|
|
289
|
-
stableBuildchainRoot,
|
|
290
|
-
alphaBuildchainRoot,
|
|
291
|
-
});
|
|
292
73
|
}
|
|
74
|
+
|
|
293
75
|
export const {
|
|
294
76
|
planPaperMigration,
|
|
295
77
|
planPaperScaffold,
|
|
@@ -302,97 +84,5 @@ export const {
|
|
|
302
84
|
buildchainPackageIdentity,
|
|
303
85
|
migrationFiles,
|
|
304
86
|
normalizePackageName,
|
|
305
|
-
resolvePaperRuntimeGitSha,
|
|
306
87
|
scaffoldFiles,
|
|
307
88
|
});
|
|
308
|
-
|
|
309
|
-
function migrationContractLock({
|
|
310
|
-
buildchainRoot,
|
|
311
|
-
existingLock,
|
|
312
|
-
runtimeIdentity,
|
|
313
|
-
runtimeSha,
|
|
314
|
-
}) {
|
|
315
|
-
return createBuildchainContractLock({
|
|
316
|
-
buildchainRef: "v4",
|
|
317
|
-
resolvedSha: runtimeSha,
|
|
318
|
-
contractWorld: runtimeContractWorld(buildchainRoot),
|
|
319
|
-
acceptedAt:
|
|
320
|
-
existingLock?.buildchain?.resolvedSha === runtimeSha
|
|
321
|
-
? existingLock.buildchain.acceptedAt
|
|
322
|
-
: runtimeAcceptedAt(
|
|
323
|
-
buildchainRoot,
|
|
324
|
-
runtimeSha,
|
|
325
|
-
runtimeIdentity.version,
|
|
326
|
-
),
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
function finalizePaperEntryFiles({
|
|
331
|
-
files,
|
|
332
|
-
cwd,
|
|
333
|
-
buildchainRoot,
|
|
334
|
-
buildchainVersion,
|
|
335
|
-
buildchainSha,
|
|
336
|
-
contractLock,
|
|
337
|
-
provisioningAuthority,
|
|
338
|
-
stableBuildchainRoot,
|
|
339
|
-
alphaBuildchainRoot,
|
|
340
|
-
}) {
|
|
341
|
-
if (!buildchainVersion.startsWith("4."))
|
|
342
|
-
throw new Error("Paper provisioning requires a Buildchain v4 runtime");
|
|
343
|
-
const channelPlan = paperChannels({
|
|
344
|
-
cwd,
|
|
345
|
-
buildchainRoot,
|
|
346
|
-
buildchainVersion: buildchainVersion,
|
|
347
|
-
buildchainSha: buildchainSha,
|
|
348
|
-
contractWorld: runtimeContractWorld(buildchainRoot),
|
|
349
|
-
acceptedAt: contractLock.buildchain.acceptedAt,
|
|
350
|
-
stableBuildchainRoot,
|
|
351
|
-
alphaBuildchainRoot,
|
|
352
|
-
});
|
|
353
|
-
for (const channel of Object.values(channelPlan.channels))
|
|
354
|
-
files.set(channel.lockPath, channel.content);
|
|
355
|
-
for (const workflowPath of [
|
|
356
|
-
PAPER_PATHS.buildWorkflow,
|
|
357
|
-
PAPER_PATHS.verifyWorkflow,
|
|
358
|
-
]) {
|
|
359
|
-
files.set(
|
|
360
|
-
workflowPath,
|
|
361
|
-
files
|
|
362
|
-
.get(workflowPath)
|
|
363
|
-
|
|
364
|
-
.replaceAll(
|
|
365
|
-
".buildchain/contract-lock.json",
|
|
366
|
-
".buildchain/alpha-contract-lock.json",
|
|
367
|
-
),
|
|
368
|
-
);
|
|
369
|
-
}
|
|
370
|
-
const releaseWorkflow = files.get(PAPER_PATHS.releaseWorkflow);
|
|
371
|
-
const releaseStart = releaseWorkflow.indexOf(" paper-release:\n");
|
|
372
|
-
const releaseJob = releaseWorkflow.slice(releaseStart);
|
|
373
|
-
const alphaJob = releaseJob
|
|
374
|
-
.replace(
|
|
375
|
-
" paper-release:\n",
|
|
376
|
-
" paper-release-alpha:\n if: ${{ startsWith(github.ref_name, 'alpha/') }}\n",
|
|
377
|
-
)
|
|
378
|
-
|
|
379
|
-
.replaceAll(
|
|
380
|
-
".buildchain/contract-lock.json",
|
|
381
|
-
".buildchain/alpha-contract-lock.json",
|
|
382
|
-
);
|
|
383
|
-
const stableJob = releaseJob
|
|
384
|
-
.replace(
|
|
385
|
-
" paper-release:\n",
|
|
386
|
-
" paper-release:\n if: ${{ startsWith(github.ref_name, 'release/') }}\n",
|
|
387
|
-
)
|
|
388
|
-
.replaceAll("@v4-alpha", "@v4");
|
|
389
|
-
files.set(
|
|
390
|
-
PAPER_PATHS.releaseWorkflow,
|
|
391
|
-
`${releaseWorkflow.slice(0, releaseStart)}${alphaJob}\n${stableJob}`,
|
|
392
|
-
);
|
|
393
|
-
files.set(
|
|
394
|
-
PAPER_PATHS.provisioningAuthority,
|
|
395
|
-
jsonText(bindPaperAuthority(provisioningAuthority, channelPlan, files)),
|
|
396
|
-
);
|
|
397
|
-
return files;
|
|
398
|
-
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { paperConsumerStatus } from "../consumer-status.js";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import { PAPER_PATHS, resolvePaperRepository } from "../paper-repository.js";
|
|
3
4
|
import {
|
|
@@ -9,63 +10,36 @@ import {
|
|
|
9
10
|
} from "./status-facts.js";
|
|
10
11
|
import { existingFileFact } from "./files.js";
|
|
11
12
|
import { PAPER_STATUS_CONTRACT } from "./identity.js";
|
|
12
|
-
export function paperStatusBlockingNextActions({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const actions = [];
|
|
18
|
-
if (!stateMap.scaffolded.satisfied) {
|
|
19
|
-
actions.push({
|
|
20
|
-
id: "scaffold-paper",
|
|
21
|
-
command: "buildchain paper scaffold --help",
|
|
22
|
-
description: "Plan a no-overwrite Buildchain paper scaffold.",
|
|
23
|
-
});
|
|
24
|
-
} else if (!stateMap.governed.satisfied) {
|
|
25
|
-
actions.push({
|
|
26
|
-
id: "restore-governance",
|
|
27
|
-
command: "buildchain paper preflight --json",
|
|
28
|
-
description:
|
|
29
|
-
"Repair the Git/contract-lock governance checks reported by preflight.",
|
|
30
|
-
});
|
|
31
|
-
} else if (!stateMap["content-ready"].satisfied) {
|
|
32
|
-
actions.push({
|
|
33
|
-
id: "complete-paper-content",
|
|
34
|
-
command: "make check",
|
|
35
|
-
description: "Add every declared paper source and metadata input.",
|
|
36
|
-
});
|
|
37
|
-
} else if (!deterministic) {
|
|
38
|
-
actions.push({
|
|
39
|
-
id: "build-reproducible-artifact",
|
|
40
|
-
command: "buildchain paper build --execute --json",
|
|
41
|
-
description:
|
|
42
|
-
"Run the existing two-clean-build reproducibility gate and promote exact bytes.",
|
|
43
|
-
});
|
|
44
|
-
} else if (
|
|
45
|
-
!stateMap.bootstrapped.satisfied ||
|
|
46
|
-
!stateMap["trust-bound"].satisfied
|
|
47
|
-
) {
|
|
48
|
-
actions.push({
|
|
49
|
-
id: "bootstrap-npm",
|
|
50
|
-
command: "buildchain paper bootstrap npm --json",
|
|
13
|
+
export function paperStatusBlockingNextActions() {
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
id: "migrate-consumer-contract",
|
|
17
|
+
command: "buildchain paper migrate --json",
|
|
51
18
|
description:
|
|
52
|
-
"
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
actions.push({
|
|
56
|
-
id: transactionFacts.selected ? "resume-alpha" : "start-alpha",
|
|
57
|
-
command: transactionFacts.selected
|
|
58
|
-
? "buildchain paper resume --json"
|
|
59
|
-
: "buildchain paper alpha --json",
|
|
60
|
-
description: transactionFacts.selected
|
|
61
|
-
? "Resume the exact sealed release transaction."
|
|
62
|
-
: "Plan the protected dev-to-alpha publication PR.",
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return actions;
|
|
19
|
+
"Review migration of this legacy Paper repository to schema 2 and the shared normal/recovery caller pair. Historical receipts remain unchanged.",
|
|
20
|
+
},
|
|
21
|
+
];
|
|
66
22
|
}
|
|
67
23
|
export function collectPaperStatus({ cwd = process.cwd() } = {}) {
|
|
68
24
|
const resolvedCwd = path.resolve(cwd);
|
|
25
|
+
const consumer = paperConsumerStatus(resolvedCwd);
|
|
26
|
+
if (consumer)
|
|
27
|
+
return {
|
|
28
|
+
...consumer,
|
|
29
|
+
contract: PAPER_STATUS_CONTRACT,
|
|
30
|
+
highestEvidenceState: consumer.ok
|
|
31
|
+
? "configured"
|
|
32
|
+
: "configuration-invalid",
|
|
33
|
+
states: consumer.checks.map((check) => ({
|
|
34
|
+
id: check.id,
|
|
35
|
+
status: check.status,
|
|
36
|
+
reason: check.message,
|
|
37
|
+
})),
|
|
38
|
+
};
|
|
39
|
+
return collectLegacyPaperStatus(resolvedCwd);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function collectLegacyPaperStatus(resolvedCwd) {
|
|
69
43
|
const governance = collectPaperGovernanceFacts(resolvedCwd);
|
|
70
44
|
const evidence = collectPaperEvidenceFacts(
|
|
71
45
|
resolvedCwd,
|
|
@@ -12,13 +12,7 @@ import {
|
|
|
12
12
|
stableJson,
|
|
13
13
|
workCheck,
|
|
14
14
|
} from "./paper-repository.js";
|
|
15
|
-
import {
|
|
16
|
-
mergeNextDevelopmentAgentInstructions,
|
|
17
|
-
NEXT_DEVELOPMENT_AGENT_SECTION_START,
|
|
18
|
-
NEXT_DEVELOPMENT_AGENT_SECTION_END,
|
|
19
|
-
NEXT_DEVELOPMENT_LOCAL_COMMAND,
|
|
20
|
-
} from "../release/next-development-projection.js";
|
|
21
|
-
import { NEXT_DEVELOPMENT_ADR } from "../release/next-development-transition.js";
|
|
15
|
+
import { paperConsumerStatus } from "./consumer-status.js";
|
|
22
16
|
|
|
23
17
|
export const PAPER_AGENT_ENTRY_CONTRACT = "kungfu-buildchain-paper-agent-entry";
|
|
24
18
|
export const PAPER_AGENT_ENTRY_SCHEMA_VERSION = 1;
|
|
@@ -36,10 +30,6 @@ const EXACT_PAPER_SCRIPTS = Object.freeze({
|
|
|
36
30
|
const GIT_SHA_PATTERN = /^[0-9a-f]{40}$/i;
|
|
37
31
|
const SHA256_PATTERN = /^sha256:[0-9a-f]{64}$/i;
|
|
38
32
|
|
|
39
|
-
function jsonText(value) {
|
|
40
|
-
return `${JSON.stringify(value, null, 2)}\n`;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
33
|
export function paperAgentEntryInstructions({ developmentRef }) {
|
|
44
34
|
return `${PAPER_AGENT_ENTRY_SECTION_START}
|
|
45
35
|
## Paper work entry (required)
|
|
@@ -65,142 +55,6 @@ does not bypass remote policy.
|
|
|
65
55
|
${PAPER_AGENT_ENTRY_SECTION_END}`;
|
|
66
56
|
}
|
|
67
57
|
|
|
68
|
-
export function mergePaperAgentEntryInstructions(
|
|
69
|
-
current = "",
|
|
70
|
-
{ developmentRef },
|
|
71
|
-
) {
|
|
72
|
-
const source = String(current || "");
|
|
73
|
-
const section = paperAgentEntryInstructions({ developmentRef });
|
|
74
|
-
const start = source.indexOf(PAPER_AGENT_ENTRY_SECTION_START);
|
|
75
|
-
const end = source.indexOf(PAPER_AGENT_ENTRY_SECTION_END);
|
|
76
|
-
if ((start === -1) !== (end === -1)) {
|
|
77
|
-
throw new Error(
|
|
78
|
-
"AGENTS.md has an incomplete Buildchain Paper agent-entry managed section",
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
if (start === -1) {
|
|
82
|
-
return source.trim()
|
|
83
|
-
? `${source.trimEnd()}\n\n${section}\n`
|
|
84
|
-
: `# AGENTS.md\n\n${section}\n`;
|
|
85
|
-
}
|
|
86
|
-
if (
|
|
87
|
-
source.indexOf(PAPER_AGENT_ENTRY_SECTION_START, start + 1) !== -1 ||
|
|
88
|
-
source.indexOf(PAPER_AGENT_ENTRY_SECTION_END, end + 1) !== -1 ||
|
|
89
|
-
end < start
|
|
90
|
-
) {
|
|
91
|
-
throw new Error(
|
|
92
|
-
"AGENTS.md has ambiguous Buildchain Paper agent-entry managed sections",
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
return `${source.slice(0, start)}${section}${source.slice(
|
|
96
|
-
end + PAPER_AGENT_ENTRY_SECTION_END.length,
|
|
97
|
-
)}`;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export function createPaperAgentEntry({
|
|
101
|
-
buildchainVersion,
|
|
102
|
-
buildchainSha,
|
|
103
|
-
developmentRef,
|
|
104
|
-
}) {
|
|
105
|
-
const version = String(buildchainVersion || "").trim();
|
|
106
|
-
const sourceSha = String(buildchainSha || "").trim();
|
|
107
|
-
if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(version)) {
|
|
108
|
-
throw new Error(
|
|
109
|
-
"paper agent entry requires an exact Buildchain semantic version",
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
if (!GIT_SHA_PATTERN.test(sourceSha)) {
|
|
113
|
-
throw new Error(
|
|
114
|
-
"paper agent entry requires an exact Buildchain source SHA",
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
if (!/^dev\/v\d+\/v\d+\.\d+$/.test(developmentRef)) {
|
|
118
|
-
throw new Error("paper agent entry requires an exact development ref");
|
|
119
|
-
}
|
|
120
|
-
const payload = {
|
|
121
|
-
schemaVersion: PAPER_AGENT_ENTRY_SCHEMA_VERSION,
|
|
122
|
-
contract: PAPER_AGENT_ENTRY_CONTRACT,
|
|
123
|
-
runtime: {
|
|
124
|
-
package: "@kungfu-tech/buildchain",
|
|
125
|
-
version,
|
|
126
|
-
sourceSha,
|
|
127
|
-
},
|
|
128
|
-
repository: {
|
|
129
|
-
developmentRef,
|
|
130
|
-
pullRequestTarget: developmentRef,
|
|
131
|
-
},
|
|
132
|
-
commands: {
|
|
133
|
-
verify: "pnpm paper:agent:verify",
|
|
134
|
-
start: "pnpm paper:work:start -- <topic> --execute --json",
|
|
135
|
-
submit: "pnpm paper:work:submit -- --execute --json",
|
|
136
|
-
},
|
|
137
|
-
policy: {
|
|
138
|
-
localMutation: "dry-run-first",
|
|
139
|
-
protectedBranchPatterns: [
|
|
140
|
-
"main",
|
|
141
|
-
"dev/**",
|
|
142
|
-
"alpha/**",
|
|
143
|
-
"release/**",
|
|
144
|
-
"publish-gate/**",
|
|
145
|
-
],
|
|
146
|
-
workBranchPattern: PAPER_WORK_BRANCH_PATTERN.source,
|
|
147
|
-
forcePush: false,
|
|
148
|
-
remoteAcceptance: "required-buildchain-check",
|
|
149
|
-
},
|
|
150
|
-
};
|
|
151
|
-
return {
|
|
152
|
-
...payload,
|
|
153
|
-
entryDigest: sha256Text(stableJson(payload)),
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function mergePaperNextDevelopmentInstructions(current) {
|
|
158
|
-
const merged = mergeNextDevelopmentAgentInstructions(current);
|
|
159
|
-
const start = merged.indexOf(NEXT_DEVELOPMENT_AGENT_SECTION_START);
|
|
160
|
-
const end = merged.indexOf(NEXT_DEVELOPMENT_AGENT_SECTION_END);
|
|
161
|
-
const section = merged.slice(start, end)
|
|
162
|
-
.replace(
|
|
163
|
-
`\`${NEXT_DEVELOPMENT_ADR}\``,
|
|
164
|
-
`[Buildchain next-development ADR](https://github.com/kungfu-systems/buildchain/blob/v4/${NEXT_DEVELOPMENT_ADR})`,
|
|
165
|
-
)
|
|
166
|
-
.replace(
|
|
167
|
-
NEXT_DEVELOPMENT_LOCAL_COMMAND,
|
|
168
|
-
NEXT_DEVELOPMENT_LOCAL_COMMAND.replace(
|
|
169
|
-
"node packages/core/", "node node_modules/@kungfu-tech/buildchain/packages/core/",
|
|
170
|
-
),
|
|
171
|
-
);
|
|
172
|
-
return `${merged.slice(0, start)}${section}${merged.slice(end)}`;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export function paperAgentEntryFiles({
|
|
176
|
-
cwd,
|
|
177
|
-
buildchainVersion,
|
|
178
|
-
buildchainSha,
|
|
179
|
-
developmentRef = "",
|
|
180
|
-
}) {
|
|
181
|
-
const resolvedDevelopmentRef = developmentRef || paperDevelopmentRef(cwd);
|
|
182
|
-
const agentsPath = path.resolve(cwd, PAPER_PATHS.agentInstructions);
|
|
183
|
-
const currentAgents = fs.existsSync(agentsPath)
|
|
184
|
-
? fs.readFileSync(agentsPath, "utf8")
|
|
185
|
-
: "";
|
|
186
|
-
const entry = createPaperAgentEntry({
|
|
187
|
-
buildchainVersion,
|
|
188
|
-
buildchainSha,
|
|
189
|
-
developmentRef: resolvedDevelopmentRef,
|
|
190
|
-
});
|
|
191
|
-
return new Map([
|
|
192
|
-
[PAPER_PATHS.agentEntry, jsonText(entry)],
|
|
193
|
-
[
|
|
194
|
-
PAPER_PATHS.agentInstructions,
|
|
195
|
-
mergePaperNextDevelopmentInstructions(
|
|
196
|
-
mergePaperAgentEntryInstructions(currentAgents, {
|
|
197
|
-
developmentRef: resolvedDevelopmentRef,
|
|
198
|
-
}),
|
|
199
|
-
),
|
|
200
|
-
],
|
|
201
|
-
]);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
58
|
export function resolvePaperBuildchainSha(buildchainRoot, buildchainSha = "") {
|
|
205
59
|
if (buildchainSha) return buildchainSha;
|
|
206
60
|
if (!fs.existsSync(path.resolve(buildchainRoot, ".git"))) return "";
|
|
@@ -283,6 +137,41 @@ export function collectPaperAgentEntry({
|
|
|
283
137
|
} = {}) {
|
|
284
138
|
const resolvedCwd = path.resolve(cwd);
|
|
285
139
|
const developmentRef = paperDevelopmentRef(resolvedCwd);
|
|
140
|
+
const consumer = paperConsumerStatus(resolvedCwd);
|
|
141
|
+
if (consumer) {
|
|
142
|
+
const context =
|
|
143
|
+
mode === "ci"
|
|
144
|
+
? ciContext({ env, developmentRef })
|
|
145
|
+
: mode === "local"
|
|
146
|
+
? localContext({ cwd: resolvedCwd, developmentRef })
|
|
147
|
+
: { mode: "contract", ok: true };
|
|
148
|
+
const checks = [...consumer.checks];
|
|
149
|
+
if (mode !== "contract")
|
|
150
|
+
checks.push(
|
|
151
|
+
workCheck(
|
|
152
|
+
"agent-entry.work-context",
|
|
153
|
+
context.ok,
|
|
154
|
+
context.message,
|
|
155
|
+
`Use a work branch containing origin/${developmentRef} and target that development channel`,
|
|
156
|
+
),
|
|
157
|
+
);
|
|
158
|
+
return {
|
|
159
|
+
...consumer,
|
|
160
|
+
contract: PAPER_AGENT_ENTRY_CONTRACT,
|
|
161
|
+
mode,
|
|
162
|
+
context,
|
|
163
|
+
checks,
|
|
164
|
+
ok: checks.every((check) => check.status === "pass"),
|
|
165
|
+
nextActions: checks
|
|
166
|
+
.filter((check) => check.status === "fail")
|
|
167
|
+
.map((check) => ({
|
|
168
|
+
id: `repair-${check.id}`,
|
|
169
|
+
command:
|
|
170
|
+
check.correctiveCommand || "buildchain paper preflight --json",
|
|
171
|
+
description: check.message,
|
|
172
|
+
})),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
286
175
|
const source = readJson(path.resolve(resolvedCwd, PAPER_PATHS.agentEntry));
|
|
287
176
|
const entry = source.value || {};
|
|
288
177
|
const packageJson =
|