@jaypie/mcp 0.8.54 → 0.8.55

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.
@@ -1 +1 @@
1
- {"version":3,"file":"createMcpServer.js","sources":["../src/createMcpServer.ts"],"sourcesContent":["import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\n\nimport { createMcpServerFromSuite } from \"@jaypie/fabric/mcp\";\n\nimport { suite } from \"./suite.js\";\n\nexport interface CreateMcpServerOptions {\n version?: string;\n verbose?: boolean;\n}\n\n/**\n * Creates and configures an MCP server instance with Jaypie tools\n *\n * Uses ServiceSuite to register all services as MCP tools automatically.\n * Services are defined in suite.ts using fabricService and registered\n * by category. The createMcpServerFromSuite bridge converts them to\n * MCP tools with proper Zod schema validation.\n *\n * @param options - Configuration options (or legacy version string)\n * @returns Configured MCP server instance\n */\nexport function createMcpServer(\n options: CreateMcpServerOptions | string = {},\n): McpServer {\n // Support legacy signature: createMcpServer(version: string)\n const config: CreateMcpServerOptions =\n typeof options === \"string\" ? { version: options } : options;\n\n const { version = \"0.0.0\", verbose = false } = config;\n\n if (verbose) {\n console.error(\"[jaypie-mcp] Creating MCP server instance from suite\");\n }\n\n const server = createMcpServerFromSuite(suite, {\n name: suite.name,\n version,\n });\n\n if (verbose) {\n console.error(\n `[jaypie-mcp] Registered ${suite.services.length} tools from suite`,\n );\n console.error(`[jaypie-mcp] Categories: ${suite.categories.join(\", \")}`);\n }\n\n return server;\n}\n"],"names":[],"mappings":";;;AAWA;;;;;;;;;;AAUG;AACG,SAAU,eAAe,CAC7B,OAAA,GAA2C,EAAE,EAAA;;AAG7C,IAAA,MAAM,MAAM,GACV,OAAO,OAAO,KAAK,QAAQ,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO;IAE9D,MAAM,EAAE,OAAO,GAAG,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,MAAM;IAErD,IAAI,OAAO,EAAE;AACX,QAAA,OAAO,CAAC,KAAK,CAAC,sDAAsD,CAAC;IACvE;AAEA,IAAA,MAAM,MAAM,GAAG,wBAAwB,CAAC,KAAK,EAAE;QAC7C,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO;AACR,KAAA,CAAC;IAEF,IAAI,OAAO,EAAE;QACX,OAAO,CAAC,KAAK,CACX,CAAA,wBAAA,EAA2B,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAA,iBAAA,CAAmB,CACpE;AACD,QAAA,OAAO,CAAC,KAAK,CAAC,CAAA,yBAAA,EAA4B,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAAC;IAC1E;AAEA,IAAA,OAAO,MAAM;AACf;;;;"}
1
+ {"version":3,"file":"createMcpServer.js","sources":["../src/createMcpServer.ts"],"sourcesContent":["/* eslint-disable no-console -- MCP stdio: stderr is the only valid log channel; stdout is reserved for JSON-RPC */\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\n\nimport { createMcpServerFromSuite } from \"@jaypie/fabric/mcp\";\n\nimport { suite } from \"./suite.js\";\n\nexport interface CreateMcpServerOptions {\n version?: string;\n verbose?: boolean;\n}\n\n/**\n * Creates and configures an MCP server instance with Jaypie tools\n *\n * Uses ServiceSuite to register all services as MCP tools automatically.\n * Services are defined in suite.ts using fabricService and registered\n * by category. The createMcpServerFromSuite bridge converts them to\n * MCP tools with proper Zod schema validation.\n *\n * @param options - Configuration options (or legacy version string)\n * @returns Configured MCP server instance\n */\nexport function createMcpServer(\n options: CreateMcpServerOptions | string = {},\n): McpServer {\n // Support legacy signature: createMcpServer(version: string)\n const config: CreateMcpServerOptions =\n typeof options === \"string\" ? { version: options } : options;\n\n const { version = \"0.0.0\", verbose = false } = config;\n\n if (verbose) {\n console.error(\"[jaypie-mcp] Creating MCP server instance from suite\");\n }\n\n const server = createMcpServerFromSuite(suite, {\n name: suite.name,\n version,\n });\n\n if (verbose) {\n console.error(\n `[jaypie-mcp] Registered ${suite.services.length} tools from suite`,\n );\n console.error(`[jaypie-mcp] Categories: ${suite.categories.join(\", \")}`);\n }\n\n return server;\n}\n"],"names":[],"mappings":";;;AAYA;;;;;;;;;;AAUG;AACG,SAAU,eAAe,CAC7B,OAAA,GAA2C,EAAE,EAAA;;AAG7C,IAAA,MAAM,MAAM,GACV,OAAO,OAAO,KAAK,QAAQ,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO;IAE9D,MAAM,EAAE,OAAO,GAAG,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,MAAM;IAErD,IAAI,OAAO,EAAE;AACX,QAAA,OAAO,CAAC,KAAK,CAAC,sDAAsD,CAAC;IACvE;AAEA,IAAA,MAAM,MAAM,GAAG,wBAAwB,CAAC,KAAK,EAAE;QAC7C,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO;AACR,KAAA,CAAC;IAEF,IAAI,OAAO,EAAE;QACX,OAAO,CAAC,KAAK,CACX,CAAA,wBAAA,EAA2B,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAA,iBAAA,CAAmB,CACpE;AACD,QAAA,OAAO,CAAC,KAAK,CAAC,CAAA,yBAAA,EAA4B,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAAC;IAC1E;AAEA,IAAA,OAAO,MAAM;AACf;;;;"}
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
6
6
  import { createMcpServer } from './createMcpServer.js';
7
7
  export { mcpExpressHandler } from './mcpExpressHandler.js';
8
8
 
9
+ /* eslint-disable no-console -- MCP stdio: stderr is the only valid log channel; stdout is reserved for JSON-RPC */
9
10
  // Version will be injected during build
10
11
  const version = "0.0.0";
11
12
  /**
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { readFileSync, realpathSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { createMcpServer } from \"./createMcpServer.js\";\n\n// Version will be injected during build\nconst version = \"0.0.0\";\n\n/**\n * Load environment variables from .env file in current working directory\n * Simple implementation that doesn't require external dependencies\n */\nfunction loadEnvFile() {\n try {\n const envPath = join(process.cwd(), \".env\");\n const content = readFileSync(envPath, \"utf-8\");\n\n for (const line of content.split(\"\\n\")) {\n const trimmed = line.trim();\n // Skip comments and empty lines\n if (!trimmed || trimmed.startsWith(\"#\")) continue;\n\n const eqIndex = trimmed.indexOf(\"=\");\n if (eqIndex === -1) continue;\n\n const key = trimmed.slice(0, eqIndex).trim();\n let value = trimmed.slice(eqIndex + 1).trim();\n\n // Remove surrounding quotes if present\n if (\n (value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\"))\n ) {\n value = value.slice(1, -1);\n }\n\n // Only set if not already defined (environment takes precedence)\n if (!process.env[key]) {\n process.env[key] = value;\n }\n }\n } catch {\n // .env file not found or not readable - that's fine\n }\n}\n\n// Load .env file before anything else\nloadEnvFile();\n\n// Parse command-line arguments\nconst args = process.argv.slice(2);\nconst verbose = args.includes(\"--verbose\") || args.includes(\"-v\");\n\n// Logger for verbose mode (uses stderr to not interfere with JSON-RPC on stdout)\nconst log = {\n info: (message: string, ...args: unknown[]) => {\n if (verbose) {\n console.error(`[jaypie-mcp] ${message}`, ...args);\n }\n },\n error: (message: string, ...args: unknown[]) => {\n console.error(`[jaypie-mcp ERROR] ${message}`, ...args);\n },\n};\n\nlet server: McpServer | null = null;\nlet isShuttingDown = false;\n\nasync function gracefulShutdown(exitCode = 0) {\n if (isShuttingDown) {\n return;\n }\n isShuttingDown = true;\n\n log.info(\"Shutting down gracefully...\");\n\n try {\n if (server) {\n await server.close();\n log.info(\"Server closed successfully\");\n }\n } catch (error) {\n log.error(\"Error during shutdown:\", error);\n } finally {\n process.exit(exitCode);\n }\n}\n\nasync function main() {\n log.info(\"Starting Jaypie MCP server...\");\n log.info(`Version: ${version}`);\n log.info(`Node version: ${process.version}`);\n log.info(`Verbose mode: ${verbose ? \"enabled\" : \"disabled\"}`);\n\n server = createMcpServer({ version, verbose });\n\n log.info(\"MCP server created successfully\");\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n log.info(\"Connected to stdio transport\");\n log.info(\"Server is ready to accept requests\");\n\n // Handle process termination signals\n process.on(\"SIGINT\", () => {\n log.info(\"Received SIGINT signal\");\n gracefulShutdown(0);\n });\n process.on(\"SIGTERM\", () => {\n log.info(\"Received SIGTERM signal\");\n gracefulShutdown(0);\n });\n\n // Handle stdio stream errors (but let transport handle normal stdin end/close)\n process.stdin.on(\"error\", (error) => {\n if (error.message?.includes(\"EPIPE\") || error.message?.includes(\"EOF\")) {\n log.info(\"stdin closed\");\n gracefulShutdown(0);\n }\n });\n\n process.stdout.on(\"error\", (error) => {\n if (error.message?.includes(\"EPIPE\")) {\n log.info(\"stdout pipe broken\");\n gracefulShutdown(0);\n }\n });\n\n // Server is running on stdio\n}\n\n// Only run main() if this module is executed directly (not imported)\n// This handles npx and symlinks in node_modules/.bin correctly\nif (process.argv[1]) {\n const realPath = realpathSync(process.argv[1]);\n const realPathAsUrl = pathToFileURL(realPath).href;\n if (import.meta.url === realPathAsUrl) {\n main().catch((error) => {\n log.error(\"Fatal error:\", error);\n process.exit(1);\n });\n }\n}\n\nexport { createMcpServer } from \"./createMcpServer.js\";\nexport type { CreateMcpServerOptions } from \"./createMcpServer.js\";\nexport {\n mcpExpressHandler,\n type McpExpressHandlerOptions,\n} from \"./mcpExpressHandler.js\";\n"],"names":[],"mappings":";;;;;;;;AAQA;AACA,MAAM,OAAO,GAAG,OAAO;AAEvB;;;AAGG;AACH,SAAS,WAAW,GAAA;AAClB,IA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oB,CAAC;YAC9B,gBAAgB,CAAC,CAAC,CAAC;QACrB;AACF,IAAA,CAAC,CAAC;;AAGJ;AAEA;AACA;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;IACnB,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9C,MAAM,aAAa,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC,IAAI;IAClD,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,EAAE;AACrC,QAAA,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,KAAI;AACrB,YAAA,GAAG,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC;AAChC,YAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACjB,QAAA,CAAC,CAAC;IACJ;AACF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n/* eslint-disable no-console -- MCP stdio: stderr is the only valid log channel; stdout is reserved for JSON-RPC */\nimport { readFileSync, realpathSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { createMcpServer } from \"./createMcpServer.js\";\n\n// Version will be injected during build\nconst version = \"0.0.0\";\n\n/**\n * Load environment variables from .env file in current working directory\n * Simple implementation that doesn't require external dependencies\n */\nfunction loadEnvFile() {\n try {\n const envPath = join(process.cwd(), \".env\");\n const content = readFileSync(envPath, \"utf-8\");\n\n for (const line of content.split(\"\\n\")) {\n const trimmed = line.trim();\n // Skip comments and empty lines\n if (!trimmed || trimmed.startsWith(\"#\")) continue;\n\n const eqIndex = trimmed.indexOf(\"=\");\n if (eqIndex === -1) continue;\n\n const key = trimmed.slice(0, eqIndex).trim();\n let value = trimmed.slice(eqIndex + 1).trim();\n\n // Remove surrounding quotes if present\n if (\n (value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\"))\n ) {\n value = value.slice(1, -1);\n }\n\n // Only set if not already defined (environment takes precedence)\n if (!process.env[key]) {\n process.env[key] = value;\n }\n }\n } catch {\n // .env file not found or not readable - that's fine\n }\n}\n\n// Load .env file before anything else\nloadEnvFile();\n\n// Parse command-line arguments\nconst args = process.argv.slice(2);\nconst verbose = args.includes(\"--verbose\") || args.includes(\"-v\");\n\n// Logger for verbose mode (uses stderr to not interfere with JSON-RPC on stdout)\nconst log = {\n info: (message: string, ...args: unknown[]) => {\n if (verbose) {\n console.error(`[jaypie-mcp] ${message}`, ...args);\n }\n },\n error: (message: string, ...args: unknown[]) => {\n console.error(`[jaypie-mcp ERROR] ${message}`, ...args);\n },\n};\n\nlet server: McpServer | null = null;\nlet isShuttingDown = false;\n\nasync function gracefulShutdown(exitCode = 0) {\n if (isShuttingDown) {\n return;\n }\n isShuttingDown = true;\n\n log.info(\"Shutting down gracefully...\");\n\n try {\n if (server) {\n await server.close();\n log.info(\"Server closed successfully\");\n }\n } catch (error) {\n log.error(\"Error during shutdown:\", error);\n } finally {\n process.exit(exitCode);\n }\n}\n\nasync function main() {\n log.info(\"Starting Jaypie MCP server...\");\n log.info(`Version: ${version}`);\n log.info(`Node version: ${process.version}`);\n log.info(`Verbose mode: ${verbose ? \"enabled\" : \"disabled\"}`);\n\n server = createMcpServer({ version, verbose });\n\n log.info(\"MCP server created successfully\");\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n log.info(\"Connected to stdio transport\");\n log.info(\"Server is ready to accept requests\");\n\n // Handle process termination signals\n process.on(\"SIGINT\", () => {\n log.info(\"Received SIGINT signal\");\n gracefulShutdown(0);\n });\n process.on(\"SIGTERM\", () => {\n log.info(\"Received SIGTERM signal\");\n gracefulShutdown(0);\n });\n\n // Handle stdio stream errors (but let transport handle normal stdin end/close)\n process.stdin.on(\"error\", (error) => {\n if (error.message?.includes(\"EPIPE\") || error.message?.includes(\"EOF\")) {\n log.info(\"stdin closed\");\n gracefulShutdown(0);\n }\n });\n\n process.stdout.on(\"error\", (error) => {\n if (error.message?.includes(\"EPIPE\")) {\n log.info(\"stdout pipe broken\");\n gracefulShutdown(0);\n }\n });\n\n // Server is running on stdio\n}\n\n// Only run main() if this module is executed directly (not imported)\n// This handles npx and symlinks in node_modules/.bin correctly\nif (process.argv[1]) {\n const realPath = realpathSync(process.argv[1]);\n const realPathAsUrl = pathToFileURL(realPath).href;\n if (import.meta.url === realPathAsUrl) {\n main().catch((error) => {\n log.error(\"Fatal error:\", error);\n process.exit(1);\n });\n }\n}\n\nexport { createMcpServer } from \"./createMcpServer.js\";\nexport type { CreateMcpServerOptions } from \"./createMcpServer.js\";\nexport {\n mcpExpressHandler,\n type McpExpressHandlerOptions,\n} from \"./mcpExpressHandler.js\";\n"],"names":[],"mappings":";;;;;;;;AACA;AAQA;AACA,MAAM,OAAO,GAAG,OAAO;AAEvB;;;AAGG;AACH,SAAS,WAAW,GAAA;AAClB,IAAA,IAAI;QACF,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC;QAC3C,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC;QAE9C,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;AACtC,YAAA,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE;;YAE3B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE;YAEzC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC;YACpC,IAAI,OAAO,KAAK,CAAC,CAAC;gBAAE;AAEpB,YAAA,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,E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;;;;"}
@@ -9,7 +9,7 @@ import { gt } from 'semver';
9
9
  /**
10
10
  * Docs Suite - Documentation services (skill, version, release_notes)
11
11
  */
12
- const BUILD_VERSION_STRING = "@jaypie/mcp@0.8.54#ff24b05a"
12
+ const BUILD_VERSION_STRING = "@jaypie/mcp@0.8.55#735a0f6f"
13
13
  ;
14
14
  const __filename$1 = fileURLToPath(import.meta.url);
15
15
  const __dirname$1 = path.dirname(__filename$1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaypie/mcp",
3
- "version": "0.8.54",
3
+ "version": "0.8.55",
4
4
  "description": "Jaypie MCP",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,11 @@
1
+ ---
2
+ version: 0.8.55
3
+ date: 2026-05-07
4
+ summary: Document JaypieStack in the cdk skill
5
+ ---
6
+
7
+ ## Changes
8
+
9
+ - Added a "Stacks" section to `skill("cdk")` introducing `JaypieStack` as the recommended base class for Jaypie CDK stacks, covering automatic stack naming, account/region resolution, and the standard tag set.
10
+ - Mentioned `JaypieAppStack` and `JaypieInfrastructureStack` as thin subclasses that pre-fill the `app` and `infra` keys.
11
+ - Updated the "Environment Configuration" example to reflect that `JaypieStack` resolves `CDK_DEFAULT_ACCOUNT` / `CDK_DEFAULT_REGION` automatically, so manual env wiring is only needed for cross-account/region deploys.
package/skills/cdk.md CHANGED
@@ -96,22 +96,65 @@ workspaces/
96
96
  │ └── package.json
97
97
  ```
98
98
 
99
+ ## Stacks
100
+
101
+ ### JaypieStack
102
+
103
+ `JaypieStack` extends CDK's `Stack` and is the recommended base class for every stack in a Jaypie project. Extending it gives you three things automatically:
104
+
105
+ 1. **Stack naming** from environment variables, in the form
106
+ `cdk-{PROJECT_SPONSOR}-{PROJECT_KEY}-{PROJECT_ENV}-{PROJECT_NONCE}[-{key}]`,
107
+ so naming stays consistent across sandbox, personal, and production deploys.
108
+ 2. **Account & region** resolved from `CDK_DEFAULT_ACCOUNT` / `CDK_DEFAULT_REGION` (overridable via `env`).
109
+ 3. **Standard tags** applied to the stack and propagated to every taggable child resource: `env`, `project`, `sponsor`, `nonce`, `commit`, `buildHex`, `buildDate`, `buildTime`, `version`, `service`, `creation`, `role`, `stack`.
110
+
111
+ ```typescript
112
+ import { Construct } from "constructs";
113
+ import { JaypieStack, JaypieStackProps } from "@jaypie/constructs";
114
+
115
+ export class DataStack extends JaypieStack {
116
+ constructor(scope: Construct, id: string, props: JaypieStackProps = {}) {
117
+ super(scope, id, { key: "data", ...props });
118
+ // ...your resources...
119
+ }
120
+ }
121
+ ```
122
+
123
+ Props extend `StackProps` with one addition:
124
+
125
+ | Prop | Description |
126
+ |------|-------------|
127
+ | `key` | Suffix appended to the generated stack name (e.g., `"data"`, `"events"`). Optional. |
128
+
129
+ If you see `undefined` or `unknown` in a generated stack name or tag, an env var is missing — fix the environment rather than overriding `stackName`.
130
+
131
+ #### `JaypieAppStack` / `JaypieInfrastructureStack`
132
+
133
+ Thin convenience subclasses that pre-fill `key`:
134
+
135
+ - `JaypieAppStack` → `key: "app"` (application workloads — Lambdas, APIs)
136
+ - `JaypieInfrastructureStack` → `key: "infra"` (shared infrastructure — buckets, hosted zones, shared secrets); also tags the stack with `stackSha` from `CDK_ENV_INFRASTRUCTURE_STACK_SHA` when set
137
+
138
+ Use them when their key fits; extend `JaypieStack` directly for any other category.
139
+
99
140
  ## Environment Configuration
100
141
 
101
- Use environment-specific configuration:
142
+ `JaypieStack` resolves the AWS account and region from `CDK_DEFAULT_ACCOUNT` / `CDK_DEFAULT_REGION` automatically, so most stacks need no env wiring at the call site:
102
143
 
103
144
  ```typescript
104
- const env = process.env.PROJECT_ENV || "sandbox";
105
- const nonce = process.env.PROJECT_NONCE || "dev";
145
+ new ApiStack(app, "ApiStack");
146
+ ```
106
147
 
107
- const stack = new ApiStack(app, `api-${env}-${nonce}`, {
108
- env: {
109
- account: process.env.CDK_DEFAULT_ACCOUNT,
110
- region: process.env.CDK_DEFAULT_REGION,
111
- },
148
+ Override per-stack only when you need to deploy outside the default context:
149
+
150
+ ```typescript
151
+ new ApiStack(app, "ApiStack", {
152
+ env: { account: "123456789012", region: "us-west-2" },
112
153
  });
113
154
  ```
114
155
 
156
+ See `skill("variables")` for the full set of `PROJECT_*` and `CDK_*` environment variables that drive naming and tagging.
157
+
115
158
  ## Resource Naming
116
159
 
117
160
  CDK logical IDs (the construct `id` parameter) are stack-scoped and unique per stack. However, **physical resource names** set via props like `repositoryName`, `logGroupName`, `clusterName`, `family`, and `ruleName` are account-global. Always include `PROJECT_ENV` and `PROJECT_NONCE` to avoid collisions when multiple stacks deploy to the same account.