@empire-builder-kit/nx 1.0.0-rc.30 → 1.0.0-rc.32

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 (310) hide show
  1. package/executors.json +8 -3
  2. package/package.json +14 -7
  3. package/src/aws/child-environment.d.ts +10 -0
  4. package/src/aws/child-environment.js +77 -0
  5. package/src/aws/child-environment.js.map +1 -0
  6. package/src/aws/identity.d.ts +13 -0
  7. package/src/aws/identity.js +41 -0
  8. package/src/aws/identity.js.map +1 -0
  9. package/src/aws-authority/index.d.ts +1 -0
  10. package/src/aws-authority/index.js +5 -0
  11. package/src/aws-authority/index.js.map +1 -0
  12. package/src/aws-authority/stage-authority.d.ts +240 -0
  13. package/src/aws-authority/stage-authority.js +2968 -0
  14. package/src/aws-authority/stage-authority.js.map +1 -0
  15. package/src/cli/main.d.ts +2 -0
  16. package/src/cli/main.js +11 -0
  17. package/src/cli/main.js.map +1 -1
  18. package/src/developer-agent/generator-planning.js +4 -4
  19. package/src/developer-agent/generator-planning.js.map +1 -1
  20. package/src/developer-agent/operation-registry.js +14 -6
  21. package/src/developer-agent/operation-registry.js.map +1 -1
  22. package/src/developer-agent/workspace-inspection.js +11 -2
  23. package/src/developer-agent/workspace-inspection.js.map +1 -1
  24. package/src/executors/deployment-plan/deployment-plan.js +1 -1
  25. package/src/executors/deployment-plan/deployment-plan.js.map +1 -1
  26. package/src/executors/foundation-preflight/foundation-preflight.d.ts +0 -1
  27. package/src/executors/foundation-preflight/foundation-preflight.js.map +1 -1
  28. package/src/executors/foundation-preflight/schema.json +0 -5
  29. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.d.ts +12 -3
  30. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js +95 -32
  31. package/src/executors/foundation-profile-preflight/foundation-profile-preflight.js.map +1 -1
  32. package/src/executors/foundation-profile-preflight/production-database-safeguard.d.ts +64 -0
  33. package/src/executors/foundation-profile-preflight/production-database-safeguard.js +221 -0
  34. package/src/executors/foundation-profile-preflight/production-database-safeguard.js.map +1 -0
  35. package/src/executors/foundation-profile-preflight/schema.json +1 -6
  36. package/src/executors/foundation-remove-preflight/foundation-remove-preflight.d.ts +11 -1
  37. package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js +44 -21
  38. package/src/executors/foundation-remove-preflight/foundation-remove-preflight.js.map +1 -1
  39. package/src/executors/foundation-remove-preflight/schema.json +6 -1
  40. package/src/executors/github-bootstrap/github-bootstrap.d.ts +1 -0
  41. package/src/executors/github-bootstrap/github-bootstrap.js +1 -0
  42. package/src/executors/github-bootstrap/github-bootstrap.js.map +1 -1
  43. package/src/executors/github-bootstrap/schema.json +7 -1
  44. package/src/executors/infrastructure-plan/infrastructure-plan.d.ts +27 -369
  45. package/src/executors/infrastructure-plan/infrastructure-plan.js +237 -5470
  46. package/src/executors/infrastructure-plan/infrastructure-plan.js.map +1 -1
  47. package/src/executors/infrastructure-plan/schema.json +8 -64
  48. package/src/executors/local-deploy/federated-credential-transport.d.ts +48 -0
  49. package/src/executors/local-deploy/federated-credential-transport.js +252 -0
  50. package/src/executors/local-deploy/federated-credential-transport.js.map +1 -0
  51. package/src/executors/local-deploy/local-approval.d.ts +4 -9
  52. package/src/executors/local-deploy/local-approval.js +3 -7
  53. package/src/executors/local-deploy/local-approval.js.map +1 -1
  54. package/src/executors/local-deploy/local-deploy.d.ts +60 -43
  55. package/src/executors/local-deploy/local-deploy.js +955 -804
  56. package/src/executors/local-deploy/local-deploy.js.map +1 -1
  57. package/src/executors/local-deploy/schema.json +3 -20
  58. package/src/executors/refresh/refresh.js +2 -2
  59. package/src/executors/refresh/refresh.js.map +1 -1
  60. package/src/executors/remove/remove.js +2 -2
  61. package/src/executors/remove/remove.js.map +1 -1
  62. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.d.ts +27 -1
  63. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js +907 -22
  64. package/src/executors/router-waf-rehearsal/router-waf-rehearsal.js.map +1 -1
  65. package/src/executors/router-waf-rehearsal/schema.json +17 -2
  66. package/src/executors/secret-initialize/schema.json +42 -0
  67. package/src/executors/secret-initialize/secret-initialize.d.ts +32 -0
  68. package/src/executors/secret-initialize/secret-initialize.js +243 -0
  69. package/src/executors/secret-initialize/secret-initialize.js.map +1 -0
  70. package/src/executors/secret-metadata/secret-metadata.d.ts +4 -1
  71. package/src/executors/secret-metadata/secret-metadata.js +76 -29
  72. package/src/executors/secret-metadata/secret-metadata.js.map +1 -1
  73. package/src/executors/sst-lifecycle/generated-secret-retirement.d.ts +53 -0
  74. package/src/executors/sst-lifecycle/generated-secret-retirement.js +192 -0
  75. package/src/executors/sst-lifecycle/generated-secret-retirement.js.map +1 -0
  76. package/src/executors/sst-lifecycle/governed-native-operation.d.ts +46 -0
  77. package/src/executors/sst-lifecycle/governed-native-operation.js +153 -0
  78. package/src/executors/sst-lifecycle/governed-native-operation.js.map +1 -0
  79. package/src/executors/sst-lifecycle/run-sst-command.d.ts +27 -7
  80. package/src/executors/sst-lifecycle/run-sst-command.js +474 -89
  81. package/src/executors/sst-lifecycle/run-sst-command.js.map +1 -1
  82. package/src/executors/sst-lifecycle/schema.json +0 -5
  83. package/src/executors/sst-lifecycle/secret-preflight.d.ts +2 -0
  84. package/src/executors/sst-lifecycle/secret-preflight.js +13 -7
  85. package/src/executors/sst-lifecycle/secret-preflight.js.map +1 -1
  86. package/src/executors/unlock/unlock.js +2 -2
  87. package/src/executors/unlock/unlock.js.map +1 -1
  88. package/src/foundation/provision-logical-database.js +2 -0
  89. package/src/foundation/provision-logical-database.js.map +1 -1
  90. package/src/foundation/router-waf-rate-rehearsal.d.ts +97 -0
  91. package/src/foundation/router-waf-rate-rehearsal.js +210 -0
  92. package/src/foundation/router-waf-rate-rehearsal.js.map +1 -0
  93. package/src/foundation/router-waf.d.ts +59 -9
  94. package/src/foundation/router-waf.js +427 -32
  95. package/src/foundation/router-waf.js.map +1 -1
  96. package/src/foundation/stages.d.ts +1 -0
  97. package/src/foundation/stages.js +11 -0
  98. package/src/foundation/stages.js.map +1 -1
  99. package/src/generators/formatting.d.ts +8 -0
  100. package/src/generators/formatting.js +118 -0
  101. package/src/generators/formatting.js.map +1 -0
  102. package/src/generators/function/function.js +37 -17
  103. package/src/generators/function/function.js.map +1 -1
  104. package/src/generators/post-generation-install.js +2 -2
  105. package/src/generators/post-generation-install.js.map +1 -1
  106. package/src/generators/preset/generator.js +28 -8
  107. package/src/generators/preset/generator.js.map +1 -1
  108. package/src/generators/preset/schema.d.ts +3 -0
  109. package/src/generators/preset/schema.json +5 -5
  110. package/src/generators/preset/workspace-files-developer-agent.js +15 -7
  111. package/src/generators/preset/workspace-files-developer-agent.js.map +1 -1
  112. package/src/generators/preset/workspace-files-ecr-inspector.d.ts +18 -0
  113. package/src/generators/preset/workspace-files-ecr-inspector.js +298 -0
  114. package/src/generators/preset/workspace-files-ecr-inspector.js.map +1 -0
  115. package/src/generators/preset/workspace-files-performance-cost.d.ts +2 -2
  116. package/src/generators/preset/workspace-files-performance-cost.js +8 -8
  117. package/src/generators/preset/workspace-files-performance-cost.js.map +1 -1
  118. package/src/generators/preset/workspace-files-performance-load.d.ts +1 -1
  119. package/src/generators/preset/workspace-files-performance-load.js +29 -24
  120. package/src/generators/preset/workspace-files-performance-load.js.map +1 -1
  121. package/src/generators/preset/workspace-files-stage-authority.d.ts +6 -0
  122. package/src/generators/preset/workspace-files-stage-authority.js +479 -0
  123. package/src/generators/preset/workspace-files-stage-authority.js.map +1 -0
  124. package/src/generators/preset/workspace-files-thin-deploy.d.ts +40 -0
  125. package/src/generators/preset/workspace-files-thin-deploy.js +1500 -0
  126. package/src/generators/preset/workspace-files-thin-deploy.js.map +1 -0
  127. package/src/generators/preset/workspace-files-thin-docs.d.ts +5 -0
  128. package/src/generators/preset/workspace-files-thin-docs.js +240 -0
  129. package/src/generators/preset/workspace-files-thin-docs.js.map +1 -0
  130. package/src/generators/preset/workspace-files-thin-release.d.ts +14 -0
  131. package/src/generators/preset/workspace-files-thin-release.js +26 -0
  132. package/src/generators/preset/workspace-files-thin-release.js.map +1 -0
  133. package/src/generators/preset/workspace-files.d.ts +2 -1
  134. package/src/generators/preset/workspace-files.js +448 -680
  135. package/src/generators/preset/workspace-files.js.map +1 -1
  136. package/src/generators/repository-policy/repository-policy.js +149 -19
  137. package/src/generators/repository-policy/repository-policy.js.map +1 -1
  138. package/src/generators/repository-policy/schema.d.ts +2 -0
  139. package/src/generators/repository-policy/schema.json +11 -1
  140. package/src/generators/repository-policy/tree-policy.d.ts +3 -0
  141. package/src/generators/repository-policy/tree-policy.js +25 -0
  142. package/src/generators/repository-policy/tree-policy.js.map +1 -0
  143. package/src/generators/slice/built-in-plan-api-files.js +1 -0
  144. package/src/generators/slice/built-in-plan-api-files.js.map +1 -1
  145. package/src/generators/slice/built-in-plan-async-work-files.js +41 -0
  146. package/src/generators/slice/built-in-plan-async-work-files.js.map +1 -1
  147. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js +6 -0
  148. package/src/generators/slice/built-in-plan-authorization-infrastructure-files.js.map +1 -1
  149. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js +5 -31
  150. package/src/generators/slice/built-in-plan-data-export-infrastructure-files.js.map +1 -1
  151. package/src/generators/slice/built-in-plan-data-files.d.ts +1 -1
  152. package/src/generators/slice/built-in-plan-data-files.js +89 -30
  153. package/src/generators/slice/built-in-plan-data-files.js.map +1 -1
  154. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js +19 -0
  155. package/src/generators/slice/built-in-plan-data-lifecycle-runtime-files.js.map +1 -1
  156. package/src/generators/slice/built-in-plan-data-retention-launcher-files.js +21 -3
  157. package/src/generators/slice/built-in-plan-data-retention-launcher-files.js.map +1 -1
  158. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js +20 -1
  159. package/src/generators/slice/built-in-plan-database-retirement-rehearsal-files.js.map +1 -1
  160. package/src/generators/slice/built-in-plan-foundation-files.js +3 -5
  161. package/src/generators/slice/built-in-plan-foundation-files.js.map +1 -1
  162. package/src/generators/slice/built-in-plan-frontend-files.js +5 -1
  163. package/src/generators/slice/built-in-plan-frontend-files.js.map +1 -1
  164. package/src/generators/slice/built-in-plan-infrastructure-files.d.ts +1 -1
  165. package/src/generators/slice/built-in-plan-infrastructure-files.js +199 -188
  166. package/src/generators/slice/built-in-plan-infrastructure-files.js.map +1 -1
  167. package/src/generators/slice/built-in-plan-metadata-files.js +13 -0
  168. package/src/generators/slice/built-in-plan-metadata-files.js.map +1 -1
  169. package/src/generators/slice/built-in-plan-native-runtime-authority-files.d.ts +2 -0
  170. package/src/generators/slice/built-in-plan-native-runtime-authority-files.js +307 -0
  171. package/src/generators/slice/built-in-plan-native-runtime-authority-files.js.map +1 -0
  172. package/src/generators/slice/built-in-plan-operations-files.js +65 -51
  173. package/src/generators/slice/built-in-plan-operations-files.js.map +1 -1
  174. package/src/generators/slice/built-in-plan-performance-files.js +97 -19
  175. package/src/generators/slice/built-in-plan-performance-files.js.map +1 -1
  176. package/src/generators/slice/built-in-plan-project-files.js +9 -68
  177. package/src/generators/slice/built-in-plan-project-files.js.map +1 -1
  178. package/src/generators/slice/built-in-plan-secret-runtime-files.d.ts +1 -1
  179. package/src/generators/slice/built-in-plan-secret-runtime-files.js +87 -76
  180. package/src/generators/slice/built-in-plan-secret-runtime-files.js.map +1 -1
  181. package/src/generators/slice/built-in-plan-testing-files.js +94 -47
  182. package/src/generators/slice/built-in-plan-testing-files.js.map +1 -1
  183. package/src/generators/slice/built-in-plan-thin-release-files.d.ts +11 -0
  184. package/src/generators/slice/built-in-plan-thin-release-files.js +129 -0
  185. package/src/generators/slice/built-in-plan-thin-release-files.js.map +1 -0
  186. package/src/generators/slice/built-in-plan-verification-files.js +6 -2
  187. package/src/generators/slice/built-in-plan-verification-files.js.map +1 -1
  188. package/src/generators/slice/built-in-plan-web-files.js +4 -2
  189. package/src/generators/slice/built-in-plan-web-files.js.map +1 -1
  190. package/src/generators/slice/built-in-plan-workload-role-files.js +26 -4
  191. package/src/generators/slice/built-in-plan-workload-role-files.js.map +1 -1
  192. package/src/generators/slice/built-in-plan.d.ts +1 -0
  193. package/src/generators/slice/built-in-plan.js +28 -11
  194. package/src/generators/slice/built-in-plan.js.map +1 -1
  195. package/src/generators/slice/slice.js +30 -32
  196. package/src/generators/slice/slice.js.map +1 -1
  197. package/src/generators/upgrade/upgrade.d.ts +1 -1
  198. package/src/generators/upgrade/upgrade.js +200 -48
  199. package/src/generators/upgrade/upgrade.js.map +1 -1
  200. package/src/generators/workload/performance-registration.d.ts +1 -0
  201. package/src/generators/workload/performance-registration.js +9 -11
  202. package/src/generators/workload/performance-registration.js.map +1 -1
  203. package/src/generators/workload/service-performance-files.d.ts +1 -0
  204. package/src/generators/workload/service-performance-files.js +27 -7
  205. package/src/generators/workload/service-performance-files.js.map +1 -1
  206. package/src/generators/workload/workload.d.ts +1 -1
  207. package/src/generators/workload/workload.js +55 -28
  208. package/src/generators/workload/workload.js.map +1 -1
  209. package/src/git-policy/github-bootstrap.d.ts +28 -7
  210. package/src/git-policy/github-bootstrap.js +205 -163
  211. package/src/git-policy/github-bootstrap.js.map +1 -1
  212. package/src/index.d.ts +1 -0
  213. package/src/index.js +1 -0
  214. package/src/index.js.map +1 -1
  215. package/src/local-dev/private-state.d.ts +3 -0
  216. package/src/local-dev/private-state.js +17 -5
  217. package/src/local-dev/private-state.js.map +1 -1
  218. package/src/local-dev/tls.js +5 -1
  219. package/src/local-dev/tls.js.map +1 -1
  220. package/src/performance/cost-collection.d.ts +1 -1
  221. package/src/performance/cost-collection.js +4 -2
  222. package/src/performance/cost-collection.js.map +1 -1
  223. package/src/performance/cost-controls.d.ts +3 -1
  224. package/src/performance/cost-controls.js +9 -4
  225. package/src/performance/cost-controls.js.map +1 -1
  226. package/src/performance/evidence.d.ts +1 -1
  227. package/src/performance/evidence.js +5 -3
  228. package/src/performance/evidence.js.map +1 -1
  229. package/src/performance/load-safety.js +5 -3
  230. package/src/performance/load-safety.js.map +1 -1
  231. package/src/performance/model.d.ts +2 -2
  232. package/src/performance/model.js +4 -3
  233. package/src/performance/model.js.map +1 -1
  234. package/src/release/index.d.ts +0 -2
  235. package/src/release/index.js +0 -2
  236. package/src/release/index.js.map +1 -1
  237. package/src/release/source-authority.d.ts +4 -5
  238. package/src/release/source-authority.js +13 -123
  239. package/src/release/source-authority.js.map +1 -1
  240. package/src/repository-policy/aurora-preflight.d.ts +1 -1
  241. package/src/repository-policy/aurora-preflight.js +4 -1
  242. package/src/repository-policy/aurora-preflight.js.map +1 -1
  243. package/src/repository-policy/policy.d.ts +21 -2
  244. package/src/repository-policy/policy.js +290 -25
  245. package/src/repository-policy/policy.js.map +1 -1
  246. package/src/schemas/performance-policy-v1.json +3 -1
  247. package/src/schemas/repository-policy-v1.json +46 -2
  248. package/src/secrets/adapters.d.ts +7 -2
  249. package/src/secrets/adapters.js +34 -3
  250. package/src/secrets/adapters.js.map +1 -1
  251. package/src/secrets/aws-control-plane.d.ts +10 -1
  252. package/src/secrets/aws-control-plane.js +67 -0
  253. package/src/secrets/aws-control-plane.js.map +1 -1
  254. package/src/secrets/generated-aws-control-plane.d.ts +23 -0
  255. package/src/secrets/generated-aws-control-plane.js +259 -0
  256. package/src/secrets/generated-aws-control-plane.js.map +1 -0
  257. package/src/secrets/metadata.js +38 -10
  258. package/src/secrets/metadata.js.map +1 -1
  259. package/src/secrets/model.d.ts +8 -1
  260. package/src/secrets/model.js +24 -3
  261. package/src/secrets/model.js.map +1 -1
  262. package/src/secrets/operator.d.ts +89 -3
  263. package/src/secrets/operator.js +422 -9
  264. package/src/secrets/operator.js.map +1 -1
  265. package/src/secrets/registry.d.ts +2 -1
  266. package/src/secrets/registry.js +18 -1
  267. package/src/secrets/registry.js.map +1 -1
  268. package/src/secrets/workload-access.js +10 -2
  269. package/src/secrets/workload-access.js.map +1 -1
  270. package/src/supply-chain/action-pins.js +61 -7
  271. package/src/supply-chain/action-pins.js.map +1 -1
  272. package/src/supply-chain/build-output-bounds.d.ts +2 -0
  273. package/src/supply-chain/build-output-bounds.js +12 -0
  274. package/src/supply-chain/build-output-bounds.js.map +1 -0
  275. package/src/supply-chain/build-output.js +2 -4
  276. package/src/supply-chain/build-output.js.map +1 -1
  277. package/src/supply-chain/ecr-scanning.d.ts +5 -3
  278. package/src/supply-chain/ecr-scanning.js +11 -7
  279. package/src/supply-chain/ecr-scanning.js.map +1 -1
  280. package/src/supply-chain/ecs-deployed-image.d.ts +5 -3
  281. package/src/supply-chain/ecs-deployed-image.js +6 -4
  282. package/src/supply-chain/ecs-deployed-image.js.map +1 -1
  283. package/src/supply-chain/generated-container-release-command.js +849 -44
  284. package/src/supply-chain/generated-container-release-command.js.map +1 -1
  285. package/src/supply-chain/generated-ecr-collector-command.d.ts +0 -1
  286. package/src/supply-chain/generated-ecr-collector-command.js +188 -91
  287. package/src/supply-chain/generated-ecr-collector-command.js.map +1 -1
  288. package/src/supply-chain/generated-files.js +4 -3
  289. package/src/supply-chain/generated-files.js.map +1 -1
  290. package/src/supply-chain/index.d.ts +1 -1
  291. package/src/supply-chain/index.js +2 -1
  292. package/src/supply-chain/index.js.map +1 -1
  293. package/src/workload-roles/index.d.ts +10 -17
  294. package/src/workload-roles/index.js +5 -18
  295. package/src/workload-roles/index.js.map +1 -1
  296. package/src/workspace-deployment/identity.d.ts +3 -0
  297. package/src/workspace-deployment/identity.js +22 -0
  298. package/src/workspace-deployment/identity.js.map +1 -0
  299. package/src/workspace-deployment/index.d.ts +3 -0
  300. package/src/workspace-deployment/index.js +7 -0
  301. package/src/workspace-deployment/index.js.map +1 -0
  302. package/src/workspace-deployment/migration-evidence.d.ts +29 -0
  303. package/src/workspace-deployment/migration-evidence.js +83 -0
  304. package/src/workspace-deployment/migration-evidence.js.map +1 -0
  305. package/src/workspace-deployment/migration.d.ts +27 -0
  306. package/src/workspace-deployment/migration.js +109 -0
  307. package/src/workspace-deployment/migration.js.map +1 -0
  308. package/src/workspace-deployment/ownership.d.ts +81 -0
  309. package/src/workspace-deployment/ownership.js +381 -0
  310. package/src/workspace-deployment/ownership.js.map +1 -0
@@ -1,30 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EBK_CODE_OWNER_PLACEHOLDER = exports.EBK_STAGING_PLAN_REPOSITORY_VARIABLES = exports.EBK_PRODUCTION_PLAN_REPOSITORY_VARIABLES = exports.EBK_PROTECTED_ENVIRONMENT_VARIABLES = exports.EBK_PROTECTED_ENVIRONMENT_SECRETS = exports.EBK_STAGING_PROMOTION_PULL_ROLE_SECRET = exports.EBK_SMOKE_ROLE_SECRET = exports.EBK_RELIABILITY_READ_ROLE_SECRET = exports.EBK_PERFORMANCE_ORIGINS_VARIABLE = exports.EBK_PERFORMANCE_LOAD_ROLE_SECRET = exports.EBK_PERFORMANCE_COST_ROLE_SECRET = exports.EBK_PERFORMANCE_AGGREGATE_ROLE_SECRET = exports.EBK_ASYNC_RECOVERY_ROLE_SECRET = exports.EBK_ECR_INSPECTOR_EVIDENCE_ROLE_SECRET = exports.EBK_DEPLOYMENT_ROLE_SECRET = exports.EBK_REQUIRED_CHECKS = exports.EBK_PROTECTED_BRANCH_RULESET_NAME = void 0;
3
+ exports.EBK_CODE_OWNER_PLACEHOLDER = exports.EBK_PROTECTED_ENVIRONMENT_VARIABLES = exports.EBK_PROTECTED_ENVIRONMENT_SECRETS = exports.EBK_STAGING_PROMOTION_PULL_ROLE_SECRET = exports.EBK_PERFORMANCE_ORIGINS_VARIABLE = exports.EBK_PERFORMANCE_LOAD_ROLE_SECRET = exports.EBK_PERFORMANCE_COST_ROLE_SECRET = exports.EBK_PERFORMANCE_AGGREGATE_ROLE_SECRET = exports.EBK_ASYNC_RECOVERY_ROLE_SECRET = exports.EBK_ECR_INSPECTOR_EVIDENCE_ROLE_SECRET = exports.EBK_RETIRED_DEPLOYMENT_ROLE_SECRET = exports.EBK_REQUIRED_CHECKS = exports.EBK_PROTECTED_BRANCH_RULESET_NAME = void 0;
4
+ exports.githubEnvironmentTopology = githubEnvironmentTopology;
4
5
  exports.runGitHubBootstrap = runGitHubBootstrap;
5
6
  const index_js_1 = require("../repository-policy/index.js");
6
7
  const deterministic_order_js_1 = require("../deterministic-order.js");
7
8
  exports.EBK_PROTECTED_BRANCH_RULESET_NAME = 'Empire Builder Kit protected branches';
8
9
  exports.EBK_REQUIRED_CHECKS = ['policy', 'verify'];
9
- exports.EBK_DEPLOYMENT_ROLE_SECRET = 'AWS_DEPLOY_ROLE_ARN';
10
+ exports.EBK_RETIRED_DEPLOYMENT_ROLE_SECRET = 'AWS_DEPLOY_ROLE_ARN';
10
11
  exports.EBK_ECR_INSPECTOR_EVIDENCE_ROLE_SECRET = 'AWS_ECR_INSPECTOR_EVIDENCE_ROLE_ARN';
11
12
  exports.EBK_ASYNC_RECOVERY_ROLE_SECRET = 'AWS_ASYNC_RECOVERY_ROLE_ARN';
12
13
  exports.EBK_PERFORMANCE_AGGREGATE_ROLE_SECRET = 'AWS_PERFORMANCE_AGGREGATE_ROLE_ARN';
13
14
  exports.EBK_PERFORMANCE_COST_ROLE_SECRET = 'AWS_PERFORMANCE_COST_ROLE_ARN';
14
15
  exports.EBK_PERFORMANCE_LOAD_ROLE_SECRET = 'AWS_PERFORMANCE_LOAD_ROLE_ARN';
15
16
  exports.EBK_PERFORMANCE_ORIGINS_VARIABLE = 'EBK_PERFORMANCE_ORIGINS_JSON';
16
- exports.EBK_RELIABILITY_READ_ROLE_SECRET = 'AWS_RELIABILITY_READ_ROLE_ARN';
17
- exports.EBK_SMOKE_ROLE_SECRET = 'AWS_SMOKE_ROLE_ARN';
18
17
  exports.EBK_STAGING_PROMOTION_PULL_ROLE_SECRET = 'AWS_STAGING_PROMOTION_PULL_ROLE_ARN';
19
18
  exports.EBK_PROTECTED_ENVIRONMENT_SECRETS = [
20
19
  exports.EBK_ASYNC_RECOVERY_ROLE_SECRET,
21
- exports.EBK_DEPLOYMENT_ROLE_SECRET,
22
20
  exports.EBK_ECR_INSPECTOR_EVIDENCE_ROLE_SECRET,
23
- exports.EBK_PERFORMANCE_AGGREGATE_ROLE_SECRET,
24
- exports.EBK_PERFORMANCE_COST_ROLE_SECRET,
25
- exports.EBK_PERFORMANCE_LOAD_ROLE_SECRET,
26
- exports.EBK_RELIABILITY_READ_ROLE_SECRET,
27
- exports.EBK_SMOKE_ROLE_SECRET,
21
+ exports.EBK_RETIRED_DEPLOYMENT_ROLE_SECRET,
28
22
  exports.EBK_STAGING_PROMOTION_PULL_ROLE_SECRET,
29
23
  ];
30
24
  exports.EBK_PROTECTED_ENVIRONMENT_VARIABLES = [
@@ -34,140 +28,99 @@ exports.EBK_PROTECTED_ENVIRONMENT_VARIABLES = [
34
28
  'AWS_STAGING_PROMOTION_REGION',
35
29
  'EBK_ALLOW_PRODUCTION_REMOVE',
36
30
  'EBK_FLEET_ORIGIN',
37
- exports.EBK_PERFORMANCE_ORIGINS_VARIABLE,
38
- 'EBK_SMOKE_AUTHORITY_VERSION',
39
- 'EBK_SMOKE_TARGETS',
40
31
  ];
41
32
  const FORBIDDEN_NPM_TOKEN_NAMES = [
42
33
  'NODE_AUTH_TOKEN',
43
34
  'NPM_CONFIG_TOKEN',
44
35
  'NPM_TOKEN',
45
36
  ];
46
- exports.EBK_PRODUCTION_PLAN_REPOSITORY_VARIABLES = [
47
- 'AWS_PRODUCTION_PLAN_EXPECTED_ACCOUNT_ID',
48
- 'AWS_PRODUCTION_PLAN_GENERATED_OBJECT_ARNS_JSON',
49
- 'AWS_PRODUCTION_PLAN_GENERATED_PARAMETER_ARNS_JSON',
50
- 'AWS_PRODUCTION_PLAN_GENERATED_SECRET_ARNS_JSON',
51
- 'AWS_PRODUCTION_PLAN_PROVIDER_REFRESH_POLICY_JSON',
52
- 'AWS_PRODUCTION_PLAN_REGION',
53
- 'AWS_PRODUCTION_PLAN_ROLE_ARN',
54
- 'AWS_PRODUCTION_PLAN_SST_APPS_JSON',
55
- 'AWS_PRODUCTION_PLAN_STATE_BUCKET_ARN',
56
- 'AWS_PRODUCTION_PLAN_STATE_KMS_KEY_ARN',
57
- 'EBK_PRODUCTION_FLEET_ORIGIN',
58
- ];
59
- exports.EBK_STAGING_PLAN_REPOSITORY_VARIABLES = [
60
- 'AWS_STAGING_PLAN_EXPECTED_ACCOUNT_ID',
61
- 'AWS_STAGING_PLAN_GENERATED_OBJECT_ARNS_JSON',
62
- 'AWS_STAGING_PLAN_GENERATED_PARAMETER_ARNS_JSON',
63
- 'AWS_STAGING_PLAN_GENERATED_SECRET_ARNS_JSON',
64
- 'AWS_STAGING_PLAN_PROVIDER_REFRESH_POLICY_JSON',
65
- 'AWS_STAGING_PLAN_REGION',
66
- 'AWS_STAGING_PLAN_ROLE_ARN',
67
- 'AWS_STAGING_PLAN_SST_APPS_JSON',
68
- 'AWS_STAGING_PLAN_STATE_BUCKET_ARN',
69
- 'AWS_STAGING_PLAN_STATE_KMS_KEY_ARN',
70
- 'EBK_STAGING_FLEET_ORIGIN',
71
- ];
72
37
  exports.EBK_CODE_OWNER_PLACEHOLDER = '@REPLACE_WITH_GITHUB_CODE_OWNER';
73
- const GITHUB_API_VERSION = '2022-11-28';
38
+ const GITHUB_API_VERSION = '2026-03-10';
39
+ const GITHUB_IMMUTABLE_OIDC_CHANGE = 'Use the default immutable GitHub OIDC repository subject.';
40
+ const GITHUB_IMMUTABLE_OIDC_TRUST_ACKNOWLEDGEMENT_PREFIX = 'aws-trust-ready:';
74
41
  const PROTECTED_BRANCHES = ['develop', 'main'];
75
- const ENVIRONMENT_BRANCHES = {
76
- 'async-recovery-production': 'main',
77
- 'async-recovery-staging': 'develop',
78
- 'infrastructure-plan-production': 'main',
79
- 'infrastructure-plan-staging': 'develop',
80
- 'performance-cost-production': 'main',
81
- 'performance-cost-staging': 'develop',
82
- 'performance-aggregate-production': 'main',
83
- 'performance-aggregate-staging': 'develop',
84
- 'performance-load-production': 'main',
85
- 'performance-load-staging': 'develop',
86
- 'npm-prerelease': 'main',
87
- production: 'main',
88
- 'reliability-read-production': 'main',
89
- 'reliability-read-staging': 'develop',
90
- staging: 'develop',
91
- };
92
- const ENVIRONMENT_SECRET_REQUIREMENTS = {
93
- 'async-recovery-production': [exports.EBK_ASYNC_RECOVERY_ROLE_SECRET],
94
- 'async-recovery-staging': [exports.EBK_ASYNC_RECOVERY_ROLE_SECRET],
95
- 'infrastructure-plan-production': [],
96
- 'infrastructure-plan-staging': [],
97
- 'performance-cost-production': [exports.EBK_PERFORMANCE_COST_ROLE_SECRET],
98
- 'performance-cost-staging': [exports.EBK_PERFORMANCE_COST_ROLE_SECRET],
99
- 'performance-aggregate-production': [exports.EBK_PERFORMANCE_AGGREGATE_ROLE_SECRET],
100
- 'performance-aggregate-staging': [exports.EBK_PERFORMANCE_AGGREGATE_ROLE_SECRET],
101
- 'performance-load-production': [exports.EBK_PERFORMANCE_LOAD_ROLE_SECRET],
102
- 'performance-load-staging': [exports.EBK_PERFORMANCE_LOAD_ROLE_SECRET],
103
- 'npm-prerelease': [],
104
- production: [
105
- exports.EBK_DEPLOYMENT_ROLE_SECRET,
106
- exports.EBK_ECR_INSPECTOR_EVIDENCE_ROLE_SECRET,
107
- exports.EBK_SMOKE_ROLE_SECRET,
108
- exports.EBK_STAGING_PROMOTION_PULL_ROLE_SECRET,
109
- ],
110
- 'reliability-read-production': [exports.EBK_RELIABILITY_READ_ROLE_SECRET],
111
- 'reliability-read-staging': [exports.EBK_RELIABILITY_READ_ROLE_SECRET],
112
- staging: [
113
- exports.EBK_DEPLOYMENT_ROLE_SECRET,
114
- exports.EBK_ECR_INSPECTOR_EVIDENCE_ROLE_SECRET,
115
- exports.EBK_SMOKE_ROLE_SECRET,
116
- ],
117
- };
118
42
  const BASE_STAGE_VARIABLES = exports.EBK_PROTECTED_ENVIRONMENT_VARIABLES.filter((variable) => variable !== 'EBK_ALLOW_PRODUCTION_REMOVE' &&
119
- variable !== exports.EBK_PERFORMANCE_ORIGINS_VARIABLE &&
120
43
  !variable.startsWith('AWS_STAGING_PROMOTION_'));
121
- const PRODUCTION_STAGE_VARIABLES = exports.EBK_PROTECTED_ENVIRONMENT_VARIABLES.filter((variable) => variable !== exports.EBK_PERFORMANCE_ORIGINS_VARIABLE);
122
- const ENVIRONMENT_VARIABLE_REQUIREMENTS = {
123
- 'async-recovery-production': ['AWS_EXPECTED_ACCOUNT_ID', 'AWS_REGION'],
124
- 'async-recovery-staging': ['AWS_EXPECTED_ACCOUNT_ID', 'AWS_REGION'],
125
- 'infrastructure-plan-production': [],
126
- 'infrastructure-plan-staging': [],
127
- 'performance-cost-production': ['AWS_EXPECTED_ACCOUNT_ID', 'AWS_REGION'],
128
- 'performance-cost-staging': ['AWS_EXPECTED_ACCOUNT_ID', 'AWS_REGION'],
129
- 'performance-aggregate-production': ['AWS_EXPECTED_ACCOUNT_ID', 'AWS_REGION'],
130
- 'performance-aggregate-staging': ['AWS_EXPECTED_ACCOUNT_ID', 'AWS_REGION'],
131
- 'performance-load-production': [
132
- 'AWS_EXPECTED_ACCOUNT_ID',
133
- 'AWS_REGION',
134
- exports.EBK_PERFORMANCE_ORIGINS_VARIABLE,
135
- ],
136
- 'performance-load-staging': [
137
- 'AWS_EXPECTED_ACCOUNT_ID',
138
- 'AWS_REGION',
139
- exports.EBK_PERFORMANCE_ORIGINS_VARIABLE,
140
- ],
141
- 'npm-prerelease': [],
142
- production: PRODUCTION_STAGE_VARIABLES,
143
- 'reliability-read-production': [],
144
- 'reliability-read-staging': [],
145
- staging: BASE_STAGE_VARIABLES,
146
- };
147
- function environmentSecretRequirements(environment, deploymentProfile) {
148
- const required = ENVIRONMENT_SECRET_REQUIREMENTS[environment];
149
- return deploymentProfile === 'starter' && environment === 'production'
150
- ? required.filter((secret) => secret !== exports.EBK_STAGING_PROMOTION_PULL_ROLE_SECRET)
151
- : required;
152
- }
153
- function environmentVariableRequirements(environment, deploymentProfile) {
154
- const required = ENVIRONMENT_VARIABLE_REQUIREMENTS[environment];
155
- return deploymentProfile === 'starter' && environment === 'production'
156
- ? required.filter((variable) => !variable.startsWith('AWS_STAGING_PROMOTION_'))
157
- : required;
158
- }
159
- function environmentStage(environment) {
160
- return environment.endsWith('-production') ||
161
- environment === 'npm-prerelease' ||
162
- environment === 'production'
163
- ? 'production'
164
- : 'staging';
44
+ const PRODUCTION_STAGE_VARIABLES = exports.EBK_PROTECTED_ENVIRONMENT_VARIABLES;
45
+ const AUXILIARY_ENVIRONMENTS = Object.freeze([
46
+ {
47
+ name: 'async-recovery',
48
+ requiredSecrets: [exports.EBK_ASYNC_RECOVERY_ROLE_SECRET],
49
+ requiredVariables: ['AWS_EXPECTED_ACCOUNT_ID', 'AWS_REGION'],
50
+ },
51
+ ]);
52
+ function stageEnvironmentTopology(stage, deploymentProfile) {
53
+ const production = stage === 'production';
54
+ return Object.freeze({
55
+ branch: production ? 'main' : 'develop',
56
+ name: stage,
57
+ requiredSecrets: Object.freeze(production
58
+ ? deploymentProfile === 'starter'
59
+ ? []
60
+ : [exports.EBK_STAGING_PROMOTION_PULL_ROLE_SECRET]
61
+ : []),
62
+ requiredVariables: Object.freeze(production
63
+ ? deploymentProfile === 'starter'
64
+ ? PRODUCTION_STAGE_VARIABLES.filter((variable) => !variable.startsWith('AWS_STAGING_PROMOTION_'))
65
+ : PRODUCTION_STAGE_VARIABLES
66
+ : BASE_STAGE_VARIABLES),
67
+ stage,
68
+ });
69
+ }
70
+ /**
71
+ * Exact generated GitHub environment contract for one deployment profile.
72
+ * Starter uses development as its rehearsal stage; isolated profiles use
73
+ * staging. Production and npm publication remain present for every profile.
74
+ */
75
+ function githubEnvironmentTopology(deploymentProfile) {
76
+ const rehearsalStage = deploymentProfile === 'starter' ? 'development' : 'staging';
77
+ const stages = [
78
+ 'production',
79
+ rehearsalStage,
80
+ ];
81
+ const topology = [];
82
+ for (const auxiliary of AUXILIARY_ENVIRONMENTS) {
83
+ for (const stage of stages) {
84
+ topology.push(Object.freeze({
85
+ branch: stage === 'production' ? 'main' : 'develop',
86
+ name: `${auxiliary.name}-${stage}`,
87
+ requiredSecrets: Object.freeze([...auxiliary.requiredSecrets]),
88
+ requiredVariables: Object.freeze([...auxiliary.requiredVariables]),
89
+ stage,
90
+ }));
91
+ }
92
+ }
93
+ const ecrStages = deploymentProfile === 'starter'
94
+ ? ['production']
95
+ : ['staging', 'production'];
96
+ for (const stage of ecrStages) {
97
+ topology.push(Object.freeze({
98
+ branch: stage === 'production' ? 'main' : 'develop',
99
+ name: `ecr-inspector-${stage}`,
100
+ requiredSecrets: Object.freeze([
101
+ exports.EBK_ECR_INSPECTOR_EVIDENCE_ROLE_SECRET,
102
+ ]),
103
+ requiredVariables: Object.freeze([
104
+ 'AWS_EXPECTED_ACCOUNT_ID',
105
+ 'AWS_REGION',
106
+ ]),
107
+ stage,
108
+ }));
109
+ }
110
+ topology.push(Object.freeze({
111
+ branch: 'main',
112
+ name: 'npm-prerelease',
113
+ requiredSecrets: Object.freeze([]),
114
+ requiredVariables: Object.freeze([]),
115
+ stage: 'production',
116
+ }), stageEnvironmentTopology('production', deploymentProfile), stageEnvironmentTopology(rehearsalStage, deploymentProfile));
117
+ return Object.freeze(topology);
165
118
  }
166
119
  function desiredEnvironmentProtection(environment, state, productionApprovalMode, productionReviewerIds, npmPrereleaseReviewerIds) {
167
- const current = state.environments[environment];
168
- const stage = environmentStage(environment);
120
+ const current = state.environments[environment.name];
121
+ const stage = environment.stage;
169
122
  const stageEnvironment = state.environments[stage];
170
- if (environment === 'npm-prerelease') {
123
+ if (environment.name === 'npm-prerelease') {
171
124
  if (productionApprovalMode === 'promotion-pr') {
172
125
  return {
173
126
  preventSelfReview: false,
@@ -189,19 +142,29 @@ function desiredEnvironmentProtection(environment, state, productionApprovalMode
189
142
  preventSelfReview: stage === 'production' &&
190
143
  productionApprovalMode === 'environment-reviewer'
191
144
  ? true
192
- : environment === stage
145
+ : environment.name === stage
193
146
  ? current.preventSelfReview
194
147
  : stageEnvironment.preventSelfReview,
195
148
  reviewers: stage === 'production' &&
196
149
  productionApprovalMode === 'environment-reviewer' &&
197
150
  productionReviewerIds.length > 0
198
151
  ? existingReviewerPayload(productionReviewerIds)
199
- : environment === stage
152
+ : environment.name === stage
200
153
  ? current.reviewers
201
154
  : stageEnvironment.reviewers,
202
- waitTimer: environment === stage ? current.waitTimer : stageEnvironment.waitTimer,
155
+ waitTimer: environment.name === stage
156
+ ? current.waitTimer
157
+ : stageEnvironment.waitTimer,
203
158
  };
204
159
  }
160
+ function requiresImmutableOidcSubjectCutover(state) {
161
+ return Boolean(state.oidcSubjectCustomization &&
162
+ (!state.oidcSubjectCustomization.useDefault ||
163
+ !state.oidcSubjectCustomization.useImmutableSubject));
164
+ }
165
+ function immutableOidcTrustAcknowledgement(identity) {
166
+ return `${GITHUB_IMMUTABLE_OIDC_TRUST_ACKNOWLEDGEMENT_PREFIX}${identity.subjectPrefix}`;
167
+ }
205
168
  const PRIVATE_ENVIRONMENT_REVIEWER_PLANS = new Set([
206
169
  'business_plus',
207
170
  'enterprise',
@@ -243,9 +206,10 @@ class GitHubApi {
243
206
  }
244
207
  throw new GitHubApiError(response.status, `GitHub ${method} ${path} failed (${response.status}): ${detail}`);
245
208
  }
246
- if (response.status === 204)
209
+ const responseBody = await response.text();
210
+ if (!responseBody)
247
211
  return undefined;
248
- return (await response.json());
212
+ return JSON.parse(responseBody);
249
213
  }
250
214
  }
251
215
  function parseRepository(repository) {
@@ -255,6 +219,58 @@ function parseRepository(repository) {
255
219
  }
256
220
  return { owner: match[1], repo: match[2] };
257
221
  }
222
+ function inspectRepositoryIdentity(repo) {
223
+ const owner = typeof repo.owner === 'object' && repo.owner !== null
224
+ ? repo.owner
225
+ : undefined;
226
+ const ownerLogin = owner?.login;
227
+ const ownerId = owner?.id;
228
+ const repositoryName = repo.name;
229
+ const repositoryId = repo.id;
230
+ const fullName = repo.full_name;
231
+ if (typeof ownerLogin !== 'string' ||
232
+ !/^[A-Za-z0-9_.-]+$/u.test(ownerLogin) ||
233
+ typeof ownerId !== 'number' ||
234
+ !Number.isSafeInteger(ownerId) ||
235
+ ownerId <= 0 ||
236
+ typeof repositoryName !== 'string' ||
237
+ !/^[A-Za-z0-9_.-]+$/u.test(repositoryName) ||
238
+ typeof repositoryId !== 'number' ||
239
+ !Number.isSafeInteger(repositoryId) ||
240
+ repositoryId <= 0 ||
241
+ typeof fullName !== 'string' ||
242
+ fullName !== `${ownerLogin}/${repositoryName}`) {
243
+ return undefined;
244
+ }
245
+ const ownerIdString = String(ownerId);
246
+ const repositoryIdString = String(repositoryId);
247
+ return {
248
+ fullName,
249
+ ownerId: ownerIdString,
250
+ repositoryId: repositoryIdString,
251
+ subjectPrefix: `repo:${ownerLogin}@${ownerIdString}/${repositoryName}@${repositoryIdString}`,
252
+ };
253
+ }
254
+ function inspectOidcSubjectCustomization(value) {
255
+ const includeClaimKeys = value.include_claim_keys;
256
+ const useDefault = value.use_default;
257
+ const useImmutableSubject = value.use_immutable_subject;
258
+ if (typeof useDefault !== 'boolean' ||
259
+ (useImmutableSubject !== undefined &&
260
+ typeof useImmutableSubject !== 'boolean') ||
261
+ (includeClaimKeys !== undefined &&
262
+ (!Array.isArray(includeClaimKeys) ||
263
+ includeClaimKeys.some((key) => typeof key !== 'string')))) {
264
+ return undefined;
265
+ }
266
+ return {
267
+ includeClaimKeys: Array.isArray(includeClaimKeys)
268
+ ? [...new Set(includeClaimKeys)].sort(deterministic_order_js_1.compareUtf16)
269
+ : [],
270
+ useDefault,
271
+ useImmutableSubject: useImmutableSubject === true,
272
+ };
273
+ }
258
274
  function asObjects(value) {
259
275
  return Array.isArray(value)
260
276
  ? value.filter((item) => typeof item === 'object' && item !== null && !Array.isArray(item))
@@ -498,9 +514,24 @@ async function inspectEnvironment(api, repositoryPath, name) {
498
514
  waitTimer: environmentWaitTimer(environment),
499
515
  };
500
516
  }
501
- async function inspect(api, repositoryPath, productionApprovalMode) {
517
+ async function inspect(api, repositoryPath, productionApprovalMode, deploymentProfile) {
502
518
  const blockers = [];
503
519
  const repo = await api.request('GET', repositoryPath);
520
+ const repositoryIdentity = inspectRepositoryIdentity(repo);
521
+ if (!repositoryIdentity) {
522
+ blockers.push('GitHub repository identity must expose one canonical full name and positive immutable owner and repository IDs.');
523
+ }
524
+ let oidcSubjectCustomization;
525
+ try {
526
+ const oidcState = await api.request('GET', `${repositoryPath}/actions/oidc/customization/sub`);
527
+ oidcSubjectCustomization = inspectOidcSubjectCustomization(oidcState);
528
+ if (!oidcSubjectCustomization) {
529
+ blockers.push('GitHub repository OIDC subject customization returned an invalid response.');
530
+ }
531
+ }
532
+ catch (error) {
533
+ blockers.push(`GitHub repository OIDC subject customization could not be inspected: ${error instanceof Error ? error.message : String(error)}`);
534
+ }
504
535
  let ownerPlanName;
505
536
  if (productionApprovalMode === 'environment-reviewer' &&
506
537
  requiresPrivateEnvironmentCapabilities(repo)) {
@@ -655,7 +686,7 @@ async function inspect(api, repositoryPath, productionApprovalMode) {
655
686
  };
656
687
  }
657
688
  };
658
- const environments = Object.fromEntries(await Promise.all(Object.keys(ENVIRONMENT_BRANCHES).map(async (name) => [name, await inspectNamedEnvironment(name)])));
689
+ const environments = Object.fromEntries(await Promise.all(githubEnvironmentTopology(deploymentProfile).map(async ({ name }) => [name, await inspectNamedEnvironment(name)])));
659
690
  return {
660
691
  blockers,
661
692
  state: {
@@ -664,10 +695,12 @@ async function inspect(api, repositoryPath, productionApprovalMode) {
664
695
  environments,
665
696
  orgSecretNames,
666
697
  orgVariableNames,
698
+ oidcSubjectCustomization,
667
699
  ownerPlanName,
668
700
  ownedRuleset: rulesets.find((ruleset) => ruleset.name === exports.EBK_PROTECTED_BRANCH_RULESET_NAME &&
669
701
  ruleset.source_type !== 'Organization'),
670
702
  repo,
703
+ repositoryIdentity,
671
704
  repositorySecretNames,
672
705
  repositoryVariableNames,
673
706
  rulesets,
@@ -694,6 +727,9 @@ function evaluate(repository, state, inspectionBlockers, productionApprovalMode,
694
727
  if (state.repo.allow_rebase_merge !== false) {
695
728
  changes.push('Disable repository rebase merging.');
696
729
  }
730
+ if (requiresImmutableOidcSubjectCutover(state)) {
731
+ changes.push(GITHUB_IMMUTABLE_OIDC_CHANGE);
732
+ }
697
733
  if (state.actionsCanApprovePullRequests !== true) {
698
734
  blockers.push('GitHub Actions is not permitted to create or approve pull requests for managed sync-back.');
699
735
  }
@@ -722,17 +758,6 @@ function evaluate(repository, state, inspectionBlockers, productionApprovalMode,
722
758
  blockers.push(`${variable} is exposed from organization variable scope instead of its protected environment.`);
723
759
  }
724
760
  }
725
- for (const variable of [
726
- ...exports.EBK_STAGING_PLAN_REPOSITORY_VARIABLES,
727
- ...exports.EBK_PRODUCTION_PLAN_REPOSITORY_VARIABLES,
728
- ]) {
729
- if (!state.repositoryVariableNames.includes(variable)) {
730
- blockers.push(`Repository variable ${variable} is required for a protected read-only plan job; bootstrap never creates variable values.`);
731
- }
732
- if (state.orgVariableNames?.includes(variable)) {
733
- blockers.push(`${variable} must be repository-bound instead of inherited from organization scope.`);
734
- }
735
- }
736
761
  for (const ruleset of state.rulesets) {
737
762
  const conflicts = conflictsWithMergeCommitContract(ruleset);
738
763
  if (conflicts.length > 0) {
@@ -746,7 +771,8 @@ function evaluate(repository, state, inspectionBlockers, productionApprovalMode,
746
771
  JSON.stringify(normalizeRuleset(desiredRuleset()))) {
747
772
  changes.push(`Update ruleset ${exports.EBK_PROTECTED_BRANCH_RULESET_NAME}.`);
748
773
  }
749
- for (const [environment, branch] of Object.entries(ENVIRONMENT_BRANCHES)) {
774
+ for (const topology of githubEnvironmentTopology(deploymentProfile)) {
775
+ const { branch, name: environment, stage } = topology;
750
776
  const current = state.environments[environment];
751
777
  if (!current.exists)
752
778
  changes.push(`Create ${environment} environment.`);
@@ -762,7 +788,7 @@ function evaluate(repository, state, inspectionBlockers, productionApprovalMode,
762
788
  if (!current.branchPolicies.some(({ name, type }) => name === branch && type === 'branch')) {
763
789
  changes.push(`Restrict ${environment} deployment to ${branch}.`);
764
790
  }
765
- const requiredSecrets = environmentSecretRequirements(environment, deploymentProfile);
791
+ const requiredSecrets = topology.requiredSecrets;
766
792
  for (const secret of requiredSecrets) {
767
793
  if (!current.secretNames.includes(secret)) {
768
794
  blockers.push(`${environment} environment is missing ${secret}; bootstrap never creates secret values.`);
@@ -773,7 +799,7 @@ function evaluate(repository, state, inspectionBlockers, productionApprovalMode,
773
799
  blockers.push(`${environment} environment exposes ${secret} outside its exact capability boundary.`);
774
800
  }
775
801
  }
776
- const requiredVariables = environmentVariableRequirements(environment, deploymentProfile);
802
+ const requiredVariables = topology.requiredVariables;
777
803
  for (const variable of requiredVariables) {
778
804
  if (!current.variableNames.includes(variable)) {
779
805
  blockers.push(`${environment} environment is missing required variable ${variable}; bootstrap never creates variable values.`);
@@ -784,9 +810,8 @@ function evaluate(repository, state, inspectionBlockers, productionApprovalMode,
784
810
  blockers.push(`${environment} environment exposes ${variable} outside its exact capability boundary.`);
785
811
  }
786
812
  }
787
- const stage = environmentStage(environment);
788
813
  if (environment !== stage) {
789
- const desired = desiredEnvironmentProtection(environment, state, productionApprovalMode, productionReviewerIds, npmPrereleaseReviewerIds);
814
+ const desired = desiredEnvironmentProtection(topology, state, productionApprovalMode, productionReviewerIds, npmPrereleaseReviewerIds);
790
815
  if (environment === 'npm-prerelease' &&
791
816
  productionApprovalMode === 'environment-reviewer' &&
792
817
  desired.reviewers.length === 0) {
@@ -828,8 +853,9 @@ function evaluate(repository, state, inspectionBlockers, productionApprovalMode,
828
853
  }
829
854
  }
830
855
  }
831
- if (state.environments.staging.reviewers.length > 0) {
832
- warnings.push('Staging has additional reviewer protection; bootstrap will preserve it.');
856
+ const rehearsalStage = deploymentProfile === 'starter' ? 'development' : 'staging';
857
+ if (state.environments[rehearsalStage].reviewers.length > 0) {
858
+ warnings.push(`${rehearsalStage === 'development' ? 'Development' : 'Staging'} has additional reviewer protection; bootstrap will preserve it.`);
833
859
  }
834
860
  return {
835
861
  blockers: [...new Set(blockers)].sort(),
@@ -837,6 +863,9 @@ function evaluate(repository, state, inspectionBlockers, productionApprovalMode,
837
863
  deploymentProfile,
838
864
  ready: blockers.length === 0 && changes.length === 0,
839
865
  repository,
866
+ ...(state.repositoryIdentity
867
+ ? { repositoryIdentity: state.repositoryIdentity }
868
+ : {}),
840
869
  productionApprovalMode,
841
870
  warnings: [...new Set(warnings)].sort(),
842
871
  };
@@ -902,7 +931,10 @@ function rulesetMatchesDesired(ruleset) {
902
931
  return (JSON.stringify(normalizeRuleset(ruleset)) ===
903
932
  JSON.stringify(normalizeRuleset(desiredRuleset())));
904
933
  }
905
- async function applyChanges(api, repositoryPath, state, productionApprovalMode, productionReviewerIds, npmPrereleaseReviewerIds) {
934
+ async function applyChanges(api, repositoryPath, state, productionApprovalMode, productionReviewerIds, npmPrereleaseReviewerIds, deploymentProfile) {
935
+ if (requiresImmutableOidcSubjectCutover(state)) {
936
+ await api.request('PUT', `${repositoryPath}/actions/oidc/customization/sub`, { use_default: true, use_immutable_subject: true });
937
+ }
906
938
  if (state.repo.allow_merge_commit !== true ||
907
939
  state.repo.allow_rebase_merge !== false ||
908
940
  state.repo.allow_squash_merge !== false) {
@@ -921,10 +953,10 @@ async function applyChanges(api, repositoryPath, state, productionApprovalMode,
921
953
  else if (!state.ownedRuleset) {
922
954
  await api.request('POST', `${repositoryPath}/rulesets`, desired);
923
955
  }
924
- for (const [environment, branch] of Object.entries(ENVIRONMENT_BRANCHES)) {
956
+ for (const topology of githubEnvironmentTopology(deploymentProfile)) {
957
+ const { branch, name: environment, stage } = topology;
925
958
  const current = state.environments[environment];
926
- const stage = environmentStage(environment);
927
- const desiredProtection = desiredEnvironmentProtection(environment, state, productionApprovalMode, productionReviewerIds, npmPrereleaseReviewerIds);
959
+ const desiredProtection = desiredEnvironmentProtection(topology, state, productionApprovalMode, productionReviewerIds, npmPrereleaseReviewerIds);
928
960
  const reviewers = desiredProtection.reviewers;
929
961
  const desiredPreventSelfReview = desiredProtection.preventSelfReview;
930
962
  const desiredWaitTimer = desiredProtection.waitTimer;
@@ -990,15 +1022,25 @@ async function runGitHubBootstrap(options) {
990
1022
  }
991
1023
  const api = new GitHubApi(options.apiBaseUrl?.trim() || 'https://api.github.com', options.token);
992
1024
  const repositoryPath = `/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`;
993
- const initial = await inspect(api, repositoryPath, options.productionApprovalMode);
1025
+ const initial = await inspect(api, repositoryPath, options.productionApprovalMode, deploymentProfile);
994
1026
  const report = evaluate(repository, initial.state, initial.blockers, options.productionApprovalMode, productionReviewerIds, npmPrereleaseReviewerIds, deploymentProfile);
995
1027
  if (!options.apply)
996
1028
  return report;
997
1029
  if (report.blockers.length > 0) {
998
1030
  throw new Error(`GitHub bootstrap apply is blocked:\n- ${report.blockers.join('\n- ')}`);
999
1031
  }
1000
- await applyChanges(api, repositoryPath, initial.state, options.productionApprovalMode, productionReviewerIds, npmPrereleaseReviewerIds);
1001
- const completed = await inspect(api, repositoryPath, options.productionApprovalMode);
1032
+ if (requiresImmutableOidcSubjectCutover(initial.state)) {
1033
+ const identity = initial.state.repositoryIdentity;
1034
+ if (!identity) {
1035
+ throw new Error('GitHub bootstrap cannot acknowledge immutable OIDC trust without the inspected repository identity.');
1036
+ }
1037
+ const expectedAcknowledgement = immutableOidcTrustAcknowledgement(identity);
1038
+ if (options.immutableOidcTrustAcknowledgement !== expectedAcknowledgement) {
1039
+ throw new Error(`GitHub bootstrap immutable OIDC subject cutover requires the exact AWS-trust readiness acknowledgement ${JSON.stringify(expectedAcknowledgement)}. Apply the matching immutable repository-subject AWS trusts, read them back, and rerun with --immutableOidcTrustAcknowledgement=${JSON.stringify(expectedAcknowledgement)}. No GitHub settings were changed.`);
1040
+ }
1041
+ }
1042
+ await applyChanges(api, repositoryPath, initial.state, options.productionApprovalMode, productionReviewerIds, npmPrereleaseReviewerIds, deploymentProfile);
1043
+ const completed = await inspect(api, repositoryPath, options.productionApprovalMode, deploymentProfile);
1002
1044
  return evaluate(repository, completed.state, completed.blockers, options.productionApprovalMode, productionReviewerIds, npmPrereleaseReviewerIds, deploymentProfile);
1003
1045
  }
1004
1046
  //# sourceMappingURL=github-bootstrap.js.map