cdk-real-drift 0.12.109 → 0.13.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
@@ -355,6 +355,13 @@ CI (with `--yes`).
355
355
  the flag).
356
356
  - **`--fail`** (the `cdk diff --fail` / `cdk drift --fail` convention) exits `1` on
357
357
  drift and suppresses all prompts. It's the one flag for scripts and CI.
358
+ - **`--no-prompt`** is the **prompt** axis, orthogonal to `--fail`'s exit-code axis:
359
+ it suppresses the interactive resolve menu (report-only) but keeps exit `0` on
360
+ drift. Reach for it when a script runs `check` **attached to a terminal** (both
361
+ stdin+stdout are a TTY, so the TTY gate alone would still prompt and could hang)
362
+ yet must not fail the job on drift. A non-TTY run (real CI, a pipe, redirected
363
+ output) never prompts anyway, so this only matters for the terminal-attached case;
364
+ combined with `--fail`, `--fail`'s exit `1` wins.
358
365
  - **`--strict`** is the orthogonal **coverage** axis: it exits `1` when a run was
359
366
  incomplete (a resource skipped for an ACTIONABLE reason — a CC-unsupported type
360
367
  with no override, a read error / throttle / AccessDenied — or a nested stack not
@@ -401,6 +408,7 @@ CI (with `--yes`).
401
408
  | `--all` | target every stack the app defines (the default when no `<stack>` is named; cannot be combined with named stacks — a `<stack> ... --all` invocation errors) |
402
409
  | `--json` | machine-readable output (see [JSON contract](#json-output-contract)) |
403
410
  | `--fail` | (check) exit 1 on drift and never prompt; for scripts/CI. Without it, check reports drift but exits 0 |
411
+ | `--no-prompt` | (check) never open the interactive resolve menu (report-only), but keep exit 0 on drift — the exit-0 twin of `--fail`'s prompt suppression, for a report-only script attached to a terminal. Non-TTY never prompts anyway; with `--fail`, `--fail`'s exit 1 wins |
404
412
  | `--strict` | (check) exit 1 when coverage is incomplete. A coverage gap is always surfaced loudly; `--strict` makes it CI-failing. Orthogonal to `--fail` |
405
413
  | `--show-all` | (check) inventory mode: show all current undeclared state, ignoring the baseline |
406
414
  | `--verbose` / `-v` | (check) expand the `info:` footer tiers / (revert) expand the not-revertable summary to full lists; (record) itemizes nested sub-keys in the multiselect. `-v` means `--verbose` **inside a verb** (`check -v`); a bare `cdkrd -v` (no verb) prints the version |
@@ -422,7 +430,7 @@ error (they select which comparison runs, so a combination is contradictory).
422
430
  ### Interactive prompts (TTY only, CI is never prompted)
423
431
 
424
432
  Every option runs exactly the same code as the standalone commands. Prompts are
425
- skipped under `--json`, `--show-all`, `--pre-deploy`, `--fail`, `--yes`, and the
433
+ skipped under `--json`, `--show-all`, `--pre-deploy`, `--fail`, `--no-prompt`, `--yes`, and the
426
434
  scope filters `--declared-only` / `--undeclared-only` (a filtered finding set must
427
435
  never become a snapshot-complete baseline via the inline Record — use the standalone
428
436
  `record` verb, which sees the unfiltered state, #779). A non-TTY run
package/dist/cli.js CHANGED
@@ -287,6 +287,7 @@ const VALUE_FLAGS = new Set([
287
287
  const BOOLEAN_FLAGS = new Set([
288
288
  "--json",
289
289
  "--fail",
290
+ "--no-prompt",
290
291
  "--show-all",
291
292
  "--yes",
292
293
  "-y",
@@ -321,6 +322,7 @@ const ALLOWED_FLAGS_BY_VERB = {
321
322
  check: new Set([
322
323
  ...GLOBAL_FLAGS,
323
324
  "--fail",
325
+ "--no-prompt",
324
326
  "--strict",
325
327
  "--show-all",
326
328
  "--pre-deploy",
@@ -416,7 +418,7 @@ function parseCommonArgs(args, verb) {
416
418
  ].filter(has);
417
419
  if (scopes.length > 1) throw new Error(`${scopes.join(" and ")} are mutually exclusive — see cdkrd --help`);
418
420
  if (values["--profile"] !== void 0) process.env.CDKRD_EXPLICIT_PROFILE = "1";
419
- return {
421
+ const parsed = {
420
422
  stackNames,
421
423
  all: has("--all"),
422
424
  context,
@@ -436,6 +438,8 @@ function parseCommonArgs(args, verb) {
436
438
  verbose: has("--verbose") || has("-v"),
437
439
  waitMs
438
440
  };
441
+ parsed.noPrompt = has("--no-prompt");
442
+ return parsed;
439
443
  }
440
444
 
441
445
  //#endregion
@@ -7391,6 +7395,21 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
7391
7395
  continue;
7392
7396
  }
7393
7397
  }
7398
+ if (resourceType === "AWS::RDS::DBInstance" && k === "PubliclyAccessible") {
7399
+ const subnetGroup = declared.DBSubnetGroupName ?? live.DBSubnetGroupName;
7400
+ if (typeof subnetGroup === "string") {
7401
+ if (v === (subnetGroup === "default")) {
7402
+ findings.push({
7403
+ tier: "atDefault",
7404
+ logicalId,
7405
+ resourceType,
7406
+ path: k,
7407
+ actual: v
7408
+ });
7409
+ continue;
7410
+ }
7411
+ }
7412
+ }
7394
7413
  const namePattern = DEFAULT_MANAGED_NAME_PATHS[resourceType]?.[k];
7395
7414
  if (namePattern !== void 0 && typeof v === "string" && namePattern.test(v)) {
7396
7415
  findings.push({
@@ -20241,6 +20260,9 @@ function finalCheckExit(code, fail) {
20241
20260
  * who can make the decision. It is gated OUT of every machine/automation mode:
20242
20261
  * - --json / --show-all / --pre-deploy — machine output or baseline-untouched contracts,
20243
20262
  * - --fail — the CI drift-exit path,
20263
+ * - --no-prompt — the exit-0 twin of --fail's suppression: force the run non-interactive
20264
+ * (report-only) even in a TTY, without failing CI on drift. Its whole job is this gate;
20265
+ * when it fires on a no-baseline stack the establish note below takes over (no hang).
20244
20266
  * - #779: --declared-only / --undeclared-only — a SCOPE filter is active, so `findings`
20245
20267
  * has been reduced to one tier (declared-only drops the whole undeclared/added/atDefault
20246
20268
  * tier; undeclared-only drops declared plus its readGap/unresolved byproducts). The
@@ -20263,7 +20285,7 @@ function finalCheckExit(code, fail) {
20263
20285
  * Pure + exported for tests.
20264
20286
  */
20265
20287
  function shouldOfferInteractiveResolve(a, ctx) {
20266
- return (ctx.code === 1 || ctx.hasUnrecorded || !ctx.hasBaseline) && !a.json && !a.showAll && !a.preDeploy && !a.fail && !a.yes && !a.declaredOnly && !a.undeclaredOnly && ctx.interactive;
20288
+ return (ctx.code === 1 || ctx.hasUnrecorded || !ctx.hasBaseline) && !a.json && !a.showAll && !a.preDeploy && !a.fail && !a.noPrompt && !a.yes && !a.declaredOnly && !a.undeclaredOnly && ctx.interactive;
20267
20289
  }
20268
20290
  /**
20269
20291
  * #781: does a committed baseline exist for this stack IN THE REGION being checked?
@@ -20760,6 +20782,12 @@ OPTIONS
20760
20782
  --fail (check) exit 1 on drift + never prompt — for
20761
20783
  scripts/CI (same convention as \`cdk diff --fail\`);
20762
20784
  without it, check REPORTS drift but exits 0
20785
+ --no-prompt (check) never open the interactive resolve menu —
20786
+ report only, exit 0 even on drift. The exit-0 twin of
20787
+ --fail's suppression, for a report-only script run
20788
+ ATTACHED to a terminal (where the TTY gate alone would
20789
+ still prompt and could hang). Non-TTY runs never prompt
20790
+ anyway; with --fail, --fail's exit-1 wins
20763
20791
  --strict (check) exit 1 when coverage is INCOMPLETE — any
20764
20792
  resource skipped (unread) or a nested stack not
20765
20793
  recursed into. A loud coverage warning always prints;
@@ -20799,8 +20827,8 @@ OPTIONS
20799
20827
  --help, -h --version, -v (bare \`cdkrd -v\` prints the version; inside a verb,
20800
20828
  \`-v\` is the short alias for --verbose, e.g. check -v)
20801
20829
 
20802
- Automation: check --fail / record --yes / ignore --yes / revert --yes (or
20803
- --dry-run); non-TTY runs never prompt.
20830
+ Automation: check --fail (or --no-prompt for exit-0 report-only) / record --yes /
20831
+ ignore --yes / revert --yes (or --dry-run); non-TTY runs never prompt.
20804
20832
 
20805
20833
  EXIT CODES
20806
20834
  check: 0 = clean (or drift without --fail) 1 = drift (--fail) / incomplete coverage (--strict) 2 = error