@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
@@ -55,7 +55,7 @@ export interface UpgradeReport {
55
55
  }
56
56
  export interface SeededReconciliationWork {
57
57
  adopterContentSha256: string;
58
- category: 'async-adapter' | 'async-settings' | 'configuration-contract' | 'configuration-values' | 'feature-controls' | 'frontend-contract' | 'frontend-security' | 'performance-aggregate-provider' | 'performance-policy' | 'reliability-operations' | 'reliability-slo' | 'release-controls';
58
+ category: 'async-adapter' | 'async-settings' | 'configuration-contract' | 'configuration-values' | 'feature-controls' | 'frontend-contract' | 'frontend-security' | 'performance-aggregate-provider' | 'performance-policy' | 'reliability-operations' | 'reliability-slo' | 'release-controls' | 'secret-contract';
59
59
  currentFrameworkSha256: string | null;
60
60
  implications: string[];
61
61
  markerReference: 'PLAN:5.6/seeded-upgrade-reconciliation';
@@ -13,7 +13,6 @@ const node_crypto_1 = require("node:crypto");
13
13
  const node_fs_1 = require("node:fs");
14
14
  const node_path_1 = require("node:path");
15
15
  const node_util_1 = require("node:util");
16
- const prettier_1 = require("prettier");
17
16
  const yaml_1 = require("yaml");
18
17
  const index_js_1 = require("../../blueprints/index.js");
19
18
  const index_js_2 = require("../../api-contract/index.js");
@@ -26,12 +25,23 @@ const tool_versions_js_1 = require("../preset/tool-versions.js");
26
25
  const workspace_files_js_1 = require("../preset/workspace-files.js");
27
26
  const built_in_plan_js_1 = require("../slice/built-in-plan.js");
28
27
  const workload_js_1 = require("../workload/workload.js");
28
+ const formatting_js_1 = require("../formatting.js");
29
29
  const git_inspection_js_1 = require("../../developer-agent/git-inspection.js");
30
30
  const context_js_1 = require("../../developer-agent/context.js");
31
31
  const model_js_1 = require("../../developer-agent/model.js");
32
32
  const preview_source_js_1 = require("../../developer-agent/preview-source.js");
33
33
  const preview_changes_js_1 = require("../../developer-agent/preview-changes.js");
34
34
  const validation_js_1 = require("../../developer-agent/validation.js");
35
+ const tree_policy_js_1 = require("../repository-policy/tree-policy.js");
36
+ function readRepositoryDeploymentRenderingOptions(tree) {
37
+ const policy = (0, tree_policy_js_1.readRepositoryOperatingPolicyFromTree)(tree);
38
+ return {
39
+ deploymentAccounts: policy.deploymentAccounts,
40
+ deploymentProfile: policy.deploymentProfile,
41
+ deploymentRegion: policy.deploymentRegion,
42
+ workspaceDeploymentId: policy.workspaceDeploymentId,
43
+ };
44
+ }
35
45
  function requireTargetCompositionFeatures(files, ownership) {
36
46
  if (ownership.compositions.length === 0)
37
47
  return;
@@ -355,9 +365,29 @@ const SEEDED_RECONCILIATION = {
355
365
  'journey-authority',
356
366
  ],
357
367
  },
368
+ 'secrets/declarations.ts': {
369
+ category: 'secret-contract',
370
+ implications: [
371
+ 'generation-authority',
372
+ 'secret-value-ownership',
373
+ 'stage-requirements',
374
+ ],
375
+ },
376
+ 'secrets/metadata.json': {
377
+ category: 'secret-contract',
378
+ implications: ['logical-identity', 'management-class', 'registry-schema'],
379
+ },
380
+ 'secrets/workload-access.json': {
381
+ category: 'secret-contract',
382
+ implications: [
383
+ 'logical-identity',
384
+ 'runtime-secret-linkage',
385
+ 'workload-iam',
386
+ ],
387
+ },
358
388
  };
359
389
  const SEEDED_RECONCILIATION_MARKER_REFERENCE = 'PLAN:5.6/seeded-upgrade-reconciliation';
360
- const SEEDED_RECONCILIATION_MARKER = '// EBK-TODO(PLAN:5.6/seeded-upgrade-reconciliation): Review retained seeded async, configuration, feature, frontend, performance, reliability, and release decisions against this framework upgrade before protected promotion.';
390
+ const SEEDED_RECONCILIATION_MARKER = '// EBK-TODO(PLAN:5.6/seeded-upgrade-reconciliation): Review retained seeded async, configuration, feature, frontend, performance, reliability, release, and secret decisions against this framework upgrade before protected promotion.';
361
391
  const SEEDED_RECONCILIATION_MARKER_ANCHOR = 'async/recovery-adapters.ts';
362
392
  const DEVELOPER_AGENT_AGENTS_HEADING = '## Developer-Agent workflow';
363
393
  function developerAgentAgentsAppendix(renderedAgents) {
@@ -431,8 +461,8 @@ const COMPOSITION_REGIONS = [
431
461
  'workload-registrations',
432
462
  'function-registrations',
433
463
  'composition-outputs',
434
- 'workload-role-extensions',
435
- 'workload-role-intent-contributions',
464
+ 'native-runtime-extensions',
465
+ 'native-runtime-intent-contributions',
436
466
  ];
437
467
  function preserveCompositionRegions(current, target) {
438
468
  let merged = target;
@@ -457,29 +487,117 @@ function preserveCompositionRegions(current, target) {
457
487
  }
458
488
  return merged;
459
489
  }
460
- function reconcileFunctionRegistrationRouterArguments(source, ownership) {
490
+ function countExact(source, value) {
491
+ return source.split(value).length - 1;
492
+ }
493
+ function escapeRegularExpression(value) {
494
+ return value.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
495
+ }
496
+ function exactIndentedStringCallMatches(source, callee, argument) {
497
+ const pattern = new RegExp(`^ ${escapeRegularExpression(callee)}\\(\\s*(['"])${escapeRegularExpression(argument)}\\1\\s*,?\\s*\\),[ \\t]*$`, 'gmu');
498
+ return [...source.matchAll(pattern)];
499
+ }
500
+ function reconcileFunctionRegistrationArguments(source, ownership) {
461
501
  let reconciled = source;
462
502
  for (const composition of ownership.compositions) {
463
503
  if (composition.kind !== 'function')
464
504
  continue;
465
505
  const { register } = (0, function_js_1.createFunctionFilePlan)('unused-workspace', ownership.slice, composition.name, composition.feature);
466
- const previous = ` ${register}(\n api,\n foundation.discovery.alertTopicArn,`;
467
- const current = ` ${register}(\n api,\n foundation.router,\n foundation.discovery.alertTopicArn,`;
468
- const previousCount = reconciled.split(previous).length - 1;
469
- const currentCount = reconciled.split(current).length - 1;
470
- if (previousCount === 1 && currentCount === 0) {
471
- reconciled = reconciled.replace(previous, current);
472
- continue;
506
+ const registrationStart = ` ${register}(\n`;
507
+ if (countExact(reconciled, registrationStart) !== 1) {
508
+ throw new Error(`Retained Function ${composition.name} registration does not expose one exact Router argument shape.`);
473
509
  }
474
- if (previousCount === 0 && currentCount === 1)
475
- continue;
476
- throw new Error(`Retained Function ${composition.name} registration does not expose one exact Router argument shape.`);
510
+ const start = reconciled.indexOf(registrationStart);
511
+ const registrationEnd = '\n );';
512
+ const end = reconciled.indexOf(registrationEnd, start);
513
+ if (end < 0) {
514
+ throw new Error(`Retained Function ${composition.name} registration does not expose one exact Router argument shape.`);
515
+ }
516
+ let registration = reconciled.slice(start, end + registrationEnd.length);
517
+ if (registration.length > 64 * 1024) {
518
+ throw new Error(`Retained Function ${composition.name} registration exceeds its bounded managed shape.`);
519
+ }
520
+ const previousRouter = `\n api,\n foundation.discovery.alertTopicArn,`;
521
+ const currentRouter = `\n api,\n foundation.router,\n foundation.discovery.alertTopicArn,`;
522
+ const previousRouterCount = countExact(registration, previousRouter);
523
+ const currentRouterCount = countExact(registration, currentRouter);
524
+ if (previousRouterCount === 1 && currentRouterCount === 0) {
525
+ registration = registration.replace(previousRouter, currentRouter);
526
+ }
527
+ else if (!(previousRouterCount === 0 && currentRouterCount === 1)) {
528
+ throw new Error(`Retained Function ${composition.name} registration does not expose one exact Router argument shape.`);
529
+ }
530
+ const previousAuthorityMatches = exactIndentedStringCallMatches(registration, 'workloadRoleBindings?.extension.function', composition.name);
531
+ const currentAuthorityMatches = exactIndentedStringCallMatches(registration, 'nativeAuthority.permissions', `${composition.name}-function`);
532
+ if (previousAuthorityMatches.length === 1 &&
533
+ currentAuthorityMatches.length === 0) {
534
+ const [previousAuthority] = previousAuthorityMatches;
535
+ const authorityIndex = previousAuthority.index;
536
+ if (authorityIndex === undefined) {
537
+ throw new Error(`Retained Function ${composition.name} registration authority is not position-bound.`);
538
+ }
539
+ const currentAuthority = ` nativeAuthority.permissions('${composition.name}-function'),`;
540
+ registration =
541
+ registration.slice(0, authorityIndex) +
542
+ currentAuthority +
543
+ registration.slice(authorityIndex + previousAuthority[0].length);
544
+ }
545
+ else if (!(previousAuthorityMatches.length === 0 &&
546
+ currentAuthorityMatches.length === 1)) {
547
+ throw new Error(`Retained Function ${composition.name} registration does not expose one exact native-authority argument shape.`);
548
+ }
549
+ reconciled =
550
+ reconciled.slice(0, start) +
551
+ registration +
552
+ reconciled.slice(end + registrationEnd.length);
477
553
  }
478
554
  return reconciled;
479
555
  }
480
556
  function json(value) {
481
557
  return `${JSON.stringify(value, null, 2)}\n`;
482
558
  }
559
+ const DERIVED_API_ARTIFACT_PATHS = [
560
+ 'api/generated/contract.json',
561
+ 'api/generated/openapi.json',
562
+ ];
563
+ function preserveBuiltInDerivedApiArtifacts(tree, root, currentOwnership, targetFiles) {
564
+ const sourceEntry = currentOwnership.paths.find(({ path }) => path === 'api/contracts/protected.ts');
565
+ const source = tree.read(node_path_1.posix.join(root, 'api/contracts/protected.ts'), 'utf8');
566
+ if (sourceEntry?.mode !== 'seeded' || source === null)
567
+ return targetFiles;
568
+ const currentEntries = new Map(currentOwnership.paths.map((entry) => [entry.path, entry]));
569
+ const artifacts = DERIVED_API_ARTIFACT_PATHS.map((path) => ({
570
+ current: tree.read(node_path_1.posix.join(root, path), 'utf8'),
571
+ entry: currentEntries.get(path),
572
+ path,
573
+ }));
574
+ const missing = artifacts
575
+ .filter(({ current }) => current === null)
576
+ .map(({ path }) => path);
577
+ if (missing.length > 0) {
578
+ throw new Error(`Built-in Product Slice ${currentOwnership.slice} is missing derived managed API artifacts:\n${missing.map((path) => `- ${path}`).join('\n')}\nRun pnpm nx run ${currentOwnership.slice}:api-contract-generate before upgrading.`);
579
+ }
580
+ const completeCleanPair = artifacts.every(({ current, entry }) => current !== null &&
581
+ entry?.mode === 'managed' &&
582
+ entry.origin === 'blueprint' &&
583
+ entry.managedJsonPointers === undefined &&
584
+ (0, index_js_4.hashOwnedContent)(current, entry) === entry.sha256);
585
+ if (!completeCleanPair)
586
+ return targetFiles;
587
+ const retained = { ...targetFiles };
588
+ for (const { current, path } of artifacts) {
589
+ if (current === null) {
590
+ throw new Error(`Derived managed API artifact disappeared: ${path}.`);
591
+ }
592
+ // The built-in API artifacts are derived from the seeded TypeScript
593
+ // contract. An upgrade preserves that adopter-owned source, so rendering
594
+ // fresh artifacts from the uncustomized Blueprint would make the managed
595
+ // output disagree with its authority. The explicit api-contract-generate
596
+ // target remains the only operation that recompiles and restamps them.
597
+ retained[path] = current;
598
+ }
599
+ return retained;
600
+ }
483
601
  function upgradeConflictMessage(label, report) {
484
602
  const ownershipDetails = [
485
603
  ...report.conflictingJsonMembers.map((member) => `- conflicting JSON ownership claim: ${member}`),
@@ -490,26 +608,19 @@ function upgradeConflictMessage(label, report) {
490
608
  function seededMigrationUpgradeMessage(label, report) {
491
609
  return `${label} upgrade cannot rewrite an existing seeded database migration:\n${report.incompatibleSeededMigrations.map((path) => `- ${path}`).join('\n')}\nRegenerate this prerelease workspace instead. Stable-v1 upgrades must add a new migration rather than rewrite migration history.`;
492
610
  }
493
- async function formatRenderedFiles(files, prefix = '') {
494
- const canonicalApiArtifacts = new Set([
495
- 'api/generated/baseline.json',
496
- 'api/generated/contract.json',
497
- 'api/generated/openapi.json',
498
- ]);
611
+ async function formatRenderedFiles(tree, files, prefix = '') {
612
+ const changedOptions = (0, formatting_js_1.changedTreePrettierOptions)(tree);
499
613
  return Object.fromEntries(await Promise.all(Object.entries(files).map(async ([path, contents]) => {
500
614
  const workspacePath = node_path_1.posix.join(prefix, path);
501
- if (canonicalApiArtifacts.has(path) ||
502
- (0, workspace_files_js_1.isRawWorkspaceAuthorityPath)(workspacePath) ||
503
- path.startsWith('database/migrations/')) {
615
+ if ((0, built_in_plan_js_1.isBuiltInSliceFormatSensitivePath)(path) ||
616
+ (0, workspace_files_js_1.isRawWorkspaceAuthorityPath)(workspacePath)) {
504
617
  return [path, contents];
505
618
  }
506
619
  try {
620
+ const options = await (0, formatting_js_1.effectiveTreePrettierOptions)(tree, workspacePath, changedOptions);
507
621
  return [
508
622
  path,
509
- await (0, prettier_1.format)(contents, {
510
- filepath: workspacePath,
511
- singleQuote: true,
512
- }),
623
+ await (0, formatting_js_1.formatTreeContentsToFixedPoint)(contents, options, workspacePath),
513
624
  ];
514
625
  }
515
626
  catch {
@@ -517,6 +628,12 @@ async function formatRenderedFiles(files, prefix = '') {
517
628
  }
518
629
  })));
519
630
  }
631
+ async function formatOwnershipRecord(tree, path, label) {
632
+ if (!tree.exists(path)) {
633
+ throw new Error(`${label} ownership metadata is missing at ${path}.`);
634
+ }
635
+ await (0, formatting_js_1.formatTreeFileToFixedPoint)(tree, path);
636
+ }
520
637
  function readJson(tree, path, label) {
521
638
  const contents = tree.read(path, 'utf8');
522
639
  if (contents === null)
@@ -870,6 +987,22 @@ function mergeStructuredTargetFiles(currentFiles, currentOwnership, targetFiles,
870
987
  }
871
988
  return { files, ...changes };
872
989
  }
990
+ async function formatMergedManagedJsonFiles(tree, root, merge, ownership) {
991
+ const files = new Map(merge.files);
992
+ const changedOptions = (0, formatting_js_1.changedTreePrettierOptions)(tree);
993
+ await Promise.all(ownership.paths.map(async (entry) => {
994
+ if (entry.mode !== 'managed' || !entry.managedJsonPointers)
995
+ return;
996
+ const contents = files.get(entry.path);
997
+ if (contents === undefined) {
998
+ throw new Error(`Target did not render managed JSON ${entry.path}.`);
999
+ }
1000
+ const workspacePath = node_path_1.posix.join(root, entry.path);
1001
+ const options = await (0, formatting_js_1.effectiveTreePrettierOptions)(tree, workspacePath, changedOptions);
1002
+ files.set(entry.path, await (0, formatting_js_1.formatTreeContentsToFixedPoint)(contents, options, workspacePath));
1003
+ }));
1004
+ return { ...merge, files };
1005
+ }
873
1006
  function renderCompositionUpgradePlan(ownership, workspace, runtimeVersion, serviceAdapterOwner) {
874
1007
  const compositionPaths = ownership.paths.filter(({ origin }) => origin === 'composition');
875
1008
  const files = {};
@@ -950,10 +1083,15 @@ function retainedServiceAdapterOwner(tree, root, ownership) {
950
1083
  const serviceScenario = serviceScenarios[0];
951
1084
  const secretAccess = readJson(tree, node_path_1.posix.join(root, 'secrets/workload-access.json'), 'Product Slice secret workload access registry');
952
1085
  const bindings = record(secretAccess) ? secretAccess['bindings'] : undefined;
953
- const logicalName = `${ownership.slice
1086
+ const logicalName = 'GeneratedPerformanceLoadHmacKeys';
1087
+ const prereleaseLogicalName = `${ownership.slice
954
1088
  .split('-')
955
1089
  .map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)
956
1090
  .join('')}PerformanceLoadHmacKeys`;
1091
+ if (Array.isArray(bindings) &&
1092
+ bindings.some((binding) => record(binding) && binding['logicalName'] === prereleaseLogicalName)) {
1093
+ throw new Error(`Product Slice ${ownership.slice} still uses the prerelease operator HMAC declaration ${prereleaseLogicalName}. Regenerate the prerelease Slice or reconcile secrets/declarations.ts, secrets/metadata.json, and secrets/workload-access.json to GeneratedPerformanceLoadHmacKeys under a reviewed adoption ledger entry before rerunning the upgrade; no automatic prerelease migration is provided.`);
1094
+ }
957
1095
  const protectedLoadBindings = Array.isArray(bindings)
958
1096
  ? bindings.filter((binding) => record(binding) &&
959
1097
  binding['logicalName'] === logicalName &&
@@ -1035,13 +1173,15 @@ async function upgradeFoundation(tree, options, packageJson, output) {
1035
1173
  throw new Error('Workspace package.json must declare a name.');
1036
1174
  }
1037
1175
  const currentOwnership = ownershipResult.value;
1176
+ const deployment = readRepositoryDeploymentRenderingOptions(tree);
1038
1177
  const renderedTarget = (0, workspace_files_js_1.renderFoundationFilePlan)({
1178
+ ...deployment,
1039
1179
  frameworkVersion: (0, generator_js_1.frameworkPackageVersion)(),
1040
1180
  name: packageJson.name,
1041
1181
  });
1042
1182
  const target = {
1043
1183
  ...renderedTarget,
1044
- files: await formatRenderedFiles(renderedTarget.files, root),
1184
+ files: await formatRenderedFiles(tree, renderedTarget.files, root),
1045
1185
  };
1046
1186
  const targetValidation = (0, index_js_4.validateFoundationOwnershipRecord)(target.ownership);
1047
1187
  if (!targetValidation.valid) {
@@ -1057,7 +1197,8 @@ async function upgradeFoundation(tree, options, packageJson, output) {
1057
1197
  path,
1058
1198
  tree.read(node_path_1.posix.join(root, path), 'utf8'),
1059
1199
  ]));
1060
- const mergedTarget = mergeStructuredTargetFiles(currentFiles, currentOwnership, new Map(Object.entries(target.files)), target.ownership);
1200
+ let mergedTarget = mergeStructuredTargetFiles(currentFiles, currentOwnership, new Map(Object.entries(target.files)), target.ownership);
1201
+ mergedTarget = await formatMergedManagedJsonFiles(tree, root, mergedTarget, target.ownership);
1061
1202
  const report = createUpgradeReport(currentFiles, currentOwnership, mergedTarget.files, target.ownership, mergedTarget);
1062
1203
  output.info(`[ebk-upgrade] foundation ${currentOwnership.frameworkVersion} -> ${target.ownership.frameworkVersion}\n${JSON.stringify(report, null, 2)}`);
1063
1204
  if (!options.apply)
@@ -1083,9 +1224,10 @@ async function upgradeFoundation(tree, options, packageJson, output) {
1083
1224
  }
1084
1225
  tree.write(node_path_1.posix.join(root, path), contents);
1085
1226
  }
1086
- if (!options.skipFormat)
1087
- await (0, devkit_1.formatFiles)(tree);
1088
1227
  (0, index_js_4.restampFoundationOwnership)(tree);
1228
+ if (!options.skipFormat) {
1229
+ await formatOwnershipRecord(tree, node_path_1.posix.join(root, '.ebk/ownership.json'), 'Standard Foundation');
1230
+ }
1089
1231
  }
1090
1232
  async function upgradeWorkspace(tree, options, packageJson, output) {
1091
1233
  if (options.blueprint !== undefined || options.inputs !== undefined) {
@@ -1100,13 +1242,15 @@ async function upgradeWorkspace(tree, options, packageJson, output) {
1100
1242
  }
1101
1243
  const sstVersionState = inspectWorkspaceSstVersion(tree, packageJson);
1102
1244
  const currentOwnership = ownershipResult.value;
1245
+ const deployment = readRepositoryDeploymentRenderingOptions(tree);
1103
1246
  const renderedTarget = (0, workspace_files_js_1.renderWorkspaceRootFilePlan)({
1247
+ ...deployment,
1104
1248
  frameworkVersion: (0, generator_js_1.frameworkPackageVersion)(),
1105
1249
  name: packageJson.name,
1106
1250
  });
1107
1251
  const target = {
1108
1252
  ...renderedTarget,
1109
- files: await formatRenderedFiles(renderedTarget.files),
1253
+ files: await formatRenderedFiles(tree, renderedTarget.files),
1110
1254
  };
1111
1255
  const targetValidation = (0, index_js_4.validateWorkspaceOwnershipRecord)(target.ownership);
1112
1256
  if (!targetValidation.valid) {
@@ -1117,7 +1261,8 @@ async function upgradeWorkspace(tree, options, packageJson, output) {
1117
1261
  ...target.ownership.paths.map(({ path }) => path),
1118
1262
  ]);
1119
1263
  const currentFiles = new Map([...allPaths].map((path) => [path, tree.read(path, 'utf8')]));
1120
- const mergedTarget = mergeStructuredTargetFiles(currentFiles, currentOwnership, new Map(Object.entries(target.files)), target.ownership);
1264
+ let mergedTarget = mergeStructuredTargetFiles(currentFiles, currentOwnership, new Map(Object.entries(target.files)), target.ownership);
1265
+ mergedTarget = await formatMergedManagedJsonFiles(tree, '', mergedTarget, target.ownership);
1121
1266
  const developerAgentInstructionAppend = planDeveloperAgentInstructionAppend(currentFiles.get('AGENTS.md') ?? null, target.files['AGENTS.md']);
1122
1267
  if (developerAgentInstructionAppend !== null) {
1123
1268
  mergedTarget.files.set(developerAgentInstructionAppend.path, developerAgentInstructionAppend.contents);
@@ -1160,17 +1305,13 @@ async function upgradeWorkspace(tree, options, packageJson, output) {
1160
1305
  }
1161
1306
  tree.write(path, contents);
1162
1307
  }
1163
- if (!options.skipFormat) {
1164
- await (0, devkit_1.formatFiles)(tree);
1165
- for (const [path, contents] of Object.entries(target.files)) {
1166
- if ((0, workspace_files_js_1.isRawWorkspaceAuthorityPath)(path))
1167
- tree.write(path, contents);
1168
- }
1169
- }
1170
1308
  if (developerAgentInstructionAppend !== null) {
1171
1309
  tree.write(developerAgentInstructionAppend.path, developerAgentInstructionAppend.contents);
1172
1310
  }
1173
1311
  (0, index_js_4.restampWorkspaceOwnership)(tree);
1312
+ if (!options.skipFormat) {
1313
+ await formatOwnershipRecord(tree, '.ebk/ownership.json', 'Workspace');
1314
+ }
1174
1315
  }
1175
1316
  async function executeUpgradeGenerator(tree, options, output = devkit_1.logger, executionOptions = {}) {
1176
1317
  const name = requireName(options.name);
@@ -1228,10 +1369,11 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
1228
1369
  let externalBlueprintDestinationPaths;
1229
1370
  const scope = workspaceScope(packageJson);
1230
1371
  if (blueprint.source === 'built-in') {
1372
+ const deployment = readRepositoryDeploymentRenderingOptions(tree);
1231
1373
  const runtimeVersion = packageJson.dependencies?.['@empire-builder-kit/runtime'];
1232
1374
  if (!runtimeVersion)
1233
1375
  throw new Error('Workspace must depend on @empire-builder-kit/runtime.');
1234
- const plan = (0, built_in_plan_js_1.createBuiltInSlicePlan)(name, scope, runtimeVersion, blueprint.manifest, inputResult.value);
1376
+ const plan = (0, built_in_plan_js_1.createBuiltInSlicePlan)(name, scope, runtimeVersion, blueprint.manifest, inputResult.value, undefined, deployment.deploymentProfile);
1235
1377
  targetFiles = Object.fromEntries(Object.entries(plan.files).map(([path, contents]) => {
1236
1378
  const current = tree.read(node_path_1.posix.join(root, path), 'utf8');
1237
1379
  return [
@@ -1329,8 +1471,9 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
1329
1471
  }
1330
1472
  targetFiles = {
1331
1473
  ...targetFiles,
1332
- [productPath]: reconcileFunctionRegistrationRouterArguments(productSource, currentOwnership),
1474
+ [productPath]: reconcileFunctionRegistrationArguments(productSource, currentOwnership),
1333
1475
  };
1476
+ targetFiles = preserveBuiltInDerivedApiArtifacts(tree, root, currentOwnership, targetFiles);
1334
1477
  }
1335
1478
  const targetPathSet = new Set(targetOwnership.paths.map(({ path }) => path));
1336
1479
  const compositionPlan = renderCompositionUpgradePlan(currentOwnership, packageJson.name ?? '', packageJson.dependencies?.['@empire-builder-kit/runtime'] ?? '', serviceAdapterOwner);
@@ -1349,7 +1492,7 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
1349
1492
  }
1350
1493
  targetFiles = { ...targetFiles, [entry.path]: contents };
1351
1494
  }
1352
- targetFiles = await formatRenderedFiles(targetFiles, root);
1495
+ targetFiles = await formatRenderedFiles(tree, targetFiles, root);
1353
1496
  targetOwnership = {
1354
1497
  ...targetOwnership,
1355
1498
  compositions: currentOwnership.compositions,
@@ -1386,7 +1529,8 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
1386
1529
  path,
1387
1530
  tree.read(node_path_1.posix.join(root, path), 'utf8'),
1388
1531
  ]));
1389
- const mergedTarget = mergeStructuredTargetFiles(currentFiles, currentOwnership, new Map(Object.entries(targetFiles)), targetOwnership);
1532
+ let mergedTarget = mergeStructuredTargetFiles(currentFiles, currentOwnership, new Map(Object.entries(targetFiles)), targetOwnership);
1533
+ mergedTarget = await formatMergedManagedJsonFiles(tree, root, mergedTarget, targetOwnership);
1390
1534
  requireTargetCompositionFeatures(mergedTarget.files, targetOwnership);
1391
1535
  const report = createUpgradeReport(currentFiles, currentOwnership, mergedTarget.files, targetOwnership, mergedTarget);
1392
1536
  output.info(`[ebk-upgrade] ${name} ${currentOwnership.blueprint.name}@${currentOwnership.blueprint.version} -> ${blueprint.manifest.name}@${blueprint.manifest.version}\n${JSON.stringify(report, null, 2)}`);
@@ -1419,10 +1563,18 @@ async function executeUpgradeGenerator(tree, options, output = devkit_1.logger,
1419
1563
  [blueprint.manifest.name]: blueprint.manifest.version,
1420
1564
  };
1421
1565
  tree.write('package.json', json(packageJson));
1566
+ if (!options.skipFormat) {
1567
+ const path = 'package.json';
1568
+ if (!tree.exists(path)) {
1569
+ throw new Error('Workspace package.json disappeared during upgrade.');
1570
+ }
1571
+ await (0, formatting_js_1.formatTreeFileToFixedPoint)(tree, path);
1572
+ }
1422
1573
  }
1423
- if (!options.skipFormat)
1424
- await (0, devkit_1.formatFiles)(tree);
1425
1574
  (0, index_js_4.restampProductSliceOwnership)(tree, name, { preserveSeeded: true });
1575
+ if (!options.skipFormat) {
1576
+ await formatOwnershipRecord(tree, node_path_1.posix.join(root, '.ebk/ownership.json'), 'Product Slice');
1577
+ }
1426
1578
  return options.skipInstall
1427
1579
  ? undefined
1428
1580
  : () => (0, devkit_1.installPackagesTask)(tree, true);