declastruct 1.7.2 → 1.8.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/dist/contract/cli/apply.js +13 -1
- package/dist/contract/cli/apply.js.map +1 -1
- package/dist/contract/cli/invoke.js +21 -1
- package/dist/contract/cli/invoke.js.map +1 -1
- package/dist/contract/cli/plan.d.ts +2 -1
- package/dist/contract/cli/plan.js +14 -3
- package/dist/contract/cli/plan.js.map +1 -1
- package/dist/domain.objects/ContextDeclastructCli.d.ts +15 -0
- package/dist/domain.objects/ContextDeclastructCli.js +3 -0
- package/dist/domain.objects/ContextDeclastructCli.js.map +1 -0
- package/dist/domain.objects/DeclastructChange.d.ts +5 -1
- package/dist/domain.objects/DeclastructChange.js +4 -0
- package/dist/domain.objects/DeclastructChange.js.map +1 -1
- package/dist/domain.objects/DeclastructPlan.d.ts +7 -1
- package/dist/domain.objects/DeclastructPlan.js.map +1 -1
- package/dist/domain.operations/apply/applyChanges.d.ts +2 -1
- package/dist/domain.operations/apply/applyChanges.js.map +1 -1
- package/dist/domain.operations/plan/computeChange.d.ts +2 -2
- package/dist/domain.operations/plan/computeChange.js +5 -2
- package/dist/domain.operations/plan/computeChange.js.map +1 -1
- package/dist/domain.operations/plan/planChanges.d.ts +2 -1
- package/dist/domain.operations/plan/planChanges.js +9 -1
- package/dist/domain.operations/plan/planChanges.js.map +1 -1
- package/dist/infra/colorizeAction.js +2 -0
- package/dist/infra/colorizeAction.js.map +1 -1
- package/package.json +9 -4
- package/readme.md +42 -0
|
@@ -90,6 +90,17 @@ const executeApplyCommand = async (input) => {
|
|
|
90
90
|
log.info(` plan: ${relativePlanPath}`);
|
|
91
91
|
log.info(` wish: ${relativeWishPath}`);
|
|
92
92
|
log.info('');
|
|
93
|
+
// create cli context with passthrough args from plan
|
|
94
|
+
const cliContext = {
|
|
95
|
+
passthrough: { argv: plan?.wish.argv ?? [] },
|
|
96
|
+
};
|
|
97
|
+
// inject argv from plan so wish file sees same args as plan time
|
|
98
|
+
// this ensures staleness check compares same resources
|
|
99
|
+
process.argv = [
|
|
100
|
+
process.argv[0],
|
|
101
|
+
process.argv[1],
|
|
102
|
+
...cliContext.passthrough.argv,
|
|
103
|
+
];
|
|
93
104
|
// import wish file
|
|
94
105
|
const wish = await Promise.resolve(`${resolvedWishPath}`).then(s => __importStar(require(s)));
|
|
95
106
|
// validate exports
|
|
@@ -103,10 +114,11 @@ const executeApplyCommand = async (input) => {
|
|
|
103
114
|
// initialize providers
|
|
104
115
|
// log.info('✨ start providers...');
|
|
105
116
|
await Promise.all(providers.map((p) => p.hooks.beforeAll()));
|
|
106
|
-
// create context
|
|
117
|
+
// create context with passthrough args
|
|
107
118
|
const context = {
|
|
108
119
|
bottleneck: new bottleneck_1.default({ maxConcurrent: 1 }),
|
|
109
120
|
log,
|
|
121
|
+
passthrough: cliContext.passthrough,
|
|
110
122
|
};
|
|
111
123
|
// apply changes (plan=null triggers yolo mode, skipping validation)
|
|
112
124
|
const result = await (0, applyChanges_1.applyChanges)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/contract/cli/apply.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,4DAAoC;AACpC,2BAAgC;AAChC,0CAAuC;AACvC,mDAAiD;AACjD,+BAAyC;AACzC,+DAAsD;
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/contract/cli/apply.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,4DAAoC;AACpC,2BAAgC;AAChC,0CAAuC;AACvC,mDAAiD;AACjD,+BAAyC;AACzC,+DAAsD;AAItD,yEAAsE;AACtE,4EAAyE;AAEzE,MAAM,GAAG,GAAG,OAAO,CAAC;AAEpB;;;;;;GAMG;AACI,MAAM,mBAAmB,GAAG,KAAK,EAAE,KAGzC,EAAiB,EAAE;IAClB,oCAA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U;QACzC,MAAM,IAAI,gCAAe,CAAC,+CAA+C,CAAC,CAAC;IAE7E,8BAA8B;IAC9B,MAAM,SAAS,GAAuB,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;IAChE,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;IAE5C,uBAAuB;IACvB,oCAAoC;IACpC,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IAElE,uCAAuC;IACvC,MAAM,OAAO,GAAG;QACd,UAAU,EAAE,IAAI,oBAAU,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;QAChD,GAAG;QACH,WAAW,EAAE,UAAU,CAAC,WAAW;KACpC,CAAC;IAEF,oEAAoE;IACpE,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAY,EAC/B;QACE,IAAI;QACJ,SAAS;QACT,SAAS;KACV,EACD,OAAO,CACR,CAAC;IAEF,oBAAoB;IACpB,gBAAgB;IAChB,mCAAmC;IACnC,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAEjE,cAAc;IACd,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACb,GAAG,CAAC,IAAI,CAAC,cAAc,MAAM,CAAC,cAAc,CAAC,MAAM,UAAU,CAAC,CAAC;IAC/D,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACf,CAAC,CAAC;AA5GW,QAAA,mBAAmB,uBA4G9B"}
|
|
@@ -25,11 +25,30 @@ const invoke = async ({ args }) => {
|
|
|
25
25
|
.description('Generate a change plan from a wish file')
|
|
26
26
|
.requiredOption('--wish <file>', 'Path to wish file')
|
|
27
27
|
.requiredOption('--into <file>', 'Path to output plan file')
|
|
28
|
-
.
|
|
28
|
+
.usage('--wish <file> --into <file> [-- <wish-args>]')
|
|
29
|
+
.allowExcessArguments(true)
|
|
30
|
+
.configureOutput({
|
|
31
|
+
writeErr: (str) => {
|
|
32
|
+
// intercept unknown option errors and add hint
|
|
33
|
+
if (str.includes('unknown option')) {
|
|
34
|
+
const match = str.match(/unknown option '([^']+)'/);
|
|
35
|
+
const flag = match?.[1] ?? '';
|
|
36
|
+
log.error(str.trim());
|
|
37
|
+
log.error(`hint: to pass args to your wish file, use: -- ${flag}`);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
log.error(str.trim());
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
.action(async (options, command) => {
|
|
29
45
|
try {
|
|
46
|
+
// capture args after -- separator
|
|
47
|
+
const passthroughArgs = command.args;
|
|
30
48
|
await (0, plan_1.executePlanCommand)({
|
|
31
49
|
wishFilePath: options.wish,
|
|
32
50
|
planFilePath: options.into,
|
|
51
|
+
passthroughArgs,
|
|
33
52
|
});
|
|
34
53
|
}
|
|
35
54
|
catch (error) {
|
|
@@ -42,6 +61,7 @@ const invoke = async ({ args }) => {
|
|
|
42
61
|
.description('Apply changes from a plan file')
|
|
43
62
|
.option('--plan <file>', 'Path to plan file, or "yolo" for immediate apply')
|
|
44
63
|
.option('--wish <file>', 'Path to wish file (required when --plan yolo)')
|
|
64
|
+
.allowExcessArguments(true) // ignore passthrough args - apply uses plan's captured state
|
|
45
65
|
.action(async (options) => {
|
|
46
66
|
try {
|
|
47
67
|
await (0, apply_1.executeApplyCommand)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke.js","sourceRoot":"","sources":["../../../src/contract/cli/invoke.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAoC;AAEpC,yEAAwC;AACxC,mCAA8C;AAC9C,iCAA4C;AAE5C,MAAM,GAAG,GAAG,OAAO,CAAC;AAEpB;;;;GA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EAAE,OAAO,CAAC,IAAI;gBAC1B,YAAY,EAAE,OAAO,CAAC,IAAI;aAC3B,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;YAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AACnD,CAAC,CAAC;AA9DW,QAAA,MAAM,UA8DjB"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* .why = provides CLI interface for planning infrastructure changes
|
|
5
5
|
* .note = requires wish file with getResources() and getProviders() exports
|
|
6
6
|
*/
|
|
7
|
-
export declare const executePlanCommand: ({ wishFilePath, planFilePath, }: {
|
|
7
|
+
export declare const executePlanCommand: ({ wishFilePath, planFilePath, passthroughArgs, }: {
|
|
8
8
|
wishFilePath: string;
|
|
9
9
|
planFilePath: string;
|
|
10
|
+
passthroughArgs?: string[];
|
|
10
11
|
}) => Promise<void>;
|
|
@@ -41,7 +41,7 @@ const log = console;
|
|
|
41
41
|
* .why = provides CLI interface for planning infrastructure changes
|
|
42
42
|
* .note = requires wish file with getResources() and getProviders() exports
|
|
43
43
|
*/
|
|
44
|
-
const executePlanCommand = async ({ wishFilePath, planFilePath, }) => {
|
|
44
|
+
const executePlanCommand = async ({ wishFilePath, planFilePath, passthroughArgs = [], }) => {
|
|
45
45
|
// resolve paths
|
|
46
46
|
const resolvedWishPath = (0, path_1.resolve)(process.cwd(), wishFilePath);
|
|
47
47
|
const resolvedPlanPath = (0, path_1.resolve)(process.cwd(), planFilePath);
|
|
@@ -58,7 +58,17 @@ const executePlanCommand = async ({ wishFilePath, planFilePath, }) => {
|
|
|
58
58
|
log.info(` wish: ${relativeWishPath}`);
|
|
59
59
|
log.info(` plan: ${relativePlanPath}`);
|
|
60
60
|
log.info('');
|
|
61
|
-
//
|
|
61
|
+
// create cli context with passthrough args
|
|
62
|
+
const cliContext = {
|
|
63
|
+
passthrough: { argv: passthroughArgs },
|
|
64
|
+
};
|
|
65
|
+
// inject passthrough args into process.argv before import
|
|
66
|
+
process.argv = [
|
|
67
|
+
process.argv[0],
|
|
68
|
+
process.argv[1],
|
|
69
|
+
...cliContext.passthrough.argv,
|
|
70
|
+
];
|
|
71
|
+
// import wish file (now sees passthrough.argv in process.argv)
|
|
62
72
|
const wish = await Promise.resolve(`${resolvedWishPath}`).then(s => __importStar(require(s)));
|
|
63
73
|
// validate exports
|
|
64
74
|
if (typeof wish.getResources !== 'function') {
|
|
@@ -73,10 +83,11 @@ const executePlanCommand = async ({ wishFilePath, planFilePath, }) => {
|
|
|
73
83
|
// initialize providers
|
|
74
84
|
// log.info('✨ start providers...');
|
|
75
85
|
await Promise.all(providers.map((p) => p.hooks.beforeAll()));
|
|
76
|
-
// create context
|
|
86
|
+
// create context with passthrough args
|
|
77
87
|
const context = {
|
|
78
88
|
bottleneck: new bottleneck_1.default({ maxConcurrent: 1 }),
|
|
79
89
|
log,
|
|
90
|
+
passthrough: cliContext.passthrough,
|
|
80
91
|
};
|
|
81
92
|
// plan changes (logs emitted in real-time by planChanges)
|
|
82
93
|
const plan = await (0, planChanges_1.planChanges)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../src/contract/cli/plan.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,4DAAoC;AACpC,2BAAgC;AAChC,0CAA+C;AAC/C,mDAAiD;AACjD,+BAAkD;AAClD,+DAAsD;
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../src/contract/cli/plan.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,4DAAoC;AACpC,2BAAgC;AAChC,0CAA+C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,IAAA,gBAAK,EAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE1C,qBAAqB;IACrB,MAAM,IAAA,oBAAS,EAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAE1E,oBAAoB;IACpB,gBAAgB;IAChB,mCAAmC;IACnC,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAEjE,cAAc;IACd,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACb,GAAG,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,OAAO,CAAC,MAAM,YAAY,CAAC,CAAC;IAC5D,GAAG,CAAC,IAAI,CAAC,WAAW,gBAAgB,EAAE,CAAC,CAAC;IACxC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACf,CAAC,CAAC;AA9FW,QAAA,kBAAkB,sBA8F7B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* .what = context for CLI operations with passthrough args
|
|
3
|
+
* .why = enables wish files to receive args passed via -- separator
|
|
4
|
+
*/
|
|
5
|
+
export type ContextDeclastructCli = {
|
|
6
|
+
/**
|
|
7
|
+
* args passed through from CLI via -- separator
|
|
8
|
+
*/
|
|
9
|
+
passthrough: {
|
|
10
|
+
/**
|
|
11
|
+
* argv to inject into process.argv before wish file import
|
|
12
|
+
*/
|
|
13
|
+
argv: string[];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextDeclastructCli.js","sourceRoot":"","sources":["../../src/domain.objects/ContextDeclastructCli.ts"],"names":[],"mappings":""}
|
|
@@ -23,7 +23,11 @@ export declare enum DeclastructChangeAction {
|
|
|
23
23
|
/**
|
|
24
24
|
* replace an existing resource (delete then create)
|
|
25
25
|
*/
|
|
26
|
-
REPLACE = "REPLACE"
|
|
26
|
+
REPLACE = "REPLACE",
|
|
27
|
+
/**
|
|
28
|
+
* omit from instructions (resource doesn't exist and isn't desired)
|
|
29
|
+
*/
|
|
30
|
+
OMIT = "OMIT"
|
|
27
31
|
}
|
|
28
32
|
/**
|
|
29
33
|
* .what = describes a single change required to align remote state with desired state
|
|
@@ -28,6 +28,10 @@ var DeclastructChangeAction;
|
|
|
28
28
|
* replace an existing resource (delete then create)
|
|
29
29
|
*/
|
|
30
30
|
DeclastructChangeAction["REPLACE"] = "REPLACE";
|
|
31
|
+
/**
|
|
32
|
+
* omit from instructions (resource doesn't exist and isn't desired)
|
|
33
|
+
*/
|
|
34
|
+
DeclastructChangeAction["OMIT"] = "OMIT";
|
|
31
35
|
})(DeclastructChangeAction || (exports.DeclastructChangeAction = DeclastructChangeAction = {}));
|
|
32
36
|
class DeclastructChange extends domain_objects_1.DomainLiteral {
|
|
33
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeclastructChange.js","sourceRoot":"","sources":["../../src/domain.objects/DeclastructChange.ts"],"names":[],"mappings":";;;AAAA,mDAAkE;AAElE;;;GAGG;AACH,IAAY,
|
|
1
|
+
{"version":3,"file":"DeclastructChange.js","sourceRoot":"","sources":["../../src/domain.objects/DeclastructChange.ts"],"names":[],"mappings":";;;AAAA,mDAAkE;AAElE;;;GAGG;AACH,IAAY,uBA8BX;AA9BD,WAAY,uBAAuB;IACjC;;OAEG;IACH,wCAAa,CAAA;IAEb;;OAEG;IACH,4CAAiB,CAAA;IAEjB;;OAEG;IACH,4CAAiB,CAAA;IAEjB;;OAEG;IACH,8CAAmB,CAAA;IAEnB;;OAEG;IACH,8CAAmB,CAAA;IAEnB;;OAEG;IACH,wCAAa,CAAA;AACf,CAAC,EA9BW,uBAAuB,uCAAvB,uBAAuB,QA8BlC;AAsDD,MAAa,iBAGX,SAAQ,8BAA2C;CACT;AAJ5C,8CAI4C"}
|
|
@@ -19,9 +19,15 @@ export interface DeclastructPlan {
|
|
|
19
19
|
*/
|
|
20
20
|
wish: {
|
|
21
21
|
/**
|
|
22
|
-
* file path URI to the wish file
|
|
22
|
+
* file path URI to the wish file
|
|
23
23
|
*/
|
|
24
24
|
uri: string;
|
|
25
|
+
/**
|
|
26
|
+
* args passed via -- separator at plan time
|
|
27
|
+
*
|
|
28
|
+
* .why = apply must replay these to get same resources for staleness check
|
|
29
|
+
*/
|
|
30
|
+
argv: string[];
|
|
25
31
|
};
|
|
26
32
|
/**
|
|
27
33
|
* all proposed changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeclastructPlan.js","sourceRoot":"","sources":["../../src/domain.objects/DeclastructPlan.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;
|
|
1
|
+
{"version":3,"file":"DeclastructPlan.js","sourceRoot":"","sources":["../../src/domain.objects/DeclastructPlan.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AA2C9C,MAAa,eACX,SAAQ,6BAA6B;;AADvC,0CAOC;AAHe,uBAAO,GAAG,CAAC,MAAM,CAAU,CAAC;AAC5B,sBAAM,GAAG,CAAC,MAAM,CAAU,CAAC;AAC3B,yBAAS,GAAG,EAAW,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type DomainEntity } from 'domain-objects';
|
|
2
2
|
import type { ContextLogTrail } from 'simple-log-methods';
|
|
3
3
|
import type { ContextDeclastruct } from '../../domain.objects/ContextDeclastruct';
|
|
4
|
+
import type { ContextDeclastructCli } from '../../domain.objects/ContextDeclastructCli';
|
|
4
5
|
import { type DeclastructChange } from '../../domain.objects/DeclastructChange';
|
|
5
6
|
import type { DeclastructPlan } from '../../domain.objects/DeclastructPlan';
|
|
6
7
|
import type { DeclastructProvider } from '../../domain.objects/DeclastructProvider';
|
|
@@ -15,6 +16,6 @@ export declare const applyChanges: (input: {
|
|
|
15
16
|
plan: DeclastructPlan | null;
|
|
16
17
|
resources: DomainEntity<any>[];
|
|
17
18
|
providers: DeclastructProvider<any, any>[];
|
|
18
|
-
}, context: ContextLogTrail & ContextDeclastruct) => Promise<{
|
|
19
|
+
}, context: ContextLogTrail & ContextDeclastruct & ContextDeclastructCli) => Promise<{
|
|
19
20
|
appliedChanges: DeclastructChange[];
|
|
20
21
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyChanges.js","sourceRoot":"","sources":["../../../src/domain.operations/apply/applyChanges.ts"],"names":[],"mappings":";;;AAAA,mDAA4E;AAC5E,mDAAyD;
|
|
1
|
+
{"version":3,"file":"applyChanges.js","sourceRoot":"","sources":["../../../src/domain.operations/apply/applyChanges.ts"],"names":[],"mappings":";;;AAAA,mDAA4E;AAC5E,mDAAyD;AAKzD,6EAG+C;AAG/C,yEAAsE;AACtE,mEAA4E;AAC5E,8DAA2D;AAC3D,wDAAqD;AAErD,+CAA4C;AAE5C;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,KAAK,EAC/B,KAIC,EACD,OAAqE,EACnB,EAAE;IACpD,8BAA8B;IAC9B,MAAM,WAAW,GAAG,MAAM,IAAA,yBAAW,EACnC;QACE,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,YAAY,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,WAAW;KAClD,EACD,OAAO,CACR,CAAC;IAEF,oDAAoD;IACpD,MAAM,WAAW,GAAG,WAAW,CAAC;IAEhC,uDAAuD;IACvD,MAAM,oBAAoB,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CACnD,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,2CAAuB,CAAC,IAAI,CAC3D,CAAC;IAEF,4CAA4C;IAC5C,IAAI,CAAC,oBAAoB;QAAE,OAAO,EAAE,cA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,MAAM,CAAC,WAAW,CAAC,IAAI,CACjE;YACD,wCAAuB,CAAC,KAAK,CAC3B,4DAA4D,EAC5D,EAAE,MAAM,EAAE,CACX,CAAC;QAEJ,oCAAoC;QACpC,MAAM,WAAW,GAAG,IAAA,+BAAc,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,WAAW,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;QAEhE,8CAA8C;QAC9C,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,IAAA,yBAAW,EAAC;YACxD,OAAO,EAAE,UAAU;YACnB,SAAS,EAAE,GAAG,EAAE,CACd,IAAA,yBAAW,EAAC;gBACV,MAAM;gBACN,QAAQ,EAAE,aAAa;gBACvB,SAAS,EAAE,KAAK,CAAC,SAAS;aAC3B,CAAC;SACL,CAAC,CAAC;QAEH,+BAA+B;QAC/B,MAAM,WAAW,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,WAAW,GAAG,CAAC,CAAC;QACpD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAErB,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,EAAE,cAAc,EAAE,CAAC;AAC5B,CAAC,CAAC;AA/FW,QAAA,YAAY,gBA+FvB"}
|
|
@@ -3,9 +3,9 @@ import { DeclastructChange } from '../../domain.objects/DeclastructChange';
|
|
|
3
3
|
/**
|
|
4
4
|
* .what = computes a single change by comparing desired vs remote state
|
|
5
5
|
* .why = determines the action needed to achieve desired state for one resource
|
|
6
|
-
* .note =
|
|
6
|
+
* .note = returns null when both desired and remote are null (nothing to track)
|
|
7
7
|
*/
|
|
8
8
|
export declare const computeChange: ({ desired, remote, }: {
|
|
9
9
|
desired: DomainEntity<any> | null;
|
|
10
10
|
remote: DomainEntity<any> | null;
|
|
11
|
-
}) => DeclastructChange;
|
|
11
|
+
}) => DeclastructChange | null;
|
|
@@ -19,12 +19,15 @@ const checkAreResourcesEquivalent = (input) => {
|
|
|
19
19
|
/**
|
|
20
20
|
* .what = computes a single change by comparing desired vs remote state
|
|
21
21
|
* .why = determines the action needed to achieve desired state for one resource
|
|
22
|
-
* .note =
|
|
22
|
+
* .note = returns null when both desired and remote are null (nothing to track)
|
|
23
23
|
*/
|
|
24
24
|
const computeChange = ({ desired, remote, }) => {
|
|
25
|
+
// resource doesn't exist and isn't desired - nothing to track
|
|
26
|
+
if (!remote && !desired)
|
|
27
|
+
return null;
|
|
25
28
|
// determine action based on state comparison
|
|
26
29
|
const action = (() => {
|
|
27
|
-
// resource doesn't exist remotely
|
|
30
|
+
// resource doesn't exist remotely but is desired - create it
|
|
28
31
|
if (!remote)
|
|
29
32
|
return DeclastructChange_1.DeclastructChangeAction.CREATE;
|
|
30
33
|
// resource exists but should be deleted
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeChange.js","sourceRoot":"","sources":["../../../src/domain.operations/plan/computeChange.ts"],"names":[],"mappings":";;;AAAA,mDAKwB;AACxB,mDAAyD;AAEzD,6EAG+C;AAE/C,6DAA0D;AAE1D;;;;GAIG;AACH,MAAM,2BAA2B,GAAG,CAAC,KAGpC,EAAW,EAAE;IACZ,0EAA0E;IAC1E,MAAM,gBAAgB,GAAG,IAAA,0BAAS,EAAC,IAAA,6BAAY,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/D,MAAM,iBAAiB,GAAG,IAAA,0BAAS,EAAC,IAAA,6BAAY,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAEjE,OAAO,gBAAgB,KAAK,iBAAiB,CAAC;AAChD,CAAC,CAAC;AAEF;;;;GAIG;AACI,MAAM,aAAa,GAAG,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QAAA,aAAa,iBAwExB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type DomainEntity } from 'domain-objects';
|
|
2
2
|
import type { ContextLogTrail } from 'simple-log-methods';
|
|
3
3
|
import type { ContextDeclastruct } from '../../domain.objects/ContextDeclastruct';
|
|
4
|
+
import type { ContextDeclastructCli } from '../../domain.objects/ContextDeclastructCli';
|
|
4
5
|
import { DeclastructPlan } from '../../domain.objects/DeclastructPlan';
|
|
5
6
|
import type { DeclastructProvider } from '../../domain.objects/DeclastructProvider';
|
|
6
7
|
/**
|
|
@@ -12,4 +13,4 @@ export declare const planChanges: (input: {
|
|
|
12
13
|
resources: DomainEntity<any>[];
|
|
13
14
|
providers: DeclastructProvider<any, any>[];
|
|
14
15
|
wishFilePath: string;
|
|
15
|
-
}, context: ContextLogTrail & ContextDeclastruct) => Promise<DeclastructPlan>;
|
|
16
|
+
}, context: ContextLogTrail & ContextDeclastruct & ContextDeclastructCli) => Promise<DeclastructPlan>;
|
|
@@ -50,6 +50,12 @@ const planChanges = async (input, context) => {
|
|
|
50
50
|
desired: desiredState,
|
|
51
51
|
remote: remoteState,
|
|
52
52
|
});
|
|
53
|
+
// skip if nothing to track (resource doesn't exist and isn't desired)
|
|
54
|
+
if (!computed) {
|
|
55
|
+
context.log.info(` └─ decision ${(0, colorizeAction_1.colorizeAction)(DeclastructChange_1.DeclastructChangeAction.OMIT)}`);
|
|
56
|
+
context.log.info('');
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
53
59
|
// log decision
|
|
54
60
|
context.log.info(` └─ decision ${(0, colorizeAction_1.colorizeAction)(computed.action)}`);
|
|
55
61
|
// and the diff too, indented to align with tree
|
|
@@ -63,7 +69,8 @@ const planChanges = async (input, context) => {
|
|
|
63
69
|
context.log.info('');
|
|
64
70
|
return computed;
|
|
65
71
|
});
|
|
66
|
-
|
|
72
|
+
if (change)
|
|
73
|
+
changes.push(change);
|
|
67
74
|
}
|
|
68
75
|
// log success message if everything is in sync
|
|
69
76
|
const allInSync = changes.every((change) => change.action === DeclastructChange_1.DeclastructChangeAction.KEEP);
|
|
@@ -77,6 +84,7 @@ const planChanges = async (input, context) => {
|
|
|
77
84
|
createdAt: (0, asIsoTimestamp_1.asIsoTimestamp)(new Date()),
|
|
78
85
|
wish: {
|
|
79
86
|
uri: input.wishFilePath,
|
|
87
|
+
argv: context.passthrough.argv,
|
|
80
88
|
},
|
|
81
89
|
changes,
|
|
82
90
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planChanges.js","sourceRoot":"","sources":["../../../src/domain.operations/plan/planChanges.ts"],"names":[],"mappings":";;;AAAA,mDAA4E;
|
|
1
|
+
{"version":3,"file":"planChanges.js","sourceRoot":"","sources":["../../../src/domain.operations/plan/planChanges.ts"],"names":[],"mappings":";;;AAAA,mDAA4E;AAK5E,6EAAgF;AAChF,yEAAsE;AAEtE,wDAAqE;AACrE,8DAA2D;AAC3D,8DAA2D;AAC3D,wDAAqD;AAErD,mDAAgD;AAChD,yDAAsD;AACtD,+CAA4C;AAE5C;;;;GAIG;AACI,MAAM,WAAW,GAAG,KAAK,EAC9B,KAIC,EACD,OAAqE,EAC3C,EAAE;IAC5B,wBAAwB;IACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAErB,kCAAkC;IAClC,MAAM,UAAU,GACd,QAAQ,IAAI,OAAO,CAAC,UAAU;QAC5B,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM;QAC3B,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAEzB,0DAA0D;IAC1D,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE;YAClD,k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AO;KACR,CAAC,CAAC;AACL,CAAC,CAAC;AAhGW,QAAA,WAAW,eAgGtB"}
|
|
@@ -23,6 +23,8 @@ const colorizeAction = (action) => {
|
|
|
23
23
|
return chalk_1.default.hex('#fca5a5')('[DESTROY]'); // pastel red
|
|
24
24
|
case DeclastructChange_1.DeclastructChangeAction.REPLACE:
|
|
25
25
|
return chalk_1.default.hex('#fca5a5')('[REPLACE]'); // pastel red, since it includes a destroy
|
|
26
|
+
case DeclastructChange_1.DeclastructChangeAction.OMIT:
|
|
27
|
+
return chalk_1.default.hex('#9ca3af')('[OMIT]'); // pastel gray
|
|
26
28
|
default:
|
|
27
29
|
return `[${action}]`;
|
|
28
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorizeAction.js","sourceRoot":"","sources":["../../src/infra/colorizeAction.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,6EAAgF;AAEhF;;;;GAIG;AACI,MAAM,cAAc,GAAG,CAAC,MAA+B,EAAU,EAAE;IACxE,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,2CAAuB,CAAC,IAAI;YAC/B,OAAO,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc;QACvD,KAAK,2CAAuB,CAAC,MAAM;YACjC,OAAO,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe;QAC1D,KAAK,2CAAuB,CAAC,MAAM;YACjC,OAAO,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB;QAC3D,KAAK,2CAAuB,CAAC,OAAO;YAClC,OAAO,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa;QACzD,KAAK,2CAAuB,CAAC,OAAO;YAClC,OAAO,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,0CAA0C;QACtF;YACE,OAAO,IAAI,MAAM,GAAG,CAAC;IACzB,CAAC;AACH,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"colorizeAction.js","sourceRoot":"","sources":["../../src/infra/colorizeAction.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,6EAAgF;AAEhF;;;;GAIG;AACI,MAAM,cAAc,GAAG,CAAC,MAA+B,EAAU,EAAE;IACxE,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,2CAAuB,CAAC,IAAI;YAC/B,OAAO,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc;QACvD,KAAK,2CAAuB,CAAC,MAAM;YACjC,OAAO,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe;QAC1D,KAAK,2CAAuB,CAAC,MAAM;YACjC,OAAO,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB;QAC3D,KAAK,2CAAuB,CAAC,OAAO;YAClC,OAAO,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa;QACzD,KAAK,2CAAuB,CAAC,OAAO;YAClC,OAAO,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,0CAA0C;QACtF,KAAK,2CAAuB,CAAC,IAAI;YAC/B,OAAO,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc;QACvD;YACE,OAAO,IAAI,MAAM,GAAG,CAAC;IACzB,CAAC;AACH,CAAC,CAAC;AAjBW,QAAA,cAAc,kBAiBzB"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "declastruct",
|
|
3
3
|
"author": "ehmpathy",
|
|
4
4
|
"description": "Add declarative control to any resource constructs. Declare, plan, and apply within an observable pit-of-success.",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.8.0",
|
|
6
6
|
"repository": "ehmpathy/declastruct",
|
|
7
7
|
"homepage": "https://github.com/ehmpathy/declastruct",
|
|
8
8
|
"keywords": [
|
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
"preversion": "npm run prepush",
|
|
54
54
|
"postversion": "git push origin HEAD --tags --no-verify",
|
|
55
55
|
"prepare:husky": "npx husky install && chmod ug+x .husky/*",
|
|
56
|
-
"prepare": "[ -e .git ] && npm run prepare:husky || exit 0"
|
|
56
|
+
"prepare": "[ -e .git ] && npm run prepare:husky || exit 0 && npm run prepare:rhachet",
|
|
57
|
+
"prepare:rhachet": "rhachet init --hooks --roles mechanic behaver driver reviewer librarian ergonomist architect reflector dreamer dispatcher"
|
|
57
58
|
},
|
|
58
59
|
"dependencies": {
|
|
59
60
|
"bottleneck": "2.19.5",
|
|
@@ -90,8 +91,12 @@
|
|
|
90
91
|
"esbuild-register": "3.6.0",
|
|
91
92
|
"husky": "8.0.3",
|
|
92
93
|
"jest": "30.2.0",
|
|
93
|
-
"rhachet": "1.
|
|
94
|
-
"rhachet-
|
|
94
|
+
"rhachet": "1.39.10",
|
|
95
|
+
"rhachet-brains-anthropic": "0.4.0",
|
|
96
|
+
"rhachet-brains-xai": "0.3.3",
|
|
97
|
+
"rhachet-roles-bhrain": "0.23.12",
|
|
98
|
+
"rhachet-roles-bhuild": "0.17.1",
|
|
99
|
+
"rhachet-roles-ehmpathy": "1.34.27",
|
|
95
100
|
"test-fns": "1.7.2",
|
|
96
101
|
"tsc-alias": "1.8.10",
|
|
97
102
|
"tsx": "4.20.6",
|
package/readme.md
CHANGED
|
@@ -120,6 +120,48 @@ planned changes:
|
|
|
120
120
|
+ metadata: { source: "app-web" }
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
+
#### pass args to your wish file
|
|
124
|
+
|
|
125
|
+
pass args to your wish file via `--` separator:
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
npx declastruct plan \
|
|
129
|
+
--wish provision/resources.ts \
|
|
130
|
+
--into provision/.temp/plan.json \
|
|
131
|
+
-- --env prod --region us-west-2
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
args after `--` are injected into `process.argv` before the wish file loads. parse them with node's `parseArgs`:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
import { parseArgs } from 'util';
|
|
138
|
+
|
|
139
|
+
const { values } = parseArgs({
|
|
140
|
+
args: process.argv.slice(2),
|
|
141
|
+
options: {
|
|
142
|
+
env: { type: 'string', default: 'test' },
|
|
143
|
+
region: { type: 'string', default: 'us-east-1' },
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
export const getResources = async () => {
|
|
148
|
+
// use values.env, values.region to configure resources
|
|
149
|
+
return [
|
|
150
|
+
DeclaredAwsS3Bucket.as({
|
|
151
|
+
name: `app-${values.env}-assets`,
|
|
152
|
+
region: values.region,
|
|
153
|
+
}),
|
|
154
|
+
];
|
|
155
|
+
};
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**typo safety:** unknown flags without `--` trigger an error with guidance:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
error: unknown option '--env'
|
|
162
|
+
hint: to pass args to your wish file, use: -- --env
|
|
163
|
+
```
|
|
164
|
+
|
|
123
165
|
### 3. **apply** the plan 🪄
|
|
124
166
|
|
|
125
167
|
apply the plan to make your wish come true
|