@empire-builder-kit/nx 1.0.0-rc.46 → 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 (780) hide show
  1. package/README.md +14 -169
  2. package/executors.json +24 -79
  3. package/generators.json +18 -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 -244
  29. package/src/aws-authority/stage-authority.js +114 -3419
  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 +5 -67
  42. package/src/executors/dev-doctor/dev-doctor.d.ts +25 -3
  43. package/src/executors/dev-doctor/dev-doctor.js +137 -50
  44. package/src/executors/dev-setup/dev-setup.d.ts +18 -1
  45. package/src/executors/dev-setup/dev-setup.js +320 -196
  46. package/src/executors/foundation-preflight/foundation-preflight.js +9 -1
  47. package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +2 -2
  48. package/src/executors/local-deploy/deployed-smoke.d.ts +12 -0
  49. package/src/executors/local-deploy/deployed-smoke.js +115 -0
  50. package/src/executors/local-deploy/deployment-authority.d.ts +24 -0
  51. package/src/executors/local-deploy/deployment-authority.js +81 -0
  52. package/src/executors/local-deploy/deployment-child.d.ts +18 -0
  53. package/src/executors/local-deploy/deployment-child.js +77 -0
  54. package/src/executors/local-deploy/deployment-contracts.d.ts +96 -0
  55. package/src/executors/local-deploy/deployment-contracts.js +3 -0
  56. package/src/executors/local-deploy/deployment-projects.d.ts +4 -0
  57. package/src/executors/local-deploy/deployment-projects.js +16 -0
  58. package/src/executors/local-deploy/deployment-receipt.d.ts +4 -0
  59. package/src/executors/local-deploy/deployment-receipt.js +55 -0
  60. package/src/executors/local-deploy/deployment-scope.d.ts +17 -0
  61. package/src/executors/local-deploy/deployment-scope.js +239 -0
  62. package/src/executors/local-deploy/deployment-source.d.ts +13 -0
  63. package/src/executors/local-deploy/deployment-source.js +86 -0
  64. package/src/executors/local-deploy/local-deploy.d.ts +5 -106
  65. package/src/executors/local-deploy/local-deploy.js +56 -855
  66. package/src/executors/sst-lifecycle/governed-child-process.d.ts +27 -0
  67. package/src/executors/sst-lifecycle/governed-child-process.js +277 -0
  68. package/src/executors/sst-lifecycle/governed-native-operation.js +4 -10
  69. package/src/executors/sst-lifecycle/run-sst-command.d.ts +4 -85
  70. package/src/executors/sst-lifecycle/run-sst-command.js +28 -788
  71. package/src/executors/sst-lifecycle/sst-contracts.d.ts +44 -0
  72. package/src/executors/sst-lifecycle/sst-contracts.js +3 -0
  73. package/src/executors/sst-lifecycle/sst-invocation.d.ts +17 -0
  74. package/src/executors/sst-lifecycle/sst-invocation.js +502 -0
  75. package/src/executors/sst-lifecycle/task-unlock.js +3 -3
  76. package/src/foundation/discovery.d.ts +1 -5
  77. package/src/foundation/discovery.js +0 -2
  78. package/src/foundation/identity-domain-parent-ready.d.ts +91 -0
  79. package/src/foundation/identity-domain-parent-ready.js +333 -0
  80. package/src/foundation/identity-domain.d.ts +94 -0
  81. package/src/foundation/identity-domain.js +115 -0
  82. package/src/foundation/index.d.ts +2 -2
  83. package/src/foundation/index.js +7 -9
  84. package/src/foundation/local-private-smoke-access.d.ts +6 -15
  85. package/src/foundation/local-private-smoke-access.js +8 -192
  86. package/src/foundation/observability.d.ts +16 -26
  87. package/src/foundation/observability.js +34 -135
  88. package/src/foundation/preflight.js +16 -14
  89. package/src/foundation/private-smoke-access.d.ts +7 -14
  90. package/src/foundation/private-smoke-access.js +4 -126
  91. package/src/foundation/root-site-workspace.d.ts +35 -0
  92. package/src/foundation/root-site-workspace.js +80 -0
  93. package/src/foundation/root-site.d.ts +82 -0
  94. package/src/foundation/root-site.js +276 -0
  95. package/src/generators/formatting.js +5 -4
  96. package/src/generators/framework-prerequisites.d.ts +2 -0
  97. package/src/generators/framework-prerequisites.js +34 -0
  98. package/src/generators/function/function.d.ts +20 -1
  99. package/src/generators/function/function.js +143 -90
  100. package/src/generators/function/schema.d.ts +1 -0
  101. package/src/generators/function/schema.json +8 -2
  102. package/src/generators/function-access/function-access.d.ts +8 -0
  103. package/src/generators/function-access/function-access.js +73 -0
  104. package/src/generators/function-access/schema.d.ts +6 -0
  105. package/src/generators/function-access/schema.json +25 -0
  106. package/src/generators/observability-policy.js +1 -2
  107. package/src/{supply-chain → generators}/pnpm-toolchain-authority.d.ts +3 -3
  108. package/src/{supply-chain → generators}/pnpm-toolchain-authority.js +12 -12
  109. package/src/generators/post-generation-install.d.ts +2 -9
  110. package/src/generators/post-generation-install.js +12 -140
  111. package/src/generators/preset/dependency-overrides.d.ts +14 -20
  112. package/src/generators/preset/dependency-overrides.js +13 -57
  113. package/src/generators/preset/generator.js +0 -3
  114. package/src/generators/preset/workspace-files-foundation-infra.d.ts +6 -0
  115. package/src/generators/preset/workspace-files-foundation-infra.js +586 -0
  116. package/src/generators/preset/workspace-files-foundation-readme.d.ts +5 -0
  117. package/src/generators/preset/workspace-files-foundation-readme.js +90 -0
  118. package/src/generators/preset/workspace-files-foundation.d.ts +3 -0
  119. package/src/generators/preset/workspace-files-foundation.js +170 -0
  120. package/src/generators/preset/workspace-files-ownership.d.ts +9 -0
  121. package/src/generators/preset/workspace-files-ownership.js +124 -0
  122. package/src/generators/preset/workspace-files-root-config.d.ts +32 -0
  123. package/src/generators/preset/workspace-files-root-config.js +356 -0
  124. package/src/generators/preset/workspace-files-root-docs.d.ts +5 -0
  125. package/src/generators/preset/workspace-files-root-docs.js +109 -0
  126. package/src/generators/preset/workspace-files-shared.d.ts +18 -0
  127. package/src/generators/preset/workspace-files-shared.js +7 -0
  128. package/src/generators/preset/workspace-files-workflows.d.ts +39 -0
  129. package/src/generators/preset/workspace-files-workflows.js +306 -0
  130. package/src/generators/preset/workspace-files-workspace-health.d.ts +6 -0
  131. package/src/generators/preset/workspace-files-workspace-health.js +148 -0
  132. package/src/generators/preset/workspace-files.d.ts +10 -24
  133. package/src/generators/preset/workspace-files.js +48 -10511
  134. package/src/generators/site/built-in-site-documentation-files.d.ts +3 -0
  135. package/src/generators/site/built-in-site-documentation-files.js +51 -0
  136. package/src/generators/site/built-in-site-files.d.ts +11 -0
  137. package/src/generators/site/built-in-site-files.js +41 -0
  138. package/src/generators/site/built-in-site-infrastructure-files.d.ts +3 -0
  139. package/src/generators/site/built-in-site-infrastructure-files.js +115 -0
  140. package/src/generators/site/built-in-site-plan.d.ts +23 -0
  141. package/src/generators/site/built-in-site-plan.js +67 -0
  142. package/src/generators/site/built-in-site-project-files.d.ts +11 -0
  143. package/src/generators/site/built-in-site-project-files.js +212 -0
  144. package/src/generators/site/built-in-site-script-files.d.ts +4 -0
  145. package/src/generators/site/built-in-site-script-files.js +102 -0
  146. package/src/generators/site/built-in-site-shared.d.ts +69 -0
  147. package/src/generators/site/built-in-site-shared.js +314 -0
  148. package/src/generators/site/built-in-site-sst-config-files.d.ts +3 -0
  149. package/src/generators/site/built-in-site-sst-config-files.js +107 -0
  150. package/src/generators/site/built-in-site-web-files.d.ts +3 -0
  151. package/src/generators/site/built-in-site-web-files.js +78 -0
  152. package/src/generators/site/schema.d.ts +9 -0
  153. package/src/generators/site/schema.json +26 -0
  154. package/src/generators/site/site.d.ts +5 -0
  155. package/src/generators/site/site.js +153 -0
  156. package/src/generators/slice/built-in-plan-api-files.d.ts +1 -2
  157. package/src/generators/slice/built-in-plan-api-files.js +30 -890
  158. package/src/generators/slice/built-in-plan-database-lifecycle-files.js +57 -1851
  159. package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +5 -2
  160. package/src/generators/slice/built-in-plan-infrastructure-files.js +80 -3358
  161. package/src/generators/slice/built-in-plan-key-value-files.d.ts +3 -2
  162. package/src/generators/slice/built-in-plan-key-value-files.js +3 -21
  163. package/src/generators/slice/built-in-plan-project-files.d.ts +5 -3
  164. package/src/generators/slice/built-in-plan-project-files.js +79 -897
  165. package/src/generators/slice/built-in-plan-shared.d.ts +4 -19
  166. package/src/generators/slice/built-in-plan-shared.js +5 -58
  167. package/src/generators/slice/built-in-plan-sst-config.d.ts +49 -0
  168. package/src/generators/slice/built-in-plan-sst-config.js +160 -0
  169. package/src/generators/slice/built-in-plan-web-files.d.ts +1 -1
  170. package/src/generators/slice/built-in-plan-web-files.js +14 -475
  171. package/src/generators/slice/built-in-plan.d.ts +2 -3
  172. package/src/generators/slice/built-in-plan.js +79 -277
  173. package/src/{developer-agent/preview-changes.d.ts → generators/slice/generation-tree.d.ts} +1 -5
  174. package/src/generators/slice/generation-tree.js +161 -0
  175. package/src/generators/slice/persistence-contract.js +2 -2
  176. package/src/generators/slice/schema.json +12 -4
  177. package/src/generators/slice/slice-config.d.ts +7 -0
  178. package/src/generators/slice/slice-config.js +125 -0
  179. package/src/generators/slice/slice.js +52 -257
  180. package/src/generators/slice/sql-bootstrap.d.ts +1 -0
  181. package/src/generators/slice/sql-bootstrap.js +505 -0
  182. package/src/generators/slice/sql-client.d.ts +1 -0
  183. package/src/generators/slice/sql-client.js +107 -0
  184. package/src/generators/slice/sql-infrastructure.d.ts +1 -0
  185. package/src/generators/slice/sql-infrastructure.js +225 -0
  186. package/src/generators/slice/sql-logging.d.ts +1 -0
  187. package/src/generators/slice/sql-logging.js +266 -0
  188. package/src/generators/slice/sql-migration.d.ts +2 -0
  189. package/src/generators/slice/sql-migration.js +202 -0
  190. package/src/generators/slice/standard-slice-contract.d.ts +25 -0
  191. package/src/generators/slice/standard-slice-contract.js +64 -0
  192. package/src/generators/sql/schema.json +1 -1
  193. package/src/generators/sql/sql.d.ts +1 -1
  194. package/src/generators/sql/sql.js +13 -7
  195. package/src/generators/upgrade/framework-package-upgrade.d.ts +35 -0
  196. package/src/generators/upgrade/framework-package-upgrade.js +55 -0
  197. package/src/generators/upgrade/framework-packages.d.ts +25 -0
  198. package/src/generators/upgrade/framework-packages.js +138 -0
  199. package/src/generators/upgrade/function-authentication-notice.d.ts +21 -0
  200. package/src/generators/upgrade/function-authentication-notice.js +54 -0
  201. package/src/generators/upgrade/schema.d.ts +0 -3
  202. package/src/generators/upgrade/schema.json +7 -17
  203. package/src/generators/upgrade/slice-compositions.d.ts +20 -0
  204. package/src/generators/upgrade/slice-compositions.js +100 -0
  205. package/src/generators/upgrade/slice-upgrade-guidance.d.ts +19 -0
  206. package/src/generators/upgrade/slice-upgrade-guidance.js +50 -0
  207. package/src/generators/upgrade/slice-upgrade.d.ts +4 -0
  208. package/src/generators/upgrade/slice-upgrade.js +231 -0
  209. package/src/generators/upgrade/upgrade-plan.d.ts +49 -0
  210. package/src/generators/upgrade/upgrade-plan.js +242 -0
  211. package/src/generators/upgrade/upgrade-preflight.d.ts +20 -0
  212. package/src/generators/upgrade/upgrade-preflight.js +64 -0
  213. package/src/generators/upgrade/upgrade.d.ts +8 -87
  214. package/src/generators/upgrade/upgrade.js +27 -1909
  215. package/src/generators/workload/schema.json +2 -2
  216. package/src/generators/workload/workload.d.ts +11 -11
  217. package/src/generators/workload/workload.js +167 -1200
  218. package/src/index.d.ts +0 -5
  219. package/src/index.js +0 -5
  220. package/src/local-dev/browser-verification.d.ts +0 -7
  221. package/src/local-dev/browser-verification.js +0 -136
  222. package/src/local-dev/contracts.d.ts +6 -0
  223. package/src/local-dev/contracts.js +17 -9
  224. package/src/local-dev/environment-checks.d.ts +126 -0
  225. package/src/local-dev/environment-checks.js +81 -0
  226. package/src/local-dev/environment-inspector.d.ts +3 -124
  227. package/src/local-dev/environment-inspector.js +9 -148
  228. package/src/local-dev/fleet-process.d.ts +9 -2
  229. package/src/local-dev/fleet-process.js +27 -7
  230. package/src/local-dev/gateway-daemon.d.ts +1 -1
  231. package/src/local-dev/gateway-daemon.js +6 -4
  232. package/src/local-dev/portless.d.ts +5 -0
  233. package/src/local-dev/portless.js +5 -0
  234. package/src/local-dev/private-state.d.ts +1 -0
  235. package/src/local-dev/private-state.js +19 -23
  236. package/src/local-dev/process-group.d.ts +10 -0
  237. package/src/local-dev/process-group.js +33 -0
  238. package/src/local-dev/process-identity.js +4 -2
  239. package/src/local-dev/slice-runner-child.d.ts +37 -0
  240. package/src/local-dev/slice-runner-child.js +127 -0
  241. package/src/local-dev/slice-runner-recovery.d.ts +32 -0
  242. package/src/local-dev/slice-runner-recovery.js +216 -0
  243. package/src/local-dev/slice-runner-state.d.ts +82 -0
  244. package/src/local-dev/slice-runner-state.js +265 -0
  245. package/src/local-dev/slice-runner.d.ts +4 -117
  246. package/src/local-dev/slice-runner.js +59 -594
  247. package/src/local-dev/tls.js +39 -99
  248. package/src/local-dev/trust-store.d.ts +42 -0
  249. package/src/local-dev/trust-store.js +87 -0
  250. package/src/ownership/composition.d.ts +7 -0
  251. package/src/ownership/composition.js +64 -56
  252. package/src/ownership/index.d.ts +2 -0
  253. package/src/ownership/index.js +7 -0
  254. package/src/ownership/pnpm-workspace.d.ts +77 -0
  255. package/src/ownership/pnpm-workspace.js +225 -0
  256. package/src/ownership/record.d.ts +19 -0
  257. package/src/ownership/record.js +26 -2
  258. package/src/ownership/site-record.d.ts +26 -0
  259. package/src/ownership/site-record.js +120 -0
  260. package/src/repository-policy/capacity-migration.d.ts +1 -1
  261. package/src/repository-policy/capacity-migration.js +1 -1
  262. package/src/repository-policy/deployment-plan.d.ts +3 -0
  263. package/src/repository-policy/deployment-plan.js +33 -4
  264. package/src/repository-policy/foundation-router.d.ts +17 -0
  265. package/src/repository-policy/foundation-router.js +44 -0
  266. package/src/repository-policy/index.d.ts +3 -0
  267. package/src/repository-policy/index.js +3 -0
  268. package/src/repository-policy/policy-accounts.d.ts +22 -0
  269. package/src/repository-policy/policy-accounts.js +134 -0
  270. package/src/repository-policy/policy-files.d.ts +8 -0
  271. package/src/repository-policy/policy-files.js +201 -0
  272. package/src/repository-policy/policy-internal.d.ts +2 -0
  273. package/src/repository-policy/policy-internal.js +11 -0
  274. package/src/repository-policy/policy-model.d.ts +95 -0
  275. package/src/repository-policy/policy-model.js +42 -0
  276. package/src/repository-policy/policy-validation.d.ts +4 -0
  277. package/src/repository-policy/policy-validation.js +308 -0
  278. package/src/repository-policy/policy.d.ts +6 -109
  279. package/src/repository-policy/policy.js +52 -626
  280. package/src/repository-policy/public-dns.d.ts +69 -0
  281. package/src/repository-policy/public-dns.js +265 -0
  282. package/src/{generators/repository-policy → repository-policy}/tree-policy.d.ts +1 -1
  283. package/src/{generators/repository-policy → repository-policy}/tree-policy.js +5 -5
  284. package/src/schemas/generated-ownership-v2.json +6 -0
  285. package/src/schemas/repository-policy-v1.json +106 -3
  286. package/src/secrets/index.d.ts +0 -5
  287. package/src/secrets/index.js +0 -5
  288. package/src/slice-infra/index.d.ts +57 -0
  289. package/src/slice-infra/index.js +117 -0
  290. package/src/slice-scripts/build.d.ts +27 -0
  291. package/src/slice-scripts/build.js +120 -0
  292. package/src/slice-scripts/database.d.ts +87 -0
  293. package/src/slice-scripts/database.js +328 -0
  294. package/src/slice-scripts/index.d.ts +11 -0
  295. package/src/slice-scripts/index.js +23 -0
  296. package/src/slice-scripts/root-site-routes.d.ts +11 -0
  297. package/src/slice-scripts/root-site-routes.js +83 -0
  298. package/src/slice-scripts/sql-migration-engine.mjs +180 -0
  299. package/src/workload-roles/effective-policy.d.ts +0 -37
  300. package/src/workload-roles/effective-policy.js +1 -174
  301. package/src/workload-roles/standard-slice.d.ts +2 -19
  302. package/src/workload-roles/standard-slice.js +3 -129
  303. package/src/workspace-deployment/ownership.d.ts +15 -0
  304. package/src/workspace-deployment/ownership.js +19 -3
  305. package/src/api-contract/baseline-update.d.ts +0 -82
  306. package/src/api-contract/baseline-update.js +0 -225
  307. package/src/api-contract/compatibility.d.ts +0 -30
  308. package/src/api-contract/compatibility.js +0 -643
  309. package/src/api-contract/contract-graph.d.ts +0 -35
  310. package/src/api-contract/contract-graph.js +0 -141
  311. package/src/api-contract/evidence.d.ts +0 -23
  312. package/src/api-contract/evidence.js +0 -87
  313. package/src/api-contract/index.d.ts +0 -6
  314. package/src/api-contract/index.js +0 -10
  315. package/src/api-contract/model.d.ts +0 -144
  316. package/src/api-contract/model.js +0 -993
  317. package/src/api-contract/rollout.d.ts +0 -32
  318. package/src/api-contract/rollout.js +0 -88
  319. package/src/authorization/compatibility.d.ts +0 -62
  320. package/src/authorization/compatibility.js +0 -175
  321. package/src/authorization/index.d.ts +0 -1
  322. package/src/authorization/index.js +0 -5
  323. package/src/blueprints/execution.d.ts +0 -55
  324. package/src/blueprints/execution.js +0 -329
  325. package/src/blueprints/external-sandbox.d.ts +0 -53
  326. package/src/blueprints/external-sandbox.js +0 -1194
  327. package/src/blueprints/index.d.ts +0 -5
  328. package/src/blueprints/index.js +0 -9
  329. package/src/blueprints/inputs.d.ts +0 -43
  330. package/src/blueprints/inputs.js +0 -103
  331. package/src/blueprints/manifest.d.ts +0 -281
  332. package/src/blueprints/manifest.js +0 -424
  333. package/src/blueprints/resolver.d.ts +0 -37
  334. package/src/blueprints/resolver.js +0 -387
  335. package/src/blueprints/transitions.d.ts +0 -20
  336. package/src/blueprints/transitions.js +0 -61
  337. package/src/cli/agent-command.d.ts +0 -30
  338. package/src/cli/agent-command.js +0 -204
  339. package/src/cli/agent-runtime.d.ts +0 -25
  340. package/src/cli/agent-runtime.js +0 -498
  341. package/src/cli/blueprint-authority.d.ts +0 -9
  342. package/src/cli/blueprint-authority.js +0 -43
  343. package/src/cli/blueprint-command.d.ts +0 -24
  344. package/src/cli/blueprint-command.js +0 -63
  345. package/src/data-lifecycle/index.d.ts +0 -3
  346. package/src/data-lifecycle/index.js +0 -7
  347. package/src/data-lifecycle/model.d.ts +0 -172
  348. package/src/data-lifecycle/model.js +0 -95
  349. package/src/data-lifecycle/sensitive-artifacts.d.ts +0 -28
  350. package/src/data-lifecycle/sensitive-artifacts.js +0 -146
  351. package/src/data-lifecycle/validation.d.ts +0 -32
  352. package/src/data-lifecycle/validation.js +0 -837
  353. package/src/database-retirement/contract.d.ts +0 -68
  354. package/src/database-retirement/contract.js +0 -166
  355. package/src/database-retirement/index.d.ts +0 -1
  356. package/src/database-retirement/index.js +0 -5
  357. package/src/developer-agent/context.d.ts +0 -57
  358. package/src/developer-agent/context.js +0 -662
  359. package/src/developer-agent/generator-planning.d.ts +0 -34
  360. package/src/developer-agent/generator-planning.js +0 -666
  361. package/src/developer-agent/generator-preview.d.ts +0 -8
  362. package/src/developer-agent/generator-preview.js +0 -650
  363. package/src/developer-agent/git-inspection.d.ts +0 -112
  364. package/src/developer-agent/git-inspection.js +0 -887
  365. package/src/developer-agent/handoff.d.ts +0 -43
  366. package/src/developer-agent/handoff.js +0 -713
  367. package/src/developer-agent/index.d.ts +0 -10
  368. package/src/developer-agent/index.js +0 -14
  369. package/src/developer-agent/model.d.ts +0 -493
  370. package/src/developer-agent/model.js +0 -143
  371. package/src/developer-agent/operation-registry.d.ts +0 -60
  372. package/src/developer-agent/operation-registry.js +0 -1550
  373. package/src/developer-agent/ordering.d.ts +0 -9
  374. package/src/developer-agent/ordering.js +0 -15
  375. package/src/developer-agent/planning.d.ts +0 -25
  376. package/src/developer-agent/planning.js +0 -478
  377. package/src/developer-agent/preview-changes.js +0 -215
  378. package/src/developer-agent/preview-source.d.ts +0 -2
  379. package/src/developer-agent/preview-source.js +0 -19
  380. package/src/developer-agent/validation.d.ts +0 -30
  381. package/src/developer-agent/validation.js +0 -2725
  382. package/src/developer-agent/workspace-inspection.d.ts +0 -20
  383. package/src/developer-agent/workspace-inspection.js +0 -1189
  384. package/src/developer-agent/workspace-path.d.ts +0 -6
  385. package/src/developer-agent/workspace-path.js +0 -22
  386. package/src/executors/blueprint-trust/blueprint-trust.d.ts +0 -29
  387. package/src/executors/blueprint-trust/blueprint-trust.js +0 -121
  388. package/src/executors/blueprint-trust/schema.json +0 -27
  389. package/src/executors/blueprint-verification/blueprint-verification.d.ts +0 -13
  390. package/src/executors/blueprint-verification/blueprint-verification.js +0 -110
  391. package/src/executors/blueprint-verification/schema.json +0 -44
  392. package/src/executors/developer-context/developer-context.d.ts +0 -38
  393. package/src/executors/developer-context/developer-context.js +0 -78
  394. package/src/executors/developer-context/schema.json +0 -87
  395. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.d.ts +0 -19
  396. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js +0 -105
  397. package/src/executors/foundation-profile-preflight/schema.json +0 -32
  398. package/src/executors/github-bootstrap/github-bootstrap.d.ts +0 -13
  399. package/src/executors/github-bootstrap/github-bootstrap.js +0 -62
  400. package/src/executors/github-bootstrap/schema.json +0 -50
  401. package/src/executors/infrastructure-plan/infrastructure-plan.d.ts +0 -37
  402. package/src/executors/infrastructure-plan/infrastructure-plan.js +0 -268
  403. package/src/executors/infrastructure-plan/schema.json +0 -38
  404. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.d.ts +0 -42
  405. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js +0 -1229
  406. package/src/executors/router-waf-rehearsal/schema.json +0 -29
  407. package/src/executors/secret-guardrails/schema.json +0 -6
  408. package/src/executors/secret-guardrails/secret-guardrails.d.ts +0 -3
  409. package/src/executors/secret-guardrails/secret-guardrails.js +0 -44
  410. package/src/executors/secret-initialize/schema.json +0 -42
  411. package/src/executors/secret-initialize/secret-initialize.d.ts +0 -34
  412. package/src/executors/secret-initialize/secret-initialize.js +0 -297
  413. package/src/executors/secret-metadata/schema.json +0 -36
  414. package/src/executors/secret-metadata/secret-metadata.d.ts +0 -46
  415. package/src/executors/secret-metadata/secret-metadata.js +0 -230
  416. package/src/executors/sst-lifecycle/generated-secret-retirement.d.ts +0 -53
  417. package/src/executors/sst-lifecycle/generated-secret-retirement.js +0 -192
  418. package/src/executors/sst-lifecycle/logging-preflight.d.ts +0 -22
  419. package/src/executors/sst-lifecycle/logging-preflight.js +0 -206
  420. package/src/executors/sst-lifecycle/secret-preflight.d.ts +0 -27
  421. package/src/executors/sst-lifecycle/secret-preflight.js +0 -125
  422. package/src/executors/work-markers/schema.json +0 -14
  423. package/src/executors/work-markers/work-markers.d.ts +0 -6
  424. package/src/executors/work-markers/work-markers.js +0 -20
  425. package/src/foundation/cost-estimate.d.ts +0 -175
  426. package/src/foundation/cost-estimate.js +0 -706
  427. package/src/foundation/private-smoke-admission.d.ts +0 -45
  428. package/src/foundation/private-smoke-admission.js +0 -180
  429. package/src/foundation/private-smoke-control-plane.d.ts +0 -18
  430. package/src/foundation/private-smoke-control-plane.js +0 -184
  431. package/src/foundation/router-waf-rate-rehearsal.d.ts +0 -97
  432. package/src/foundation/router-waf-rate-rehearsal.js +0 -210
  433. package/src/foundation/router-waf.d.ts +0 -149
  434. package/src/foundation/router-waf.js +0 -809
  435. package/src/frontend-security/index.d.ts +0 -1
  436. package/src/frontend-security/index.js +0 -5
  437. package/src/frontend-security/security-headers.d.ts +0 -50
  438. package/src/frontend-security/security-headers.js +0 -418
  439. package/src/generators/blueprint/blueprint.d.ts +0 -5
  440. package/src/generators/blueprint/blueprint.js +0 -102
  441. package/src/generators/blueprint/files.d.ts +0 -6
  442. package/src/generators/blueprint/files.js +0 -217
  443. package/src/generators/blueprint/schema.d.ts +0 -4
  444. package/src/generators/blueprint/schema.json +0 -18
  445. package/src/generators/feature-registry.d.ts +0 -13
  446. package/src/generators/feature-registry.js +0 -73
  447. package/src/generators/observability-infrastructure.d.ts +0 -2
  448. package/src/generators/observability-infrastructure.js +0 -31
  449. package/src/generators/preset/workspace-files-adopter-skills.d.ts +0 -7
  450. package/src/generators/preset/workspace-files-adopter-skills.js +0 -345
  451. package/src/generators/preset/workspace-files-agent-development.d.ts +0 -9
  452. package/src/generators/preset/workspace-files-agent-development.js +0 -42
  453. package/src/generators/preset/workspace-files-ci-acceptance.d.ts +0 -1
  454. package/src/generators/preset/workspace-files-ci-acceptance.js +0 -791
  455. package/src/generators/preset/workspace-files-ci-install.d.ts +0 -2
  456. package/src/generators/preset/workspace-files-ci-install.js +0 -196
  457. package/src/generators/preset/workspace-files-developer-agent.d.ts +0 -16
  458. package/src/generators/preset/workspace-files-developer-agent.js +0 -638
  459. package/src/generators/preset/workspace-files-ecr-inspector.d.ts +0 -18
  460. package/src/generators/preset/workspace-files-ecr-inspector.js +0 -298
  461. package/src/generators/preset/workspace-files-foundation-workload-roles.d.ts +0 -6
  462. package/src/generators/preset/workspace-files-foundation-workload-roles.js +0 -409
  463. package/src/generators/preset/workspace-files-performance-cost.d.ts +0 -66
  464. package/src/generators/preset/workspace-files-performance-cost.js +0 -866
  465. package/src/generators/preset/workspace-files-performance-load.d.ts +0 -73
  466. package/src/generators/preset/workspace-files-performance-load.js +0 -815
  467. package/src/generators/preset/workspace-files-shared-operation-claims.d.ts +0 -10
  468. package/src/generators/preset/workspace-files-shared-operation-claims.js +0 -59
  469. package/src/generators/preset/workspace-files-stage-authority.d.ts +0 -6
  470. package/src/generators/preset/workspace-files-stage-authority.js +0 -529
  471. package/src/generators/preset/workspace-files-thin-deploy.d.ts +0 -65
  472. package/src/generators/preset/workspace-files-thin-deploy.js +0 -2520
  473. package/src/generators/preset/workspace-files-thin-docs.d.ts +0 -7
  474. package/src/generators/preset/workspace-files-thin-docs.js +0 -358
  475. package/src/generators/preset/workspace-files-thin-release.d.ts +0 -14
  476. package/src/generators/preset/workspace-files-thin-release.js +0 -26
  477. package/src/generators/preset/workspace-files-workload-role-baseline.d.ts +0 -9
  478. package/src/generators/preset/workspace-files-workload-role-baseline.js +0 -1314
  479. package/src/generators/repository-policy/repository-policy.d.ts +0 -4
  480. package/src/generators/repository-policy/repository-policy.js +0 -293
  481. package/src/generators/repository-policy/schema.d.ts +0 -28
  482. package/src/generators/repository-policy/schema.json +0 -122
  483. package/src/generators/slice/built-in-plan-alarm-identity.d.ts +0 -173
  484. package/src/generators/slice/built-in-plan-alarm-identity.js +0 -202
  485. package/src/generators/slice/built-in-plan-api-contract-files.d.ts +0 -2
  486. package/src/generators/slice/built-in-plan-api-contract-files.js +0 -2830
  487. package/src/generators/slice/built-in-plan-async-work-files.d.ts +0 -2
  488. package/src/generators/slice/built-in-plan-async-work-files.js +0 -6100
  489. package/src/generators/slice/built-in-plan-authorization-files.d.ts +0 -2
  490. package/src/generators/slice/built-in-plan-authorization-files.js +0 -2082
  491. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.d.ts +0 -2
  492. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +0 -1301
  493. package/src/generators/slice/built-in-plan-authorization-storage.d.ts +0 -3
  494. package/src/generators/slice/built-in-plan-authorization-storage.js +0 -119
  495. package/src/generators/slice/built-in-plan-background-work-files.d.ts +0 -2
  496. package/src/generators/slice/built-in-plan-background-work-files.js +0 -99
  497. package/src/generators/slice/built-in-plan-data-deletion-files.d.ts +0 -2
  498. package/src/generators/slice/built-in-plan-data-deletion-files.js +0 -273
  499. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.d.ts +0 -2
  500. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js +0 -223
  501. package/src/generators/slice/built-in-plan-data-files.d.ts +0 -2
  502. package/src/generators/slice/built-in-plan-data-files.js +0 -513
  503. package/src/generators/slice/built-in-plan-data-lifecycle-files.d.ts +0 -2
  504. package/src/generators/slice/built-in-plan-data-lifecycle-files.js +0 -775
  505. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.d.ts +0 -2
  506. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js +0 -863
  507. package/src/generators/slice/built-in-plan-data-retention-job-files.d.ts +0 -2
  508. package/src/generators/slice/built-in-plan-data-retention-job-files.js +0 -169
  509. package/src/generators/slice/built-in-plan-data-retention-launcher-files.d.ts +0 -2
  510. package/src/generators/slice/built-in-plan-data-retention-launcher-files.js +0 -186
  511. package/src/generators/slice/built-in-plan-data-rights-files.d.ts +0 -2
  512. package/src/generators/slice/built-in-plan-data-rights-files.js +0 -152
  513. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.d.ts +0 -2
  514. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js +0 -508
  515. package/src/generators/slice/built-in-plan-event-contract-literal.d.ts +0 -6
  516. package/src/generators/slice/built-in-plan-event-contract-literal.js +0 -52
  517. package/src/generators/slice/built-in-plan-foundation-files.d.ts +0 -3
  518. package/src/generators/slice/built-in-plan-foundation-files.js +0 -205
  519. package/src/generators/slice/built-in-plan-frontend-files.d.ts +0 -2
  520. package/src/generators/slice/built-in-plan-frontend-files.js +0 -2244
  521. package/src/generators/slice/built-in-plan-infrastructure-safety-files.d.ts +0 -2
  522. package/src/generators/slice/built-in-plan-infrastructure-safety-files.js +0 -373
  523. package/src/generators/slice/built-in-plan-key-value-cleanup.d.ts +0 -4
  524. package/src/generators/slice/built-in-plan-key-value-cleanup.js +0 -100
  525. package/src/generators/slice/built-in-plan-key-value-consumer.d.ts +0 -4
  526. package/src/generators/slice/built-in-plan-key-value-consumer.js +0 -151
  527. package/src/generators/slice/built-in-plan-key-value-deletion.d.ts +0 -2
  528. package/src/generators/slice/built-in-plan-key-value-deletion.js +0 -377
  529. package/src/generators/slice/built-in-plan-key-value-delivery.d.ts +0 -2
  530. package/src/generators/slice/built-in-plan-key-value-delivery.js +0 -137
  531. package/src/generators/slice/built-in-plan-key-value-export.d.ts +0 -2
  532. package/src/generators/slice/built-in-plan-key-value-export.js +0 -595
  533. package/src/generators/slice/built-in-plan-key-value-holds.d.ts +0 -2
  534. package/src/generators/slice/built-in-plan-key-value-holds.js +0 -189
  535. package/src/generators/slice/built-in-plan-key-value-infrastructure.d.ts +0 -2
  536. package/src/generators/slice/built-in-plan-key-value-infrastructure.js +0 -102
  537. package/src/generators/slice/built-in-plan-key-value-performance.d.ts +0 -5
  538. package/src/generators/slice/built-in-plan-key-value-performance.js +0 -530
  539. package/src/generators/slice/built-in-plan-key-value-provider.d.ts +0 -4
  540. package/src/generators/slice/built-in-plan-key-value-provider.js +0 -366
  541. package/src/generators/slice/built-in-plan-key-value-records.d.ts +0 -3
  542. package/src/generators/slice/built-in-plan-key-value-records.js +0 -232
  543. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.d.ts +0 -2
  544. package/src/generators/slice/built-in-plan-key-value-retention-infrastructure.js +0 -103
  545. package/src/generators/slice/built-in-plan-key-value-retention-job-files.d.ts +0 -2
  546. package/src/generators/slice/built-in-plan-key-value-retention-job-files.js +0 -160
  547. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.d.ts +0 -2
  548. package/src/generators/slice/built-in-plan-key-value-retention-maintenance.js +0 -329
  549. package/src/generators/slice/built-in-plan-key-value-retention-worker.d.ts +0 -2
  550. package/src/generators/slice/built-in-plan-key-value-retention-worker.js +0 -477
  551. package/src/generators/slice/built-in-plan-key-value-retention.d.ts +0 -2
  552. package/src/generators/slice/built-in-plan-key-value-retention.js +0 -184
  553. package/src/generators/slice/built-in-plan-metadata-files.d.ts +0 -3
  554. package/src/generators/slice/built-in-plan-metadata-files.js +0 -384
  555. package/src/generators/slice/built-in-plan-native-runtime-authority-files.d.ts +0 -2
  556. package/src/generators/slice/built-in-plan-native-runtime-authority-files.js +0 -324
  557. package/src/generators/slice/built-in-plan-operations-files.d.ts +0 -2
  558. package/src/generators/slice/built-in-plan-operations-files.js +0 -1218
  559. package/src/generators/slice/built-in-plan-performance-files.d.ts +0 -4
  560. package/src/generators/slice/built-in-plan-performance-files.js +0 -2439
  561. package/src/generators/slice/built-in-plan-release-files.d.ts +0 -2
  562. package/src/generators/slice/built-in-plan-release-files.js +0 -6585
  563. package/src/generators/slice/built-in-plan-reliability-files.d.ts +0 -2
  564. package/src/generators/slice/built-in-plan-reliability-files.js +0 -4724
  565. package/src/generators/slice/built-in-plan-secret-runtime-files.d.ts +0 -2
  566. package/src/generators/slice/built-in-plan-secret-runtime-files.js +0 -1015
  567. package/src/generators/slice/built-in-plan-sql-events.d.ts +0 -2
  568. package/src/generators/slice/built-in-plan-sql-events.js +0 -276
  569. package/src/generators/slice/built-in-plan-testing-files.d.ts +0 -2
  570. package/src/generators/slice/built-in-plan-testing-files.js +0 -2575
  571. package/src/generators/slice/built-in-plan-testing-persistence-event-files.d.ts +0 -7
  572. package/src/generators/slice/built-in-plan-testing-persistence-event-files.js +0 -487
  573. package/src/generators/slice/built-in-plan-testing-persistence-files.d.ts +0 -2
  574. package/src/generators/slice/built-in-plan-testing-persistence-files.js +0 -180
  575. package/src/generators/slice/built-in-plan-thin-release-files.d.ts +0 -11
  576. package/src/generators/slice/built-in-plan-thin-release-files.js +0 -162
  577. package/src/generators/slice/built-in-plan-verification-files.d.ts +0 -2
  578. package/src/generators/slice/built-in-plan-verification-files.js +0 -431
  579. package/src/generators/slice/built-in-plan-workload-role-files.d.ts +0 -2
  580. package/src/generators/slice/built-in-plan-workload-role-files.js +0 -2220
  581. package/src/generators/slice/data-policy-review-seed.d.ts +0 -2
  582. package/src/generators/slice/data-policy-review-seed.js +0 -22
  583. package/src/generators/slice/deployed-smoke-readiness.d.ts +0 -2
  584. package/src/generators/slice/deployed-smoke-readiness.js +0 -214
  585. package/src/generators/slice/local-source-identity.d.ts +0 -2
  586. package/src/generators/slice/local-source-identity.js +0 -31
  587. package/src/generators/upgrade/sql-seeded-reconciliation.d.ts +0 -2
  588. package/src/generators/upgrade/sql-seeded-reconciliation.js +0 -170
  589. package/src/generators/workload/performance-registration.d.ts +0 -33
  590. package/src/generators/workload/performance-registration.js +0 -224
  591. package/src/generators/workload/reliability-registration.d.ts +0 -16
  592. package/src/generators/workload/reliability-registration.js +0 -150
  593. package/src/generators/workload/service-performance-files.d.ts +0 -5
  594. package/src/generators/workload/service-performance-files.js +0 -1883
  595. package/src/git-policy/action-pins.d.ts +0 -43
  596. package/src/git-policy/action-pins.js +0 -50
  597. package/src/git-policy/github-bootstrap.d.ts +0 -94
  598. package/src/git-policy/github-bootstrap.js +0 -1248
  599. package/src/git-policy/index.d.ts +0 -3
  600. package/src/git-policy/index.js +0 -7
  601. package/src/git-policy/routing.d.ts +0 -21
  602. package/src/git-policy/routing.js +0 -138
  603. package/src/infrastructure-change/convergence.d.ts +0 -13
  604. package/src/infrastructure-change/convergence.js +0 -85
  605. package/src/infrastructure-change/drift.d.ts +0 -13
  606. package/src/infrastructure-change/drift.js +0 -112
  607. package/src/infrastructure-change/index.d.ts +0 -7
  608. package/src/infrastructure-change/index.js +0 -11
  609. package/src/infrastructure-change/local-capability.d.ts +0 -73
  610. package/src/infrastructure-change/local-capability.js +0 -114
  611. package/src/infrastructure-change/model.d.ts +0 -274
  612. package/src/infrastructure-change/model.js +0 -29
  613. package/src/infrastructure-change/normalize.d.ts +0 -16
  614. package/src/infrastructure-change/normalize.js +0 -285
  615. package/src/infrastructure-change/plan.d.ts +0 -67
  616. package/src/infrastructure-change/plan.js +0 -671
  617. package/src/infrastructure-change/risk.d.ts +0 -9
  618. package/src/infrastructure-change/risk.js +0 -349
  619. package/src/infrastructure-change/summary.d.ts +0 -20
  620. package/src/infrastructure-change/summary.js +0 -130
  621. package/src/performance/cost-collection.d.ts +0 -225
  622. package/src/performance/cost-collection.js +0 -827
  623. package/src/performance/cost-controls.d.ts +0 -135
  624. package/src/performance/cost-controls.js +0 -347
  625. package/src/performance/evidence.d.ts +0 -140
  626. package/src/performance/evidence.js +0 -601
  627. package/src/performance/index.d.ts +0 -10
  628. package/src/performance/index.js +0 -14
  629. package/src/performance/load-safety.d.ts +0 -84
  630. package/src/performance/load-safety.js +0 -348
  631. package/src/performance/model.d.ts +0 -129
  632. package/src/performance/model.js +0 -451
  633. package/src/performance/pr-artifact-budget.d.ts +0 -42
  634. package/src/performance/pr-artifact-budget.js +0 -151
  635. package/src/performance/runner.d.ts +0 -75
  636. package/src/performance/runner.js +0 -227
  637. package/src/performance/scenario-endpoint.d.ts +0 -1
  638. package/src/performance/scenario-endpoint.js +0 -5
  639. package/src/performance/scenario.d.ts +0 -215
  640. package/src/performance/scenario.js +0 -744
  641. package/src/performance/unit-cost.d.ts +0 -105
  642. package/src/performance/unit-cost.js +0 -364
  643. package/src/release/index.d.ts +0 -2
  644. package/src/release/index.js +0 -6
  645. package/src/release/lifecycle.d.ts +0 -132
  646. package/src/release/lifecycle.js +0 -411
  647. package/src/release/manifest.d.ts +0 -148
  648. package/src/release/manifest.js +0 -503
  649. package/src/release/rollout.d.ts +0 -170
  650. package/src/release/rollout.js +0 -578
  651. package/src/release/source-authority.d.ts +0 -19
  652. package/src/release/source-authority.js +0 -212
  653. package/src/schemas/aggregate-count-evidence-v1.json +0 -135
  654. package/src/schemas/api-contract-baseline-v1.json +0 -674
  655. package/src/schemas/api-contract-compatibility-report-v1.json +0 -126
  656. package/src/schemas/aws-billing-actual-evidence-v1.json +0 -407
  657. package/src/schemas/blueprint-input-schema-v1.json +0 -23
  658. package/src/schemas/blueprint-v1.json +0 -188
  659. package/src/schemas/data-lifecycle-policy-v1.json +0 -517
  660. package/src/schemas/performance-policy-v1.json +0 -335
  661. package/src/schemas/testing-evidence-quarantine-v1.json +0 -168
  662. package/src/schemas/testing-evidence-result-v1.json +0 -319
  663. package/src/secrets/aws-control-plane.d.ts +0 -29
  664. package/src/secrets/aws-control-plane.js +0 -322
  665. package/src/secrets/generated-aws-control-plane.d.ts +0 -33
  666. package/src/secrets/generated-aws-control-plane.js +0 -322
  667. package/src/secrets/guardrails.d.ts +0 -26
  668. package/src/secrets/guardrails.js +0 -328
  669. package/src/secrets/metadata.d.ts +0 -48
  670. package/src/secrets/metadata.js +0 -199
  671. package/src/secrets/operator.d.ts +0 -190
  672. package/src/secrets/operator.js +0 -701
  673. package/src/secrets/verification.d.ts +0 -18
  674. package/src/secrets/verification.js +0 -152
  675. package/src/supply-chain/action-pins.d.ts +0 -26
  676. package/src/supply-chain/action-pins.js +0 -262
  677. package/src/supply-chain/blueprint-trust-git.d.ts +0 -130
  678. package/src/supply-chain/blueprint-trust-git.js +0 -1642
  679. package/src/supply-chain/blueprint-trust-process.d.ts +0 -4
  680. package/src/supply-chain/blueprint-trust-process.js +0 -88
  681. package/src/supply-chain/blueprint-trust.d.ts +0 -354
  682. package/src/supply-chain/blueprint-trust.js +0 -1558
  683. package/src/supply-chain/blueprint-verification-authority.d.ts +0 -62
  684. package/src/supply-chain/blueprint-verification-authority.js +0 -661
  685. package/src/supply-chain/blueprint-verification-execution.d.ts +0 -68
  686. package/src/supply-chain/blueprint-verification-execution.js +0 -639
  687. package/src/supply-chain/build-output-bounds.d.ts +0 -2
  688. package/src/supply-chain/build-output-bounds.js +0 -12
  689. package/src/supply-chain/build-output.d.ts +0 -41
  690. package/src/supply-chain/build-output.js +0 -551
  691. package/src/supply-chain/common.d.ts +0 -21
  692. package/src/supply-chain/common.js +0 -107
  693. package/src/supply-chain/container-artifact-contract.d.ts +0 -23
  694. package/src/supply-chain/container-artifact-contract.js +0 -208
  695. package/src/supply-chain/container-release.d.ts +0 -119
  696. package/src/supply-chain/container-release.js +0 -496
  697. package/src/supply-chain/ecr-applicability.d.ts +0 -19
  698. package/src/supply-chain/ecr-applicability.js +0 -103
  699. package/src/supply-chain/ecr-scanning.d.ts +0 -85
  700. package/src/supply-chain/ecr-scanning.js +0 -325
  701. package/src/supply-chain/ecs-deployed-image.d.ts +0 -87
  702. package/src/supply-chain/ecs-deployed-image.js +0 -302
  703. package/src/supply-chain/errors.d.ts +0 -6
  704. package/src/supply-chain/errors.js +0 -15
  705. package/src/supply-chain/generated-blueprint-trust-command.d.ts +0 -4
  706. package/src/supply-chain/generated-blueprint-trust-command.js +0 -1379
  707. package/src/supply-chain/generated-command.d.ts +0 -1
  708. package/src/supply-chain/generated-command.js +0 -775
  709. package/src/supply-chain/generated-container-release-command.d.ts +0 -16
  710. package/src/supply-chain/generated-container-release-command.js +0 -3248
  711. package/src/supply-chain/generated-ecr-collector-command.d.ts +0 -20
  712. package/src/supply-chain/generated-ecr-collector-command.js +0 -1445
  713. package/src/supply-chain/generated-files.d.ts +0 -13
  714. package/src/supply-chain/generated-files.js +0 -421
  715. package/src/supply-chain/generated-scanner-command.d.ts +0 -1
  716. package/src/supply-chain/generated-scanner-command.js +0 -778
  717. package/src/supply-chain/index.d.ts +0 -28
  718. package/src/supply-chain/index.js +0 -36
  719. package/src/supply-chain/inventory.d.ts +0 -96
  720. package/src/supply-chain/inventory.js +0 -828
  721. package/src/supply-chain/license-expression.d.ts +0 -7
  722. package/src/supply-chain/license-expression.js +0 -128
  723. package/src/supply-chain/policy.d.ts +0 -105
  724. package/src/supply-chain/policy.js +0 -304
  725. package/src/supply-chain/publication.d.ts +0 -48
  726. package/src/supply-chain/publication.js +0 -85
  727. package/src/supply-chain/sbom.d.ts +0 -228
  728. package/src/supply-chain/sbom.js +0 -913
  729. package/src/supply-chain/scanner.d.ts +0 -77
  730. package/src/supply-chain/scanner.js +0 -514
  731. package/src/supply-chain/vendored-source.d.ts +0 -95
  732. package/src/supply-chain/vendored-source.js +0 -315
  733. package/src/testing-evidence/fixture-scope.d.ts +0 -53
  734. package/src/testing-evidence/fixture-scope.js +0 -142
  735. package/src/testing-evidence/index.d.ts +0 -5
  736. package/src/testing-evidence/index.js +0 -9
  737. package/src/testing-evidence/quarantine.d.ts +0 -48
  738. package/src/testing-evidence/quarantine.js +0 -253
  739. package/src/testing-evidence/result.d.ts +0 -109
  740. package/src/testing-evidence/result.js +0 -585
  741. package/src/testing-evidence/runner-adapter.d.ts +0 -51
  742. package/src/testing-evidence/runner-adapter.js +0 -288
  743. package/src/testing-evidence/sensitive-artifacts.d.ts +0 -13
  744. package/src/testing-evidence/sensitive-artifacts.js +0 -93
  745. package/src/work-markers/index.d.ts +0 -1
  746. package/src/work-markers/index.js +0 -5
  747. package/src/work-markers/work-markers.d.ts +0 -39
  748. package/src/work-markers/work-markers.js +0 -360
  749. package/src/workload-roles/account-baseline.d.ts +0 -143
  750. package/src/workload-roles/account-baseline.js +0 -980
  751. package/src/workload-roles/authority.d.ts +0 -40
  752. package/src/workload-roles/authority.js +0 -202
  753. package/src/workload-roles/aws-adapter.d.ts +0 -99
  754. package/src/workload-roles/aws-adapter.js +0 -416
  755. package/src/workload-roles/aws-internal-handler.d.ts +0 -27
  756. package/src/workload-roles/aws-internal-handler.js +0 -58
  757. package/src/workload-roles/aws-s3-state.d.ts +0 -52
  758. package/src/workload-roles/aws-s3-state.js +0 -191
  759. package/src/workload-roles/aws-sdk-control-plane.d.ts +0 -12
  760. package/src/workload-roles/aws-sdk-control-plane.js +0 -291
  761. package/src/workload-roles/boundary.d.ts +0 -34
  762. package/src/workload-roles/boundary.js +0 -137
  763. package/src/workload-roles/convergence.d.ts +0 -66
  764. package/src/workload-roles/convergence.js +0 -186
  765. package/src/workload-roles/handler.d.ts +0 -43
  766. package/src/workload-roles/handler.js +0 -158
  767. package/src/workload-roles/history.d.ts +0 -47
  768. package/src/workload-roles/history.js +0 -324
  769. package/src/workload-roles/injection.d.ts +0 -119
  770. package/src/workload-roles/injection.js +0 -495
  771. package/src/workload-roles/manifest.d.ts +0 -54
  772. package/src/workload-roles/manifest.js +0 -343
  773. package/src/workload-roles/provisioner.d.ts +0 -70
  774. package/src/workload-roles/provisioner.js +0 -239
  775. package/src/workload-roles/registration.d.ts +0 -102
  776. package/src/workload-roles/registration.js +0 -462
  777. package/src/workload-roles/stage-boundary.d.ts +0 -31
  778. package/src/workload-roles/stage-boundary.js +0 -208
  779. /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.d.ts +0 -0
  780. /package/src/executors/{foundation-profile-preflight → local-deploy}/production-database-safeguard.js +0 -0
@@ -1,2244 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderProductFrontendFiles = renderProductFrontendFiles;
4
- const built_in_plan_shared_js_1 = require("./built-in-plan-shared.js");
5
- const index_js_1 = require("../../frontend-security/index.js");
6
- /** @internal */
7
- function renderProductFrontendFiles(name, pascalName) {
8
- const states = [
9
- 'loading',
10
- 'empty',
11
- 'success',
12
- 'validation',
13
- 'partial',
14
- 'forbidden',
15
- 'not-found',
16
- 'failure',
17
- 'stale',
18
- 'offline',
19
- ];
20
- return {
21
- 'frontend/contract.json': (0, built_in_plan_shared_js_1.json)({
22
- accessibility: {
23
- automatedScan: 'axe-rendered-state',
24
- conformanceTarget: 'WCAG-2.2-AA',
25
- manualEvidence: [
26
- 'keyboard',
27
- 'focus',
28
- 'announcements',
29
- 'zoom-and-reflow',
30
- 'reduced-motion',
31
- 'assistive-technology',
32
- ],
33
- nativeBeforeAria: true,
34
- zeroViolationsIsConformanceClaim: false,
35
- },
36
- browserSecurity: {
37
- browserStorage: 'no-sensitive-data',
38
- clientGraphResolution: 'typescript-tsconfig-local-module-closure',
39
- clientPublicConfiguration: ['NEXT_PUBLIC_API_URL'],
40
- effectiveResponseValidation: true,
41
- foundationBaselineMayNotBeWeakened: true,
42
- headerApplicationPoint: 'next-proxy-request-nonce',
43
- headerProfiles: ['local-development', 'deployed-https'],
44
- productionInlineAuthority: 'per-request-cryptographic-nonce',
45
- sliceHeaderAuthority: 'frontend/security-headers.json#csp-only',
46
- serverOnlyMarker: 'server-only',
47
- },
48
- deploymentProof: {
49
- generatedStandardProfile: 'server-rendered-opennext',
50
- privateStaticFirstProfile: 'reference-static-site',
51
- staticExportSliceGeneration: 'post-1.0',
52
- },
53
- evidence: {
54
- baselineProfile: 'browser-and-operating-system',
55
- screenshotsContainOnlyNeutralSyntheticContent: true,
56
- visualBaseline: 'frontend/visual-baselines.json',
57
- visualObservations: '.ebk/evidence/frontend/frontend-visual-observations.json',
58
- },
59
- ownership: {
60
- adopterOwned: ['brand', 'content', 'product-interaction', 'theme'],
61
- managed: [
62
- 'validators',
63
- 'neutral-proof-fixture',
64
- 'default-test-targets',
65
- ],
66
- seeded: [
67
- 'frontend-contract',
68
- 'route-state-inventory',
69
- 'security-header-policy',
70
- 'support-policy',
71
- 'visual-baseline',
72
- 'accessibility-runbook',
73
- ],
74
- },
75
- postV1Exclusions: [
76
- 'organization-design-system-generation',
77
- 'non-slice-recipe-distribution',
78
- 'static-export-slice-generation',
79
- 'operations-console-ui',
80
- 'hosted-component-marketplace',
81
- ],
82
- publicConfiguration: {
83
- allowlist: ['NEXT_PUBLIC_API_URL'],
84
- dynamicEnvironmentLookup: 'forbidden-in-client-graph',
85
- },
86
- schemaVersion: 1,
87
- semanticQueries: ['role', 'name', 'description', 'state'],
88
- slice: name,
89
- stateFixture: `/${name}/_ebk/frontend-states`,
90
- states,
91
- }),
92
- 'frontend/support-policy.json': (0, built_in_plan_shared_js_1.json)({
93
- assistiveTechnology: [
94
- {
95
- browser: 'adopter-selected',
96
- screenReader: 'adopter-selected',
97
- status: 'manual-proof-required',
98
- },
99
- ],
100
- browserFamilies: [
101
- {
102
- family: 'chromium',
103
- policy: 'current-stable',
104
- status: 'framework-default-executed',
105
- },
106
- {
107
- family: 'firefox',
108
- policy: 'current-stable',
109
- status: 'unevaluated-adopter-owned',
110
- },
111
- {
112
- family: 'webkit',
113
- policy: 'current-stable',
114
- status: 'unevaluated-adopter-owned',
115
- },
116
- ],
117
- inputModalities: ['keyboard', 'pointer', 'touch'],
118
- languageDirections: ['ltr', 'rtl-review-when-applicable'],
119
- note: 'The framework default executes Chromium only. Firefox, WebKit, and assistive-technology status remain unevaluated until adopter-owned evidence exists; upgrades do not silently change this seeded policy.',
120
- schemaVersion: 1,
121
- slice: name,
122
- viewportClasses: ['narrow', 'medium', 'wide'],
123
- }),
124
- 'frontend/routes.json': (0, built_in_plan_shared_js_1.json)({
125
- routes: [
126
- {
127
- actor: 'public',
128
- feature: 'product-entry',
129
- path: `/${name}`,
130
- readAuthorization: 'public-content-only',
131
- states: ['success', 'failure'],
132
- },
133
- {
134
- actor: 'unauthenticated-user',
135
- feature: 'sign-in',
136
- mutationAuthorization: 'server-authentication-and-session-cookie-plan',
137
- path: `/${name}/sign-in`,
138
- states: [
139
- 'initial',
140
- 'loading',
141
- 'validation',
142
- 'success',
143
- 'failure',
144
- 'offline',
145
- ],
146
- },
147
- {
148
- actor: 'unauthenticated-user',
149
- feature: 'password-reset',
150
- mutationAuthorization: 'server-normalized-non-enumerating-reset-request',
151
- path: `/${name}/password-reset`,
152
- states: [
153
- 'initial',
154
- 'loading',
155
- 'validation',
156
- 'success',
157
- 'failure',
158
- 'offline',
159
- ],
160
- },
161
- {
162
- actor: 'synthetic-proof-only',
163
- feature: 'neutral-frontend-states',
164
- path: `/${name}/_ebk/frontend-states`,
165
- readAuthorization: 'public-neutral-content-only',
166
- states,
167
- },
168
- ],
169
- schemaVersion: 1,
170
- slice: name,
171
- }),
172
- 'frontend/security-headers.json': (0, built_in_plan_shared_js_1.json)((0, index_js_1.sliceFrontendSecurityHeaderPolicy)(name)),
173
- 'frontend/visual-baselines.json': (0, built_in_plan_shared_js_1.json)({
174
- records: [],
175
- schemaVersion: 1,
176
- slice: name,
177
- }),
178
- 'docs/frontend-accessibility.md': `# ${pascalName} frontend and accessibility
179
-
180
- The Standard Slice uses a server-first Next.js App Router boundary. Routes and
181
- layouts own URL structure, metadata, composition, and coarse loading or error
182
- states. Server Components may resolve identity, authorization, configuration,
183
- secrets, and protected data. Client Components are the smallest possible
184
- interaction boundary and may receive only intentional serializable view models.
185
- Application policy, validation, and mutations remain server-authoritative.
186
-
187
- The generated Standard profile proves server-rendered OpenNext behavior. The
188
- required static-first proof belongs to the private \`reference-static-site\`
189
- application. Static-export Slice generation and an organization design-system
190
- generator are post-1.0 work; do not imitate either contract inside this Slice.
191
-
192
- ## Ownership
193
-
194
- \`web/src/app/globals.css\`, product content, page composition, brand, and theme
195
- remain seeded Slice-owned material. Framework regeneration must preserve them.
196
- The \`/_ebk/frontend-states\` route is a managed neutral proof fixture, not a
197
- product component catalog and not an import surface for product code.
198
-
199
- The seeded files in \`frontend/\` declare this Slice's route/state, support, and
200
- visual-evidence decisions. Review them when browser support or a journey
201
- changes; framework upgrades must not silently rewrite adopter commitments.
202
-
203
- ## Server and client boundaries
204
-
205
- - Mark every secret or protected-data module with \`import 'server-only'\`.
206
- - Client code may read only the literal public keys in
207
- \`frontend/contract.json\`. A \`NEXT_PUBLIC_\` prefix means public, not safe.
208
- - Never pass ORM records, credentials, authorization policy, or protected
209
- identifiers into a Client Component.
210
- - Do not put protected values in URLs, browser storage, analytics, screenshots,
211
- logs, or error copy.
212
- - Raw HTML, dynamic environment access, and a client-to-server-only import fail
213
- \`frontend-boundaries\`.
214
-
215
- ## Response-header ownership
216
-
217
- The Foundation owns HTTPS, deployed HSTS, and the minimum Permissions-Policy,
218
- Referrer-Policy, and X-Content-Type-Options values in
219
- \`packages/foundation/contracts/frontend-security-headers.json\`. This Slice
220
- owns only its enforced CSP template in \`frontend/security-headers.json\`. The
221
- generated Next 16 \`proxy.ts\` creates a cryptographically random nonce for
222
- each deployed request, composes those disjoint sources, places the materialized
223
- CSP on the request so Next can nonce its framework output, and applies the same
224
- headers to the response. Do not add the same headers to Next configuration,
225
- route handlers, OpenNext, or the Foundation Router. Case-insensitive duplicates
226
- and cross-owner declarations fail before the response is rendered.
227
-
228
- The deployed profile intentionally forces dynamic rendering: static generation,
229
- ISR, PPR, and shared CDN caching cannot safely reuse a request nonce. The
230
- standard SST/OpenNext server keeps Proxy inside the server runtime. A future
231
- external Proxy placement must preserve the request-header handoff and the exact
232
- response policy before it can replace this authority.
233
-
234
- The managed \`/_ebk/frontend-csp\` response is the one reviewed raw-HTML proof
235
- adapter. It contains neutral synthetic parser-inserted script and style pairs so
236
- the deployed browser check can prove that matching nonces execute and missing
237
- nonces are refused. Product routes must not import or imitate that adapter.
238
-
239
- The local-development profile omits HSTS over loopback HTTP and permits only the
240
- development connections needed by Next. Staging and production are locked to
241
- the deployed-https profile. Local packed proof can exercise the deployed
242
- response composition over loopback, but only a deployed HTTPS observation is
243
- hosted transport evidence. Header observation aborts after ten seconds;
244
- \`EBK_FRONTEND_HEADER_FETCH_TIMEOUT_MS\` may lower that bound for a constrained
245
- runner but cannot increase it.
246
-
247
- ## Route and state review
248
-
249
- For every product route, record the actor, read authorization, mutation
250
- authorization, view model, freshness, applicable states, and recovery behavior.
251
- The neutral fixture demonstrates loading, empty, success, validation, partial,
252
- forbidden, not-found, failure, stale, and offline states. Product fixtures
253
- should reproduce equivalent states with synthetic inputs rather than production
254
- data.
255
-
256
- Every mutation authenticates, authorizes, validates, normalizes, and applies
257
- idempotency or concurrency behavior on the server. A hidden or disabled control
258
- is never authorization. Validation errors remain associated with their fields
259
- and are summarized or announced when useful.
260
-
261
- ## Required checks
262
-
263
- Run the Slice targets for:
264
-
265
- - static accessibility lint and client/server boundary validation;
266
- - rendered-state accessibility scans;
267
- - keyboard, focus restoration, and announcement behavior;
268
- - narrow viewport reflow and reduced motion;
269
- - effective local and deployed response headers; and
270
- - stable neutral screenshots and the visual report.
271
-
272
- Automated scans identify only a subset of accessibility barriers and are not a
273
- WCAG conformance claim. Critical journeys additionally require a documented
274
- keyboard, zoom/reflow, and assistive-technology pass. Record the browser,
275
- assistive technology, versions, journey, findings, repairs, and reviewer
276
- without copying user content.
277
-
278
- An accessibility quarantine uses the shared \`testing/quarantine.json\` record
279
- and adds an \`accessibility\` object containing the affected WCAG criteria,
280
- journey, and an approver distinct from the owner. The exception must remain
281
- bounded, supplemental, and linked to remediation. It cannot waive a security
282
- header failure, leaked server module, unresolved \`EBK-SECURITY\` or
283
- \`EBK-BLOCKER\` marker, or the only proof of a protected journey.
284
-
285
- ## Visual reports
286
-
287
- Browser proof writes synthetic screenshots and observations under
288
- \`.ebk/evidence/frontend/\`. The committed
289
- \`frontend/visual-baselines.json\` contains digests and no image data. Updating
290
- it is an intentional local development action with a work reference; CI and
291
- protected stages refuse updates. Baselines are browser-and-operating-system
292
- specific so one reviewed profile cannot silently replace another. Review the
293
- retained screenshots, semantic tests, accessibility results, browser console,
294
- and network results together.
295
-
296
- ## Larger design systems and external starters
297
-
298
- V1 manages validators, test adapters, and this neutral proof fixture. It does
299
- not publish product-facing components from the framework. Product components
300
- remain Slice-owned; future reusable wrappers belong to an organization-owned
301
- design-system project only after that separate post-1.0 generator contract is
302
- implemented. Until then, keep brand and theme decisions in the Slice and do not
303
- create a second framework token authority.
304
-
305
- An external non-Slice starter needs an accepted recipe, ownership, upgrade, and
306
- verification contract. The v1 Slice Blueprint must not be stretched to
307
- distribute one implicitly. This boundary is deliberate even when an example
308
- looks reusable.
309
-
310
- ## Manual review
311
-
312
- An agent driving a real browser may perform and record the keyboard, focus,
313
- zoom/reflow, reduced-motion, and announcement checks below and attach them to
314
- the visual report. A human using actual assistive technology (screen reader,
315
- switch access, or magnifier) completes the assistive-technology pass and is
316
- recorded as the reviewer for that pass; the quarantine approver must still be
317
- distinct from the owner.
318
-
319
- Confirm, at minimum:
320
-
321
- 1. landmark and heading order, names, roles, descriptions, and state;
322
- 2. complete keyboard operation, visible focus, logical order, dialog
323
- containment, and focus restoration;
324
- 3. validation, status, loading, and recovery announcements without excessive
325
- live-region noise;
326
- 4. text and non-text contrast, non-color cues, target size, narrow reflow, 200%
327
- text sizing, browser zoom, and long-content expansion;
328
- 5. reduced-motion behavior and absence of dangerous flashing;
329
- 6. useful behavior when images, fonts, analytics, or optional enhancement fail;
330
- 7. effective HTTPS headers and enforced CSP rather than report-only alone; and
331
- 8. no credentials, personal data, protected identifiers, or raw form values in
332
- retained evidence.
333
- `,
334
- 'web/src/lib/public-configuration.ts': `export const PUBLIC_WEB_CONFIGURATION_KEYS = [
335
- 'NEXT_PUBLIC_API_URL',
336
- ] as const;
337
-
338
- export interface PublicWebConfiguration {
339
- apiUrl?: string;
340
- }
341
-
342
- function publicUrl(value: string | undefined): string | undefined {
343
- const trimmed = value?.trim();
344
- if (!trimmed) return undefined;
345
- const parsed = new URL(trimmed);
346
- const local =
347
- parsed.hostname === '127.0.0.1' ||
348
- parsed.hostname === 'localhost' ||
349
- parsed.hostname === '::1';
350
- if (
351
- (parsed.protocol !== 'https:' && !(local && parsed.protocol === 'http:')) ||
352
- parsed.username ||
353
- parsed.password ||
354
- parsed.search ||
355
- parsed.hash
356
- ) {
357
- throw new Error('NEXT_PUBLIC_API_URL must be an HTTPS URL without credentials, query, or fragment.');
358
- }
359
- return parsed.href.replace(/\\/$/, '');
360
- }
361
-
362
- export function readPublicWebConfiguration(
363
- environment: Readonly<{ NEXT_PUBLIC_API_URL?: string }> = {
364
- NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
365
- },
366
- ): PublicWebConfiguration {
367
- const apiUrl = publicUrl(environment.NEXT_PUBLIC_API_URL);
368
- return apiUrl ? { apiUrl } : {};
369
- }
370
- `,
371
- 'web/src/lib/server-configuration.ts': `import 'server-only';
372
-
373
- export type ServerWebConfigurationKey =
374
- | 'AUTH_CLIENT_ID'
375
- | 'EBK_SOURCE_COMMIT'
376
- | 'EBK_STAGE';
377
-
378
- export function requireServerWebConfiguration(
379
- key: ServerWebConfigurationKey,
380
- environment: Readonly<Record<string, string | undefined>> = process.env,
381
- ): string {
382
- const value = environment[key]?.trim();
383
- if (!value) {
384
- throw new Error(key + ' is required by the ${name} server runtime.');
385
- }
386
- return value;
387
- }
388
- `,
389
- 'web/src/app/%5Febk/frontend-states/fixture.module.css': `.fixture {
390
- background: #ffffff;
391
- color: #172033;
392
- font: 1rem/1.5 system-ui, sans-serif;
393
- margin: 0 auto;
394
- max-width: 72rem;
395
- overflow-wrap: anywhere;
396
- padding: 1.5rem;
397
- }
398
-
399
- .fixturePage {
400
- overflow-wrap: anywhere;
401
- }
402
-
403
- .fixture a {
404
- color: #0645ad;
405
- text-decoration-thickness: .12em;
406
- text-underline-offset: .16em;
407
- }
408
-
409
- .fixture :where(a, button, input):focus-visible {
410
- outline: .2rem solid #b94a00;
411
- outline-offset: .2rem;
412
- }
413
-
414
- .fixture :where(button, input) {
415
- font: inherit;
416
- min-height: 2.75rem;
417
- }
418
-
419
- .fixture button {
420
- background: #153f78;
421
- border: .125rem solid #153f78;
422
- border-radius: .25rem;
423
- color: #ffffff;
424
- cursor: pointer;
425
- padding: .55rem 1rem;
426
- }
427
-
428
- .fixture button:hover {
429
- background: #0b2d5b;
430
- }
431
-
432
- .fixture nav ul,
433
- .stateNavigation ul,
434
- .pagination {
435
- display: flex;
436
- flex-wrap: wrap;
437
- gap: .75rem;
438
- list-style: none;
439
- padding: 0;
440
- }
441
-
442
- .stateNavigation a {
443
- align-items: center;
444
- display: inline-flex;
445
- min-height: 2.75rem;
446
- padding-inline: .5rem;
447
- }
448
-
449
- .panel {
450
- border: .125rem solid #52657d;
451
- border-radius: .5rem;
452
- margin-block: 1rem;
453
- padding: 1rem;
454
- }
455
-
456
- .error {
457
- border-color: #8b1d2c;
458
- }
459
-
460
- .field {
461
- display: grid;
462
- gap: .35rem;
463
- margin-block: 1rem;
464
- max-width: 32rem;
465
- }
466
-
467
- .field input {
468
- border: .125rem solid #52657d;
469
- border-radius: .25rem;
470
- padding: .5rem;
471
- }
472
-
473
- .field input[aria-invalid='true'] {
474
- border-color: #8b1d2c;
475
- }
476
-
477
- .tableWrapper {
478
- max-width: 100%;
479
- overflow-x: auto;
480
- }
481
-
482
- .table {
483
- border-collapse: collapse;
484
- inline-size: 100%;
485
- }
486
-
487
- .table :where(th, td) {
488
- border: .0625rem solid #52657d;
489
- padding: .5rem;
490
- text-align: start;
491
- }
492
-
493
- .dialog {
494
- background: #ffffff;
495
- border: .125rem solid #172033;
496
- border-radius: .5rem;
497
- color: #172033;
498
- max-inline-size: min(32rem, calc(100% - 2rem));
499
- padding: 1.25rem;
500
- }
501
-
502
- .dialog::backdrop {
503
- background: rgb(12 20 34 / 70%);
504
- }
505
-
506
- .motionSample {
507
- transition: transform 180ms ease;
508
- }
509
-
510
- .motionSample:hover {
511
- transform: translateY(-.125rem);
512
- }
513
-
514
- @media (prefers-reduced-motion: reduce) {
515
- .fixture *,
516
- .fixture *::before,
517
- .fixture *::after {
518
- animation-duration: .01ms !important;
519
- animation-iteration-count: 1 !important;
520
- scroll-behavior: auto !important;
521
- transition-duration: .01ms !important;
522
- }
523
- }
524
-
525
- @media (max-width: 30rem) {
526
- .fixture {
527
- padding: .75rem;
528
- }
529
- }
530
- `,
531
- 'web/src/app/%5Febk/frontend-states/states.ts': `export const FRONTEND_FIXTURE_STATES = ${JSON.stringify(states)} as const;
532
- export type FrontendFixtureState = (typeof FRONTEND_FIXTURE_STATES)[number];
533
- `,
534
- 'web/src/app/%5Febk/frontend-states/fixture.tsx': `'use client';
535
-
536
- import { useRef, useState } from 'react';
537
- import styles from './fixture.module.css';
538
- import type { FrontendFixtureState } from './states';
539
-
540
- function StatePanel({ state }: Readonly<{ state: FrontendFixtureState }>) {
541
- if (state === 'loading') {
542
- return <section aria-labelledby="state-heading" className={styles.panel}>
543
- <h2 id="state-heading">Loading records</h2>
544
- <p aria-live="polite" role="status">Loading the current records.</p>
545
- </section>;
546
- }
547
- if (state === 'empty') {
548
- return <section aria-labelledby="state-heading" className={styles.panel}>
549
- <h2 id="state-heading">No records yet</h2>
550
- <p>Create the first record when the required details are available.</p>
551
- <button type="button">Create a record</button>
552
- </section>;
553
- }
554
- if (state === 'validation') {
555
- return <section aria-labelledby="state-heading" className={styles.panel}>
556
- <h2 id="state-heading">Review the form</h2>
557
- <div className={styles.error} role="alert">
558
- <p>There is one problem. Correct it and submit again.</p>
559
- <a href="#fixture-name">Enter a record name</a>
560
- </div>
561
- <div className={styles.field}>
562
- <label htmlFor="fixture-name">Record name</label>
563
- <input
564
- aria-describedby="fixture-name-error"
565
- aria-invalid="true"
566
- id="fixture-name"
567
- name="name"
568
- required
569
- />
570
- <p id="fixture-name-error">Enter a record name.</p>
571
- </div>
572
- <button type="button">Save record</button>
573
- </section>;
574
- }
575
- if (state === 'partial') {
576
- return <section aria-labelledby="state-heading" className={styles.panel}>
577
- <h2 id="state-heading">Records partially available</h2>
578
- <p role="status">Recent records are available. Archived records could not be loaded.</p>
579
- <button type="button">Retry archived records</button>
580
- </section>;
581
- }
582
- if (state === 'forbidden') {
583
- return <section aria-labelledby="state-heading" className={styles.panel}>
584
- <h2 id="state-heading">Access not permitted</h2>
585
- <p>Your signed-in account cannot view these records.</p>
586
- <a href="/${name}">Return to ${pascalName}</a>
587
- </section>;
588
- }
589
- if (state === 'not-found') {
590
- return <section aria-labelledby="state-heading" className={styles.panel}>
591
- <h2 id="state-heading">Record not found</h2>
592
- <p>It may have been removed or the link may be incorrect.</p>
593
- <a href="/${name}">Return to ${pascalName}</a>
594
- </section>;
595
- }
596
- if (state === 'failure') {
597
- return <section aria-labelledby="state-heading" className={styles.panel}>
598
- <h2 id="state-heading">Records unavailable</h2>
599
- <p role="alert">The request failed. Support reference: ui-safe-0001.</p>
600
- <button type="button">Try again</button>
601
- </section>;
602
- }
603
- if (state === 'stale') {
604
- return <section aria-labelledby="state-heading" className={styles.panel}>
605
- <h2 id="state-heading">Newer changes are available</h2>
606
- <p role="status">This view is out of date. Review changes before saving.</p>
607
- <button type="button">Review newer changes</button>
608
- </section>;
609
- }
610
- if (state === 'offline') {
611
- return <section aria-labelledby="state-heading" className={styles.panel}>
612
- <h2 id="state-heading">Connection interrupted</h2>
613
- <p role="status">Your change was not sent. Reconnect and try again.</p>
614
- <button type="button">Retry connection</button>
615
- </section>;
616
- }
617
- return <section aria-labelledby="state-heading" className={styles.panel}>
618
- <h2 id="state-heading">Record saved</h2>
619
- <p role="status">The synthetic record was saved.</p>
620
- </section>;
621
- }
622
-
623
- export function NeutralFrontendStateFixture({
624
- state,
625
- }: Readonly<{ state: FrontendFixtureState }>) {
626
- const dialog = useRef<HTMLDialogElement>(null);
627
- const dialogClose = useRef<HTMLButtonElement>(null);
628
- const dialogTrigger = useRef<HTMLButtonElement>(null);
629
- const [dialogOpen, setDialogOpen] = useState(false);
630
-
631
- function openDialog() {
632
- setDialogOpen(true);
633
- dialog.current?.showModal();
634
- queueMicrotask(() => dialogClose.current?.focus());
635
- }
636
-
637
- function restoreDialogFocus() {
638
- setDialogOpen(false);
639
- dialogTrigger.current?.focus();
640
- }
641
-
642
- return <div className={styles.fixture}>
643
- <StatePanel state={state} />
644
-
645
- <section aria-labelledby="actions-heading" className={styles.panel}>
646
- <h2 id="actions-heading">Semantic actions</h2>
647
- <p>Use a link to navigate and a button to change the current interface.</p>
648
- <a href="/${name}">Return to ${pascalName}</a>
649
- {' '}
650
- <button
651
- aria-expanded={dialogOpen}
652
- aria-haspopup="dialog"
653
- className={styles.motionSample}
654
- onClick={openDialog}
655
- ref={dialogTrigger}
656
- type="button"
657
- >
658
- Open details dialog
659
- </button>
660
- </section>
661
-
662
- <section aria-labelledby="table-heading" className={styles.panel}>
663
- <h2 id="table-heading">Synthetic records</h2>
664
- <div className={styles.tableWrapper}>
665
- <table className={styles.table}>
666
- <caption>Neutral fixture record status</caption>
667
- <thead><tr><th scope="col">Record</th><th scope="col">Status</th></tr></thead>
668
- <tbody><tr><th scope="row">Example A</th><td>Ready</td></tr></tbody>
669
- </table>
670
- </div>
671
- <nav aria-label="Record pages">
672
- <ul className={styles.pagination}>
673
- <li><a aria-current="page" href="?state=success">Page 1</a></li>
674
- <li><a href="?state=empty">Page 2</a></li>
675
- </ul>
676
- </nav>
677
- </section>
678
-
679
- <dialog
680
- aria-labelledby="details-dialog-title"
681
- className={styles.dialog}
682
- onCancel={restoreDialogFocus}
683
- onClose={restoreDialogFocus}
684
- ref={dialog}
685
- >
686
- <h2 id="details-dialog-title">Synthetic record details</h2>
687
- <p>This dialog contains neutral proof content only.</p>
688
- <button onClick={() => dialog.current?.close()} ref={dialogClose} type="button">
689
- Close details
690
- </button>
691
- </dialog>
692
- </div>;
693
- }
694
- `,
695
- 'web/src/app/%5Febk/frontend-states/page.tsx': `import type { Metadata } from 'next';
696
- import { NeutralFrontendStateFixture } from './fixture';
697
- import styles from './fixture.module.css';
698
- import {
699
- FRONTEND_FIXTURE_STATES,
700
- type FrontendFixtureState,
701
- } from './states';
702
-
703
- export const metadata: Metadata = {
704
- robots: { follow: false, index: false },
705
- title: '${pascalName} neutral frontend states',
706
- };
707
-
708
- function fixtureState(value: string | undefined): FrontendFixtureState {
709
- return FRONTEND_FIXTURE_STATES.find((state) => state === value) ?? 'success';
710
- }
711
-
712
- export default async function FrontendStates({
713
- searchParams,
714
- }: Readonly<{ searchParams: Promise<{ state?: string }> }>) {
715
- const state = fixtureState((await searchParams).state);
716
- return <main className={styles.fixturePage}>
717
- <h1>${pascalName} neutral frontend states</h1>
718
- <p>
719
- This managed route contains synthetic accessibility evidence, not product
720
- content or a shared design system.
721
- </p>
722
- <nav aria-label="Frontend fixture states" className={styles.stateNavigation}>
723
- <ul>
724
- {FRONTEND_FIXTURE_STATES.map((candidate) => <li key={candidate}>
725
- <a
726
- aria-current={candidate === state ? 'page' : undefined}
727
- href={'/${name}/_ebk/frontend-states?state=' + candidate}
728
- >
729
- {candidate}
730
- </a>
731
- </li>)}
732
- </ul>
733
- </nav>
734
- <NeutralFrontendStateFixture state={state} />
735
- </main>;
736
- }
737
- `,
738
- 'web/src/app/%5Febk/frontend-states/page.spec.tsx': `import { renderToStaticMarkup } from 'react-dom/server';
739
- import { describe, expect, it } from 'vitest';
740
- import { NeutralFrontendStateFixture } from './fixture';
741
- import { FRONTEND_FIXTURE_STATES } from './states';
742
-
743
- describe('neutral frontend state fixture', () => {
744
- it.each(FRONTEND_FIXTURE_STATES)('renders the %s state with one named region', (state) => {
745
- const html = renderToStaticMarkup(<NeutralFrontendStateFixture state={state} />);
746
- expect(html).toContain('id="state-heading"');
747
- expect(html).not.toContain('dangerouslySetInnerHTML');
748
- expect(html).not.toContain('placeholder');
749
- });
750
-
751
- it('keeps the dialog, table, pagination, field, and status semantics inspectable', () => {
752
- const html = renderToStaticMarkup(<NeutralFrontendStateFixture state="validation" />);
753
- expect(html).toContain('<dialog');
754
- expect(html).toContain('aria-labelledby="details-dialog-title"');
755
- expect(html).toContain('<caption>');
756
- expect(html).toContain('aria-label="Record pages"');
757
- expect(html).toContain('aria-invalid="true"');
758
- expect(html).toContain('role="alert"');
759
- });
760
- });
761
- `,
762
- 'web/src/app/%5Febk/frontend-csp/route.ts': `import 'server-only';
763
- import { headers } from 'next/headers';
764
-
765
- const noncePattern = /^[A-Za-z0-9+/_-]{16,128}={0,2}$/;
766
-
767
- export async function GET(): Promise<Response> {
768
- const nonce = (await headers()).get('x-nonce') ?? '';
769
- if (!noncePattern.test(nonce)) {
770
- return new Response('Strict CSP proof requires the request nonce.', {
771
- status: 500,
772
- });
773
- }
774
- return new Response(
775
- '<!doctype html><html><head>' +
776
- '<style nonce="' + nonce + '">#approved-style{color:rgb(1,2,3)}</style>' +
777
- '<style>#unapproved-style{color:rgb(4,5,6)}</style>' +
778
- '</head><body>' +
779
- '<h1>${pascalName} strict CSP proof</h1>' +
780
- '<p id="approved-style">Approved style</p>' +
781
- '<p id="unapproved-style">Unapproved style</p>' +
782
- '<script nonce="' + nonce + '">' +
783
- "document.documentElement.dataset.ebkApprovedInline='executed'" +
784
- '</script>' +
785
- '<script>' +
786
- "document.documentElement.dataset.ebkUnapprovedInline='executed'" +
787
- '</script>' +
788
- '</body></html>',
789
- { headers: { 'Content-Type': 'text/html; charset=utf-8' } },
790
- );
791
- }
792
- `,
793
- 'scripts/frontend-boundaries.mjs': `import {
794
- lstatSync,
795
- mkdirSync,
796
- opendirSync,
797
- readFileSync,
798
- writeFileSync,
799
- } from 'node:fs';
800
- import { dirname, extname, join, relative, resolve, sep } from 'node:path';
801
- import { fileURLToPath } from 'node:url';
802
- import ts from 'typescript';
803
-
804
- const projectRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
805
- const sourceRoot = join(projectRoot, 'web', 'src');
806
- const contractPath = join(projectRoot, 'frontend', 'contract.json');
807
- const tsconfigPath = join(projectRoot, 'web', 'tsconfig.json');
808
- const SOURCE_EXTENSIONS = new Set(['.cjs', '.js', '.jsx', '.mjs', '.ts', '.tsx']);
809
- const CLIENT_ASSET_EXTENSIONS = new Set(['.css']);
810
- const MAX_SOURCE_DIRECTORIES = 512;
811
- const MAX_SOURCE_FILES = 1_024;
812
- const MAX_SOURCE_FILE_BYTES = 1024 * 1024;
813
- const MAX_SOURCE_BYTES = 16 * 1024 * 1024;
814
- const MAX_TRAVERSAL_ENTRIES = 20_000;
815
-
816
- function portable(path) {
817
- return relative(projectRoot, path).split(sep).join('/');
818
- }
819
-
820
- function lineOf(sourceFile, node) {
821
- return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1;
822
- }
823
-
824
- function sourcePaths(root) {
825
- const paths = [];
826
- const findings = [];
827
- const pending = [root];
828
- let directories = 0;
829
- let entries = 0;
830
- let totalBytes = 0;
831
- let traversalAborted = false;
832
- while (pending.length > 0 && !traversalAborted) {
833
- const directory = pending.pop();
834
- directories += 1;
835
- if (directories > MAX_SOURCE_DIRECTORIES) {
836
- findings.push({
837
- classification: 'source-directory-limit-exceeded',
838
- limit: MAX_SOURCE_DIRECTORIES,
839
- path: portable(directory),
840
- });
841
- traversalAborted = true;
842
- break;
843
- }
844
- const handle = opendirSync(directory);
845
- try {
846
- let entry;
847
- while ((entry = handle.readSync()) !== null) {
848
- entries += 1;
849
- if (entries > MAX_TRAVERSAL_ENTRIES) {
850
- findings.push({
851
- classification: 'source-entry-limit-exceeded',
852
- limit: MAX_TRAVERSAL_ENTRIES,
853
- path: portable(directory),
854
- });
855
- traversalAborted = true;
856
- break;
857
- }
858
- const path = join(directory, entry.name);
859
- if (entry.isSymbolicLink()) {
860
- findings.push({
861
- classification: 'source-symlink-forbidden',
862
- path: portable(path),
863
- });
864
- } else if (entry.isDirectory()) {
865
- pending.push(path);
866
- } else if (entry.isFile() && SOURCE_EXTENSIONS.has(extname(entry.name))) {
867
- const size = lstatSync(path).size;
868
- if (size > MAX_SOURCE_FILE_BYTES) {
869
- findings.push({
870
- bytes: size,
871
- classification: 'source-file-byte-limit-exceeded',
872
- limit: MAX_SOURCE_FILE_BYTES,
873
- path: portable(path),
874
- });
875
- continue;
876
- }
877
- if (paths.length >= MAX_SOURCE_FILES) {
878
- findings.push({
879
- classification: 'source-file-limit-exceeded',
880
- limit: MAX_SOURCE_FILES,
881
- path: portable(path),
882
- });
883
- traversalAborted = true;
884
- break;
885
- }
886
- if (totalBytes + size > MAX_SOURCE_BYTES) {
887
- findings.push({
888
- classification: 'source-total-byte-limit-exceeded',
889
- limit: MAX_SOURCE_BYTES,
890
- path: portable(path),
891
- });
892
- traversalAborted = true;
893
- break;
894
- }
895
- totalBytes += size;
896
- paths.push(path);
897
- } else if (
898
- !entry.isFile() &&
899
- !entry.isDirectory() &&
900
- !entry.isSymbolicLink()
901
- ) {
902
- findings.push({
903
- classification: 'source-special-file-forbidden',
904
- path: portable(path),
905
- });
906
- }
907
- }
908
- } finally {
909
- handle.closeSync();
910
- }
911
- }
912
- return {
913
- findings,
914
- paths: traversalAborted ? [] : paths,
915
- };
916
- }
917
-
918
- function outsideSourceRoot(target) {
919
- const fromSourceRoot = relative(sourceRoot, target);
920
- return (
921
- fromSourceRoot === '..' ||
922
- fromSourceRoot.startsWith('..' + sep) ||
923
- resolve(sourceRoot, fromSourceRoot) !== target
924
- );
925
- }
926
-
927
- function relativeImport(importer, specifier, existing, compilerOptions) {
928
- const requestedTarget = resolve(dirname(importer), specifier);
929
- if (outsideSourceRoot(requestedTarget)) {
930
- return {
931
- failure: 'outside-source-root',
932
- kind: 'relative',
933
- specifier,
934
- target: requestedTarget,
935
- };
936
- }
937
- const resolvedModule = ts.resolveModuleName(
938
- specifier,
939
- importer,
940
- compilerOptions,
941
- ts.sys,
942
- ).resolvedModule;
943
- if (!resolvedModule) {
944
- if (
945
- ts.sys.fileExists(requestedTarget) &&
946
- CLIENT_ASSET_EXTENSIONS.has(extname(requestedTarget))
947
- ) {
948
- return { kind: 'asset', specifier, target: requestedTarget };
949
- }
950
- return {
951
- failure: ts.sys.fileExists(requestedTarget)
952
- ? 'unsupported-target'
953
- : 'unresolved',
954
- kind: 'relative',
955
- specifier,
956
- target: ts.sys.fileExists(requestedTarget) ? requestedTarget : undefined,
957
- };
958
- }
959
- const target = resolve(resolvedModule.resolvedFileName);
960
- if (outsideSourceRoot(target)) {
961
- return {
962
- failure: 'outside-source-root',
963
- kind: 'relative',
964
- specifier,
965
- target,
966
- };
967
- }
968
- if (!existing.has(target)) {
969
- if (CLIENT_ASSET_EXTENSIONS.has(extname(target))) {
970
- return { kind: 'asset', specifier, target };
971
- }
972
- return {
973
- failure: 'unsupported-target',
974
- kind: 'relative',
975
- specifier,
976
- target,
977
- };
978
- }
979
- return { kind: 'relative', specifier, target };
980
- }
981
-
982
- function compilerConfiguration() {
983
- const loaded = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
984
- if (loaded.error) {
985
- throw new Error(
986
- 'web/tsconfig.json is invalid: ' +
987
- ts.flattenDiagnosticMessageText(loaded.error.messageText, ' '),
988
- );
989
- }
990
- const parsed = ts.parseJsonConfigFileContent(
991
- loaded.config,
992
- ts.sys,
993
- dirname(tsconfigPath),
994
- undefined,
995
- tsconfigPath,
996
- );
997
- if (parsed.errors.length > 0) {
998
- throw new Error(
999
- 'web/tsconfig.json is invalid: ' +
1000
- parsed.errors
1001
- .map((diagnostic) =>
1002
- ts.flattenDiagnosticMessageText(diagnostic.messageText, ' '),
1003
- )
1004
- .join(' '),
1005
- );
1006
- }
1007
- return {
1008
- aliasPatterns: Object.keys(parsed.options.paths ?? {}).sort(),
1009
- options: parsed.options,
1010
- };
1011
- }
1012
-
1013
- function aliasMatches(pattern, specifier) {
1014
- const wildcard = pattern.indexOf('*');
1015
- if (wildcard === -1) return pattern === specifier;
1016
- if (pattern.indexOf('*', wildcard + 1) !== -1) return false;
1017
- const prefix = pattern.slice(0, wildcard);
1018
- const suffix = pattern.slice(wildcard + 1);
1019
- return (
1020
- specifier.length >= prefix.length + suffix.length &&
1021
- specifier.startsWith(prefix) &&
1022
- specifier.endsWith(suffix)
1023
- );
1024
- }
1025
-
1026
- function moduleImport(
1027
- importer,
1028
- specifier,
1029
- existing,
1030
- compilerOptions,
1031
- aliasPatterns,
1032
- ) {
1033
- if (specifier.startsWith('.')) {
1034
- return relativeImport(importer, specifier, existing, compilerOptions);
1035
- }
1036
- const alias = aliasPatterns.find((pattern) =>
1037
- aliasMatches(pattern, specifier),
1038
- );
1039
- const resolvedModule = ts.resolveModuleName(
1040
- specifier,
1041
- importer,
1042
- compilerOptions,
1043
- ts.sys,
1044
- ).resolvedModule;
1045
- if (!resolvedModule) {
1046
- return alias
1047
- ? { alias, failure: 'unresolved', kind: 'alias', specifier }
1048
- : undefined;
1049
- }
1050
- if (!alias && resolvedModule.isExternalLibraryImport) return undefined;
1051
- const kind = alias ? 'alias' : 'base-url';
1052
- const target = resolve(resolvedModule.resolvedFileName);
1053
- if (outsideSourceRoot(target)) {
1054
- return {
1055
- alias,
1056
- failure: 'outside-source-root',
1057
- kind,
1058
- specifier,
1059
- target,
1060
- };
1061
- }
1062
- if (!existing.has(target)) {
1063
- return {
1064
- alias,
1065
- failure: 'unsupported-target',
1066
- kind,
1067
- specifier,
1068
- target,
1069
- };
1070
- }
1071
- return { alias, kind, specifier, target };
1072
- }
1073
-
1074
- function scriptKind(path) {
1075
- switch (extname(path)) {
1076
- case '.js':
1077
- case '.mjs':
1078
- case '.cjs':
1079
- return ts.ScriptKind.JS;
1080
- case '.jsx':
1081
- return ts.ScriptKind.JSX;
1082
- case '.tsx':
1083
- return ts.ScriptKind.TSX;
1084
- default:
1085
- return ts.ScriptKind.TS;
1086
- }
1087
- }
1088
-
1089
- function calledModule(node) {
1090
- if (
1091
- ts.isImportDeclaration(node) ||
1092
- ts.isExportDeclaration(node)
1093
- ) {
1094
- return node.moduleSpecifier && ts.isStringLiteralLike(node.moduleSpecifier)
1095
- ? { kind: 'static', specifier: node.moduleSpecifier.text }
1096
- : undefined;
1097
- }
1098
- if (!ts.isCallExpression(node)) return undefined;
1099
- const kind =
1100
- node.expression.kind === ts.SyntaxKind.ImportKeyword
1101
- ? 'dynamic-import'
1102
- : ts.isIdentifier(node.expression) && node.expression.text === 'require'
1103
- ? 'require'
1104
- : undefined;
1105
- if (!kind) return undefined;
1106
- const argument = node.arguments[0];
1107
- return node.arguments.length === 1 && argument && ts.isStringLiteralLike(argument)
1108
- ? { kind, specifier: argument.text }
1109
- : { kind, specifier: null };
1110
- }
1111
-
1112
- function environmentRead(node) {
1113
- if (
1114
- ts.isPropertyAccessExpression(node) &&
1115
- isProcessEnvironmentObject(node.expression)
1116
- ) {
1117
- return node.name.text;
1118
- }
1119
- if (
1120
- ts.isElementAccessExpression(node) &&
1121
- isProcessEnvironmentObject(node.expression)
1122
- ) {
1123
- return ts.isStringLiteralLike(node.argumentExpression)
1124
- ? node.argumentExpression.text
1125
- : null;
1126
- }
1127
- return undefined;
1128
- }
1129
-
1130
- function isProcessEnvironmentObject(node) {
1131
- return (
1132
- (ts.isPropertyAccessExpression(node) &&
1133
- ts.isIdentifier(node.expression) &&
1134
- node.expression.text === 'process' &&
1135
- node.name.text === 'env') ||
1136
- (ts.isElementAccessExpression(node) &&
1137
- ts.isIdentifier(node.expression) &&
1138
- node.expression.text === 'process' &&
1139
- ts.isStringLiteralLike(node.argumentExpression) &&
1140
- node.argumentExpression.text === 'env')
1141
- );
1142
- }
1143
-
1144
- function serverPackage(specifier) {
1145
- return (
1146
- specifier === 'next/headers' ||
1147
- specifier === 'next/server' ||
1148
- specifier === 'server-only' ||
1149
- specifier.startsWith('@aws-sdk/') ||
1150
- specifier === '@empire-builder-kit/runtime/auth-backend' ||
1151
- specifier === '@empire-builder-kit/runtime/database' ||
1152
- specifier === '@empire-builder-kit/runtime/secrets'
1153
- );
1154
- }
1155
-
1156
- export function inspectFrontendBoundaries() {
1157
- const contract = JSON.parse(readFileSync(contractPath, 'utf8'));
1158
- if (
1159
- contract?.schemaVersion !== 1 ||
1160
- contract?.slice !== '${name}' ||
1161
- !Array.isArray(contract?.publicConfiguration?.allowlist)
1162
- ) {
1163
- throw new Error('frontend/contract.json is missing the managed public configuration contract.');
1164
- }
1165
- const allowedPublic = new Set(contract.publicConfiguration.allowlist);
1166
- const discovered = sourcePaths(sourceRoot);
1167
- const findings = [...discovered.findings];
1168
- const paths = discovered.paths;
1169
- const existing = new Set(paths);
1170
- const modules = new Map();
1171
- const { aliasPatterns, options: compilerOptions } = compilerConfiguration();
1172
-
1173
- for (const path of paths) {
1174
- const source = readFileSync(path, 'utf8');
1175
- const sourceFile = ts.createSourceFile(
1176
- path,
1177
- source,
1178
- ts.ScriptTarget.Latest,
1179
- true,
1180
- scriptKind(path),
1181
- );
1182
- const imports = [];
1183
- const dynamicModuleSpecifiers = [];
1184
- const serverPackages = [];
1185
- let serverOnly = false;
1186
- const inspectModules = (node) => {
1187
- const called = calledModule(node);
1188
- if (called) {
1189
- const moduleSpecifier = called.specifier;
1190
- if (moduleSpecifier === null) {
1191
- dynamicModuleSpecifiers.push({
1192
- kind: called.kind,
1193
- line: lineOf(sourceFile, node),
1194
- });
1195
- } else {
1196
- if (moduleSpecifier === 'server-only') serverOnly = true;
1197
- if (serverPackage(moduleSpecifier)) serverPackages.push(moduleSpecifier);
1198
- const target = moduleImport(
1199
- path,
1200
- moduleSpecifier,
1201
- existing,
1202
- compilerOptions,
1203
- aliasPatterns,
1204
- );
1205
- if (target) imports.push(target);
1206
- }
1207
- }
1208
- ts.forEachChild(node, inspectModules);
1209
- };
1210
- inspectModules(sourceFile);
1211
- let client = false;
1212
- for (const statement of sourceFile.statements) {
1213
- if (
1214
- !ts.isExpressionStatement(statement) ||
1215
- !ts.isStringLiteral(statement.expression)
1216
- ) {
1217
- break;
1218
- }
1219
- if (statement.expression.text === 'use client') client = true;
1220
- }
1221
- modules.set(path, {
1222
- client,
1223
- dynamicModuleSpecifiers,
1224
- imports: imports.filter(
1225
- (candidate, index) =>
1226
- imports.findIndex(
1227
- (entry) => JSON.stringify(entry) === JSON.stringify(candidate),
1228
- ) === index,
1229
- ),
1230
- serverOnly,
1231
- serverPackages: [...new Set(serverPackages)],
1232
- sourceFile,
1233
- });
1234
- }
1235
-
1236
- const clientReachable = new Map();
1237
- for (const [path, module] of modules) {
1238
- if (!module.client) continue;
1239
- const pending = [
1240
- {
1241
- ancestry: [],
1242
- edgeKinds: [],
1243
- path,
1244
- root: path,
1245
- },
1246
- ];
1247
- const visited = new Set();
1248
- while (pending.length > 0) {
1249
- const current = pending.pop();
1250
- if (!current) continue;
1251
- if (current.ancestry.includes(current.path)) {
1252
- const cycleStart = current.ancestry.indexOf(current.path);
1253
- const cycleEdgeKinds = [
1254
- ...new Set(current.edgeKinds.slice(cycleStart)),
1255
- ].sort();
1256
- const cyclePaths = current.ancestry
1257
- .slice(cycleStart)
1258
- .map((cyclePath) => portable(cyclePath))
1259
- .sort();
1260
- const reachedThroughAlias = cycleEdgeKinds.includes('alias');
1261
- const reachedThroughBaseUrl = cycleEdgeKinds.includes('base-url');
1262
- if (
1263
- cycleEdgeKinds.length > 1 &&
1264
- (reachedThroughAlias || reachedThroughBaseUrl)
1265
- ) {
1266
- findings.push({
1267
- classification: 'client-mixed-local-module-cycle',
1268
- client: portable(current.root),
1269
- cycleEdgeKinds,
1270
- path: cyclePaths[0],
1271
- });
1272
- } else if (reachedThroughBaseUrl) {
1273
- findings.push({
1274
- classification: 'client-base-url-cycle',
1275
- client: portable(current.root),
1276
- cycleEdgeKinds,
1277
- path: cyclePaths[0],
1278
- });
1279
- } else if (reachedThroughAlias) {
1280
- findings.push({
1281
- classification: 'client-path-alias-cycle',
1282
- client: portable(current.root),
1283
- cycleEdgeKinds,
1284
- path: cyclePaths[0],
1285
- });
1286
- }
1287
- continue;
1288
- }
1289
- if (visited.has(current.path)) continue;
1290
- visited.add(current.path);
1291
- const currentModule = modules.get(current.path);
1292
- if (!currentModule) continue;
1293
- if (!clientReachable.has(current.path)) {
1294
- clientReachable.set(current.path, new Set());
1295
- }
1296
- clientReachable.get(current.path).add(current.root);
1297
- if (currentModule.serverOnly) {
1298
- findings.push({
1299
- classification: 'client-imports-server-only',
1300
- client: portable(current.root),
1301
- path: portable(current.path),
1302
- });
1303
- }
1304
- for (const dynamic of currentModule.dynamicModuleSpecifiers) {
1305
- findings.push({
1306
- classification: 'client-dynamic-module-specifier',
1307
- client: portable(current.root),
1308
- kind: dynamic.kind,
1309
- line: dynamic.line,
1310
- path: portable(current.path),
1311
- });
1312
- }
1313
- for (const packageName of currentModule.serverPackages) {
1314
- findings.push({
1315
- classification: 'client-imports-server-package',
1316
- client: portable(current.root),
1317
- package: packageName,
1318
- path: portable(current.path),
1319
- });
1320
- }
1321
- const orderedImports = [...currentModule.imports].sort((left, right) =>
1322
- JSON.stringify(right) < JSON.stringify(left)
1323
- ? -1
1324
- : JSON.stringify(right) > JSON.stringify(left)
1325
- ? 1
1326
- : 0,
1327
- );
1328
- for (const imported of orderedImports) {
1329
- if (imported.failure) {
1330
- const importKind =
1331
- imported.kind === 'relative'
1332
- ? 'relative-import'
1333
- : imported.kind === 'alias'
1334
- ? 'path-alias'
1335
- : 'base-url';
1336
- findings.push({
1337
- alias: imported.alias,
1338
- classification:
1339
- imported.failure === 'outside-source-root'
1340
- ? 'client-' + importKind + '-outside-source-root'
1341
- : imported.failure === 'unsupported-target'
1342
- ? 'client-' + importKind + '-target-unsupported'
1343
- : 'client-' + importKind + '-unresolved',
1344
- client: portable(current.root),
1345
- path: portable(current.path),
1346
- specifier: imported.specifier,
1347
- target: imported.target ? portable(imported.target) : undefined,
1348
- });
1349
- continue;
1350
- }
1351
- pending.push({
1352
- ancestry: [...current.ancestry, current.path],
1353
- edgeKinds: [...current.edgeKinds, imported.kind],
1354
- path: imported.target,
1355
- root: current.root,
1356
- });
1357
- }
1358
- }
1359
- }
1360
-
1361
- for (const [path, module] of modules) {
1362
- const inClientGraph = clientReachable.has(path);
1363
- const visit = (node) => {
1364
- const key = environmentRead(node);
1365
- const parent = node.parent;
1366
- const parentConsumesEnvironment =
1367
- (parent &&
1368
- ts.isPropertyAccessExpression(parent) &&
1369
- parent.expression === node) ||
1370
- (parent &&
1371
- ts.isElementAccessExpression(parent) &&
1372
- parent.expression === node);
1373
- if (inClientGraph && key === null) {
1374
- findings.push({
1375
- classification: 'client-dynamic-environment-access',
1376
- line: lineOf(module.sourceFile, node),
1377
- path: portable(path),
1378
- });
1379
- } else if (
1380
- inClientGraph &&
1381
- isProcessEnvironmentObject(node) &&
1382
- !parentConsumesEnvironment
1383
- ) {
1384
- findings.push({
1385
- classification: 'client-dynamic-environment-access',
1386
- line: lineOf(module.sourceFile, node),
1387
- path: portable(path),
1388
- });
1389
- } else if (inClientGraph && typeof key === 'string') {
1390
- findings.push({
1391
- classification:
1392
- key.startsWith('NEXT_PUBLIC_') && allowedPublic.has(key)
1393
- ? undefined
1394
- : key.startsWith('NEXT_PUBLIC_')
1395
- ? 'undeclared-public-configuration'
1396
- : 'client-reads-server-environment',
1397
- key:
1398
- key.startsWith('NEXT_PUBLIC_') && !allowedPublic.has(key)
1399
- ? key
1400
- : undefined,
1401
- line: lineOf(module.sourceFile, node),
1402
- path: portable(path),
1403
- });
1404
- }
1405
- if (
1406
- (ts.isIdentifier(node) && node.text === 'dangerouslySetInnerHTML') ||
1407
- (ts.isPropertyAccessExpression(node) && node.name.text === 'innerHTML')
1408
- ) {
1409
- findings.push({
1410
- classification: 'raw-html-sink-requires-reviewed-adapter',
1411
- line: lineOf(module.sourceFile, node),
1412
- path: portable(path),
1413
- });
1414
- }
1415
- ts.forEachChild(node, visit);
1416
- };
1417
- visit(module.sourceFile);
1418
- }
1419
-
1420
- const normalized = findings
1421
- .filter((finding) => finding.classification)
1422
- .map((finding) =>
1423
- Object.fromEntries(
1424
- Object.entries(finding).filter(([, value]) => value !== undefined),
1425
- ),
1426
- )
1427
- .sort((left, right) =>
1428
- JSON.stringify(left) < JSON.stringify(right)
1429
- ? -1
1430
- : JSON.stringify(left) > JSON.stringify(right)
1431
- ? 1
1432
- : 0,
1433
- );
1434
- return {
1435
- counts: { checked: modules.size, findings: normalized.length },
1436
- findings: normalized,
1437
- kind: 'ebk-frontend-boundary-result',
1438
- outcome: normalized.length === 0 ? 'passed' : 'failed',
1439
- schemaVersion: 1,
1440
- slice: '${name}',
1441
- };
1442
- }
1443
-
1444
- function main() {
1445
- const result = inspectFrontendBoundaries();
1446
- const outputArgument = process.argv.find((value) => value.startsWith('--output='));
1447
- if (outputArgument) {
1448
- const output = resolve(projectRoot, outputArgument.slice('--output='.length));
1449
- if (
1450
- relative(projectRoot, output).startsWith('..' + sep) ||
1451
- relative(projectRoot, output) === '..'
1452
- ) {
1453
- throw new Error('Frontend boundary evidence must remain inside the Product Slice.');
1454
- }
1455
- mkdirSync(dirname(output), { recursive: true, mode: 0o700 });
1456
- writeFileSync(output, JSON.stringify(result, null, 2) + '\\n', { mode: 0o600 });
1457
- }
1458
- process.stdout.write(JSON.stringify(result) + '\\n');
1459
- if (result.outcome !== 'passed') process.exitCode = 1;
1460
- }
1461
-
1462
- main();
1463
- `,
1464
- 'scripts/frontend-security-headers.mjs': `import { createHash } from 'node:crypto';
1465
- import { mkdirSync, readFileSync, realpathSync, writeFileSync } from 'node:fs';
1466
- import { dirname, relative, resolve, sep } from 'node:path';
1467
- import { fileURLToPath } from 'node:url';
1468
- import {
1469
- inspectFrontendSecurityHeaders as inspectOwnedFrontendSecurityHeaders,
1470
- resolveFrontendSecurityHeaderProfile,
1471
- } from '@empire-builder-kit/nx/frontend-security';
1472
-
1473
- const projectRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
1474
- const foundationPolicyPath = resolve(
1475
- projectRoot,
1476
- '..',
1477
- 'foundation',
1478
- 'contracts',
1479
- 'frontend-security-headers.json',
1480
- );
1481
- const slicePolicyPath = resolve(
1482
- projectRoot,
1483
- 'frontend',
1484
- 'security-headers.json',
1485
- );
1486
- const readPolicy = (path) => {
1487
- const contents = readFileSync(path);
1488
- return {
1489
- digest: 'sha256:' + createHash('sha256').update(contents).digest('hex'),
1490
- value: JSON.parse(contents),
1491
- };
1492
- };
1493
- const foundationPolicy = readPolicy(foundationPolicyPath);
1494
- const slicePolicy = readPolicy(slicePolicyPath);
1495
- const gitObjectIdPattern = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
1496
- const MAX_FRONTEND_HEADER_FETCH_TIMEOUT_MS = 10_000;
1497
-
1498
- function loopback(hostname) {
1499
- return ['127.0.0.1', 'localhost', '::1', '[::1]'].includes(hostname);
1500
- }
1501
-
1502
- function safeTarget(value, profile, allowLoopbackTransportProof) {
1503
- const target = new URL(value);
1504
- if (
1505
- (target.protocol !== 'https:' &&
1506
- !(
1507
- loopback(target.hostname) &&
1508
- target.protocol === 'http:' &&
1509
- (profile === 'local-development' || allowLoopbackTransportProof)
1510
- )) ||
1511
- target.username ||
1512
- target.password ||
1513
- target.search ||
1514
- target.hash
1515
- ) {
1516
- throw new Error('Frontend header target must be HTTPS without credentials, query, or fragment.');
1517
- }
1518
- return target;
1519
- }
1520
-
1521
- export function inspectFrontendSecurityHeaders({
1522
- allowLoopbackTransportProof = false,
1523
- headers,
1524
- https,
1525
- profile = 'deployed-https',
1526
- }) {
1527
- return inspectOwnedFrontendSecurityHeaders({
1528
- actual: headers,
1529
- allowLoopbackTransportProof,
1530
- foundation: foundationPolicy.value,
1531
- https,
1532
- profile,
1533
- slice: slicePolicy.value,
1534
- sliceName: '${name}',
1535
- });
1536
- }
1537
-
1538
- function responseNonce(headers) {
1539
- const policy = new Headers(headers).get('content-security-policy') ?? '';
1540
- const nonces = [
1541
- ...policy.matchAll(/'nonce-([A-Za-z0-9+/_-]{16,128}={0,2})'/g),
1542
- ].map((match) => match[1]);
1543
- const unique = [...new Set(nonces)];
1544
- return unique.length === 1 && nonces.length >= 2 ? unique[0] : undefined;
1545
- }
1546
-
1547
- export function inspectFrontendNonceFreshness(firstHeaders, secondHeaders) {
1548
- const first = responseNonce(firstHeaders);
1549
- const second = responseNonce(secondHeaders);
1550
- return {
1551
- firstNoncePresent: first !== undefined,
1552
- fresh: first !== undefined && second !== undefined && first !== second,
1553
- secondNoncePresent: second !== undefined,
1554
- };
1555
- }
1556
-
1557
- function outputPath(argument) {
1558
- const output = resolve(
1559
- projectRoot,
1560
- argument?.slice('--output='.length) ??
1561
- '.ebk/evidence/frontend/security-headers.json',
1562
- );
1563
- const fromRoot = relative(projectRoot, output);
1564
- if (fromRoot === '..' || fromRoot.startsWith('..' + sep)) {
1565
- throw new Error('Frontend header evidence must remain inside the Product Slice.');
1566
- }
1567
- return output;
1568
- }
1569
-
1570
- function fetchTimeout() {
1571
- const value =
1572
- process.env.EBK_FRONTEND_HEADER_FETCH_TIMEOUT_MS?.trim() ?? '10000';
1573
- if (!/^[1-9]\\d*$/.test(value)) {
1574
- throw new Error(
1575
- 'EBK_FRONTEND_HEADER_FETCH_TIMEOUT_MS must be a positive integer.',
1576
- );
1577
- }
1578
- const milliseconds = Number(value);
1579
- if (milliseconds > MAX_FRONTEND_HEADER_FETCH_TIMEOUT_MS) {
1580
- throw new Error(
1581
- 'EBK_FRONTEND_HEADER_FETCH_TIMEOUT_MS may not exceed ' +
1582
- MAX_FRONTEND_HEADER_FETCH_TIMEOUT_MS +
1583
- ' milliseconds.',
1584
- );
1585
- }
1586
- return milliseconds;
1587
- }
1588
-
1589
- export async function fetchFrontendResponse(
1590
- target,
1591
- timeout,
1592
- fetchImplementation = fetch,
1593
- ) {
1594
- const signal = AbortSignal.timeout(timeout);
1595
- try {
1596
- return await fetchImplementation(target, { redirect: 'error', signal });
1597
- } catch (error) {
1598
- if (signal.aborted) {
1599
- throw new Error(
1600
- 'Frontend header request did not complete within ' +
1601
- timeout +
1602
- ' milliseconds.',
1603
- { cause: error },
1604
- );
1605
- }
1606
- throw error;
1607
- }
1608
- }
1609
-
1610
- async function main() {
1611
- const arguments_ = process.argv.slice(2);
1612
- const urlArguments = arguments_.filter((value) => value.startsWith('--url='));
1613
- const outputArguments = arguments_.filter((value) =>
1614
- value.startsWith('--output='),
1615
- );
1616
- const allowLoopbackTransportProof = arguments_.includes(
1617
- '--allow-loopback-transport-proof',
1618
- );
1619
- const unsupported = arguments_.filter(
1620
- (value) =>
1621
- !value.startsWith('--url=') &&
1622
- !value.startsWith('--output=') &&
1623
- value !== '--allow-loopback-transport-proof',
1624
- );
1625
- if (
1626
- urlArguments.length > 1 ||
1627
- outputArguments.length > 1 ||
1628
- unsupported.length > 0
1629
- ) {
1630
- throw new Error(
1631
- 'Usage: frontend-security-headers.mjs [--url=<url>] [--output=<path>] [--allow-loopback-transport-proof]',
1632
- );
1633
- }
1634
- const profile = resolveFrontendSecurityHeaderProfile(process.env);
1635
- const target = safeTarget(
1636
- urlArguments[0]?.slice('--url='.length) ??
1637
- process.env.EBK_FRONTEND_URL ??
1638
- '',
1639
- profile,
1640
- allowLoopbackTransportProof,
1641
- );
1642
- const timeout = fetchTimeout();
1643
- const response = await fetchFrontendResponse(target, timeout);
1644
- const hostedTransportVerified =
1645
- profile === 'deployed-https' && target.protocol === 'https:';
1646
- const inspected = inspectFrontendSecurityHeaders({
1647
- allowLoopbackTransportProof,
1648
- headers: response.headers,
1649
- https: target.protocol === 'https:',
1650
- profile,
1651
- });
1652
- const freshnessResponse = hostedTransportVerified
1653
- ? await fetchFrontendResponse(target, timeout)
1654
- : undefined;
1655
- const freshnessInspection = freshnessResponse
1656
- ? inspectFrontendSecurityHeaders({
1657
- allowLoopbackTransportProof,
1658
- headers: freshnessResponse.headers,
1659
- https: true,
1660
- profile,
1661
- })
1662
- : undefined;
1663
- const nonceFreshness = freshnessResponse
1664
- ? inspectFrontendNonceFreshness(response.headers, freshnessResponse.headers)
1665
- : {
1666
- firstNoncePresent: false,
1667
- fresh: false,
1668
- secondNoncePresent: false,
1669
- };
1670
- const nonceFreshnessVerified =
1671
- hostedTransportVerified &&
1672
- freshnessResponse !== undefined &&
1673
- freshnessResponse.status >= 200 &&
1674
- freshnessResponse.status < 400 &&
1675
- freshnessInspection?.findings.length === 0 &&
1676
- nonceFreshness.fresh;
1677
- const sourceCommit =
1678
- process.env.EBK_SOURCE_COMMIT?.trim() ?? 'unresolved-local-source';
1679
- const stage = process.env.EBK_STAGE?.trim() ?? 'development';
1680
- const findings = [
1681
- ...inspected.findings,
1682
- ...(profile === 'deployed-https' && !gitObjectIdPattern.test(sourceCommit)
1683
- ? ['deployed-source-commit-required']
1684
- : []),
1685
- ...(response.status >= 200 && response.status < 400
1686
- ? []
1687
- : ['frontend-response-unsuccessful']),
1688
- ...(hostedTransportVerified && !nonceFreshnessVerified
1689
- ? ['hosted-response-nonce-not-fresh']
1690
- : []),
1691
- ].sort();
1692
- const proofScope =
1693
- profile === 'local-development'
1694
- ? 'local-development'
1695
- : hostedTransportVerified
1696
- ? 'hosted-deployed'
1697
- : 'local-response-composition';
1698
- const result = {
1699
- ...inspected,
1700
- binding: {
1701
- foundationPolicyDigest: foundationPolicy.digest,
1702
- slicePolicyDigest: slicePolicy.digest,
1703
- sourceCommit,
1704
- stage,
1705
- targetOriginDigest:
1706
- 'sha256:' +
1707
- createHash('sha256').update(target.origin, 'utf8').digest('hex'),
1708
- },
1709
- findings,
1710
- hostedTransportVerified,
1711
- nonceFreshnessVerified,
1712
- outcome: findings.length === 0 ? 'passed' : 'failed',
1713
- proofScope,
1714
- response: {
1715
- https: target.protocol === 'https:',
1716
- pathname: target.pathname,
1717
- status: response.status,
1718
- },
1719
- };
1720
- const output = outputPath(outputArguments[0]);
1721
- mkdirSync(dirname(output), { recursive: true, mode: 0o700 });
1722
- writeFileSync(output, JSON.stringify(result, null, 2) + '\\n', { mode: 0o600 });
1723
- process.stdout.write(JSON.stringify(result) + '\\n');
1724
- if (result.outcome !== 'passed') process.exitCode = 1;
1725
- }
1726
-
1727
- if (
1728
- process.argv[1] &&
1729
- realpathSync(resolve(process.argv[1])) ===
1730
- realpathSync(fileURLToPath(import.meta.url))
1731
- ) {
1732
- await main();
1733
- }
1734
- `,
1735
- 'scripts/frontend-visual-report.mjs': `import { createHash } from 'node:crypto';
1736
- import {
1737
- lstatSync,
1738
- mkdirSync,
1739
- readFileSync,
1740
- realpathSync,
1741
- writeFileSync,
1742
- } from 'node:fs';
1743
- import { dirname, join, relative, resolve, sep } from 'node:path';
1744
- import { fileURLToPath } from 'node:url';
1745
-
1746
- const projectRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
1747
- const baselinePath = join(projectRoot, 'frontend', 'visual-baselines.json');
1748
- const observationPath = join(
1749
- projectRoot,
1750
- '.ebk',
1751
- 'evidence',
1752
- 'frontend',
1753
- 'frontend-visual-observations.json',
1754
- );
1755
- const resultPath = join(
1756
- projectRoot,
1757
- '.ebk',
1758
- 'evidence',
1759
- 'frontend',
1760
- 'frontend-visual-report.json',
1761
- );
1762
- const digestPattern = /^sha256:[a-f0-9]{64}$/;
1763
- const tokenPattern = /^[A-Za-z0-9][A-Za-z0-9._/-]*$/;
1764
-
1765
- function regularProjectFile(path, label) {
1766
- const relativePath = relative(projectRoot, path);
1767
- if (
1768
- !relativePath ||
1769
- relativePath === '..' ||
1770
- relativePath.startsWith('..' + sep) ||
1771
- resolve(projectRoot, relativePath) !== path
1772
- ) {
1773
- throw new Error(label + ' must remain inside the Product Slice.');
1774
- }
1775
- const stat = lstatSync(path);
1776
- if (!stat.isFile() || stat.isSymbolicLink()) {
1777
- throw new Error(label + ' must be a regular non-symlink file.');
1778
- }
1779
- const real = realpathSync(path);
1780
- const realRelative = relative(realpathSync(projectRoot), real);
1781
- if (realRelative === '..' || realRelative.startsWith('..' + sep)) {
1782
- throw new Error(label + ' resolves outside the Product Slice.');
1783
- }
1784
- }
1785
-
1786
- function readJson(path, label) {
1787
- regularProjectFile(path, label);
1788
- return JSON.parse(readFileSync(path, 'utf8'));
1789
- }
1790
-
1791
- function exactKeys(value, allowed) {
1792
- return (
1793
- value &&
1794
- typeof value === 'object' &&
1795
- Object.keys(value).every((key) => allowed.includes(key))
1796
- );
1797
- }
1798
-
1799
- function records(value, label, { observations = false } = {}) {
1800
- if (
1801
- !exactKeys(
1802
- value,
1803
- observations
1804
- ? ['records', 'schemaVersion', 'slice']
1805
- : ['records', 'reviewedAt', 'schemaVersion', 'slice', 'workItem'],
1806
- ) ||
1807
- value?.schemaVersion !== 1 ||
1808
- value?.slice !== '${name}' ||
1809
- !Array.isArray(value?.records)
1810
- ) {
1811
- throw new Error(label + ' is not a ${name} frontend visual record.');
1812
- }
1813
- if (
1814
- !observations &&
1815
- ((value.reviewedAt === undefined) !== (value.workItem === undefined) ||
1816
- (value.records.length > 0 &&
1817
- (value.reviewedAt === undefined || value.workItem === undefined)) ||
1818
- (value.reviewedAt !== undefined &&
1819
- (typeof value.reviewedAt !== 'string' ||
1820
- !Number.isFinite(Date.parse(value.reviewedAt)) ||
1821
- new Date(value.reviewedAt).toISOString() !== value.reviewedAt ||
1822
- !/^(?:GH:[1-9][0-9]*|PLAN:[A-Za-z0-9._/-]+)$/.test(
1823
- value.workItem ?? '',
1824
- ))))
1825
- ) {
1826
- throw new Error(label + ' has invalid review attribution.');
1827
- }
1828
- const ids = new Set();
1829
- return value.records.map((record, index) => {
1830
- if (
1831
- !exactKeys(record, ['artifact', 'digest', 'id', 'profile', 'viewport']) ||
1832
- !record ||
1833
- typeof record !== 'object' ||
1834
- !tokenPattern.test(record.id ?? '') ||
1835
- !tokenPattern.test(record.profile ?? '') ||
1836
- !tokenPattern.test(record.viewport ?? '') ||
1837
- !digestPattern.test(record.digest ?? '') ||
1838
- typeof record.artifact !== 'string' ||
1839
- !record.artifact.startsWith('.ebk/evidence/frontend/visuals/') ||
1840
- record.artifact.includes('..')
1841
- ) {
1842
- throw new Error(label + ' record ' + index + ' is malformed.');
1843
- }
1844
- if (observations) {
1845
- const artifactPath = resolve(projectRoot, record.artifact);
1846
- regularProjectFile(artifactPath, label + ' artifact ' + index);
1847
- const actualDigest =
1848
- 'sha256:' +
1849
- createHash('sha256').update(readFileSync(artifactPath)).digest('hex');
1850
- if (actualDigest !== record.digest) {
1851
- throw new Error(label + ' artifact ' + index + ' does not match its digest.');
1852
- }
1853
- }
1854
- const key = record.id + '@' + record.viewport + '@' + record.profile;
1855
- if (ids.has(key)) throw new Error(label + ' contains duplicate record ' + key + '.');
1856
- ids.add(key);
1857
- return {
1858
- artifact: record.artifact,
1859
- digest: record.digest,
1860
- id: record.id,
1861
- profile: record.profile,
1862
- viewport: record.viewport,
1863
- };
1864
- }).sort((left, right) =>
1865
- left.id + '@' + left.viewport + '@' + left.profile <
1866
- right.id + '@' + right.viewport + '@' + right.profile
1867
- ? -1
1868
- : left.id + '@' + left.viewport + '@' + left.profile >
1869
- right.id + '@' + right.viewport + '@' + right.profile
1870
- ? 1
1871
- : 0,
1872
- );
1873
- }
1874
-
1875
- function compare(baseline, observed) {
1876
- const expected = new Map(
1877
- baseline.map((record) => [
1878
- record.id + '@' + record.viewport + '@' + record.profile,
1879
- record,
1880
- ]),
1881
- );
1882
- const actual = new Map(
1883
- observed.map((record) => [
1884
- record.id + '@' + record.viewport + '@' + record.profile,
1885
- record,
1886
- ]),
1887
- );
1888
- const findings = [];
1889
- for (const [key, record] of expected) {
1890
- const observation = actual.get(key);
1891
- if (!observation) findings.push({ classification: 'observation-missing', id: key });
1892
- else if (observation.digest !== record.digest) {
1893
- findings.push({ classification: 'visual-change-unreviewed', id: key });
1894
- }
1895
- }
1896
- for (const key of actual.keys()) {
1897
- if (!expected.has(key)) findings.push({ classification: 'baseline-missing', id: key });
1898
- }
1899
- return findings.sort((left, right) =>
1900
- left.id < right.id ? -1 : left.id > right.id ? 1 : 0,
1901
- );
1902
- }
1903
-
1904
- export function verifyFrontendVisualReport() {
1905
- const baseline = records(
1906
- readJson(baselinePath, 'Visual baseline'),
1907
- 'Visual baseline',
1908
- );
1909
- const observed = records(
1910
- readJson(observationPath, 'Visual observation'),
1911
- 'Visual observation',
1912
- { observations: true },
1913
- );
1914
- const observedProfiles = new Set(observed.map(({ profile }) => profile));
1915
- const applicableBaseline = baseline.filter(({ profile }) =>
1916
- observedProfiles.has(profile),
1917
- );
1918
- const findings =
1919
- applicableBaseline.length === 0
1920
- ? [{ classification: 'baseline-empty', id: '${name}' }]
1921
- : compare(applicableBaseline, observed);
1922
- return {
1923
- counts: {
1924
- applicableBaseline: applicableBaseline.length,
1925
- baseline: baseline.length,
1926
- observed: observed.length,
1927
- },
1928
- findings,
1929
- kind: 'ebk-frontend-visual-result',
1930
- outcome: findings.length === 0 ? 'passed' : 'failed',
1931
- schemaVersion: 1,
1932
- slice: '${name}',
1933
- };
1934
- }
1935
-
1936
- function updateBaseline(workItem) {
1937
- if (
1938
- process.env.CI === 'true' ||
1939
- process.env.GITHUB_ACTIONS === 'true' ||
1940
- !['', 'development'].includes(process.env.EBK_STAGE ?? '')
1941
- ) {
1942
- throw new Error('Frontend visual baselines may be updated only in local development.');
1943
- }
1944
- if (!/^(?:GH:[1-9][0-9]*|PLAN:[A-Za-z0-9._/-]+)$/.test(workItem ?? '')) {
1945
- throw new Error('Visual baseline update requires --work-item=GH:<number> or PLAN:<reference>.');
1946
- }
1947
- const observed = records(
1948
- readJson(observationPath, 'Visual observation'),
1949
- 'Visual observation',
1950
- { observations: true },
1951
- );
1952
- if (observed.length === 0) throw new Error('Visual baseline update requires observations.');
1953
- const previous = records(
1954
- readJson(baselinePath, 'Visual baseline'),
1955
- 'Visual baseline',
1956
- );
1957
- const updatedProfiles = new Set(observed.map(({ profile }) => profile));
1958
- const nextRecords = [
1959
- ...previous.filter(({ profile }) => !updatedProfiles.has(profile)),
1960
- ...observed,
1961
- ].sort((left, right) =>
1962
- left.id + '@' + left.viewport + '@' + left.profile <
1963
- right.id + '@' + right.viewport + '@' + right.profile
1964
- ? -1
1965
- : left.id + '@' + left.viewport + '@' + left.profile >
1966
- right.id + '@' + right.viewport + '@' + right.profile
1967
- ? 1
1968
- : 0,
1969
- );
1970
- writeFileSync(
1971
- baselinePath,
1972
- JSON.stringify(
1973
- {
1974
- records: nextRecords,
1975
- reviewedAt: new Date().toISOString(),
1976
- schemaVersion: 1,
1977
- slice: '${name}',
1978
- workItem,
1979
- },
1980
- null,
1981
- 2,
1982
- ) + '\\n',
1983
- );
1984
- }
1985
-
1986
- function writeResult(result) {
1987
- mkdirSync(dirname(resultPath), { recursive: true, mode: 0o700 });
1988
- writeFileSync(resultPath, JSON.stringify(result, null, 2) + '\\n', { mode: 0o600 });
1989
- process.stdout.write(JSON.stringify(result) + '\\n');
1990
- }
1991
-
1992
- function main() {
1993
- const command = process.argv[2];
1994
- if (command === 'update') {
1995
- const workItem = process.argv.find((value) => value.startsWith('--work-item='));
1996
- updateBaseline(workItem?.slice('--work-item='.length));
1997
- } else if (command !== 'verify') {
1998
- throw new Error('Usage: frontend-visual-report.mjs <verify|update> [--work-item=GH:123]');
1999
- }
2000
- const result = verifyFrontendVisualReport();
2001
- writeResult(result);
2002
- if (result.outcome !== 'passed') process.exitCode = 1;
2003
- }
2004
-
2005
- main();
2006
- `,
2007
- 'e2e/frontend-accessibility.spec.ts': `import { createHash } from 'node:crypto';
2008
- import { mkdirSync, writeFileSync } from 'node:fs';
2009
- import { join } from 'node:path';
2010
- import AxeBuilder from '@axe-core/playwright';
2011
- import { expect, test, type Page } from '@playwright/test';
2012
-
2013
- const states = ${JSON.stringify(states)} as const;
2014
-
2015
- function requiredEnvironment(name: string): string {
2016
- const value = process.env[name]?.trim();
2017
- if (!value) throw new Error(name + ' is required for frontend browser proof.');
2018
- return value;
2019
- }
2020
-
2021
- function fixtureUrl(state: (typeof states)[number]): string {
2022
- const product = new URL(requiredEnvironment('EBK_SMOKE_URL'));
2023
- product.pathname =
2024
- product.pathname.replace(/\\/$/, '') + '/_ebk/frontend-states';
2025
- product.searchParams.set('state', state);
2026
- return product.href;
2027
- }
2028
-
2029
- function cspProofUrl(): string {
2030
- const product = new URL(requiredEnvironment('EBK_SMOKE_URL'));
2031
- product.pathname = product.pathname.replace(/\\/$/, '') + '/_ebk/frontend-csp';
2032
- return product.href;
2033
- }
2034
-
2035
- function observeBrowserFailures(page: Page): string[] {
2036
- const failures: string[] = [];
2037
- page.on('console', (message) => {
2038
- if (message.type() === 'error') {
2039
- failures.push(
2040
- 'console-error:' +
2041
- message.text().replace(/\\s+/g, ' ').slice(0, 300),
2042
- );
2043
- }
2044
- });
2045
- page.on('pageerror', (error) =>
2046
- failures.push(
2047
- 'uncaught-page-error:' +
2048
- error.message.replace(/\\s+/g, ' ').slice(0, 300),
2049
- ),
2050
- );
2051
- page.on('requestfailed', (request) =>
2052
- failures.push(
2053
- 'request-failed:' +
2054
- new URL(request.url()).pathname.slice(0, 200),
2055
- ),
2056
- );
2057
- return failures;
2058
- }
2059
-
2060
- async function installSecurityPolicyViolationObserver(page: Page): Promise<void> {
2061
- await page.addInitScript(() => {
2062
- const observedWindow = window as Window & {
2063
- __ebkSecurityPolicyViolations?: string[];
2064
- };
2065
- const violations: string[] = [];
2066
- Object.defineProperty(observedWindow, '__ebkSecurityPolicyViolations', {
2067
- configurable: false,
2068
- enumerable: false,
2069
- value: violations,
2070
- writable: false,
2071
- });
2072
- document.addEventListener('securitypolicyviolation', (event) => {
2073
- if (violations.length < 20) {
2074
- violations.push(
2075
- 'csp-violation:' + event.effectiveDirective + ':' + event.disposition,
2076
- );
2077
- }
2078
- });
2079
- });
2080
- }
2081
-
2082
- async function securityPolicyViolations(page: Page): Promise<string[]> {
2083
- return page.evaluate(() => {
2084
- const observedWindow = window as Window & {
2085
- __ebkSecurityPolicyViolations?: string[];
2086
- };
2087
- return [...(observedWindow.__ebkSecurityPolicyViolations ?? [])];
2088
- });
2089
- }
2090
-
2091
- test.describe('generated frontend accessibility', () => {
2092
- test('scans every deterministic rendered state', async ({ page }) => {
2093
- const browserFailures = observeBrowserFailures(page);
2094
- for (const state of states) {
2095
- await page.goto(fixtureUrl(state));
2096
- await expect(
2097
- page.getByRole('heading', { level: 1, name: '${pascalName} neutral frontend states' }),
2098
- ).toBeVisible();
2099
- const result = await new AxeBuilder({ page })
2100
- .withTags(['wcag2a', 'wcag2aa', 'wcag21aa', 'wcag22aa'])
2101
- .analyze();
2102
- expect(result.violations, state).toEqual([]);
2103
- }
2104
- expect([...new Set(browserFailures)].sort()).toEqual([]);
2105
- });
2106
-
2107
- test('operates the dialog by keyboard and restores focus', async ({ page }) => {
2108
- const frameworkResponse = await page.goto(fixtureUrl('success'));
2109
- expect(frameworkResponse).not.toBeNull();
2110
- const trigger = page.getByRole('button', { name: 'Open details dialog' });
2111
- await trigger.focus();
2112
- await page.keyboard.press('Enter');
2113
- const dialog = page.getByRole('dialog', { name: 'Synthetic record details' });
2114
- await expect(dialog).toBeVisible();
2115
- await expect(page.getByRole('button', { name: 'Close details' })).toBeFocused();
2116
- await page.keyboard.press('Escape');
2117
- await expect(dialog).toBeHidden();
2118
- await expect(trigger).toBeFocused();
2119
- });
2120
-
2121
- test('preserves announcements, narrow reflow, and reduced motion', async ({ page }) => {
2122
- await page.setViewportSize({ height: 640, width: 320 });
2123
- await page.emulateMedia({ reducedMotion: 'reduce' });
2124
- await page.goto(fixtureUrl('validation'));
2125
- await expect(
2126
- page.getByRole('alert').filter({ hasText: 'one problem' }),
2127
- ).toContainText('one problem');
2128
- expect(
2129
- await page.evaluate(
2130
- () => document.documentElement.scrollWidth <= document.documentElement.clientWidth,
2131
- ),
2132
- ).toBe(true);
2133
- const duration = await page
2134
- .getByRole('button', { name: 'Open details dialog' })
2135
- .evaluate((element) => getComputedStyle(element).transitionDuration);
2136
- expect(duration.endsWith('s')).toBe(true);
2137
- expect(Number.parseFloat(duration)).toBeLessThanOrEqual(.001);
2138
- });
2139
-
2140
- test('hydrates framework UI and executes only nonce-authorized production inline script and style', async ({ page }) => {
2141
- test.skip(
2142
- process.env.EBK_FRONTEND_SECURITY_PROFILE !== 'deployed-https',
2143
- 'Strict nonce refusal is a deployed-profile proof.',
2144
- );
2145
- const browserFailures = observeBrowserFailures(page);
2146
- await installSecurityPolicyViolationObserver(page);
2147
- const frameworkResponse = await page.goto(fixtureUrl('success'));
2148
- expect(frameworkResponse).not.toBeNull();
2149
- await expect(
2150
- page.getByRole('heading', { level: 1, name: '${pascalName} neutral frontend states' }),
2151
- ).toBeVisible();
2152
- const trigger = page.getByRole('button', { name: 'Open details dialog' });
2153
- await trigger.click();
2154
- const dialog = page.getByRole('dialog', { name: 'Synthetic record details' });
2155
- await expect(dialog).toBeVisible();
2156
- await page.getByRole('button', { name: 'Close details' }).click();
2157
- await expect(dialog).toBeHidden();
2158
- await expect(trigger).toBeFocused();
2159
- expect([...new Set(browserFailures)].sort()).toEqual([]);
2160
- expect(await securityPolicyViolations(page)).toEqual([]);
2161
-
2162
- // The dedicated route below deliberately violates CSP. Keep its expected
2163
- // refusal signals separate from the clean framework-hydration observation.
2164
- const response = await page.goto(cspProofUrl());
2165
- expect(response).not.toBeNull();
2166
- const csp = response?.headers()['content-security-policy'] ?? '';
2167
- expect(csp).not.toContain("'unsafe-inline'");
2168
- const nonces = [...csp.matchAll(/'nonce-([A-Za-z0-9+/_-]{16,128}={0,2})'/g)].map(
2169
- (match) => match[1],
2170
- );
2171
- expect(new Set(nonces).size).toBe(1);
2172
- expect(nonces).toHaveLength(2);
2173
- const frameworkCsp =
2174
- frameworkResponse?.headers()['content-security-policy'] ?? '';
2175
- expect(frameworkCsp).not.toContain("'nonce-" + nonces[0] + "'");
2176
- const proof = await page.evaluate(() => {
2177
- const approvedStyle = document.querySelector('#approved-style');
2178
- const unapprovedStyle = document.querySelector('#unapproved-style');
2179
- if (!approvedStyle || !unapprovedStyle) {
2180
- throw new Error('The strict CSP proof fixture is incomplete.');
2181
- }
2182
- return {
2183
- approvedScript:
2184
- document.documentElement.dataset.ebkApprovedInline === 'executed',
2185
- approvedStyle: getComputedStyle(approvedStyle).color,
2186
- refusedScript:
2187
- document.documentElement.dataset.ebkUnapprovedInline === 'executed',
2188
- refusedStyle: getComputedStyle(unapprovedStyle).color,
2189
- };
2190
- });
2191
-
2192
- expect(proof).toMatchObject({
2193
- approvedScript: true,
2194
- approvedStyle: 'rgb(1, 2, 3)',
2195
- refusedScript: false,
2196
- });
2197
- expect(proof.refusedStyle).not.toBe('rgb(4, 5, 6)');
2198
- });
2199
-
2200
- test('captures stable neutral visual observations', async ({ browserName, page }) => {
2201
- const evidenceRoot = join(
2202
- process.cwd(),
2203
- '.ebk',
2204
- 'evidence',
2205
- 'frontend',
2206
- );
2207
- const visualRoot = join(evidenceRoot, 'visuals');
2208
- mkdirSync(visualRoot, { recursive: true, mode: 0o700 });
2209
- const records = [];
2210
- const profile = browserName + '-' + process.platform;
2211
- await page.setViewportSize({ height: 720, width: 1024 });
2212
- for (const state of ['empty', 'success', 'validation'] as const) {
2213
- await page.goto(fixtureUrl(state));
2214
- const artifact =
2215
- '.ebk/evidence/frontend/visuals/' +
2216
- state +
2217
- '-medium-' +
2218
- profile +
2219
- '.png';
2220
- const bytes = await page.screenshot({
2221
- animations: 'disabled',
2222
- caret: 'hide',
2223
- fullPage: true,
2224
- path: join(process.cwd(), artifact),
2225
- });
2226
- records.push({
2227
- artifact,
2228
- digest: 'sha256:' + createHash('sha256').update(bytes).digest('hex'),
2229
- id: state,
2230
- profile,
2231
- viewport: 'medium',
2232
- });
2233
- }
2234
- writeFileSync(
2235
- join(evidenceRoot, 'frontend-visual-observations.json'),
2236
- JSON.stringify({ records, schemaVersion: 1, slice: '${name}' }, null, 2) + '\\n',
2237
- { mode: 0o600 },
2238
- );
2239
- });
2240
- });
2241
- `,
2242
- };
2243
- }
2244
- //# sourceMappingURL=built-in-plan-frontend-files.js.map