@go-to-k/cdkd 0.92.0 → 0.93.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # cdkd
1
+ # cdkd (CDK Direct)
2
2
 
3
- **cdkd** (CDK Direct) a from-scratch CDK CLI that provisions via AWS SDK instead of CloudFormation.
3
+ Drop-in CDK CLI for existing CDK apps faster deploys via AWS SDK instead of CloudFormation, with local emulation for Lambda, API Gateway, and ECS.
4
4
 
5
5
  - **Drop-in CDK compatible** — your existing CDK app code runs as-is.
6
6
  - **Up to 15x faster deploys than the AWS CDK CLI (CloudFormation)**
package/dist/cli.js CHANGED
@@ -17830,6 +17830,14 @@ function withSkipPrefix(skip, fn) {
17830
17830
  function getCurrentSkipPrefix() {
17831
17831
  return skipPrefixStore.getStore() ?? false;
17832
17832
  }
17833
+ var PATTERN_B_RESOURCE_TYPES = [
17834
+ "AWS::IAM::Role",
17835
+ "AWS::IAM::User",
17836
+ "AWS::IAM::Group",
17837
+ "AWS::IAM::InstanceProfile",
17838
+ "AWS::ElasticLoadBalancingV2::LoadBalancer",
17839
+ "AWS::ElasticLoadBalancingV2::TargetGroup"
17840
+ ];
17833
17841
  function generateResourceName(name, options) {
17834
17842
  const {
17835
17843
  maxLength,
@@ -65471,6 +65479,72 @@ function registerAllProviders(registry) {
65471
65479
 
65472
65480
  // src/cli/commands/deploy.ts
65473
65481
  init_aws_clients();
65482
+
65483
+ // src/cli/commands/prefix-migration-check.ts
65484
+ import * as readline from "node:readline/promises";
65485
+ function findPendingPrefixRenames(stackName, state) {
65486
+ if (!state)
65487
+ return [];
65488
+ const patternB = new Set(PATTERN_B_RESOURCE_TYPES);
65489
+ const prefix = `${stackName}-`;
65490
+ const out = [];
65491
+ for (const [logicalId, resource] of Object.entries(state.resources)) {
65492
+ if (!patternB.has(resource.resourceType))
65493
+ continue;
65494
+ if (typeof resource.physicalId !== "string")
65495
+ continue;
65496
+ if (!resource.physicalId.startsWith(prefix))
65497
+ continue;
65498
+ const newPhysicalId = resource.physicalId.slice(prefix.length);
65499
+ if (newPhysicalId.length === 0)
65500
+ continue;
65501
+ out.push({
65502
+ logicalId,
65503
+ resourceType: resource.resourceType,
65504
+ oldPhysicalId: resource.physicalId,
65505
+ newPhysicalId
65506
+ });
65507
+ }
65508
+ return out;
65509
+ }
65510
+ async function promptMigrationConfirm(renames, opts) {
65511
+ if (renames.length === 0)
65512
+ return true;
65513
+ const logger = getLogger();
65514
+ logger.warn("");
65515
+ logger.warn(
65516
+ `WARNING: --no-prefix-user-supplied-names will REPLACE ${renames.length} resource(s) whose AWS physical name is still prefixed with the stack name:`
65517
+ );
65518
+ for (const r of renames) {
65519
+ logger.warn(` - ${r.logicalId} (${r.resourceType}): ${r.oldPhysicalId} -> ${r.newPhysicalId}`);
65520
+ }
65521
+ logger.warn(
65522
+ "These resources will be REPLACED because the new naming convention drops the stack-name prefix."
65523
+ );
65524
+ if (opts.yes)
65525
+ return true;
65526
+ if (process.stdin.isTTY !== true) {
65527
+ throw new Error(
65528
+ "--no-prefix-user-supplied-names migration confirm prompt cannot run in a non-interactive environment. Pass --yes / -y to confirm the REPLACEMENT, or run the deploy from a real terminal."
65529
+ );
65530
+ }
65531
+ const rl = readline.createInterface({
65532
+ input: process.stdin,
65533
+ output: process.stdout
65534
+ });
65535
+ try {
65536
+ const answer = await rl.question("\nContinue? (y/N): ");
65537
+ const trimmed = answer.trim().toLowerCase();
65538
+ if (trimmed === "y" || trimmed === "yes")
65539
+ return true;
65540
+ logger.info("Deploy cancelled \u2014 no resources modified.");
65541
+ return false;
65542
+ } finally {
65543
+ rl.close();
65544
+ }
65545
+ }
65546
+
65547
+ // src/cli/commands/deploy.ts
65474
65548
  async function deployCommand(stacks, options) {
65475
65549
  const logger = getLogger();
65476
65550
  if (options.verbose) {
@@ -65674,33 +65748,43 @@ Deploying stack: ${stackInfo.stackName}${stackRegion !== baseRegion ? ` (region:
65674
65748
  const stackProviderRegistry = new ProviderRegistry();
65675
65749
  registerAllProviders(stackProviderRegistry);
65676
65750
  stackProviderRegistry.setCustomResourceResponseBucket(stateBucket, baseRegion);
65677
- const stackDeployEngine = new DeployEngine(
65678
- stackStateBackend,
65679
- stackLockManager,
65680
- dagBuilder,
65681
- diffCalculator,
65682
- stackProviderRegistry,
65683
- {
65684
- concurrency: options.concurrency,
65685
- dryRun: options.dryRun,
65686
- noRollback: !options.rollback,
65687
- captureObservedState: resolveCaptureObservedState(options.captureObservedState),
65688
- ...options.resourceWarnAfter?.globalMs !== void 0 && {
65689
- resourceWarnAfterMs: options.resourceWarnAfter.globalMs
65690
- },
65691
- ...options.resourceTimeout?.globalMs !== void 0 && {
65692
- resourceTimeoutMs: options.resourceTimeout.globalMs
65693
- },
65694
- ...options.resourceWarnAfter?.perTypeMs && {
65695
- resourceWarnAfterByType: options.resourceWarnAfter.perTypeMs
65696
- },
65697
- ...options.resourceTimeout?.perTypeMs && {
65698
- resourceTimeoutByType: options.resourceTimeout.perTypeMs
65699
- }
65700
- },
65701
- stackRegion
65702
- );
65703
65751
  try {
65752
+ if (skipPrefix) {
65753
+ const existing = await stackStateBackend.getState(stackInfo.stackName, stackRegion);
65754
+ const pending = findPendingPrefixRenames(stackInfo.stackName, existing?.state);
65755
+ if (pending.length > 0) {
65756
+ const proceed = await promptMigrationConfirm(pending, { yes: options.yes });
65757
+ if (!proceed) {
65758
+ return;
65759
+ }
65760
+ }
65761
+ }
65762
+ const stackDeployEngine = new DeployEngine(
65763
+ stackStateBackend,
65764
+ stackLockManager,
65765
+ dagBuilder,
65766
+ diffCalculator,
65767
+ stackProviderRegistry,
65768
+ {
65769
+ concurrency: options.concurrency,
65770
+ dryRun: options.dryRun,
65771
+ noRollback: !options.rollback,
65772
+ captureObservedState: resolveCaptureObservedState(options.captureObservedState),
65773
+ ...options.resourceWarnAfter?.globalMs !== void 0 && {
65774
+ resourceWarnAfterMs: options.resourceWarnAfter.globalMs
65775
+ },
65776
+ ...options.resourceTimeout?.globalMs !== void 0 && {
65777
+ resourceTimeoutMs: options.resourceTimeout.globalMs
65778
+ },
65779
+ ...options.resourceWarnAfter?.perTypeMs && {
65780
+ resourceWarnAfterByType: options.resourceWarnAfter.perTypeMs
65781
+ },
65782
+ ...options.resourceTimeout?.perTypeMs && {
65783
+ resourceTimeoutByType: options.resourceTimeout.perTypeMs
65784
+ }
65785
+ },
65786
+ stackRegion
65787
+ );
65704
65788
  const deployResult = await stackDeployEngine.deploy(
65705
65789
  stackInfo.stackName,
65706
65790
  stackInfo.template
@@ -65985,7 +66069,7 @@ function createDiffCommand() {
65985
66069
  }
65986
66070
 
65987
66071
  // src/cli/commands/drift.ts
65988
- import * as readline from "node:readline/promises";
66072
+ import * as readline2 from "node:readline/promises";
65989
66073
  import { Command as Command6, Option as Option3 } from "commander";
65990
66074
  init_aws_clients();
65991
66075
 
@@ -66694,7 +66778,7 @@ async function runWithConcurrency(tasks, concurrency) {
66694
66778
  await Promise.all(workers);
66695
66779
  }
66696
66780
  async function confirmPrompt(prompt) {
66697
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
66781
+ const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
66698
66782
  try {
66699
66783
  const ans = await rl.question(`${prompt} [y/N] `);
66700
66784
  return /^y(es)?$/i.test(ans.trim());
@@ -66807,7 +66891,7 @@ import { Command as Command7 } from "commander";
66807
66891
  init_aws_clients();
66808
66892
 
66809
66893
  // src/cli/commands/destroy-runner.ts
66810
- import * as readline2 from "node:readline/promises";
66894
+ import * as readline3 from "node:readline/promises";
66811
66895
  init_aws_clients();
66812
66896
  var PROTECTION_PROPERTY_BY_TYPE = {
66813
66897
  "AWS::Logs::LogGroup": "DeletionProtectionEnabled",
@@ -66879,7 +66963,7 @@ Resources to be deleted (${resourceCount}):`);
66879
66963
  }
66880
66964
  const protectedCount = ctx.removeProtection ? countProtectedResources(state) : 0;
66881
66965
  if (!ctx.skipConfirmation) {
66882
- const rl = readline2.createInterface({
66966
+ const rl = readline3.createInterface({
66883
66967
  input: process.stdin,
66884
66968
  output: process.stdout
66885
66969
  });
@@ -67313,7 +67397,7 @@ function createDestroyCommand() {
67313
67397
  }
67314
67398
 
67315
67399
  // src/cli/commands/orphan.ts
67316
- import * as readline3 from "node:readline/promises";
67400
+ import * as readline4 from "node:readline/promises";
67317
67401
  import { Command as Command8 } from "commander";
67318
67402
  init_aws_clients();
67319
67403
 
@@ -67986,7 +68070,7 @@ function stringifyForAudit(value) {
67986
68070
  return JSON.stringify(value);
67987
68071
  }
67988
68072
  async function confirmPrompt2(prompt) {
67989
- const rl = readline3.createInterface({ input: process.stdin, output: process.stdout });
68073
+ const rl = readline4.createInterface({ input: process.stdin, output: process.stdout });
67990
68074
  try {
67991
68075
  const ans = await rl.question(`${prompt} [y/N] `);
67992
68076
  return /^y(es)?$/i.test(ans.trim());
@@ -68261,7 +68345,7 @@ function createForceUnlockCommand() {
68261
68345
  }
68262
68346
 
68263
68347
  // src/cli/commands/state.ts
68264
- import * as readline5 from "node:readline/promises";
68348
+ import * as readline6 from "node:readline/promises";
68265
68349
  import { Command as Command12, Option as Option6 } from "commander";
68266
68350
  import {
68267
68351
  GetBucketLocationCommand as GetBucketLocationCommand2,
@@ -68271,7 +68355,7 @@ import {
68271
68355
  init_aws_clients();
68272
68356
 
68273
68357
  // src/cli/commands/state-migrate.ts
68274
- import * as readline4 from "node:readline/promises";
68358
+ import * as readline5 from "node:readline/promises";
68275
68359
  import { Command as Command11 } from "commander";
68276
68360
  import {
68277
68361
  CopyObjectCommand,
@@ -68547,7 +68631,7 @@ async function emptyBucketAllVersions(s3, bucket) {
68547
68631
  } while (keyMarker || versionIdMarker);
68548
68632
  }
68549
68633
  async function confirmPrompt3(prompt) {
68550
- const rl = readline4.createInterface({ input: process.stdin, output: process.stdout });
68634
+ const rl = readline5.createInterface({ input: process.stdin, output: process.stdout });
68551
68635
  try {
68552
68636
  const ans = await rl.question(`${prompt} [y/N] `);
68553
68637
  return /^y(es)?$/i.test(ans.trim());
@@ -68955,7 +69039,7 @@ Use 'cdkd destroy ${stackName}' if you want to delete the actual resources.
68955
69039
 
68956
69040
  `
68957
69041
  );
68958
- const rl = readline5.createInterface({
69042
+ const rl = readline6.createInterface({
68959
69043
  input: process.stdin,
68960
69044
  output: process.stdout
68961
69045
  });
@@ -69043,7 +69127,7 @@ WARNING: This destroys ${stackNames.length} stack(s) and removes their state rec
69043
69127
  `);
69044
69128
  }
69045
69129
  process.stdout.write("\n");
69046
- const rl = readline5.createInterface({
69130
+ const rl = readline6.createInterface({
69047
69131
  input: process.stdin,
69048
69132
  output: process.stdout
69049
69133
  });
@@ -69469,7 +69553,7 @@ async function refreshObservedForStack(stackName, region, stateBackend, lockMana
69469
69553
  }
69470
69554
  }
69471
69555
  async function confirmRefresh(prompt) {
69472
- const rl = readline5.createInterface({ input: process.stdin, output: process.stdout });
69556
+ const rl = readline6.createInterface({ input: process.stdin, output: process.stdout });
69473
69557
  try {
69474
69558
  const ans = await rl.question(`${prompt} [y/N] `);
69475
69559
  return /^y(es)?$/i.test(ans.trim());
@@ -69500,12 +69584,12 @@ function createStateCommand() {
69500
69584
 
69501
69585
  // src/cli/commands/import.ts
69502
69586
  import { readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "node:fs";
69503
- import * as readline7 from "node:readline/promises";
69587
+ import * as readline8 from "node:readline/promises";
69504
69588
  import { Command as Command13 } from "commander";
69505
69589
  init_aws_clients();
69506
69590
 
69507
69591
  // src/cli/commands/retire-cfn-stack.ts
69508
- import * as readline6 from "node:readline/promises";
69592
+ import * as readline7 from "node:readline/promises";
69509
69593
  import {
69510
69594
  DescribeStacksCommand,
69511
69595
  DescribeStackResourcesCommand,
@@ -69711,7 +69795,7 @@ async function getCloudFormationResourceMapping(cfnStackName, cfnClient) {
69711
69795
  return map;
69712
69796
  }
69713
69797
  async function confirmPrompt4(prompt) {
69714
- const rl = readline6.createInterface({ input: process.stdin, output: process.stdout });
69798
+ const rl = readline7.createInterface({ input: process.stdin, output: process.stdout });
69715
69799
  try {
69716
69800
  const ans = await rl.question(`${prompt} [y/N] `);
69717
69801
  return /^y(es)?$/i.test(ans.trim());
@@ -70173,7 +70257,7 @@ function formatOutcome(outcome) {
70173
70257
  }
70174
70258
  }
70175
70259
  async function confirmPrompt5(prompt) {
70176
- const rl = readline7.createInterface({ input: process.stdin, output: process.stdout });
70260
+ const rl = readline8.createInterface({ input: process.stdin, output: process.stdout });
70177
70261
  try {
70178
70262
  const ans = await rl.question(`${prompt} [y/N] `);
70179
70263
  return /^y(es)?$/i.test(ans.trim());
@@ -79836,7 +79920,7 @@ function createLocalCommand() {
79836
79920
  }
79837
79921
 
79838
79922
  // src/cli/commands/export.ts
79839
- import * as readline8 from "node:readline/promises";
79923
+ import * as readline9 from "node:readline/promises";
79840
79924
  import { readFileSync as readFileSync9 } from "node:fs";
79841
79925
  import { Command as Command17 } from "commander";
79842
79926
  import {
@@ -80781,7 +80865,7 @@ function printNextSteps(args) {
80781
80865
  logger.info("");
80782
80866
  }
80783
80867
  async function confirmPrompt6(prompt) {
80784
- const rl = readline8.createInterface({ input: process.stdin, output: process.stdout });
80868
+ const rl = readline9.createInterface({ input: process.stdin, output: process.stdout });
80785
80869
  try {
80786
80870
  const ans = await rl.question(`${prompt} [y/N] `);
80787
80871
  return /^y(es)?$/i.test(ans.trim());
@@ -80854,7 +80938,7 @@ function reorderArgs(argv) {
80854
80938
  }
80855
80939
  async function main() {
80856
80940
  const program = new Command18();
80857
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.92.0");
80941
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.93.0");
80858
80942
  program.addCommand(createBootstrapCommand());
80859
80943
  program.addCommand(createSynthCommand());
80860
80944
  program.addCommand(createListCommand());