@go-to-k/cdkd 0.31.0 → 0.31.1
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/README.md +18 -0
- package/dist/cli.js +31 -8
- package/dist/cli.js.map +2 -2
- package/dist/go-to-k-cdkd-0.31.1.tgz +0 -0
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/dist/go-to-k-cdkd-0.31.0.tgz +0 -0
package/README.md
CHANGED
|
@@ -414,6 +414,24 @@ per-resource timeout flags (`--resource-warn-after`,
|
|
|
414
414
|
and the rationale for the 30m default), see
|
|
415
415
|
**[docs/cli-reference.md](docs/cli-reference.md)**.
|
|
416
416
|
|
|
417
|
+
## Exit codes
|
|
418
|
+
|
|
419
|
+
cdkd commands distinguish three outcomes via the process exit code so
|
|
420
|
+
CI / bench scripts can react without grepping log output:
|
|
421
|
+
|
|
422
|
+
| Exit | Meaning |
|
|
423
|
+
|------|---------|
|
|
424
|
+
| `0` | Success — command completed and no resources are in an error state |
|
|
425
|
+
| `1` | Command-level failure — auth error, bad arguments, synth crash, unhandled exception |
|
|
426
|
+
| `2` | **Partial failure** — work completed but one or more resources failed (state.json is preserved, re-running typically resolves it) |
|
|
427
|
+
|
|
428
|
+
Exit `2` is currently emitted by `cdkd destroy` and `cdkd state
|
|
429
|
+
destroy` when one or more per-resource deletes fail. The summary line
|
|
430
|
+
also switches from `✓ Stack X destroyed` to `⚠ Stack X partially
|
|
431
|
+
destroyed (...). State preserved — re-run 'cdkd destroy' / 'cdkd
|
|
432
|
+
state destroy' to clean up.` so the visual marker matches the exit
|
|
433
|
+
code.
|
|
434
|
+
|
|
417
435
|
## Example
|
|
418
436
|
|
|
419
437
|
```typescript
|
package/dist/cli.js
CHANGED
|
@@ -1170,6 +1170,14 @@ var DependencyError = class _DependencyError extends CdkdError {
|
|
|
1170
1170
|
Object.setPrototypeOf(this, _DependencyError.prototype);
|
|
1171
1171
|
}
|
|
1172
1172
|
};
|
|
1173
|
+
var PartialFailureError = class _PartialFailureError extends CdkdError {
|
|
1174
|
+
exitCode = 2;
|
|
1175
|
+
constructor(message, cause) {
|
|
1176
|
+
super(message, "PARTIAL_FAILURE", cause);
|
|
1177
|
+
this.name = "PartialFailureError";
|
|
1178
|
+
Object.setPrototypeOf(this, _PartialFailureError.prototype);
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1173
1181
|
function isCdkdError(error) {
|
|
1174
1182
|
return error instanceof CdkdError;
|
|
1175
1183
|
}
|
|
@@ -1193,7 +1201,8 @@ function handleError(error) {
|
|
|
1193
1201
|
if (error instanceof Error && error.stack) {
|
|
1194
1202
|
logger.debug("Stack trace:", error.stack);
|
|
1195
1203
|
}
|
|
1196
|
-
|
|
1204
|
+
const exitCode = error instanceof PartialFailureError ? error.exitCode : 1;
|
|
1205
|
+
process.exit(exitCode);
|
|
1197
1206
|
}
|
|
1198
1207
|
function withErrorHandling(fn) {
|
|
1199
1208
|
return async (...args) => {
|
|
@@ -33548,10 +33557,17 @@ Acquiring lock for stack ${stackName}...`);
|
|
|
33548
33557
|
} else {
|
|
33549
33558
|
logger.warn(`${result.errorCount} resource(s) failed to delete. State preserved.`);
|
|
33550
33559
|
}
|
|
33551
|
-
|
|
33552
|
-
|
|
33560
|
+
if (result.errorCount === 0) {
|
|
33561
|
+
logger.info(
|
|
33562
|
+
`
|
|
33553
33563
|
\u2713 Stack ${stackName} destroyed (${result.deletedCount} deleted, ${result.errorCount} errors)`
|
|
33554
|
-
|
|
33564
|
+
);
|
|
33565
|
+
} else {
|
|
33566
|
+
logger.warn(
|
|
33567
|
+
`
|
|
33568
|
+
\u26A0 Stack ${stackName} partially destroyed (${result.deletedCount} deleted, ${result.errorCount} errors). State preserved \u2014 re-run 'cdkd destroy' / 'cdkd state destroy' to clean up.`
|
|
33569
|
+
);
|
|
33570
|
+
}
|
|
33555
33571
|
} finally {
|
|
33556
33572
|
renderer.stop();
|
|
33557
33573
|
logger.debug("Releasing lock...");
|
|
@@ -33671,6 +33687,7 @@ async function destroyCommand(stackArgs, options) {
|
|
|
33671
33687
|
arr.push(ref);
|
|
33672
33688
|
stateRefsByName.set(ref.stackName, arr);
|
|
33673
33689
|
}
|
|
33690
|
+
let totalErrors = 0;
|
|
33674
33691
|
for (const stackName of stackNames) {
|
|
33675
33692
|
logger.info(`
|
|
33676
33693
|
Preparing to destroy stack: ${stackName}`);
|
|
@@ -33701,7 +33718,7 @@ Preparing to destroy stack: ${stackName}`);
|
|
|
33701
33718
|
logger.warn(`No state found for stack ${stackName}, skipping`);
|
|
33702
33719
|
continue;
|
|
33703
33720
|
}
|
|
33704
|
-
await runDestroyForStack(stackName, stateResult.state, {
|
|
33721
|
+
const result = await runDestroyForStack(stackName, stateResult.state, {
|
|
33705
33722
|
stateBackend,
|
|
33706
33723
|
lockManager,
|
|
33707
33724
|
providerRegistry,
|
|
@@ -33723,6 +33740,12 @@ Preparing to destroy stack: ${stackName}`);
|
|
|
33723
33740
|
resourceTimeoutByType: options.resourceTimeout.perTypeMs
|
|
33724
33741
|
}
|
|
33725
33742
|
});
|
|
33743
|
+
totalErrors += result.errorCount;
|
|
33744
|
+
}
|
|
33745
|
+
if (totalErrors > 0) {
|
|
33746
|
+
throw new PartialFailureError(
|
|
33747
|
+
`Destroy completed with ${totalErrors} resource error(s). State preserved \u2014 inspect 'cdkd state show <stack>' and re-run 'cdkd destroy' to retry.`
|
|
33748
|
+
);
|
|
33726
33749
|
}
|
|
33727
33750
|
} finally {
|
|
33728
33751
|
awsClients.destroy();
|
|
@@ -35420,8 +35443,8 @@ Preparing to destroy stack: ${stackName}${ref.region ? ` (${ref.region})` : ""}`
|
|
|
35420
35443
|
}
|
|
35421
35444
|
}
|
|
35422
35445
|
if (totalErrors > 0) {
|
|
35423
|
-
throw new
|
|
35424
|
-
`Destroy completed with ${totalErrors} resource error(s).
|
|
35446
|
+
throw new PartialFailureError(
|
|
35447
|
+
`Destroy completed with ${totalErrors} resource error(s). State preserved \u2014 inspect 'cdkd state show <stack>' and re-run 'cdkd state destroy' to retry.`
|
|
35425
35448
|
);
|
|
35426
35449
|
}
|
|
35427
35450
|
} finally {
|
|
@@ -36330,7 +36353,7 @@ function reorderArgs(argv) {
|
|
|
36330
36353
|
}
|
|
36331
36354
|
async function main() {
|
|
36332
36355
|
const program = new Command13();
|
|
36333
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.31.
|
|
36356
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.31.1");
|
|
36334
36357
|
program.addCommand(createBootstrapCommand());
|
|
36335
36358
|
program.addCommand(createSynthCommand());
|
|
36336
36359
|
program.addCommand(createListCommand());
|