@go-to-k/cdkd 0.207.6 → 0.208.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
@@ -59,7 +59,7 @@ Reproduce the first two with `./tests/benchmark/run-benchmark.sh all`. See [test
59
59
  - **Rollback on failure**: When a deploy errors mid-stack, cdkd rolls back the resources it just created so the stack state stays consistent (CloudFormation parity — but cdkd does this without round-tripping through CFn). Pass `cdkd deploy --no-rollback` to skip rollback and keep the partial state for Terraform-style inspection / repair. See [Rollback behavior](#rollback-behavior).
60
60
  - **`--no-wait` for async resources**: Skip the multi-minute wait on CloudFront / RDS / ElastiCache / NAT Gateway and return as soon as the create call returns (CloudFormation always blocks)
61
61
  - **VPC route DependsOn relaxation (on by default)**: Drop CDK-injected defensive `DependsOn` edges from VPC Lambdas onto private-subnet routes so `CloudFront::Distribution` and `Lambda::Url` start their ~3-min propagation in parallel with NAT Gateway stabilization (~50% faster on VPC + Lambda + CloudFront stacks). Pass `--no-aggressive-vpc-parallel` to opt out.
62
- - **Local execution** (`cdkd local invoke` / `start-api` / `run-task` / `start-service` / `invoke-agentcore`): run Lambdas, API Gateway routes, ECS tasks, long-running ECS services, and Bedrock AgentCore Runtimes from your CDK code via Docker. All AWS Lambda runtimes, container Lambdas, REST v1 / HTTP v2 / Function URL routes, Service Connect / Cloud Map, AgentCore HTTP / MCP / A2A / AGUI / WebSocket protocols. Works for both `cdkd deploy`-managed (`--from-state`) AND `cdk deploy`-managed (`--from-cfn-stack`) stacks. See [Local execution](#local-execution).
62
+ - **Local execution** (`cdkd local invoke` / `start-api` / `run-task` / `start-service` / `start-alb` / `start-cloudfront` / `invoke-agentcore`): run Lambdas, API Gateway routes, ECS tasks, long-running ECS services, CloudFront distributions, and Bedrock AgentCore Runtimes from your CDK code. All AWS Lambda runtimes, container Lambdas, REST v1 / HTTP v2 / Function URL routes, Service Connect / Cloud Map, AgentCore HTTP / MCP / A2A / AGUI / WebSocket protocols. The Docker-backed commands work for both `cdkd deploy`-managed (`--from-state`) AND `cdk deploy`-managed (`--from-cfn-stack`) stacks; `start-cloudfront` serves the viewer-request -> S3 origin -> viewer-response pipeline in-process (no Docker, no state binding). See [Local execution](#local-execution).
63
63
  - **Bidirectional CloudFormation migration**: `cdkd import --migrate-from-cloudformation` adopts existing CFn stacks (including `cdk deploy`-managed) into cdkd state without re-creating resources; `cdkd export` hands a cdkd stack back to CloudFormation when production-ready. See [Importing](#importing-existing-resources) / [Exporting](#exporting-a-stack-back-to-cloudformation).
64
64
 
65
65
  > **Note**: Resource types not covered by either SDK Providers or Cloud Control API cannot be deployed with cdkd. Deployment fails with a clear error message naming the type + a 1-click issue link.
@@ -243,12 +243,15 @@ maintain, no `cdk synth | sam ...` round-trip.
243
243
  | `cdkd local start-service <target>` | Long-running ECS Service emulator — `DesiredCount` replicas with restart-on-exit (no local load balancer in v1) |
244
244
  | `cdkd local invoke-agentcore <target>` | One-shot Bedrock AgentCore Runtime invoke (HTTP `/invocations` / MCP `/mcp` / A2A `/a2a` / AGUI / WebSocket `--ws`) |
245
245
  | `cdkd local start-alb <targets...>` | Long-running local ALB front-door (HTTP + HTTPS listeners, path / host / header / weighted / redirect / fixed-response routing, authenticate-cognito / authenticate-oidc) for ECS / Lambda backing services |
246
+ | `cdkd local start-cloudfront [target]` | Long-running local CloudFront distribution — viewer-request -> S3 origin -> viewer-response pipeline, CloudFront Functions run in-process (no Docker) |
246
247
 
247
- Requires Docker. Pass `--from-state` (cdkd-deployed) or
248
- `--from-cfn-stack` (cdk-deployed / CFn-managed) to substitute deployed
249
- physical IDs into intrinsic-valued env vars / secrets / image URIs;
250
- without either, intrinsic values are dropped with a per-key warning
251
- (matches `sam local *`). The two flags are mutually exclusive.
248
+ The Docker-backed commands above require Docker. Pass `--from-state`
249
+ (cdkd-deployed) or `--from-cfn-stack` (cdk-deployed / CFn-managed) to
250
+ substitute deployed physical IDs into intrinsic-valued env vars /
251
+ secrets / image URIs; without either, intrinsic values are dropped with
252
+ a per-key warning (matches `sam local *`). The two flags are mutually
253
+ exclusive. `start-cloudfront` is the exception: it serves entirely
254
+ in-process (no Docker) and makes no AWS call, so it takes neither flag.
252
255
 
253
256
  ### `local invoke`
254
257
 
@@ -328,6 +331,28 @@ interpreted-handler source edits go through the bind-mount fast path
328
331
  (no rebuild); Dockerfile / dependency / compiled-source edits fall
329
332
  through to a rebuild + atomic front-door pool swap.
330
333
 
334
+ ### `local start-cloudfront`
335
+
336
+ ```bash
337
+ cdkd local start-cloudfront # interactive picker
338
+ cdkd local start-cloudfront MyStack/MyDistribution # name the distribution
339
+ cdkd local start-cloudfront MyStack/MyDistribution --watch # re-synth + swap on edit
340
+ cdkd local start-cloudfront MyStack/MyDistribution --tls # real HTTPS termination
341
+ ```
342
+
343
+ Serves a CloudFront distribution's **viewer-request -> S3 origin ->
344
+ viewer-response** pipeline locally so a routing-function change is
345
+ verifiable in seconds instead of a deploy round-trip. The distribution's
346
+ `AWS::CloudFront::Function`s (URL rewrites, trailing-slash normalization,
347
+ SPA fallback, header tweaks) run in-process in a `node:vm` sandbox; the
348
+ S3 origin content is the `BucketDeployment` source asset resolved out of
349
+ the cloud assembly, served with `DefaultRootObject` and
350
+ `CustomErrorResponses`. Path patterns route across the default + ordered
351
+ cache behaviors. Pure-local: no Docker, no AWS call — `--watch` is just
352
+ re-synth + an in-memory routing-model swap. S3 origins only (custom /
353
+ Lambda@Edge origins are warn-and-skip); `--origin <id>=<dir>` points an
354
+ origin at a local directory when `BucketDeployment` resolution can't.
355
+
331
356
  See **[docs/local-emulation.md](docs/local-emulation.md)** for the
332
357
  full reference — runtimes, target resolution, every flag, integration
333
358
  and authorizer detail, route precedence, container pool, networking,
package/dist/cli.js CHANGED
@@ -61,7 +61,7 @@ import { CreateVectorBucketCommand, DeleteIndexCommand, DeleteVectorBucketComman
61
61
  import { CreateNamespaceCommand, CreateTableBucketCommand, CreateTableCommand as CreateTableCommand$2, DeleteNamespaceCommand as DeleteNamespaceCommand$1, DeleteTableBucketCommand, DeleteTableCommand as DeleteTableCommand$2, GetTableBucketCommand, GetTableCommand as GetTableCommand$1, ListNamespacesCommand as ListNamespacesCommand$1, ListTableBucketsCommand, ListTablesCommand as ListTablesCommand$1, ListTagsForResourceCommand as ListTagsForResourceCommand$19, NotFoundException as NotFoundException$5, S3TablesClient, TagResourceCommand as TagResourceCommand$16, UntagResourceCommand as UntagResourceCommand$15 } from "@aws-sdk/client-s3tables";
62
62
  import { AttachLoadBalancerTargetGroupsCommand, AttachLoadBalancersCommand, AttachTrafficSourcesCommand, AutoScalingClient, CreateAutoScalingGroupCommand, CreateOrUpdateTagsCommand, DeleteAutoScalingGroupCommand, DeleteLifecycleHookCommand, DeleteNotificationConfigurationCommand, DeleteTagsCommand as DeleteTagsCommand$1, DescribeAutoScalingGroupsCommand, DescribeLifecycleHooksCommand, DescribeNotificationConfigurationsCommand, DescribeTrafficSourcesCommand, DetachLoadBalancerTargetGroupsCommand, DetachLoadBalancersCommand, DetachTrafficSourcesCommand, DisableMetricsCollectionCommand, EnableMetricsCollectionCommand, PutLifecycleHookCommand, PutNotificationConfigurationCommand, UpdateAutoScalingGroupCommand } from "@aws-sdk/client-auto-scaling";
63
63
  import { Document, Pair, Scalar, YAMLMap, YAMLSeq, parse as parse$1, stringify } from "yaml";
64
- import { createLocalStateProvider, getEmbedConfig, isCfnFlagPresent, listTargets, rejectExplicitCfnStackWithMultipleStacks, resolveCfnFallbackRegion, setEmbedConfig, substituteAgainstState, substituteAgainstStateAsync, substituteEnvVarsFromState, substituteEnvVarsFromStateAsync } from "cdk-local";
64
+ import { createLocalStartCloudFrontCommand, createLocalStateProvider, getEmbedConfig, isCfnFlagPresent, listTargets, rejectExplicitCfnStackWithMultipleStacks, resolveCfnFallbackRegion, setEmbedConfig, substituteAgainstState, substituteAgainstStateAsync, substituteEnvVarsFromState, substituteEnvVarsFromStateAsync } from "cdk-local";
65
65
  import { A2A_CONTAINER_PORT, A2A_PATH, AGENTCORE_A2A_PROTOCOL, AGENTCORE_AGUI_PROTOCOL, AGENTCORE_MCP_PROTOCOL, ConnectionRegistry, EcsTaskResolutionError, HOST_GATEWAY_MIN_VERSION, LocalInvokeBuildError, MCP_CONTAINER_PORT, MCP_PATH, a2aInvokeOnce, addAlbSpecificOptions, addCommonEcsServiceOptions, addStartServiceSpecificOptions, albStrategy, architectureToPlatform, attachAuthorizers, attachStageContext, availableApiIdentifiers, bufferToBody, buildAgentCoreCodeImage, buildCognitoJwksUrl, buildConnectEvent, buildContainerImage, buildCorsConfigByApiId, buildCorsConfigFromCloudFrontChain, buildDisconnectEvent, buildJwksUrlFromIssuer, buildMessageEvent, buildMgmtEndpointEnvUrl, buildStageMap, classifySourceChange, createAuthorizerCache, createFileWatcher, createFileWatcher as createFileWatcher$1, createJwksCache, createWatchPredicates, defaultCredentialsLoader, derivePseudoParametersFromRegion, discoverRoutes, discoverWebSocketApis, downloadAndExtractS3Bundle, filterRoutesByApiIdentifier, groupRoutesByServer, handleConnectionsRequest, invokeAgentCore, invokeAgentCoreWs, materializeLayerFromArn, mcpInvokeOnce, parseConnectionsPath, parseSelectionExpressionPath, pickAgentCoreCandidateStack, pickAgentCoreCandidateStack as pickAgentCoreCandidateStack$1, probeHostGatewaySupport, readMtlsMaterialsFromDisk, resolveAgentCoreTarget, resolveEnvVars, resolveRuntimeCodeMountPath, resolveRuntimeFileExtension, resolveRuntimeImage, resolveSingleTarget, resolveWatchConfig, runEcsServiceEmulator, signAgentCoreInvocation, startApiServer, substituteImagePlaceholders, tryResolveImageFnJoin, verifyJwtViaDiscovery, waitForAgentCorePing } from "cdk-local/internal";
66
66
  import { createServer } from "node:net";
67
67
  import { promisify } from "node:util";
@@ -50804,6 +50804,37 @@ function createLocalStartAlbCommand() {
50804
50804
  return addCommonEcsServiceOptions(cmd);
50805
50805
  }
50806
50806
 
50807
+ //#endregion
50808
+ //#region src/cli/commands/local-start-cloudfront.ts
50809
+ /**
50810
+ * `cdkd local start-cloudfront <distribution>` — serve a CloudFront distribution
50811
+ * locally: its S3 origin content (resolved from the BucketDeployment source in
50812
+ * the cloud assembly) plus its viewer-request / viewer-response CloudFront
50813
+ * Functions, reproducing the distribution routing so a rewrite / routing change
50814
+ * is verifiable in seconds. Inherited from cdk-local (go-to-k/cdk-local#363).
50815
+ *
50816
+ * Unlike the `start-api` / `start-alb` / `start-service` wrappers, this command
50817
+ * is a THIN pass-through to cdk-local's factory and adds NO cdkd-specific
50818
+ * options. `start-cloudfront` is pure-local: it runs no container and makes no
50819
+ * AWS call (it serves the distribution's local BucketDeployment source + runs
50820
+ * CloudFront Functions in-process), so it declares NEITHER `--from-cfn-stack`
50821
+ * NOR `--assume-role`, and there is no deployed state to bind — hence no
50822
+ * `--from-state` / `--state-bucket` / `--state-prefix` options and no
50823
+ * `cdkdExtraStateProviders` threading. The flags it exposes are `--port` /
50824
+ * `--host` / `--origin <originId>=<dir>` / `--tls` / `--tls-cert` /
50825
+ * `--tls-key` / `--watch` plus the shared common / app / context / region /
50826
+ * profile options, all owned by cdk-local.
50827
+ *
50828
+ * The active cdkd embed config is re-handed to the factory so branding stays
50829
+ * cdkd: cdk-local's factory calls `setEmbedConfig(opts.embedConfig)`, and
50830
+ * passing the current config (set once by `createLocalCommand` before the
50831
+ * subcommands are built) keeps it as a no-op re-set rather than a reset back to
50832
+ * cdk-local's `cdkl` defaults.
50833
+ */
50834
+ function createLocalStartCloudFrontCommand$1() {
50835
+ return createLocalStartCloudFrontCommand({ embedConfig: getEmbedConfig() });
50836
+ }
50837
+
50807
50838
  //#endregion
50808
50839
  //#region src/cli/commands/local-invoke.ts
50809
50840
  /**
@@ -51608,6 +51639,7 @@ function createLocalCommand() {
51608
51639
  local.addCommand(createLocalStartServiceCommand());
51609
51640
  local.addCommand(createLocalInvokeAgentCoreCommand());
51610
51641
  local.addCommand(createLocalStartAlbCommand());
51642
+ local.addCommand(createLocalStartCloudFrontCommand$1());
51611
51643
  return local;
51612
51644
  }
51613
51645
 
@@ -52746,7 +52778,7 @@ function reorderArgs(argv) {
52746
52778
  async function main() {
52747
52779
  installPipeCloseHandler();
52748
52780
  const program = new Command();
52749
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.207.6");
52781
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.208.0");
52750
52782
  program.addCommand(createBootstrapCommand());
52751
52783
  program.addCommand(createSynthCommand());
52752
52784
  program.addCommand(createListCommand());