@empire-builder-kit/nx 1.0.0-rc.47 → 1.0.0-rc.48

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 (764) hide show
  1. package/README.md +14 -169
  2. package/executors.json +24 -79
  3. package/generators.json +8 -18
  4. package/package.json +13 -71
  5. package/src/aws/identity.d.ts +1 -1
  6. package/src/aws-authority/boundary-transforms.d.ts +9 -0
  7. package/src/aws-authority/boundary-transforms.js +78 -0
  8. package/src/aws-authority/contracts.d.ts +116 -0
  9. package/src/aws-authority/contracts.js +40 -0
  10. package/src/aws-authority/deployment-guardrails.d.ts +4 -0
  11. package/src/aws-authority/deployment-guardrails.js +543 -0
  12. package/src/aws-authority/deployment-policy-groups.d.ts +3 -0
  13. package/src/aws-authority/deployment-policy-groups.js +299 -0
  14. package/src/aws-authority/deployment-resources.d.ts +64 -0
  15. package/src/aws-authority/deployment-resources.js +265 -0
  16. package/src/aws-authority/deployment-services.d.ts +3 -0
  17. package/src/aws-authority/deployment-services.js +717 -0
  18. package/src/aws-authority/development-authority.d.ts +11 -0
  19. package/src/aws-authority/development-authority.js +160 -0
  20. package/src/aws-authority/guardrail-actions.d.ts +87 -0
  21. package/src/aws-authority/guardrail-actions.js +463 -0
  22. package/src/aws-authority/policy-document.d.ts +15 -0
  23. package/src/aws-authority/policy-document.js +264 -0
  24. package/src/aws-authority/runtime-boundary.d.ts +7 -0
  25. package/src/aws-authority/runtime-boundary.js +211 -0
  26. package/src/aws-authority/service-actions.d.ts +96 -0
  27. package/src/aws-authority/service-actions.js +512 -0
  28. package/src/aws-authority/stage-authority.d.ts +6 -272
  29. package/src/aws-authority/stage-authority.js +109 -3609
  30. package/src/aws-authority/stage-identity.d.ts +6 -0
  31. package/src/aws-authority/stage-identity.js +134 -0
  32. package/src/cli/bootstrap.d.ts +0 -20
  33. package/src/cli/bootstrap.js +2 -153
  34. package/src/cli/dev-command.d.ts +2 -4
  35. package/src/cli/dev-command.js +1 -19
  36. package/src/cli/main.d.ts +0 -4
  37. package/src/cli/main.js +22 -80
  38. package/src/cli/output.d.ts +2 -4
  39. package/src/cli/output.js +2 -8
  40. package/src/executors/deployment-plan/deployment-plan.d.ts +0 -2
  41. package/src/executors/deployment-plan/deployment-plan.js +3 -68
  42. package/src/executors/dev-doctor/dev-doctor.js +2 -2
  43. package/src/executors/local-deploy/deployed-smoke.d.ts +12 -0
  44. package/src/executors/local-deploy/deployed-smoke.js +115 -0
  45. package/src/executors/local-deploy/deployment-authority.d.ts +24 -0
  46. package/src/executors/local-deploy/deployment-authority.js +81 -0
  47. package/src/executors/local-deploy/deployment-child.d.ts +18 -0
  48. package/src/executors/local-deploy/deployment-child.js +77 -0
  49. package/src/executors/local-deploy/deployment-contracts.d.ts +96 -0
  50. package/src/executors/local-deploy/deployment-contracts.js +3 -0
  51. package/src/executors/local-deploy/deployment-projects.d.ts +4 -0
  52. package/src/executors/local-deploy/deployment-projects.js +16 -0
  53. package/src/executors/local-deploy/deployment-receipt.d.ts +4 -0
  54. package/src/executors/local-deploy/deployment-receipt.js +55 -0
  55. package/src/executors/local-deploy/deployment-scope.d.ts +17 -0
  56. package/src/executors/local-deploy/deployment-scope.js +239 -0
  57. package/src/executors/local-deploy/deployment-source.d.ts +13 -0
  58. package/src/executors/local-deploy/deployment-source.js +86 -0
  59. package/src/executors/local-deploy/local-deploy.d.ts +5 -121
  60. package/src/executors/local-deploy/local-deploy.js +55 -936
  61. package/src/executors/sst-lifecycle/governed-child-process.d.ts +27 -0
  62. package/src/executors/sst-lifecycle/governed-child-process.js +277 -0
  63. package/src/executors/sst-lifecycle/governed-native-operation.js +4 -10
  64. package/src/executors/sst-lifecycle/run-sst-command.d.ts +4 -85
  65. package/src/executors/sst-lifecycle/run-sst-command.js +28 -834
  66. package/src/executors/sst-lifecycle/sst-contracts.d.ts +44 -0
  67. package/src/executors/sst-lifecycle/sst-contracts.js +3 -0
  68. package/src/executors/sst-lifecycle/sst-invocation.d.ts +17 -0
  69. package/src/executors/sst-lifecycle/sst-invocation.js +502 -0
  70. package/src/executors/sst-lifecycle/task-unlock.js +3 -3
  71. package/src/foundation/discovery.d.ts +1 -5
  72. package/src/foundation/discovery.js +0 -2
  73. package/src/foundation/index.d.ts +0 -2
  74. package/src/foundation/index.js +0 -9
  75. package/src/foundation/local-private-smoke-access.d.ts +6 -15
  76. package/src/foundation/local-private-smoke-access.js +8 -192
  77. package/src/foundation/observability.d.ts +16 -26
  78. package/src/foundation/observability.js +34 -135
  79. package/src/foundation/preflight.js +0 -14
  80. package/src/foundation/private-smoke-access.d.ts +7 -14
  81. package/src/foundation/private-smoke-access.js +4 -126
  82. package/src/foundation/root-site-workspace.d.ts +35 -0
  83. package/src/foundation/root-site-workspace.js +80 -0
  84. package/src/foundation/root-site.d.ts +8 -7
  85. package/src/foundation/root-site.js +17 -9
  86. package/src/generators/formatting.js +5 -4
  87. package/src/generators/function/function.d.ts +9 -5
  88. package/src/generators/function/function.js +106 -136
  89. package/src/generators/function/schema.json +2 -2
  90. package/src/generators/function-access/function-access.d.ts +0 -6
  91. package/src/generators/function-access/function-access.js +41 -109
  92. package/src/generators/observability-policy.js +1 -2
  93. package/src/{supply-chain → generators}/pnpm-toolchain-authority.d.ts +3 -3
  94. package/src/{supply-chain → generators}/pnpm-toolchain-authority.js +12 -12
  95. package/src/generators/post-generation-install.d.ts +1 -8
  96. package/src/generators/post-generation-install.js +11 -139
  97. package/src/generators/preset/dependency-overrides.d.ts +13 -19
  98. package/src/generators/preset/dependency-overrides.js +12 -56
  99. package/src/generators/preset/generator.js +0 -3
  100. package/src/generators/preset/workspace-files-foundation-infra.d.ts +6 -0
  101. package/src/generators/preset/workspace-files-foundation-infra.js +586 -0
  102. package/src/generators/preset/workspace-files-foundation-readme.d.ts +5 -0
  103. package/src/generators/preset/workspace-files-foundation-readme.js +90 -0
  104. package/src/generators/preset/workspace-files-foundation.d.ts +3 -0
  105. package/src/generators/preset/workspace-files-foundation.js +170 -0
  106. package/src/generators/preset/workspace-files-ownership.d.ts +9 -0
  107. package/src/generators/preset/workspace-files-ownership.js +124 -0
  108. package/src/generators/preset/workspace-files-root-config.d.ts +32 -0
  109. package/src/generators/preset/workspace-files-root-config.js +356 -0
  110. package/src/generators/preset/workspace-files-root-docs.d.ts +5 -0
  111. package/src/generators/preset/workspace-files-root-docs.js +109 -0
  112. package/src/generators/preset/workspace-files-shared.d.ts +18 -0
  113. package/src/generators/preset/workspace-files-shared.js +7 -0
  114. package/src/generators/preset/workspace-files-workflows.d.ts +39 -0
  115. package/src/generators/preset/workspace-files-workflows.js +306 -0
  116. package/src/generators/preset/workspace-files-workspace-health.d.ts +6 -0
  117. package/src/generators/preset/workspace-files-workspace-health.js +148 -0
  118. package/src/generators/preset/workspace-files.d.ts +10 -24
  119. package/src/generators/preset/workspace-files.js +48 -10705
  120. package/src/generators/site/built-in-site-documentation-files.d.ts +2 -1
  121. package/src/generators/site/built-in-site-documentation-files.js +15 -56
  122. package/src/generators/site/built-in-site-files.d.ts +4 -1
  123. package/src/generators/site/built-in-site-files.js +12 -11
  124. package/src/generators/site/built-in-site-infrastructure-files.d.ts +2 -1
  125. package/src/generators/site/built-in-site-infrastructure-files.js +46 -206
  126. package/src/generators/site/built-in-site-plan.d.ts +5 -1
  127. package/src/generators/site/built-in-site-plan.js +7 -5
  128. package/src/generators/site/built-in-site-project-files.d.ts +10 -2
  129. package/src/generators/site/built-in-site-project-files.js +131 -177
  130. package/src/generators/site/built-in-site-script-files.d.ts +2 -0
  131. package/src/generators/site/built-in-site-script-files.js +76 -280
  132. package/src/generators/site/built-in-site-shared.d.ts +64 -4
  133. package/src/generators/site/built-in-site-shared.js +307 -14
  134. package/src/generators/site/built-in-site-sst-config-files.d.ts +2 -1
  135. package/src/generators/site/built-in-site-sst-config-files.js +90 -22
  136. package/src/generators/site/built-in-site-web-files.d.ts +2 -1
  137. package/src/generators/site/built-in-site-web-files.js +19 -225
  138. package/src/generators/site/schema.d.ts +5 -0
  139. package/src/generators/site/schema.json +6 -0
  140. package/src/generators/site/site.d.ts +0 -8
  141. package/src/generators/site/site.js +17 -85
  142. package/src/generators/slice/built-in-plan-api-files.d.ts +1 -2
  143. package/src/generators/slice/built-in-plan-api-files.js +30 -890
  144. package/src/generators/slice/built-in-plan-database-lifecycle-files.js +57 -1851
  145. package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +5 -2
  146. package/src/generators/slice/built-in-plan-infrastructure-files.js +80 -3272
  147. package/src/generators/slice/built-in-plan-key-value-files.d.ts +3 -2
  148. package/src/generators/slice/built-in-plan-key-value-files.js +3 -21
  149. package/src/generators/slice/built-in-plan-project-files.d.ts +5 -3
  150. package/src/generators/slice/built-in-plan-project-files.js +79 -897
  151. package/src/generators/slice/built-in-plan-shared.d.ts +3 -18
  152. package/src/generators/slice/built-in-plan-shared.js +4 -57
  153. package/src/generators/slice/built-in-plan-web-files.d.ts +1 -1
  154. package/src/generators/slice/built-in-plan-web-files.js +14 -540
  155. package/src/generators/slice/built-in-plan.d.ts +2 -3
  156. package/src/generators/slice/built-in-plan.js +79 -277
  157. package/src/{developer-agent/preview-changes.d.ts → generators/slice/generation-tree.d.ts} +1 -5
  158. package/src/generators/slice/generation-tree.js +161 -0
  159. package/src/generators/slice/schema.json +12 -4
  160. package/src/generators/slice/slice-config.d.ts +7 -0
  161. package/src/generators/slice/slice-config.js +125 -0
  162. package/src/generators/slice/slice.js +29 -261
  163. package/src/generators/slice/sql-bootstrap.d.ts +1 -0
  164. package/src/generators/slice/sql-bootstrap.js +505 -0
  165. package/src/generators/slice/sql-client.d.ts +1 -0
  166. package/src/generators/slice/sql-client.js +107 -0
  167. package/src/generators/slice/sql-infrastructure.d.ts +1 -0
  168. package/src/generators/slice/sql-infrastructure.js +225 -0
  169. package/src/generators/slice/sql-logging.d.ts +1 -0
  170. package/src/generators/slice/sql-logging.js +266 -0
  171. package/src/generators/slice/sql-migration.d.ts +2 -0
  172. package/src/generators/slice/sql-migration.js +202 -0
  173. package/src/generators/slice/standard-slice-contract.d.ts +25 -0
  174. package/src/generators/slice/standard-slice-contract.js +64 -0
  175. package/src/generators/sql/schema.json +1 -1
  176. package/src/generators/sql/sql.d.ts +1 -1
  177. package/src/generators/sql/sql.js +13 -7
  178. package/src/generators/upgrade/framework-package-upgrade.d.ts +4 -27
  179. package/src/generators/upgrade/framework-package-upgrade.js +16 -39
  180. package/src/generators/upgrade/framework-packages.d.ts +25 -0
  181. package/src/generators/upgrade/framework-packages.js +138 -0
  182. package/src/generators/upgrade/function-authentication-notice.d.ts +10 -18
  183. package/src/generators/upgrade/function-authentication-notice.js +24 -44
  184. package/src/generators/upgrade/schema.d.ts +0 -3
  185. package/src/generators/upgrade/schema.json +6 -16
  186. package/src/generators/upgrade/slice-compositions.d.ts +20 -0
  187. package/src/generators/upgrade/slice-compositions.js +100 -0
  188. package/src/generators/upgrade/slice-upgrade-guidance.d.ts +19 -0
  189. package/src/generators/upgrade/slice-upgrade-guidance.js +50 -0
  190. package/src/generators/upgrade/slice-upgrade.d.ts +4 -0
  191. package/src/generators/upgrade/slice-upgrade.js +231 -0
  192. package/src/generators/upgrade/upgrade-plan.d.ts +10 -13
  193. package/src/generators/upgrade/upgrade-plan.js +33 -197
  194. package/src/generators/upgrade/upgrade-preflight.d.ts +20 -0
  195. package/src/generators/upgrade/upgrade-preflight.js +64 -0
  196. package/src/generators/upgrade/upgrade.d.ts +8 -53
  197. package/src/generators/upgrade/upgrade.js +23 -1571
  198. package/src/generators/workload/schema.json +2 -2
  199. package/src/generators/workload/workload.d.ts +11 -11
  200. package/src/generators/workload/workload.js +166 -1255
  201. package/src/index.d.ts +0 -5
  202. package/src/index.js +0 -5
  203. package/src/local-dev/browser-verification.d.ts +0 -7
  204. package/src/local-dev/browser-verification.js +0 -136
  205. package/src/local-dev/contracts.d.ts +6 -0
  206. package/src/local-dev/contracts.js +17 -9
  207. package/src/local-dev/environment-checks.d.ts +126 -0
  208. package/src/local-dev/environment-checks.js +81 -0
  209. package/src/local-dev/environment-inspector.d.ts +3 -124
  210. package/src/local-dev/environment-inspector.js +9 -148
  211. package/src/local-dev/private-state.d.ts +1 -0
  212. package/src/local-dev/private-state.js +19 -23
  213. package/src/local-dev/process-identity.js +4 -2
  214. package/src/local-dev/slice-runner-child.d.ts +37 -0
  215. package/src/local-dev/slice-runner-child.js +127 -0
  216. package/src/local-dev/slice-runner-recovery.d.ts +32 -0
  217. package/src/local-dev/slice-runner-recovery.js +216 -0
  218. package/src/local-dev/slice-runner-state.d.ts +82 -0
  219. package/src/local-dev/slice-runner-state.js +265 -0
  220. package/src/local-dev/slice-runner.d.ts +4 -117
  221. package/src/local-dev/slice-runner.js +59 -594
  222. package/src/local-dev/tls.js +8 -97
  223. package/src/ownership/index.d.ts +1 -0
  224. package/src/ownership/index.js +6 -0
  225. package/src/ownership/pnpm-workspace.d.ts +77 -0
  226. package/src/ownership/pnpm-workspace.js +225 -0
  227. package/src/ownership/site-record.d.ts +8 -0
  228. package/src/ownership/site-record.js +17 -2
  229. package/src/repository-policy/capacity-migration.d.ts +1 -1
  230. package/src/repository-policy/capacity-migration.js +1 -1
  231. package/src/repository-policy/foundation-router.d.ts +17 -0
  232. package/src/repository-policy/foundation-router.js +44 -0
  233. package/src/repository-policy/index.d.ts +2 -0
  234. package/src/repository-policy/index.js +2 -0
  235. package/src/repository-policy/policy-accounts.d.ts +22 -0
  236. package/src/repository-policy/policy-accounts.js +134 -0
  237. package/src/repository-policy/policy-files.d.ts +8 -0
  238. package/src/repository-policy/policy-files.js +201 -0
  239. package/src/repository-policy/policy-internal.d.ts +2 -0
  240. package/src/repository-policy/policy-internal.js +11 -0
  241. package/src/repository-policy/policy-model.d.ts +95 -0
  242. package/src/repository-policy/policy-model.js +42 -0
  243. package/src/repository-policy/policy-validation.d.ts +4 -0
  244. package/src/repository-policy/policy-validation.js +308 -0
  245. package/src/repository-policy/policy.d.ts +5 -120
  246. package/src/repository-policy/policy.js +34 -662
  247. package/src/repository-policy/public-dns.d.ts +4 -0
  248. package/src/repository-policy/public-dns.js +102 -5
  249. package/src/{generators/repository-policy → repository-policy}/tree-policy.d.ts +1 -1
  250. package/src/{generators/repository-policy → repository-policy}/tree-policy.js +5 -5
  251. package/src/schemas/repository-policy-v1.json +40 -3
  252. package/src/secrets/index.d.ts +0 -5
  253. package/src/secrets/index.js +0 -5
  254. package/src/slice-infra/index.d.ts +57 -0
  255. package/src/slice-infra/index.js +117 -0
  256. package/src/slice-scripts/build.d.ts +27 -0
  257. package/src/slice-scripts/build.js +120 -0
  258. package/src/slice-scripts/database.d.ts +87 -0
  259. package/src/slice-scripts/database.js +328 -0
  260. package/src/slice-scripts/index.d.ts +11 -0
  261. package/src/slice-scripts/index.js +23 -0
  262. package/src/slice-scripts/root-site-routes.d.ts +11 -0
  263. package/src/slice-scripts/root-site-routes.js +83 -0
  264. package/src/slice-scripts/sql-migration-engine.mjs +180 -0
  265. package/src/workload-roles/effective-policy.d.ts +0 -37
  266. package/src/workload-roles/effective-policy.js +1 -174
  267. package/src/workload-roles/standard-slice.d.ts +2 -19
  268. package/src/workload-roles/standard-slice.js +3 -129
  269. package/src/api-contract/baseline-update.d.ts +0 -82
  270. package/src/api-contract/baseline-update.js +0 -225
  271. package/src/api-contract/compatibility.d.ts +0 -30
  272. package/src/api-contract/compatibility.js +0 -643
  273. package/src/api-contract/contract-graph.d.ts +0 -35
  274. package/src/api-contract/contract-graph.js +0 -141
  275. package/src/api-contract/evidence.d.ts +0 -23
  276. package/src/api-contract/evidence.js +0 -87
  277. package/src/api-contract/index.d.ts +0 -6
  278. package/src/api-contract/index.js +0 -10
  279. package/src/api-contract/model.d.ts +0 -144
  280. package/src/api-contract/model.js +0 -993
  281. package/src/api-contract/rollout.d.ts +0 -32
  282. package/src/api-contract/rollout.js +0 -88
  283. package/src/authorization/compatibility.d.ts +0 -62
  284. package/src/authorization/compatibility.js +0 -175
  285. package/src/authorization/index.d.ts +0 -1
  286. package/src/authorization/index.js +0 -5
  287. package/src/blueprints/execution.d.ts +0 -55
  288. package/src/blueprints/execution.js +0 -329
  289. package/src/blueprints/external-sandbox.d.ts +0 -53
  290. package/src/blueprints/external-sandbox.js +0 -1194
  291. package/src/blueprints/index.d.ts +0 -5
  292. package/src/blueprints/index.js +0 -9
  293. package/src/blueprints/inputs.d.ts +0 -43
  294. package/src/blueprints/inputs.js +0 -103
  295. package/src/blueprints/manifest.d.ts +0 -281
  296. package/src/blueprints/manifest.js +0 -424
  297. package/src/blueprints/resolver.d.ts +0 -37
  298. package/src/blueprints/resolver.js +0 -387
  299. package/src/blueprints/transitions.d.ts +0 -20
  300. package/src/blueprints/transitions.js +0 -61
  301. package/src/cli/agent-command.d.ts +0 -30
  302. package/src/cli/agent-command.js +0 -204
  303. package/src/cli/agent-runtime.d.ts +0 -25
  304. package/src/cli/agent-runtime.js +0 -498
  305. package/src/cli/blueprint-authority.d.ts +0 -9
  306. package/src/cli/blueprint-authority.js +0 -43
  307. package/src/cli/blueprint-command.d.ts +0 -24
  308. package/src/cli/blueprint-command.js +0 -63
  309. package/src/data-lifecycle/index.d.ts +0 -3
  310. package/src/data-lifecycle/index.js +0 -7
  311. package/src/data-lifecycle/model.d.ts +0 -172
  312. package/src/data-lifecycle/model.js +0 -95
  313. package/src/data-lifecycle/sensitive-artifacts.d.ts +0 -28
  314. package/src/data-lifecycle/sensitive-artifacts.js +0 -146
  315. package/src/data-lifecycle/validation.d.ts +0 -32
  316. package/src/data-lifecycle/validation.js +0 -837
  317. package/src/database-retirement/contract.d.ts +0 -68
  318. package/src/database-retirement/contract.js +0 -166
  319. package/src/database-retirement/index.d.ts +0 -1
  320. package/src/database-retirement/index.js +0 -5
  321. package/src/developer-agent/context.d.ts +0 -57
  322. package/src/developer-agent/context.js +0 -662
  323. package/src/developer-agent/generator-planning.d.ts +0 -34
  324. package/src/developer-agent/generator-planning.js +0 -759
  325. package/src/developer-agent/generator-preview.d.ts +0 -8
  326. package/src/developer-agent/generator-preview.js +0 -650
  327. package/src/developer-agent/git-inspection.d.ts +0 -112
  328. package/src/developer-agent/git-inspection.js +0 -887
  329. package/src/developer-agent/handoff.d.ts +0 -43
  330. package/src/developer-agent/handoff.js +0 -713
  331. package/src/developer-agent/index.d.ts +0 -10
  332. package/src/developer-agent/index.js +0 -14
  333. package/src/developer-agent/model.d.ts +0 -497
  334. package/src/developer-agent/model.js +0 -144
  335. package/src/developer-agent/operation-registry.d.ts +0 -61
  336. package/src/developer-agent/operation-registry.js +0 -1591
  337. package/src/developer-agent/ordering.d.ts +0 -9
  338. package/src/developer-agent/ordering.js +0 -15
  339. package/src/developer-agent/planning.d.ts +0 -25
  340. package/src/developer-agent/planning.js +0 -481
  341. package/src/developer-agent/preview-changes.js +0 -225
  342. package/src/developer-agent/preview-source.d.ts +0 -2
  343. package/src/developer-agent/preview-source.js +0 -19
  344. package/src/developer-agent/validation.d.ts +0 -30
  345. package/src/developer-agent/validation.js +0 -2729
  346. package/src/developer-agent/workspace-inspection.d.ts +0 -20
  347. package/src/developer-agent/workspace-inspection.js +0 -1236
  348. package/src/developer-agent/workspace-path.d.ts +0 -6
  349. package/src/developer-agent/workspace-path.js +0 -22
  350. package/src/executors/blueprint-trust/blueprint-trust.d.ts +0 -29
  351. package/src/executors/blueprint-trust/blueprint-trust.js +0 -121
  352. package/src/executors/blueprint-trust/schema.json +0 -27
  353. package/src/executors/blueprint-verification/blueprint-verification.d.ts +0 -13
  354. package/src/executors/blueprint-verification/blueprint-verification.js +0 -110
  355. package/src/executors/blueprint-verification/schema.json +0 -44
  356. package/src/executors/developer-context/developer-context.d.ts +0 -38
  357. package/src/executors/developer-context/developer-context.js +0 -78
  358. package/src/executors/developer-context/schema.json +0 -87
  359. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.d.ts +0 -19
  360. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js +0 -105
  361. package/src/executors/foundation-profile-preflight/schema.json +0 -32
  362. package/src/executors/github-bootstrap/github-bootstrap.d.ts +0 -13
  363. package/src/executors/github-bootstrap/github-bootstrap.js +0 -62
  364. package/src/executors/github-bootstrap/schema.json +0 -50
  365. package/src/executors/infrastructure-plan/infrastructure-plan.d.ts +0 -37
  366. package/src/executors/infrastructure-plan/infrastructure-plan.js +0 -275
  367. package/src/executors/infrastructure-plan/schema.json +0 -38
  368. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.d.ts +0 -42
  369. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js +0 -1229
  370. package/src/executors/router-waf-rehearsal/schema.json +0 -29
  371. package/src/executors/secret-guardrails/schema.json +0 -6
  372. package/src/executors/secret-guardrails/secret-guardrails.d.ts +0 -3
  373. package/src/executors/secret-guardrails/secret-guardrails.js +0 -44
  374. package/src/executors/secret-initialize/schema.json +0 -42
  375. package/src/executors/secret-initialize/secret-initialize.d.ts +0 -34
  376. package/src/executors/secret-initialize/secret-initialize.js +0 -297
  377. package/src/executors/secret-metadata/schema.json +0 -36
  378. package/src/executors/secret-metadata/secret-metadata.d.ts +0 -46
  379. package/src/executors/secret-metadata/secret-metadata.js +0 -230
  380. package/src/executors/sst-lifecycle/generated-secret-retirement.d.ts +0 -53
  381. package/src/executors/sst-lifecycle/generated-secret-retirement.js +0 -192
  382. package/src/executors/sst-lifecycle/logging-preflight.d.ts +0 -22
  383. package/src/executors/sst-lifecycle/logging-preflight.js +0 -217
  384. package/src/executors/sst-lifecycle/secret-preflight.d.ts +0 -27
  385. package/src/executors/sst-lifecycle/secret-preflight.js +0 -125
  386. package/src/executors/work-markers/schema.json +0 -14
  387. package/src/executors/work-markers/work-markers.d.ts +0 -6
  388. package/src/executors/work-markers/work-markers.js +0 -20
  389. package/src/foundation/cost-estimate.d.ts +0 -175
  390. package/src/foundation/cost-estimate.js +0 -706
  391. package/src/foundation/private-smoke-admission.d.ts +0 -45
  392. package/src/foundation/private-smoke-admission.js +0 -180
  393. package/src/foundation/private-smoke-control-plane.d.ts +0 -18
  394. package/src/foundation/private-smoke-control-plane.js +0 -184
  395. package/src/foundation/root-site-readiness.d.ts +0 -27
  396. package/src/foundation/root-site-readiness.js +0 -78
  397. package/src/foundation/router-waf-rate-rehearsal.d.ts +0 -97
  398. package/src/foundation/router-waf-rate-rehearsal.js +0 -210
  399. package/src/foundation/router-waf.d.ts +0 -149
  400. package/src/foundation/router-waf.js +0 -809
  401. package/src/frontend-security/index.d.ts +0 -1
  402. package/src/frontend-security/index.js +0 -5
  403. package/src/frontend-security/security-headers.d.ts +0 -50
  404. package/src/frontend-security/security-headers.js +0 -418
  405. package/src/generators/blueprint/blueprint.d.ts +0 -5
  406. package/src/generators/blueprint/blueprint.js +0 -102
  407. package/src/generators/blueprint/files.d.ts +0 -6
  408. package/src/generators/blueprint/files.js +0 -217
  409. package/src/generators/blueprint/schema.d.ts +0 -4
  410. package/src/generators/blueprint/schema.json +0 -18
  411. package/src/generators/feature-registry.d.ts +0 -13
  412. package/src/generators/feature-registry.js +0 -73
  413. package/src/generators/function/function-registration.d.ts +0 -24
  414. package/src/generators/function/function-registration.js +0 -66
  415. package/src/generators/observability-infrastructure.d.ts +0 -2
  416. package/src/generators/observability-infrastructure.js +0 -31
  417. package/src/generators/preset/workspace-files-adopter-skills.d.ts +0 -7
  418. package/src/generators/preset/workspace-files-adopter-skills.js +0 -359
  419. package/src/generators/preset/workspace-files-agent-development.d.ts +0 -9
  420. package/src/generators/preset/workspace-files-agent-development.js +0 -42
  421. package/src/generators/preset/workspace-files-ci-acceptance.d.ts +0 -1
  422. package/src/generators/preset/workspace-files-ci-acceptance.js +0 -791
  423. package/src/generators/preset/workspace-files-ci-install.d.ts +0 -2
  424. package/src/generators/preset/workspace-files-ci-install.js +0 -196
  425. package/src/generators/preset/workspace-files-developer-agent.d.ts +0 -16
  426. package/src/generators/preset/workspace-files-developer-agent.js +0 -644
  427. package/src/generators/preset/workspace-files-ecr-inspector.d.ts +0 -18
  428. package/src/generators/preset/workspace-files-ecr-inspector.js +0 -298
  429. package/src/generators/preset/workspace-files-foundation-workload-roles.d.ts +0 -6
  430. package/src/generators/preset/workspace-files-foundation-workload-roles.js +0 -409
  431. package/src/generators/preset/workspace-files-performance-cost.d.ts +0 -66
  432. package/src/generators/preset/workspace-files-performance-cost.js +0 -866
  433. package/src/generators/preset/workspace-files-performance-load.d.ts +0 -73
  434. package/src/generators/preset/workspace-files-performance-load.js +0 -815
  435. package/src/generators/preset/workspace-files-shared-operation-claims.d.ts +0 -10
  436. package/src/generators/preset/workspace-files-shared-operation-claims.js +0 -59
  437. package/src/generators/preset/workspace-files-stage-authority.d.ts +0 -6
  438. package/src/generators/preset/workspace-files-stage-authority.js +0 -586
  439. package/src/generators/preset/workspace-files-thin-deploy.d.ts +0 -76
  440. package/src/generators/preset/workspace-files-thin-deploy.js +0 -2563
  441. package/src/generators/preset/workspace-files-thin-docs.d.ts +0 -7
  442. package/src/generators/preset/workspace-files-thin-docs.js +0 -386
  443. package/src/generators/preset/workspace-files-thin-release.d.ts +0 -14
  444. package/src/generators/preset/workspace-files-thin-release.js +0 -26
  445. package/src/generators/preset/workspace-files-workload-role-baseline.d.ts +0 -9
  446. package/src/generators/preset/workspace-files-workload-role-baseline.js +0 -1314
  447. package/src/generators/repository-policy/repository-policy.d.ts +0 -4
  448. package/src/generators/repository-policy/repository-policy.js +0 -294
  449. package/src/generators/repository-policy/schema.d.ts +0 -30
  450. package/src/generators/repository-policy/schema.json +0 -127
  451. package/src/generators/site/built-in-site-smoke-files.d.ts +0 -2
  452. package/src/generators/site/built-in-site-smoke-files.js +0 -37
  453. package/src/generators/slice/built-in-plan-alarm-identity.d.ts +0 -182
  454. package/src/generators/slice/built-in-plan-alarm-identity.js +0 -209
  455. package/src/generators/slice/built-in-plan-api-contract-files.d.ts +0 -2
  456. package/src/generators/slice/built-in-plan-api-contract-files.js +0 -2848
  457. package/src/generators/slice/built-in-plan-async-work-files.d.ts +0 -2
  458. package/src/generators/slice/built-in-plan-async-work-files.js +0 -6118
  459. package/src/generators/slice/built-in-plan-authorization-files.d.ts +0 -2
  460. package/src/generators/slice/built-in-plan-authorization-files.js +0 -2082
  461. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.d.ts +0 -2
  462. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +0 -1301
  463. package/src/generators/slice/built-in-plan-authorization-storage.d.ts +0 -3
  464. package/src/generators/slice/built-in-plan-authorization-storage.js +0 -119
  465. package/src/generators/slice/built-in-plan-background-work-files.d.ts +0 -2
  466. package/src/generators/slice/built-in-plan-background-work-files.js +0 -99
  467. package/src/generators/slice/built-in-plan-data-deletion-files.d.ts +0 -2
  468. package/src/generators/slice/built-in-plan-data-deletion-files.js +0 -273
  469. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.d.ts +0 -2
  470. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js +0 -223
  471. package/src/generators/slice/built-in-plan-data-files.d.ts +0 -2
  472. package/src/generators/slice/built-in-plan-data-files.js +0 -618
  473. package/src/generators/slice/built-in-plan-data-lifecycle-files.d.ts +0 -2
  474. package/src/generators/slice/built-in-plan-data-lifecycle-files.js +0 -775
  475. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.d.ts +0 -2
  476. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js +0 -863
  477. package/src/generators/slice/built-in-plan-data-retention-job-files.d.ts +0 -2
  478. package/src/generators/slice/built-in-plan-data-retention-job-files.js +0 -169
  479. package/src/generators/slice/built-in-plan-data-retention-launcher-files.d.ts +0 -2
  480. package/src/generators/slice/built-in-plan-data-retention-launcher-files.js +0 -186
  481. package/src/generators/slice/built-in-plan-data-rights-files.d.ts +0 -2
  482. package/src/generators/slice/built-in-plan-data-rights-files.js +0 -152
  483. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.d.ts +0 -2
  484. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js +0 -508
  485. package/src/generators/slice/built-in-plan-event-contract-literal.d.ts +0 -6
  486. package/src/generators/slice/built-in-plan-event-contract-literal.js +0 -52
  487. package/src/generators/slice/built-in-plan-foundation-files.d.ts +0 -15
  488. package/src/generators/slice/built-in-plan-foundation-files.js +0 -314
  489. package/src/generators/slice/built-in-plan-frontend-files.d.ts +0 -2
  490. package/src/generators/slice/built-in-plan-frontend-files.js +0 -1975
  491. package/src/generators/slice/built-in-plan-frontend-header-proof.d.ts +0 -6
  492. package/src/generators/slice/built-in-plan-frontend-header-proof.js +0 -282
  493. package/src/generators/slice/built-in-plan-infrastructure-safety-files.d.ts +0 -2
  494. package/src/generators/slice/built-in-plan-infrastructure-safety-files.js +0 -373
  495. package/src/generators/slice/built-in-plan-key-value-cleanup.d.ts +0 -4
  496. package/src/generators/slice/built-in-plan-key-value-cleanup.js +0 -101
  497. package/src/generators/slice/built-in-plan-key-value-consumer.d.ts +0 -4
  498. package/src/generators/slice/built-in-plan-key-value-consumer.js +0 -151
  499. package/src/generators/slice/built-in-plan-key-value-deletion.d.ts +0 -2
  500. package/src/generators/slice/built-in-plan-key-value-deletion.js +0 -377
  501. package/src/generators/slice/built-in-plan-key-value-delivery.d.ts +0 -2
  502. package/src/generators/slice/built-in-plan-key-value-delivery.js +0 -137
  503. package/src/generators/slice/built-in-plan-key-value-export.d.ts +0 -2
  504. package/src/generators/slice/built-in-plan-key-value-export.js +0 -595
  505. package/src/generators/slice/built-in-plan-key-value-holds.d.ts +0 -2
  506. package/src/generators/slice/built-in-plan-key-value-holds.js +0 -189
  507. package/src/generators/slice/built-in-plan-key-value-infrastructure.d.ts +0 -2
  508. package/src/generators/slice/built-in-plan-key-value-infrastructure.js +0 -102
  509. package/src/generators/slice/built-in-plan-key-value-performance.d.ts +0 -5
  510. package/src/generators/slice/built-in-plan-key-value-performance.js +0 -530
  511. package/src/generators/slice/built-in-plan-key-value-provider.d.ts +0 -4
  512. package/src/generators/slice/built-in-plan-key-value-provider.js +0 -366
  513. package/src/generators/slice/built-in-plan-key-value-records.d.ts +0 -3
  514. package/src/generators/slice/built-in-plan-key-value-records.js +0 -232
  515. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.d.ts +0 -2
  516. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.js +0 -103
  517. package/src/generators/slice/built-in-plan-key-value-retention-job-files.d.ts +0 -2
  518. package/src/generators/slice/built-in-plan-key-value-retention-job-files.js +0 -160
  519. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.d.ts +0 -2
  520. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.js +0 -329
  521. package/src/generators/slice/built-in-plan-key-value-retention-worker.d.ts +0 -2
  522. package/src/generators/slice/built-in-plan-key-value-retention-worker.js +0 -477
  523. package/src/generators/slice/built-in-plan-key-value-retention.d.ts +0 -2
  524. package/src/generators/slice/built-in-plan-key-value-retention.js +0 -184
  525. package/src/generators/slice/built-in-plan-log-group-helpers.d.ts +0 -29
  526. package/src/generators/slice/built-in-plan-log-group-helpers.js +0 -130
  527. package/src/generators/slice/built-in-plan-metadata-files.d.ts +0 -3
  528. package/src/generators/slice/built-in-plan-metadata-files.js +0 -401
  529. package/src/generators/slice/built-in-plan-native-runtime-authority-files.d.ts +0 -2
  530. package/src/generators/slice/built-in-plan-native-runtime-authority-files.js +0 -324
  531. package/src/generators/slice/built-in-plan-next-build-authority.d.ts +0 -5
  532. package/src/generators/slice/built-in-plan-next-build-authority.js +0 -124
  533. package/src/generators/slice/built-in-plan-operations-files.d.ts +0 -8
  534. package/src/generators/slice/built-in-plan-operations-files.js +0 -1106
  535. package/src/generators/slice/built-in-plan-performance-files.d.ts +0 -4
  536. package/src/generators/slice/built-in-plan-performance-files.js +0 -2444
  537. package/src/generators/slice/built-in-plan-release-files.d.ts +0 -2
  538. package/src/generators/slice/built-in-plan-release-files.js +0 -6585
  539. package/src/generators/slice/built-in-plan-reliability-files.d.ts +0 -2
  540. package/src/generators/slice/built-in-plan-reliability-files.js +0 -4728
  541. package/src/generators/slice/built-in-plan-secret-runtime-files.d.ts +0 -2
  542. package/src/generators/slice/built-in-plan-secret-runtime-files.js +0 -1015
  543. package/src/generators/slice/built-in-plan-sql-events.d.ts +0 -2
  544. package/src/generators/slice/built-in-plan-sql-events.js +0 -276
  545. package/src/generators/slice/built-in-plan-testing-files.d.ts +0 -2
  546. package/src/generators/slice/built-in-plan-testing-files.js +0 -2618
  547. package/src/generators/slice/built-in-plan-testing-persistence-event-files.d.ts +0 -7
  548. package/src/generators/slice/built-in-plan-testing-persistence-event-files.js +0 -487
  549. package/src/generators/slice/built-in-plan-testing-persistence-files.d.ts +0 -2
  550. package/src/generators/slice/built-in-plan-testing-persistence-files.js +0 -180
  551. package/src/generators/slice/built-in-plan-thin-release-files.d.ts +0 -11
  552. package/src/generators/slice/built-in-plan-thin-release-files.js +0 -162
  553. package/src/generators/slice/built-in-plan-verification-files.d.ts +0 -2
  554. package/src/generators/slice/built-in-plan-verification-files.js +0 -442
  555. package/src/generators/slice/built-in-plan-workload-role-files.d.ts +0 -2
  556. package/src/generators/slice/built-in-plan-workload-role-files.js +0 -2220
  557. package/src/generators/slice/data-policy-review-seed.d.ts +0 -2
  558. package/src/generators/slice/data-policy-review-seed.js +0 -22
  559. package/src/generators/slice/deployed-smoke-diagnostics.d.ts +0 -35
  560. package/src/generators/slice/deployed-smoke-diagnostics.js +0 -189
  561. package/src/generators/slice/deployed-smoke-readiness.d.ts +0 -9
  562. package/src/generators/slice/deployed-smoke-readiness.js +0 -309
  563. package/src/generators/slice/local-source-identity.d.ts +0 -2
  564. package/src/generators/slice/local-source-identity.js +0 -31
  565. package/src/generators/slice/pnpm-launch-script.d.ts +0 -13
  566. package/src/generators/slice/pnpm-launch-script.js +0 -28
  567. package/src/generators/upgrade/custom-domain-notice.d.ts +0 -19
  568. package/src/generators/upgrade/custom-domain-notice.js +0 -38
  569. package/src/generators/upgrade/external-blueprint-compositions.d.ts +0 -84
  570. package/src/generators/upgrade/external-blueprint-compositions.js +0 -478
  571. package/src/generators/upgrade/sql-seeded-reconciliation.d.ts +0 -2
  572. package/src/generators/upgrade/sql-seeded-reconciliation.js +0 -170
  573. package/src/generators/workload/performance-registration.d.ts +0 -33
  574. package/src/generators/workload/performance-registration.js +0 -224
  575. package/src/generators/workload/reliability-registration.d.ts +0 -16
  576. package/src/generators/workload/reliability-registration.js +0 -150
  577. package/src/generators/workload/service-performance-files.d.ts +0 -5
  578. package/src/generators/workload/service-performance-files.js +0 -1883
  579. package/src/git-policy/action-pins.d.ts +0 -43
  580. package/src/git-policy/action-pins.js +0 -50
  581. package/src/git-policy/github-bootstrap.d.ts +0 -95
  582. package/src/git-policy/github-bootstrap.js +0 -1250
  583. package/src/git-policy/index.d.ts +0 -3
  584. package/src/git-policy/index.js +0 -7
  585. package/src/git-policy/routing.d.ts +0 -21
  586. package/src/git-policy/routing.js +0 -138
  587. package/src/infrastructure-change/convergence.d.ts +0 -13
  588. package/src/infrastructure-change/convergence.js +0 -85
  589. package/src/infrastructure-change/drift.d.ts +0 -13
  590. package/src/infrastructure-change/drift.js +0 -112
  591. package/src/infrastructure-change/index.d.ts +0 -7
  592. package/src/infrastructure-change/index.js +0 -11
  593. package/src/infrastructure-change/local-capability.d.ts +0 -73
  594. package/src/infrastructure-change/local-capability.js +0 -114
  595. package/src/infrastructure-change/model.d.ts +0 -274
  596. package/src/infrastructure-change/model.js +0 -29
  597. package/src/infrastructure-change/normalize.d.ts +0 -16
  598. package/src/infrastructure-change/normalize.js +0 -285
  599. package/src/infrastructure-change/plan.d.ts +0 -67
  600. package/src/infrastructure-change/plan.js +0 -671
  601. package/src/infrastructure-change/risk.d.ts +0 -9
  602. package/src/infrastructure-change/risk.js +0 -349
  603. package/src/infrastructure-change/summary.d.ts +0 -20
  604. package/src/infrastructure-change/summary.js +0 -130
  605. package/src/performance/cost-collection.d.ts +0 -225
  606. package/src/performance/cost-collection.js +0 -827
  607. package/src/performance/cost-controls.d.ts +0 -135
  608. package/src/performance/cost-controls.js +0 -347
  609. package/src/performance/evidence.d.ts +0 -140
  610. package/src/performance/evidence.js +0 -601
  611. package/src/performance/index.d.ts +0 -10
  612. package/src/performance/index.js +0 -14
  613. package/src/performance/load-safety.d.ts +0 -84
  614. package/src/performance/load-safety.js +0 -348
  615. package/src/performance/model.d.ts +0 -129
  616. package/src/performance/model.js +0 -451
  617. package/src/performance/pr-artifact-budget.d.ts +0 -42
  618. package/src/performance/pr-artifact-budget.js +0 -151
  619. package/src/performance/runner.d.ts +0 -75
  620. package/src/performance/runner.js +0 -227
  621. package/src/performance/scenario-endpoint.d.ts +0 -1
  622. package/src/performance/scenario-endpoint.js +0 -5
  623. package/src/performance/scenario.d.ts +0 -215
  624. package/src/performance/scenario.js +0 -744
  625. package/src/performance/unit-cost.d.ts +0 -105
  626. package/src/performance/unit-cost.js +0 -364
  627. package/src/release/index.d.ts +0 -2
  628. package/src/release/index.js +0 -6
  629. package/src/release/lifecycle.d.ts +0 -132
  630. package/src/release/lifecycle.js +0 -411
  631. package/src/release/manifest.d.ts +0 -148
  632. package/src/release/manifest.js +0 -503
  633. package/src/release/rollout.d.ts +0 -170
  634. package/src/release/rollout.js +0 -578
  635. package/src/release/source-authority.d.ts +0 -19
  636. package/src/release/source-authority.js +0 -212
  637. package/src/schemas/aggregate-count-evidence-v1.json +0 -135
  638. package/src/schemas/api-contract-baseline-v1.json +0 -674
  639. package/src/schemas/api-contract-compatibility-report-v1.json +0 -126
  640. package/src/schemas/aws-billing-actual-evidence-v1.json +0 -407
  641. package/src/schemas/blueprint-input-schema-v1.json +0 -23
  642. package/src/schemas/blueprint-v1.json +0 -188
  643. package/src/schemas/data-lifecycle-policy-v1.json +0 -517
  644. package/src/schemas/performance-policy-v1.json +0 -335
  645. package/src/schemas/testing-evidence-quarantine-v1.json +0 -168
  646. package/src/schemas/testing-evidence-result-v1.json +0 -319
  647. package/src/secrets/aws-control-plane.d.ts +0 -29
  648. package/src/secrets/aws-control-plane.js +0 -322
  649. package/src/secrets/generated-aws-control-plane.d.ts +0 -33
  650. package/src/secrets/generated-aws-control-plane.js +0 -322
  651. package/src/secrets/guardrails.d.ts +0 -26
  652. package/src/secrets/guardrails.js +0 -328
  653. package/src/secrets/metadata.d.ts +0 -48
  654. package/src/secrets/metadata.js +0 -199
  655. package/src/secrets/operator.d.ts +0 -190
  656. package/src/secrets/operator.js +0 -701
  657. package/src/secrets/verification.d.ts +0 -18
  658. package/src/secrets/verification.js +0 -152
  659. package/src/supply-chain/action-pins.d.ts +0 -26
  660. package/src/supply-chain/action-pins.js +0 -262
  661. package/src/supply-chain/blueprint-trust-git.d.ts +0 -130
  662. package/src/supply-chain/blueprint-trust-git.js +0 -1666
  663. package/src/supply-chain/blueprint-trust-process.d.ts +0 -4
  664. package/src/supply-chain/blueprint-trust-process.js +0 -88
  665. package/src/supply-chain/blueprint-trust.d.ts +0 -354
  666. package/src/supply-chain/blueprint-trust.js +0 -1558
  667. package/src/supply-chain/blueprint-verification-authority.d.ts +0 -62
  668. package/src/supply-chain/blueprint-verification-authority.js +0 -679
  669. package/src/supply-chain/blueprint-verification-execution.d.ts +0 -68
  670. package/src/supply-chain/blueprint-verification-execution.js +0 -639
  671. package/src/supply-chain/build-output-bounds.d.ts +0 -2
  672. package/src/supply-chain/build-output-bounds.js +0 -12
  673. package/src/supply-chain/build-output.d.ts +0 -41
  674. package/src/supply-chain/build-output.js +0 -551
  675. package/src/supply-chain/common.d.ts +0 -21
  676. package/src/supply-chain/common.js +0 -107
  677. package/src/supply-chain/container-artifact-contract.d.ts +0 -23
  678. package/src/supply-chain/container-artifact-contract.js +0 -208
  679. package/src/supply-chain/container-release.d.ts +0 -119
  680. package/src/supply-chain/container-release.js +0 -496
  681. package/src/supply-chain/ecr-applicability.d.ts +0 -19
  682. package/src/supply-chain/ecr-applicability.js +0 -103
  683. package/src/supply-chain/ecr-scanning.d.ts +0 -85
  684. package/src/supply-chain/ecr-scanning.js +0 -325
  685. package/src/supply-chain/ecs-deployed-image.d.ts +0 -87
  686. package/src/supply-chain/ecs-deployed-image.js +0 -302
  687. package/src/supply-chain/errors.d.ts +0 -6
  688. package/src/supply-chain/errors.js +0 -15
  689. package/src/supply-chain/generated-blueprint-trust-command.d.ts +0 -4
  690. package/src/supply-chain/generated-blueprint-trust-command.js +0 -1394
  691. package/src/supply-chain/generated-command.d.ts +0 -1
  692. package/src/supply-chain/generated-command.js +0 -775
  693. package/src/supply-chain/generated-container-release-command.d.ts +0 -16
  694. package/src/supply-chain/generated-container-release-command.js +0 -3248
  695. package/src/supply-chain/generated-ecr-collector-command.d.ts +0 -20
  696. package/src/supply-chain/generated-ecr-collector-command.js +0 -1445
  697. package/src/supply-chain/generated-files.d.ts +0 -13
  698. package/src/supply-chain/generated-files.js +0 -421
  699. package/src/supply-chain/generated-scanner-command.d.ts +0 -1
  700. package/src/supply-chain/generated-scanner-command.js +0 -778
  701. package/src/supply-chain/index.d.ts +0 -28
  702. package/src/supply-chain/index.js +0 -36
  703. package/src/supply-chain/inventory.d.ts +0 -96
  704. package/src/supply-chain/inventory.js +0 -828
  705. package/src/supply-chain/license-expression.d.ts +0 -7
  706. package/src/supply-chain/license-expression.js +0 -128
  707. package/src/supply-chain/policy.d.ts +0 -105
  708. package/src/supply-chain/policy.js +0 -304
  709. package/src/supply-chain/publication.d.ts +0 -48
  710. package/src/supply-chain/publication.js +0 -85
  711. package/src/supply-chain/sbom.d.ts +0 -228
  712. package/src/supply-chain/sbom.js +0 -913
  713. package/src/supply-chain/scanner.d.ts +0 -77
  714. package/src/supply-chain/scanner.js +0 -514
  715. package/src/supply-chain/vendored-source.d.ts +0 -95
  716. package/src/supply-chain/vendored-source.js +0 -315
  717. package/src/testing-evidence/fixture-scope.d.ts +0 -53
  718. package/src/testing-evidence/fixture-scope.js +0 -142
  719. package/src/testing-evidence/index.d.ts +0 -5
  720. package/src/testing-evidence/index.js +0 -9
  721. package/src/testing-evidence/quarantine.d.ts +0 -48
  722. package/src/testing-evidence/quarantine.js +0 -253
  723. package/src/testing-evidence/result.d.ts +0 -109
  724. package/src/testing-evidence/result.js +0 -585
  725. package/src/testing-evidence/runner-adapter.d.ts +0 -51
  726. package/src/testing-evidence/runner-adapter.js +0 -288
  727. package/src/testing-evidence/sensitive-artifacts.d.ts +0 -13
  728. package/src/testing-evidence/sensitive-artifacts.js +0 -93
  729. package/src/work-markers/index.d.ts +0 -1
  730. package/src/work-markers/index.js +0 -5
  731. package/src/work-markers/work-markers.d.ts +0 -39
  732. package/src/work-markers/work-markers.js +0 -363
  733. package/src/workload-roles/account-baseline.d.ts +0 -143
  734. package/src/workload-roles/account-baseline.js +0 -980
  735. package/src/workload-roles/authority.d.ts +0 -40
  736. package/src/workload-roles/authority.js +0 -202
  737. package/src/workload-roles/aws-adapter.d.ts +0 -99
  738. package/src/workload-roles/aws-adapter.js +0 -416
  739. package/src/workload-roles/aws-internal-handler.d.ts +0 -27
  740. package/src/workload-roles/aws-internal-handler.js +0 -58
  741. package/src/workload-roles/aws-s3-state.d.ts +0 -52
  742. package/src/workload-roles/aws-s3-state.js +0 -191
  743. package/src/workload-roles/aws-sdk-control-plane.d.ts +0 -12
  744. package/src/workload-roles/aws-sdk-control-plane.js +0 -291
  745. package/src/workload-roles/boundary.d.ts +0 -34
  746. package/src/workload-roles/boundary.js +0 -137
  747. package/src/workload-roles/convergence.d.ts +0 -66
  748. package/src/workload-roles/convergence.js +0 -186
  749. package/src/workload-roles/handler.d.ts +0 -43
  750. package/src/workload-roles/handler.js +0 -158
  751. package/src/workload-roles/history.d.ts +0 -47
  752. package/src/workload-roles/history.js +0 -324
  753. package/src/workload-roles/injection.d.ts +0 -119
  754. package/src/workload-roles/injection.js +0 -495
  755. package/src/workload-roles/manifest.d.ts +0 -54
  756. package/src/workload-roles/manifest.js +0 -343
  757. package/src/workload-roles/provisioner.d.ts +0 -70
  758. package/src/workload-roles/provisioner.js +0 -239
  759. package/src/workload-roles/registration.d.ts +0 -102
  760. package/src/workload-roles/registration.js +0 -462
  761. package/src/workload-roles/stage-boundary.d.ts +0 -31
  762. package/src/workload-roles/stage-boundary.js +0 -208
  763. /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.d.ts +0 -0
  764. /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.js +0 -0
@@ -1,1666 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BLUEPRINT_TRUST_SNAPSHOT_PATH = exports.BLUEPRINT_TRUST_POLICY_PATH = void 0;
4
- exports.protectedWorkspaceHasExternalBlueprintOwnership = protectedWorkspaceHasExternalBlueprintOwnership;
5
- exports.inspectProtectedWorkspaceExternalBlueprintHistory = inspectProtectedWorkspaceExternalBlueprintHistory;
6
- exports.protectedWorkspaceHistoryRequiresStrictNxAuthority = protectedWorkspaceHistoryRequiresStrictNxAuthority;
7
- exports.inspectBlueprintTrustGitAuthority = inspectBlueprintTrustGitAuthority;
8
- exports.inspectProtectedGitFileAuthority = inspectProtectedGitFileAuthority;
9
- exports.inspectProtectedGitFileRefAuthority = inspectProtectedGitFileRefAuthority;
10
- exports.createBlueprintVerificationWorkspaceSnapshot = createBlueprintVerificationWorkspaceSnapshot;
11
- exports.assertBlueprintVerificationWorkspaceSnapshot = assertBlueprintVerificationWorkspaceSnapshot;
12
- exports.assertProtectedGitWorkingTreeAuthority = assertProtectedGitWorkingTreeAuthority;
13
- exports.assertProtectedGitVerificationExecutionAuthority = assertProtectedGitVerificationExecutionAuthority;
14
- const node_child_process_1 = require("node:child_process");
15
- const node_crypto_1 = require("node:crypto");
16
- const node_fs_1 = require("node:fs");
17
- const node_path_1 = require("node:path");
18
- const deterministic_order_js_1 = require("../deterministic-order.js");
19
- const validation_js_1 = require("../validation.js");
20
- const foundation_record_js_1 = require("../ownership/foundation-record.js");
21
- const record_js_1 = require("../ownership/record.js");
22
- const workspace_record_js_1 = require("../ownership/workspace-record.js");
23
- const site_record_js_1 = require("../ownership/site-record.js");
24
- const root_site_js_1 = require("../foundation/root-site.js");
25
- const blueprint_verification_authority_js_1 = require("./blueprint-verification-authority.js");
26
- const blueprint_trust_js_1 = require("./blueprint-trust.js");
27
- const errors_js_1 = require("./errors.js");
28
- const FULL_GIT_OBJECT_ID = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
29
- const SAFE_GIT_REFERENCE = /^(?:HEAD|HEAD\^1|refs\/(?:heads|remotes\/origin)\/[A-Za-z0-9][A-Za-z0-9._/-]{0,254}|[a-f0-9]{40}|[a-f0-9]{64})$/;
30
- const SAFE_PROTECTED_GIT_REFERENCE = /^(?:refs\/remotes\/origin\/[A-Za-z0-9][A-Za-z0-9._/-]{0,254}|[a-f0-9]{40}|[a-f0-9]{64})$/;
31
- const SAFE_REPOSITORY_PATH = /^(?!\/)(?!.*(?:^|\/)\.\.(?:\/|$))[A-Za-z0-9._@+~/-]{1,512}$/;
32
- const AMBIGUOUS_TRACKED_PATH_CHARACTER =
33
- // eslint-disable-next-line no-control-regex -- C0/C1 characters are deliberately rejected in tracked path names.
34
- /[\u0000-\u001f\u007f-\u009f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069\ufffd]/u;
35
- const OWNERSHIP_PATH = /^packages\/[a-z][a-z0-9]*(?:-[a-z0-9]+)*\/\.ebk\/ownership\.json$/;
36
- const OWNERSHIP_PATHSPEC = ':(glob,top)packages/*/.ebk/ownership.json';
37
- const VERIFICATION_RECEIPT_PATH = /^supply-chain\/blueprint-verification-receipts\/([a-z][a-z0-9]*(?:-[a-z0-9]+)*)\.json$/;
38
- const VERIFICATION_RECEIPT_DIRECTORY = 'supply-chain/blueprint-verification-receipts';
39
- const PROTECTED_BLUEPRINT_OWNERSHIP_REFS = [
40
- 'refs/remotes/origin/develop',
41
- 'refs/remotes/origin/main',
42
- ];
43
- const MAX_GIT_OUTPUT_BYTES = 30 * 1024 * 1024;
44
- const MAX_TRACKED_REPOSITORY_PATH_BYTES = 4 * 1024;
45
- const MAX_HISTORY_COMMITS = 20_000;
46
- const MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS = 512;
47
- const MAX_PREGRAPH_OWNERSHIP_HISTORY_RECORDS = 8_192;
48
- const MAX_JSON_BYTES = 5 * 1024 * 1024;
49
- const MAX_OWNERSHIP_RECORDS = 1_000;
50
- const MAX_EXECUTION_SNAPSHOT_BYTES = 512 * 1024 * 1024;
51
- const MAX_EXECUTION_SNAPSHOT_ENTRIES = 50_000;
52
- const MAX_EXECUTION_SNAPSHOT_FILE_BYTES = 25 * 1024 * 1024;
53
- const TRUSTED_GIT_CONFIGURATION = [
54
- '-c',
55
- 'core.fsmonitor=false',
56
- '-c',
57
- 'core.untrackedCache=false',
58
- ];
59
- exports.BLUEPRINT_TRUST_POLICY_PATH = 'supply-chain/blueprint-trust-policy.json';
60
- exports.BLUEPRINT_TRUST_SNAPSHOT_PATH = 'supply-chain/blueprint-trust-snapshot.json';
61
- function supplyChainGitEnvironment(source) {
62
- return Object.fromEntries(['SystemRoot', 'SYSTEMROOT', 'TEMP', 'TMP', 'WINDIR'].flatMap((name) => source[name] === undefined ? [] : [[name, source[name]]]));
63
- }
64
- function trustedGitExecutable(workspaceRoot) {
65
- const candidates = process.platform === 'win32'
66
- ? [
67
- 'C:\\Program Files\\Git\\cmd\\git.exe',
68
- 'C:\\Program Files\\Git\\bin\\git.exe',
69
- 'C:\\Program Files (x86)\\Git\\cmd\\git.exe',
70
- ]
71
- : ['/usr/bin/git'];
72
- for (const candidate of candidates) {
73
- if (!(0, node_path_1.isAbsolute)(candidate) || !(0, node_fs_1.existsSync)(candidate))
74
- continue;
75
- let executable;
76
- try {
77
- executable = (0, node_fs_1.realpathSync)(candidate);
78
- }
79
- catch {
80
- continue;
81
- }
82
- const child = (0, node_path_1.relative)(workspaceRoot, executable);
83
- if (!(0, node_fs_1.lstatSync)(executable).isFile() ||
84
- child === '' ||
85
- (child !== '..' && !child.startsWith(`..${node_path_1.sep}`) && !(0, node_path_1.isAbsolute)(child))) {
86
- continue;
87
- }
88
- return executable;
89
- }
90
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git', 'cannot locate a trusted absolute system Git executable outside the workspace');
91
- }
92
- function isSameCanonicalDirectory(left, right) {
93
- try {
94
- const leftPath = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(left));
95
- const rightPath = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(right));
96
- const leftMetadata = (0, node_fs_1.lstatSync)(leftPath, { bigint: true });
97
- const rightMetadata = (0, node_fs_1.lstatSync)(rightPath, { bigint: true });
98
- if (!leftMetadata.isDirectory() || !rightMetadata.isDirectory()) {
99
- return false;
100
- }
101
- return ((leftMetadata.ino !== 0n &&
102
- leftMetadata.dev === rightMetadata.dev &&
103
- leftMetadata.ino === rightMetadata.ino) ||
104
- leftPath === rightPath);
105
- }
106
- catch {
107
- return false;
108
- }
109
- }
110
- function git(context, args, options = {}) {
111
- const result = (0, node_child_process_1.spawnSync)(context.executable, [...TRUSTED_GIT_CONFIGURATION, ...args], {
112
- cwd: context.workspaceRoot,
113
- encoding: 'utf8',
114
- env: {
115
- ...context.environment,
116
- GIT_CONFIG_GLOBAL: process.platform === 'win32' ? 'NUL' : '/dev/null',
117
- GIT_CONFIG_NOSYSTEM: '1',
118
- GIT_NO_REPLACE_OBJECTS: '1',
119
- GIT_OPTIONAL_LOCKS: '0',
120
- },
121
- maxBuffer: MAX_GIT_OUTPUT_BYTES,
122
- shell: false,
123
- timeout: 15_000,
124
- windowsHide: true,
125
- });
126
- if (result.error ||
127
- result.status !== 0 ||
128
- typeof result.stdout !== 'string') {
129
- if (options.allowFailure)
130
- return undefined;
131
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git', `cannot establish protected trust history with git ${args[0] ?? 'command'}`);
132
- }
133
- return result.stdout.replace(/\r\n/g, '\n').replace(/\n$/, '');
134
- }
135
- function hashGitBlob(context, value) {
136
- const result = (0, node_child_process_1.spawnSync)(context.executable, [...TRUSTED_GIT_CONFIGURATION, 'hash-object', '--stdin'], {
137
- cwd: context.workspaceRoot,
138
- encoding: 'utf8',
139
- env: {
140
- ...context.environment,
141
- GIT_CONFIG_GLOBAL: process.platform === 'win32' ? 'NUL' : '/dev/null',
142
- GIT_CONFIG_NOSYSTEM: '1',
143
- GIT_NO_REPLACE_OBJECTS: '1',
144
- GIT_OPTIONAL_LOCKS: '0',
145
- },
146
- input: value,
147
- maxBuffer: MAX_GIT_OUTPUT_BYTES,
148
- shell: false,
149
- timeout: 15_000,
150
- windowsHide: true,
151
- });
152
- const objectId = String(result.stdout ?? '').trim();
153
- if (result.error ||
154
- result.status !== 0 ||
155
- !FULL_GIT_OBJECT_ID.test(objectId)) {
156
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.fileAuthority', 'cannot hash the exact working-tree bytes with trusted Git');
157
- }
158
- return objectId;
159
- }
160
- function hashGitBlobLocally(value, expectedObjectId) {
161
- const algorithm = expectedObjectId.length === 64 ? 'sha256' : 'sha1';
162
- return (0, node_crypto_1.createHash)(algorithm)
163
- .update(Buffer.from(`blob ${value.byteLength}\0`, 'utf8'))
164
- .update(value)
165
- .digest('hex');
166
- }
167
- function safeRepositoryPath(path, label) {
168
- if (!SAFE_REPOSITORY_PATH.test(path) || path.split('/').includes('..')) {
169
- throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', label, 'must be a bounded repository-relative path');
170
- }
171
- return path;
172
- }
173
- /**
174
- * Git permits ordinary tracked names outside the framework's deliberately
175
- * narrow authority-path grammar. Whole-tree review must bind those bytes too,
176
- * without making spaces or international product documentation illegal.
177
- * Reject only names whose decoding or repository-relative resolution in the
178
- * current checkout is ambiguous.
179
- */
180
- function safeTrackedRepositoryPath(path, label) {
181
- const segments = path.split('/');
182
- if (path.length === 0 ||
183
- Buffer.byteLength(path, 'utf8') > MAX_TRACKED_REPOSITORY_PATH_BYTES ||
184
- path.startsWith('/') ||
185
- /^[A-Za-z]:\//u.test(path) ||
186
- path.includes('\\') ||
187
- AMBIGUOUS_TRACKED_PATH_CHARACTER.test(path) ||
188
- segments.some((segment) => segment.length === 0 || segment === '.' || segment === '..')) {
189
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', label, 'protected tree contains an unsafe or ambiguous tracked path');
190
- }
191
- return path;
192
- }
193
- function exactCommit(context, reference) {
194
- if (!SAFE_GIT_REFERENCE.test(reference)) {
195
- throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'protectedRef', 'must be an exact protected branch, HEAD parent, or Git object ID');
196
- }
197
- const commit = git(context, [
198
- 'rev-parse',
199
- '--verify',
200
- `${reference}^{commit}`,
201
- ]);
202
- if (!commit || !FULL_GIT_OBJECT_ID.test(commit)) {
203
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'protectedRef', `cannot resolve ${reference} to one full Git commit`);
204
- }
205
- return commit;
206
- }
207
- function protectedCommit(context, input) {
208
- if (!SAFE_PROTECTED_GIT_REFERENCE.test(input.protectedRef)) {
209
- throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'protectedRef', 'must be an explicit full Git object ID or refs/remotes/origin/* default-base ref');
210
- }
211
- return exactCommit(context, input.protectedRef);
212
- }
213
- function commits(context, args) {
214
- const output = git(context, [
215
- 'rev-list',
216
- '--first-parent',
217
- '--reverse',
218
- ...args,
219
- ]);
220
- const values = output === '' ? [] : (output ?? '').split('\n');
221
- if (values.length > MAX_HISTORY_COMMITS ||
222
- values.some((commit) => !FULL_GIT_OBJECT_ID.test(commit))) {
223
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.history', `must contain at most ${MAX_HISTORY_COMMITS} exact first-parent commits`);
224
- }
225
- return values;
226
- }
227
- function commitParents(context, commit) {
228
- if (!FULL_GIT_OBJECT_ID.test(commit)) {
229
- throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'git.commit', 'must be a full Git object ID');
230
- }
231
- const line = git(context, ['rev-list', '--parents', '-n', '1', commit]);
232
- const values = line?.split(' ') ?? [];
233
- if (values[0] !== commit ||
234
- values.some((value) => !FULL_GIT_OBJECT_ID.test(value))) {
235
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:parents`, 'cannot establish one exact Git parent list');
236
- }
237
- return values.slice(1);
238
- }
239
- function treeObjectId(context, commit) {
240
- const tree = git(context, ['rev-parse', '--verify', `${commit}^{tree}`]);
241
- if (!tree || !FULL_GIT_OBJECT_ID.test(tree)) {
242
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:tree`, 'cannot establish one exact Git tree');
243
- }
244
- return tree;
245
- }
246
- function blobObjectId(context, commit, path) {
247
- const repositoryPath = safeRepositoryPath(path, 'git.path');
248
- const object = git(context, ['rev-parse', '--verify', `${commit}:${repositoryPath}`], { allowFailure: true });
249
- if (object === undefined)
250
- return undefined;
251
- if (!FULL_GIT_OBJECT_ID.test(object) ||
252
- git(context, ['cat-file', '-t', object]) !== 'blob') {
253
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${repositoryPath}`, 'must resolve to one exact Git blob');
254
- }
255
- return object;
256
- }
257
- function readBlob(context, commit, path) {
258
- if (!FULL_GIT_OBJECT_ID.test(commit)) {
259
- throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'git.commit', 'must be a full Git object ID');
260
- }
261
- const repositoryPath = safeRepositoryPath(path, 'git.path');
262
- const treeEntry = git(context, [
263
- 'ls-tree',
264
- '--name-only',
265
- '-z',
266
- commit,
267
- '--',
268
- repositoryPath,
269
- ]);
270
- if (treeEntry === '')
271
- return undefined;
272
- if (treeEntry !== `${repositoryPath}\0`) {
273
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${repositoryPath}`, 'historical trust path did not resolve to one exact Git tree entry');
274
- }
275
- const value = git(context, ['show', `${commit}:${repositoryPath}`]);
276
- if (value === undefined) {
277
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${repositoryPath}`, 'historical trust blob could not be read');
278
- }
279
- if (Buffer.byteLength(value, 'utf8') > MAX_JSON_BYTES) {
280
- throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', repositoryPath, 'historical trust input exceeds 5 MiB');
281
- }
282
- return value;
283
- }
284
- function readRawBlob(context, commit, path, maximumBytes) {
285
- if (!FULL_GIT_OBJECT_ID.test(commit)) {
286
- throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'git.commit', 'must be a full Git object ID');
287
- }
288
- const repositoryPath = safeRepositoryPath(path, 'git.path');
289
- if (git(context, [
290
- 'ls-tree',
291
- '--name-only',
292
- '-z',
293
- commit,
294
- '--',
295
- repositoryPath,
296
- ]) !== `${repositoryPath}\0`) {
297
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${repositoryPath}`, 'historical execution authority is not one exact Git tree entry');
298
- }
299
- const result = (0, node_child_process_1.spawnSync)(context.executable, [...TRUSTED_GIT_CONFIGURATION, 'show', `${commit}:${repositoryPath}`], {
300
- cwd: context.workspaceRoot,
301
- encoding: null,
302
- env: {
303
- ...context.environment,
304
- GIT_CONFIG_GLOBAL: process.platform === 'win32' ? 'NUL' : '/dev/null',
305
- GIT_CONFIG_NOSYSTEM: '1',
306
- GIT_NO_REPLACE_OBJECTS: '1',
307
- GIT_OPTIONAL_LOCKS: '0',
308
- },
309
- maxBuffer: Math.min(MAX_GIT_OUTPUT_BYTES, maximumBytes + 1),
310
- shell: false,
311
- timeout: 15_000,
312
- windowsHide: true,
313
- });
314
- if (result.error ||
315
- result.status !== 0 ||
316
- !Buffer.isBuffer(result.stdout) ||
317
- result.stdout.length <= 0 ||
318
- result.stdout.length > maximumBytes) {
319
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${repositoryPath}`, 'historical execution authority cannot be read within its byte bound');
320
- }
321
- return result.stdout;
322
- }
323
- function readJsonBlob(context, commit, path) {
324
- const value = readBlob(context, commit, path);
325
- if (value === undefined)
326
- return undefined;
327
- try {
328
- return JSON.parse(value);
329
- }
330
- catch {
331
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${path}`, 'historical trust input is not valid JSON');
332
- }
333
- }
334
- function stateAtCommit(context, commit, policyPath, snapshotPath) {
335
- const policy = readJsonBlob(context, commit, policyPath);
336
- const snapshot = readJsonBlob(context, commit, snapshotPath);
337
- if (policy === undefined && snapshot === undefined)
338
- return undefined;
339
- if (policy === undefined || snapshot === undefined) {
340
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', commit, 'historical trust policy and snapshot must be introduced and retained as one pair');
341
- }
342
- return (0, blueprint_trust_js_1.createBlueprintTrustState)({
343
- policy: policy,
344
- snapshot: snapshot,
345
- });
346
- }
347
- function historyStates(context, history, policyPath, snapshotPath) {
348
- const states = [];
349
- let pairIntroduced = false;
350
- let lastDigest;
351
- for (const commit of history) {
352
- const state = stateAtCommit(context, commit, policyPath, snapshotPath);
353
- if (!state) {
354
- if (pairIntroduced) {
355
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', commit, 'cannot remove the protected Blueprint trust pair from Git history');
356
- }
357
- continue;
358
- }
359
- pairIntroduced = true;
360
- const digest = (0, blueprint_trust_js_1.blueprintTrustStateDigest)(state);
361
- if (digest !== lastDigest) {
362
- states.push({ ...state, commit });
363
- lastDigest = digest;
364
- }
365
- else if (commit === history.at(-1)) {
366
- states.push({ ...state, commit });
367
- }
368
- }
369
- if (states.length === 0) {
370
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.history', 'does not contain a committed Blueprint trust pair');
371
- }
372
- return states;
373
- }
374
- function optionalBlueprintTrustAuthorityBaseline(context, tip, policyPath = exports.BLUEPRINT_TRUST_POLICY_PATH, snapshotPath = exports.BLUEPRINT_TRUST_SNAPSHOT_PATH) {
375
- const stateCommits = commits(context, [tip, '--', policyPath, snapshotPath]);
376
- if (stateCommits.length === 0 &&
377
- stateAtCommit(context, tip, policyPath, snapshotPath) === undefined) {
378
- return undefined;
379
- }
380
- if (stateCommits.at(-1) !== tip)
381
- stateCommits.push(tip);
382
- const states = historyStates(context, stateCommits, policyPath, snapshotPath);
383
- return states[0]?.commit;
384
- }
385
- function blueprintTrustAuthorityBaseline(context, tip, policyPath = exports.BLUEPRINT_TRUST_POLICY_PATH, snapshotPath = exports.BLUEPRINT_TRUST_SNAPSHOT_PATH) {
386
- const baseline = optionalBlueprintTrustAuthorityBaseline(context, tip, policyPath, snapshotPath);
387
- if (!baseline) {
388
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${tip}:ownership`, 'cannot establish the first protected Blueprint trust authority commit');
389
- }
390
- return baseline;
391
- }
392
- function blueprintIdentity(value, path) {
393
- if (!(0, validation_js_1.isRecord)(value) ||
394
- !(0, validation_js_1.isRecord)(value.blueprint) ||
395
- typeof value.blueprint.name !== 'string' ||
396
- typeof value.blueprint.version !== 'string' ||
397
- typeof value.slice !== 'string') {
398
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'historical ownership does not retain an exact Blueprint identity');
399
- }
400
- return {
401
- name: value.blueprint.name,
402
- slice: value.slice,
403
- version: value.blueprint.version,
404
- };
405
- }
406
- function ownershipRecordsAtCommit(context, commit, paths) {
407
- if (paths.some((path) => !OWNERSHIP_PATH.test(path))) {
408
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'contains a noncanonical or ambiguous Slice ownership path');
409
- }
410
- if (paths.length > MAX_OWNERSHIP_RECORDS) {
411
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, `contains more than ${MAX_OWNERSHIP_RECORDS} Slice ownership records`);
412
- }
413
- return paths.flatMap((path) => {
414
- const value = readJsonBlob(context, commit, path);
415
- if (value === undefined) {
416
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${path}`, 'historical ownership disappeared during exact tree inspection');
417
- }
418
- return historicalOwnershipRecord(commit, path, value);
419
- });
420
- }
421
- function historicalOwnershipRecord(commit, path, value) {
422
- if (path === 'packages/foundation/.ebk/ownership.json') {
423
- const foundation = (0, foundation_record_js_1.validateFoundationOwnershipRecord)(value);
424
- if (!foundation.valid) {
425
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${path}`, 'historical Foundation ownership is malformed');
426
- }
427
- return [];
428
- }
429
- // The root site has no Blueprint. Its record is valid only at packages/site.
430
- // History keeps any Slice record as it was committed, so a workspace
431
- // that renamed a Slice named site before the reservation still verifies.
432
- if ((0, site_record_js_1.isSiteOwnershipRecord)(value)) {
433
- if (path !== site_record_js_1.SITE_OWNERSHIP_PATH ||
434
- !(0, site_record_js_1.validateSiteOwnershipRecord)(value).valid) {
435
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${path}`, 'historical root site ownership is malformed or outside packages/site');
436
- }
437
- return [];
438
- }
439
- const validation = (0, record_js_1.validateGeneratedOwnershipRecord)(value);
440
- const slice = path.split('/')[1];
441
- if (!validation.valid || validation.value.slice !== slice) {
442
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${path}`, 'historical Slice ownership is malformed or ambiguous');
443
- }
444
- return [
445
- {
446
- name: validation.value.blueprint.name,
447
- path,
448
- projects: validation.value.projects,
449
- slice: validation.value.slice,
450
- version: validation.value.blueprint.version,
451
- },
452
- ];
453
- }
454
- function changedOwnershipValuesAtCommit(context, commit, paths) {
455
- if (paths.length === 0)
456
- return [];
457
- const specifications = paths.map((path) => `${commit}:${path}`);
458
- const result = (0, node_child_process_1.spawnSync)(context.executable, [...TRUSTED_GIT_CONFIGURATION, 'cat-file', '--batch'], {
459
- cwd: context.workspaceRoot,
460
- env: {
461
- ...context.environment,
462
- GIT_CONFIG_GLOBAL: process.platform === 'win32' ? 'NUL' : '/dev/null',
463
- GIT_CONFIG_NOSYSTEM: '1',
464
- GIT_NO_REPLACE_OBJECTS: '1',
465
- GIT_OPTIONAL_LOCKS: '0',
466
- },
467
- input: Buffer.from(`${specifications.join('\n')}\n`, 'utf8'),
468
- maxBuffer: MAX_GIT_OUTPUT_BYTES,
469
- shell: false,
470
- timeout: 15_000,
471
- windowsHide: true,
472
- });
473
- if (result.error || result.status !== 0 || !Buffer.isBuffer(result.stdout)) {
474
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'historical ownership changes could not be read within their aggregate byte bound');
475
- }
476
- const output = result.stdout;
477
- const values = [];
478
- let offset = 0;
479
- for (const [index, specification] of specifications.entries()) {
480
- const path = paths[index];
481
- if (path === undefined) {
482
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'historical ownership batch input lost its path identity');
483
- }
484
- const headerEnd = output.indexOf(0x0a, offset);
485
- if (headerEnd < 0) {
486
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'historical ownership batch output ended before its declared entries');
487
- }
488
- const header = output.subarray(offset, headerEnd).toString('utf8');
489
- offset = headerEnd + 1;
490
- if (header === `${specification} missing`)
491
- continue;
492
- const match = /^([a-f0-9]{40}|[a-f0-9]{64}) blob ([1-9][0-9]*)$/u.exec(header);
493
- const size = match?.[2] ? Number.parseInt(match[2], 10) : Number.NaN;
494
- if (!match?.[1] ||
495
- !Number.isSafeInteger(size) ||
496
- size > MAX_JSON_BYTES ||
497
- offset + size >= output.length ||
498
- output[offset + size] !== 0x0a) {
499
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${path}`, 'historical ownership batch output is not one bounded Git blob');
500
- }
501
- let value;
502
- try {
503
- value = JSON.parse(output.subarray(offset, offset + size).toString('utf8'));
504
- }
505
- catch {
506
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:${path}`, 'historical ownership batch input is not valid JSON');
507
- }
508
- values.push({ path, value });
509
- offset += size + 1;
510
- }
511
- if (offset !== output.length) {
512
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'historical ownership batch output contains undeclared trailing bytes');
513
- }
514
- return values;
515
- }
516
- function ownershipInventoryAtCommit(context, commit) {
517
- const output = git(context, [
518
- 'ls-tree',
519
- '-r',
520
- '--name-only',
521
- '-z',
522
- commit,
523
- '--',
524
- 'packages',
525
- ]);
526
- const paths = (output === '' ? [] : (output ?? '').split('\0'))
527
- .filter((path) => path !== '')
528
- .filter((path) => path.endsWith('/.ebk/ownership.json'));
529
- return ownershipRecordsAtCommit(context, commit, paths);
530
- }
531
- function changedOwnershipAtCommit(context, commit) {
532
- const output = git(context, [
533
- 'diff-tree',
534
- '--root',
535
- '--first-parent',
536
- '-m',
537
- '--no-commit-id',
538
- '-r',
539
- '--name-only',
540
- '-z',
541
- commit,
542
- '--',
543
- OWNERSHIP_PATHSPEC,
544
- ]);
545
- const paths = (output === '' ? [] : (output ?? '').split('\0')).filter((path) => path !== '');
546
- if (paths.some((path) => !OWNERSHIP_PATH.test(path))) {
547
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'contains a noncanonical or ambiguous changed Slice ownership path');
548
- }
549
- if (paths.length > MAX_OWNERSHIP_RECORDS) {
550
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, `changes more than ${MAX_OWNERSHIP_RECORDS} Slice ownership records`);
551
- }
552
- const parent = git(context, ['rev-parse', '--verify', `${commit}^1^{commit}`], { allowFailure: true });
553
- if (!parent || !FULL_GIT_OBJECT_ID.test(parent)) {
554
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'cannot resolve the exact first parent of an ownership change after the trust authority floor');
555
- }
556
- return [parent, commit].flatMap((revision) => changedOwnershipValuesAtCommit(context, revision, paths).flatMap(({ path, value }) => historicalOwnershipRecord(revision, path, value)));
557
- }
558
- function protectedWorkspaceHasExternalBlueprintOwnership(input) {
559
- if (!FULL_GIT_OBJECT_ID.test(input.commit)) {
560
- throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'blueprintOwnership.commit', 'protected ownership inventory requires one full commit object ID');
561
- }
562
- const workspaceRoot = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(input.workspaceRoot));
563
- const context = {
564
- environment: supplyChainGitEnvironment(process.env),
565
- executable: trustedGitExecutable(workspaceRoot),
566
- workspaceRoot,
567
- };
568
- const gitRoot = git(context, ['rev-parse', '--show-toplevel']);
569
- const commit = git(context, [
570
- 'rev-parse',
571
- '--verify',
572
- `${input.commit}^{commit}`,
573
- ]);
574
- if (!gitRoot ||
575
- !isSameCanonicalDirectory(gitRoot, workspaceRoot) ||
576
- commit !== input.commit) {
577
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.commit', 'protected ownership inventory requires the exact Git worktree and commit');
578
- }
579
- return ownershipInventoryAtCommit(context, commit).some(({ name }) => name !== input.builtInName);
580
- }
581
- /**
582
- * Determines whether an external Blueprint appears anywhere in the bounded
583
- * first-parent ownership histories of current HEAD or either fixed protected
584
- * remote ref before Nx is allowed to load workspace plugins. The workspace's
585
- * mutable defaultBase is deliberately not an authority for this decision, and
586
- * the stricter pre-graph boundary remains permanently enabled after a
587
- * protected external adoption is later removed or relabeled. A missing fixed
588
- * remote ref makes the inventory incomplete and conservatively enables the
589
- * strict boundary; it does not prevent a local-only repository with safe Nx
590
- * configuration from being inspected. A shallow repository likewise enables
591
- * the strict boundary because hidden history cannot prove permanent absence.
592
- * HEAD is always required and clone/ref state is re-resolved after the
593
- * immutable commit inventories are inspected so a concurrent rewrite fails
594
- * closed.
595
- */
596
- function inspectProtectedWorkspaceExternalBlueprintHistory(input) {
597
- const workspaceRoot = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(input.workspaceRoot));
598
- const context = {
599
- environment: supplyChainGitEnvironment(process.env),
600
- executable: trustedGitExecutable(workspaceRoot),
601
- workspaceRoot,
602
- };
603
- const gitRoot = git(context, ['rev-parse', '--show-toplevel']);
604
- if (!gitRoot || !isSameCanonicalDirectory(gitRoot, workspaceRoot)) {
605
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', 'protected ownership history requires the exact Git worktree root');
606
- }
607
- const shallowBefore = git(context, ['rev-parse', '--is-shallow-repository']);
608
- if (!['true', 'false'].includes(shallowBefore ?? '')) {
609
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', 'protected ownership history could not establish clone completeness');
610
- }
611
- const resolveCommits = () => {
612
- const head = exactCommit(context, 'HEAD');
613
- const output = git(context, [
614
- 'for-each-ref',
615
- '--format=%(refname) %(objectname)',
616
- ...PROTECTED_BLUEPRINT_OWNERSHIP_REFS,
617
- ]);
618
- const resolved = new Map();
619
- for (const line of output === '' ? [] : (output ?? '').split('\n')) {
620
- const match = /^(refs\/remotes\/origin\/(?:develop|main)) ([a-f0-9]{40}|[a-f0-9]{64})$/u.exec(line);
621
- if (!match?.[1] ||
622
- !match[2] ||
623
- !PROTECTED_BLUEPRINT_OWNERSHIP_REFS.includes(match[1]) ||
624
- resolved.has(match[1])) {
625
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', 'protected ownership refs could not be enumerated exactly');
626
- }
627
- const commit = exactCommit(context, match[1]);
628
- if (commit !== match[2]) {
629
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', match[1], 'protected ownership ref changed while it was resolved');
630
- }
631
- resolved.set(match[1], commit);
632
- }
633
- return [
634
- head,
635
- ...PROTECTED_BLUEPRINT_OWNERSHIP_REFS.map((reference) => resolved.get(reference)),
636
- ];
637
- };
638
- const before = resolveCommits();
639
- const tips = [
640
- ...new Set(before.filter((commit) => commit !== undefined)),
641
- ];
642
- const baselines = new Set();
643
- const history = new Set();
644
- const inspectedCommits = new Set();
645
- for (const tip of tips) {
646
- const baseline = shallowBefore === 'false'
647
- ? optionalBlueprintTrustAuthorityBaseline(context, tip)
648
- : undefined;
649
- if (baseline) {
650
- baselines.add(baseline);
651
- inspectedCommits.add(baseline);
652
- }
653
- const tipHistory = commits(context, [
654
- `--max-count=${MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS + 1}`,
655
- baseline ? `${baseline}..${tip}` : tip,
656
- '--',
657
- OWNERSHIP_PATHSPEC,
658
- ]);
659
- if (tipHistory.length + (baseline ? 1 : 0) >
660
- MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS) {
661
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', `protected ownership history exceeds ${MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS} changing commits`);
662
- }
663
- for (const commit of tipHistory) {
664
- history.add(commit);
665
- inspectedCommits.add(commit);
666
- if (inspectedCommits.size > MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS) {
667
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', `protected ownership history exceeds ${MAX_PREGRAPH_OWNERSHIP_HISTORY_COMMITS} distinct changing commits`);
668
- }
669
- }
670
- }
671
- const externalProjectNames = new Set();
672
- const externalSliceRoots = new Set();
673
- let externalRecordFound = false;
674
- let historicalRecordCount = 0;
675
- const inspectInventory = (inventory) => {
676
- historicalRecordCount += inventory.length;
677
- if (historicalRecordCount > MAX_PREGRAPH_OWNERSHIP_HISTORY_RECORDS) {
678
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', `protected ownership history exceeds ${MAX_PREGRAPH_OWNERSHIP_HISTORY_RECORDS} aggregate Slice records`);
679
- }
680
- for (const record of inventory) {
681
- if (record.name === input.builtInName)
682
- continue;
683
- externalRecordFound = true;
684
- externalProjectNames.add(record.slice);
685
- for (const project of record.projects ?? []) {
686
- externalProjectNames.add(project);
687
- }
688
- externalSliceRoots.add(`packages/${record.slice}`);
689
- }
690
- };
691
- for (const baseline of baselines) {
692
- inspectInventory(ownershipInventoryAtCommit(context, baseline));
693
- }
694
- for (const commit of history) {
695
- if (baselines.has(commit))
696
- continue;
697
- inspectInventory(changedOwnershipAtCommit(context, commit));
698
- }
699
- const after = resolveCommits();
700
- const shallowAfter = git(context, ['rev-parse', '--is-shallow-repository']);
701
- if (shallowAfter !== shallowBefore ||
702
- before.length !== after.length ||
703
- before.some((commit, index) => commit !== after[index])) {
704
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'blueprintOwnership.history', 'HEAD or a protected ownership ref changed during pre-graph inspection');
705
- }
706
- const protectedInventoryComplete = before
707
- .slice(1)
708
- .every((commit) => commit !== undefined);
709
- const complete = shallowBefore === 'false' && protectedInventoryComplete;
710
- return {
711
- complete,
712
- externalProjectNames: [...externalProjectNames].sort(deterministic_order_js_1.compareUtf16),
713
- externalSliceRoots: [...externalSliceRoots].sort(deterministic_order_js_1.compareUtf16),
714
- requiresStrictNxAuthority: !complete || externalRecordFound,
715
- };
716
- }
717
- function protectedWorkspaceHistoryRequiresStrictNxAuthority(input) {
718
- return inspectProtectedWorkspaceExternalBlueprintHistory(input)
719
- .requiresStrictNxAuthority;
720
- }
721
- function currentOwnershipInventory(input) {
722
- if (input.ownership.length > MAX_OWNERSHIP_RECORDS) {
723
- throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'ownership', `contains more than ${MAX_OWNERSHIP_RECORDS} Slice ownership records`);
724
- }
725
- return input.ownership.flatMap(({ path, value }) => {
726
- const repositoryPath = safeRepositoryPath(path, 'ownership.path');
727
- return historicalOwnershipRecord('working-tree', repositoryPath, value);
728
- });
729
- }
730
- function ownershipIdentity(record) {
731
- return `${record.path}\0${record.slice}\0${record.name}\0${record.version}`;
732
- }
733
- function changedOwnershipPaths(context, parent, commit) {
734
- const output = git(context, [
735
- 'diff-tree',
736
- '-r',
737
- '--no-commit-id',
738
- '--name-only',
739
- '--no-renames',
740
- '-z',
741
- parent,
742
- commit,
743
- '--',
744
- OWNERSHIP_PATHSPEC,
745
- ]);
746
- const paths = (output === '' ? [] : (output ?? '').split('\0')).filter((path) => path !== '');
747
- if (paths.length > MAX_OWNERSHIP_RECORDS ||
748
- paths.some((path) => !OWNERSHIP_PATH.test(path))) {
749
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, `changes more than ${MAX_OWNERSHIP_RECORDS} canonical Slice ownership records`);
750
- }
751
- return paths;
752
- }
753
- function historicalOwnershipAudit(context, builtInName, tip, baseline) {
754
- if (!commits(context, [tip]).includes(baseline)) {
755
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${tip}:ownership`, 'Blueprint trust authority baseline must remain on the exact first-parent lineage');
756
- }
757
- const root = ownershipInventoryAtCommit(context, baseline);
758
- const external = new Map();
759
- const rememberExternal = (record) => {
760
- if (record.name !== builtInName) {
761
- external.set(ownershipIdentity(record), record);
762
- }
763
- };
764
- root.forEach(rememberExternal);
765
- for (const commit of commits(context, [
766
- `${baseline}..${tip}`,
767
- '--',
768
- OWNERSHIP_PATHSPEC,
769
- ])) {
770
- const parent = git(context, ['rev-parse', '--verify', `${commit}^1^{commit}`], { allowFailure: true });
771
- if (!parent || !FULL_GIT_OBJECT_ID.test(parent)) {
772
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${commit}:ownership`, 'cannot resolve the exact first parent of an ownership change');
773
- }
774
- for (const path of changedOwnershipPaths(context, parent, commit)) {
775
- if (path === 'packages/foundation/.ebk/ownership.json')
776
- continue;
777
- const beforeValue = readJsonBlob(context, parent, path);
778
- const afterValue = readJsonBlob(context, commit, path);
779
- const before = beforeValue
780
- ? historicalOwnershipRecord(parent, path, beforeValue)[0]
781
- : undefined;
782
- const after = afterValue
783
- ? historicalOwnershipRecord(commit, path, afterValue)[0]
784
- : undefined;
785
- if (before)
786
- rememberExternal(before);
787
- if (after)
788
- rememberExternal(after);
789
- }
790
- }
791
- return {
792
- external: [...external.values()],
793
- };
794
- }
795
- function assertNoHistoricalPathIndependentRelabel(current, audits) {
796
- for (const audit of audits) {
797
- const ambiguous = audit.external.find((record) => ownershipLineageOverlaps(record, current));
798
- if (!ambiguous)
799
- continue;
800
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${current.path}#blueprint`, `cannot establish built-in provenance while historical external Blueprint ${ambiguous.name}@${ambiguous.version} ownership at ${ambiguous.path} was removed, moved, or reused`);
801
- }
802
- }
803
- function ownershipLineageOverlaps(left, right) {
804
- const rightProjects = new Set(right.projects ?? []);
805
- return (left.slice === right.slice ||
806
- left.path === right.path ||
807
- left.projects?.some((project) => rightProjects.has(project)) === true);
808
- }
809
- function assertNoPathIndependentRelabel(builtInName, current, before, after) {
810
- const afterExternal = new Set(after.filter(({ name }) => name !== builtInName).map(ownershipIdentity));
811
- const relatedExternal = [...before, ...after].find((record) => record.name !== builtInName &&
812
- ownershipLineageOverlaps(record, current) &&
813
- (!before.includes(record) ||
814
- !afterExternal.has(ownershipIdentity(record))));
815
- if (!relatedExternal)
816
- return;
817
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${current.path}#blueprint`, `cannot establish built-in provenance while historical external Blueprint ${relatedExternal.name}@${relatedExternal.version} ownership at ${relatedExternal.path} was removed, moved, or reused`);
818
- }
819
- function builtInProvenance(context, input, headCommit, headBaseline, protectedCommit, protectedBaseline) {
820
- const provenance = [];
821
- const currentOwnership = currentOwnershipInventory(input);
822
- const builtInOwnership = currentOwnership.filter(({ name }) => name === input.builtIn.name);
823
- if (builtInOwnership.length === 0)
824
- return provenance;
825
- const protectedOwnership = ownershipInventoryAtCommit(context, protectedCommit);
826
- const headOwnership = ownershipInventoryAtCommit(context, headCommit);
827
- const protectedAudit = historicalOwnershipAudit(context, input.builtIn.name, protectedCommit, protectedBaseline);
828
- const audits = headCommit === protectedCommit
829
- ? [protectedAudit]
830
- : [
831
- protectedAudit,
832
- historicalOwnershipAudit(context, input.builtIn.name, headCommit, headBaseline),
833
- ];
834
- for (const currentRecord of builtInOwnership) {
835
- const current = currentRecord;
836
- const path = current.path;
837
- const pathCommits = new Set([
838
- headBaseline,
839
- ...commits(context, [`${headBaseline}..${headCommit}`, '--', path]),
840
- protectedBaseline,
841
- ...commits(context, [
842
- `${protectedBaseline}..${protectedCommit}`,
843
- '--',
844
- path,
845
- ]),
846
- ]);
847
- for (const commit of pathCommits) {
848
- const historical = readJsonBlob(context, commit, path);
849
- if (!historical)
850
- continue;
851
- const identity = blueprintIdentity(historical, `${commit}:${path}`);
852
- if (identity.name !== input.builtIn.name) {
853
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${path}#blueprint`, `cannot relabel historical external Blueprint ${identity.name}@${identity.version} as built-in`);
854
- }
855
- }
856
- assertNoHistoricalPathIndependentRelabel(currentRecord, audits);
857
- const head = readJsonBlob(context, headCommit, path);
858
- const protectedValue = readJsonBlob(context, protectedCommit, path);
859
- const headIdentity = head
860
- ? blueprintIdentity(head, `${headCommit}:${path}`)
861
- : undefined;
862
- const protectedIdentity = protectedValue
863
- ? blueprintIdentity(protectedValue, `${protectedCommit}:${path}`)
864
- : undefined;
865
- const matches = (identity) => identity?.name === current.name && identity.version === current.version;
866
- const protectedLineage = protectedOwnership.some((record) => record.path === path &&
867
- record.slice === current.slice &&
868
- record.name === input.builtIn.name);
869
- if (!protectedLineage) {
870
- const headLineage = headOwnership.some((record) => record.path === path &&
871
- record.slice === current.slice &&
872
- record.name === input.builtIn.name);
873
- assertNoPathIndependentRelabel(input.builtIn.name, currentRecord, headLineage ? protectedOwnership : headOwnership, headLineage ? headOwnership : currentOwnership);
874
- }
875
- if (matches(protectedIdentity)) {
876
- provenance.push({
877
- authority: 'protected-git-history',
878
- commit: protectedCommit,
879
- name: current.name,
880
- path,
881
- version: current.version,
882
- });
883
- }
884
- else if (matches(headIdentity)) {
885
- provenance.push({
886
- authority: 'candidate-git-history',
887
- commit: headCommit,
888
- name: current.name,
889
- path,
890
- version: current.version,
891
- });
892
- }
893
- else {
894
- provenance.push({
895
- authority: 'working-tree-adoption',
896
- name: current.name,
897
- path,
898
- version: current.version,
899
- });
900
- }
901
- }
902
- return provenance;
903
- }
904
- function repositoryRootCommit(context, tip) {
905
- const roots = commits(context, ['--max-parents=0', tip]);
906
- if (roots.length !== 1 || !roots[0]) {
907
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.repositoryRoot', 'protected Blueprint authority must descend from one exact repository root commit');
908
- }
909
- return roots[0];
910
- }
911
- function assertCreateOnlyReceiptRetention(context, receiptCommit, executionCommit, paths) {
912
- const parents = commitParents(context, receiptCommit);
913
- // Generated repository governance retains proposals through merge commits.
914
- // Admit that exact shape, not arbitrary ancestry or an updated execution base.
915
- const proposal = parents.length === 2 ? parents[1] : undefined;
916
- const proposalParents = proposal ? commitParents(context, proposal) : [];
917
- const exactRetentionShape = parents[0] === executionCommit &&
918
- (parents.length === 1 ||
919
- (proposal !== undefined &&
920
- proposalParents.length === 1 &&
921
- proposalParents[0] === executionCommit &&
922
- treeObjectId(context, receiptCommit) ===
923
- treeObjectId(context, proposal)));
924
- const changedPaths = (git(context, [
925
- 'diff-tree',
926
- '-r',
927
- '--no-commit-id',
928
- '--name-only',
929
- '--no-renames',
930
- '-z',
931
- executionCommit,
932
- receiptCommit,
933
- ]) ?? '')
934
- .split('\0')
935
- .filter(Boolean)
936
- .map((changedPath) => safeTrackedRepositoryPath(changedPath, 'git.blueprintVerificationReceiptRetention.changedPath'))
937
- .sort();
938
- const retainedPaths = [...paths].sort();
939
- if (!exactRetentionShape ||
940
- retainedPaths.length === 0 ||
941
- retainedPaths.length !== changedPaths.length ||
942
- retainedPaths.some((path, index) => path !== changedPaths[index]) ||
943
- retainedPaths.some((path) => !VERIFICATION_RECEIPT_PATH.test(path) ||
944
- blobObjectId(context, executionCommit, path) !== undefined ||
945
- blobObjectId(context, receiptCommit, path) === undefined)) {
946
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${receiptCommit}:${VERIFICATION_RECEIPT_DIRECTORY}`, 'protected Blueprint verification receipt retention must be one receipt-only, create-only commit whose first parent is the exact execution commit shared by the complete final set; a two-parent PR merge must retain the exact tree of a one-parent proposal directly on that same execution commit. The execution tree must lack every retained receipt path and the changed paths must equal the complete set');
947
- }
948
- }
949
- function latestReceiptSetCommit(context, tip, paths, label) {
950
- const latest = paths.map((path) => commits(context, [tip, '--', path]).at(-1));
951
- const commit = latest[0];
952
- if (!commit || latest.some((candidate) => candidate !== commit)) {
953
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${tip}:${VERIFICATION_RECEIPT_DIRECTORY}`, `${label} must bind the complete final Blueprint verification receipt set through one exact commit`);
954
- }
955
- return commit;
956
- }
957
- function protectedReceiptCommit(context, input, protectedCommit, paths, executionCommit, policyPath, snapshotPath) {
958
- const protectedFirstParent = commits(context, [protectedCommit]);
959
- const directReceiptCommit = latestReceiptSetCommit(context, protectedCommit, paths, input.protectedBranch === 'main'
960
- ? 'production promotion'
961
- : 'protected receipt retention');
962
- const directExecutionIndex = protectedFirstParent.indexOf(executionCommit);
963
- const directRetentionIndex = protectedFirstParent.indexOf(directReceiptCommit);
964
- if (input.protectedBranch !== 'main') {
965
- if (directExecutionIndex !== -1 &&
966
- directRetentionIndex !== -1 &&
967
- directExecutionIndex < directRetentionIndex) {
968
- assertCreateOnlyReceiptRetention(context, directReceiptCommit, executionCommit, paths);
969
- return directReceiptCommit;
970
- }
971
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${VERIFICATION_RECEIPT_DIRECTORY}`, 'execution evidence must originate at an earlier first-parent protected commit and be retained by a later protected Git commit');
972
- }
973
- if (directRetentionIndex === -1) {
974
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${VERIFICATION_RECEIPT_DIRECTORY}`, 'production Blueprint receipt must be retained by one exact commit on the selected main first-parent history');
975
- }
976
- const promotionCommit = directReceiptCommit;
977
- const parents = commitParents(context, promotionCommit);
978
- if (parents.length !== 2) {
979
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${promotionCommit}:${VERIFICATION_RECEIPT_DIRECTORY}`, 'production Blueprint receipt authority requires one literal two-parent develop-to-main promotion merge');
980
- }
981
- const developAuthorityCommit = exactCommit(context, 'refs/remotes/origin/develop');
982
- const promotedParent = parents[1];
983
- const developFirstParent = commits(context, [developAuthorityCommit]);
984
- const mainRoot = repositoryRootCommit(context, protectedCommit);
985
- if (!developFirstParent.includes(promotedParent) ||
986
- repositoryRootCommit(context, developAuthorityCommit) !== mainRoot ||
987
- repositoryRootCommit(context, promotedParent) !== mainRoot) {
988
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${promotionCommit}:parents[1]`, 'production Blueprint receipt authority requires its promoted parent on the exact fetched protected develop first-parent lineage in the same repository history');
989
- }
990
- for (const parityPath of [policyPath, snapshotPath, ...paths]) {
991
- const promotedBlob = blobObjectId(context, promotedParent, parityPath);
992
- const protectedBlob = blobObjectId(context, promotionCommit, parityPath);
993
- if (!promotedBlob || !protectedBlob || promotedBlob !== protectedBlob) {
994
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${promotionCommit}:${parityPath}`, 'production promotion must retain the exact develop-parent trust and receipt blob');
995
- }
996
- }
997
- if (treeObjectId(context, promotedParent) !==
998
- treeObjectId(context, promotionCommit)) {
999
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${promotionCommit}:tree`, 'production promotion tree must equal its exact reviewed develop parent');
1000
- }
1001
- const promotedFirstParent = commits(context, [promotedParent]);
1002
- const promotedReceiptCommit = latestReceiptSetCommit(context, promotedParent, paths, 'promoted develop receipt retention');
1003
- const promotedExecutionIndex = promotedFirstParent.indexOf(executionCommit);
1004
- const promotedRetentionIndex = promotedFirstParent.indexOf(promotedReceiptCommit);
1005
- if (promotedExecutionIndex === -1 ||
1006
- promotedRetentionIndex === -1 ||
1007
- promotedExecutionIndex >= promotedRetentionIndex) {
1008
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${promotionCommit}:${VERIFICATION_RECEIPT_DIRECTORY}`, 'promoted execution evidence must originate at an earlier first-parent develop commit and be retained by a later first-parent develop commit');
1009
- }
1010
- assertCreateOnlyReceiptRetention(context, promotedReceiptCommit, executionCommit, paths);
1011
- if (exactCommit(context, 'refs/remotes/origin/develop') !==
1012
- developAuthorityCommit) {
1013
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'refs/remotes/origin/develop', 'protected develop authority changed during production receipt inspection');
1014
- }
1015
- return promotedReceiptCommit;
1016
- }
1017
- function protectedVerificationReceipts(context, input, protectedCommit, repositoryRoot, policyPath, snapshotPath) {
1018
- const output = git(context, [
1019
- 'ls-tree',
1020
- '-r',
1021
- '--name-only',
1022
- '-z',
1023
- protectedCommit,
1024
- '--',
1025
- VERIFICATION_RECEIPT_DIRECTORY,
1026
- ]);
1027
- const paths = (output === '' ? [] : (output ?? '').split('\0')).filter((path) => path !== '');
1028
- if (paths.length > MAX_OWNERSHIP_RECORDS ||
1029
- paths.some((path) => !VERIFICATION_RECEIPT_PATH.test(path))) {
1030
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:blueprintVerificationReceipts`, `must contain at most ${MAX_OWNERSHIP_RECORDS} canonical protected receipt blobs`);
1031
- }
1032
- const receipts = paths.map((path) => {
1033
- const value = readJsonBlob(context, protectedCommit, path);
1034
- if (value === undefined) {
1035
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}`, 'protected Blueprint verification receipt disappeared during exact tree inspection');
1036
- }
1037
- const receipt = (0, blueprint_trust_js_1.createBlueprintVerificationExecutionReceipt)(value);
1038
- if (path !== (0, blueprint_trust_js_1.blueprintVerificationExecutionReceiptPath)(receipt.slice)) {
1039
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}`, 'protected Blueprint verification receipt path does not match its Slice');
1040
- }
1041
- if (receipt.repositoryRootCommit !== repositoryRoot) {
1042
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}#repositoryRootCommit`, 'protected Blueprint verification receipt belongs to a different Git repository history');
1043
- }
1044
- return { path, receipt };
1045
- });
1046
- const firstReceipt = receipts[0];
1047
- if (!firstReceipt)
1048
- return [];
1049
- const executionCommit = firstReceipt.receipt.executionCommit;
1050
- if (receipts.some(({ receipt }) => receipt.executionCommit !== executionCommit)) {
1051
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${VERIFICATION_RECEIPT_DIRECTORY}`, 'the complete final Blueprint verification receipt set must share one exact execution commit');
1052
- }
1053
- const receiptCommit = protectedReceiptCommit(context, input, protectedCommit, paths, executionCommit, policyPath, snapshotPath);
1054
- return receipts.map(({ path, receipt }) => {
1055
- const executionLockfile = readRawBlob(context, receipt.executionCommit, 'pnpm-lock.yaml', 25 * 1024 * 1024);
1056
- if ((0, node_crypto_1.createHash)('sha256').update(executionLockfile).digest('hex') !==
1057
- receipt.lockfileSha256) {
1058
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}#lockfileSha256`, 'protected receipt does not bind the exact execution-commit pnpm lockfile blob');
1059
- }
1060
- const executionManifestBytes = readRawBlob(context, receipt.executionCommit, 'package.json', MAX_JSON_BYTES);
1061
- const executionNodeVersion = readRawBlob(context, receipt.executionCommit, '.node-version', 128).toString('utf8');
1062
- let executionManifest;
1063
- try {
1064
- executionManifest = JSON.parse(executionManifestBytes.toString('utf8'));
1065
- }
1066
- catch {
1067
- executionManifest = undefined;
1068
- }
1069
- const executionNodeEngine = (0, validation_js_1.isRecord)(executionManifest) && (0, validation_js_1.isRecord)(executionManifest.engines)
1070
- ? executionManifest.engines.node
1071
- : undefined;
1072
- if (executionNodeEngine !== receipt.nodeEngine ||
1073
- executionNodeVersion !== `${receipt.nodeVersionDeclaration}\n`) {
1074
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}#nodeEngine`, 'protected receipt does not bind the exact execution-commit Node declarations');
1075
- }
1076
- const changedExecutionAuthority = git(context, [
1077
- 'diff-tree',
1078
- '-r',
1079
- '--no-commit-id',
1080
- '--name-only',
1081
- '--no-renames',
1082
- '-z',
1083
- receipt.executionCommit,
1084
- protectedCommit,
1085
- ]);
1086
- const changedSelectedAuthority = (changedExecutionAuthority ?? '')
1087
- .split('\0')
1088
- .filter(Boolean)
1089
- .map((entry) => safeTrackedRepositoryPath(entry, 'git.verificationExecutionAuthority.changedPath'))
1090
- .filter(blueprint_verification_authority_js_1.isBlueprintVerificationExecutionAuthorityPath);
1091
- if (changedSelectedAuthority.length > 0) {
1092
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}#executionCommit`, 'protected Blueprint verification execution authority changed after receipt execution; rerun the review from the current protected commit');
1093
- }
1094
- const executionState = stateAtCommit(context, receipt.executionCommit, policyPath, snapshotPath);
1095
- const review = executionState?.policy.generatedReviews.find(({ evidenceDigest }) => evidenceDigest === receipt.approvalDigest);
1096
- if (!executionState || !review) {
1097
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}#approvalDigest`, 'execution commit does not contain the exact protected static approval');
1098
- }
1099
- const decision = (0, blueprint_trust_js_1.authorizeBlueprintTrust)({
1100
- frameworkVersion: input.builtIn.version,
1101
- integrity: receipt.blueprint.integrity,
1102
- name: receipt.blueprint.name,
1103
- now: receipt.generatedAt,
1104
- operation: 'adopt',
1105
- policy: executionState.policy,
1106
- snapshot: executionState.snapshot,
1107
- version: receipt.blueprint.version,
1108
- });
1109
- if (decision.decision !== 'allow') {
1110
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${protectedCommit}:${path}#executionCommit`, 'execution commit did not authorize the exact Blueprint release');
1111
- }
1112
- return {
1113
- protectedCommit: receiptCommit,
1114
- receipt,
1115
- reference: path,
1116
- };
1117
- });
1118
- }
1119
- function inspectBlueprintTrustGitAuthority(input) {
1120
- if (!['develop', 'main'].includes(input.protectedBranch)) {
1121
- throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'protectedBranch', 'must explicitly identify develop or main protected-route authority');
1122
- }
1123
- const workspaceRoot = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(input.workspaceRoot));
1124
- const context = {
1125
- environment: supplyChainGitEnvironment(input.environment ?? process.env),
1126
- executable: trustedGitExecutable(workspaceRoot),
1127
- workspaceRoot,
1128
- };
1129
- const gitRoot = git(context, ['rev-parse', '--show-toplevel']);
1130
- if (!gitRoot) {
1131
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git', 'workspace is not backed by Git history');
1132
- }
1133
- if (!isSameCanonicalDirectory(gitRoot, workspaceRoot)) {
1134
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git', 'workspace root must equal the protected Git worktree root');
1135
- }
1136
- if (git(context, ['rev-parse', '--is-shallow-repository']) !== 'false') {
1137
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.history', 'must be complete; fetch full protected history before Blueprint authorization');
1138
- }
1139
- const policyPath = safeRepositoryPath(input.policyPath ?? exports.BLUEPRINT_TRUST_POLICY_PATH, 'policyPath');
1140
- const snapshotPath = safeRepositoryPath(input.snapshotPath ?? exports.BLUEPRINT_TRUST_SNAPSHOT_PATH, 'snapshotPath');
1141
- const headCommit = exactCommit(context, 'HEAD');
1142
- const authorityCommit = protectedCommit(context, input);
1143
- const rootCommit = repositoryRootCommit(context, authorityCommit);
1144
- const protectedCommits = commits(context, [
1145
- authorityCommit,
1146
- '--',
1147
- policyPath,
1148
- snapshotPath,
1149
- ]);
1150
- if (protectedCommits.at(-1) !== authorityCommit) {
1151
- protectedCommits.push(authorityCommit);
1152
- }
1153
- const protectedStates = historyStates(context, protectedCommits, policyPath, snapshotPath);
1154
- const protectedHistory = (0, blueprint_trust_js_1.validateBlueprintTrustHistory)(protectedStates);
1155
- const protectedBaseline = protectedStates[0]?.commit;
1156
- if (!protectedBaseline) {
1157
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `${authorityCommit}:ownership`, 'cannot establish the first protected Blueprint trust authority commit');
1158
- }
1159
- const authorization = (0, blueprint_trust_js_1.createBlueprintTrustState)(protectedStates.at(-1));
1160
- const mergeBase = git(context, ['merge-base', authorityCommit, headCommit]);
1161
- if (!mergeBase || !FULL_GIT_OBJECT_ID.test(mergeBase)) {
1162
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.history', 'candidate and protected history do not share one exact merge base');
1163
- }
1164
- const candidateCommits = [
1165
- mergeBase,
1166
- ...commits(context, [
1167
- `${mergeBase}..${headCommit}`,
1168
- '--',
1169
- policyPath,
1170
- snapshotPath,
1171
- ]),
1172
- ].filter((commit, index, values) => values.indexOf(commit) === index);
1173
- if (candidateCommits.at(-1) !== headCommit)
1174
- candidateCommits.push(headCommit);
1175
- const candidateStates = historyStates(context, candidateCommits, policyPath, snapshotPath);
1176
- const candidateHistory = (0, blueprint_trust_js_1.validateBlueprintTrustHistory)(candidateStates);
1177
- const headBaseline = blueprintTrustAuthorityBaseline(context, headCommit, policyPath, snapshotPath);
1178
- const head = (0, blueprint_trust_js_1.createBlueprintTrustState)(candidateStates.at(-1));
1179
- if ((0, blueprint_trust_js_1.blueprintTrustStateDigest)(authorization) !== (0, blueprint_trust_js_1.blueprintTrustStateDigest)(head)) {
1180
- (0, blueprint_trust_js_1.planBlueprintTrustStateTransition)(authorization, head);
1181
- }
1182
- const current = (0, blueprint_trust_js_1.createBlueprintTrustState)(input.current);
1183
- const workingTreeTransition = (0, blueprint_trust_js_1.blueprintTrustStateDigest)(head) === (0, blueprint_trust_js_1.blueprintTrustStateDigest)(current)
1184
- ? undefined
1185
- : (0, blueprint_trust_js_1.planBlueprintTrustStateTransition)(head, current).receipt;
1186
- return {
1187
- authorization,
1188
- builtInProvenance: builtInProvenance(context, input, headCommit, headBaseline, authorityCommit, protectedBaseline),
1189
- candidateHistory,
1190
- headCommit,
1191
- protectedCommit: authorityCommit,
1192
- protectedHistory,
1193
- protectedVerificationReceipts: protectedVerificationReceipts(context, input, authorityCommit, rootCommit, policyPath, snapshotPath),
1194
- repositoryRootCommit: rootCommit,
1195
- ...(workingTreeTransition ? { workingTreeTransition } : {}),
1196
- };
1197
- }
1198
- /**
1199
- * Binds one working-tree file byte-for-byte to both commits already admitted by
1200
- * the protected Blueprint trust inspection. `git hash-object --stdin` computes
1201
- * the repository's native object id without writing an object, so this remains
1202
- * correct for either SHA-1 or SHA-256 repositories and does not normalize text.
1203
- */
1204
- function inspectProtectedGitFileAuthority(input) {
1205
- if (!FULL_GIT_OBJECT_ID.test(input.headCommit) ||
1206
- !FULL_GIT_OBJECT_ID.test(input.protectedCommit)) {
1207
- throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'git.fileAuthority', 'head and protected authority must be full Git commit object ids');
1208
- }
1209
- const repositoryPath = safeRepositoryPath(input.path, 'git.fileAuthority.path');
1210
- const current = Buffer.from(input.current);
1211
- if (current.byteLength === 0 || current.byteLength > MAX_JSON_BYTES) {
1212
- throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', repositoryPath, 'protected working-tree authority must be a non-empty file of at most 5 MiB');
1213
- }
1214
- const workspaceRoot = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(input.workspaceRoot));
1215
- const context = {
1216
- environment: supplyChainGitEnvironment(input.environment ?? process.env),
1217
- executable: trustedGitExecutable(workspaceRoot),
1218
- workspaceRoot,
1219
- };
1220
- const gitRoot = git(context, ['rev-parse', '--show-toplevel']);
1221
- if (!gitRoot || !isSameCanonicalDirectory(gitRoot, workspaceRoot)) {
1222
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', repositoryPath, 'protected file authority requires the exact Git worktree root');
1223
- }
1224
- const currentObjectId = hashGitBlob(context, current);
1225
- const headObjectId = blobObjectId(context, input.headCommit, repositoryPath);
1226
- const protectedObjectId = blobObjectId(context, input.protectedCommit, repositoryPath);
1227
- if (!headObjectId ||
1228
- !protectedObjectId ||
1229
- currentObjectId !== headObjectId ||
1230
- currentObjectId !== protectedObjectId) {
1231
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', repositoryPath, 'working, HEAD, and protected Git file bytes must be exactly identical');
1232
- }
1233
- return {
1234
- blobObjectId: currentObjectId,
1235
- headCommit: input.headCommit,
1236
- path: repositoryPath,
1237
- protectedCommit: input.protectedCommit,
1238
- };
1239
- }
1240
- function inspectProtectedGitFileRefAuthority(input) {
1241
- if (!['refs/remotes/origin/develop', 'refs/remotes/origin/main'].includes(input.protectedRef)) {
1242
- throw new errors_js_1.SupplyChainError('supply-chain-input-invalid', 'git.fileAuthority.protectedRef', 'protected file authority requires one exact remote protected ref');
1243
- }
1244
- const workspaceRoot = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(input.workspaceRoot));
1245
- const context = {
1246
- environment: supplyChainGitEnvironment(input.environment ?? process.env),
1247
- executable: trustedGitExecutable(workspaceRoot),
1248
- workspaceRoot,
1249
- };
1250
- const headCommit = git(context, ['rev-parse', '--verify', 'HEAD^{commit}']);
1251
- const protectedCommit = git(context, [
1252
- 'rev-parse',
1253
- '--verify',
1254
- `${input.protectedRef}^{commit}`,
1255
- ]);
1256
- if (!headCommit ||
1257
- !protectedCommit ||
1258
- !FULL_GIT_OBJECT_ID.test(headCommit) ||
1259
- !FULL_GIT_OBJECT_ID.test(protectedCommit)) {
1260
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', input.path, 'protected file authority cannot resolve exact HEAD and remote commits');
1261
- }
1262
- return inspectProtectedGitFileAuthority({
1263
- current: input.current,
1264
- environment: input.environment,
1265
- headCommit,
1266
- path: input.path,
1267
- protectedCommit,
1268
- workspaceRoot,
1269
- });
1270
- }
1271
- function readExecutionSnapshotFile(workspaceRoot, path, maximumBytes) {
1272
- const repositoryPath = safeTrackedRepositoryPath(path, 'blueprintVerification.workspaceSnapshot.path');
1273
- const absolute = (0, node_path_1.join)(workspaceRoot, repositoryPath);
1274
- const metadata = (0, node_fs_1.lstatSync)(absolute);
1275
- if (metadata.isSymbolicLink() ||
1276
- !metadata.isFile() ||
1277
- metadata.nlink !== 1 ||
1278
- metadata.size <= 0 ||
1279
- metadata.size > maximumBytes ||
1280
- (0, node_fs_1.realpathSync)(absolute) !== absolute) {
1281
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', repositoryPath, 'workspace execution snapshot requires one canonical bounded file');
1282
- }
1283
- const bytes = (0, node_fs_1.readFileSync)(absolute);
1284
- if (bytes.byteLength !== metadata.size) {
1285
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', repositoryPath, 'workspace execution snapshot file changed while read');
1286
- }
1287
- return bytes;
1288
- }
1289
- function executionSnapshotOwnedPaths(workspaceRoot) {
1290
- const paths = new Set();
1291
- const addOwnedPaths = (prefix, owned) => {
1292
- for (const entry of owned) {
1293
- if (entry.mode !== 'managed' && entry.origin !== 'blueprint')
1294
- continue;
1295
- paths.add(safeTrackedRepositoryPath(prefix ? `${prefix}/${entry.path}` : entry.path, 'blueprintVerification.workspaceSnapshot.ownedPath'));
1296
- }
1297
- };
1298
- const rootOwnershipPath = (0, node_path_1.join)(workspaceRoot, '.ebk', 'ownership.json');
1299
- if ((0, node_fs_1.existsSync)(rootOwnershipPath)) {
1300
- const rootOwnership = readExecutionSnapshotFile(workspaceRoot, '.ebk/ownership.json', MAX_JSON_BYTES);
1301
- let value;
1302
- try {
1303
- value = JSON.parse(rootOwnership.toString('utf8'));
1304
- }
1305
- catch {
1306
- value = undefined;
1307
- }
1308
- const validation = (0, workspace_record_js_1.validateWorkspaceOwnershipRecord)(value);
1309
- if (!validation.valid) {
1310
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', '.ebk/ownership.json', 'workspace execution snapshot requires valid workspace ownership');
1311
- }
1312
- paths.add('.ebk/ownership.json');
1313
- addOwnedPaths('', validation.value.paths);
1314
- }
1315
- const packagesRoot = (0, node_path_1.join)(workspaceRoot, 'packages');
1316
- if (!(0, node_fs_1.existsSync)(packagesRoot))
1317
- return [...paths];
1318
- const packagesMetadata = (0, node_fs_1.lstatSync)(packagesRoot);
1319
- if (packagesMetadata.isSymbolicLink() ||
1320
- !packagesMetadata.isDirectory() ||
1321
- (0, node_fs_1.realpathSync)(packagesRoot) !== packagesRoot) {
1322
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'packages', 'workspace execution snapshot requires one canonical packages directory');
1323
- }
1324
- const packages = (0, node_fs_1.readdirSync)(packagesRoot, { withFileTypes: true }).sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
1325
- if (packages.length > 2_000) {
1326
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'packages', 'workspace execution snapshot exceeds 2,000 package entries');
1327
- }
1328
- const identities = new Set();
1329
- for (const entry of packages) {
1330
- const identity = entry.name.normalize('NFC').toLowerCase();
1331
- if (identities.has(identity) || entry.isSymbolicLink()) {
1332
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', `packages/${entry.name}`, 'workspace execution snapshot refuses ambiguous or symbolic-link packages');
1333
- }
1334
- identities.add(identity);
1335
- if (!entry.isDirectory())
1336
- continue;
1337
- const prefix = safeTrackedRepositoryPath(`packages/${entry.name}`, 'blueprintVerification.workspaceSnapshot.package');
1338
- const ownershipPath = `${prefix}/.ebk/ownership.json`;
1339
- if (!(0, node_fs_1.existsSync)((0, node_path_1.join)(workspaceRoot, ownershipPath)))
1340
- continue;
1341
- const ownership = readExecutionSnapshotFile(workspaceRoot, ownershipPath, MAX_JSON_BYTES);
1342
- let value;
1343
- try {
1344
- value = JSON.parse(ownership.toString('utf8'));
1345
- }
1346
- catch {
1347
- value = undefined;
1348
- }
1349
- paths.add(ownershipPath);
1350
- if (entry.name === 'foundation') {
1351
- const foundation = (0, foundation_record_js_1.validateFoundationOwnershipRecord)(value);
1352
- if (!foundation.valid) {
1353
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', ownershipPath, 'workspace execution snapshot requires valid Foundation ownership');
1354
- }
1355
- addOwnedPaths(prefix, foundation.value.paths);
1356
- continue;
1357
- }
1358
- // packages/site holds only the root site, and its record belongs only
1359
- // there.
1360
- if (entry.name === root_site_js_1.ROOT_SITE_NAME || (0, site_record_js_1.isSiteOwnershipRecord)(value)) {
1361
- const site = (0, site_record_js_1.validateSiteOwnershipRecord)(value);
1362
- if (entry.name !== root_site_js_1.ROOT_SITE_NAME || !site.valid) {
1363
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', ownershipPath, entry.name === root_site_js_1.ROOT_SITE_NAME
1364
- ? 'workspace execution snapshot requires valid root site ownership at packages/site, which is reserved for the workspace root site'
1365
- : 'workspace execution snapshot refuses root site ownership outside packages/site');
1366
- }
1367
- addOwnedPaths(prefix, site.value.paths);
1368
- continue;
1369
- }
1370
- const generated = (0, record_js_1.validateGeneratedOwnershipRecord)(value);
1371
- if (!generated.valid || generated.value.slice !== entry.name) {
1372
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', ownershipPath, 'workspace execution snapshot requires valid unambiguous Slice ownership');
1373
- }
1374
- addOwnedPaths(prefix, generated.value.paths);
1375
- }
1376
- return [...paths];
1377
- }
1378
- /**
1379
- * Captures the exact entry bytes of every tracked/nonignored path plus every
1380
- * ignored ownership-managed or Blueprint-origin path. Verification targets may
1381
- * write ignored evidence/cache outputs, but cannot mutate subsequent target
1382
- * authority without failing their own executor result.
1383
- */
1384
- function createBlueprintVerificationWorkspaceSnapshot(workspace, additionalAuthorityPaths = []) {
1385
- const workspaceRoot = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(workspace));
1386
- const context = {
1387
- environment: supplyChainGitEnvironment(process.env),
1388
- executable: trustedGitExecutable(workspaceRoot),
1389
- workspaceRoot,
1390
- };
1391
- const gitRoot = git(context, ['rev-parse', '--show-toplevel']);
1392
- if (!gitRoot || !isSameCanonicalDirectory(gitRoot, workspaceRoot)) {
1393
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeSnapshot', 'workspace execution snapshot requires the exact Git worktree root');
1394
- }
1395
- const inventory = git(context, [
1396
- 'ls-files',
1397
- '--cached',
1398
- '--others',
1399
- '--exclude-standard',
1400
- '-z',
1401
- ]);
1402
- const paths = new Set((inventory ?? '')
1403
- .split('\0')
1404
- .filter(Boolean)
1405
- .map((path) => safeTrackedRepositoryPath(path, 'blueprintVerification.workspaceSnapshot.path')));
1406
- const authorityPaths = [...new Set(additionalAuthorityPaths)]
1407
- .map((path) => safeTrackedRepositoryPath(path, 'blueprintVerification.workspaceSnapshot.authorityPath'))
1408
- .sort();
1409
- for (const path of authorityPaths)
1410
- paths.add(path);
1411
- for (const path of executionSnapshotOwnedPaths(workspaceRoot)) {
1412
- paths.add(path);
1413
- }
1414
- if (paths.size > MAX_EXECUTION_SNAPSHOT_ENTRIES) {
1415
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeSnapshot', 'workspace execution snapshot exceeds 50,000 files');
1416
- }
1417
- const aliases = new Set();
1418
- let totalBytes = 0;
1419
- const entries = [...paths]
1420
- .sort()
1421
- .map((path) => {
1422
- const alias = path.normalize('NFC').toLowerCase();
1423
- if (aliases.has(alias)) {
1424
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'workspace execution snapshot contains a case or Unicode path alias');
1425
- }
1426
- aliases.add(alias);
1427
- const absolute = (0, node_path_1.join)(workspaceRoot, path);
1428
- const metadata = (0, node_fs_1.lstatSync)(absolute);
1429
- if (metadata.isSymbolicLink() ||
1430
- !metadata.isFile() ||
1431
- metadata.nlink !== 1 ||
1432
- metadata.size > MAX_EXECUTION_SNAPSHOT_FILE_BYTES ||
1433
- (0, node_fs_1.realpathSync)(absolute) !== absolute) {
1434
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'workspace execution snapshot requires one canonical bounded file');
1435
- }
1436
- totalBytes += metadata.size;
1437
- if (totalBytes > MAX_EXECUTION_SNAPSHOT_BYTES) {
1438
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'workspace execution snapshot exceeds its 512 MiB byte bound');
1439
- }
1440
- const bytes = (0, node_fs_1.readFileSync)(absolute);
1441
- if (bytes.byteLength !== metadata.size) {
1442
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'workspace execution snapshot file changed while read');
1443
- }
1444
- return {
1445
- mode: process.platform === 'win32' || (metadata.mode & 0o111) === 0
1446
- ? '100644'
1447
- : '100755',
1448
- path,
1449
- sha256: (0, node_crypto_1.createHash)('sha256').update(bytes).digest('hex'),
1450
- size: metadata.size,
1451
- };
1452
- });
1453
- return { authorityPaths, entries, workspaceRoot };
1454
- }
1455
- function assertBlueprintVerificationWorkspaceSnapshot(snapshot) {
1456
- const current = createBlueprintVerificationWorkspaceSnapshot(snapshot.workspaceRoot, snapshot.authorityPaths);
1457
- if (JSON.stringify(current.entries) !== JSON.stringify(snapshot.entries)) {
1458
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeSnapshot', 'workspace execution authority changed during recurring verification');
1459
- }
1460
- }
1461
- /**
1462
- * Proves that every tracked and non-ignored workspace byte still represents
1463
- * the exact protected commit selected for receipt-minting execution. Ignored
1464
- * dependency/cache state remains outside this local-integrity boundary and is
1465
- * constrained separately by the generated reviewer.
1466
- */
1467
- function assertProtectedGitTreeAuthority(input, pathSelector, allowHeadDifference = false, readAuthorityFile = node_fs_1.readFileSync) {
1468
- if (!FULL_GIT_OBJECT_ID.test(input.headCommit) ||
1469
- !FULL_GIT_OBJECT_ID.test(input.protectedCommit) ||
1470
- (!allowHeadDifference && input.headCommit !== input.protectedCommit) ||
1471
- !['refs/remotes/origin/develop', 'refs/remotes/origin/main'].includes(input.protectedRef)) {
1472
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeAuthority', 'working-tree authority requires one exact protected HEAD commit');
1473
- }
1474
- const workspaceRoot = (0, node_fs_1.realpathSync)((0, node_path_1.resolve)(input.workspaceRoot));
1475
- const context = {
1476
- environment: supplyChainGitEnvironment(input.environment ?? process.env),
1477
- executable: trustedGitExecutable(workspaceRoot),
1478
- workspaceRoot,
1479
- };
1480
- const head = git(context, ['rev-parse', '--verify', 'HEAD^{commit}']);
1481
- const protectedCommit = git(context, [
1482
- 'rev-parse',
1483
- '--verify',
1484
- `${input.protectedRef}^{commit}`,
1485
- ]);
1486
- const treeOutput = git(context, [
1487
- 'ls-tree',
1488
- '-rz',
1489
- '--full-tree',
1490
- input.headCommit,
1491
- ]);
1492
- const protectedTreeOutput = allowHeadDifference
1493
- ? git(context, ['ls-tree', '-rz', '--full-tree', input.protectedCommit])
1494
- : treeOutput;
1495
- const indexOutput = git(context, ['ls-files', '--stage', '-z']);
1496
- const untracked = git(context, [
1497
- 'ls-files',
1498
- '--others',
1499
- '--exclude-standard',
1500
- '-z',
1501
- ]);
1502
- const tree = new Map();
1503
- const treeAliases = new Set();
1504
- for (const entry of (treeOutput ?? '').split('\0').filter(Boolean)) {
1505
- const separator = entry.indexOf('\t');
1506
- const rawPath = separator === -1 ? '' : entry.slice(separator + 1);
1507
- if (pathSelector && !pathSelector(rawPath))
1508
- continue;
1509
- const match = /^(100644|100755|120000) blob ([a-f0-9]{40}|[a-f0-9]{64})\t(.+)$/u.exec(entry);
1510
- if (!match || !match[1] || !match[2] || !match[3]) {
1511
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeAuthority', 'protected tree contains an unsupported tracked entry');
1512
- }
1513
- const path = safeTrackedRepositoryPath(match[3], 'git.workingTreeAuthority.path');
1514
- const alias = path.normalize('NFC').toLowerCase();
1515
- if (tree.has(path) || treeAliases.has(alias)) {
1516
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'protected tree contains a duplicate, case, or Unicode aliased tracked path');
1517
- }
1518
- treeAliases.add(alias);
1519
- tree.set(path, { mode: match[1], objectId: match[2] });
1520
- }
1521
- const protectedTree = new Map();
1522
- const protectedTreeAliases = new Set();
1523
- for (const entry of (protectedTreeOutput ?? '').split('\0').filter(Boolean)) {
1524
- const separator = entry.indexOf('\t');
1525
- const rawPath = separator === -1 ? '' : entry.slice(separator + 1);
1526
- if (pathSelector && !pathSelector(rawPath))
1527
- continue;
1528
- const match = /^(100644|100755|120000) blob ([a-f0-9]{40}|[a-f0-9]{64})\t(.+)$/u.exec(entry);
1529
- if (!match || !match[1] || !match[2] || !match[3]) {
1530
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeAuthority', 'protected authority tree contains an unsupported tracked entry');
1531
- }
1532
- const path = safeTrackedRepositoryPath(match[3], 'git.workingTreeAuthority.path');
1533
- const alias = path.normalize('NFC').toLowerCase();
1534
- if (protectedTree.has(path) || protectedTreeAliases.has(alias)) {
1535
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'protected authority tree contains a duplicate, case, or Unicode aliased tracked path');
1536
- }
1537
- protectedTreeAliases.add(alias);
1538
- protectedTree.set(path, { mode: match[1], objectId: match[2] });
1539
- }
1540
- const index = new Map();
1541
- const indexAliases = new Set();
1542
- for (const entry of (indexOutput ?? '').split('\0').filter(Boolean)) {
1543
- const separator = entry.indexOf('\t');
1544
- const rawPath = separator === -1 ? '' : entry.slice(separator + 1);
1545
- if (pathSelector && !pathSelector(rawPath))
1546
- continue;
1547
- const match = /^(100644|100755|120000) ([a-f0-9]{40}|[a-f0-9]{64}) 0\t(.+)$/u.exec(entry);
1548
- if (!match || !match[1] || !match[2] || !match[3]) {
1549
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeAuthority', 'index contains an unsupported or unresolved tracked entry');
1550
- }
1551
- const path = safeTrackedRepositoryPath(match[3], 'git.workingTreeAuthority.path');
1552
- const alias = path.normalize('NFC').toLowerCase();
1553
- if (index.has(path) || indexAliases.has(alias)) {
1554
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'index contains a duplicate, case, or Unicode aliased tracked path');
1555
- }
1556
- indexAliases.add(alias);
1557
- index.set(path, { mode: match[1], objectId: match[2] });
1558
- }
1559
- const selectedUntracked = (untracked ?? '')
1560
- .split('\0')
1561
- .filter(Boolean)
1562
- .filter((path) => !pathSelector || pathSelector(path))
1563
- .map((path) => safeTrackedRepositoryPath(path, 'git.workingTreeAuthority.path'));
1564
- const untrackedAliases = new Set();
1565
- for (const path of selectedUntracked) {
1566
- const alias = path.normalize('NFC').toLowerCase();
1567
- if (untrackedAliases.has(alias) || treeAliases.has(alias)) {
1568
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'untracked authority contains a duplicate, case, or Unicode alias');
1569
- }
1570
- untrackedAliases.add(alias);
1571
- }
1572
- if (head !== input.headCommit ||
1573
- protectedCommit !== input.protectedCommit ||
1574
- selectedUntracked.length > 0 ||
1575
- tree.size !== index.size ||
1576
- tree.size !== protectedTree.size) {
1577
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeAuthority', 'protected review requires a clean current tree at the exact protected commit');
1578
- }
1579
- const assertCurrentWorkingBytes = (path, expected) => {
1580
- const candidate = (0, node_path_1.join)(workspaceRoot, ...path.split('/'));
1581
- const metadata = (0, node_fs_1.lstatSync)(candidate);
1582
- if (!Number.isSafeInteger(metadata.size) ||
1583
- metadata.size < 0 ||
1584
- metadata.size > MAX_GIT_OUTPUT_BYTES) {
1585
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'working authority file exceeds the bounded byte contract');
1586
- }
1587
- const bytes = expected.mode === '120000'
1588
- ? Buffer.from((0, node_fs_1.readlinkSync)(candidate), 'utf8')
1589
- : readAuthorityFile(candidate);
1590
- if ((expected.mode === '120000') !== metadata.isSymbolicLink() ||
1591
- (expected.mode !== '120000' && !metadata.isFile()) ||
1592
- (process.platform !== 'win32' &&
1593
- expected.mode !== '120000' &&
1594
- ((metadata.mode & 0o111) !== 0) !== (expected.mode === '100755')) ||
1595
- (expected.mode !== '120000' && bytes.byteLength !== metadata.size) ||
1596
- hashGitBlobLocally(bytes, expected.objectId) !== expected.objectId) {
1597
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'working bytes must equal the exact protected tree');
1598
- }
1599
- };
1600
- for (const [path, expected] of tree) {
1601
- const staged = index.get(path);
1602
- const protectedExpected = protectedTree.get(path);
1603
- if (!staged ||
1604
- !protectedExpected ||
1605
- staged.mode !== expected.mode ||
1606
- staged.objectId !== expected.objectId ||
1607
- protectedExpected.mode !== expected.mode ||
1608
- protectedExpected.objectId !== expected.objectId) {
1609
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', path, 'index bytes must equal the exact protected tree');
1610
- }
1611
- assertCurrentWorkingBytes(path, expected);
1612
- }
1613
- for (const [path, expected] of tree) {
1614
- assertCurrentWorkingBytes(path, expected);
1615
- }
1616
- const finalHead = git(context, ['rev-parse', '--verify', 'HEAD^{commit}']);
1617
- const finalProtectedCommit = git(context, [
1618
- 'rev-parse',
1619
- '--verify',
1620
- `${input.protectedRef}^{commit}`,
1621
- ]);
1622
- const finalIndexOutput = git(context, ['ls-files', '--stage', '-z']);
1623
- const finalUntracked = git(context, [
1624
- 'ls-files',
1625
- '--others',
1626
- '--exclude-standard',
1627
- '-z',
1628
- ]);
1629
- const selectedIndexSignature = (output) => (output ?? '')
1630
- .split('\0')
1631
- .filter(Boolean)
1632
- .filter((entry) => {
1633
- const separator = entry.indexOf('\t');
1634
- const path = separator === -1 ? '' : entry.slice(separator + 1);
1635
- return !pathSelector || pathSelector(path);
1636
- })
1637
- .sort()
1638
- .join('\0');
1639
- const selectedUntrackedSignature = (output) => (output ?? '')
1640
- .split('\0')
1641
- .filter(Boolean)
1642
- .filter((path) => !pathSelector || pathSelector(path))
1643
- .sort()
1644
- .join('\0');
1645
- if (finalHead !== head ||
1646
- finalProtectedCommit !== protectedCommit ||
1647
- selectedIndexSignature(finalIndexOutput) !==
1648
- selectedIndexSignature(indexOutput) ||
1649
- selectedUntrackedSignature(finalUntracked) !==
1650
- selectedUntrackedSignature(untracked)) {
1651
- throw new errors_js_1.SupplyChainError('supply-chain-blueprint-untrusted', 'git.workingTreeAuthority', 'working-tree authority changed during exact inspection');
1652
- }
1653
- }
1654
- function assertProtectedGitWorkingTreeAuthority(input) {
1655
- assertProtectedGitTreeAuthority(input);
1656
- }
1657
- /**
1658
- * Keeps ordinary source edits available while binding every receipt execution
1659
- * authority byte, index entry, mode, and non-ignored untracked match to the
1660
- * current protected commit. Reading working bytes directly also defeats Git
1661
- * skip-worktree/assume-unchanged hints.
1662
- */
1663
- function assertProtectedGitVerificationExecutionAuthority(input, readAuthorityFile = node_fs_1.readFileSync) {
1664
- assertProtectedGitTreeAuthority(input, blueprint_verification_authority_js_1.isBlueprintVerificationExecutionAuthorityPath, true, readAuthorityFile);
1665
- }
1666
- //# sourceMappingURL=blueprint-trust-git.js.map