cdk-real-drift 0.4.0 → 0.4.2

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 CHANGED
@@ -333,6 +333,10 @@ CI (with `--yes`).
333
333
  is always surfaced regardless (as the `skipped=N` footer line or a loud
334
334
  `warning:`); `--strict` only decides whether it fails the build.
335
335
  - Errors always exit `2`; `revert` exits `1` when drift remains after it.
336
+ - Interrupting a run with **Ctrl-C** (or **ESC**) during the gather/read phase
337
+ exits `130` (128 + SIGINT) for every verb — never `0`, so an aborted
338
+ `check --fail` can never be mistaken for "no drift" and an aborted `record` is
339
+ never a false "written".
336
340
 
337
341
  ```yaml
338
342
  - run: npm ci # cdkrd resolves the CDK app, so its deps must be installed
package/dist/cli.js CHANGED
@@ -71,6 +71,29 @@ async function flushAndExit(code) {
71
71
  process.exit(code);
72
72
  }
73
73
 
74
+ //#endregion
75
+ //#region src/interrupt.ts
76
+ let gatherActive = false;
77
+ function setGatherActive(active) {
78
+ gatherActive = active;
79
+ }
80
+ function interruptExitCode(code, active) {
81
+ return active && (code === void 0 || code === 0) ? 130 : code ?? 0;
82
+ }
83
+ let installed = false;
84
+ function installInterruptGuard() {
85
+ if (installed) return;
86
+ installed = true;
87
+ const realExit = process.exit.bind(process);
88
+ process.exit = (code) => realExit(interruptExitCode(code, gatherActive));
89
+ const onSignal = () => {
90
+ process.stderr.write("\x1B[?25h");
91
+ return realExit(130);
92
+ };
93
+ process.on("SIGINT", onSignal);
94
+ process.on("SIGTERM", onSignal);
95
+ }
96
+
74
97
  //#endregion
75
98
  //#region src/aws-errors.ts
76
99
  function isStackNotDeployed(e) {
@@ -9565,6 +9588,7 @@ async function regatherTouched(gathered, touched, region) {
9565
9588
  async function gatherWithProgress(show, label, run) {
9566
9589
  if (!show) return run();
9567
9590
  const s = spinner();
9591
+ setGatherActive(true);
9568
9592
  s.start(`${label}: reading live AWS state & computing drift…`);
9569
9593
  try {
9570
9594
  const gathered = await run();
@@ -9573,6 +9597,8 @@ async function gatherWithProgress(show, label, run) {
9573
9597
  } catch (e) {
9574
9598
  s.error(`${label}: read failed`);
9575
9599
  throw e;
9600
+ } finally {
9601
+ setGatherActive(false);
9576
9602
  }
9577
9603
  }
9578
9604
  function positionPrefix(idx, total) {
@@ -11877,9 +11903,24 @@ const REVERT_SET_DEFAULT_PATHS = new Set([
11877
11903
  "AWS::RolesAnywhere::Profile\0AttributeMappings",
11878
11904
  "AWS::EC2::Subnet\0AssignIpv6AddressOnCreation",
11879
11905
  "AWS::EC2::Subnet\0PrivateDnsNameOptionsOnLaunch",
11880
- "AWS::EC2::Subnet\0EnableDns64"
11906
+ "AWS::EC2::Subnet\0EnableDns64",
11907
+ "AWS::EC2::ClientVpnEndpoint\0VpnPort",
11908
+ "AWS::EC2::ClientVpnEndpoint\0DisconnectOnSessionTimeout",
11909
+ "AWS::EC2::ClientVpnEndpoint\0SplitTunnel",
11910
+ "AWS::DocDB::DBCluster\0Port",
11911
+ "AWS::DocDB::DBCluster\0BackupRetentionPeriod",
11912
+ "AWS::DocDB::DBCluster\0DeletionProtection",
11913
+ "AWS::DocDB::DBInstance\0CACertificateIdentifier",
11914
+ "AWS::OpenSearchService::Domain\0SnapshotOptions",
11915
+ "AWS::OpenSearchService::Domain\0AdvancedOptions",
11916
+ "AWS::OpenSearchService::Domain\0IPAddressType",
11917
+ "AWS::OpenSearchService::Domain\0DeploymentStrategyOptions"
11881
11918
  ]);
11882
- const REVERT_SET_DEFAULT_VALUES = { "AWS::EC2::Subnet\0EnableDns64": false };
11919
+ const REVERT_SET_DEFAULT_VALUES = {
11920
+ "AWS::EC2::Subnet\0EnableDns64": false,
11921
+ "AWS::EC2::ClientVpnEndpoint\0SplitTunnel": false,
11922
+ "AWS::DocDB::DBCluster\0DeletionProtection": false
11923
+ };
11883
11924
  /**
11884
11925
  * A nested undeclared value (a live sub-key inside a declared object, R96/R98) — a dotted
11885
11926
  * path (`Conf.Destination`) or an identity-keyed array element (`Prop[<id>].sub`). Pure +
@@ -14679,6 +14720,7 @@ EXIT CODES
14679
14720
  record: 0 = written 2 = error/refused
14680
14721
  ignore: 0 = rule(s) written / nothing to ignore 2 = error/refused
14681
14722
  revert: 0 = converged/aborted 1 = drift remains 2 = error/apply failure
14723
+ all: 130 = interrupted (Ctrl-C / ESC) during the gather/read phase — never mistaken for clean
14682
14724
 
14683
14725
  The baseline lives at .cdkrd/baselines/<stack>.<accountId>.<region>.json — commit it; review
14684
14726
  its diff in PRs. Ignore rules live in .cdkrd/ignore.yaml — also git-committed.`;
@@ -14714,6 +14756,7 @@ async function main(argv) {
14714
14756
  return 2;
14715
14757
  }
14716
14758
  }
14759
+ installInterruptGuard();
14717
14760
  const argv = process.argv.slice(2);
14718
14761
  main(argv).then((code) => flushAndExit(code)).catch((e) => {
14719
14762
  const msg = e?.message ?? String(e);