@go-to-k/cdkd 0.208.0 → 0.209.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` / `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).
62
+ - **Local execution** (`cdkd local invoke` / `start-api` / `run-task` / `start-service` / `start-alb` / `start-cloudfront` / `invoke-agentcore` / `start-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 (one-shot `invoke-agentcore` and long-running `/ws` serve via `start-agentcore`). 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 / Lambda Function URL origin -> viewer-response pipeline (CloudFront-Functions + S3-only distributions run in-process with no Docker). 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.
@@ -242,16 +242,19 @@ maintain, no `cdk synth | sam ...` round-trip.
242
242
  | `cdkd local run-task <target>` | ECS RunTask — every container in a task definition started on a per-task docker network |
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
+ | `cdkd local start-agentcore [target]` | Long-running serve of a Bedrock AgentCore Runtime's bidirectional `/ws` WebSocket (HTTP / AGUI), fronted by a host bridge that injects the session-id / Authorization a header-less browser client cannot set |
245
246
  | `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) |
247
+ | `cdkd local start-cloudfront [target]` | Long-running local CloudFront distribution — viewer-request -> S3 / Lambda Function URL origin -> viewer-response pipeline, CloudFront Functions run in-process (Function URL origins use Docker/RIE) |
247
248
 
248
249
  The Docker-backed commands above require Docker. Pass `--from-state`
249
250
  (cdkd-deployed) or `--from-cfn-stack` (cdk-deployed / CFn-managed) to
250
251
  substitute deployed physical IDs into intrinsic-valued env vars /
251
252
  secrets / image URIs; without either, intrinsic values are dropped with
252
253
  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.
254
+ exclusive. `start-cloudfront` is the partial exception: a
255
+ CloudFront-Functions + S3-origin distribution serves entirely in-process
256
+ (no Docker), and it carries cdk-local's `--from-cfn-stack` but not cdkd's
257
+ `--from-state` (its factory lacks the state-provider seam — issue #766).
255
258
 
256
259
  ### `local invoke`
257
260
 
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 { createLocalStartCloudFrontCommand, createLocalStateProvider, getEmbedConfig, isCfnFlagPresent, listTargets, rejectExplicitCfnStackWithMultipleStacks, resolveCfnFallbackRegion, setEmbedConfig, substituteAgainstState, substituteAgainstStateAsync, substituteEnvVarsFromState, substituteEnvVarsFromStateAsync } from "cdk-local";
64
+ import { createLocalStartAgentCoreCommand, 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";
@@ -50787,6 +50787,54 @@ function createLocalInvokeAgentCoreCommand() {
50787
50787
  return cmd;
50788
50788
  }
50789
50789
 
50790
+ //#endregion
50791
+ //#region src/cli/commands/local-start-agentcore.ts
50792
+ /**
50793
+ * `cdkd local start-agentcore <target>` — long-running serve for a Bedrock
50794
+ * AgentCore Runtime's bidirectional `/ws` WebSocket endpoint. Boots the
50795
+ * `AWS::BedrockAgentCore::Runtime` container (same image / env / credential
50796
+ * resolution as `invoke-agentcore`) and fronts its `/ws` endpoint with a host
50797
+ * WebSocket bridge that injects the AgentCore session-id (and `Authorization`
50798
+ * under a `customJwtAuthorizer`) on the container upgrade, so a header-less
50799
+ * client (e.g. a browser) can hold an interactive multi-frame session. HTTP /
50800
+ * AGUI protocols only. The serve counterpart of the single-shot
50801
+ * `cdkd local invoke-agentcore`. Inherited from cdk-local
50802
+ * (go-to-k/cdk-local#420).
50803
+ *
50804
+ * Like `start-cloudfront`, this is a THIN pass-through to cdk-local's factory —
50805
+ * the serve behavior and the `start-agentcore`-only option block (`--port` /
50806
+ * `--host` / `--session-id` / `--bearer-token` / `--no-verify-auth` /
50807
+ * `--env-vars` / `--platform` / `--no-pull` / `--no-build` / `--container-host`
50808
+ * / `--timeout` / `--assume-role` / `--ecr-role-arn` / `--from-cfn-stack` /
50809
+ * `--stack-region`) live in cdk-local's `addStartAgentCoreSpecificOptions` and
50810
+ * are auto-inherited.
50811
+ *
50812
+ * UNLIKE `start-cloudfront`, this command DOES bind deployed state: cdk-local's
50813
+ * factory accepts an `extraStateProviders` option (the same seam the
50814
+ * heavy-wrapper `cdkd local *` commands use), so cdkd threads its S3-backed
50815
+ * `--from-state` factory in via `cdkdExtraStateProviders` and layers the
50816
+ * cdkd-specific `--from-state` / `--state-bucket` / `--state-prefix` flags on
50817
+ * top of cdk-local's inherited `--from-cfn-stack` / `--stack-region` (issue
50818
+ * #766). The factory's internal `createLocalStateProvider` call picks cdkd's
50819
+ * `fromState` factory transparently when `--from-state` is passed.
50820
+ *
50821
+ * The active cdkd embed config is re-handed to the factory so branding stays
50822
+ * cdkd: cdk-local's factory calls `setEmbedConfig(opts.embedConfig)`, and
50823
+ * passing the current config (set once by `createLocalCommand` before the
50824
+ * subcommands are built) keeps it as a no-op re-set rather than a reset back to
50825
+ * cdk-local's `cdkl` defaults.
50826
+ */
50827
+ function createLocalStartAgentCoreCommand$1() {
50828
+ const cmd = createLocalStartAgentCoreCommand({
50829
+ embedConfig: getEmbedConfig(),
50830
+ extraStateProviders: cdkdExtraStateProviders
50831
+ });
50832
+ cmd.addOption(new Option("--from-state", "Read cdkd's S3 state for the target stack and substitute Ref / Fn::GetAtt / Fn::Sub / Fn::ImportValue / Fn::GetStackOutput intrinsics in the AgentCore runtime container image and environment variables. Mutually exclusive with --from-cfn-stack.").default(false));
50833
+ cmd.addOption(new Option("--state-bucket <bucket>", "S3 bucket for --from-state. Falls back to CDKD_STATE_BUCKET env or cdk.json context.cdkd.stateBucket."));
50834
+ cmd.addOption(new Option("--state-prefix <prefix>", "S3 key prefix for --from-state state files.").default("cdkd"));
50835
+ return cmd;
50836
+ }
50837
+
50790
50838
  //#endregion
50791
50839
  //#region src/cli/commands/local-start-alb.ts
50792
50840
  /**
@@ -50809,21 +50857,30 @@ function createLocalStartAlbCommand() {
50809
50857
  /**
50810
50858
  * `cdkd local start-cloudfront <distribution>` — serve a CloudFront distribution
50811
50859
  * locally: its S3 origin content (resolved from the BucketDeployment source in
50812
- * the cloud assembly) plus its viewer-request / viewer-response CloudFront
50860
+ * the cloud assembly) AND its Lambda Function URL origins (the backing Lambda is
50861
+ * run locally via RIE), plus its viewer-request / viewer-response CloudFront
50813
50862
  * 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.
50863
+ * is verifiable in seconds. Inherited from cdk-local (go-to-k/cdk-local#363,
50864
+ * Lambda Function URL + deployed-S3 origins added in #380).
50865
+ *
50866
+ * Like the `start-agentcore` wrapper, this command is a THIN pass-through to
50867
+ * cdk-local's factory. The serve behavior and the option block (`--port` /
50868
+ * `--host` / `--origin <originId>=<dir>` / `--kvs-file` / `--cache-origin` /
50869
+ * `--no-pull` / `--tls` / `--tls-cert` / `--tls-key` / `--watch`, plus
50870
+ * cdk-local's own `--from-cfn-stack` / `--stack-region` / `--assume-role` for
50871
+ * binding a Function URL origin's backing Lambda + a deployed-S3 origin's bucket
50872
+ * name to deployed state) live in cdk-local and are auto-inherited.
50873
+ *
50874
+ * UNLIKE `start-agentcore` / `start-alb` / `start-service`, this command does
50875
+ * NOT thread cdkd's S3-backed `--from-state` source: cdk-local's
50876
+ * `CreateLocalStartCloudFrontCommandOptions` accepts only `embedConfig`, not the
50877
+ * `extraStateProviders` seam (the factory's internal `createLocalStateProvider`
50878
+ * calls pass no fourth argument). So `--from-state` / `--state-bucket` /
50879
+ * `--state-prefix` and `cdkdExtraStateProviders` threading are intentionally
50880
+ * absent here — start-cloudfront stays exempt from issue #766 until cdk-local
50881
+ * adds `extraStateProviders` to its start-cloudfront factory. Until then the
50882
+ * `--from-cfn-stack` flag (CloudFormation-backed deployed state) is the only
50883
+ * state source on this command.
50827
50884
  *
50828
50885
  * The active cdkd embed config is re-handed to the factory so branding stays
50829
50886
  * cdkd: cdk-local's factory calls `setEmbedConfig(opts.embedConfig)`, and
@@ -51638,6 +51695,7 @@ function createLocalCommand() {
51638
51695
  local.addCommand(createLocalRunTaskCommand());
51639
51696
  local.addCommand(createLocalStartServiceCommand());
51640
51697
  local.addCommand(createLocalInvokeAgentCoreCommand());
51698
+ local.addCommand(createLocalStartAgentCoreCommand$1());
51641
51699
  local.addCommand(createLocalStartAlbCommand());
51642
51700
  local.addCommand(createLocalStartCloudFrontCommand$1());
51643
51701
  return local;
@@ -52778,7 +52836,7 @@ function reorderArgs(argv) {
52778
52836
  async function main() {
52779
52837
  installPipeCloseHandler();
52780
52838
  const program = new Command();
52781
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.208.0");
52839
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.209.0");
52782
52840
  program.addCommand(createBootstrapCommand());
52783
52841
  program.addCommand(createSynthCommand());
52784
52842
  program.addCommand(createListCommand());