@go-to-k/cdkd 0.234.1 → 0.235.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/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { A as withErrorHandling, B as generateResourceName, C as StackHasActiveImportsError, F as getLiveRenderer, H as withSkipPrefix, I as PATTERN_B_NAME_OPTIONS, L as PATTERN_B_NAME_PROPERTIES, M as getLogger, P as runStackBuffered, R as PATTERN_B_RESOURCE_TYPES, S as ResourceUpdateNotSupportedError, U as withStackName, V as generateResourceNameWithFallback, _ as MissingCdkCliError, a as normalizeAwsTagsToCfn, b as ProvisioningError, f as LocalInvokeBuildError$1, i as matchesCdkPath, k as normalizeAwsError, l as CdkdError, m as LocalStartServiceError, n as isTerminationProtectionPropagationError, o as resolveExplicitPhysicalId, p as LocalMigrateError, r as CDK_PATH_TAG, s as assertRegionMatch, t as disableInstanceApiTermination, v as NestedStackChildDirectDestroyError, w as StackTerminationProtectionError, x as ResourceTimeoutError, y as PartialFailureError } from "./ec2-termination-protection-uvVnteGl.js";
3
3
  import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-pjPwZz1r.js";
4
- import { $ as AssetManifestLoader, A as DiffCalculator, B as buildAssetRedirectMap, C as findActionableSilentDrops, D as refStateLookupFromResource, E as cfnRefValueFromPhysicalId, F as rebuildClientForBucketRegion, G as BOOTSTRAP_MARKER_PREFIX, H as loadPublishableAssetManifest, I as shouldRetainResource, J as buildDockerImage, K as ensureAssetStorage, L as AssetPublisher, M as TemplateParser, N as LockManager, O as WAFv2WebACLProvider, P as S3StateBackend, Q as runDockerStreaming, R as stringifyValue, S as ProviderRegistry, T as IntrinsicFunctionResolver, U as rewriteTemplateAssetReferences, V as createAssetRedirectResolver, W as AssetModeResolver, X as getDockerCmd, Y as formatDockerLoginError, Z as runDockerForeground, _ as green, _t as AssemblyReader, a as withRetry, at as resolveApp, b as IAMRoleProvider, c as computeImplicitDeleteEdges, ct as resolveStateBucketWithDefault, d as isStatefulRecreateTargetSync, dt as warnDeprecatedNoPrefixCliFlag, et as getDockerImageBySourceHash, f as renderStatefulReason, ft as CFN_TEMPLATE_BODY_LIMIT, g as gray, gt as uploadCfnTemplate, h as cyan, ht as findLargeInlineResources, i as withResourceDeadline, it as getLegacyStateBucketName, j as DagBuilder, k as applyRoleArnIfSet, l as extractDeploymentEventError, lt as resolveStateBucketWithDefaultAndSource, m as bold, mt as MIGRATE_TMP_PREFIX, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as synthesisStatusMessage, o as isRetryableTransientError, ot as resolveCaptureObservedState, p as formatResourceLine, pt as CFN_TEMPLATE_URL_LIMIT, q as parseBootstrapMarker, r as DeployEngine, rt as getDefaultStateBucketName, s as IMPLICIT_DELETE_DEPENDENCIES, st as resolveSkipPrefix, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as Synthesizer, u as MULTI_REGION_RECREATE_BLOCKED_TYPES, ut as resolveUseCdkBootstrapAssets, v as red, w as CloudControlProvider, x as collectInlinePolicyNamesManagedBySiblings, y as yellow, yt as resolveBucketRegion, z as WorkGraph } from "./deploy-engine-CdAkyW9k.js";
4
+ import { $ as AssetManifestLoader, A as DiffCalculator, B as buildAssetRedirectMap, C as findActionableSilentDrops, D as refStateLookupFromResource, E as cfnRefValueFromPhysicalId, F as rebuildClientForBucketRegion, G as BOOTSTRAP_MARKER_PREFIX, H as loadPublishableAssetManifest, I as shouldRetainResource, J as buildDockerImage, K as ensureAssetStorage, L as AssetPublisher, M as TemplateParser, N as LockManager, O as WAFv2WebACLProvider, P as S3StateBackend, Q as runDockerStreaming, R as stringifyValue, S as ProviderRegistry, T as IntrinsicFunctionResolver, U as rewriteTemplateAssetReferences, V as createAssetRedirectResolver, W as AssetModeResolver, X as getDockerCmd, Y as formatDockerLoginError, Z as runDockerForeground, _ as green, _t as uploadCfnTemplate, a as withRetry, at as resolveApp, b as IAMRoleProvider, bt as resolveBucketRegion, c as computeImplicitDeleteEdges, ct as resolveSkipPrefix, d as isStatefulRecreateTargetSync, dt as resolveUseCdkBootstrapAssets, et as getDockerImageBySourceHash, f as renderStatefulReason, ft as warnDeprecatedNoPrefixCliFlag, g as gray, gt as findLargeInlineResources, h as cyan, ht as MIGRATE_TMP_PREFIX, i as withResourceDeadline, it as getLegacyStateBucketName, j as DagBuilder, k as applyRoleArnIfSet, l as extractDeploymentEventError, lt as resolveStateBucketWithDefault, m as bold, mt as CFN_TEMPLATE_URL_LIMIT, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as synthesisStatusMessage, o as isRetryableTransientError, ot as resolveAutoAssetStorage, p as formatResourceLine, pt as CFN_TEMPLATE_BODY_LIMIT, q as parseBootstrapMarker, r as DeployEngine, rt as getDefaultStateBucketName, s as IMPLICIT_DELETE_DEPENDENCIES, st as resolveCaptureObservedState, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as Synthesizer, u as MULTI_REGION_RECREATE_BLOCKED_TYPES, ut as resolveStateBucketWithDefaultAndSource, v as red, vt as AssemblyReader, w as CloudControlProvider, x as collectInlinePolicyNamesManagedBySiblings, y as yellow, z as WorkGraph } from "./deploy-engine-Cbi5IzWV.js";
5
5
  import { t as ASGProvider } from "./asg-provider-Dd9Xze-T.js";
6
6
  import { AsyncLocalStorage } from "node:async_hooks";
7
7
  import { createHash, randomBytes, randomUUID } from "node:crypto";
@@ -508,6 +508,7 @@ const deployOptions = [
508
508
  new Option("--dry-run", "Show changes without applying").default(false),
509
509
  new Option("--skip-assets", "Skip asset publishing").default(false),
510
510
  new Option("--no-rollback", "Skip rollback on deployment failure"),
511
+ new Option("--no-auto-asset-storage", "Do not auto-create cdkd-owned asset storage (asset bucket + container-asset ECR repo + marker) on the first deploy into a region not yet opted in via 'cdkd bootstrap'. Deploys into such regions stay in legacy mode (CDK bootstrap destinations). Per-app opt-out: cdk.json context.cdkd.autoAssetStorage: false."),
511
512
  new Option("--no-capture-observed-state", "Skip capturing AWS-current properties after each create/update (adds a fire-and-forget readCurrentState per resource so cdkd drift can compare against the real deploy-time AWS snapshot instead of the template). On by default. Disable when deploy speed matters more than rich drift detection — falls back to comparing against template properties (the pre-v3 behavior)."),
512
513
  new Option("--prefix-user-supplied-names", "Opt in to LEGACY behavior: prepend the stack name to physical names the user explicitly supplied in their CDK code (e.g. `new iam.Role(this, \"X\", { roleName: \"my-role\" })` → AWS resource named `MyStack-my-role` instead of `my-role`). Since v0.94.0 the default is to NOT prefix user-supplied names — this flag restores the pre-v0.94.0 behavior on Pattern B providers (IAM Role / User / Group / InstanceProfile / ELBv2 LoadBalancer / TargetGroup). Enable via this flag, CDKD_PREFIX_USER_SUPPLIED_NAMES=true, or cdk.json context.cdkd.prefixUserSuppliedNames=true. Applies to `cdkd deploy` only.").default(false),
513
514
  noWaitOption,
@@ -1463,6 +1464,28 @@ async function promptRecreateConfirm(input) {
1463
1464
  }
1464
1465
  }
1465
1466
 
1467
+ //#endregion
1468
+ //#region src/cli/commands/confirm-prompt.ts
1469
+ /**
1470
+ * Default-YES confirmation prompt (`[Y/n]`, empty input = yes). Used by the
1471
+ * issue #1007 asset-storage auto-create on interactive TTY deploys without
1472
+ * `--yes`. Kept in its own module (mirrors `recreate-confirm-prompt.ts`) so
1473
+ * the accept/decline parsing is unit-testable without importing the whole
1474
+ * deploy command.
1475
+ */
1476
+ async function promptYesNo(prompt) {
1477
+ const rl = readline.createInterface({
1478
+ input: process.stdin,
1479
+ output: process.stdout
1480
+ });
1481
+ try {
1482
+ const ans = await rl.question(`${prompt} [Y/n] `);
1483
+ return /^(y(es)?)?$/i.test(ans.trim());
1484
+ } finally {
1485
+ rl.close();
1486
+ }
1487
+ }
1488
+
1466
1489
  //#endregion
1467
1490
  //#region src/state/deployment-events-store.ts
1468
1491
  /**
@@ -1503,7 +1526,7 @@ const FLUSH_INTERVAL_MS = 2e3;
1503
1526
  const FLUSH_EVENT_THRESHOLD = 50;
1504
1527
  /** Build-time cdkd version, with a dev fallback for non-built contexts. */
1505
1528
  function getCdkdVersion() {
1506
- return "0.234.1";
1529
+ return "0.235.0";
1507
1530
  }
1508
1531
  /**
1509
1532
  * Generate a time-sortable unique run id, e.g.
@@ -37709,9 +37732,18 @@ async function deployCommand(stacks, options) {
37709
37732
  stsClient.destroy();
37710
37733
  const assetPublisher = new AssetPublisher();
37711
37734
  const useCdkBootstrapAssets = resolveUseCdkBootstrapAssets(options.useCdkBootstrapAssets);
37735
+ const autoAssetStorage = resolveAutoAssetStorage(options.autoAssetStorage);
37736
+ const confirmAutoAssetStorage = async (assetRegion) => {
37737
+ if (options.yes || !process.stdin.isTTY) {
37738
+ logger.info(`Creating cdkd asset storage for region '${assetRegion}' (first deploy into this region; opt out with --no-auto-asset-storage).`);
37739
+ return true;
37740
+ }
37741
+ return promptYesNo(`Region '${assetRegion}' has no cdkd asset storage yet. Create it now (S3 bucket cdkd-assets-${accountId}-${assetRegion} + container-asset ECR repo, out of 'cdk gc' reach)?`);
37742
+ };
37712
37743
  const assetModeResolver = new AssetModeResolver(preflightStateBackend, accountId, {
37713
37744
  ...options.profile && { profile: options.profile },
37714
- ...useCdkBootstrapAssets && { useCdkBootstrapAssets: true }
37745
+ ...useCdkBootstrapAssets && { useCdkBootstrapAssets: true },
37746
+ ...autoAssetStorage && !options.dryRun && !options.skipAssets && { autoCreate: { confirm: confirmAutoAssetStorage } }
37715
37747
  });
37716
37748
  const stateConfig = {
37717
37749
  bucket: stateBucket,
@@ -56014,7 +56046,7 @@ function reorderArgs(argv) {
56014
56046
  async function main() {
56015
56047
  installPipeCloseHandler();
56016
56048
  const program = new Command();
56017
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.234.1");
56049
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.235.0");
56018
56050
  program.addCommand(createBootstrapCommand());
56019
56051
  program.addCommand(createSynthCommand());
56020
56052
  program.addCommand(createListCommand());