@ankhorage/infra 7.1.107 → 7.2.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 +6 -0
- package/README.md +1 -1
- package/dist/capabilities/index.d.ts +83 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +68 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/cli/commands/destroy.js +1 -2
- package/dist/cli/commands/destroy.js.map +1 -1
- package/dist/cli/commands/down.d.ts.map +1 -1
- package/dist/cli/commands/down.js +1 -2
- package/dist/cli/commands/down.js.map +1 -1
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +1 -2
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/outputs.d.ts.map +1 -1
- package/dist/cli/commands/outputs.js +1 -2
- package/dist/cli/commands/outputs.js.map +1 -1
- package/dist/cli/commands/plan.d.ts.map +1 -1
- package/dist/cli/commands/plan.js +1 -2
- package/dist/cli/commands/plan.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +1 -2
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/up.d.ts.map +1 -1
- package/dist/cli/commands/up.js +1 -2
- package/dist/cli/commands/up.js.map +1 -1
- package/dist/cli/commands/validate.d.ts.map +1 -1
- package/dist/cli/commands/validate.js +1 -2
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/createInfraRuntimeProvider.d.ts.map +1 -1
- package/dist/cli/createInfraRuntimeProvider.js +3 -2
- package/dist/cli/createInfraRuntimeProvider.js.map +1 -1
- package/dist/constants.d.ts +81 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -11
- package/dist/constants.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/types/infraCli.d.ts +2 -2
- package/dist/types/infraCli.d.ts.map +1 -1
- package/dist/types/infraCli.js.map +1 -1
- package/package.json +129 -12
- package/src/capabilities/index.test.ts +17 -0
- package/src/capabilities/index.ts +71 -0
- package/src/cli/commands/destroy.ts +2 -2
- package/src/cli/commands/down.ts +3 -2
- package/src/cli/commands/generate.ts +3 -2
- package/src/cli/commands/outputs.ts +3 -2
- package/src/cli/commands/plan.ts +3 -2
- package/src/cli/commands/status.ts +3 -2
- package/src/cli/commands/up.ts +3 -2
- package/src/cli/commands/validate.ts +3 -2
- package/src/cli/createInfraRuntimeProvider.ts +3 -7
- package/src/cli/index.test.ts +3 -11
- package/src/commands.test.ts +4 -0
- package/src/constants.ts +3 -17
- package/src/metadata/index.ts +0 -1
- package/src/package.test.ts +21 -23
- package/src/types/infraCli.ts +2 -2
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB,QAAmB,CAAC;AACnD,eAAO,MAAM,qBAAqB,QAAsB,CAAC;AACzD,eAAO,MAAM,yBAAyB,QAA0B,CAAC;AACjE,eAAO,MAAM,sBAAsB,SAAiD,CAAC;AACrF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIK,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
import packageJson from '../package.json';
|
|
2
|
+
import { CAPABILITIES } from './capabilities/index.js';
|
|
2
3
|
export const INFRA_PACKAGE_NAME = packageJson.name;
|
|
3
4
|
export const INFRA_PACKAGE_VERSION = packageJson.version;
|
|
4
5
|
export const INFRA_PACKAGE_DESCRIPTION = packageJson.description;
|
|
5
6
|
export const INFRA_COMMAND_CATEGORY = 'infra';
|
|
6
|
-
export const INFRA_CAPABILITIES = [
|
|
7
|
-
'infra.validate',
|
|
8
|
-
'infra.plan',
|
|
9
|
-
'infra.generate',
|
|
10
|
-
'infra.up',
|
|
11
|
-
'infra.status',
|
|
12
|
-
'infra.outputs',
|
|
13
|
-
'infra.down',
|
|
14
|
-
'infra.destroy',
|
|
15
|
-
];
|
|
16
7
|
export const INFRA_PACKAGE_METADATA = {
|
|
17
8
|
category: INFRA_COMMAND_CATEGORY,
|
|
18
9
|
provider: './dist/cli/index.js',
|
|
19
|
-
capabilities:
|
|
10
|
+
capabilities: CAPABILITIES,
|
|
20
11
|
};
|
|
21
12
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC,IAAI,CAAC;AACnD,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC,OAAO,CAAC;AACzD,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAW,CAAC,WAAW,CAAC;AACjE,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAA8C,CAAC;AACrF,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,QAAQ,EAAE,sBAAsB;IAChC,QAAQ,EAAE,qBAAqB;IAC/B,YAAY,EAAE,YAAY;CACY,CAAC","sourcesContent":["import type { AnkhCommandCategory, AnkhPackageMetadata } from '@ankhorage/contracts/cli';\n\nimport packageJson from '../package.json';\nimport { CAPABILITIES } from './capabilities/index.js';\n\nexport const INFRA_PACKAGE_NAME = packageJson.name;\nexport const INFRA_PACKAGE_VERSION = packageJson.version;\nexport const INFRA_PACKAGE_DESCRIPTION = packageJson.description;\nexport const INFRA_COMMAND_CATEGORY = 'infra' as const satisfies AnkhCommandCategory;\nexport const INFRA_PACKAGE_METADATA = {\n category: INFRA_COMMAND_CATEGORY,\n provider: './dist/cli/index.js',\n capabilities: CAPABILITIES,\n} as const satisfies AnkhPackageMetadata;\n"]}
|
package/dist/metadata/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { INFRA_COMMAND_CATEGORY, INFRA_PACKAGE_METADATA, INFRA_PACKAGE_NAME, INFRA_PACKAGE_VERSION, } from '../constants.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC"}
|
package/dist/metadata/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { INFRA_COMMAND_CATEGORY, INFRA_PACKAGE_METADATA, INFRA_PACKAGE_NAME, INFRA_PACKAGE_VERSION, } from '../constants.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/metadata/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC","sourcesContent":["export {\n INFRA_COMMAND_CATEGORY,\n INFRA_PACKAGE_METADATA,\n INFRA_PACKAGE_NAME,\n INFRA_PACKAGE_VERSION,\n} from '../constants.js';\n"]}
|
package/dist/types/infraCli.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Capability } from '@ankhorage/contracts/capabilities';
|
|
2
2
|
import type { AppEnvironmentId } from '@ankhorage/contracts/environments';
|
|
3
3
|
import type { InfraEnvironmentSpec, InfraGeneratedArtifact, InfraLedger, InfraOutput } from '@ankhorage/contracts/infra';
|
|
4
4
|
import type { InfraDestroyOperationRequest, InfraDestroyOperationResult, InfraDownOperationResult, InfraGenerateOperationResult, InfraOperationRequest, InfraOrchestrationDependencies, InfraOutputsOperationResult, InfraPlanOperationResult, InfraStatusOperationResult, InfraStoredState, InfraUpOperationResult, InfraValidateOperationResult } from './infraOrchestration.js';
|
|
@@ -27,7 +27,7 @@ export interface InfraCommandRunRequest {
|
|
|
27
27
|
}
|
|
28
28
|
type InfraCommandImplementation = (request: InfraCommandRunRequest, services: InfraCommandServices) => Promise<InfraCommandRunResult>;
|
|
29
29
|
export interface InfraCommandDefinition {
|
|
30
|
-
readonly capability:
|
|
30
|
+
readonly capability: Capability['id'];
|
|
31
31
|
readonly path: readonly [InfraCommandName];
|
|
32
32
|
readonly standaloneName: InfraCommandName;
|
|
33
33
|
readonly summary: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infraCli.d.ts","sourceRoot":"","sources":["../../src/types/infraCli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"infraCli.d.ts","sourceRoot":"","sources":["../../src/types/infraCli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC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C,QAAQ,CAAC,YAAY,EAAE,8BAA8B,CAAC;CACvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infraCli.js","sourceRoot":"","sources":["../../src/types/infraCli.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"infraCli.js","sourceRoot":"","sources":["../../src/types/infraCli.ts"],"names":[],"mappings":"","sourcesContent":["import type { Capability } from '@ankhorage/contracts/capabilities';\nimport type { AppEnvironmentId } from '@ankhorage/contracts/environments';\nimport type {\n InfraEnvironmentSpec,\n InfraGeneratedArtifact,\n InfraLedger,\n InfraOutput,\n} from '@ankhorage/contracts/infra';\n\nimport type {\n InfraDestroyOperationRequest,\n InfraDestroyOperationResult,\n InfraDownOperationResult,\n InfraGenerateOperationResult,\n InfraOperationRequest,\n InfraOrchestrationDependencies,\n InfraOutputsOperationResult,\n InfraPlanOperationResult,\n InfraStatusOperationResult,\n InfraStoredState,\n InfraUpOperationResult,\n InfraValidateOperationResult,\n} from './infraOrchestration.js';\nimport type { InfraArtifactWriteResult, ResolvedInfraProject } from './infraProject.js';\n\ntype InfraCommandName =\n 'validate' | 'plan' | 'generate' | 'up' | 'status' | 'outputs' | 'down' | 'destroy';\n\nexport interface InfraCommandContext {\n readonly cwd: string;\n readonly env: Readonly<Record<string, string | undefined>>;\n readonly version: string;\n writeStdout(text: string): void;\n writeStderr(text: string): void;\n}\n\nexport interface InfraCommandRunResult {\n readonly exitCode: number;\n}\n\nexport interface ParsedInfraArguments {\n readonly projectId?: string;\n readonly environment?: AppEnvironmentId;\n readonly format: 'human' | 'json' | 'env';\n readonly confirmation?: string;\n readonly deleteResources: readonly string[];\n}\n\nexport interface InfraCommandRunRequest {\n readonly context: InfraCommandContext;\n readonly arguments: ParsedInfraArguments;\n}\n\ntype InfraCommandImplementation = (\n request: InfraCommandRunRequest,\n services: InfraCommandServices,\n) => Promise<InfraCommandRunResult>;\n\nexport interface InfraCommandDefinition {\n readonly capability: Capability['id'];\n readonly path: readonly [InfraCommandName];\n readonly standaloneName: InfraCommandName;\n readonly summary: string;\n readonly run: InfraCommandImplementation;\n}\n\nexport interface InfraCommandInvocation {\n readonly argv: readonly string[];\n readonly command: InfraCommandDefinition;\n readonly context: InfraCommandContext;\n}\n\nexport interface InfraLifecycleOperations {\n readonly validate: (\n request: InfraOperationRequest,\n dependencies: InfraOrchestrationDependencies,\n ) => Promise<InfraValidateOperationResult>;\n readonly plan: (\n request: InfraOperationRequest,\n dependencies: InfraOrchestrationDependencies,\n ) => Promise<InfraPlanOperationResult>;\n readonly generate: (\n request: InfraOperationRequest,\n dependencies: InfraOrchestrationDependencies,\n ) => Promise<InfraGenerateOperationResult>;\n readonly up: (\n request: InfraOperationRequest,\n dependencies: InfraOrchestrationDependencies,\n ) => Promise<InfraUpOperationResult>;\n readonly status: (\n request: InfraOperationRequest,\n dependencies: InfraOrchestrationDependencies,\n ) => Promise<InfraStatusOperationResult>;\n readonly outputs: (request: InfraOperationRequest) => InfraOutputsOperationResult;\n readonly down: (\n request: InfraOperationRequest,\n dependencies: InfraOrchestrationDependencies,\n ) => Promise<InfraDownOperationResult>;\n readonly destroy: (\n request: InfraDestroyOperationRequest,\n dependencies: InfraOrchestrationDependencies,\n ) => Promise<InfraDestroyOperationResult>;\n}\n\ninterface InfraDependencyScope {\n readonly projectPath: string;\n readonly environment: AppEnvironmentId;\n}\n\nexport interface InfraCommandServices {\n readonly resolveProject: (options: {\n readonly cwd: string;\n readonly projectId?: string;\n }) => Promise<ResolvedInfraProject>;\n readonly readState: (\n projectPath: string,\n environment: AppEnvironmentId,\n ) => Promise<InfraStoredState | null>;\n readonly writeState: (projectPath: string, state: InfraStoredState) => Promise<void>;\n readonly removeState: (projectPath: string, environment: AppEnvironmentId) => Promise<void>;\n readonly removeCredentials: (projectPath: string, environment: AppEnvironmentId) => Promise<void>;\n readonly writeArtifacts: (\n projectPath: string,\n artifacts: readonly InfraGeneratedArtifact[],\n previous: InfraLedger | undefined,\n ) => Promise<InfraArtifactWriteResult>;\n readonly writeEnvironmentOutputs: (\n projectPath: string,\n environment: AppEnvironmentId,\n outputs: readonly InfraOutput[],\n ) => Promise<void>;\n readonly operations: InfraLifecycleOperations;\n readonly createDependencies: (\n context: InfraCommandContext,\n scope: InfraDependencyScope,\n ) => InfraOrchestrationDependencies;\n}\n\nexport interface RunInfraCommandOptions {\n readonly services?: Partial<InfraCommandServices>;\n}\n\nexport interface CreateInfraRuntimeProviderOptions {\n readonly runCommandImpl?: RunInfraCommandImpl;\n readonly services?: Partial<InfraCommandServices>;\n}\n\nexport type RunInfraCommandImpl = (\n request: InfraCommandInvocation,\n options?: RunInfraCommandOptions,\n) => Promise<InfraCommandRunResult>;\n\nexport interface PreparedInfraCommandOperation {\n readonly project: ResolvedInfraProject;\n readonly state: InfraStoredState | null;\n readonly desired: InfraEnvironmentSpec;\n readonly operation: InfraOperationRequest;\n readonly dependencies: InfraOrchestrationDependencies;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/infra",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.2.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,8 @@
|
|
|
35
35
|
"openapi"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ankhorage/ankh": "^0.
|
|
39
|
-
"@ankhorage/contracts": "^
|
|
38
|
+
"@ankhorage/ankh": "^0.12.0",
|
|
39
|
+
"@ankhorage/contracts": "^24.1.0",
|
|
40
40
|
"@ankhorage/utility": "^1.9.85"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
@@ -63,6 +63,11 @@
|
|
|
63
63
|
"import": "./dist/metadata/index.js",
|
|
64
64
|
"default": "./dist/metadata/index.js"
|
|
65
65
|
},
|
|
66
|
+
"./capabilities": {
|
|
67
|
+
"types": "./dist/capabilities/index.d.ts",
|
|
68
|
+
"import": "./dist/capabilities/index.js",
|
|
69
|
+
"default": "./dist/capabilities/index.js"
|
|
70
|
+
},
|
|
66
71
|
"./project": {
|
|
67
72
|
"types": "./dist/project/index.d.ts",
|
|
68
73
|
"import": "./dist/project/index.js",
|
|
@@ -77,14 +82,126 @@
|
|
|
77
82
|
"category": "infra",
|
|
78
83
|
"provider": "./dist/cli/index.js",
|
|
79
84
|
"capabilities": [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
{
|
|
86
|
+
"id": "infra.validate",
|
|
87
|
+
"owner": "@ankhorage/infra",
|
|
88
|
+
"access": [
|
|
89
|
+
"invoke"
|
|
90
|
+
],
|
|
91
|
+
"binding": {
|
|
92
|
+
"kind": "action",
|
|
93
|
+
"bindableAs": [
|
|
94
|
+
"target"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"label": "Validate infrastructure",
|
|
98
|
+
"description": "Validate the manifest, credentials, compatibility, and selected infrastructure adapters."
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"id": "infra.plan",
|
|
102
|
+
"owner": "@ankhorage/infra",
|
|
103
|
+
"access": [
|
|
104
|
+
"invoke"
|
|
105
|
+
],
|
|
106
|
+
"binding": {
|
|
107
|
+
"kind": "action",
|
|
108
|
+
"bindableAs": [
|
|
109
|
+
"target"
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
"label": "Plan infrastructure",
|
|
113
|
+
"description": "Calculate the infrastructure changes required for the selected environment."
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"id": "infra.generate",
|
|
117
|
+
"owner": "@ankhorage/infra",
|
|
118
|
+
"access": [
|
|
119
|
+
"invoke"
|
|
120
|
+
],
|
|
121
|
+
"binding": {
|
|
122
|
+
"kind": "action",
|
|
123
|
+
"bindableAs": [
|
|
124
|
+
"target"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"label": "Generate infrastructure",
|
|
128
|
+
"description": "Generate infrastructure artifacts for the selected environment."
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"id": "infra.up",
|
|
132
|
+
"owner": "@ankhorage/infra",
|
|
133
|
+
"access": [
|
|
134
|
+
"invoke"
|
|
135
|
+
],
|
|
136
|
+
"binding": {
|
|
137
|
+
"kind": "action",
|
|
138
|
+
"bindableAs": [
|
|
139
|
+
"target"
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
"label": "Start infrastructure",
|
|
143
|
+
"description": "Ensure and reconcile the selected infrastructure environment."
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"id": "infra.status",
|
|
147
|
+
"owner": "@ankhorage/infra",
|
|
148
|
+
"access": [
|
|
149
|
+
"invoke"
|
|
150
|
+
],
|
|
151
|
+
"binding": {
|
|
152
|
+
"kind": "action",
|
|
153
|
+
"bindableAs": [
|
|
154
|
+
"target"
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
"label": "Get infrastructure status",
|
|
158
|
+
"description": "Inspect the current status of the selected infrastructure environment."
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"id": "infra.outputs",
|
|
162
|
+
"owner": "@ankhorage/infra",
|
|
163
|
+
"access": [
|
|
164
|
+
"invoke"
|
|
165
|
+
],
|
|
166
|
+
"binding": {
|
|
167
|
+
"kind": "action",
|
|
168
|
+
"bindableAs": [
|
|
169
|
+
"target"
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
"label": "Get infrastructure outputs",
|
|
173
|
+
"description": "Read generated public and referenced outputs for the selected infrastructure environment."
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"id": "infra.down",
|
|
177
|
+
"owner": "@ankhorage/infra",
|
|
178
|
+
"access": [
|
|
179
|
+
"invoke"
|
|
180
|
+
],
|
|
181
|
+
"binding": {
|
|
182
|
+
"kind": "action",
|
|
183
|
+
"bindableAs": [
|
|
184
|
+
"target"
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
"label": "Stop infrastructure",
|
|
188
|
+
"description": "Suspend the selected infrastructure environment while retaining its state."
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"id": "infra.destroy",
|
|
192
|
+
"owner": "@ankhorage/infra",
|
|
193
|
+
"access": [
|
|
194
|
+
"invoke"
|
|
195
|
+
],
|
|
196
|
+
"binding": {
|
|
197
|
+
"kind": "action",
|
|
198
|
+
"bindableAs": [
|
|
199
|
+
"target"
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
"label": "Destroy infrastructure",
|
|
203
|
+
"description": "Destroy the selected infrastructure environment after explicit confirmation."
|
|
204
|
+
}
|
|
88
205
|
]
|
|
89
206
|
},
|
|
90
207
|
"publishConfig": {
|
|
@@ -113,7 +230,7 @@
|
|
|
113
230
|
},
|
|
114
231
|
"devDependencies": {
|
|
115
232
|
"@ankhorage/cerbos": "^0.2.0",
|
|
116
|
-
"@ankhorage/devtools": "^2.1.
|
|
233
|
+
"@ankhorage/devtools": "^2.1.17",
|
|
117
234
|
"@ankhorage/docker-compose": "^0.5.3",
|
|
118
235
|
"@ankhorage/hetzner": "^0.3.0",
|
|
119
236
|
"@ankhorage/k3s": "^0.4.1",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { isCapability } from '@ankhorage/contracts/capabilities';
|
|
2
|
+
import { describe, expect, test } from 'bun:test';
|
|
3
|
+
|
|
4
|
+
import { CAPABILITIES } from './index.js';
|
|
5
|
+
|
|
6
|
+
describe('Infra capabilities', () => {
|
|
7
|
+
test('contains one canonical descriptor for every executable lifecycle operation', () => {
|
|
8
|
+
expect(CAPABILITIES).toHaveLength(8);
|
|
9
|
+
expect(CAPABILITIES.every(isCapability)).toBeTrue();
|
|
10
|
+
expect(new Set(CAPABILITIES.map(({ id }) => id)).size).toBe(CAPABILITIES.length);
|
|
11
|
+
for (const capability of CAPABILITIES) {
|
|
12
|
+
expect(capability.owner).toBe('@ankhorage/infra');
|
|
13
|
+
expect(capability.access).toEqual(['invoke']);
|
|
14
|
+
expect(capability.binding).toEqual({ kind: 'action', bindableAs: ['target'] });
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { Capability } from '@ankhorage/contracts/capabilities';
|
|
2
|
+
|
|
3
|
+
/*** Publish Infra's executable lifecycle operations for Ankh discovery and bindings. */
|
|
4
|
+
export const CAPABILITIES = [
|
|
5
|
+
{
|
|
6
|
+
id: 'infra.validate',
|
|
7
|
+
owner: '@ankhorage/infra',
|
|
8
|
+
access: ['invoke'],
|
|
9
|
+
binding: { kind: 'action', bindableAs: ['target'] },
|
|
10
|
+
label: 'Validate infrastructure',
|
|
11
|
+
description:
|
|
12
|
+
'Validate the manifest, credentials, compatibility, and selected infrastructure adapters.',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 'infra.plan',
|
|
16
|
+
owner: '@ankhorage/infra',
|
|
17
|
+
access: ['invoke'],
|
|
18
|
+
binding: { kind: 'action', bindableAs: ['target'] },
|
|
19
|
+
label: 'Plan infrastructure',
|
|
20
|
+
description: 'Calculate the infrastructure changes required for the selected environment.',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 'infra.generate',
|
|
24
|
+
owner: '@ankhorage/infra',
|
|
25
|
+
access: ['invoke'],
|
|
26
|
+
binding: { kind: 'action', bindableAs: ['target'] },
|
|
27
|
+
label: 'Generate infrastructure',
|
|
28
|
+
description: 'Generate infrastructure artifacts for the selected environment.',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'infra.up',
|
|
32
|
+
owner: '@ankhorage/infra',
|
|
33
|
+
access: ['invoke'],
|
|
34
|
+
binding: { kind: 'action', bindableAs: ['target'] },
|
|
35
|
+
label: 'Start infrastructure',
|
|
36
|
+
description: 'Ensure and reconcile the selected infrastructure environment.',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 'infra.status',
|
|
40
|
+
owner: '@ankhorage/infra',
|
|
41
|
+
access: ['invoke'],
|
|
42
|
+
binding: { kind: 'action', bindableAs: ['target'] },
|
|
43
|
+
label: 'Get infrastructure status',
|
|
44
|
+
description: 'Inspect the current status of the selected infrastructure environment.',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: 'infra.outputs',
|
|
48
|
+
owner: '@ankhorage/infra',
|
|
49
|
+
access: ['invoke'],
|
|
50
|
+
binding: { kind: 'action', bindableAs: ['target'] },
|
|
51
|
+
label: 'Get infrastructure outputs',
|
|
52
|
+
description:
|
|
53
|
+
'Read generated public and referenced outputs for the selected infrastructure environment.',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 'infra.down',
|
|
57
|
+
owner: '@ankhorage/infra',
|
|
58
|
+
access: ['invoke'],
|
|
59
|
+
binding: { kind: 'action', bindableAs: ['target'] },
|
|
60
|
+
label: 'Stop infrastructure',
|
|
61
|
+
description: 'Suspend the selected infrastructure environment while retaining its state.',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: 'infra.destroy',
|
|
65
|
+
owner: '@ankhorage/infra',
|
|
66
|
+
access: ['invoke'],
|
|
67
|
+
binding: { kind: 'action', bindableAs: ['target'] },
|
|
68
|
+
label: 'Destroy infrastructure',
|
|
69
|
+
description: 'Destroy the selected infrastructure environment after explicit confirmation.',
|
|
70
|
+
},
|
|
71
|
+
] as const satisfies readonly Capability[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { Capability } from '@ankhorage/contracts/capabilities';
|
|
1
2
|
import type { AppEnvironmentId } from '@ankhorage/contracts/environments';
|
|
2
3
|
|
|
3
|
-
import { INFRA_CAPABILITIES } from '../../constants.js';
|
|
4
4
|
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
5
5
|
import type { InfraDestroyOperationRequest } from '../../types/infraOrchestration.js';
|
|
6
6
|
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
@@ -12,7 +12,7 @@ import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
|
12
12
|
export const destroy = {
|
|
13
13
|
standaloneName: 'destroy',
|
|
14
14
|
path: ['destroy'],
|
|
15
|
-
capability:
|
|
15
|
+
capability: 'infra.destroy' satisfies Capability['id'],
|
|
16
16
|
summary: 'Destroy exact owned resources behind explicit confirmation.',
|
|
17
17
|
async run(request, services) {
|
|
18
18
|
const operation = await prepareInfraCommandOperationAsync(request, services, true);
|
package/src/cli/commands/down.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Capability } from '@ankhorage/contracts/capabilities';
|
|
2
|
+
|
|
2
3
|
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
3
4
|
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
4
5
|
import { requireInfraSuccess } from '../utils/requireInfraSuccess.js';
|
|
@@ -8,7 +9,7 @@ import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
|
8
9
|
export const down = {
|
|
9
10
|
standaloneName: 'down',
|
|
10
11
|
path: ['down'],
|
|
11
|
-
capability:
|
|
12
|
+
capability: 'infra.down' satisfies Capability['id'],
|
|
12
13
|
summary: 'Reversibly suspend runtime workloads while retaining persistent data.',
|
|
13
14
|
async run(request, services) {
|
|
14
15
|
const operation = await prepareInfraCommandOperationAsync(request, services);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Capability } from '@ankhorage/contracts/capabilities';
|
|
2
|
+
|
|
2
3
|
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
3
4
|
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
4
5
|
import { requireInfraSuccess } from '../utils/requireInfraSuccess.js';
|
|
@@ -8,7 +9,7 @@ import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
|
8
9
|
export const generate = {
|
|
9
10
|
standaloneName: 'generate',
|
|
10
11
|
path: ['generate'],
|
|
11
|
-
capability:
|
|
12
|
+
capability: 'infra.generate' satisfies Capability['id'],
|
|
12
13
|
summary: 'Generate deterministic review artifacts without remote side effects.',
|
|
13
14
|
async run(request, services) {
|
|
14
15
|
const operation = await prepareInfraCommandOperationAsync(request, services);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Capability } from '@ankhorage/contracts/capabilities';
|
|
2
|
+
|
|
2
3
|
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
3
4
|
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
4
5
|
import { requireInfraSuccess } from '../utils/requireInfraSuccess.js';
|
|
@@ -9,7 +10,7 @@ import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
|
9
10
|
export const outputs = {
|
|
10
11
|
standaloneName: 'outputs',
|
|
11
12
|
path: ['outputs'],
|
|
12
|
-
capability:
|
|
13
|
+
capability: 'infra.outputs' satisfies Capability['id'],
|
|
13
14
|
summary: 'Print safe public outputs and secret references.',
|
|
14
15
|
async run(request, services) {
|
|
15
16
|
const operation = await prepareInfraCommandOperationAsync(request, services);
|
package/src/cli/commands/plan.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Capability } from '@ankhorage/contracts/capabilities';
|
|
2
|
+
|
|
2
3
|
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
3
4
|
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
4
5
|
import { requireInfraSuccess } from '../utils/requireInfraSuccess.js';
|
|
@@ -8,7 +9,7 @@ import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
|
8
9
|
export const plan = {
|
|
9
10
|
standaloneName: 'plan',
|
|
10
11
|
path: ['plan'],
|
|
11
|
-
capability:
|
|
12
|
+
capability: 'infra.plan' satisfies Capability['id'],
|
|
12
13
|
summary: 'Print an ordered side-effect-free infrastructure plan.',
|
|
13
14
|
async run(request, services) {
|
|
14
15
|
const operation = await prepareInfraCommandOperationAsync(request, services);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Capability } from '@ankhorage/contracts/capabilities';
|
|
2
|
+
|
|
2
3
|
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
3
4
|
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
4
5
|
import { requireInfraSuccess } from '../utils/requireInfraSuccess.js';
|
|
@@ -8,7 +9,7 @@ import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
|
8
9
|
export const status = {
|
|
9
10
|
standaloneName: 'status',
|
|
10
11
|
path: ['status'],
|
|
11
|
-
capability:
|
|
12
|
+
capability: 'infra.status' satisfies Capability['id'],
|
|
12
13
|
summary: 'Aggregate provider-neutral environment status.',
|
|
13
14
|
async run(request, services) {
|
|
14
15
|
const operation = await prepareInfraCommandOperationAsync(request, services);
|
package/src/cli/commands/up.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Capability } from '@ankhorage/contracts/capabilities';
|
|
2
|
+
|
|
2
3
|
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
3
4
|
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
4
5
|
import { requireInfraSuccess } from '../utils/requireInfraSuccess.js';
|
|
@@ -8,7 +9,7 @@ import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
|
8
9
|
export const up = {
|
|
9
10
|
standaloneName: 'up',
|
|
10
11
|
path: ['up'],
|
|
11
|
-
capability:
|
|
12
|
+
capability: 'infra.up' satisfies Capability['id'],
|
|
12
13
|
summary: 'Idempotently ensure and reconcile the selected environment.',
|
|
13
14
|
async run(request, services) {
|
|
14
15
|
const operation = await prepareInfraCommandOperationAsync(request, services);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Capability } from '@ankhorage/contracts/capabilities';
|
|
2
|
+
|
|
2
3
|
import type { InfraCommandDefinition } from '../../types/infraCli.js';
|
|
3
4
|
import { prepareInfraCommandOperationAsync } from '../utils/prepareInfraCommandOperationAsync.js';
|
|
4
5
|
import { requireInfraSuccess } from '../utils/requireInfraSuccess.js';
|
|
@@ -8,7 +9,7 @@ import { writeInfraStructured } from '../utils/writeInfraStructured.js';
|
|
|
8
9
|
export const validate = {
|
|
9
10
|
standaloneName: 'validate',
|
|
10
11
|
path: ['validate'],
|
|
11
|
-
capability:
|
|
12
|
+
capability: 'infra.validate' satisfies Capability['id'],
|
|
12
13
|
summary: 'Validate manifest, compatibility, credentials and selected adapters.',
|
|
13
14
|
async run(request, services) {
|
|
14
15
|
const operation = await prepareInfraCommandOperationAsync(request, services);
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { AnkhRuntimeCommandProvider } from '@ankhorage/ankh';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
INFRA_COMMAND_CATEGORY,
|
|
6
|
-
INFRA_PACKAGE_NAME,
|
|
7
|
-
INFRA_PACKAGE_VERSION,
|
|
8
|
-
} from '../constants.js';
|
|
3
|
+
import { CAPABILITIES } from '../capabilities/index.js';
|
|
4
|
+
import { INFRA_COMMAND_CATEGORY, INFRA_PACKAGE_NAME, INFRA_PACKAGE_VERSION } from '../constants.js';
|
|
9
5
|
import type { CreateInfraRuntimeProviderOptions } from '../types/infraCli.js';
|
|
10
6
|
import { INFRA_COMMANDS } from './constants.js';
|
|
11
7
|
import { createProviderCommandDescriptors } from './createProviderCommandDescriptors.js';
|
|
@@ -20,7 +16,7 @@ export function createInfraRuntimeProvider(
|
|
|
20
16
|
id: INFRA_PACKAGE_NAME,
|
|
21
17
|
category: INFRA_COMMAND_CATEGORY,
|
|
22
18
|
version: INFRA_PACKAGE_VERSION,
|
|
23
|
-
capabilities:
|
|
19
|
+
capabilities: CAPABILITIES,
|
|
24
20
|
commands: createProviderCommandDescriptors(),
|
|
25
21
|
handlers: INFRA_COMMANDS.map((command) => ({
|
|
26
22
|
path: command.path,
|
package/src/cli/index.test.ts
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
import type { AnkhRuntimeCommandProvider } from '@ankhorage/ankh';
|
|
2
2
|
import { describe, expect, test } from 'bun:test';
|
|
3
3
|
|
|
4
|
+
import { CAPABILITIES } from '../capabilities/index.js';
|
|
4
5
|
import { createProviderCommandDescriptors } from './createProviderCommandDescriptors.js';
|
|
5
6
|
import provider, { createInfraRuntimeProvider } from './index.js';
|
|
6
7
|
|
|
7
8
|
describe('Infra Ankh provider', () => {
|
|
8
|
-
test('publishes
|
|
9
|
+
test('publishes the canonical capability descriptors and handlers', () => {
|
|
9
10
|
const expected = createInfraRuntimeProvider() satisfies AnkhRuntimeCommandProvider;
|
|
10
|
-
expect(expected.capabilities).toEqual(
|
|
11
|
-
'infra.validate',
|
|
12
|
-
'infra.plan',
|
|
13
|
-
'infra.generate',
|
|
14
|
-
'infra.up',
|
|
15
|
-
'infra.status',
|
|
16
|
-
'infra.outputs',
|
|
17
|
-
'infra.down',
|
|
18
|
-
'infra.destroy',
|
|
19
|
-
]);
|
|
11
|
+
expect(expected.capabilities).toEqual(CAPABILITIES);
|
|
20
12
|
expect(expected.commands).toEqual(createProviderCommandDescriptors());
|
|
21
13
|
expect(expected.handlers).toHaveLength(8);
|
|
22
14
|
expect(provider.handlers).toHaveLength(8);
|
package/src/commands.test.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { AppManifest } from '@ankhorage/contracts';
|
|
|
3
3
|
import type { InfraEnvironmentSpec, InfraLedger, InfraResult } from '@ankhorage/contracts/infra';
|
|
4
4
|
import { describe, expect, test } from 'bun:test';
|
|
5
5
|
|
|
6
|
+
import { CAPABILITIES } from './capabilities/index.js';
|
|
6
7
|
import { INFRA_COMMANDS } from './cli/constants.js';
|
|
7
8
|
import { createInfraRuntimeProvider } from './cli/createInfraRuntimeProvider.js';
|
|
8
9
|
import { createProviderCommandDescriptors } from './cli/createProviderCommandDescriptors.js';
|
|
@@ -17,6 +18,9 @@ describe('canonical Infra commands', () => {
|
|
|
17
18
|
test('exposes the same locked eight-command surface everywhere', () => {
|
|
18
19
|
const names = ['validate', 'plan', 'generate', 'up', 'status', 'outputs', 'down', 'destroy'];
|
|
19
20
|
expect(INFRA_COMMANDS.map(({ standaloneName }) => standaloneName)).toEqual(names);
|
|
21
|
+
expect(INFRA_COMMANDS.map(({ capability }) => capability)).toEqual(
|
|
22
|
+
CAPABILITIES.map(({ id }) => id),
|
|
23
|
+
);
|
|
20
24
|
expect(createProviderCommandDescriptors().map(({ path }) => path.join(' '))).toEqual(names);
|
|
21
25
|
const help = renderProviderHelp({
|
|
22
26
|
commandPrefix: ['ankhorage-infra'],
|
package/src/constants.ts
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AnkhCapabilityId,
|
|
3
|
-
AnkhCommandCategory,
|
|
4
|
-
AnkhPackageMetadata,
|
|
5
|
-
} from '@ankhorage/contracts/cli';
|
|
1
|
+
import type { AnkhCommandCategory, AnkhPackageMetadata } from '@ankhorage/contracts/cli';
|
|
6
2
|
|
|
7
3
|
import packageJson from '../package.json';
|
|
4
|
+
import { CAPABILITIES } from './capabilities/index.js';
|
|
8
5
|
|
|
9
6
|
export const INFRA_PACKAGE_NAME = packageJson.name;
|
|
10
7
|
export const INFRA_PACKAGE_VERSION = packageJson.version;
|
|
11
8
|
export const INFRA_PACKAGE_DESCRIPTION = packageJson.description;
|
|
12
9
|
export const INFRA_COMMAND_CATEGORY = 'infra' as const satisfies AnkhCommandCategory;
|
|
13
|
-
export const INFRA_CAPABILITIES = [
|
|
14
|
-
'infra.validate',
|
|
15
|
-
'infra.plan',
|
|
16
|
-
'infra.generate',
|
|
17
|
-
'infra.up',
|
|
18
|
-
'infra.status',
|
|
19
|
-
'infra.outputs',
|
|
20
|
-
'infra.down',
|
|
21
|
-
'infra.destroy',
|
|
22
|
-
] as const satisfies readonly AnkhCapabilityId[];
|
|
23
|
-
|
|
24
10
|
export const INFRA_PACKAGE_METADATA = {
|
|
25
11
|
category: INFRA_COMMAND_CATEGORY,
|
|
26
12
|
provider: './dist/cli/index.js',
|
|
27
|
-
capabilities:
|
|
13
|
+
capabilities: CAPABILITIES,
|
|
28
14
|
} as const satisfies AnkhPackageMetadata;
|