@ankhorage/infra 4.1.10 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (521) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +21 -32
  3. package/dist/cli/bin.d.ts +1 -8
  4. package/dist/cli/bin.d.ts.map +1 -1
  5. package/dist/cli/bin.js +2 -34
  6. package/dist/cli/bin.js.map +1 -1
  7. package/dist/cli/commands/destroy.d.ts +11 -0
  8. package/dist/cli/commands/destroy.d.ts.map +1 -0
  9. package/dist/cli/commands/destroy.js +51 -0
  10. package/dist/cli/commands/destroy.js.map +1 -0
  11. package/dist/cli/commands/down.d.ts +11 -0
  12. package/dist/cli/commands/down.d.ts.map +1 -0
  13. package/dist/cli/commands/down.js +27 -0
  14. package/dist/cli/commands/down.js.map +1 -0
  15. package/dist/cli/commands/generate.d.ts +11 -0
  16. package/dist/cli/commands/generate.d.ts.map +1 -0
  17. package/dist/cli/commands/generate.js +29 -0
  18. package/dist/cli/commands/generate.js.map +1 -0
  19. package/dist/cli/commands/outputs.d.ts +11 -0
  20. package/dist/cli/commands/outputs.d.ts.map +1 -0
  21. package/dist/cli/commands/outputs.js +25 -0
  22. package/dist/cli/commands/outputs.js.map +1 -0
  23. package/dist/cli/commands/plan.d.ts +11 -0
  24. package/dist/cli/commands/plan.d.ts.map +1 -0
  25. package/dist/cli/commands/plan.js +19 -0
  26. package/dist/cli/commands/plan.js.map +1 -0
  27. package/dist/cli/commands/status.d.ts +11 -0
  28. package/dist/cli/commands/status.d.ts.map +1 -0
  29. package/dist/cli/commands/status.js +19 -0
  30. package/dist/cli/commands/status.js.map +1 -0
  31. package/dist/cli/commands/up.d.ts +11 -0
  32. package/dist/cli/commands/up.d.ts.map +1 -0
  33. package/dist/cli/commands/up.js +28 -0
  34. package/dist/cli/commands/up.js.map +1 -0
  35. package/dist/cli/commands/validate.d.ts +11 -0
  36. package/dist/cli/commands/validate.d.ts.map +1 -0
  37. package/dist/cli/commands/validate.js +19 -0
  38. package/dist/cli/commands/validate.js.map +1 -0
  39. package/dist/cli/constants.d.ts +66 -0
  40. package/dist/cli/constants.d.ts.map +1 -0
  41. package/dist/cli/constants.js +19 -0
  42. package/dist/cli/constants.js.map +1 -0
  43. package/dist/cli/createDefaultInfraCommandContext.d.ts +4 -0
  44. package/dist/cli/createDefaultInfraCommandContext.d.ts.map +1 -0
  45. package/dist/{commandContext.js → cli/createDefaultInfraCommandContext.js} +4 -3
  46. package/dist/cli/createDefaultInfraCommandContext.js.map +1 -0
  47. package/dist/cli/createInfraRuntimeProvider.d.ts +5 -0
  48. package/dist/cli/createInfraRuntimeProvider.d.ts.map +1 -0
  49. package/dist/cli/createInfraRuntimeProvider.js +22 -0
  50. package/dist/cli/createInfraRuntimeProvider.js.map +1 -0
  51. package/dist/cli/createProviderCommandDescriptors.d.ts +4 -0
  52. package/dist/cli/createProviderCommandDescriptors.d.ts.map +1 -0
  53. package/dist/cli/createProviderCommandDescriptors.js +6 -0
  54. package/dist/cli/createProviderCommandDescriptors.js.map +1 -0
  55. package/dist/cli/findInfraCommand.d.ts +4 -0
  56. package/dist/cli/findInfraCommand.d.ts.map +1 -0
  57. package/dist/cli/findInfraCommand.js +6 -0
  58. package/dist/cli/findInfraCommand.js.map +1 -0
  59. package/dist/cli/index.d.ts +3 -8
  60. package/dist/cli/index.d.ts.map +1 -1
  61. package/dist/cli/index.js +2 -24
  62. package/dist/cli/index.js.map +1 -1
  63. package/dist/cli/renderInfraRootHelp.d.ts +3 -0
  64. package/dist/cli/renderInfraRootHelp.d.ts.map +1 -0
  65. package/dist/cli/renderInfraRootHelp.js +21 -0
  66. package/dist/cli/renderInfraRootHelp.js.map +1 -0
  67. package/dist/cli/renderUnknownInfraCommand.d.ts +3 -0
  68. package/dist/cli/renderUnknownInfraCommand.d.ts.map +1 -0
  69. package/dist/cli/renderUnknownInfraCommand.js +5 -0
  70. package/dist/cli/renderUnknownInfraCommand.js.map +1 -0
  71. package/dist/cli/runInfraCliAsync.d.ts +10 -0
  72. package/dist/cli/runInfraCliAsync.d.ts.map +1 -0
  73. package/dist/cli/runInfraCliAsync.js +34 -0
  74. package/dist/cli/runInfraCliAsync.js.map +1 -0
  75. package/dist/cli/runInfraCommandAsync.d.ts +4 -0
  76. package/dist/cli/runInfraCommandAsync.d.ts.map +1 -0
  77. package/dist/cli/runInfraCommandAsync.js +100 -0
  78. package/dist/cli/runInfraCommandAsync.js.map +1 -0
  79. package/dist/cli/utils/prepareInfraCommandOperationAsync.d.ts +4 -0
  80. package/dist/cli/utils/prepareInfraCommandOperationAsync.d.ts.map +1 -0
  81. package/dist/cli/utils/prepareInfraCommandOperationAsync.js +45 -0
  82. package/dist/cli/utils/prepareInfraCommandOperationAsync.js.map +1 -0
  83. package/dist/cli/utils/requireInfraSuccess.d.ts +7 -0
  84. package/dist/cli/utils/requireInfraSuccess.d.ts.map +1 -0
  85. package/dist/cli/utils/requireInfraSuccess.js +17 -0
  86. package/dist/cli/utils/requireInfraSuccess.js.map +1 -0
  87. package/dist/cli/utils/resolveInfraPersistence.d.ts +4 -0
  88. package/dist/cli/utils/resolveInfraPersistence.d.ts.map +1 -0
  89. package/dist/cli/utils/resolveInfraPersistence.js +17 -0
  90. package/dist/cli/utils/resolveInfraPersistence.js.map +1 -0
  91. package/dist/cli/utils/writeInfraEnvironmentOutputs.d.ts +5 -0
  92. package/dist/cli/utils/writeInfraEnvironmentOutputs.d.ts.map +1 -0
  93. package/dist/cli/utils/writeInfraEnvironmentOutputs.js +16 -0
  94. package/dist/cli/utils/writeInfraEnvironmentOutputs.js.map +1 -0
  95. package/dist/cli/utils/writeInfraStructured.d.ts +4 -0
  96. package/dist/cli/utils/writeInfraStructured.d.ts.map +1 -0
  97. package/dist/cli/utils/writeInfraStructured.js +8 -0
  98. package/dist/cli/utils/writeInfraStructured.js.map +1 -0
  99. package/dist/constants.d.ts +10 -0
  100. package/dist/constants.d.ts.map +1 -0
  101. package/dist/{packageMetadata.js → constants.js} +6 -3
  102. package/dist/constants.js.map +1 -0
  103. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.d.ts +4 -0
  104. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.d.ts.map +1 -0
  105. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.js +35 -0
  106. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.js.map +1 -0
  107. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.d.ts +4 -0
  108. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.d.ts.map +1 -0
  109. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.js +23 -0
  110. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.js.map +1 -0
  111. package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.d.ts +4 -0
  112. package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.d.ts.map +1 -0
  113. package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.js +9 -0
  114. package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.js.map +1 -0
  115. package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.d.ts +5 -0
  116. package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.d.ts.map +1 -0
  117. package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.js +28 -0
  118. package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.js.map +1 -0
  119. package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.d.ts +4 -0
  120. package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.d.ts.map +1 -0
  121. package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.js +7 -0
  122. package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.js.map +1 -0
  123. package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.d.ts +7 -0
  124. package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.d.ts.map +1 -0
  125. package/dist/{project.js → features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.js} +10 -34
  126. package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.js.map +1 -0
  127. package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.d.ts +5 -0
  128. package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.d.ts.map +1 -0
  129. package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.js +28 -0
  130. package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.js.map +1 -0
  131. package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.d.ts +4 -0
  132. package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.d.ts.map +1 -0
  133. package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.js +16 -0
  134. package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.js.map +1 -0
  135. package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.d.ts +9 -0
  136. package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.d.ts.map +1 -0
  137. package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.js +2 -0
  138. package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.js.map +1 -0
  139. package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.d.ts +4 -0
  140. package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.d.ts.map +1 -0
  141. package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.js +15 -0
  142. package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.js.map +1 -0
  143. package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.d.ts +4 -0
  144. package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.d.ts.map +1 -0
  145. package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.js +84 -0
  146. package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.js.map +1 -0
  147. package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.d.ts +4 -0
  148. package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.d.ts.map +1 -0
  149. package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.js +55 -0
  150. package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.js.map +1 -0
  151. package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.d.ts +4 -0
  152. package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.d.ts.map +1 -0
  153. package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.js +38 -0
  154. package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.js.map +1 -0
  155. package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.d.ts +4 -0
  156. package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.d.ts.map +1 -0
  157. package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.js +34 -0
  158. package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.js.map +1 -0
  159. package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.d.ts +4 -0
  160. package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.d.ts.map +1 -0
  161. package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.js +57 -0
  162. package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.js.map +1 -0
  163. package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.d.ts +5 -0
  164. package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.d.ts.map +1 -0
  165. package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.js +109 -0
  166. package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.js.map +1 -0
  167. package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.d.ts +6 -0
  168. package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.d.ts.map +1 -0
  169. package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.js +181 -0
  170. package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.js.map +1 -0
  171. package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.d.ts +4 -0
  172. package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.d.ts.map +1 -0
  173. package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.js +68 -0
  174. package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.js.map +1 -0
  175. package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.d.ts +4 -0
  176. package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.d.ts.map +1 -0
  177. package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.js +98 -0
  178. package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.js.map +1 -0
  179. package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.d.ts +5 -0
  180. package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.d.ts.map +1 -0
  181. package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.js +17 -0
  182. package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.js.map +1 -0
  183. package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.d.ts +4 -0
  184. package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.d.ts.map +1 -0
  185. package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.js +13 -0
  186. package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.js.map +1 -0
  187. package/dist/features/environment-lifecycle/composition/createInfraCommandServices.d.ts +4 -0
  188. package/dist/features/environment-lifecycle/composition/createInfraCommandServices.d.ts.map +1 -0
  189. package/dist/features/environment-lifecycle/composition/createInfraCommandServices.js +43 -0
  190. package/dist/features/environment-lifecycle/composition/createInfraCommandServices.js.map +1 -0
  191. package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.d.ts +4 -0
  192. package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.d.ts.map +1 -0
  193. package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.js +54 -0
  194. package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.js.map +1 -0
  195. package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.d.ts +5 -0
  196. package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.d.ts.map +1 -0
  197. package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.js +39 -0
  198. package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.js.map +1 -0
  199. package/dist/features/environment-lifecycle/utils/appendInfraFailure.d.ts +7 -0
  200. package/dist/features/environment-lifecycle/utils/appendInfraFailure.d.ts.map +1 -0
  201. package/dist/features/environment-lifecycle/utils/appendInfraFailure.js +5 -0
  202. package/dist/features/environment-lifecycle/utils/appendInfraFailure.js.map +1 -0
  203. package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.d.ts +5 -0
  204. package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.d.ts.map +1 -0
  205. package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.js +13 -0
  206. package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.js.map +1 -0
  207. package/dist/features/environment-lifecycle/utils/createInfraFailure.d.ts +4 -0
  208. package/dist/features/environment-lifecycle/utils/createInfraFailure.d.ts.map +1 -0
  209. package/dist/features/environment-lifecycle/utils/createInfraFailure.js +5 -0
  210. package/dist/features/environment-lifecycle/utils/createInfraFailure.js.map +1 -0
  211. package/dist/features/environment-lifecycle/utils/createInfraLedger.d.ts +12 -0
  212. package/dist/features/environment-lifecycle/utils/createInfraLedger.d.ts.map +1 -0
  213. package/dist/features/environment-lifecycle/utils/createInfraLedger.js +14 -0
  214. package/dist/features/environment-lifecycle/utils/createInfraLedger.js.map +1 -0
  215. package/dist/features/environment-lifecycle/utils/infraIdentityKey.d.ts +4 -0
  216. package/dist/features/environment-lifecycle/utils/infraIdentityKey.d.ts.map +1 -0
  217. package/dist/features/environment-lifecycle/utils/infraIdentityKey.js +5 -0
  218. package/dist/features/environment-lifecycle/utils/infraIdentityKey.js.map +1 -0
  219. package/dist/features/environment-lifecycle/utils/isInfraStoredState.d.ts +4 -0
  220. package/dist/features/environment-lifecycle/utils/isInfraStoredState.d.ts.map +1 -0
  221. package/dist/features/environment-lifecycle/utils/isInfraStoredState.js +103 -0
  222. package/dist/features/environment-lifecycle/utils/isInfraStoredState.js.map +1 -0
  223. package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.d.ts +4 -0
  224. package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.d.ts.map +1 -0
  225. package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.js +10 -0
  226. package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.js.map +1 -0
  227. package/dist/features/environment-lifecycle/utils/mergeInfraResources.d.ts +4 -0
  228. package/dist/features/environment-lifecycle/utils/mergeInfraResources.d.ts.map +1 -0
  229. package/dist/features/environment-lifecycle/utils/mergeInfraResources.js +10 -0
  230. package/dist/features/environment-lifecycle/utils/mergeInfraResources.js.map +1 -0
  231. package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.d.ts +3 -0
  232. package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.d.ts.map +1 -0
  233. package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.js +8 -0
  234. package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.js.map +1 -0
  235. package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.d.ts +4 -0
  236. package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.d.ts.map +1 -0
  237. package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.js +11 -0
  238. package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.js.map +1 -0
  239. package/dist/features/environment-lifecycle/utils/resolveProjectFile.d.ts +3 -0
  240. package/dist/features/environment-lifecycle/utils/resolveProjectFile.d.ts.map +1 -0
  241. package/dist/features/environment-lifecycle/utils/resolveProjectFile.js +19 -0
  242. package/dist/features/environment-lifecycle/utils/resolveProjectFile.js.map +1 -0
  243. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.d.ts +4 -0
  244. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.d.ts.map +1 -0
  245. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.js +6 -0
  246. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.js.map +1 -0
  247. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.d.ts +4 -0
  248. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.d.ts.map +1 -0
  249. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.js +6 -0
  250. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.js.map +1 -0
  251. package/dist/index.d.ts +16 -6
  252. package/dist/index.d.ts.map +1 -1
  253. package/dist/index.js +14 -15
  254. package/dist/index.js.map +1 -1
  255. package/dist/metadata/index.d.ts +1 -1
  256. package/dist/metadata/index.d.ts.map +1 -1
  257. package/dist/metadata/index.js +1 -1
  258. package/dist/metadata/index.js.map +1 -1
  259. package/dist/project/index.d.ts +7 -5
  260. package/dist/project/index.d.ts.map +1 -1
  261. package/dist/project/index.js +6 -5
  262. package/dist/project/index.js.map +1 -1
  263. package/dist/readme-usage.js +17 -26
  264. package/dist/readme-usage.js.map +1 -1
  265. package/dist/testSupport.d.ts +1 -1
  266. package/dist/testSupport.d.ts.map +1 -1
  267. package/dist/testSupport.js +11 -1
  268. package/dist/testSupport.js.map +1 -1
  269. package/dist/types/infraCli.d.ts +91 -0
  270. package/dist/types/infraCli.d.ts.map +1 -0
  271. package/dist/types/infraCli.js +2 -0
  272. package/dist/types/infraCli.js.map +1 -0
  273. package/dist/types/infraOrchestration.d.ts +84 -0
  274. package/dist/types/infraOrchestration.d.ts.map +1 -0
  275. package/dist/types/infraOrchestration.js +2 -0
  276. package/dist/types/infraOrchestration.js.map +1 -0
  277. package/dist/{project.d.ts → types/infraProject.d.ts} +6 -6
  278. package/dist/types/infraProject.d.ts.map +1 -0
  279. package/dist/types/infraProject.js +2 -0
  280. package/dist/types/infraProject.js.map +1 -0
  281. package/package.json +21 -11
  282. package/src/adapterPackages.integration.test.ts +79 -0
  283. package/src/cli/bin.ts +2 -61
  284. package/src/cli/cli.test.ts +35 -126
  285. package/src/cli/commands/destroy.ts +57 -0
  286. package/src/cli/commands/down.ts +28 -0
  287. package/src/cli/commands/generate.ts +34 -0
  288. package/src/cli/commands/outputs.ts +25 -0
  289. package/src/cli/commands/plan.ts +20 -0
  290. package/src/cli/commands/status.ts +20 -0
  291. package/src/cli/commands/up.ts +29 -0
  292. package/src/cli/commands/validate.ts +20 -0
  293. package/src/cli/constants.ts +19 -0
  294. package/src/cli/createDefaultInfraCommandContext.ts +17 -0
  295. package/src/cli/createInfraRuntimeProvider.ts +35 -0
  296. package/src/cli/createProviderCommandDescriptors.ts +8 -0
  297. package/src/cli/findInfraCommand.ts +7 -0
  298. package/src/cli/index.test.ts +12 -20
  299. package/src/cli/index.ts +7 -49
  300. package/src/cli/renderInfraRootHelp.ts +23 -0
  301. package/src/cli/renderUnknownInfraCommand.ts +4 -0
  302. package/src/cli/runInfraCliAsync.ts +51 -0
  303. package/src/cli/runInfraCommandAsync.ts +114 -0
  304. package/src/cli/utils/prepareInfraCommandOperationAsync.ts +64 -0
  305. package/src/cli/utils/requireInfraSuccess.ts +24 -0
  306. package/src/cli/utils/resolveInfraPersistence.ts +22 -0
  307. package/src/cli/utils/writeInfraEnvironmentOutputs.ts +24 -0
  308. package/src/cli/utils/writeInfraStructured.ts +11 -0
  309. package/src/commands.test.ts +198 -196
  310. package/src/{packageMetadata.ts → constants.ts} +5 -2
  311. package/src/environmentLifecycle.test.ts +193 -0
  312. package/src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.ts +52 -0
  313. package/src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.ts +32 -0
  314. package/src/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.ts +10 -0
  315. package/src/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.ts +34 -0
  316. package/src/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.ts +12 -0
  317. package/src/{project.ts → features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.ts} +10 -45
  318. package/src/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.ts +34 -0
  319. package/src/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.ts +21 -0
  320. package/src/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.ts +10 -0
  321. package/src/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.ts +25 -0
  322. package/src/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.ts +119 -0
  323. package/src/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.ts +65 -0
  324. package/src/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.ts +51 -0
  325. package/src/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.ts +41 -0
  326. package/src/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.ts +67 -0
  327. package/src/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.ts +137 -0
  328. package/src/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.ts +257 -0
  329. package/src/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.ts +80 -0
  330. package/src/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.ts +126 -0
  331. package/src/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.ts +25 -0
  332. package/src/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.ts +21 -0
  333. package/src/features/environment-lifecycle/composition/createInfraCommandServices.ts +47 -0
  334. package/src/features/environment-lifecycle/domain/orderInfraPlanActions.ts +64 -0
  335. package/src/features/environment-lifecycle/domain/resolveInfraEnvironment.ts +62 -0
  336. package/src/features/environment-lifecycle/utils/appendInfraFailure.ts +9 -0
  337. package/src/features/environment-lifecycle/utils/createInfraExecutionContext.ts +24 -0
  338. package/src/features/environment-lifecycle/utils/createInfraFailure.ts +6 -0
  339. package/src/features/environment-lifecycle/utils/createInfraLedger.ts +30 -0
  340. package/src/features/environment-lifecycle/utils/infraIdentityKey.ts +6 -0
  341. package/src/features/environment-lifecycle/utils/isInfraStoredState.ts +141 -0
  342. package/src/features/environment-lifecycle/utils/mergeInfraOutputs.ts +14 -0
  343. package/src/features/environment-lifecycle/utils/mergeInfraResources.ts +14 -0
  344. package/src/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.ts +7 -0
  345. package/src/features/environment-lifecycle/utils/resolveInfraStatePath.ts +12 -0
  346. package/src/features/environment-lifecycle/utils/resolveProjectFile.ts +22 -0
  347. package/src/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.ts +15 -0
  348. package/src/features/environment-lifecycle/utils/retainUnchangedAdapterResources.ts +15 -0
  349. package/src/index.test.ts +22 -315
  350. package/src/index.ts +41 -53
  351. package/src/infraComposition.integration.test.ts +128 -0
  352. package/src/infraOperations.test.ts +386 -0
  353. package/src/infraUp.test.ts +260 -0
  354. package/src/metadata/index.ts +1 -1
  355. package/src/package.test.ts +4 -2
  356. package/src/project/index.test.ts +8 -188
  357. package/src/project/index.ts +7 -22
  358. package/src/project.test.ts +39 -189
  359. package/src/projectContractsParser.test.ts +2 -2
  360. package/src/projectInfrastructure.test.ts +121 -167
  361. package/src/readme-usage.ts +17 -26
  362. package/src/testSupport.ts +12 -2
  363. package/src/types/infraCli.ts +115 -0
  364. package/src/types/infraOrchestration.ts +126 -0
  365. package/src/types/infraProject.ts +15 -0
  366. package/dist/adapters/minikube/auth/index.d.ts +0 -8
  367. package/dist/adapters/minikube/auth/index.d.ts.map +0 -1
  368. package/dist/adapters/minikube/auth/index.js +0 -29
  369. package/dist/adapters/minikube/auth/index.js.map +0 -1
  370. package/dist/adapters/minikube/auth/oauthRuntime.d.ts +0 -4
  371. package/dist/adapters/minikube/auth/oauthRuntime.d.ts.map +0 -1
  372. package/dist/adapters/minikube/auth/oauthRuntime.js +0 -138
  373. package/dist/adapters/minikube/auth/oauthRuntime.js.map +0 -1
  374. package/dist/adapters/minikube/auth/supabase/index.d.ts +0 -7
  375. package/dist/adapters/minikube/auth/supabase/index.d.ts.map +0 -1
  376. package/dist/adapters/minikube/auth/supabase/index.js +0 -232
  377. package/dist/adapters/minikube/auth/supabase/index.js.map +0 -1
  378. package/dist/adapters/minikube/auth/supabase/profile.d.ts +0 -20
  379. package/dist/adapters/minikube/auth/supabase/profile.d.ts.map +0 -1
  380. package/dist/adapters/minikube/auth/supabase/profile.js +0 -452
  381. package/dist/adapters/minikube/auth/supabase/profile.js.map +0 -1
  382. package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.d.ts +0 -7
  383. package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.d.ts.map +0 -1
  384. package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.js +0 -104
  385. package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.js.map +0 -1
  386. package/dist/adapters/minikube/authz/cerbos/index.d.ts +0 -13
  387. package/dist/adapters/minikube/authz/cerbos/index.d.ts.map +0 -1
  388. package/dist/adapters/minikube/authz/cerbos/index.js +0 -382
  389. package/dist/adapters/minikube/authz/cerbos/index.js.map +0 -1
  390. package/dist/adapters/minikube/authz/index.d.ts +0 -9
  391. package/dist/adapters/minikube/authz/index.d.ts.map +0 -1
  392. package/dist/adapters/minikube/authz/index.js +0 -23
  393. package/dist/adapters/minikube/authz/index.js.map +0 -1
  394. package/dist/adapters/minikube/base/index.d.ts +0 -14
  395. package/dist/adapters/minikube/base/index.d.ts.map +0 -1
  396. package/dist/adapters/minikube/base/index.js +0 -3433
  397. package/dist/adapters/minikube/base/index.js.map +0 -1
  398. package/dist/adapters/minikube/base/supabaseMigrations.d.ts +0 -2
  399. package/dist/adapters/minikube/base/supabaseMigrations.d.ts.map +0 -1
  400. package/dist/adapters/minikube/base/supabaseMigrations.js +0 -6
  401. package/dist/adapters/minikube/base/supabaseMigrations.js.map +0 -1
  402. package/dist/adapters/minikube/contracts.d.ts +0 -34
  403. package/dist/adapters/minikube/contracts.d.ts.map +0 -1
  404. package/dist/adapters/minikube/contracts.js +0 -10
  405. package/dist/adapters/minikube/contracts.js.map +0 -1
  406. package/dist/adapters/minikube/index.d.ts +0 -3
  407. package/dist/adapters/minikube/index.d.ts.map +0 -1
  408. package/dist/adapters/minikube/index.js +0 -136
  409. package/dist/adapters/minikube/index.js.map +0 -1
  410. package/dist/adapters/minikube/secrets/index.d.ts +0 -7
  411. package/dist/adapters/minikube/secrets/index.d.ts.map +0 -1
  412. package/dist/adapters/minikube/secrets/index.js +0 -13
  413. package/dist/adapters/minikube/secrets/index.js.map +0 -1
  414. package/dist/adapters/minikube/secrets/supabase-vault/index.d.ts +0 -8
  415. package/dist/adapters/minikube/secrets/supabase-vault/index.d.ts.map +0 -1
  416. package/dist/adapters/minikube/secrets/supabase-vault/index.js +0 -118
  417. package/dist/adapters/minikube/secrets/supabase-vault/index.js.map +0 -1
  418. package/dist/adapters/minikube/storage/index.d.ts +0 -7
  419. package/dist/adapters/minikube/storage/index.d.ts.map +0 -1
  420. package/dist/adapters/minikube/storage/index.js +0 -77
  421. package/dist/adapters/minikube/storage/index.js.map +0 -1
  422. package/dist/adapters/minikube/storage/supabase/index.d.ts +0 -7
  423. package/dist/adapters/minikube/storage/supabase/index.d.ts.map +0 -1
  424. package/dist/adapters/minikube/storage/supabase/index.js +0 -82
  425. package/dist/adapters/minikube/storage/supabase/index.js.map +0 -1
  426. package/dist/authRedirects.d.ts +0 -19
  427. package/dist/authRedirects.d.ts.map +0 -1
  428. package/dist/authRedirects.js +0 -80
  429. package/dist/authRedirects.js.map +0 -1
  430. package/dist/authTargetRedirects.d.ts +0 -12
  431. package/dist/authTargetRedirects.d.ts.map +0 -1
  432. package/dist/authTargetRedirects.js +0 -32
  433. package/dist/authTargetRedirects.js.map +0 -1
  434. package/dist/commandContext.d.ts +0 -12
  435. package/dist/commandContext.d.ts.map +0 -1
  436. package/dist/commandContext.js.map +0 -1
  437. package/dist/commands.d.ts +0 -95
  438. package/dist/commands.d.ts.map +0 -1
  439. package/dist/commands.js +0 -256
  440. package/dist/commands.js.map +0 -1
  441. package/dist/infraValidation.d.ts +0 -4
  442. package/dist/infraValidation.d.ts.map +0 -1
  443. package/dist/infraValidation.js +0 -63
  444. package/dist/infraValidation.js.map +0 -1
  445. package/dist/packageMetadata.d.ts +0 -10
  446. package/dist/packageMetadata.d.ts.map +0 -1
  447. package/dist/packageMetadata.js.map +0 -1
  448. package/dist/project.d.ts.map +0 -1
  449. package/dist/project.js.map +0 -1
  450. package/dist/projectDatabase.d.ts +0 -5
  451. package/dist/projectDatabase.d.ts.map +0 -1
  452. package/dist/projectDatabase.js +0 -22
  453. package/dist/projectDatabase.js.map +0 -1
  454. package/dist/projectEnvironment.d.ts +0 -6
  455. package/dist/projectEnvironment.d.ts.map +0 -1
  456. package/dist/projectEnvironment.js +0 -45
  457. package/dist/projectEnvironment.js.map +0 -1
  458. package/dist/projectInfrastructure.d.ts +0 -38
  459. package/dist/projectInfrastructure.d.ts.map +0 -1
  460. package/dist/projectInfrastructure.js +0 -145
  461. package/dist/projectInfrastructure.js.map +0 -1
  462. package/dist/runtime.d.ts +0 -54
  463. package/dist/runtime.d.ts.map +0 -1
  464. package/dist/runtime.js +0 -151
  465. package/dist/runtime.js.map +0 -1
  466. package/dist/secretStore.d.ts +0 -19
  467. package/dist/secretStore.d.ts.map +0 -1
  468. package/dist/secretStore.js +0 -22
  469. package/dist/secretStore.js.map +0 -1
  470. package/dist/types.d.ts +0 -70
  471. package/dist/types.d.ts.map +0 -1
  472. package/dist/types.js +0 -2
  473. package/dist/types.js.map +0 -1
  474. package/src/adapters/minikube/README.md +0 -115
  475. package/src/adapters/minikube/appRuntimeServing.test.ts +0 -28
  476. package/src/adapters/minikube/auth/index.ts +0 -40
  477. package/src/adapters/minikube/auth/oauthRuntime.ts +0 -163
  478. package/src/adapters/minikube/auth/supabase/index.test.ts +0 -227
  479. package/src/adapters/minikube/auth/supabase/index.ts +0 -293
  480. package/src/adapters/minikube/auth/supabase/oauthRuntime.test.ts +0 -154
  481. package/src/adapters/minikube/auth/supabase/profile.integration.test.ts +0 -1028
  482. package/src/adapters/minikube/auth/supabase/profile.ts +0 -526
  483. package/src/adapters/minikube/auth/supabase/providerAssignments.test.ts +0 -36
  484. package/src/adapters/minikube/auth/targetAwareOAuthRuntime.test.ts +0 -83
  485. package/src/adapters/minikube/auth/targetAwareOAuthRuntime.ts +0 -136
  486. package/src/adapters/minikube/authz/cerbos/index.ts +0 -486
  487. package/src/adapters/minikube/authz/index.ts +0 -32
  488. package/src/adapters/minikube/base/appImageBuild.test.ts +0 -352
  489. package/src/adapters/minikube/base/index.test.ts +0 -693
  490. package/src/adapters/minikube/base/index.ts +0 -3763
  491. package/src/adapters/minikube/base/portForwardRuntime.test.ts +0 -624
  492. package/src/adapters/minikube/base/supabaseMigrations.test.ts +0 -168
  493. package/src/adapters/minikube/base/supabaseMigrations.ts +0 -5
  494. package/src/adapters/minikube/base/twoAppIsolation.integration.test.ts +0 -898
  495. package/src/adapters/minikube/base/upgradeReconciliation.test.ts +0 -135
  496. package/src/adapters/minikube/contracts.ts +0 -46
  497. package/src/adapters/minikube/index.ts +0 -172
  498. package/src/adapters/minikube/secrets/index.test.ts +0 -147
  499. package/src/adapters/minikube/secrets/index.ts +0 -19
  500. package/src/adapters/minikube/secrets/supabase-vault/index.ts +0 -139
  501. package/src/adapters/minikube/storage/index.ts +0 -91
  502. package/src/adapters/minikube/storage/supabase/index.ts +0 -108
  503. package/src/apiInfrastructure.test.ts +0 -69
  504. package/src/authRedirects.test.ts +0 -63
  505. package/src/authRedirects.ts +0 -113
  506. package/src/authTargetRedirects.test.ts +0 -62
  507. package/src/authTargetRedirects.ts +0 -46
  508. package/src/commandContext.ts +0 -27
  509. package/src/commands.ts +0 -404
  510. package/src/generatedApiLedgerCleanup.test.ts +0 -72
  511. package/src/infraApiValidation.test.ts +0 -42
  512. package/src/infraValidation.ts +0 -99
  513. package/src/minikubeImageLifecycle.test.ts +0 -35
  514. package/src/projectDatabase.ts +0 -27
  515. package/src/projectEnvironment.ts +0 -51
  516. package/src/projectInfrastructure.ts +0 -221
  517. package/src/runtime.test.ts +0 -124
  518. package/src/runtime.ts +0 -234
  519. package/src/secretStore.test.ts +0 -76
  520. package/src/secretStore.ts +0 -44
  521. package/src/types.ts +0 -82
@@ -1,203 +1,148 @@
1
+ import type { InfraGeneratedArtifact, InfraLedger } from '@ankhorage/contracts/infra';
1
2
  import { afterEach, describe, expect, test } from 'bun:test';
2
3
  import { promises as fs } from 'fs';
3
4
  import os from 'os';
4
5
  import path from 'path';
5
6
 
6
7
  import {
8
+ readStoredInfraStateAsync,
9
+ removeStoredInfraStateAsync,
7
10
  resolveProjectFile,
8
- resolveProjectInfrastructureTarget,
9
- syncProjectInfrastructure,
10
- } from './projectInfrastructure.js';
11
- import { createAppManifest } from './testSupport.js';
11
+ writeInfraGeneratedArtifactsAsync,
12
+ writeStoredInfraStateAsync,
13
+ } from './project/index.js';
12
14
 
13
- const tempRoots = new Set<string>();
15
+ const temporaryPaths = new Set<string>();
14
16
 
15
17
  afterEach(async () => {
16
18
  await Promise.all(
17
- [...tempRoots].map((rootPath) => fs.rm(rootPath, { force: true, recursive: true })),
19
+ [...temporaryPaths].map((entry) => fs.rm(entry, { force: true, recursive: true })),
18
20
  );
19
- tempRoots.clear();
21
+ temporaryPaths.clear();
20
22
  });
21
23
 
22
- describe('project infrastructure sync', () => {
23
- test('writes generated files and the infra ledger', async () => {
24
- const projectPath = await fs.mkdtemp(path.join(os.tmpdir(), 'infra-sync-'));
25
- tempRoots.add(projectPath);
26
-
27
- const result = await syncProjectInfrastructure({
28
- projectId: 'shop',
29
- projectPath,
30
- manifest: createAppManifest('shop', {
31
- deployment: { target: 'minikube', monitoring: false },
32
- modules: [],
33
- }),
34
- generateInfrastructureImpl() {
35
- return {
36
- files: [
37
- {
38
- path: 'infra/minikube/scripts/status.sh',
39
- content: '#!/usr/bin/env bash\n',
40
- executable: true,
41
- },
42
- { path: 'infra/minikube/.env.example', content: 'APP_PORT=1\n' },
43
- ],
44
- warnings: ['generated warning'],
45
- meta: {
46
- target: 'minikube',
47
- providers: [],
48
- },
49
- dependencies: [],
50
- };
51
- },
52
- });
53
-
54
- expect(result.generated).toBe(2);
55
- expect(result.removed).toBe(0);
56
- expect(result.warnings).toEqual(['generated warning']);
57
- expect(await fs.readFile(path.join(projectPath, 'infra/minikube/.env.example'), 'utf8')).toBe(
58
- 'APP_PORT=1\n',
59
- );
60
-
61
- const ledger = JSON.parse(
62
- await fs.readFile(path.join(projectPath, '.ankh/infra-ledger.json'), 'utf8'),
63
- ) as {
64
- readonly target: string;
65
- readonly files: readonly string[];
66
- };
67
- expect(ledger.target).toBe('minikube');
68
- expect(ledger.files).toEqual([
69
- 'infra/minikube/.env.example',
70
- 'infra/minikube/scripts/status.sh',
71
- ]);
72
- });
73
-
74
- test('removes stale files when regeneration shrinks the output set', async () => {
75
- const projectPath = await fs.mkdtemp(path.join(os.tmpdir(), 'infra-stale-'));
76
- tempRoots.add(projectPath);
77
-
78
- const manifest = createAppManifest('shop', {
79
- deployment: { target: 'minikube', monitoring: false },
80
- modules: [],
81
- });
82
-
83
- await syncProjectInfrastructure({
84
- projectId: 'shop',
85
- projectPath,
86
- manifest,
87
- generateInfrastructureImpl() {
88
- return {
89
- files: [
90
- { path: 'infra/minikube/scripts/status.sh', content: 'first' },
91
- { path: 'infra/minikube/scripts/up.sh', content: 'extra' },
92
- ],
93
- warnings: [],
94
- meta: { target: 'minikube', providers: [] },
95
- dependencies: [],
96
- };
97
- },
24
+ describe('project Infra state and artifacts', () => {
25
+ test('persists environment-scoped desired state and a secret-safe ledger', async () => {
26
+ const projectPath = await temporaryProject();
27
+ await writeStoredInfraStateAsync(projectPath, {
28
+ schemaVersion: 1,
29
+ desired: desired,
30
+ ledger: ledger([]),
98
31
  });
99
-
100
- const result = await syncProjectInfrastructure({
101
- projectId: 'shop',
102
- projectPath,
103
- manifest,
104
- generateInfrastructureImpl() {
105
- return {
106
- files: [{ path: 'infra/minikube/scripts/status.sh', content: 'second' }],
107
- warnings: [],
108
- meta: { target: 'minikube', providers: [] },
109
- dependencies: [],
110
- };
111
- },
32
+ expect(await readStoredInfraStateAsync(projectPath, 'local')).toEqual({
33
+ schemaVersion: 1,
34
+ desired,
35
+ ledger: ledger([]),
112
36
  });
113
-
114
- expect(result.removed).toBe(1);
115
- expect(await pathExists(path.join(projectPath, 'infra/minikube/scripts/up.sh'))).toBe(false);
37
+ await removeStoredInfraStateAsync(projectPath, 'local');
38
+ expect(await readStoredInfraStateAsync(projectPath, 'local')).toBeNull();
116
39
  });
117
40
 
118
- test('cleans generated files when deployment is removed', async () => {
119
- const projectPath = await fs.mkdtemp(path.join(os.tmpdir(), 'infra-clean-'));
120
- tempRoots.add(projectPath);
121
-
122
- await fs.mkdir(path.join(projectPath, '.ankh'), { recursive: true });
123
- await fs.mkdir(path.join(projectPath, 'infra/minikube/scripts'), { recursive: true });
124
- await fs.writeFile(
125
- path.join(projectPath, 'infra/minikube/scripts/status.sh'),
126
- 'status',
127
- 'utf8',
128
- );
129
- await fs.writeFile(
130
- path.join(projectPath, '.ankh/infra-ledger.json'),
131
- JSON.stringify({
132
- schemaVersion: 1,
133
- generatedAt: new Date().toISOString(),
134
- target: 'minikube',
135
- files: ['infra/minikube/scripts/status.sh'],
136
- warnings: [],
137
- }),
138
- 'utf8',
139
- );
140
-
141
- const result = await syncProjectInfrastructure({
142
- projectId: 'shop',
41
+ test('writes deterministic artifacts and removes only previously tracked stale files', async () => {
42
+ const projectPath = await temporaryProject();
43
+ const unrelatedPath = path.join(projectPath, 'infra/unrelated.txt');
44
+ await fs.mkdir(path.dirname(unrelatedPath), { recursive: true });
45
+ await fs.writeFile(unrelatedPath, 'keep', 'utf8');
46
+ const first = artifact('infra/compose.yaml', 'first');
47
+ const stale = artifact('infra/stale.yaml', 'stale');
48
+ await writeInfraGeneratedArtifactsAsync(projectPath, [first, stale], undefined);
49
+ const result = await writeInfraGeneratedArtifactsAsync(
143
50
  projectPath,
144
- manifest: createAppManifest('shop', { modules: [] }),
145
- });
146
-
147
- expect(result.generated).toBe(0);
148
- expect(result.removed).toBe(1);
149
- expect(await pathExists(path.join(projectPath, '.ankh/infra-ledger.json'))).toBe(false);
51
+ [artifact('infra/compose.yaml', 'second')],
52
+ ledger([first, stale]),
53
+ );
54
+ expect(result).toEqual({ written: 1, removed: 1 });
55
+ expect(await fs.readFile(path.join(projectPath, 'infra/compose.yaml'), 'utf8')).toBe('second');
56
+ expect(await fs.readFile(unrelatedPath, 'utf8')).toBe('keep');
57
+ expect(await fileExists(path.join(projectPath, 'infra/stale.yaml'))).toBe(false);
150
58
  });
151
59
 
152
- test('preserves apps/studio skip behavior', async () => {
153
- const projectPath = await fs.mkdtemp(path.join(os.tmpdir(), 'infra-studio-'));
154
- tempRoots.add(projectPath);
155
-
156
- const result = await syncProjectInfrastructure({
157
- projectId: 'studio',
158
- projectPath,
159
- manifest: createAppManifest('studio', {
160
- deployment: { target: 'minikube', monitoring: false },
161
- modules: [],
162
- }),
163
- });
164
-
165
- expect(result.skipped?.reason).toContain('apps/studio');
60
+ test('rejects traversal, state collisions and duplicate artifact paths before writing', async () => {
61
+ const projectPath = await temporaryProject();
62
+ expect(() => resolveProjectFile(projectPath, '../outside')).toThrow('outside project root');
63
+ expect(() => resolveProjectFile(projectPath, '.ankh/infra/local/state.json')).toThrow(
64
+ 'Invalid generated Infra artifact path',
65
+ );
66
+ expect(
67
+ await captureError(
68
+ writeInfraGeneratedArtifactsAsync(
69
+ projectPath,
70
+ [artifact('infra/duplicate', 'a'), artifact('infra/duplicate', 'b')],
71
+ undefined,
72
+ ),
73
+ ),
74
+ ).toContain('Duplicate generated Infra artifact path');
75
+ expect(await fileExists(path.join(projectPath, 'infra/duplicate'))).toBe(false);
166
76
  });
167
77
 
168
- test('resolves targets from the ledger when deployment metadata is absent', async () => {
169
- const projectPath = await fs.mkdtemp(path.join(os.tmpdir(), 'infra-target-'));
170
- tempRoots.add(projectPath);
171
-
172
- await fs.mkdir(path.join(projectPath, '.ankh'), { recursive: true });
78
+ test('fails closed when stored secret outputs contain a resolved value', async () => {
79
+ const projectPath = await temporaryProject();
80
+ const statePath = path.join(projectPath, '.ankh/infra/local/state.json');
81
+ await fs.mkdir(path.dirname(statePath), { recursive: true });
173
82
  await fs.writeFile(
174
- path.join(projectPath, '.ankh/infra-ledger.json'),
83
+ statePath,
175
84
  JSON.stringify({
176
85
  schemaVersion: 1,
177
- generatedAt: new Date().toISOString(),
178
- target: 'minikube',
179
- files: [],
180
- warnings: [],
86
+ desired,
87
+ ledger: {
88
+ ...ledger([]),
89
+ outputs: [
90
+ {
91
+ owner: artifact('infra/example', '').owner,
92
+ name: 'password',
93
+ visibility: 'secret',
94
+ value: 'must-not-be-accepted',
95
+ },
96
+ ],
97
+ },
181
98
  }),
182
99
  'utf8',
183
100
  );
184
-
185
- const target = await resolveProjectInfrastructureTarget({
186
- manifest: createAppManifest('shop', { modules: [] }),
187
- projectPath,
188
- });
189
-
190
- expect(target).toBe('minikube');
191
- });
192
-
193
- test('rejects generated file paths outside the project root', () => {
194
- expect(() => resolveProjectFile('/workspace/project', '../outside.txt')).toThrow(
195
- 'Invalid infra output path outside project root',
101
+ expect(await captureError(readStoredInfraStateAsync(projectPath, 'local'))).toContain(
102
+ 'invalid shape',
196
103
  );
197
104
  });
198
105
  });
199
106
 
200
- async function pathExists(filePath: string): Promise<boolean> {
107
+ const desired = {
108
+ deployment: {
109
+ compute: { provider: 'local' },
110
+ runtime: { provider: 'docker-compose' },
111
+ },
112
+ } as const;
113
+
114
+ function ledger(artifacts: readonly InfraGeneratedArtifact[]): InfraLedger {
115
+ return {
116
+ schemaVersion: 1,
117
+ projectId: 'sample',
118
+ environment: 'local',
119
+ targets: [],
120
+ resources: [],
121
+ outputs: [],
122
+ artifacts: artifacts.map(({ owner, path: artifactPath }) => ({ owner, path: artifactPath })),
123
+ };
124
+ }
125
+
126
+ function artifact(artifactPath: string, content: string): InfraGeneratedArtifact {
127
+ return {
128
+ owner: {
129
+ projectId: 'sample',
130
+ environment: 'local',
131
+ adapter: 'docker-compose',
132
+ resourceId: 'runtime',
133
+ },
134
+ path: artifactPath,
135
+ content,
136
+ };
137
+ }
138
+
139
+ async function temporaryProject(): Promise<string> {
140
+ const projectPath = await fs.mkdtemp(path.join(os.tmpdir(), 'infra-project-'));
141
+ temporaryPaths.add(projectPath);
142
+ return projectPath;
143
+ }
144
+
145
+ async function fileExists(filePath: string): Promise<boolean> {
201
146
  try {
202
147
  await fs.access(filePath);
203
148
  return true;
@@ -205,3 +150,12 @@ async function pathExists(filePath: string): Promise<boolean> {
205
150
  return false;
206
151
  }
207
152
  }
153
+
154
+ async function captureError(operation: Promise<unknown>): Promise<string> {
155
+ try {
156
+ await operation;
157
+ } catch (error) {
158
+ return error instanceof Error ? error.message : String(error);
159
+ }
160
+ throw new Error('Expected operation to fail.');
161
+ }
@@ -1,39 +1,30 @@
1
- import { runCli } from './cli/bin.js';
1
+ import { runInfraCliAsync } from './cli/runInfraCliAsync.js';
2
2
 
3
3
  /***
4
- * Provider, CLI, and project API surface
4
+ * Provider-neutral infrastructure lifecycle
5
5
  *
6
- * `@ankhorage/infra` owns infrastructure generation, project reconciliation,
7
- * and generated lifecycle execution.
6
+ * `@ankhorage/infra` resolves only the compute, runtime, and service adapter packages selected by
7
+ * an environment-aware Infra manifest. Its typed use cases own orchestration, dependency ordering,
8
+ * safe outputs, deterministic artifacts, and environment-scoped ownership state. Provider packages
9
+ * own all technology-specific implementation.
8
10
  *
9
- * The same owner implementation backs CLI consumers and the public
10
- * `@ankhorage/infra/project` application-service boundary. Trusted hosts such
11
- * as Studio should call that subpath instead of reproducing ledger, generated
12
- * file, lifecycle-script, or port-forward configuration semantics.
13
- *
14
- * CLI entrypoints:
15
- *
16
- * - `ankh infra ...`
17
- * - `bunx @ankhorage/infra ...`
18
- *
19
- * Current command surface:
11
+ * The standalone CLI and `ankh infra` expose the same lifecycle:
20
12
  *
21
13
  * - `validate`
14
+ * - `plan`
22
15
  * - `generate`
23
- * - `status`
24
16
  * - `up`
17
+ * - `status`
18
+ * - `outputs`
25
19
  * - `down`
20
+ * - `destroy`
26
21
  *
27
- * Project resolution for the CLI is workspace-aware: pass `[project]`, or
28
- * omit it when cwd is already inside `apps/<project>`. Programmatic project
29
- * operations accept an explicit project path and do not require Studio or a
30
- * particular workspace layout.
31
- *
32
- * Running applications can repair their provider-aware host endpoints through
33
- * `ensureProjectInfrastructureRuntime()` from `@ankhorage/infra/project`. This
34
- * operation only ensures the generated runtime port-forward group; it does not
35
- * deploy, bootstrap, or reconcile infrastructure.
22
+ * `local` is the only default environment. Destruction always requires an explicit environment and
23
+ * exact `<project>:<environment>` confirmation. Persistent resources remain retained unless each
24
+ * exact owned resource is separately authorized with `--delete-resource <adapter>:<resourceId>`.
25
+ * Environment-style outputs print only explicitly public values with an environment-variable name;
26
+ * secret outputs remain references.
36
27
  *
37
28
  * @usage
38
29
  */
39
- await runCli(['--help']);
30
+ await runInfraCliAsync(['--help']);
@@ -3,7 +3,7 @@ import { promises as fs } from 'fs';
3
3
  import os from 'os';
4
4
  import path from 'path';
5
5
 
6
- import type { InfraCommandContext } from './commandContext.js';
6
+ import type { InfraCommandContext } from './types/infraCli.js';
7
7
 
8
8
  export interface CapturedCommandContext {
9
9
  readonly context: InfraCommandContext;
@@ -79,7 +79,17 @@ export async function createWorkspaceFixture(
79
79
 
80
80
  export function createAppManifest(
81
81
  projectId: string,
82
- infra: AppManifest['infra'] = { modules: [] },
82
+ infra: AppManifest['infra'] = {
83
+ environments: {
84
+ local: {
85
+ deployment: {
86
+ compute: { provider: 'local' },
87
+ runtime: { provider: 'docker-compose' },
88
+ },
89
+ },
90
+ },
91
+ modules: [],
92
+ },
83
93
  ): AppManifest {
84
94
  return {
85
95
  metadata: {
@@ -0,0 +1,115 @@
1
+ import type { AnkhCapabilityId } from '@ankhorage/contracts/cli';
2
+ import type { AppEnvironmentId } from '@ankhorage/contracts/environments';
3
+ import type { InfraEnvironmentSpec } from '@ankhorage/contracts/infra';
4
+
5
+ import type { readStoredInfraStateAsync } from '../features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.js';
6
+ import type { removeStoredInfraStateAsync } from '../features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.js';
7
+ import type { writeInfraGeneratedArtifactsAsync } from '../features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.js';
8
+ import type { writeStoredInfraStateAsync } from '../features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.js';
9
+ import type { destroyInfraEnvironmentAsync } from '../features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.js';
10
+ import type { downInfraEnvironmentAsync } from '../features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.js';
11
+ import type { generateInfraEnvironmentAsync } from '../features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.js';
12
+ import type { getInfraEnvironmentOutputs } from '../features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.js';
13
+ import type { planInfraEnvironmentAsync } from '../features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.js';
14
+ import type { statusInfraEnvironmentAsync } from '../features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.js';
15
+ import type { upInfraEnvironmentAsync } from '../features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.js';
16
+ import type { validateInfraEnvironmentAsync } from '../features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.js';
17
+ import type {
18
+ InfraOperationRequest,
19
+ InfraOrchestrationDependencies,
20
+ InfraStoredState,
21
+ } from './infraOrchestration.js';
22
+ import type { ResolvedInfraProject } from './infraProject.js';
23
+
24
+ type InfraCommandName =
25
+ 'validate' | 'plan' | 'generate' | 'up' | 'status' | 'outputs' | 'down' | 'destroy';
26
+
27
+ export interface InfraCommandContext {
28
+ readonly cwd: string;
29
+ readonly env: Readonly<Record<string, string | undefined>>;
30
+ readonly version: string;
31
+ writeStdout(text: string): void;
32
+ writeStderr(text: string): void;
33
+ }
34
+
35
+ export interface InfraCommandRunResult {
36
+ readonly exitCode: number;
37
+ }
38
+
39
+ export interface ParsedInfraArguments {
40
+ readonly projectId?: string;
41
+ readonly environment?: AppEnvironmentId;
42
+ readonly format: 'human' | 'json' | 'env';
43
+ readonly confirmation?: string;
44
+ readonly deleteResources: readonly string[];
45
+ }
46
+
47
+ export interface InfraCommandRunRequest {
48
+ readonly context: InfraCommandContext;
49
+ readonly arguments: ParsedInfraArguments;
50
+ }
51
+
52
+ type InfraCommandImplementation = (
53
+ request: InfraCommandRunRequest,
54
+ services: InfraCommandServices,
55
+ ) => Promise<InfraCommandRunResult>;
56
+
57
+ export interface InfraCommandDefinition {
58
+ readonly capability: AnkhCapabilityId;
59
+ readonly path: readonly [InfraCommandName];
60
+ readonly standaloneName: InfraCommandName;
61
+ readonly summary: string;
62
+ readonly run: InfraCommandImplementation;
63
+ }
64
+
65
+ export interface InfraCommandInvocation {
66
+ readonly argv: readonly string[];
67
+ readonly command: InfraCommandDefinition;
68
+ readonly context: InfraCommandContext;
69
+ }
70
+
71
+ export interface InfraLifecycleOperations {
72
+ readonly validate: typeof validateInfraEnvironmentAsync;
73
+ readonly plan: typeof planInfraEnvironmentAsync;
74
+ readonly generate: typeof generateInfraEnvironmentAsync;
75
+ readonly up: typeof upInfraEnvironmentAsync;
76
+ readonly status: typeof statusInfraEnvironmentAsync;
77
+ readonly outputs: typeof getInfraEnvironmentOutputs;
78
+ readonly down: typeof downInfraEnvironmentAsync;
79
+ readonly destroy: typeof destroyInfraEnvironmentAsync;
80
+ }
81
+
82
+ export interface InfraCommandServices {
83
+ readonly resolveProject: (options: {
84
+ readonly cwd: string;
85
+ readonly projectId?: string;
86
+ }) => Promise<ResolvedInfraProject>;
87
+ readonly readState: typeof readStoredInfraStateAsync;
88
+ readonly writeState: typeof writeStoredInfraStateAsync;
89
+ readonly removeState: typeof removeStoredInfraStateAsync;
90
+ readonly writeArtifacts: typeof writeInfraGeneratedArtifactsAsync;
91
+ readonly operations: InfraLifecycleOperations;
92
+ readonly createDependencies: (context: InfraCommandContext) => InfraOrchestrationDependencies;
93
+ }
94
+
95
+ export interface RunInfraCommandOptions {
96
+ readonly services?: Partial<InfraCommandServices>;
97
+ }
98
+
99
+ export interface CreateInfraRuntimeProviderOptions {
100
+ readonly runCommandImpl?: RunInfraCommandImpl;
101
+ readonly services?: Partial<InfraCommandServices>;
102
+ }
103
+
104
+ export type RunInfraCommandImpl = (
105
+ request: InfraCommandInvocation,
106
+ options?: RunInfraCommandOptions,
107
+ ) => Promise<InfraCommandRunResult>;
108
+
109
+ export interface PreparedInfraCommandOperation {
110
+ readonly project: ResolvedInfraProject;
111
+ readonly state: InfraStoredState | null;
112
+ readonly desired: InfraEnvironmentSpec;
113
+ readonly operation: InfraOperationRequest;
114
+ readonly dependencies: InfraOrchestrationDependencies;
115
+ }
@@ -0,0 +1,126 @@
1
+ import type { AppEnvironmentId } from '@ankhorage/contracts/environments';
2
+ import type {
3
+ InfraComputeAdapter,
4
+ InfraComputeSnapshot,
5
+ InfraComputeTarget,
6
+ InfraDestroyRequest,
7
+ InfraEnvironmentSpec,
8
+ InfraExecutionContext,
9
+ InfraGeneratedArtifact,
10
+ InfraLedger,
11
+ InfraManifest,
12
+ InfraOutput,
13
+ InfraOwnedResource,
14
+ InfraPlan,
15
+ InfraResult,
16
+ InfraRuntimeAdapter,
17
+ InfraRuntimeDesiredState,
18
+ InfraServiceAdapter,
19
+ InfraStatus,
20
+ } from '@ankhorage/contracts/infra';
21
+
22
+ import type { InfraAdapterPackageResolver } from '../features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.js';
23
+
24
+ export interface ResolvedInfraEnvironment {
25
+ readonly id: AppEnvironmentId;
26
+ readonly desired: InfraEnvironmentSpec;
27
+ readonly manifest: InfraManifest;
28
+ }
29
+
30
+ export interface InfraEnvironmentResolutionRequest {
31
+ readonly environment?: string;
32
+ readonly manifest: InfraManifest;
33
+ readonly operation:
34
+ 'validate' | 'plan' | 'generate' | 'up' | 'status' | 'outputs' | 'down' | 'destroy';
35
+ }
36
+
37
+ export interface ResolvedInfraAdapters {
38
+ readonly compute: InfraComputeAdapter;
39
+ readonly runtime: InfraRuntimeAdapter;
40
+ readonly services: readonly InfraServiceAdapter[];
41
+ }
42
+
43
+ export interface InfraStoredState {
44
+ readonly schemaVersion: 1;
45
+ readonly desired: InfraEnvironmentSpec;
46
+ readonly ledger: InfraLedger;
47
+ }
48
+
49
+ export interface PreparedInfraOperation {
50
+ readonly environment: ResolvedInfraEnvironment;
51
+ readonly context: InfraExecutionContext;
52
+ readonly adapters: ResolvedInfraAdapters;
53
+ readonly compute: InfraComputeSnapshot;
54
+ readonly runtimeDesired: InfraRuntimeDesiredState;
55
+ }
56
+
57
+ export interface InfraOrchestrationDependencies {
58
+ readonly adapterResolver: InfraAdapterPackageResolver;
59
+ readonly credentials: InfraExecutionContext['credentials'];
60
+ readonly secrets: InfraExecutionContext['secrets'];
61
+ }
62
+
63
+ export interface InfraOperationRequest {
64
+ readonly projectId: string;
65
+ readonly manifest: InfraManifest;
66
+ readonly environment?: string;
67
+ readonly previous?: InfraLedger;
68
+ readonly previousDesired?: InfraEnvironmentSpec;
69
+ readonly signal?: AbortSignal;
70
+ }
71
+
72
+ export interface InfraDestroyOperationRequest extends InfraOperationRequest {
73
+ readonly confirmation: InfraDestroyRequest['confirmation'];
74
+ readonly persistence: InfraDestroyRequest['persistence'];
75
+ }
76
+
77
+ export interface InfraValidateResult {
78
+ readonly environment: AppEnvironmentId;
79
+ }
80
+
81
+ export type InfraValidateOperationResult = InfraResult<InfraValidateResult>;
82
+
83
+ export type InfraUpRequest = InfraOperationRequest;
84
+
85
+ export interface InfraUpResult {
86
+ readonly environment: AppEnvironmentId;
87
+ readonly targets: readonly InfraComputeTarget[];
88
+ readonly resources: readonly InfraOwnedResource[];
89
+ readonly outputs: readonly InfraOutput[];
90
+ readonly ledger: InfraLedger;
91
+ }
92
+
93
+ export type InfraUpOperationResult = InfraResult<InfraUpResult>;
94
+
95
+ export type InfraPlanOperationResult = InfraResult<InfraPlan>;
96
+
97
+ export interface InfraGenerateResult {
98
+ readonly environment: AppEnvironmentId;
99
+ readonly artifacts: readonly InfraGeneratedArtifact[];
100
+ readonly ledger: InfraLedger;
101
+ }
102
+
103
+ export type InfraGenerateOperationResult = InfraResult<InfraGenerateResult>;
104
+
105
+ export type InfraStatusOperationResult = InfraResult<InfraStatus>;
106
+
107
+ export interface InfraOutputsResult {
108
+ readonly environment: AppEnvironmentId;
109
+ readonly outputs: readonly InfraOutput[];
110
+ }
111
+
112
+ export type InfraOutputsOperationResult = InfraResult<InfraOutputsResult>;
113
+
114
+ export interface InfraDownResult {
115
+ readonly environment: AppEnvironmentId;
116
+ readonly ledger: InfraLedger;
117
+ }
118
+
119
+ export type InfraDownOperationResult = InfraResult<InfraDownResult>;
120
+
121
+ export interface InfraDestroyResult {
122
+ readonly environment: AppEnvironmentId;
123
+ readonly ledger: InfraLedger | null;
124
+ }
125
+
126
+ export type InfraDestroyOperationResult = InfraResult<InfraDestroyResult>;
@@ -0,0 +1,15 @@
1
+ import type { AppManifest } from '@ankhorage/contracts';
2
+
3
+ export interface InfraArtifactWriteResult {
4
+ readonly written: number;
5
+ readonly removed: number;
6
+ }
7
+
8
+ export interface ResolvedInfraProject {
9
+ readonly appsRoot: string;
10
+ readonly manifest: AppManifest;
11
+ readonly manifestPath: string;
12
+ readonly projectId: string;
13
+ readonly projectPath: string;
14
+ readonly workspaceRoot: string;
15
+ }