@go-to-k/cdkd 0.202.0 → 0.204.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 +12 -2
- package/dist/cli.js +19 -12
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -296,18 +296,25 @@ with the AWS-published ECS metadata sidecar.
|
|
|
296
296
|
```bash
|
|
297
297
|
cdkd local start-service MyStack/Orders MyStack/Web # multiple services in one invocation
|
|
298
298
|
cdkd local start-service MyStack/Orders --from-state # OR --from-cfn-stack
|
|
299
|
+
cdkd local start-service MyStack/Web --watch # hot reload (sub-second on interpreted handlers)
|
|
299
300
|
```
|
|
300
301
|
|
|
301
302
|
Long-running ECS Service emulator: `DesiredCount` replicas with
|
|
302
303
|
restart-on-exit, cross-service Service Connect / Cloud Map DNS
|
|
303
304
|
discovery (peer containers reach each other by `<discoveryName>.<namespace>`).
|
|
304
|
-
No local load-balancer in v1.
|
|
305
|
+
No local load-balancer in v1. `--watch` re-synths on every CDK source edit
|
|
306
|
+
and reloads one replica at a time — source-only edits on
|
|
307
|
+
interpreted-language handlers (Node / Python / Ruby / shell) take a
|
|
308
|
+
bind-mount fast path (`docker cp` + `docker restart`; no rebuild);
|
|
309
|
+
Dockerfile / dependency manifest / compiled-language source edits fall
|
|
310
|
+
through to a full rebuild + shadow boot + atomic swap.
|
|
305
311
|
|
|
306
312
|
### `local start-alb`
|
|
307
313
|
|
|
308
314
|
```bash
|
|
309
315
|
cdkd local start-alb MyStack/MyAlb --lb-port 80=8080 # remap privileged listener port
|
|
310
316
|
cdkd local start-alb MyStack/MyAlb --from-state # OR --from-cfn-stack
|
|
317
|
+
cdkd local start-alb MyStack/MyAlb --watch # hot reload (sub-second on interpreted handlers)
|
|
311
318
|
```
|
|
312
319
|
|
|
313
320
|
Long-running local ALB front-door: names an `AWS::ElasticLoadBalancingV2::LoadBalancer`,
|
|
@@ -316,7 +323,10 @@ HTTP / HTTPS front-door on each listener port that round-robins across
|
|
|
316
323
|
the running replicas and routes its listener rules across the backing
|
|
317
324
|
services. Forward / redirect / fixed-response actions; ECS or Lambda
|
|
318
325
|
targets; authenticate-cognito / authenticate-oidc via a local Bearer-JWT
|
|
319
|
-
check.
|
|
326
|
+
check. `--watch` reloads one backing-replica at a time across edits —
|
|
327
|
+
interpreted-handler source edits go through the bind-mount fast path
|
|
328
|
+
(no rebuild); Dockerfile / dependency / compiled-source edits fall
|
|
329
|
+
through to a rebuild + atomic front-door pool swap.
|
|
320
330
|
|
|
321
331
|
See **[docs/local-emulation.md](docs/local-emulation.md)** for the
|
|
322
332
|
full reference — runtimes, target resolution, every flag, integration
|
package/dist/cli.js
CHANGED
|
@@ -62,7 +62,7 @@ import { CreateNamespaceCommand, CreateTableBucketCommand, CreateTableCommand as
|
|
|
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
64
|
import { createLocalStateProvider, getEmbedConfig, isCfnFlagPresent, listTargets, rejectExplicitCfnStackWithMultipleStacks, resolveCfnFallbackRegion, setEmbedConfig, substituteAgainstState, substituteAgainstStateAsync, substituteEnvVarsFromState, substituteEnvVarsFromStateAsync } from "cdk-local";
|
|
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, albStrategy, architectureToPlatform, attachAuthorizers, attachStageContext, availableApiIdentifiers, bufferToBody, buildAgentCoreCodeImage, buildCognitoJwksUrl, buildConnectEvent, buildContainerImage, buildCorsConfigByApiId, buildCorsConfigFromCloudFrontChain, buildDisconnectEvent, buildJwksUrlFromIssuer, buildMessageEvent, buildMgmtEndpointEnvUrl, buildStageMap, createAuthorizerCache, createFileWatcher, createJwksCache, createWatchPredicates, defaultCredentialsLoader, derivePseudoParametersFromRegion, discoverRoutes, discoverWebSocketApis, downloadAndExtractS3Bundle, filterRoutesByApiIdentifier, groupRoutesByServer, handleConnectionsRequest, invokeAgentCore, invokeAgentCoreWs, materializeLayerFromArn, mcpInvokeOnce, parseConnectionsPath, parseSelectionExpressionPath, pickAgentCoreCandidateStack, probeHostGatewaySupport, readMtlsMaterialsFromDisk, resolveAgentCoreTarget, resolveEnvVars, resolveRuntimeCodeMountPath, resolveRuntimeFileExtension, resolveRuntimeImage, resolveSingleTarget, resolveWatchConfig, runEcsServiceEmulator, signAgentCoreInvocation, startApiServer, substituteImagePlaceholders, tryResolveImageFnJoin, verifyJwtViaDiscovery, waitForAgentCorePing } from "cdk-local/internal";
|
|
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, createAuthorizerCache, createFileWatcher, createJwksCache, createWatchPredicates, defaultCredentialsLoader, derivePseudoParametersFromRegion, discoverRoutes, discoverWebSocketApis, downloadAndExtractS3Bundle, filterRoutesByApiIdentifier, groupRoutesByServer, handleConnectionsRequest, invokeAgentCore, invokeAgentCoreWs, materializeLayerFromArn, mcpInvokeOnce, parseConnectionsPath, parseSelectionExpressionPath, pickAgentCoreCandidateStack, 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";
|
|
68
68
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
@@ -46647,7 +46647,7 @@ async function localStartApiCommand(target, options) {
|
|
|
46647
46647
|
let profileCredsFile;
|
|
46648
46648
|
const authorizerCache = createAuthorizerCache();
|
|
46649
46649
|
const jwksCache = createJwksCache();
|
|
46650
|
-
const
|
|
46650
|
+
const jwksWarnedAt = /* @__PURE__ */ new Map();
|
|
46651
46651
|
let sigV4CredentialsLoader;
|
|
46652
46652
|
const sigV4WarnedForeignIds = /* @__PURE__ */ new Set();
|
|
46653
46653
|
const fromCfnTipEmitted = { value: false };
|
|
@@ -46811,7 +46811,7 @@ async function localStartApiCommand(target, options) {
|
|
|
46811
46811
|
port: basePort === 0 ? 0 : nextPort,
|
|
46812
46812
|
authorizerCache,
|
|
46813
46813
|
jwksCache,
|
|
46814
|
-
|
|
46814
|
+
jwksWarnedAt,
|
|
46815
46815
|
sigV4CredentialsLoader,
|
|
46816
46816
|
sigV4WarnedForeignIds,
|
|
46817
46817
|
sigV4Strict: options.strictSigv4 === true,
|
|
@@ -46858,7 +46858,7 @@ async function localStartApiCommand(target, options) {
|
|
|
46858
46858
|
port: basePort === 0 ? 0 : nextPort,
|
|
46859
46859
|
authorizerCache,
|
|
46860
46860
|
jwksCache,
|
|
46861
|
-
|
|
46861
|
+
jwksWarnedAt,
|
|
46862
46862
|
sigV4WarnedForeignIds,
|
|
46863
46863
|
sigV4Strict: options.strictSigv4 === true,
|
|
46864
46864
|
preDispatch: async (req, res) => {
|
|
@@ -49153,9 +49153,13 @@ function createLocalRunTaskCommand() {
|
|
|
49153
49153
|
* `cdkl start-service` strategy — name one or more ECS services and the engine
|
|
49154
49154
|
* boots their replicas. There is no front-door listener (services are reached
|
|
49155
49155
|
* directly via their published container ports). Mirrors `albStrategy` in
|
|
49156
|
-
* shape, with `frontDoor` omitted and `lbPortOverrides` empty.
|
|
49156
|
+
* shape, with `frontDoor` omitted and `lbPortOverrides` empty. No-arg to match
|
|
49157
|
+
* cdk-local's bundled `serviceStrategy()` signature exactly — start-service
|
|
49158
|
+
* has no per-invocation options that branch the strategy shape (unlike
|
|
49159
|
+
* `albStrategy(options)`, which threads `--lb-port` parses into
|
|
49160
|
+
* `lbPortOverrides`).
|
|
49157
49161
|
*/
|
|
49158
|
-
function serviceStrategy(
|
|
49162
|
+
function serviceStrategy() {
|
|
49159
49163
|
return {
|
|
49160
49164
|
pickEntries: (stacks) => listTargets(stacks).ecsServices,
|
|
49161
49165
|
pickerMessage: "Select one or more ECS services to run",
|
|
@@ -49165,7 +49169,8 @@ function serviceStrategy(_options) {
|
|
|
49165
49169
|
boots: chosenTargets.map((target) => ({ target })),
|
|
49166
49170
|
warnings: []
|
|
49167
49171
|
}),
|
|
49168
|
-
lbPortOverrides: {}
|
|
49172
|
+
lbPortOverrides: {},
|
|
49173
|
+
supportsWatch: true
|
|
49169
49174
|
};
|
|
49170
49175
|
}
|
|
49171
49176
|
/**
|
|
@@ -49180,9 +49185,11 @@ function serviceStrategy(_options) {
|
|
|
49180
49185
|
* --add-host overlay (Issue #460).
|
|
49181
49186
|
*/
|
|
49182
49187
|
function createLocalStartServiceCommand() {
|
|
49183
|
-
|
|
49184
|
-
await runEcsServiceEmulator(targets, options, serviceStrategy(
|
|
49185
|
-
}))
|
|
49188
|
+
const cmd = new Command("start-service").description("Run one or more AWS::ECS::Service resources locally as a long-running emulator. Spins up DesiredCount task replicas per service (clamped by --max-tasks) using the same per-task docker network + metadata sidecar pattern as `cdkd local run-task`, then keeps each replica running and restarts it on exit per --restart-policy. ^C tears every replica + sidecar + network down. Each <target> accepts a CDK display path (MyStack/MyService) or stack-qualified logical ID (MyStack:MyServiceXYZ); single-stack apps may omit the stack prefix. When two or more <target>s are supplied, every service is booted into a shared Cloud Map / Service Connect registry so peer services discover each other via docker --add-host overlay (Issue #460). Omit <targets> in an interactive terminal to multi-select the ECS services from a list.").argument("[targets...]", "One or more CDK display paths or stack-qualified logical IDs of the AWS::ECS::Service resources to run (omit to multi-select interactively in a TTY)").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 container images, environment variables, secrets, role ARNs, and volumes. Mutually exclusive with --from-cfn-stack.").default(false)).addOption(new Option("--state-bucket <bucket>", "S3 bucket for --from-state. Falls back to CDKD_STATE_BUCKET env or cdk.json context.cdkd.stateBucket.")).addOption(new Option("--state-prefix <prefix>", "S3 key prefix for --from-state state files.").default("cdkd")).action(withErrorHandling(async (targets, options) => {
|
|
49189
|
+
await runEcsServiceEmulator(targets, options, serviceStrategy(), cdkdExtraStateProviders);
|
|
49190
|
+
}));
|
|
49191
|
+
addStartServiceSpecificOptions(cmd);
|
|
49192
|
+
return addCommonEcsServiceOptions(cmd);
|
|
49186
49193
|
}
|
|
49187
49194
|
|
|
49188
49195
|
//#endregion
|
|
@@ -49389,7 +49396,7 @@ async function resolveInboundAuthorization(resolved, options) {
|
|
|
49389
49396
|
...authorizer.allowedClients && { allowedClients: authorizer.allowedClients },
|
|
49390
49397
|
...authorizer.allowedScopes && { allowedScopes: authorizer.allowedScopes },
|
|
49391
49398
|
...authorizer.customClaims && { customClaims: authorizer.customClaims }
|
|
49392
|
-
}, header, createJwksCache(), {
|
|
49399
|
+
}, header, createJwksCache(), { warnedAt: /* @__PURE__ */ new Map() })).allow) throw new CdkdError(`Inbound JWT rejected by the runtime's customJwtAuthorizer (signature / issuer / expiry / audience check failed against ${authorizer.discoveryUrl}).`, "LOCAL_INVOKE_AGENTCORE_AUTH_DENIED");
|
|
49393
49400
|
logger.info(`Inbound JWT verified against ${authorizer.discoveryUrl}.`);
|
|
49394
49401
|
return header;
|
|
49395
49402
|
}
|
|
@@ -51924,7 +51931,7 @@ function reorderArgs(argv) {
|
|
|
51924
51931
|
*/
|
|
51925
51932
|
async function main() {
|
|
51926
51933
|
const program = new Command();
|
|
51927
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
51934
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.204.0");
|
|
51928
51935
|
program.addCommand(createBootstrapCommand());
|
|
51929
51936
|
program.addCommand(createSynthCommand());
|
|
51930
51937
|
program.addCommand(createListCommand());
|