@go-to-k/cdkd 0.0.4 → 0.1.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
@@ -99,6 +99,8 @@ Reproduce with `./tests/benchmark/run-benchmark.sh all`. See [tests/benchmark/RE
99
99
  └── Initialize AWS clients
100
100
 
101
101
  2. Synthesis (self-implemented, no CDK CLI dependency)
102
+ ├── Short-circuit: if --app is an existing directory, treat it as a
103
+ │ pre-synthesized cloud assembly and skip the steps below
102
104
  ├── Load context (merge order, later wins):
103
105
  │ ├── CDK defaults (path-metadata, asset-metadata, version-reporting, bundling-stacks)
104
106
  │ ├── ~/.cdk.json "context" field (user defaults)
@@ -364,6 +366,9 @@ cdkd bootstrap \
364
366
  # Synthesize only
365
367
  cdkd synth --app "npx ts-node app.ts"
366
368
 
369
+ # Deploy from a pre-synthesized cloud assembly directory
370
+ cdkd deploy --app cdk.out
371
+
367
372
  # Deploy (single stack auto-detected, reads --app from cdk.json)
368
373
  cdkd deploy
369
374
 
package/dist/cli.js CHANGED
@@ -477,12 +477,16 @@ function parseContextOptions(contextArgs) {
477
477
  var commonOptions = [
478
478
  new Option("--verbose", "Enable verbose logging").default(false),
479
479
  new Option("--region <region>", "AWS region"),
480
- new Option("--profile <profile>", "AWS profile")
480
+ new Option("--profile <profile>", "AWS profile"),
481
+ new Option(
482
+ "-y, --yes",
483
+ "Automatically answer interactive prompts with the recommended response (e.g. confirm destroy)"
484
+ ).default(false)
481
485
  ];
482
486
  var appOptions = [
483
487
  new Option(
484
- "--app <command>",
485
- 'CDK app command (e.g., "npx ts-node app.ts"). Falls back to cdk.json or CDKD_APP env'
488
+ "-a, --app <command>",
489
+ 'CDK app command (e.g., "npx ts-node app.ts") or path to a pre-synthesized cloud assembly directory. Falls back to cdk.json or CDKD_APP env'
486
490
  ),
487
491
  new Option("--output <path>", "Output directory for synthesis").default("cdk.out")
488
492
  ];
@@ -517,7 +521,11 @@ var contextOptions = [
517
521
  "Set context values (can be specified multiple times)"
518
522
  )
519
523
  ];
520
- var destroyOptions = [new Option("--force", "Skip confirmation prompt").default(false)];
524
+ var destroyOptions = [
525
+ new Option("-f, --force", "Do not ask for confirmation before destroying the stacks").default(
526
+ false
527
+ )
528
+ ];
521
529
 
522
530
  // src/utils/logger.ts
523
531
  var colors = {
@@ -950,7 +958,7 @@ import { writeFileSync as writeFileSync3 } from "fs";
950
958
  import { join as join4 } from "path";
951
959
 
952
960
  // src/synthesis/synthesizer.ts
953
- import { mkdirSync } from "node:fs";
961
+ import { existsSync as existsSync3, mkdirSync, statSync } from "node:fs";
954
962
  import { resolve as resolve3 } from "node:path";
955
963
  import { GetCallerIdentityCommand as GetCallerIdentityCommand2, STSClient as STSClient2 } from "@aws-sdk/client-sts";
956
964
 
@@ -2118,6 +2126,14 @@ var Synthesizer = class {
2118
2126
  * 5. Return assembly with stacks
2119
2127
  */
2120
2128
  async synthesize(options) {
2129
+ const appPath = resolve3(options.app);
2130
+ if (existsSync3(appPath) && statSync(appPath).isDirectory()) {
2131
+ this.logger.debug(`Using pre-synthesized cloud assembly at ${appPath}`);
2132
+ const manifest = this.assemblyReader.readManifest(appPath);
2133
+ const stacks = this.assemblyReader.getAllStacks(appPath, manifest);
2134
+ this.logger.debug(`Loaded ${stacks.length} stack(s) from pre-synthesized assembly`);
2135
+ return { manifest, assemblyDir: appPath, stacks };
2136
+ }
2121
2137
  const outputDir = resolve3(options.output || "cdk.out");
2122
2138
  mkdirSync(outputDir, { recursive: true });
2123
2139
  const userCdkJson = loadUserCdkJson();
@@ -2318,7 +2334,7 @@ import { Command as Command3 } from "commander";
2318
2334
  import { readFileSync as readFileSync4 } from "node:fs";
2319
2335
 
2320
2336
  // src/assets/file-asset-publisher.ts
2321
- import { createReadStream, statSync } from "node:fs";
2337
+ import { createReadStream, statSync as statSync2 } from "node:fs";
2322
2338
  import { join as join5, basename } from "node:path";
2323
2339
  import { S3Client as S3Client2, HeadObjectCommand, PutObjectCommand } from "@aws-sdk/client-s3";
2324
2340
  var FileAssetPublisher = class {
@@ -2388,7 +2404,7 @@ var FileAssetPublisher = class {
2388
2404
  * Upload a single file to S3
2389
2405
  */
2390
2406
  async uploadFile(client, filePath, bucket, key) {
2391
- const stat = statSync(filePath);
2407
+ const stat = statSync2(filePath);
2392
2408
  const stream = createReadStream(filePath);
2393
2409
  await client.send(
2394
2410
  new PutObjectCommand({
@@ -2410,7 +2426,7 @@ var FileAssetPublisher = class {
2410
2426
  archive.on("data", (chunk) => chunks.push(chunk));
2411
2427
  archive.on("end", () => resolve4(Buffer.concat(chunks)));
2412
2428
  archive.on("error", reject);
2413
- const stat = statSync(dirPath);
2429
+ const stat = statSync2(dirPath);
2414
2430
  if (stat.isDirectory()) {
2415
2431
  archive.directory(dirPath, false);
2416
2432
  } else {
@@ -26711,7 +26727,7 @@ Resources to be deleted (${resourceCount}):`);
26711
26727
  for (const [logicalId, resource] of Object.entries(currentState.resources)) {
26712
26728
  logger.info(` - ${logicalId} (${resource.resourceType})`);
26713
26729
  }
26714
- if (!options.force) {
26730
+ if (!options.yes && !options.force) {
26715
26731
  const rl = readline.createInterface({
26716
26732
  input: process.stdin,
26717
26733
  output: process.stdout
@@ -27013,7 +27029,7 @@ function reorderArgs(argv) {
27013
27029
  }
27014
27030
  async function main() {
27015
27031
  const program = new Command8();
27016
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.0.4");
27032
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.1.0");
27017
27033
  program.addCommand(createBootstrapCommand());
27018
27034
  program.addCommand(createSynthCommand());
27019
27035
  program.addCommand(createDeployCommand());