@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.
- package/CHANGELOG.md +24 -0
- package/README.md +21 -32
- package/dist/cli/bin.d.ts +1 -8
- package/dist/cli/bin.d.ts.map +1 -1
- package/dist/cli/bin.js +2 -34
- package/dist/cli/bin.js.map +1 -1
- package/dist/cli/commands/destroy.d.ts +11 -0
- package/dist/cli/commands/destroy.d.ts.map +1 -0
- package/dist/cli/commands/destroy.js +51 -0
- package/dist/cli/commands/destroy.js.map +1 -0
- package/dist/cli/commands/down.d.ts +11 -0
- package/dist/cli/commands/down.d.ts.map +1 -0
- package/dist/cli/commands/down.js +27 -0
- package/dist/cli/commands/down.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +11 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +29 -0
- package/dist/cli/commands/generate.js.map +1 -0
- package/dist/cli/commands/outputs.d.ts +11 -0
- package/dist/cli/commands/outputs.d.ts.map +1 -0
- package/dist/cli/commands/outputs.js +25 -0
- package/dist/cli/commands/outputs.js.map +1 -0
- package/dist/cli/commands/plan.d.ts +11 -0
- package/dist/cli/commands/plan.d.ts.map +1 -0
- package/dist/cli/commands/plan.js +19 -0
- package/dist/cli/commands/plan.js.map +1 -0
- package/dist/cli/commands/status.d.ts +11 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +19 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/up.d.ts +11 -0
- package/dist/cli/commands/up.d.ts.map +1 -0
- package/dist/cli/commands/up.js +28 -0
- package/dist/cli/commands/up.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +11 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +19 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/constants.d.ts +66 -0
- package/dist/cli/constants.d.ts.map +1 -0
- package/dist/cli/constants.js +19 -0
- package/dist/cli/constants.js.map +1 -0
- package/dist/cli/createDefaultInfraCommandContext.d.ts +4 -0
- package/dist/cli/createDefaultInfraCommandContext.d.ts.map +1 -0
- package/dist/{commandContext.js → cli/createDefaultInfraCommandContext.js} +4 -3
- package/dist/cli/createDefaultInfraCommandContext.js.map +1 -0
- package/dist/cli/createInfraRuntimeProvider.d.ts +5 -0
- package/dist/cli/createInfraRuntimeProvider.d.ts.map +1 -0
- package/dist/cli/createInfraRuntimeProvider.js +22 -0
- package/dist/cli/createInfraRuntimeProvider.js.map +1 -0
- package/dist/cli/createProviderCommandDescriptors.d.ts +4 -0
- package/dist/cli/createProviderCommandDescriptors.d.ts.map +1 -0
- package/dist/cli/createProviderCommandDescriptors.js +6 -0
- package/dist/cli/createProviderCommandDescriptors.js.map +1 -0
- package/dist/cli/findInfraCommand.d.ts +4 -0
- package/dist/cli/findInfraCommand.d.ts.map +1 -0
- package/dist/cli/findInfraCommand.js +6 -0
- package/dist/cli/findInfraCommand.js.map +1 -0
- package/dist/cli/index.d.ts +3 -8
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -24
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/renderInfraRootHelp.d.ts +3 -0
- package/dist/cli/renderInfraRootHelp.d.ts.map +1 -0
- package/dist/cli/renderInfraRootHelp.js +21 -0
- package/dist/cli/renderInfraRootHelp.js.map +1 -0
- package/dist/cli/renderUnknownInfraCommand.d.ts +3 -0
- package/dist/cli/renderUnknownInfraCommand.d.ts.map +1 -0
- package/dist/cli/renderUnknownInfraCommand.js +5 -0
- package/dist/cli/renderUnknownInfraCommand.js.map +1 -0
- package/dist/cli/runInfraCliAsync.d.ts +10 -0
- package/dist/cli/runInfraCliAsync.d.ts.map +1 -0
- package/dist/cli/runInfraCliAsync.js +34 -0
- package/dist/cli/runInfraCliAsync.js.map +1 -0
- package/dist/cli/runInfraCommandAsync.d.ts +4 -0
- package/dist/cli/runInfraCommandAsync.d.ts.map +1 -0
- package/dist/cli/runInfraCommandAsync.js +100 -0
- package/dist/cli/runInfraCommandAsync.js.map +1 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.d.ts +4 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.d.ts.map +1 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.js +45 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.js.map +1 -0
- package/dist/cli/utils/requireInfraSuccess.d.ts +7 -0
- package/dist/cli/utils/requireInfraSuccess.d.ts.map +1 -0
- package/dist/cli/utils/requireInfraSuccess.js +17 -0
- package/dist/cli/utils/requireInfraSuccess.js.map +1 -0
- package/dist/cli/utils/resolveInfraPersistence.d.ts +4 -0
- package/dist/cli/utils/resolveInfraPersistence.d.ts.map +1 -0
- package/dist/cli/utils/resolveInfraPersistence.js +17 -0
- package/dist/cli/utils/resolveInfraPersistence.js.map +1 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.d.ts +5 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.d.ts.map +1 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.js +16 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.js.map +1 -0
- package/dist/cli/utils/writeInfraStructured.d.ts +4 -0
- package/dist/cli/utils/writeInfraStructured.d.ts.map +1 -0
- package/dist/cli/utils/writeInfraStructured.js +8 -0
- package/dist/cli/utils/writeInfraStructured.js.map +1 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/{packageMetadata.js → constants.js} +6 -3
- package/dist/constants.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.js +35 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.js +23 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.js +9 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.js +28 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.js +7 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.d.ts +7 -0
- package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.d.ts.map +1 -0
- package/dist/{project.js → features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.js} +10 -34
- package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.js +28 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.js +16 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.d.ts +9 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.js +2 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.js +15 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.js +84 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.js +55 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.js +38 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.js +34 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.js +57 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.js +109 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.d.ts +6 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.js +181 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.js +68 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.js +98 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.js +17 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.js +13 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.d.ts +4 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.js +43 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.js.map +1 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.d.ts +4 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.js +54 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.js.map +1 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.d.ts +5 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.js +39 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.d.ts +7 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.js +5 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.d.ts +5 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.js +13 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.js +5 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.d.ts +12 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.js +14 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.js +5 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.js +103 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.js +10 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.js +10 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.d.ts +3 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.js +8 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.js +11 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.d.ts +3 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.js +19 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.js +6 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.js +6 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.js.map +1 -0
- package/dist/index.d.ts +16 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -15
- package/dist/index.js.map +1 -1
- package/dist/metadata/index.d.ts +1 -1
- package/dist/metadata/index.d.ts.map +1 -1
- package/dist/metadata/index.js +1 -1
- package/dist/metadata/index.js.map +1 -1
- package/dist/project/index.d.ts +7 -5
- package/dist/project/index.d.ts.map +1 -1
- package/dist/project/index.js +6 -5
- package/dist/project/index.js.map +1 -1
- package/dist/readme-usage.js +17 -26
- package/dist/readme-usage.js.map +1 -1
- package/dist/testSupport.d.ts +1 -1
- package/dist/testSupport.d.ts.map +1 -1
- package/dist/testSupport.js +11 -1
- package/dist/testSupport.js.map +1 -1
- package/dist/types/infraCli.d.ts +91 -0
- package/dist/types/infraCli.d.ts.map +1 -0
- package/dist/types/infraCli.js +2 -0
- package/dist/types/infraCli.js.map +1 -0
- package/dist/types/infraOrchestration.d.ts +84 -0
- package/dist/types/infraOrchestration.d.ts.map +1 -0
- package/dist/types/infraOrchestration.js +2 -0
- package/dist/types/infraOrchestration.js.map +1 -0
- package/dist/{project.d.ts → types/infraProject.d.ts} +6 -6
- package/dist/types/infraProject.d.ts.map +1 -0
- package/dist/types/infraProject.js +2 -0
- package/dist/types/infraProject.js.map +1 -0
- package/package.json +21 -11
- package/src/adapterPackages.integration.test.ts +79 -0
- package/src/cli/bin.ts +2 -61
- package/src/cli/cli.test.ts +35 -126
- package/src/cli/commands/destroy.ts +57 -0
- package/src/cli/commands/down.ts +28 -0
- package/src/cli/commands/generate.ts +34 -0
- package/src/cli/commands/outputs.ts +25 -0
- package/src/cli/commands/plan.ts +20 -0
- package/src/cli/commands/status.ts +20 -0
- package/src/cli/commands/up.ts +29 -0
- package/src/cli/commands/validate.ts +20 -0
- package/src/cli/constants.ts +19 -0
- package/src/cli/createDefaultInfraCommandContext.ts +17 -0
- package/src/cli/createInfraRuntimeProvider.ts +35 -0
- package/src/cli/createProviderCommandDescriptors.ts +8 -0
- package/src/cli/findInfraCommand.ts +7 -0
- package/src/cli/index.test.ts +12 -20
- package/src/cli/index.ts +7 -49
- package/src/cli/renderInfraRootHelp.ts +23 -0
- package/src/cli/renderUnknownInfraCommand.ts +4 -0
- package/src/cli/runInfraCliAsync.ts +51 -0
- package/src/cli/runInfraCommandAsync.ts +114 -0
- package/src/cli/utils/prepareInfraCommandOperationAsync.ts +64 -0
- package/src/cli/utils/requireInfraSuccess.ts +24 -0
- package/src/cli/utils/resolveInfraPersistence.ts +22 -0
- package/src/cli/utils/writeInfraEnvironmentOutputs.ts +24 -0
- package/src/cli/utils/writeInfraStructured.ts +11 -0
- package/src/commands.test.ts +198 -196
- package/src/{packageMetadata.ts → constants.ts} +5 -2
- package/src/environmentLifecycle.test.ts +193 -0
- package/src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.ts +52 -0
- package/src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.ts +32 -0
- package/src/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.ts +10 -0
- package/src/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.ts +34 -0
- package/src/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.ts +12 -0
- package/src/{project.ts → features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.ts} +10 -45
- package/src/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.ts +34 -0
- package/src/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.ts +21 -0
- package/src/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.ts +10 -0
- package/src/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.ts +25 -0
- package/src/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.ts +119 -0
- package/src/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.ts +65 -0
- package/src/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.ts +51 -0
- package/src/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.ts +41 -0
- package/src/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.ts +67 -0
- package/src/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.ts +137 -0
- package/src/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.ts +257 -0
- package/src/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.ts +80 -0
- package/src/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.ts +126 -0
- package/src/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.ts +25 -0
- package/src/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.ts +21 -0
- package/src/features/environment-lifecycle/composition/createInfraCommandServices.ts +47 -0
- package/src/features/environment-lifecycle/domain/orderInfraPlanActions.ts +64 -0
- package/src/features/environment-lifecycle/domain/resolveInfraEnvironment.ts +62 -0
- package/src/features/environment-lifecycle/utils/appendInfraFailure.ts +9 -0
- package/src/features/environment-lifecycle/utils/createInfraExecutionContext.ts +24 -0
- package/src/features/environment-lifecycle/utils/createInfraFailure.ts +6 -0
- package/src/features/environment-lifecycle/utils/createInfraLedger.ts +30 -0
- package/src/features/environment-lifecycle/utils/infraIdentityKey.ts +6 -0
- package/src/features/environment-lifecycle/utils/isInfraStoredState.ts +141 -0
- package/src/features/environment-lifecycle/utils/mergeInfraOutputs.ts +14 -0
- package/src/features/environment-lifecycle/utils/mergeInfraResources.ts +14 -0
- package/src/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.ts +7 -0
- package/src/features/environment-lifecycle/utils/resolveInfraStatePath.ts +12 -0
- package/src/features/environment-lifecycle/utils/resolveProjectFile.ts +22 -0
- package/src/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.ts +15 -0
- package/src/features/environment-lifecycle/utils/retainUnchangedAdapterResources.ts +15 -0
- package/src/index.test.ts +22 -315
- package/src/index.ts +41 -53
- package/src/infraComposition.integration.test.ts +128 -0
- package/src/infraOperations.test.ts +386 -0
- package/src/infraUp.test.ts +260 -0
- package/src/metadata/index.ts +1 -1
- package/src/package.test.ts +4 -2
- package/src/project/index.test.ts +8 -188
- package/src/project/index.ts +7 -22
- package/src/project.test.ts +39 -189
- package/src/projectContractsParser.test.ts +2 -2
- package/src/projectInfrastructure.test.ts +121 -167
- package/src/readme-usage.ts +17 -26
- package/src/testSupport.ts +12 -2
- package/src/types/infraCli.ts +115 -0
- package/src/types/infraOrchestration.ts +126 -0
- package/src/types/infraProject.ts +15 -0
- package/dist/adapters/minikube/auth/index.d.ts +0 -8
- package/dist/adapters/minikube/auth/index.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/index.js +0 -29
- package/dist/adapters/minikube/auth/index.js.map +0 -1
- package/dist/adapters/minikube/auth/oauthRuntime.d.ts +0 -4
- package/dist/adapters/minikube/auth/oauthRuntime.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/oauthRuntime.js +0 -138
- package/dist/adapters/minikube/auth/oauthRuntime.js.map +0 -1
- package/dist/adapters/minikube/auth/supabase/index.d.ts +0 -7
- package/dist/adapters/minikube/auth/supabase/index.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/supabase/index.js +0 -232
- package/dist/adapters/minikube/auth/supabase/index.js.map +0 -1
- package/dist/adapters/minikube/auth/supabase/profile.d.ts +0 -20
- package/dist/adapters/minikube/auth/supabase/profile.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/supabase/profile.js +0 -452
- package/dist/adapters/minikube/auth/supabase/profile.js.map +0 -1
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.d.ts +0 -7
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.js +0 -104
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.js.map +0 -1
- package/dist/adapters/minikube/authz/cerbos/index.d.ts +0 -13
- package/dist/adapters/minikube/authz/cerbos/index.d.ts.map +0 -1
- package/dist/adapters/minikube/authz/cerbos/index.js +0 -382
- package/dist/adapters/minikube/authz/cerbos/index.js.map +0 -1
- package/dist/adapters/minikube/authz/index.d.ts +0 -9
- package/dist/adapters/minikube/authz/index.d.ts.map +0 -1
- package/dist/adapters/minikube/authz/index.js +0 -23
- package/dist/adapters/minikube/authz/index.js.map +0 -1
- package/dist/adapters/minikube/base/index.d.ts +0 -14
- package/dist/adapters/minikube/base/index.d.ts.map +0 -1
- package/dist/adapters/minikube/base/index.js +0 -3433
- package/dist/adapters/minikube/base/index.js.map +0 -1
- package/dist/adapters/minikube/base/supabaseMigrations.d.ts +0 -2
- package/dist/adapters/minikube/base/supabaseMigrations.d.ts.map +0 -1
- package/dist/adapters/minikube/base/supabaseMigrations.js +0 -6
- package/dist/adapters/minikube/base/supabaseMigrations.js.map +0 -1
- package/dist/adapters/minikube/contracts.d.ts +0 -34
- package/dist/adapters/minikube/contracts.d.ts.map +0 -1
- package/dist/adapters/minikube/contracts.js +0 -10
- package/dist/adapters/minikube/contracts.js.map +0 -1
- package/dist/adapters/minikube/index.d.ts +0 -3
- package/dist/adapters/minikube/index.d.ts.map +0 -1
- package/dist/adapters/minikube/index.js +0 -136
- package/dist/adapters/minikube/index.js.map +0 -1
- package/dist/adapters/minikube/secrets/index.d.ts +0 -7
- package/dist/adapters/minikube/secrets/index.d.ts.map +0 -1
- package/dist/adapters/minikube/secrets/index.js +0 -13
- package/dist/adapters/minikube/secrets/index.js.map +0 -1
- package/dist/adapters/minikube/secrets/supabase-vault/index.d.ts +0 -8
- package/dist/adapters/minikube/secrets/supabase-vault/index.d.ts.map +0 -1
- package/dist/adapters/minikube/secrets/supabase-vault/index.js +0 -118
- package/dist/adapters/minikube/secrets/supabase-vault/index.js.map +0 -1
- package/dist/adapters/minikube/storage/index.d.ts +0 -7
- package/dist/adapters/minikube/storage/index.d.ts.map +0 -1
- package/dist/adapters/minikube/storage/index.js +0 -77
- package/dist/adapters/minikube/storage/index.js.map +0 -1
- package/dist/adapters/minikube/storage/supabase/index.d.ts +0 -7
- package/dist/adapters/minikube/storage/supabase/index.d.ts.map +0 -1
- package/dist/adapters/minikube/storage/supabase/index.js +0 -82
- package/dist/adapters/minikube/storage/supabase/index.js.map +0 -1
- package/dist/authRedirects.d.ts +0 -19
- package/dist/authRedirects.d.ts.map +0 -1
- package/dist/authRedirects.js +0 -80
- package/dist/authRedirects.js.map +0 -1
- package/dist/authTargetRedirects.d.ts +0 -12
- package/dist/authTargetRedirects.d.ts.map +0 -1
- package/dist/authTargetRedirects.js +0 -32
- package/dist/authTargetRedirects.js.map +0 -1
- package/dist/commandContext.d.ts +0 -12
- package/dist/commandContext.d.ts.map +0 -1
- package/dist/commandContext.js.map +0 -1
- package/dist/commands.d.ts +0 -95
- package/dist/commands.d.ts.map +0 -1
- package/dist/commands.js +0 -256
- package/dist/commands.js.map +0 -1
- package/dist/infraValidation.d.ts +0 -4
- package/dist/infraValidation.d.ts.map +0 -1
- package/dist/infraValidation.js +0 -63
- package/dist/infraValidation.js.map +0 -1
- package/dist/packageMetadata.d.ts +0 -10
- package/dist/packageMetadata.d.ts.map +0 -1
- package/dist/packageMetadata.js.map +0 -1
- package/dist/project.d.ts.map +0 -1
- package/dist/project.js.map +0 -1
- package/dist/projectDatabase.d.ts +0 -5
- package/dist/projectDatabase.d.ts.map +0 -1
- package/dist/projectDatabase.js +0 -22
- package/dist/projectDatabase.js.map +0 -1
- package/dist/projectEnvironment.d.ts +0 -6
- package/dist/projectEnvironment.d.ts.map +0 -1
- package/dist/projectEnvironment.js +0 -45
- package/dist/projectEnvironment.js.map +0 -1
- package/dist/projectInfrastructure.d.ts +0 -38
- package/dist/projectInfrastructure.d.ts.map +0 -1
- package/dist/projectInfrastructure.js +0 -145
- package/dist/projectInfrastructure.js.map +0 -1
- package/dist/runtime.d.ts +0 -54
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -151
- package/dist/runtime.js.map +0 -1
- package/dist/secretStore.d.ts +0 -19
- package/dist/secretStore.d.ts.map +0 -1
- package/dist/secretStore.js +0 -22
- package/dist/secretStore.js.map +0 -1
- package/dist/types.d.ts +0 -70
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/src/adapters/minikube/README.md +0 -115
- package/src/adapters/minikube/appRuntimeServing.test.ts +0 -28
- package/src/adapters/minikube/auth/index.ts +0 -40
- package/src/adapters/minikube/auth/oauthRuntime.ts +0 -163
- package/src/adapters/minikube/auth/supabase/index.test.ts +0 -227
- package/src/adapters/minikube/auth/supabase/index.ts +0 -293
- package/src/adapters/minikube/auth/supabase/oauthRuntime.test.ts +0 -154
- package/src/adapters/minikube/auth/supabase/profile.integration.test.ts +0 -1028
- package/src/adapters/minikube/auth/supabase/profile.ts +0 -526
- package/src/adapters/minikube/auth/supabase/providerAssignments.test.ts +0 -36
- package/src/adapters/minikube/auth/targetAwareOAuthRuntime.test.ts +0 -83
- package/src/adapters/minikube/auth/targetAwareOAuthRuntime.ts +0 -136
- package/src/adapters/minikube/authz/cerbos/index.ts +0 -486
- package/src/adapters/minikube/authz/index.ts +0 -32
- package/src/adapters/minikube/base/appImageBuild.test.ts +0 -352
- package/src/adapters/minikube/base/index.test.ts +0 -693
- package/src/adapters/minikube/base/index.ts +0 -3763
- package/src/adapters/minikube/base/portForwardRuntime.test.ts +0 -624
- package/src/adapters/minikube/base/supabaseMigrations.test.ts +0 -168
- package/src/adapters/minikube/base/supabaseMigrations.ts +0 -5
- package/src/adapters/minikube/base/twoAppIsolation.integration.test.ts +0 -898
- package/src/adapters/minikube/base/upgradeReconciliation.test.ts +0 -135
- package/src/adapters/minikube/contracts.ts +0 -46
- package/src/adapters/minikube/index.ts +0 -172
- package/src/adapters/minikube/secrets/index.test.ts +0 -147
- package/src/adapters/minikube/secrets/index.ts +0 -19
- package/src/adapters/minikube/secrets/supabase-vault/index.ts +0 -139
- package/src/adapters/minikube/storage/index.ts +0 -91
- package/src/adapters/minikube/storage/supabase/index.ts +0 -108
- package/src/apiInfrastructure.test.ts +0 -69
- package/src/authRedirects.test.ts +0 -63
- package/src/authRedirects.ts +0 -113
- package/src/authTargetRedirects.test.ts +0 -62
- package/src/authTargetRedirects.ts +0 -46
- package/src/commandContext.ts +0 -27
- package/src/commands.ts +0 -404
- package/src/generatedApiLedgerCleanup.test.ts +0 -72
- package/src/infraApiValidation.test.ts +0 -42
- package/src/infraValidation.ts +0 -99
- package/src/minikubeImageLifecycle.test.ts +0 -35
- package/src/projectDatabase.ts +0 -27
- package/src/projectEnvironment.ts +0 -51
- package/src/projectInfrastructure.ts +0 -221
- package/src/runtime.test.ts +0 -124
- package/src/runtime.ts +0 -234
- package/src/secretStore.test.ts +0 -76
- package/src/secretStore.ts +0 -44
- package/src/types.ts +0 -82
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/infra",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"description": "Project-aware infrastructure generation library and executable Ankh provider for Ankhorage.",
|
|
6
6
|
"homepage": "https://github.com/ankhorage/infra#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -35,8 +35,7 @@
|
|
|
35
35
|
"openapi"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ankhorage/contracts": "^
|
|
39
|
-
"@ankhorage/supabase-vault": "^0.2.9"
|
|
38
|
+
"@ankhorage/contracts": "^19.0.0"
|
|
40
39
|
},
|
|
41
40
|
"files": [
|
|
42
41
|
"dist",
|
|
@@ -77,11 +76,13 @@
|
|
|
77
76
|
"provider": "./dist/cli/index.js",
|
|
78
77
|
"capabilities": [
|
|
79
78
|
"infra.validate",
|
|
79
|
+
"infra.plan",
|
|
80
80
|
"infra.generate",
|
|
81
|
-
"infra.status",
|
|
82
81
|
"infra.up",
|
|
82
|
+
"infra.status",
|
|
83
|
+
"infra.outputs",
|
|
83
84
|
"infra.down",
|
|
84
|
-
"infra.
|
|
85
|
+
"infra.destroy"
|
|
85
86
|
]
|
|
86
87
|
},
|
|
87
88
|
"publishConfig": {
|
|
@@ -98,20 +99,29 @@
|
|
|
98
99
|
"format:check": "ankhorage-prettier --check .",
|
|
99
100
|
"prepack": "bun run build",
|
|
100
101
|
"test": "bun test src",
|
|
101
|
-
"test:e2e": "bun
|
|
102
|
-
"test:e2e:minikube": "ANKH_MINIKUBE_ISOLATION=1 bun test src/adapters/minikube/base/twoAppIsolation.integration.test.ts",
|
|
103
|
-
"test:e2e:supabase": "ANKH_MINIKUBE_SUPABASE_ISOLATION=1 bun test src/adapters/minikube/base/twoAppIsolation.integration.test.ts",
|
|
102
|
+
"test:e2e": "ANKH_INFRA_COMPOSITION_E2E=1 bun test src/infraComposition.integration.test.ts",
|
|
104
103
|
"typecheck": "bun x tsc --noEmit -p tsconfig.json",
|
|
104
|
+
"check-types": "bun run typecheck",
|
|
105
105
|
"version-packages": "ankhorage-changeset version",
|
|
106
|
-
"knip:check": "ankhorage-knip"
|
|
106
|
+
"knip:check": "ankhorage-knip",
|
|
107
|
+
"knip:test": "bun run knip:check"
|
|
107
108
|
},
|
|
108
109
|
"devDependencies": {
|
|
109
110
|
"@ankhorage/ankh": "^0.8.11",
|
|
110
|
-
"@ankhorage/
|
|
111
|
+
"@ankhorage/cerbos": "^0.2.0",
|
|
112
|
+
"@ankhorage/devtools": "^1.14.0",
|
|
113
|
+
"@ankhorage/docker-compose": "^0.4.0",
|
|
114
|
+
"@ankhorage/hetzner": "^0.3.0",
|
|
115
|
+
"@ankhorage/k3s": "^0.3.0",
|
|
116
|
+
"@ankhorage/local": "^0.3.0",
|
|
117
|
+
"@ankhorage/minikube": "^0.3.0",
|
|
111
118
|
"@ankhorage/paradox": "^0.1.24",
|
|
119
|
+
"@ankhorage/r2": "^0.2.0",
|
|
120
|
+
"@ankhorage/supabase": "^0.2.0",
|
|
121
|
+
"@ankhorage/supabase-vault": "^0.3.1",
|
|
112
122
|
"@types/bun": "^1.4.1",
|
|
113
123
|
"@types/node": "^25.6.0",
|
|
114
124
|
"typescript": "^5.9.3"
|
|
115
125
|
},
|
|
116
|
-
"packageManager": "bun@1.4.
|
|
126
|
+
"packageManager": "bun@1.4.2"
|
|
117
127
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { InfraEnvironmentSpec } from '@ankhorage/contracts/infra';
|
|
2
|
+
import { expect, test } from 'bun:test';
|
|
3
|
+
|
|
4
|
+
import { createNodeInfraAdapterPackageResolver } from './features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.js';
|
|
5
|
+
import { resolveInfraAdaptersAsync } from './features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.js';
|
|
6
|
+
|
|
7
|
+
test('loads every published package in the required provider composition matrix', async () => {
|
|
8
|
+
const environments = [
|
|
9
|
+
environment('local', 'minikube'),
|
|
10
|
+
environment('local', 'k3s'),
|
|
11
|
+
environment('local', 'docker-compose'),
|
|
12
|
+
production(false),
|
|
13
|
+
production(true),
|
|
14
|
+
];
|
|
15
|
+
const resolved = await Promise.all(
|
|
16
|
+
environments.map((desired) =>
|
|
17
|
+
resolveInfraAdaptersAsync(desired, createNodeInfraAdapterPackageResolver()),
|
|
18
|
+
),
|
|
19
|
+
);
|
|
20
|
+
expect(resolved.every(({ ok }) => ok)).toBe(true);
|
|
21
|
+
expect(
|
|
22
|
+
new Set(
|
|
23
|
+
resolved.flatMap((result) =>
|
|
24
|
+
result.ok
|
|
25
|
+
? [
|
|
26
|
+
result.value.compute.descriptor.id,
|
|
27
|
+
result.value.runtime.descriptor.id,
|
|
28
|
+
...result.value.services.map(({ descriptor }) => descriptor.id),
|
|
29
|
+
]
|
|
30
|
+
: [],
|
|
31
|
+
),
|
|
32
|
+
),
|
|
33
|
+
).toEqual(
|
|
34
|
+
new Set([
|
|
35
|
+
'local',
|
|
36
|
+
'hetzner',
|
|
37
|
+
'minikube',
|
|
38
|
+
'k3s',
|
|
39
|
+
'docker-compose',
|
|
40
|
+
'supabase',
|
|
41
|
+
'cerbos',
|
|
42
|
+
'r2',
|
|
43
|
+
'supabase-vault',
|
|
44
|
+
]),
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
function environment(
|
|
49
|
+
compute: 'local',
|
|
50
|
+
runtime: 'minikube' | 'k3s' | 'docker-compose',
|
|
51
|
+
): InfraEnvironmentSpec {
|
|
52
|
+
if (runtime === 'minikube') {
|
|
53
|
+
return {
|
|
54
|
+
deployment: { compute: { provider: compute }, runtime: { provider: runtime } },
|
|
55
|
+
database: { provider: 'supabase' },
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
deployment: { compute: { provider: compute }, runtime: { provider: runtime } },
|
|
60
|
+
database: { provider: 'supabase' },
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function production(withOptionalServices: boolean): InfraEnvironmentSpec {
|
|
65
|
+
return {
|
|
66
|
+
deployment: {
|
|
67
|
+
compute: { provider: 'hetzner', location: 'nbg1' },
|
|
68
|
+
runtime: { provider: 'k3s', topology: { servers: 1, agents: 0 } },
|
|
69
|
+
},
|
|
70
|
+
database: { provider: 'supabase' },
|
|
71
|
+
...(withOptionalServices
|
|
72
|
+
? {
|
|
73
|
+
objectStorage: { provider: 'r2' as const, buckets: ['media'] },
|
|
74
|
+
authz: { provider: 'cerbos' as const, kind: 'ABAC' as const },
|
|
75
|
+
secretStore: { provider: 'supabase-vault' as const },
|
|
76
|
+
}
|
|
77
|
+
: {}),
|
|
78
|
+
};
|
|
79
|
+
}
|
package/src/cli/bin.ts
CHANGED
|
@@ -1,67 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { createDefaultCommandContext } from '../commandContext.js';
|
|
5
|
-
import {
|
|
6
|
-
findInfraCommandByStandaloneName,
|
|
7
|
-
type InfraCommandServices,
|
|
8
|
-
renderRootHelp,
|
|
9
|
-
renderUnknownCommand,
|
|
10
|
-
runInfraCommand,
|
|
11
|
-
type RunInfraCommandImpl,
|
|
12
|
-
} from '../commands.js';
|
|
13
|
-
|
|
14
|
-
export interface InfraCliOptions {
|
|
15
|
-
readonly context?: InfraCommandContext;
|
|
16
|
-
readonly runCommandImpl?: RunInfraCommandImpl;
|
|
17
|
-
readonly services?: Partial<InfraCommandServices>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export async function runCli(
|
|
21
|
-
argv: readonly string[],
|
|
22
|
-
options: InfraCliOptions = {},
|
|
23
|
-
): Promise<InfraCommandRunResult> {
|
|
24
|
-
const context = options.context ?? createDefaultCommandContext();
|
|
25
|
-
const runCommand = options.runCommandImpl ?? runInfraCommand;
|
|
26
|
-
const [firstToken, ...restTokens] = argv;
|
|
27
|
-
|
|
28
|
-
if (firstToken === undefined || isHelpToken(firstToken)) {
|
|
29
|
-
context.writeStdout(renderRootHelp(context.version));
|
|
30
|
-
return { exitCode: 0 };
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (isVersionToken(firstToken)) {
|
|
34
|
-
context.writeStdout(`${context.version}\n`);
|
|
35
|
-
return { exitCode: 0 };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const command = findInfraCommandByStandaloneName(firstToken);
|
|
39
|
-
if (command === null) {
|
|
40
|
-
context.writeStderr(renderUnknownCommand(firstToken));
|
|
41
|
-
return { exitCode: 1 };
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return runCommand(
|
|
45
|
-
{
|
|
46
|
-
argv: restTokens,
|
|
47
|
-
command,
|
|
48
|
-
context,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
services: options.services,
|
|
52
|
-
},
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function isHelpToken(value: string): boolean {
|
|
57
|
-
return value === '--help' || value === '-h' || value === 'help';
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function isVersionToken(value: string): boolean {
|
|
61
|
-
return value === '--version' || value === '-v' || value === 'version';
|
|
62
|
-
}
|
|
3
|
+
import { runInfraCliAsync } from './runInfraCliAsync.js';
|
|
63
4
|
|
|
64
5
|
if (import.meta.main) {
|
|
65
|
-
const result = await
|
|
6
|
+
const result = await runInfraCliAsync(process.argv.slice(2));
|
|
66
7
|
process.exit(result.exitCode);
|
|
67
8
|
}
|
package/src/cli/cli.test.ts
CHANGED
|
@@ -1,137 +1,46 @@
|
|
|
1
|
-
import type { AnkhDiscoveredPackage, AnkhLoadedProvider } from '@ankhorage/ankh';
|
|
2
|
-
import {
|
|
3
|
-
createPackageRegistry,
|
|
4
|
-
createProviderRegistry,
|
|
5
|
-
runCli as runAnkhCli,
|
|
6
|
-
} from '@ankhorage/ankh';
|
|
7
1
|
import { describe, expect, test } from 'bun:test';
|
|
8
2
|
|
|
9
3
|
import { createCapturedCommandContext } from '../testSupport.js';
|
|
10
|
-
import {
|
|
11
|
-
import { createInfraRuntimeProvider } from './index.js';
|
|
4
|
+
import { runInfraCliAsync } from './runInfraCliAsync.js';
|
|
12
5
|
|
|
13
|
-
describe('standalone
|
|
14
|
-
test('prints help and
|
|
6
|
+
describe('standalone Infra CLI', () => {
|
|
7
|
+
test('prints help/version and dispatches all commands through the shared runner', async () => {
|
|
15
8
|
const help = createCapturedCommandContext('/workspace', '9.9.9');
|
|
16
9
|
const version = createCapturedCommandContext('/workspace', '9.9.9');
|
|
17
|
-
|
|
18
|
-
expect(
|
|
19
|
-
expect(help.stdout.value).toContain('
|
|
20
|
-
expect(
|
|
21
|
-
|
|
22
|
-
expect((await runCli(['--version'], { context: version.context })).exitCode).toBe(0);
|
|
10
|
+
expect((await runInfraCliAsync([], { context: help.context })).exitCode).toBe(0);
|
|
11
|
+
expect(help.stdout.value).toContain('ankhorage-infra <command>');
|
|
12
|
+
expect(help.stdout.value).toContain('destroy');
|
|
13
|
+
expect((await runInfraCliAsync(['--version'], { context: version.context })).exitCode).toBe(0);
|
|
23
14
|
expect(version.stdout.value).toBe('9.9.9\n');
|
|
24
|
-
});
|
|
25
15
|
|
|
26
|
-
test('uses the shared command runner for standalone CLI dispatch', async () => {
|
|
27
|
-
const captured = createCapturedCommandContext('/workspace');
|
|
28
16
|
const calls: string[] = [];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const packageRegistry = createPackageRegistry([createDiscoveredPackage()]);
|
|
58
|
-
const providerRegistry = createProviderRegistry([createLoadedProvider(provider)]);
|
|
59
|
-
|
|
60
|
-
const result = await runAnkhCli(['infra', 'status', 'shop'], {
|
|
61
|
-
context: captured.context,
|
|
62
|
-
registry: packageRegistry,
|
|
63
|
-
providerRegistry,
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
expect(result.exitCode).toBe(0);
|
|
67
|
-
expect(calls).toEqual(['status']);
|
|
68
|
-
expect(captured.stdout.value).toContain('provider:status');
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test('uses the same injected shared runner from both surfaces', async () => {
|
|
72
|
-
const standalone = createCapturedCommandContext('/workspace');
|
|
73
|
-
const providerContext = createCapturedCommandContext('/workspace');
|
|
74
|
-
const calls: string[] = [];
|
|
75
|
-
|
|
76
|
-
const runCommandImpl = (request: {
|
|
77
|
-
readonly argv: readonly string[];
|
|
78
|
-
readonly command: { readonly standaloneName: string };
|
|
79
|
-
readonly context: { writeStdout(text: string): void };
|
|
80
|
-
}) => {
|
|
81
|
-
calls.push(request.command.standaloneName);
|
|
82
|
-
request.context.writeStdout(`shared:${request.command.standaloneName}\n`);
|
|
83
|
-
return Promise.resolve({ exitCode: 0 });
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
await runCli(['generate', 'shop'], {
|
|
87
|
-
context: standalone.context,
|
|
88
|
-
runCommandImpl,
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
const provider = createInfraRuntimeProvider({ runCommandImpl });
|
|
92
|
-
const packageRegistry = createPackageRegistry([createDiscoveredPackage()]);
|
|
93
|
-
const providerRegistry = createProviderRegistry([createLoadedProvider(provider)]);
|
|
94
|
-
|
|
95
|
-
await runAnkhCli(['infra', 'generate', 'shop'], {
|
|
96
|
-
context: providerContext.context,
|
|
97
|
-
registry: packageRegistry,
|
|
98
|
-
providerRegistry,
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
expect(calls).toEqual(['generate', 'generate']);
|
|
102
|
-
expect(standalone.stdout.value).toContain('shared:generate');
|
|
103
|
-
expect(providerContext.stdout.value).toContain('shared:generate');
|
|
17
|
+
for (const name of [
|
|
18
|
+
'validate',
|
|
19
|
+
'plan',
|
|
20
|
+
'generate',
|
|
21
|
+
'up',
|
|
22
|
+
'status',
|
|
23
|
+
'outputs',
|
|
24
|
+
'down',
|
|
25
|
+
'destroy',
|
|
26
|
+
]) {
|
|
27
|
+
await runInfraCliAsync([name, 'shop'], {
|
|
28
|
+
context: createCapturedCommandContext('/workspace').context,
|
|
29
|
+
runCommandImpl(request) {
|
|
30
|
+
calls.push(request.command.standaloneName);
|
|
31
|
+
return Promise.resolve({ exitCode: 0 });
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
expect(calls).toEqual([
|
|
36
|
+
'validate',
|
|
37
|
+
'plan',
|
|
38
|
+
'generate',
|
|
39
|
+
'up',
|
|
40
|
+
'status',
|
|
41
|
+
'outputs',
|
|
42
|
+
'down',
|
|
43
|
+
'destroy',
|
|
44
|
+
]);
|
|
104
45
|
});
|
|
105
46
|
});
|
|
106
|
-
|
|
107
|
-
function createDiscoveredPackage(): AnkhDiscoveredPackage {
|
|
108
|
-
return {
|
|
109
|
-
metadata: {
|
|
110
|
-
category: 'infra',
|
|
111
|
-
provider: './dist/cli/index.js',
|
|
112
|
-
capabilities: ['infra.validate', 'infra.generate', 'infra.status', 'infra.up', 'infra.down'],
|
|
113
|
-
},
|
|
114
|
-
packageJsonPath: '/workspace/package.json',
|
|
115
|
-
packageName: '@ankhorage/infra',
|
|
116
|
-
packageRoot: '/workspace',
|
|
117
|
-
source: 'workspace',
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function createLoadedProvider(
|
|
122
|
-
provider: ReturnType<typeof createInfraRuntimeProvider>,
|
|
123
|
-
): AnkhLoadedProvider {
|
|
124
|
-
return {
|
|
125
|
-
discoveredPackage: createDiscoveredPackage(),
|
|
126
|
-
manifest: {
|
|
127
|
-
id: provider.id,
|
|
128
|
-
category: provider.category,
|
|
129
|
-
version: provider.version,
|
|
130
|
-
capabilities: provider.capabilities,
|
|
131
|
-
commands: provider.commands,
|
|
132
|
-
},
|
|
133
|
-
providerModuleDefaultExport: provider,
|
|
134
|
-
providerModulePath: '/workspace/dist/cli/index.js',
|
|
135
|
-
providerModuleUrl: 'file:///workspace/dist/cli/index.js',
|
|
136
|
-
};
|
|
137
|
-
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { AppEnvironmentId } from '@ankhorage/contracts/environments';
|
|
2
|
+
|
|
3
|
+
import { INFRA_CAPABILITIES } from '../../constants.js';
|
|
4
|
+
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
5
|
+
import type { InfraDestroyOperationRequest } from '../../types/infraOrchestration.js';
|
|
6
|
+
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
7
|
+
import { requireInfraSuccess } from '../utils/requireInfraSuccess.js';
|
|
8
|
+
import { resolveInfraPersistence } from '../utils/resolveInfraPersistence.js';
|
|
9
|
+
import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
10
|
+
|
|
11
|
+
/*** Define exact-scope destruction behind environment and persistent-resource confirmation. */
|
|
12
|
+
export const destroy = {
|
|
13
|
+
standaloneName: 'destroy',
|
|
14
|
+
path: ['destroy'],
|
|
15
|
+
capability: INFRA_CAPABILITIES[7],
|
|
16
|
+
summary: 'Destroy exact owned resources behind explicit confirmation.',
|
|
17
|
+
async run(request, services) {
|
|
18
|
+
const operation = await prepareInfraCommandOperationAsync(request, services, true);
|
|
19
|
+
const environment = requireEnvironment(request.arguments.environment);
|
|
20
|
+
const confirmation = `${operation.project.projectId}:${environment}`;
|
|
21
|
+
if (request.arguments.confirmation !== confirmation) {
|
|
22
|
+
throw new Error(`Infra destroy requires --confirm ${confirmation}.`);
|
|
23
|
+
}
|
|
24
|
+
const destroyRequest: InfraDestroyOperationRequest = {
|
|
25
|
+
...operation.operation,
|
|
26
|
+
environment,
|
|
27
|
+
confirmation: { projectId: operation.project.projectId, environment },
|
|
28
|
+
persistence: resolveInfraPersistence(
|
|
29
|
+
operation.state?.ledger,
|
|
30
|
+
request.arguments.deleteResources,
|
|
31
|
+
),
|
|
32
|
+
};
|
|
33
|
+
const result = await services.operations.destroy(destroyRequest, operation.dependencies);
|
|
34
|
+
requireInfraSuccess(result, request.context);
|
|
35
|
+
await services.writeArtifacts(operation.project.projectPath, [], operation.state?.ledger);
|
|
36
|
+
if (result.value.ledger === null) {
|
|
37
|
+
await services.removeState(operation.project.projectPath, environment);
|
|
38
|
+
} else {
|
|
39
|
+
await services.writeState(operation.project.projectPath, {
|
|
40
|
+
schemaVersion: 1,
|
|
41
|
+
desired: operation.desired,
|
|
42
|
+
ledger: result.value.ledger,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
writeInfraStructured(request.context, request.arguments.format, {
|
|
46
|
+
environment: result.value.environment,
|
|
47
|
+
retainedResources: result.value.ledger?.resources.length ?? 0,
|
|
48
|
+
});
|
|
49
|
+
return { exitCode: 0 };
|
|
50
|
+
},
|
|
51
|
+
} as const satisfies InfraCommandDefinition;
|
|
52
|
+
|
|
53
|
+
/*** Require the explicit destroy environment after CLI parsing. */
|
|
54
|
+
function requireEnvironment(value: AppEnvironmentId | undefined): AppEnvironmentId {
|
|
55
|
+
if (value === undefined) throw new Error('Infra destroy requires an explicit environment.');
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { INFRA_CAPABILITIES } from '../../constants.js';
|
|
2
|
+
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
3
|
+
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
4
|
+
import { requireInfraSuccess } from '../utils/requireInfraSuccess.js';
|
|
5
|
+
import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
6
|
+
|
|
7
|
+
/*** Define reversible runtime suspension while retaining persistent resources. */
|
|
8
|
+
export const down = {
|
|
9
|
+
standaloneName: 'down',
|
|
10
|
+
path: ['down'],
|
|
11
|
+
capability: INFRA_CAPABILITIES[6],
|
|
12
|
+
summary: 'Reversibly suspend runtime workloads while retaining persistent data.',
|
|
13
|
+
async run(request, services) {
|
|
14
|
+
const operation = await prepareInfraCommandOperationAsync(request, services);
|
|
15
|
+
const result = await services.operations.down(operation.operation, operation.dependencies);
|
|
16
|
+
requireInfraSuccess(result, request.context);
|
|
17
|
+
await services.writeState(operation.project.projectPath, {
|
|
18
|
+
schemaVersion: 1,
|
|
19
|
+
desired: operation.desired,
|
|
20
|
+
ledger: result.value.ledger,
|
|
21
|
+
});
|
|
22
|
+
writeInfraStructured(request.context, request.arguments.format, {
|
|
23
|
+
environment: result.value.environment,
|
|
24
|
+
state: 'stopped',
|
|
25
|
+
});
|
|
26
|
+
return { exitCode: 0 };
|
|
27
|
+
},
|
|
28
|
+
} as const satisfies InfraCommandDefinition;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { INFRA_CAPABILITIES } from '../../constants.js';
|
|
2
|
+
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
3
|
+
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
4
|
+
import { requireInfraSuccess } from '../utils/requireInfraSuccess.js';
|
|
5
|
+
import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
6
|
+
|
|
7
|
+
/*** Define deterministic review-artifact generation without remote side effects. */
|
|
8
|
+
export const generate = {
|
|
9
|
+
standaloneName: 'generate',
|
|
10
|
+
path: ['generate'],
|
|
11
|
+
capability: INFRA_CAPABILITIES[2],
|
|
12
|
+
summary: 'Generate deterministic review artifacts without remote side effects.',
|
|
13
|
+
async run(request, services) {
|
|
14
|
+
const operation = await prepareInfraCommandOperationAsync(request, services);
|
|
15
|
+
const result = await services.operations.generate(operation.operation, operation.dependencies);
|
|
16
|
+
requireInfraSuccess(result, request.context);
|
|
17
|
+
const written = await services.writeArtifacts(
|
|
18
|
+
operation.project.projectPath,
|
|
19
|
+
result.value.artifacts,
|
|
20
|
+
operation.state?.ledger,
|
|
21
|
+
);
|
|
22
|
+
await services.writeState(operation.project.projectPath, {
|
|
23
|
+
schemaVersion: 1,
|
|
24
|
+
desired: operation.desired,
|
|
25
|
+
ledger: result.value.ledger,
|
|
26
|
+
});
|
|
27
|
+
writeInfraStructured(request.context, request.arguments.format, {
|
|
28
|
+
environment: result.value.environment,
|
|
29
|
+
...written,
|
|
30
|
+
artifacts: result.value.artifacts.map(({ path }) => path),
|
|
31
|
+
});
|
|
32
|
+
return { exitCode: 0 };
|
|
33
|
+
},
|
|
34
|
+
} as const satisfies InfraCommandDefinition;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { INFRA_CAPABILITIES } from '../../constants.js';
|
|
2
|
+
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
3
|
+
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
4
|
+
import { requireInfraSuccess } from '../utils/requireInfraSuccess.js';
|
|
5
|
+
import { writeInfraEnvironmentOutputs } from '../utils/writeInfraEnvironmentOutputs.js';
|
|
6
|
+
import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
7
|
+
|
|
8
|
+
/*** Define safe public-output and secret-reference presentation. */
|
|
9
|
+
export const outputs = {
|
|
10
|
+
standaloneName: 'outputs',
|
|
11
|
+
path: ['outputs'],
|
|
12
|
+
capability: INFRA_CAPABILITIES[5],
|
|
13
|
+
summary: 'Print safe public outputs and secret references.',
|
|
14
|
+
async run(request, services) {
|
|
15
|
+
const operation = await prepareInfraCommandOperationAsync(request, services);
|
|
16
|
+
const result = services.operations.outputs(operation.operation);
|
|
17
|
+
requireInfraSuccess(result, request.context);
|
|
18
|
+
if (request.arguments.format === 'env') {
|
|
19
|
+
writeInfraEnvironmentOutputs(request.context, result.value.outputs);
|
|
20
|
+
} else {
|
|
21
|
+
writeInfraStructured(request.context, request.arguments.format, result.value);
|
|
22
|
+
}
|
|
23
|
+
return { exitCode: 0 };
|
|
24
|
+
},
|
|
25
|
+
} as const satisfies InfraCommandDefinition;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { INFRA_CAPABILITIES } from '../../constants.js';
|
|
2
|
+
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
3
|
+
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
4
|
+
import { requireInfraSuccess } from '../utils/requireInfraSuccess.js';
|
|
5
|
+
import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
6
|
+
|
|
7
|
+
/*** Define the ordered side-effect-free infrastructure planning command. */
|
|
8
|
+
export const plan = {
|
|
9
|
+
standaloneName: 'plan',
|
|
10
|
+
path: ['plan'],
|
|
11
|
+
capability: INFRA_CAPABILITIES[1],
|
|
12
|
+
summary: 'Print an ordered side-effect-free infrastructure plan.',
|
|
13
|
+
async run(request, services) {
|
|
14
|
+
const operation = await prepareInfraCommandOperationAsync(request, services);
|
|
15
|
+
const result = await services.operations.plan(operation.operation, operation.dependencies);
|
|
16
|
+
requireInfraSuccess(result, request.context);
|
|
17
|
+
writeInfraStructured(request.context, request.arguments.format, result.value);
|
|
18
|
+
return { exitCode: 0 };
|
|
19
|
+
},
|
|
20
|
+
} as const satisfies InfraCommandDefinition;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { INFRA_CAPABILITIES } from '../../constants.js';
|
|
2
|
+
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
3
|
+
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
4
|
+
import { requireInfraSuccess } from '../utils/requireInfraSuccess.js';
|
|
5
|
+
import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
6
|
+
|
|
7
|
+
/*** Define provider-neutral environment status aggregation. */
|
|
8
|
+
export const status = {
|
|
9
|
+
standaloneName: 'status',
|
|
10
|
+
path: ['status'],
|
|
11
|
+
capability: INFRA_CAPABILITIES[4],
|
|
12
|
+
summary: 'Aggregate provider-neutral environment status.',
|
|
13
|
+
async run(request, services) {
|
|
14
|
+
const operation = await prepareInfraCommandOperationAsync(request, services);
|
|
15
|
+
const result = await services.operations.status(operation.operation, operation.dependencies);
|
|
16
|
+
requireInfraSuccess(result, request.context);
|
|
17
|
+
writeInfraStructured(request.context, request.arguments.format, result.value);
|
|
18
|
+
return { exitCode: 0 };
|
|
19
|
+
},
|
|
20
|
+
} as const satisfies InfraCommandDefinition;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { INFRA_CAPABILITIES } from '../../constants.js';
|
|
2
|
+
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
3
|
+
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
4
|
+
import { requireInfraSuccess } from '../utils/requireInfraSuccess.js';
|
|
5
|
+
import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
6
|
+
|
|
7
|
+
/*** Define idempotent environment creation and reconciliation. */
|
|
8
|
+
export const up = {
|
|
9
|
+
standaloneName: 'up',
|
|
10
|
+
path: ['up'],
|
|
11
|
+
capability: INFRA_CAPABILITIES[3],
|
|
12
|
+
summary: 'Idempotently ensure and reconcile the selected environment.',
|
|
13
|
+
async run(request, services) {
|
|
14
|
+
const operation = await prepareInfraCommandOperationAsync(request, services);
|
|
15
|
+
const result = await services.operations.up(operation.operation, operation.dependencies);
|
|
16
|
+
requireInfraSuccess(result, request.context);
|
|
17
|
+
await services.writeState(operation.project.projectPath, {
|
|
18
|
+
schemaVersion: 1,
|
|
19
|
+
desired: operation.desired,
|
|
20
|
+
ledger: result.value.ledger,
|
|
21
|
+
});
|
|
22
|
+
writeInfraStructured(request.context, request.arguments.format, {
|
|
23
|
+
environment: result.value.environment,
|
|
24
|
+
resources: result.value.resources.length,
|
|
25
|
+
outputs: result.value.outputs,
|
|
26
|
+
});
|
|
27
|
+
return { exitCode: 0 };
|
|
28
|
+
},
|
|
29
|
+
} as const satisfies InfraCommandDefinition;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { INFRA_CAPABILITIES } from '../../constants.js';
|
|
2
|
+
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
3
|
+
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
4
|
+
import { requireInfraSuccess } from '../utils/requireInfraSuccess.js';
|
|
5
|
+
import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
6
|
+
|
|
7
|
+
/*** Define the manifest, compatibility, credential and selected-adapter validation command. */
|
|
8
|
+
export const validate = {
|
|
9
|
+
standaloneName: 'validate',
|
|
10
|
+
path: ['validate'],
|
|
11
|
+
capability: INFRA_CAPABILITIES[0],
|
|
12
|
+
summary: 'Validate manifest, compatibility, credentials and selected adapters.',
|
|
13
|
+
async run(request, services) {
|
|
14
|
+
const operation = await prepareInfraCommandOperationAsync(request, services);
|
|
15
|
+
const result = await services.operations.validate(operation.operation, operation.dependencies);
|
|
16
|
+
requireInfraSuccess(result, request.context);
|
|
17
|
+
writeInfraStructured(request.context, request.arguments.format, result.value);
|
|
18
|
+
return { exitCode: 0 };
|
|
19
|
+
},
|
|
20
|
+
} as const satisfies InfraCommandDefinition;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { destroy } from './commands/destroy.js';
|
|
2
|
+
import { down } from './commands/down.js';
|
|
3
|
+
import { generate } from './commands/generate.js';
|
|
4
|
+
import { outputs } from './commands/outputs.js';
|
|
5
|
+
import { plan } from './commands/plan.js';
|
|
6
|
+
import { status } from './commands/status.js';
|
|
7
|
+
import { up } from './commands/up.js';
|
|
8
|
+
import { validate } from './commands/validate.js';
|
|
9
|
+
|
|
10
|
+
export const INFRA_COMMANDS = [
|
|
11
|
+
validate,
|
|
12
|
+
plan,
|
|
13
|
+
generate,
|
|
14
|
+
up,
|
|
15
|
+
status,
|
|
16
|
+
outputs,
|
|
17
|
+
down,
|
|
18
|
+
destroy,
|
|
19
|
+
] as const;
|