cdk-real-drift 0.27.0 → 0.28.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 CHANGED
@@ -67,8 +67,8 @@ result: 1 drift(s) (undeclared=1)
67
67
 
68
68
  ## Quick start
69
69
 
70
- Install it in your CDK project, then the `cdkrd` bin is on your `PATH` (via
71
- `npx`):
70
+ Requires Node.js 22.12 or later. Install it in your CDK project, then the
71
+ `cdkrd` bin is on your `PATH` (via `npx`):
72
72
 
73
73
  ```bash
74
74
  npm install -D cdk-real-drift # in your CDK project
@@ -496,7 +496,7 @@ it just reports (#1054/#1185); use the standalone `record --yes` / `ignore --yes
496
496
  / `revert --yes` verbs for scripted, non-interactive decisions.
497
497
 
498
498
  - **`check` with drift** offers `Record / Revert / Ignore / Decide per finding /
499
- Nothing` (see [The model](#the-model-one-verb-you-run-three-it-offers)). Each
499
+ Nothing` (see [The model](#the-model-one-verb-you-run-three-it-offers)). Each
500
500
  option appears only when it applies (no Revert if nothing is revertable; "Decide per finding" only
501
501
  with >1 finding). Aborting the Revert confirmation writes nothing.
502
502
  - **`revert`** shows the plan, then a multiselect of the op(s) to write. **Every op
@@ -850,14 +850,14 @@ mode: a `record` / `ignore` that would need the selection prompt refuses without
850
850
  (`"exit": 2`). Per-verb element:
851
851
 
852
852
  - `record` → `{ "stack", "recorded": <n>, "wrote": <bool>, "baselinePath"?: "<path>",
853
- "refused"?: true, "error"?: "<reason>" }` — `recorded` is how many undeclared
853
+ "refused"?: true, "error"?: "<reason>" }` — `recorded` is how many undeclared
854
854
  value(s) were written; `baselinePath` is the baseline file written (a path string,
855
855
  deliberately NOT named `baseline` — that key is check's boolean flag; #1336).
856
856
  - `ignore` → `{ "stack", "added": <n>, "wrote": <bool>, "config"?:
857
- ".cdkrd/ignore.yaml", "refused"?: true, "error"?: "<reason>" }` — `added` is how
857
+ ".cdkrd/ignore.yaml", "refused"?: true, "error"?: "<reason>" }` — `added` is how
858
858
  many new rules were appended.
859
859
  - `revert` → `{ "stack", "reverted": <n>, "failed": <n>, "aborted": <bool>, "exit":
860
- <n>, "error"?: "<reason>" }` — `reverted` / `failed` count resources; `exit` is
860
+ <n>, "error"?: "<reason>" }` — `reverted` / `failed` count resources; `exit` is
861
861
  that stack's contribution (0 clean / 1 drift remains / 2 failure).
862
862
 
863
863
  After publication this shape is a backward-compatible API.
package/dist/cli.js CHANGED
@@ -76,7 +76,7 @@ import { CloudFrontClient, GetDistributionConfigCommand, UpdateDistributionComma
76
76
  import { DescribeSignalingChannelCommand, DescribeStreamCommand, KinesisVideoClient, UpdateDataRetentionCommand, UpdateSignalingChannelCommand, UpdateStreamStorageConfigurationCommand } from "@aws-sdk/client-kinesis-video";
77
77
  import { GetWebACLCommand, UpdateWebACLCommand, WAFV2Client } from "@aws-sdk/client-wafv2";
78
78
 
79
- //#region src/exit.ts
79
+ // src/exit.ts
80
80
  function drain(stream) {
81
81
  return new Promise((resolve) => {
82
82
  if (stream.writableLength === 0 || stream.writableEnded) {
@@ -91,8 +91,7 @@ async function flushAndExit(code) {
91
91
  process.exit(code);
92
92
  }
93
93
 
94
- //#endregion
95
- //#region src/interrupt.ts
94
+ // src/interrupt.ts
96
95
  let gatherActive = false;
97
96
  function setGatherActive(active) {
98
97
  gatherActive = active;
@@ -122,8 +121,7 @@ function installInterruptGuard() {
122
121
  process.on("uncaughtException", onFatal("uncaught exception"));
123
122
  }
124
123
 
125
- //#endregion
126
- //#region src/aws-errors.ts
124
+ // src/aws-errors.ts
127
125
  function isStackNotDeployed(e) {
128
126
  const msg = e?.message ?? String(e);
129
127
  return /does not exist/i.test(msg) || /ValidationError/i.test(msg) && /stack/i.test(msg);
@@ -203,8 +201,7 @@ function isResourceNotFoundError(e) {
203
201
  return NOT_FOUND_ERROR_NAMES.has(code);
204
202
  }
205
203
 
206
- //#endregion
207
- //#region src/revert/transient.ts
204
+ // src/revert/transient.ts
208
205
  const RETRY_HINT = "the resource is still applying a previous update — retry in a few minutes";
209
206
  const TRANSIENT_PATTERNS = [
210
207
  {
@@ -286,8 +283,7 @@ async function retryTransient(op, opts = {}) {
286
283
  return result;
287
284
  }
288
285
 
289
- //#endregion
290
- //#region src/cli-args.ts
286
+ // src/cli-args.ts
291
287
  const VALUE_FLAGS = /* @__PURE__ */ new Set([
292
288
  "--region",
293
289
  "--profile",
@@ -454,8 +450,7 @@ function parseCommonArgs(args, verb) {
454
450
  return parsed;
455
451
  }
456
452
 
457
- //#endregion
458
- //#region src/commands/glob-match.ts
453
+ // src/commands/glob-match.ts
459
454
  /** True when `s` contains an UNESCAPED glob metachar (`*` or `?`). A `\*` / `\?` is a
460
455
  * literal, not a wildcard, so a pattern made only of escaped metachars is NOT a glob. */
461
456
  function isGlob(s) {
@@ -561,16 +556,14 @@ function matchesPathGlob(pattern, target) {
561
556
  return new RegExp(out).test(target);
562
557
  }
563
558
 
564
- //#endregion
565
- //#region src/construct-path.ts
559
+ // src/construct-path.ts
566
560
  function withinStackPath(constructPath, stackName) {
567
561
  const segs = constructPath.split("/");
568
562
  for (let k = segs.length - 1; k >= 1; k--) if (segs.slice(0, k).join("-") === stackName) return segs.slice(k).join("/");
569
563
  return constructPath;
570
564
  }
571
565
 
572
- //#endregion
573
- //#region src/config/config-file.ts
566
+ // src/config/config-file.ts
574
567
  const CONFIG_PATH = ".cdkrd/ignore.yaml";
575
568
  const KNOWN_KEYS = /* @__PURE__ */ new Set(["ignore"]);
576
569
  const RULE_OBJECT_KEYS = /* @__PURE__ */ new Set([
@@ -949,8 +942,7 @@ function applyIgnores(findings, scope, config) {
949
942
  });
950
943
  }
951
944
 
952
- //#endregion
953
- //#region src/read/proxy-routing-agent.ts
945
+ // src/read/proxy-routing-agent.ts
954
946
  /**
955
947
  * An `http.Agent` that routes each request through the environment's proxy, or
956
948
  * direct, according to `HTTPS_PROXY` / `HTTP_PROXY` / `NO_PROXY` (#1841).
@@ -1065,8 +1057,7 @@ function createInnerAgent(secure, proxyUrl) {
1065
1057
  return secure ? new HttpsProxyAgent(proxyUrl, INNER_AGENT_OPTIONS) : new HttpProxyAgent(proxyUrl, INNER_AGENT_OPTIONS);
1066
1058
  }
1067
1059
 
1068
- //#endregion
1069
- //#region src/read/client-config.ts
1060
+ // src/read/client-config.ts
1070
1061
  /** Port of toolkit-lib awscli-compatible `shouldPrioritizeEnv()` (env creds win over profile). */
1071
1062
  function shouldPrioritizeEnv() {
1072
1063
  if (process.env.CDKRD_EXPLICIT_PROFILE) return false;
@@ -1132,8 +1123,7 @@ const READ_RETRY = {
1132
1123
  }
1133
1124
  };
1134
1125
 
1135
- //#endregion
1136
- //#region src/commands/account-gate.ts
1126
+ // src/commands/account-gate.ts
1137
1127
  function mismatchTail(declaredAccount, verb) {
1138
1128
  return verb === "revert" ? `refusing to revert (run with account-${declaredAccount} credentials to revert it)` : `skipped (run with account-${declaredAccount} credentials to ${verb} it)`;
1139
1129
  }
@@ -1236,8 +1226,7 @@ function createAccountGate(verb) {
1236
1226
  };
1237
1227
  }
1238
1228
 
1239
- //#endregion
1240
- //#region src/synth/resolve-app.ts
1229
+ // src/synth/resolve-app.ts
1241
1230
  function decodeCdkJson(buf) {
1242
1231
  const encoding = buf[0] === 255 && buf[1] === 254 ? "utf-16le" : buf[0] === 254 && buf[1] === 255 ? "utf-16be" : "utf-8";
1243
1232
  return new TextDecoder(encoding).decode(buf);
@@ -1260,8 +1249,7 @@ function resolveApp(explicit) {
1260
1249
  return typeof json.app === "string" && json.app.length > 0 ? json.app : void 0;
1261
1250
  }
1262
1251
 
1263
- //#endregion
1264
- //#region src/synth/io-host.ts
1252
+ // src/synth/io-host.ts
1265
1253
  const APP_STDOUT = "CDK_ASSEMBLY_I1001";
1266
1254
  const APP_STDERR = "CDK_ASSEMBLY_E1002";
1267
1255
  const VALIDATION_REPORT = "CDK_TOOLKIT_E9600";
@@ -1329,8 +1317,7 @@ var QuietIoHost = class extends NonInteractiveIoHost {
1329
1317
  }
1330
1318
  };
1331
1319
 
1332
- //#endregion
1333
- //#region src/synth/missing-context.ts
1320
+ // src/synth/missing-context.ts
1334
1321
  /**
1335
1322
  * Collect `missing` context entries across the top-level assembly AND every nested assembly
1336
1323
  * (recursively — a Stage-in-Stage app nests arbitrarily deep). Mirrors how `stacksRecursively`
@@ -1364,8 +1351,7 @@ function missingContextWarning(keys, opts = {}) {
1364
1351
  return `${lead}\n${why}`;
1365
1352
  }
1366
1353
 
1367
- //#endregion
1368
- //#region src/synth/synth.ts
1354
+ // src/synth/synth.ts
1369
1355
  function proxyHttpOptions() {
1370
1356
  return isProxyConfigured() ? { httpOptions: { agent: new ProxyRoutingAgent() } } : {};
1371
1357
  }
@@ -1572,8 +1558,7 @@ async function discoverStacks(app, opts = {}) {
1572
1558
  }));
1573
1559
  }
1574
1560
 
1575
- //#endregion
1576
- //#region src/commands/resolve-stacks.ts
1561
+ // src/commands/resolve-stacks.ts
1577
1562
  function regionFromIniFile(path, section) {
1578
1563
  let text;
1579
1564
  try {
@@ -1726,8 +1711,7 @@ async function resolveStacks(a) {
1726
1711
  return out;
1727
1712
  }
1728
1713
 
1729
- //#endregion
1730
- //#region src/normalize/intrinsic-resolver.ts
1714
+ // src/normalize/intrinsic-resolver.ts
1731
1715
  const UNRESOLVED = Symbol("unresolved");
1732
1716
  const NOVALUE = Symbol("novalue");
1733
1717
  const CONTAINS_DYNAMIC_REFERENCE_RE = /\{\{resolve:(ssm|ssm-secure|secretsmanager):[\s\S]*?\}\}/;
@@ -2055,8 +2039,7 @@ function resolveProperties(props, ctx) {
2055
2039
  return pruneNoValue(resolve$1(props, ctx));
2056
2040
  }
2057
2041
 
2058
- //#endregion
2059
- //#region src/corpus/record.ts
2042
+ // src/corpus/record.ts
2060
2043
  const CORPUS_DIR_ENV = "CDKRD_CORPUS_DIR";
2061
2044
  const UNRESOLVED_SENTINEL = "__cdkrd_corpus_unresolved__";
2062
2045
  function swapUnresolved(v, from, to) {
@@ -2168,8 +2151,7 @@ async function recordCorpusCase(dir, c) {
2168
2151
  return p;
2169
2152
  }
2170
2153
 
2171
- //#endregion
2172
- //#region src/normalize/cc-api-strip.ts
2154
+ // src/normalize/cc-api-strip.ts
2173
2155
  const ALWAYS_STRIPPED = /* @__PURE__ */ new Set([
2174
2156
  "CreationDate",
2175
2157
  "CreationTime",
@@ -2253,8 +2235,7 @@ function stripWalk(value, freeForm) {
2253
2235
  return value;
2254
2236
  }
2255
2237
 
2256
- //#endregion
2257
- //#region src/normalize/noise.ts
2238
+ // src/normalize/noise.ts
2258
2239
  const KNOWN_DEFAULTS = {
2259
2240
  "AWS::IAM::Role": {
2260
2241
  MaxSessionDuration: 3600,
@@ -5072,8 +5053,7 @@ function isAllAwsTags(v) {
5072
5053
  return false;
5073
5054
  }
5074
5055
 
5075
- //#endregion
5076
- //#region src/desired/recover-nonascii.ts
5056
+ // src/desired/recover-nonascii.ts
5077
5057
  function isObject(v) {
5078
5058
  return typeof v === "object" && v !== null && !Array.isArray(v);
5079
5059
  }
@@ -5090,8 +5070,7 @@ function recoverNonAsciiMasks(deployed, recovery) {
5090
5070
  return deployed;
5091
5071
  }
5092
5072
 
5093
- //#endregion
5094
- //#region src/desired/yaml-cfn.ts
5073
+ // src/desired/yaml-cfn.ts
5095
5074
  const FN_TAGS = [
5096
5075
  "GetAtt",
5097
5076
  "Sub",
@@ -5256,8 +5235,7 @@ function parseCfnTemplate(text) {
5256
5235
  return parsed;
5257
5236
  }
5258
5237
 
5259
- //#endregion
5260
- //#region src/desired/template-adapter.ts
5238
+ // src/desired/template-adapter.ts
5261
5239
  /** Parse a deployed template body (JSON or CFn-flavored YAML). */
5262
5240
  function parseTemplateBody(body) {
5263
5241
  return parseCfnTemplate(body);
@@ -5700,8 +5678,7 @@ function resolvePolicyName(raw, ctx) {
5700
5678
  return typeof resolved === "string" ? resolved : void 0;
5701
5679
  }
5702
5680
 
5703
- //#endregion
5704
- //#region src/normalize/arn-identity.ts
5681
+ // src/normalize/arn-identity.ts
5705
5682
  function isArnNameMatch(desired, actual, opts) {
5706
5683
  if (typeof desired !== "string" || typeof actual !== "string") return false;
5707
5684
  const dArn = desired.startsWith("arn:");
@@ -5736,8 +5713,7 @@ function isLogGroupArnWildcardMatch(desired, actual) {
5736
5713
  return stripLogGroupWildcard(desired) === stripLogGroupWildcard(actual);
5737
5714
  }
5738
5715
 
5739
- //#endregion
5740
- //#region src/normalize/derived-defaults.ts
5716
+ // src/normalize/derived-defaults.ts
5741
5717
  function route53HealthCheckDerivedPort(hcType) {
5742
5718
  return hcType === "HTTP" || hcType === "HTTP_STR_MATCH" ? 80 : hcType === "HTTPS" || hcType === "HTTPS_STR_MATCH" ? 443 : void 0;
5743
5719
  }
@@ -5780,8 +5756,7 @@ function ecsDaemonDerivedDeploymentConfiguration(schedulingStrategy) {
5780
5756
  };
5781
5757
  }
5782
5758
 
5783
- //#endregion
5784
- //#region src/read/kms-aliases.ts
5759
+ // src/read/kms-aliases.ts
5785
5760
  const cache$1 = /* @__PURE__ */ new Map();
5786
5761
  /** True when the error is a DEFINITIVE access-denial (cacheable), NOT a transient blip.
5787
5762
  * Matches an AccessDenied(Exception) / UnauthorizedOperation by name or code, or the AWS
@@ -5915,8 +5890,7 @@ function usesManagedKmsAlias(v) {
5915
5890
  return false;
5916
5891
  }
5917
5892
 
5918
- //#endregion
5919
- //#region src/normalize/path-strip.ts
5893
+ // src/normalize/path-strip.ts
5920
5894
  function deepStripPaths(obj, paths) {
5921
5895
  for (const p of paths) stripPath(obj, p.split("."));
5922
5896
  }
@@ -5931,8 +5905,7 @@ function stripPath(node, segs) {
5931
5905
  } else stripPath(container[k], rest);
5932
5906
  }
5933
5907
 
5934
- //#endregion
5935
- //#region src/normalize/policy-canonical.ts
5908
+ // src/normalize/policy-canonical.ts
5936
5909
  function isObj(v) {
5937
5910
  return typeof v === "object" && v !== null && !Array.isArray(v);
5938
5911
  }
@@ -6125,8 +6098,7 @@ function normWalk(v, freeForm) {
6125
6098
  return v;
6126
6099
  }
6127
6100
 
6128
- //#endregion
6129
- //#region src/normalize/pipeline.ts
6101
+ // src/normalize/pipeline.ts
6130
6102
  function canonicalizeForCompare(v, resourceType) {
6131
6103
  const orderSig = resourceType ? ORDER_SIGNIFICANT_ARRAY_KEYS[resourceType] : void 0;
6132
6104
  const base = canonicalizeIpv6CidrsDeep(canonicalizeIdArraysDeep(canonicalizeTagListsDeep(normalizePoliciesDeep(v), orderSig)));
@@ -6150,8 +6122,7 @@ function canonicalizeBaselineForCompare(v, resourceType, path) {
6150
6122
  return sortObjectArraysDeep(canonicalizeForCompare(stripAwsTagsDeep(stripCcApiAwsManagedFields(v, freeFormSeed)), resourceType));
6151
6123
  }
6152
6124
 
6153
- //#endregion
6154
- //#region src/normalize/stack-tags.ts
6125
+ // src/normalize/stack-tags.ts
6155
6126
  const declaredTagKeys = (declared) => {
6156
6127
  const out = /* @__PURE__ */ new Set();
6157
6128
  const collect = (tags) => {
@@ -6212,8 +6183,7 @@ const subtractPropagatedStackTags = (live, stackTags, declaredKeys) => {
6212
6183
  return out;
6213
6184
  };
6214
6185
 
6215
- //#endregion
6216
- //#region src/diff/drift-calculator.ts
6186
+ // src/diff/drift-calculator.ts
6217
6187
  function calculateResourceDrift(stateProperties, awsProperties, options) {
6218
6188
  const drifts = [];
6219
6189
  const ignore = options?.ignorePaths ?? [];
@@ -6292,8 +6262,7 @@ function hasPathUnsafeKey(o) {
6292
6262
  return Object.keys(o).some((k) => PATH_UNSAFE_KEY$1.test(k));
6293
6263
  }
6294
6264
 
6295
- //#endregion
6296
- //#region src/diff/classify.ts
6265
+ // src/diff/classify.ts
6297
6266
  function elbAttributeDefaultsFor(resourceType, declared, live) {
6298
6267
  const shared = ELB_ATTRIBUTE_DEFAULTS[resourceType] ?? {};
6299
6268
  if (resourceType === "AWS::ElasticLoadBalancingV2::LoadBalancer") {
@@ -8730,8 +8699,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
8730
8699
  }));
8731
8700
  }
8732
8701
 
8733
- //#endregion
8734
- //#region src/read/child-enumerators.ts
8702
+ // src/read/child-enumerators.ts
8735
8703
  function parentRefMatches(declaredValue, ...candidates) {
8736
8704
  if (declaredValue === UNRESOLVED || hasUnresolved(declaredValue)) return true;
8737
8705
  return candidates.some((c) => c !== void 0 && declaredValue === c);
@@ -12415,8 +12383,7 @@ async function enumerateElasticBeanstalkApplicationChildren(ctx) {
12415
12383
  });
12416
12384
  }
12417
12385
 
12418
- //#endregion
12419
- //#region src/read/pem.ts
12386
+ // src/read/pem.ts
12420
12387
  function hashCaBundle(pem) {
12421
12388
  if (typeof pem !== "string") return void 0;
12422
12389
  const bodies = [];
@@ -12434,8 +12401,7 @@ function sha256Hex(bytes) {
12434
12401
  return createHash("sha256").update(bytes).digest("hex");
12435
12402
  }
12436
12403
 
12437
- //#endregion
12438
- //#region src/read/overrides.ts
12404
+ // src/read/overrides.ts
12439
12405
  const OVERRIDE_READ_GAP = Symbol.for("cdkrd.overrideReadGap");
12440
12406
  function overrideReadGap(model, readGapPaths) {
12441
12407
  return {
@@ -14894,8 +14860,7 @@ const SDK_SUPPLEMENTS = {
14894
14860
  "AWS::RedshiftServerless::Workgroup": supplementRedshiftServerlessWorkgroup
14895
14861
  };
14896
14862
 
14897
- //#endregion
14898
- //#region src/schema/schema-strip.ts
14863
+ // src/schema/schema-strip.ts
14899
14864
  const cache = /* @__PURE__ */ new Map();
14900
14865
  const EMPTY = {
14901
14866
  readOnly: /* @__PURE__ */ new Set(),
@@ -15185,8 +15150,7 @@ function parseSchema(schemaJson) {
15185
15150
  };
15186
15151
  }
15187
15152
 
15188
- //#endregion
15189
- //#region src/read/router.ts
15153
+ // src/read/router.ts
15190
15154
  const CC_IDENTIFIER_ADAPTERS = {
15191
15155
  "AWS::AppSync::GraphQLApi": (pid) => pid.startsWith("arn:") ? pid.split("/").pop() : pid,
15192
15156
  "AWS::Batch::JobDefinition": (pid) => {
@@ -15394,8 +15358,7 @@ async function readLive(cc, resource, region, accountId) {
15394
15358
  }
15395
15359
  }
15396
15360
 
15397
- //#endregion
15398
- //#region src/commands/gather.ts
15361
+ // src/commands/gather.ts
15399
15362
  function liveModelMap(reads) {
15400
15363
  const out = /* @__PURE__ */ new Map();
15401
15364
  for (const [logicalId, read] of reads) if (read.live) out.set(logicalId, read.live);
@@ -16715,8 +16678,7 @@ async function regatherTouched(gathered, touched, region) {
16715
16678
  return [...gathered.findings.filter((f) => !touched.has(f.logicalId)), ...fresh];
16716
16679
  }
16717
16680
 
16718
- //#endregion
16719
- //#region src/commands/progress.ts
16681
+ // src/commands/progress.ts
16720
16682
  async function gatherWithProgress(show, label, run) {
16721
16683
  if (!show) return run();
16722
16684
  const s = spinner();
@@ -16744,8 +16706,7 @@ function stackCountAnnouncement(stackNames) {
16744
16706
  return `note: checking ${stackNames.length} stack(s): ${stackNames.join(", ")}`;
16745
16707
  }
16746
16708
 
16747
- //#endregion
16748
- //#region src/report/redact.ts
16709
+ // src/report/redact.ts
16749
16710
  function maskPlaceholder(value) {
16750
16711
  if (typeof value === "string") {
16751
16712
  const sig = createHash("sha256").update(value).digest("hex").slice(0, 8);
@@ -16885,8 +16846,7 @@ function redactedHashOf(sentinelOrCanonical) {
16885
16846
  return isRedactedHashSentinel(sentinelOrCanonical) ? sentinelOrCanonical[REDACTION_HASH_KEY] ?? hashOfCanonical(sentinelOrCanonical) : hashOfCanonical(sentinelOrCanonical);
16886
16847
  }
16887
16848
 
16888
- //#endregion
16889
- //#region src/baseline/baseline-file.ts
16849
+ // src/baseline/baseline-file.ts
16890
16850
  const OBSERVED_DEFAULT_TRACKED_PATHS = { "AWS::S3::Bucket": ["PublicAccessBlockConfiguration"] };
16891
16851
  const KNOWN_BASELINE_KEYS = /* @__PURE__ */ new Set([
16892
16852
  "schemaVersion",
@@ -18039,8 +17999,7 @@ function warnTemplateHashDrift(baseline, rawTemplate, stackName, warn = console.
18039
17999
  if (baseline.templateHash !== hashTemplate(rawTemplate)) warn(`note: ${stackName}: baseline was captured against a different template version — consider re-running \`cdkrd record\`.`);
18040
18000
  }
18041
18001
 
18042
- //#endregion
18043
- //#region src/diff/hints.ts
18002
+ // src/diff/hints.ts
18044
18003
  const APP_SIGNALS_HINT = "looks like CloudWatch Application Signals / Lambda Insights auto-instrumentation — typically enabled at the account/region level (a CloudWatch setting), not a per-resource edit; declare it in CDK to make it intent, or record/ignore to accept it";
18045
18004
  const INSIGHTS_LAYER = /:layer:LambdaInsightsExtension(-Arm64)?:/;
18046
18005
  const INSIGHTS_POLICY = /(AWSLambdaTracerAccessExecutionRole|CloudWatchLambdaInsightsExecutionRolePolicy)/;
@@ -18083,8 +18042,7 @@ function annotateHints(findings) {
18083
18042
  });
18084
18043
  }
18085
18044
 
18086
- //#endregion
18087
- //#region src/report/style.ts
18045
+ // src/report/style.ts
18088
18046
  /** Build the palette on top of a picocolors instance (identity when disabled). */
18089
18047
  function makeStyle(c) {
18090
18048
  return {
@@ -18106,8 +18064,7 @@ function makeStyle(c) {
18106
18064
  const colorEnabled = process.stdout.isTTY === true && process.env["NO_COLOR"] === void 0;
18107
18065
  const style = makeStyle(pc.createColors(colorEnabled));
18108
18066
 
18109
- //#endregion
18110
- //#region src/report/report.ts
18067
+ // src/report/report.ts
18111
18068
  function stackNameFromHeader(header) {
18112
18069
  return header.replace(/\s*\([^)]*\)\s*$/, "");
18113
18070
  }
@@ -18439,8 +18396,7 @@ function jPair(a, b) {
18439
18396
  };
18440
18397
  }
18441
18398
 
18442
- //#endregion
18443
- //#region src/commands/bulk-multiselect.ts
18399
+ // src/commands/bulk-multiselect.ts
18444
18400
  /** The selected-value array after a bulk action — `all` selects every option, `none`
18445
18401
  * clears it. Pure (no prompt state) so the →/← wiring is unit-testable without a TTY. */
18446
18402
  function bulkSelectValues(options, action) {
@@ -18501,8 +18457,7 @@ async function bulkMultiselect(message, options) {
18501
18457
  return picked ?? [];
18502
18458
  }
18503
18459
 
18504
- //#endregion
18505
- //#region src/revert/apply-ops.ts
18460
+ // src/revert/apply-ops.ts
18506
18461
  function unescape(seg) {
18507
18462
  return seg.replace(/~1/g, "/").replace(/~0/g, "~");
18508
18463
  }
@@ -18534,8 +18489,7 @@ function removeAt(root, segs) {
18534
18489
  delete node[segs[segs.length - 1]];
18535
18490
  }
18536
18491
 
18537
- //#endregion
18538
- //#region src/revert/writers.ts
18492
+ // src/revert/writers.ts
18539
18493
  const str = (v) => typeof v === "string" && v.length > 0 ? v : void 0;
18540
18494
  const strList = (v) => (Array.isArray(v) ? v : [v]).map(str).filter((s) => s !== void 0);
18541
18495
  const opTopSeg = (path) => path.replace(/^\//, "").split("/")[0] ?? "";
@@ -20848,8 +20802,7 @@ const SDK_DELETERS = {
20848
20802
  "AWS::Glue::Table": deleteGlueTable
20849
20803
  };
20850
20804
 
20851
- //#endregion
20852
- //#region src/revert/plan.ts
20805
+ // src/revert/plan.ts
20853
20806
  const WRITEONLY_NESTED_NO_CC_REVERT = {};
20854
20807
  const SYNTHETIC_READ_SIGNAL_PATHS = {
20855
20808
  "AWS::ElasticLoadBalancingV2::TrustStore": ["CaCertificatesBundleSha256"],
@@ -20857,6 +20810,15 @@ const SYNTHETIC_READ_SIGNAL_PATHS = {
20857
20810
  "AWS::Glue::Job": ["ScriptSha256"]
20858
20811
  };
20859
20812
  const WRITEONLY_REINCLUDE_SKIP = { "AWS::Lambda::Function": ["Code"] };
20813
+ const WRITEONLY_REINCLUDE_OVERRIDE_READABLE = { "AWS::ECS::Service": ["VolumeConfigurations"] };
20814
+ function sdkRevertedOverrideReadablePaths(items, logicalId, resourceType) {
20815
+ const out = /* @__PURE__ */ new Set();
20816
+ for (const path of WRITEONLY_REINCLUDE_OVERRIDE_READABLE[resourceType] ?? []) {
20817
+ const ptr = toPointer(path);
20818
+ if (items.some((i) => i.kind === "sdk" && i.logicalId === logicalId && i.ops.some((o) => o.path === ptr || o.path.startsWith(`${ptr}/`)))) out.add(path);
20819
+ }
20820
+ return out;
20821
+ }
20860
20822
  const CC_REVERTABLE_DESPITE_READ_OVERRIDE = /* @__PURE__ */ new Set([
20861
20823
  "AWS::Scheduler::Schedule",
20862
20824
  "AWS::Cognito::IdentityPool",
@@ -21595,17 +21557,22 @@ function valueAtDottedPath(model, path) {
21595
21557
  }
21596
21558
  return node;
21597
21559
  }
21598
- function writeOnlyReincludeOps(declared, schema, existingOps, resourceType) {
21599
- if (!declared || !schema || schema.writeOnlyPaths.length === 0) return [];
21560
+ function writeOnlyReincludeOps(declared, schema, existingOps, resourceType, live, declaredSourced) {
21561
+ if (!declared || !schema) return [];
21562
+ const overrideReadable = resourceType ? WRITEONLY_REINCLUDE_OVERRIDE_READABLE[resourceType] ?? [] : [];
21563
+ const writeOnlyPaths = [...schema.writeOnlyPaths, ...overrideReadable.filter((p) => !schema.writeOnlyPaths.includes(p))];
21564
+ if (writeOnlyPaths.length === 0) return [];
21600
21565
  const touched = new Set(existingOps.map((o) => o.path));
21601
21566
  const skipPrefixes = resourceType ? WRITEONLY_REINCLUDE_SKIP[resourceType] ?? [] : [];
21602
21567
  const ops = [];
21603
- for (const path of schema.writeOnlyPaths) {
21568
+ for (const path of writeOnlyPaths) {
21604
21569
  if (path.includes("*")) continue;
21605
21570
  if (skipPrefixes.some((p) => path === p || path.startsWith(`${p}.`))) continue;
21606
21571
  if (isUnderCreateOnly(path, schema.createOnlyPaths)) continue;
21607
21572
  if (isUnderCreateOnly(path, schema.conditionalCreateOnlyPaths ?? [])) continue;
21608
- const value = valueAtDottedPath(declared, path);
21573
+ const fromLive = overrideReadable.includes(path) && !declaredSourced?.has(path);
21574
+ if (overrideReadable.includes(path) && valueAtDottedPath(declared, path) === void 0) continue;
21575
+ const value = fromLive ? live ? valueAtDottedPath(live, path) : void 0 : valueAtDottedPath(declared, path);
21609
21576
  if (value === void 0 || value === UNRESOLVED || hasUnresolved(value)) continue;
21610
21577
  const pointer = toPointer(path);
21611
21578
  if (touched.has(pointer)) continue;
@@ -21782,8 +21749,7 @@ function toPatchDocument(item, liveRaw = item.liveRaw) {
21782
21749
  return JSON.stringify(doc);
21783
21750
  }
21784
21751
 
21785
- //#endregion
21786
- //#region src/revert/apply.ts
21752
+ // src/revert/apply.ts
21787
21753
  const POLL_INTERVAL_MS = 2e3;
21788
21754
  const TIMEOUT_MS = 9e5;
21789
21755
  const MAX_POLL_READ_FAILURES = 10;
@@ -21939,8 +21905,7 @@ async function applyRevertDeleteSdk(doDelete, retry = {}) {
21939
21905
  return retryDeleteDeferringDependencies(oneDelete, retry);
21940
21906
  }
21941
21907
 
21942
- //#endregion
21943
- //#region src/commands/stack-actions.ts
21908
+ // src/commands/stack-actions.ts
21944
21909
  const isDrift = (f) => (f.tier === "deleted" || f.tier === "added" || f.tier === "declared" || f.tier === "undeclared") && !f.unrecorded;
21945
21910
  const driftCount = (findings) => findings.filter(isDrift).length;
21946
21911
  const unrecordedCount = (findings) => findings.filter((f) => f.unrecorded === true).length;
@@ -22544,11 +22509,11 @@ const CONVERGE_RETRY_DELAY_MS = 3e3;
22544
22509
  function includeUnrecordedRemovals(removeUnrecorded, interactive, yes) {
22545
22510
  return removeUnrecorded || interactive && !yes;
22546
22511
  }
22547
- function augmentCcItemOps(item, schemas, liveByLogical, declaredByLogical) {
22512
+ function augmentCcItemOps(item, schemas, liveByLogical, declaredByLogical, planItems = []) {
22548
22513
  if (item.kind !== "cc") return item;
22549
22514
  const liveRaw = liveByLogical.get(item.logicalId);
22550
22515
  const tagged = tagPreservingOps(item.ops, liveRaw);
22551
- const extra = writeOnlyReincludeOps(declaredByLogical(item.logicalId), schemas.get(item.resourceType), tagged, item.resourceType);
22516
+ const extra = writeOnlyReincludeOps(declaredByLogical(item.logicalId), schemas.get(item.resourceType), tagged, item.resourceType, liveRaw, sdkRevertedOverrideReadablePaths(planItems, item.logicalId, item.resourceType));
22552
22517
  const strip = rejectedEmptyStripOps(item.resourceType, [...tagged, ...extra], liveRaw);
22553
22518
  const combined = [
22554
22519
  ...tagged,
@@ -22571,7 +22536,7 @@ function attributeOpFailure(item, error) {
22571
22536
  function augmentRevertPlan(plan, schemas, liveByLogical, declaredByLogical) {
22572
22537
  return {
22573
22538
  ...plan,
22574
- items: plan.items.map((item) => augmentCcItemOps(item, schemas, liveByLogical, declaredByLogical))
22539
+ items: plan.items.map((item) => augmentCcItemOps(item, schemas, liveByLogical, declaredByLogical, plan.items))
22575
22540
  };
22576
22541
  }
22577
22542
  async function revertStack(p) {
@@ -22646,7 +22611,7 @@ async function revertStack(p) {
22646
22611
  if (!yes) {
22647
22612
  if (!interactive) {
22648
22613
  const reason = "refusing to write to AWS non-interactively — pass --yes to apply (or --dry-run to preview).";
22649
- console.error("\nrefusing to write to AWS non-interactively — pass --yes to apply (or --dry-run to preview).");
22614
+ console.error("\n" + reason);
22650
22615
  return {
22651
22616
  exit: 2,
22652
22617
  aborted: false,
@@ -22890,8 +22855,7 @@ function availableActions(findings, baseline, schemas, removeUnrecorded) {
22890
22855
  };
22891
22856
  }
22892
22857
 
22893
- //#endregion
22894
- //#region src/commands/verb-json.ts
22858
+ // src/commands/verb-json.ts
22895
22859
  function stackLabel(stackName, region) {
22896
22860
  return region ? `${stackName} (${region})` : stackName;
22897
22861
  }
@@ -22899,8 +22863,7 @@ function emitJsonArray(reports) {
22899
22863
  console.log(JSON.stringify(reports, null, 2));
22900
22864
  }
22901
22865
 
22902
- //#endregion
22903
- //#region src/commands/record.ts
22866
+ // src/commands/record.ts
22904
22867
  async function runRecord(args) {
22905
22868
  const a = parseCommonArgs(args, "record");
22906
22869
  if (a.profile) process.env.AWS_PROFILE = a.profile;
@@ -23031,8 +22994,7 @@ async function runRecord(args) {
23031
22994
  return worst;
23032
22995
  }
23033
22996
 
23034
- //#endregion
23035
- //#region src/commands/ignore.ts
22997
+ // src/commands/ignore.ts
23036
22998
  function ignoreApplyBaselineOpts(desired) {
23037
22999
  return {
23038
23000
  declaredByLogical: declaredKeysByLogical(desired.resources),
@@ -23174,8 +23136,7 @@ async function runIgnore(args) {
23174
23136
  return worst;
23175
23137
  }
23176
23138
 
23177
- //#endregion
23178
- //#region src/commands/action-picker.ts
23139
+ // src/commands/action-picker.ts
23179
23140
  /**
23180
23141
  * The actions that apply to a finding, in cycle order (EXCLUDING the always-present
23181
23142
  * `skip`). Mirrors the verbs' scope:
@@ -23357,8 +23318,7 @@ async function actionPicker(message, rows) {
23357
23318
  return [...actions];
23358
23319
  }
23359
23320
 
23360
- //#endregion
23361
- //#region src/commands/interactive-resolve.ts
23321
+ // src/commands/interactive-resolve.ts
23362
23322
  /**
23363
23323
  * Closing note after an interactive record inside `check` (R52). A PARTIAL record used
23364
23324
  * to end with `baseline written: ...` and a silent failure-looking exit. State plainly
@@ -23677,8 +23637,7 @@ async function perFinding(p, decidable) {
23677
23637
  };
23678
23638
  }
23679
23639
 
23680
- //#endregion
23681
- //#region src/commands/check.ts
23640
+ // src/commands/check.ts
23682
23641
  function synthKey(stackName, region, account) {
23683
23642
  return `${stackName}\0${region ?? ""}\0${account ?? ""}`;
23684
23643
  }
@@ -24075,8 +24034,7 @@ async function runCheck(args) {
24075
24034
  return worst;
24076
24035
  }
24077
24036
 
24078
- //#endregion
24079
- //#region src/commands/revert.ts
24037
+ // src/commands/revert.ts
24080
24038
  async function runRevert(args) {
24081
24039
  const a = parseCommonArgs(args, "revert");
24082
24040
  if (a.profile) process.env.AWS_PROFILE = a.profile;
@@ -24222,8 +24180,7 @@ async function runRevert(args) {
24222
24180
  return worst;
24223
24181
  }
24224
24182
 
24225
- //#endregion
24226
- //#region src/cli.ts
24183
+ // src/cli.ts
24227
24184
  const HELP = `cdkrd — drift detection + revert for AWS CDK, including UNDECLARED
24228
24185
  properties that 'cdk drift' / CloudFormation drift detection never see.
24229
24186
 
@@ -24366,6 +24323,5 @@ main(argv).then((code) => flushAndExit(code)).catch((e) => {
24366
24323
  return flushAndExit(2);
24367
24324
  });
24368
24325
 
24369
- //#endregion
24370
24326
  export { };
24371
24327
  //# sourceMappingURL=cli.js.map