@go-to-k/cdkd 0.0.2 → 0.0.3

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
@@ -306,16 +306,16 @@ Reproduce with `./tests/benchmark/run-benchmark.sh all`. See [tests/benchmark/RE
306
306
 
307
307
  ## Installation
308
308
 
309
- ### From npm (experimental)
309
+ ### From npm
310
310
 
311
311
  ```bash
312
- npm i -g @go-to-k/cdkd@experimental # latest experimental
313
- npm i -g @go-to-k/cdkd@0.1.0 # pin to a specific version
312
+ npm i -g @go-to-k/cdkd # latest release
313
+ npm i -g @go-to-k/cdkd@0.0.2 # pin to a specific version
314
314
  ```
315
315
 
316
316
  The installed binary is `cdkd` — run it the same way in either install path.
317
317
 
318
- > Published under the `experimental` dist-tag while the project is in early development. There is no `latest` tag yet always pin to `@experimental` (or a specific version) so `npm i -g @go-to-k/cdkd` does not silently resolve to a future stable release with different behavior.
318
+ > cdkd is an experimental / educational project and is not intended for production usesee the warning at the top of this README. Pin to a specific version if you need reproducible installs.
319
319
 
320
320
  ### From source
321
321
 
package/dist/cli.js CHANGED
@@ -2893,6 +2893,7 @@ import {
2893
2893
  GetObjectCommand,
2894
2894
  PutObjectCommand as PutObjectCommand2,
2895
2895
  DeleteObjectCommand,
2896
+ HeadBucketCommand as HeadBucketCommand2,
2896
2897
  HeadObjectCommand as HeadObjectCommand2,
2897
2898
  ListObjectsV2Command,
2898
2899
  NoSuchKey
@@ -2909,6 +2910,28 @@ var S3StateBackend = class {
2909
2910
  getStateKey(stackName) {
2910
2911
  return `${this.config.prefix}/${stackName}/state.json`;
2911
2912
  }
2913
+ /**
2914
+ * Verify that the configured state bucket exists.
2915
+ *
2916
+ * Called early in deploy/destroy to fail fast before expensive work
2917
+ * (asset publishing, Docker builds) runs against a missing bucket.
2918
+ */
2919
+ async verifyBucketExists() {
2920
+ try {
2921
+ await this.s3Client.send(new HeadBucketCommand2({ Bucket: this.config.bucket }));
2922
+ } catch (error) {
2923
+ const name = error.name;
2924
+ if (name === "NotFound" || name === "NoSuchBucket") {
2925
+ throw new StateError(
2926
+ `State bucket '${this.config.bucket}' does not exist. Run 'cdkd bootstrap' to create it, or specify an existing bucket via --state-bucket, CDKD_STATE_BUCKET, or cdk.json context.cdkd.stateBucket.`
2927
+ );
2928
+ }
2929
+ throw new StateError(
2930
+ `Failed to verify state bucket '${this.config.bucket}': ${error instanceof Error ? error.message : String(error)}`,
2931
+ error instanceof Error ? error : void 0
2932
+ );
2933
+ }
2934
+ }
2912
2935
  /**
2913
2936
  * Check if state exists for a stack
2914
2937
  */
@@ -26028,6 +26051,11 @@ async function deployCommand(stacks, options) {
26028
26051
  ...options.profile && { profile: options.profile }
26029
26052
  });
26030
26053
  setAwsClients(awsClients);
26054
+ const preflightStateBackend = new S3StateBackend(awsClients.s3, {
26055
+ bucket: stateBucket,
26056
+ prefix: options.statePrefix
26057
+ });
26058
+ await preflightStateBackend.verifyBucketExists();
26031
26059
  let deployInterrupted = false;
26032
26060
  const topLevelSigintHandler = () => {
26033
26061
  if (deployInterrupted) {
@@ -26481,6 +26509,7 @@ async function destroyCommand(stackArgs, options) {
26481
26509
  prefix: options.statePrefix
26482
26510
  };
26483
26511
  const stateBackend = new S3StateBackend(awsClients.s3, stateConfig);
26512
+ await stateBackend.verifyBucketExists();
26484
26513
  const lockManager = new LockManager(awsClients.s3, stateConfig);
26485
26514
  const dagBuilder = new DagBuilder();
26486
26515
  const providerRegistry = new ProviderRegistry();
@@ -26861,7 +26890,7 @@ function reorderArgs(argv) {
26861
26890
  }
26862
26891
  async function main() {
26863
26892
  const program = new Command8();
26864
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.0.2");
26893
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.0.3");
26865
26894
  program.addCommand(createBootstrapCommand());
26866
26895
  program.addCommand(createSynthCommand());
26867
26896
  program.addCommand(createDeployCommand());