@aws/nx-plugin 1.0.0-rc.86 → 1.0.0-rc.88

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.
Files changed (179) hide show
  1. package/LICENSE-THIRD-PARTY +9977 -16000
  2. package/migrations.json +128 -75
  3. package/package.json +7 -7
  4. package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +1 -1
  5. package/src/infra/app/__snapshots__/generator.spec.ts.snap +41 -15
  6. package/src/infra/app/files/app/README.md.template +14 -0
  7. package/src/infra/app/generator.js +15 -2
  8. package/src/infra/app/generator.js.map +1 -1
  9. package/src/mcp-server/tools/general-guidance.js +1 -1
  10. package/src/mcp-server/tools/general-guidance.js.map +1 -1
  11. package/src/migrations/latest/add-destroy-sandbox-target/metadata.json +3 -0
  12. package/src/migrations/latest/add-destroy-sandbox-target/migration.js +150 -0
  13. package/src/migrations/latest/add-destroy-sandbox-target/migration.js.map +1 -0
  14. package/src/migrations/latest/python-version-drop-exact-patch/metadata.json +3 -0
  15. package/src/migrations/latest/python-version-drop-exact-patch/migration.js +43 -0
  16. package/src/migrations/latest/python-version-drop-exact-patch/migration.js.map +1 -0
  17. package/src/migrations/latest/react-website-nx-react-express-override/metadata.json +3 -0
  18. package/src/migrations/latest/react-website-nx-react-express-override/migration.d.ts +31 -0
  19. package/src/migrations/latest/react-website-nx-react-express-override/migration.js +74 -0
  20. package/src/migrations/latest/react-website-nx-react-express-override/migration.js.map +1 -0
  21. package/src/migrations/latest/terraform-rdb-proxy-iam-connect-grant/__snapshots__/migration.spec.ts.snap +23 -0
  22. package/src/migrations/latest/terraform-rdb-proxy-iam-connect-grant/metadata.json +3 -0
  23. package/src/migrations/latest/terraform-rdb-proxy-iam-connect-grant/migration.js +88 -0
  24. package/src/migrations/latest/terraform-rdb-proxy-iam-connect-grant/migration.js.map +1 -0
  25. package/src/migrations/v1.0.0-rc.77/0001-dynamodb-configurable-encryption/migration.js.map +1 -0
  26. package/src/migrations/v1.0.0-rc.77/0002-user-identity-configurable-mfa/migration.js.map +1 -0
  27. package/src/migrations/v1.0.0-rc.78/0001-static-website-configurable-waf-encryption/migration.js.map +1 -0
  28. package/src/migrations/v1.0.0-rc.79/0001-py-agent-ag-ui-hooks/migration.js.map +1 -0
  29. package/src/migrations/v1.0.0-rc.82/0001-terraform-load-runtime-config-src-path/migration.js.map +1 -0
  30. package/src/migrations/v1.0.0-rc.82/0002-runtime-config-namespace-defaults/migration.js.map +1 -0
  31. package/src/migrations/v1.0.0-rc.83/0001-dynamodb-terraform-app-module-outputs/migration.js.map +1 -0
  32. package/src/migrations/v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection/migration.js.map +1 -0
  33. package/src/migrations/v1.0.0-rc.83/0003-terraform-gateway-cedar-render-root-ejs/migration.js.map +1 -0
  34. package/src/migrations/v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults/migration.js.map +1 -0
  35. package/src/migrations/v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default/migration.js.map +1 -0
  36. package/src/migrations/v1.0.0-rc.84/0003-terraform-declare-used-providers/migration.js.map +1 -0
  37. package/src/migrations/v1.0.0-rc.84/0004-waf-log-group-cmk-encryption/migration.d.ts +6 -0
  38. package/src/migrations/v1.0.0-rc.84/0004-waf-log-group-cmk-encryption/migration.js.map +1 -0
  39. package/src/migrations/v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant/migration.d.ts +6 -0
  40. package/src/migrations/v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant/migration.js.map +1 -0
  41. package/src/migrations/v1.0.0-rc.85/0001-terraform-project-checkov-target-and-bootstrap-destroy/migration.d.ts +6 -0
  42. package/src/migrations/v1.0.0-rc.85/0001-terraform-project-checkov-target-and-bootstrap-destroy/migration.js.map +1 -0
  43. package/src/open-api/ts-client/generator.js.map +1 -1
  44. package/src/open-api/ts-hooks/generator.spec.tsx +1 -1
  45. package/src/preset/__snapshots__/generator.spec.ts.snap +3 -3
  46. package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +2 -2
  47. package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +5 -5
  48. package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +4 -4
  49. package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
  50. package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
  51. package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
  52. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +3 -3
  53. package/src/py/project/generator.js +5 -5
  54. package/src/py/project/generator.js.map +1 -1
  55. package/src/py/rdb/__snapshots__/generator.spec.ts.snap +2 -2
  56. package/src/smithy/project/__snapshots__/generator.spec.ts.snap +7 -7
  57. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +16 -16
  58. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +28 -28
  59. package/src/ts/agent/__snapshots__/generator.spec.ts.snap +3 -3
  60. package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +4 -4
  61. package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
  62. package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +5 -5
  63. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +2 -2
  64. package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +9 -16
  65. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +59 -49
  66. package/src/ts/react-website/app/generator.d.ts +3 -0
  67. package/src/ts/react-website/app/generator.js +25 -1
  68. package/src/ts/react-website/app/generator.js.map +1 -1
  69. package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
  70. package/src/ts/react-website/cognito-auth/generator.js +1 -1
  71. package/src/ts/react-website/cognito-auth/generator.js.map +1 -1
  72. package/src/ts/react-website/runtime-config/generator.js +1 -1
  73. package/src/ts/react-website/runtime-config/generator.js.map +1 -1
  74. package/src/utils/agent-core-constructs/agent-core-constructs.js +3 -2
  75. package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
  76. package/src/utils/agent-core-constructs/files/cdk/core/agentcore-gateway/agentcore-gateway.ts.template +1 -1
  77. package/src/utils/api-constructs/api-constructs.js +7 -4
  78. package/src/utils/api-constructs/api-constructs.js.map +1 -1
  79. package/src/utils/api-constructs/files/cdk/app/apis/http/__apiNameKebabCase__.ts.template +4 -4
  80. package/src/utils/api-constructs/files/cdk/app/apis/rest/__apiNameKebabCase__.ts.template +4 -4
  81. package/src/utils/api-constructs/files/cdk/core/api/rest/api-gateway-account.ts.template +1 -1
  82. package/src/utils/api-constructs/files/terraform/app/apis/http/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +4 -4
  83. package/src/utils/api-constructs/files/terraform/app/apis/rest/__apiNameKebabCase__/__apiNameKebabCase__.tf.template +4 -4
  84. package/src/utils/ast.d.ts +13 -0
  85. package/src/utils/ast.js +36 -0
  86. package/src/utils/ast.js.map +1 -1
  87. package/src/utils/bundle/bundle.js +5 -2
  88. package/src/utils/bundle/bundle.js.map +1 -1
  89. package/src/utils/dcr-proxy-constructs/dcr-proxy-constructs.js +5 -3
  90. package/src/utils/dcr-proxy-constructs/dcr-proxy-constructs.js.map +1 -1
  91. package/src/utils/dcr-proxy-constructs/files/cdk/app/dcr-proxies/__nameKebabCase__/__nameKebabCase__.ts.template +1 -1
  92. package/src/utils/dcr-proxy-constructs/files/terraform/app/dcr-proxies/__nameKebabCase__/__nameKebabCase__.tf.template +2 -2
  93. package/src/utils/files/common/scripts/src/infra/stage-credentials/cdk-command.ts.template +7 -3
  94. package/src/utils/function-constructs/function-constructs.js +3 -3
  95. package/src/utils/function-constructs/function-constructs.js.map +1 -1
  96. package/src/utils/lambda-runtime-resolution.d.ts +53 -0
  97. package/src/utils/lambda-runtime-resolution.js +83 -0
  98. package/src/utils/lambda-runtime-resolution.js.map +1 -0
  99. package/src/utils/rdb-constructs/files/cdk/app/dbs/__nameKebabCase__.ts.template +3 -3
  100. package/src/utils/rdb-constructs/files/terraform/app/dbs/__nameKebabCase__/__nameKebabCase__.tf.template +4 -21
  101. package/src/utils/rdb-constructs/rdb-constructs.js +5 -3
  102. package/src/utils/rdb-constructs/rdb-constructs.js.map +1 -1
  103. package/src/utils/version-upgrade-migration/sync-lambda-runtimes.d.ts +28 -0
  104. package/src/utils/version-upgrade-migration/sync-lambda-runtimes.js +148 -0
  105. package/src/utils/version-upgrade-migration/sync-lambda-runtimes.js.map +1 -0
  106. package/src/utils/version-upgrade-migration/sync-python-language-version.d.ts +31 -0
  107. package/src/utils/version-upgrade-migration/sync-python-language-version.js +110 -0
  108. package/src/utils/version-upgrade-migration/sync-python-language-version.js.map +1 -0
  109. package/src/utils/version-upgrade-migration/sync-vended-versions.js +36 -7
  110. package/src/utils/version-upgrade-migration/sync-vended-versions.js.map +1 -1
  111. package/src/utils/versions.d.ts +108 -52
  112. package/src/utils/versions.js +98 -50
  113. package/src/utils/versions.js.map +1 -1
  114. package/src/migrations/latest/agentcore-harness-no-tools-by-default/migration.js.map +0 -1
  115. package/src/migrations/latest/dynamodb-configurable-encryption/migration.js.map +0 -1
  116. package/src/migrations/latest/dynamodb-terraform-app-module-outputs/migration.js.map +0 -1
  117. package/src/migrations/latest/py-agent-ag-ui-hooks/migration.js.map +0 -1
  118. package/src/migrations/latest/rdb-terraform-aurora-app-module-defaults/migration.js.map +0 -1
  119. package/src/migrations/latest/runtime-config-namespace-defaults/migration.js.map +0 -1
  120. package/src/migrations/latest/static-website-configurable-waf-encryption/migration.js.map +0 -1
  121. package/src/migrations/latest/terraform-data-resource-destroy-protection/migration.js.map +0 -1
  122. package/src/migrations/latest/terraform-declare-used-providers/migration.js.map +0 -1
  123. package/src/migrations/latest/terraform-gateway-cedar-render-root-ejs/migration.js.map +0 -1
  124. package/src/migrations/latest/terraform-harness-vpc-role-and-memory-grant/migration.js.map +0 -1
  125. package/src/migrations/latest/terraform-load-runtime-config-src-path/migration.js.map +0 -1
  126. package/src/migrations/latest/terraform-project-checkov-target-and-bootstrap-destroy/migration.js.map +0 -1
  127. package/src/migrations/latest/user-identity-configurable-mfa/migration.js.map +0 -1
  128. package/src/migrations/latest/waf-log-group-cmk-encryption/migration.js.map +0 -1
  129. /package/src/migrations/latest/{agentcore-harness-no-tools-by-default → add-destroy-sandbox-target}/migration.d.ts +0 -0
  130. /package/src/migrations/latest/{dynamodb-configurable-encryption → python-version-drop-exact-patch}/migration.d.ts +0 -0
  131. /package/src/migrations/latest/{dynamodb-terraform-app-module-outputs → terraform-rdb-proxy-iam-connect-grant}/migration.d.ts +0 -0
  132. /package/src/migrations/{latest/dynamodb-configurable-encryption → v1.0.0-rc.77/0001-dynamodb-configurable-encryption}/__snapshots__/migration.spec.ts.snap +0 -0
  133. /package/src/migrations/{latest/dynamodb-configurable-encryption → v1.0.0-rc.77/0001-dynamodb-configurable-encryption}/metadata.json +0 -0
  134. /package/src/migrations/{latest/py-agent-ag-ui-hooks → v1.0.0-rc.77/0001-dynamodb-configurable-encryption}/migration.d.ts +0 -0
  135. /package/src/migrations/{latest/dynamodb-configurable-encryption → v1.0.0-rc.77/0001-dynamodb-configurable-encryption}/migration.js +0 -0
  136. /package/src/migrations/{latest/user-identity-configurable-mfa → v1.0.0-rc.77/0002-user-identity-configurable-mfa}/metadata.json +0 -0
  137. /package/src/migrations/{latest/terraform-data-resource-destroy-protection → v1.0.0-rc.77/0002-user-identity-configurable-mfa}/migration.d.ts +0 -0
  138. /package/src/migrations/{latest/user-identity-configurable-mfa → v1.0.0-rc.77/0002-user-identity-configurable-mfa}/migration.js +0 -0
  139. /package/src/migrations/{latest/static-website-configurable-waf-encryption → v1.0.0-rc.78/0001-static-website-configurable-waf-encryption}/metadata.json +0 -0
  140. /package/src/migrations/{latest/rdb-terraform-aurora-app-module-defaults → v1.0.0-rc.78/0001-static-website-configurable-waf-encryption}/migration.d.ts +0 -0
  141. /package/src/migrations/{latest/static-website-configurable-waf-encryption → v1.0.0-rc.78/0001-static-website-configurable-waf-encryption}/migration.js +0 -0
  142. /package/src/migrations/{latest/py-agent-ag-ui-hooks → v1.0.0-rc.79/0001-py-agent-ag-ui-hooks}/metadata.json +0 -0
  143. /package/src/migrations/{latest/runtime-config-namespace-defaults → v1.0.0-rc.79/0001-py-agent-ag-ui-hooks}/migration.d.ts +0 -0
  144. /package/src/migrations/{latest/py-agent-ag-ui-hooks → v1.0.0-rc.79/0001-py-agent-ag-ui-hooks}/migration.js +0 -0
  145. /package/src/migrations/{latest/terraform-load-runtime-config-src-path → v1.0.0-rc.82/0001-terraform-load-runtime-config-src-path}/metadata.json +0 -0
  146. /package/src/migrations/{latest/static-website-configurable-waf-encryption → v1.0.0-rc.82/0001-terraform-load-runtime-config-src-path}/migration.d.ts +0 -0
  147. /package/src/migrations/{latest/terraform-load-runtime-config-src-path → v1.0.0-rc.82/0001-terraform-load-runtime-config-src-path}/migration.js +0 -0
  148. /package/src/migrations/{latest/runtime-config-namespace-defaults → v1.0.0-rc.82/0002-runtime-config-namespace-defaults}/metadata.json +0 -0
  149. /package/src/migrations/{latest/terraform-declare-used-providers → v1.0.0-rc.82/0002-runtime-config-namespace-defaults}/migration.d.ts +0 -0
  150. /package/src/migrations/{latest/runtime-config-namespace-defaults → v1.0.0-rc.82/0002-runtime-config-namespace-defaults}/migration.js +0 -0
  151. /package/src/migrations/{latest/dynamodb-terraform-app-module-outputs → v1.0.0-rc.83/0001-dynamodb-terraform-app-module-outputs}/metadata.json +0 -0
  152. /package/src/migrations/{latest/terraform-gateway-cedar-render-root-ejs → v1.0.0-rc.83/0001-dynamodb-terraform-app-module-outputs}/migration.d.ts +0 -0
  153. /package/src/migrations/{latest/dynamodb-terraform-app-module-outputs → v1.0.0-rc.83/0001-dynamodb-terraform-app-module-outputs}/migration.js +0 -0
  154. /package/src/migrations/{latest/terraform-data-resource-destroy-protection → v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection}/__snapshots__/migration.spec.ts.snap +0 -0
  155. /package/src/migrations/{latest/terraform-data-resource-destroy-protection → v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection}/metadata.json +0 -0
  156. /package/src/migrations/{latest/user-identity-configurable-mfa → v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection}/migration.d.ts +0 -0
  157. /package/src/migrations/{latest/terraform-data-resource-destroy-protection → v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection}/migration.js +0 -0
  158. /package/src/migrations/{latest/terraform-gateway-cedar-render-root-ejs → v1.0.0-rc.83/0003-terraform-gateway-cedar-render-root-ejs}/metadata.json +0 -0
  159. /package/src/migrations/{latest/terraform-harness-vpc-role-and-memory-grant → v1.0.0-rc.83/0003-terraform-gateway-cedar-render-root-ejs}/migration.d.ts +0 -0
  160. /package/src/migrations/{latest/terraform-gateway-cedar-render-root-ejs → v1.0.0-rc.83/0003-terraform-gateway-cedar-render-root-ejs}/migration.js +0 -0
  161. /package/src/migrations/{latest/rdb-terraform-aurora-app-module-defaults → v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults}/__snapshots__/migration.spec.ts.snap +0 -0
  162. /package/src/migrations/{latest/rdb-terraform-aurora-app-module-defaults → v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults}/metadata.json +0 -0
  163. /package/src/migrations/{latest/terraform-load-runtime-config-src-path → v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults}/migration.d.ts +0 -0
  164. /package/src/migrations/{latest/rdb-terraform-aurora-app-module-defaults → v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults}/migration.js +0 -0
  165. /package/src/migrations/{latest/agentcore-harness-no-tools-by-default → v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default}/__snapshots__/migration.spec.ts.snap +0 -0
  166. /package/src/migrations/{latest/agentcore-harness-no-tools-by-default → v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default}/metadata.json +0 -0
  167. /package/src/migrations/{latest/terraform-project-checkov-target-and-bootstrap-destroy → v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default}/migration.d.ts +0 -0
  168. /package/src/migrations/{latest/agentcore-harness-no-tools-by-default → v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default}/migration.js +0 -0
  169. /package/src/migrations/{latest/terraform-declare-used-providers → v1.0.0-rc.84/0003-terraform-declare-used-providers}/metadata.json +0 -0
  170. /package/src/migrations/{latest/waf-log-group-cmk-encryption → v1.0.0-rc.84/0003-terraform-declare-used-providers}/migration.d.ts +0 -0
  171. /package/src/migrations/{latest/terraform-declare-used-providers → v1.0.0-rc.84/0003-terraform-declare-used-providers}/migration.js +0 -0
  172. /package/src/migrations/{latest/waf-log-group-cmk-encryption → v1.0.0-rc.84/0004-waf-log-group-cmk-encryption}/__snapshots__/migration.spec.ts.snap +0 -0
  173. /package/src/migrations/{latest/waf-log-group-cmk-encryption → v1.0.0-rc.84/0004-waf-log-group-cmk-encryption}/metadata.json +0 -0
  174. /package/src/migrations/{latest/waf-log-group-cmk-encryption → v1.0.0-rc.84/0004-waf-log-group-cmk-encryption}/migration.js +0 -0
  175. /package/src/migrations/{latest/terraform-harness-vpc-role-and-memory-grant → v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant}/__snapshots__/migration.spec.ts.snap +0 -0
  176. /package/src/migrations/{latest/terraform-harness-vpc-role-and-memory-grant → v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant}/metadata.json +0 -0
  177. /package/src/migrations/{latest/terraform-harness-vpc-role-and-memory-grant → v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant}/migration.js +0 -0
  178. /package/src/migrations/{latest/terraform-project-checkov-target-and-bootstrap-destroy → v1.0.0-rc.85/0001-terraform-project-checkov-target-and-bootstrap-destroy}/metadata.json +0 -0
  179. /package/src/migrations/{latest/terraform-project-checkov-target-and-bootstrap-destroy → v1.0.0-rc.85/0001-terraform-project-checkov-target-and-bootstrap-destroy}/migration.js +0 -0
package/migrations.json CHANGED
@@ -2,80 +2,25 @@
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "name": "@aws/nx-plugin",
4
4
  "generators": {
5
- "latest-dynamodb-configurable-encryption": {
6
- "version": "1.0.0-rc.77",
7
- "description": "Surface encryption and encryptionKey on the vended DynamoDBTable construct/module",
8
- "implementation": "./src/migrations/latest/dynamodb-configurable-encryption/migration"
9
- },
10
- "latest-user-identity-configurable-mfa": {
11
- "version": "1.0.0-rc.77",
12
- "description": "Surface mfa and mfaSecondFactor on the vended UserIdentity construct/module",
13
- "implementation": "./src/migrations/latest/user-identity-configurable-mfa/migration"
14
- },
15
- "latest-static-website-configurable-waf-encryption": {
16
- "version": "1.0.0-rc.78",
17
- "description": "Surface enableWaf, encryption, encryptionKey and enableKeyRotation on the vended StaticWebsite construct/module",
18
- "implementation": "./src/migrations/latest/static-website-configurable-waf-encryption/migration"
19
- },
20
- "latest-py-agent-ag-ui-hooks": {
21
- "version": "1.0.0-rc.79",
22
- "description": "Forward the py#agent Strands hooks to the AG-UI adapter so model and tool errors are reported",
23
- "implementation": "./src/migrations/latest/py-agent-ag-ui-hooks/migration"
24
- },
25
- "latest-terraform-load-runtime-config-src-path": {
26
- "version": "1.0.0-rc.82",
27
- "description": "Point the react website's terraform load-runtime-config target at the runtime-config file the terraform aggregation actually writes",
28
- "implementation": "./src/migrations/latest/terraform-load-runtime-config-src-path/migration"
29
- },
30
- "latest-runtime-config-namespace-defaults": {
31
- "version": "1.0.0-rc.82",
32
- "description": "Provision AppConfig configuration profiles for every namespace the vended terraform modules write to",
33
- "implementation": "./src/migrations/latest/runtime-config-namespace-defaults/migration"
34
- },
35
- "latest-dynamodb-terraform-app-module-outputs": {
36
- "version": "1.0.0-rc.83",
37
- "description": "Re-export the DynamoDB table and KMS key attributes from the vended Terraform per-table app module",
38
- "implementation": "./src/migrations/latest/dynamodb-terraform-app-module-outputs/migration"
39
- },
40
- "latest-terraform-data-resource-destroy-protection": {
41
- "version": "1.0.0-rc.83",
42
- "description": "Add prevent_destroy and a 30 day KMS deletion window to the vended Terraform DynamoDB table and Aurora cluster modules",
43
- "implementation": "./src/migrations/latest/terraform-data-resource-destroy-protection/migration"
44
- },
45
- "latest-terraform-gateway-cedar-render-root-ejs": {
46
- "version": "1.0.0-rc.83",
47
- "description": "Declare ejs at the workspace root so the Terraform gateway's Cedar render script resolves it",
48
- "implementation": "./src/migrations/latest/terraform-gateway-cedar-render-root-ejs/migration"
49
- },
50
- "latest-rdb-terraform-aurora-app-module-defaults": {
51
- "version": "1.0.0-rc.84",
52
- "description": "Align the vended Terraform Aurora app module variable defaults with the core module, enabling CloudWatch engine log export and exposing enable_key_rotation",
53
- "implementation": "./src/migrations/latest/rdb-terraform-aurora-app-module-defaults/migration"
54
- },
55
- "latest-agentcore-harness-no-tools-by-default": {
56
- "version": "1.0.0-rc.84",
57
- "description": "Pin the vended AgentCore Harness construct/module to no tools by default, since AgentCore treats an absent allowedTools as every tool",
58
- "implementation": "./src/migrations/latest/agentcore-harness-no-tools-by-default/migration"
59
- },
60
- "latest-terraform-declare-used-providers": {
61
- "version": "1.0.0-rc.84",
62
- "description": "Declare every provider each vended Terraform module uses in its own required_providers",
63
- "implementation": "./src/migrations/latest/terraform-declare-used-providers/migration"
64
- },
65
- "latest-waf-log-group-cmk-encryption": {
66
- "version": "1.0.0-rc.84",
67
- "description": "Encrypt vended WAF log groups with a customer-managed KMS key",
68
- "implementation": "./src/migrations/latest/waf-log-group-cmk-encryption/migration"
69
- },
70
- "latest-terraform-harness-vpc-role-and-memory-grant": {
71
- "version": "1.0.0-rc.84",
72
- "description": "Add VPC, execution role and native field support to the vended Terraform AgentCore Harness module, and scope its managed-memory grant to the service-assigned ARN",
73
- "implementation": "./src/migrations/latest/terraform-harness-vpc-role-and-memory-grant/migration"
74
- },
75
- "latest-terraform-project-checkov-target-and-bootstrap-destroy": {
76
- "version": "1.0.0-rc.85",
77
- "description": "Add the Terraform checkov target and config, make bootstrap-destroy non-interactive, and declare required_version in the vended providers.tf",
78
- "implementation": "./src/migrations/latest/terraform-project-checkov-target-and-bootstrap-destroy/migration"
5
+ "latest-add-destroy-sandbox-target": {
6
+ "version": "1.0.0-rc.87",
7
+ "description": "Add a destroy-sandbox target to CDK infrastructure projects which destroys the sandbox stage, and drop the --require-approval flag from cdk destroy, which has no such option",
8
+ "implementation": "./src/migrations/latest/add-destroy-sandbox-target/migration"
9
+ },
10
+ "latest-terraform-rdb-proxy-iam-connect-grant": {
11
+ "version": "1.0.0-rc.87",
12
+ "description": "Replace the MySQL RDS Proxy role's admin secret access with the rds-db:connect grant it needs for end-to-end IAM auth",
13
+ "implementation": "./src/migrations/latest/terraform-rdb-proxy-iam-connect-grant/migration"
14
+ },
15
+ "latest-python-version-drop-exact-patch": {
16
+ "version": "1.0.0-rc.88",
17
+ "description": "Drop the exact CPython patch from .python-version to the Lambda runtime's major.minor",
18
+ "implementation": "./src/migrations/latest/python-version-drop-exact-patch/migration"
19
+ },
20
+ "latest-react-website-nx-react-express-override": {
21
+ "version": "1.0.0-rc.88",
22
+ "description": "Add an npm override pinning the express @nx/react resolves to the version generated websites use, so npm can satisfy its optional peer",
23
+ "implementation": "./src/migrations/latest/react-website-nx-react-express-override/migration"
79
24
  },
80
25
  "v1.0.0-rc.50-0001-modernize-function-props-cast": {
81
26
  "version": "1.0.0-rc.50",
@@ -217,8 +162,83 @@
217
162
  "description": "Extract the duplicated session-id Express middleware in ts#agent's ag-ui/a2a index.ts into a shared middleware/session-id-middleware.ts module",
218
163
  "implementation": "./src/migrations/v1.0.0-rc.75/0001-ts-agent-session-id-middleware-extraction/migration"
219
164
  },
165
+ "v1.0.0-rc.77-0001-dynamodb-configurable-encryption": {
166
+ "version": "1.0.0-rc.77",
167
+ "description": "Surface encryption and encryptionKey on the vended DynamoDBTable construct/module",
168
+ "implementation": "./src/migrations/v1.0.0-rc.77/0001-dynamodb-configurable-encryption/migration"
169
+ },
170
+ "v1.0.0-rc.77-0002-user-identity-configurable-mfa": {
171
+ "version": "1.0.0-rc.77",
172
+ "description": "Surface mfa and mfaSecondFactor on the vended UserIdentity construct/module",
173
+ "implementation": "./src/migrations/v1.0.0-rc.77/0002-user-identity-configurable-mfa/migration"
174
+ },
175
+ "v1.0.0-rc.78-0001-static-website-configurable-waf-encryption": {
176
+ "version": "1.0.0-rc.78",
177
+ "description": "Surface enableWaf, encryption, encryptionKey and enableKeyRotation on the vended StaticWebsite construct/module",
178
+ "implementation": "./src/migrations/v1.0.0-rc.78/0001-static-website-configurable-waf-encryption/migration"
179
+ },
180
+ "v1.0.0-rc.79-0001-py-agent-ag-ui-hooks": {
181
+ "version": "1.0.0-rc.79",
182
+ "description": "Forward the py#agent Strands hooks to the AG-UI adapter so model and tool errors are reported",
183
+ "implementation": "./src/migrations/v1.0.0-rc.79/0001-py-agent-ag-ui-hooks/migration"
184
+ },
185
+ "v1.0.0-rc.82-0001-terraform-load-runtime-config-src-path": {
186
+ "version": "1.0.0-rc.82",
187
+ "description": "Point the react website's terraform load-runtime-config target at the runtime-config file the terraform aggregation actually writes",
188
+ "implementation": "./src/migrations/v1.0.0-rc.82/0001-terraform-load-runtime-config-src-path/migration"
189
+ },
190
+ "v1.0.0-rc.82-0002-runtime-config-namespace-defaults": {
191
+ "version": "1.0.0-rc.82",
192
+ "description": "Provision AppConfig configuration profiles for every namespace the vended terraform modules write to",
193
+ "implementation": "./src/migrations/v1.0.0-rc.82/0002-runtime-config-namespace-defaults/migration"
194
+ },
195
+ "v1.0.0-rc.83-0001-dynamodb-terraform-app-module-outputs": {
196
+ "version": "1.0.0-rc.83",
197
+ "description": "Re-export the DynamoDB table and KMS key attributes from the vended Terraform per-table app module",
198
+ "implementation": "./src/migrations/v1.0.0-rc.83/0001-dynamodb-terraform-app-module-outputs/migration"
199
+ },
200
+ "v1.0.0-rc.83-0002-terraform-data-resource-destroy-protection": {
201
+ "version": "1.0.0-rc.83",
202
+ "description": "Add prevent_destroy and a 30 day KMS deletion window to the vended Terraform DynamoDB table and Aurora cluster modules",
203
+ "implementation": "./src/migrations/v1.0.0-rc.83/0002-terraform-data-resource-destroy-protection/migration"
204
+ },
205
+ "v1.0.0-rc.83-0003-terraform-gateway-cedar-render-root-ejs": {
206
+ "version": "1.0.0-rc.83",
207
+ "description": "Declare ejs at the workspace root so the Terraform gateway's Cedar render script resolves it",
208
+ "implementation": "./src/migrations/v1.0.0-rc.83/0003-terraform-gateway-cedar-render-root-ejs/migration"
209
+ },
210
+ "v1.0.0-rc.84-0001-rdb-terraform-aurora-app-module-defaults": {
211
+ "version": "1.0.0-rc.84",
212
+ "description": "Align the vended Terraform Aurora app module variable defaults with the core module, enabling CloudWatch engine log export and exposing enable_key_rotation",
213
+ "implementation": "./src/migrations/v1.0.0-rc.84/0001-rdb-terraform-aurora-app-module-defaults/migration"
214
+ },
215
+ "v1.0.0-rc.84-0002-agentcore-harness-no-tools-by-default": {
216
+ "version": "1.0.0-rc.84",
217
+ "description": "Pin the vended AgentCore Harness construct/module to no tools by default, since AgentCore treats an absent allowedTools as every tool",
218
+ "implementation": "./src/migrations/v1.0.0-rc.84/0002-agentcore-harness-no-tools-by-default/migration"
219
+ },
220
+ "v1.0.0-rc.84-0003-terraform-declare-used-providers": {
221
+ "version": "1.0.0-rc.84",
222
+ "description": "Declare every provider each vended Terraform module uses in its own required_providers",
223
+ "implementation": "./src/migrations/v1.0.0-rc.84/0003-terraform-declare-used-providers/migration"
224
+ },
225
+ "v1.0.0-rc.84-0004-waf-log-group-cmk-encryption": {
226
+ "version": "1.0.0-rc.84",
227
+ "description": "Encrypt vended WAF log groups with a customer-managed KMS key",
228
+ "implementation": "./src/migrations/v1.0.0-rc.84/0004-waf-log-group-cmk-encryption/migration"
229
+ },
230
+ "v1.0.0-rc.84-0005-terraform-harness-vpc-role-and-memory-grant": {
231
+ "version": "1.0.0-rc.84",
232
+ "description": "Add VPC, execution role and native field support to the vended Terraform AgentCore Harness module, and scope its managed-memory grant to the service-assigned ARN",
233
+ "implementation": "./src/migrations/v1.0.0-rc.84/0005-terraform-harness-vpc-role-and-memory-grant/migration"
234
+ },
235
+ "v1.0.0-rc.85-0001-terraform-project-checkov-target-and-bootstrap-destroy": {
236
+ "version": "1.0.0-rc.85",
237
+ "description": "Add the Terraform checkov target and config, make bootstrap-destroy non-interactive, and declare required_version in the vended providers.tf",
238
+ "implementation": "./src/migrations/v1.0.0-rc.85/0001-terraform-project-checkov-target-and-bootstrap-destroy/migration"
239
+ },
220
240
  "sync-vended-versions": {
221
- "version": "1.0.0-rc.86",
241
+ "version": "1.0.0-rc.88",
222
242
  "description": "Sync vended dependency versions and the tracked plugin version to those vended by this release",
223
243
  "implementation": "./src/utils/version-upgrade-migration/migration"
224
244
  }
@@ -256,6 +276,39 @@
256
276
  "alwaysAddToPackageJson": false
257
277
  }
258
278
  }
279
+ },
280
+ "nx-23.1.2-nx-packages": {
281
+ "version": "1.0.0-rc.88",
282
+ "packages": {
283
+ "nx": {
284
+ "version": "23.1.2",
285
+ "alwaysAddToPackageJson": false
286
+ },
287
+ "@nx/devkit": {
288
+ "version": "23.1.2",
289
+ "alwaysAddToPackageJson": false
290
+ },
291
+ "@nx/js": {
292
+ "version": "23.1.2",
293
+ "alwaysAddToPackageJson": false
294
+ },
295
+ "@nx/react": {
296
+ "version": "23.1.2",
297
+ "alwaysAddToPackageJson": false
298
+ },
299
+ "@nx/vite": {
300
+ "version": "23.1.2",
301
+ "alwaysAddToPackageJson": false
302
+ },
303
+ "@nx/vitest": {
304
+ "version": "23.1.2",
305
+ "alwaysAddToPackageJson": false
306
+ },
307
+ "@nx/workspace": {
308
+ "version": "23.1.2",
309
+ "alwaysAddToPackageJson": false
310
+ }
311
+ }
259
312
  }
260
313
  }
261
314
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin",
3
- "version": "1.0.0-rc.86",
3
+ "version": "1.0.0-rc.88",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/awslabs/nx-plugin-for-aws.git",
@@ -36,7 +36,7 @@
36
36
  "node": ">=20.19.0"
37
37
  },
38
38
  "peerDependencies": {
39
- "nx": "23.1.1"
39
+ "nx": "23.1.2"
40
40
  },
41
41
  "dependencies": {
42
42
  "@apidevtools/swagger-parser": "12.1.0",
@@ -46,10 +46,10 @@
46
46
  "@getgrit/gritql": "0.0.3",
47
47
  "@iarna/toml": "2.2.5",
48
48
  "@modelcontextprotocol/sdk": "1.30.0",
49
- "@nx/devkit": "23.1.1",
50
- "@nx/js": "23.1.1",
51
- "@nx/react": "23.1.1",
52
- "@nx/vite": "23.1.1",
49
+ "@nx/devkit": "23.1.2",
50
+ "@nx/js": "23.1.2",
51
+ "@nx/react": "23.1.2",
52
+ "@nx/vite": "23.1.2",
53
53
  "@nxlv/python": "23.0.0",
54
54
  "@phenomnomnominal/tsquery": "6.2.0",
55
55
  "@types/estree": "1.0.9",
@@ -58,7 +58,7 @@
58
58
  "enquirer": "2.4.1",
59
59
  "fast-glob": "3.3.3",
60
60
  "jiti": "2.7.0",
61
- "js-yaml": "4.3.1",
61
+ "js-yaml": "4.3.2",
62
62
  "license-checker-rseidelsohn": "4.4.2",
63
63
  "lodash.camelcase": "4.3.0",
64
64
  "lodash.clonedeepwith": "4.5.0",
@@ -7,7 +7,7 @@ exports[`agentcore-gateway generator > protocol: http > omits protocol_type from
7
7
  required_providers {
8
8
  aws = {
9
9
  source = "hashicorp/aws"
10
- version = "6.61.0"
10
+ version = "6.62.0"
11
11
  }
12
12
  time = {
13
13
  source = "hashicorp/time"
@@ -4,8 +4,8 @@ exports[`infra generator > should add required dependencies to package.json > de
4
4
 
5
5
  exports[`infra generator > should add required dependencies to package.json > dev-dependencies 1`] = `
6
6
  {
7
- "@nx/js": "23.1.1",
8
- "@nx/vitest": "23.1.1",
7
+ "@nx/js": "23.1.2",
8
+ "@nx/vitest": "23.1.2",
9
9
  "@swc/helpers": "~0.5.18",
10
10
  "@types/node": "catalog:",
11
11
  "@vitest/coverage-v8": "catalog:",
@@ -23,8 +23,8 @@ exports[`infra generator > should add required dependencies to package.json > pa
23
23
  {
24
24
  "dependencies": {},
25
25
  "devDependencies": {
26
- "@nx/js": "23.1.1",
27
- "@nx/vitest": "23.1.1",
26
+ "@nx/js": "23.1.2",
27
+ "@nx/vitest": "23.1.2",
28
28
  "@swc/helpers": "~0.5.18",
29
29
  "@types/node": "catalog:",
30
30
  "@vitest/coverage-v8": "catalog:",
@@ -56,7 +56,7 @@ exports[`infra generator > should configure Checkov target correctly > checkov-t
56
56
  "{workspaceRoot}/dist/{projectRoot}/cdk.out",
57
57
  ],
58
58
  "options": {
59
- "command": "uvx --from checkov==3.3.13 checkov --config-file {projectRoot}/checkov.yml --directory dist/{projectRoot}/cdk.out --framework cloudformation",
59
+ "command": "uvx --from checkov==3.3.15 checkov --config-file {projectRoot}/checkov.yml --directory dist/{projectRoot}/cdk.out --framework cloudformation",
60
60
  },
61
61
  "outputs": [
62
62
  "{workspaceRoot}/dist/{projectRoot}/checkov",
@@ -98,7 +98,7 @@ exports[`infra generator > should configure project.json with correct targets >
98
98
  ],
99
99
  "executor": "nx:run-commands",
100
100
  "options": {
101
- "command": "cdk destroy --require-approval=never",
101
+ "command": "cdk destroy",
102
102
  "cwd": "{projectRoot}",
103
103
  },
104
104
  }
@@ -150,7 +150,7 @@ exports[`infra generator > should configure project.json with correct targets >
150
150
  "{workspaceRoot}/dist/{projectRoot}/cdk.out",
151
151
  ],
152
152
  "options": {
153
- "command": "uvx --from checkov==3.3.13 checkov --config-file {projectRoot}/checkov.yml --directory dist/{projectRoot}/cdk.out --framework cloudformation",
153
+ "command": "uvx --from checkov==3.3.15 checkov --config-file {projectRoot}/checkov.yml --directory dist/{projectRoot}/cdk.out --framework cloudformation",
154
154
  },
155
155
  "outputs": [
156
156
  "{workspaceRoot}/dist/{projectRoot}/checkov",
@@ -202,14 +202,25 @@ exports[`infra generator > should configure project.json with correct targets >
202
202
  ],
203
203
  "executor": "nx:run-commands",
204
204
  "options": {
205
- "command": "cdk destroy --require-approval=never",
205
+ "command": "cdk destroy",
206
206
  "cwd": "{projectRoot}",
207
207
  },
208
208
  },
209
209
  "destroy-ci": {
210
210
  "executor": "nx:run-commands",
211
211
  "options": {
212
- "command": "cdk destroy --require-approval=never --app ../../dist/{projectRoot}/cdk.out",
212
+ "command": "cdk destroy --app ../../dist/{projectRoot}/cdk.out",
213
+ "cwd": "{projectRoot}",
214
+ },
215
+ },
216
+ "destroy-sandbox": {
217
+ "dependsOn": [
218
+ "^build",
219
+ "compile",
220
+ ],
221
+ "executor": "nx:run-commands",
222
+ "options": {
223
+ "command": "cdk destroy "proj-test-sandbox/*"",
213
224
  "cwd": "{projectRoot}",
214
225
  },
215
226
  },
@@ -745,7 +756,7 @@ exports[`infra generator > should handle custom project names correctly > custom
745
756
  "{workspaceRoot}/dist/{projectRoot}/cdk.out",
746
757
  ],
747
758
  "options": {
748
- "command": "uvx --from checkov==3.3.13 checkov --config-file {projectRoot}/checkov.yml --directory dist/{projectRoot}/cdk.out --framework cloudformation",
759
+ "command": "uvx --from checkov==3.3.15 checkov --config-file {projectRoot}/checkov.yml --directory dist/{projectRoot}/cdk.out --framework cloudformation",
749
760
  },
750
761
  "outputs": [
751
762
  "{workspaceRoot}/dist/{projectRoot}/checkov",
@@ -797,14 +808,25 @@ exports[`infra generator > should handle custom project names correctly > custom
797
808
  ],
798
809
  "executor": "nx:run-commands",
799
810
  "options": {
800
- "command": "cdk destroy --require-approval=never",
811
+ "command": "cdk destroy",
801
812
  "cwd": "{projectRoot}",
802
813
  },
803
814
  },
804
815
  "destroy-ci": {
805
816
  "executor": "nx:run-commands",
806
817
  "options": {
807
- "command": "cdk destroy --require-approval=never --app ../../dist/{projectRoot}/cdk.out",
818
+ "command": "cdk destroy --app ../../dist/{projectRoot}/cdk.out",
819
+ "cwd": "{projectRoot}",
820
+ },
821
+ },
822
+ "destroy-sandbox": {
823
+ "dependsOn": [
824
+ "^build",
825
+ "compile",
826
+ ],
827
+ "executor": "nx:run-commands",
828
+ "options": {
829
+ "command": "cdk destroy "proj-custom-infra-sandbox/*"",
808
830
  "cwd": "{projectRoot}",
809
831
  },
810
832
  },
@@ -1046,9 +1068,10 @@ exports[`infra generator > with stageConfig > should snapshot generated scripts
1046
1068
  "/**
1047
1069
  * Builds the CDK command as an array of arguments for spawnSync.
1048
1070
  *
1049
- * Defaults to --require-approval=never (standard for local dev deploys).
1071
+ * Deploys default to --require-approval=never (standard for local dev deploys).
1050
1072
  * If the user explicitly passes --require-approval with any value, we
1051
- * respect their choice and don't add the default.
1073
+ * respect their choice and don't add the default. \`cdk destroy\` has no
1074
+ * --require-approval option, so nothing is added for it.
1052
1075
  *
1053
1076
  * Pass --express to opt into CloudFormation express mode for faster
1054
1077
  * iteration; it is not enabled by default so deploys wait for full
@@ -1061,7 +1084,10 @@ export function buildCdkCommand(
1061
1084
  const hasRequireApproval = remainingArgs.some(
1062
1085
  (a) => a === '--require-approval' || a.startsWith('--require-approval='),
1063
1086
  );
1064
- const defaults = hasRequireApproval ? [] : ['--require-approval=never'];
1087
+ const defaults =
1088
+ action === 'destroy' || hasRequireApproval
1089
+ ? []
1090
+ : ['--require-approval=never'];
1065
1091
  return ['cdk', action, ...defaults, ...remainingArgs];
1066
1092
  }
1067
1093
  "
@@ -50,6 +50,20 @@ Currently hot swapping supports Lambda functions, Step Functions state machines,
50
50
 
51
51
  Run `<%= pkgMgrCmd %> nx deploy-sandbox <%= fullyQualifiedName %> --hotswap`
52
52
 
53
+ ## Tear Down from AWS
54
+
55
+ ### Tear down your Sandbox Stage
56
+
57
+ Run `<%= pkgMgrCmd %> nx destroy-sandbox <%= fullyQualifiedName %>`
58
+
59
+ ### Tear down all Stacks in a Stage
60
+
61
+ Run `<%= pkgMgrCmd %> nx destroy <%= fullyQualifiedName %> "[stageName]/*"`
62
+
63
+ ### Tear down a single Stack
64
+
65
+ Run `<%= pkgMgrCmd %> nx destroy <%= fullyQualifiedName %> [stageName]/[stackName]`
66
+
53
67
  ## Checkov Rule Suppressions
54
68
 
55
69
  There may be instances where you want to suppress certain rules on resources. You can do this in two ways:
@@ -206,14 +206,27 @@ export async function tsInfraGenerator(tree, schema) {
206
206
  command: `tsx packages/common/scripts/src/infra/infra-destroy.ts ${libraryRoot}`
207
207
  }) : withCdkEnv({
208
208
  cwd: '{projectRoot}',
209
- command: 'cdk destroy --require-approval=never'
209
+ command: 'cdk destroy'
210
+ })
211
+ };
212
+ config.targets['destroy-sandbox'] = {
213
+ executor: 'nx:run-commands',
214
+ dependsOn: [
215
+ '^build',
216
+ 'compile'
217
+ ],
218
+ options: stageConfig ? withCdkEnv({
219
+ command: `tsx packages/common/scripts/src/infra/infra-destroy.ts ${libraryRoot} ${sandboxStagePattern}`
220
+ }) : withCdkEnv({
221
+ cwd: '{projectRoot}',
222
+ command: `cdk destroy ${sandboxStagePattern}`
210
223
  })
211
224
  };
212
225
  config.targets['destroy-ci'] = {
213
226
  executor: 'nx:run-commands',
214
227
  options: withCdkEnv({
215
228
  cwd: '{projectRoot}',
216
- command: `cdk destroy --require-approval=never --app ${distDirFromProjectRoot}`
229
+ command: `cdk destroy --app ${distDirFromProjectRoot}`
217
230
  })
218
231
  };
219
232
  config.targets.cdk = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/infra/app/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type ProjectConfiguration,\n readProjectConfiguration,\n type Tree,\n updateJson,\n} from '@nx/devkit';\nimport path from 'path';\nimport tsProjectGenerator, { getTsLibDetails } from '../../ts/lib/generator.js';\nimport { mergeTsReferences } from '../../ts/lib/ts-project-utils.js';\nimport { addTsDependencies } from '../../utils/add-dependencies.js';\nimport { resolveContainers } from '../../utils/containers.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { esmVars } from '../../utils/module-format.js';\nimport { kebabCase } from '../../utils/names.js';\nimport { getNpmScopePrefix } from '../../utils/npm-scope.js';\nimport {\n addDependencyToTargetIfNotPresent,\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { getPackageManagerDisplayCommands } from '../../utils/pkg-manager.js';\nimport { uvxCommand } from '../../utils/py.js';\nimport {\n SHARED_CONSTRUCTS_DEPENDENCIES,\n sharedConstructsGenerator,\n} from '../../utils/shared-constructs.js';\nimport {\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n SHARED_INFRA_CONFIG_DIR,\n} from '../../utils/shared-constructs-constants.js';\nimport { sharedInfraConfigGenerator } from '../../utils/shared-infra-config.js';\nimport {\n SHARED_INFRA_SCRIPTS_DEPENDENCIES,\n sharedInfraScriptsGenerator,\n} from '../../utils/shared-infra-scripts.js';\nimport type { TsInfraGeneratorSchema } from './schema';\n\n// This generator records no metadata, so nothing a predicate could read: the\n// CDK app always needs the app libraries, and the CLI, bundler and tsx are\n// shared tooling.\nexport const DEPENDENCIES = declareDependencies()({\n ts: [\n { name: 'aws-cdk-lib' },\n { name: 'constructs' },\n { name: 'source-map-support' },\n // The `aws-cdk` CLI, esbuild (CDK bundling) and tsx are shared tooling.\n { name: 'aws-cdk', dev: true, root: true },\n { name: 'esbuild', dev: true, root: true },\n { name: 'tsx', dev: true, root: true },\n ...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),\n ...ownedElsewhere(SHARED_INFRA_SCRIPTS_DEPENDENCIES),\n ],\n});\n\nexport const INFRA_APP_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport async function tsInfraGenerator(\n tree: Tree,\n schema: TsInfraGeneratorSchema,\n): Promise<GeneratorCallback> {\n const lib = getTsLibDetails(tree, schema);\n\n if (!projectExists(tree, lib.fullyQualifiedName)) {\n await tsProjectGenerator(tree, {\n ...schema,\n preferInstallDependencies: false,\n });\n }\n\n // CDK shells out to a container engine to build image assets. Default\n // (docker) needs no env override; finch is set via CDK_DOCKER per\n // https://docs.aws.amazon.com/cdk/v2/guide/build-containers.html#build-container-replace.\n const containers = await resolveContainers(tree, 'inherit');\n const cdkEnv: Record<string, string> | undefined =\n containers === 'docker' ? undefined : { CDK_DOCKER: containers };\n const withCdkEnv = <T extends Record<string, unknown>>(opts: T): T => {\n if (!cdkEnv) return opts;\n const existingEnv = (opts.env as Record<string, string> | undefined) ?? {};\n return { ...opts, env: { ...existingEnv, ...cdkEnv } } as T;\n };\n\n // This generator IS the CDK infrastructure project, so the provider is fixed.\n addGeneratorMetadata(tree, lib.fullyQualifiedName, INFRA_APP_GENERATOR_INFO, {\n iac: 'cdk',\n });\n\n // Shared constructs always in CDK for typescript infra generator\n await sharedConstructsGenerator(\n tree,\n {\n iac: 'cdk',\n },\n DEPENDENCIES,\n );\n\n // Shared infra-config and infra-scripts packages (lazy creation, only when enabled)\n const stageConfig = schema.stageConfig ?? false;\n if (stageConfig) {\n await sharedInfraConfigGenerator(tree);\n await sharedInfraScriptsGenerator(tree, DEPENDENCIES);\n }\n\n const synthDirFromRoot = `/dist/${lib.dir}/cdk.out`;\n const synthDirFromProject =\n lib.dir\n .split('/')\n .map(() => '..')\n .join('/') + `/dist/${lib.dir}/cdk.out`;\n const distDirFromProjectRoot =\n lib.dir\n .split('/')\n .map(() => '..')\n .join('/') + '/dist/{projectRoot}/cdk.out';\n const projectConfig = readProjectConfiguration(tree, lib.fullyQualifiedName);\n const libraryRoot = projectConfig.root;\n const npmScopePrefix = getNpmScopePrefix(tree);\n const scopeAlias = npmScopePrefix;\n const fullyQualifiedName = `${npmScopePrefix}${schema.name}`;\n const namespace = kebabCase(fullyQualifiedName);\n // The stage instantiated in main.ts. Quoted so the shell does not glob `*`.\n const sandboxStagePattern = `\"${namespace}-sandbox/*\"`;\n tree.delete(joinPathFragments(libraryRoot, 'src'));\n\n generateFiles(\n tree, // the virtual file system\n joinPathFragments(import.meta.dirname, './files/app'), // path to the file templates\n libraryRoot, // destination path of the files\n {\n synthDir: synthDirFromProject,\n scopeAlias: scopeAlias,\n namespace,\n fullyQualifiedName,\n pkgMgrCmd: getPackageManagerDisplayCommands().exec,\n dir: lib.dir,\n stageConfig,\n ...schema,\n ...esmVars(tree),\n },\n {\n overwriteStrategy: OverwriteStrategy.Overwrite,\n },\n );\n\n updateJson(\n tree,\n `${libraryRoot}/project.json`,\n (config: ProjectConfiguration) => {\n config.projectType = 'application';\n addDependencyToTargetIfNotPresent(config, 'build', 'synth');\n addDependencyToTargetIfNotPresent(config, 'build', 'checkov');\n config.targets.compile.outputs = [\n '{workspaceRoot}/dist/{projectRoot}/tsc',\n ];\n config.targets.synth = {\n cache: true,\n executor: 'nx:run-commands',\n inputs: ['default'],\n outputs: ['{workspaceRoot}/dist/{projectRoot}/cdk.out'],\n dependsOn: ['^build', 'compile'], // compile clobbers dist directory, so ensure synth runs afterwards\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk synth',\n }),\n };\n config.targets.checkov = {\n cache: true,\n executor: 'nx:run-commands',\n inputs: ['{workspaceRoot}/dist/{projectRoot}/cdk.out'],\n outputs: ['{workspaceRoot}/dist/{projectRoot}/checkov'],\n dependsOn: ['synth'],\n options: {\n command: uvxCommand(\n 'checkov',\n '--config-file {projectRoot}/checkov.yml --directory dist/{projectRoot}/cdk.out --framework cloudformation',\n ),\n },\n };\n config.targets.deploy = {\n executor: 'nx:run-commands',\n dependsOn: ['^build', 'compile'],\n options: stageConfig\n ? withCdkEnv({\n command: `tsx packages/common/scripts/src/infra/infra-deploy.ts ${libraryRoot}`,\n })\n : withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk deploy --require-approval=never',\n }),\n };\n config.targets['deploy-sandbox'] = {\n executor: 'nx:run-commands',\n dependsOn: ['^build', 'compile'],\n options: stageConfig\n ? withCdkEnv({\n command: `tsx packages/common/scripts/src/infra/infra-deploy.ts ${libraryRoot} ${sandboxStagePattern}`,\n })\n : withCdkEnv({\n cwd: '{projectRoot}',\n command: `cdk deploy --require-approval=never ${sandboxStagePattern}`,\n }),\n };\n config.targets['deploy-ci'] = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: `cdk deploy --require-approval=never --app ${distDirFromProjectRoot}`,\n }),\n };\n config.targets.destroy = {\n executor: 'nx:run-commands',\n dependsOn: ['^build', 'compile'],\n options: stageConfig\n ? withCdkEnv({\n command: `tsx packages/common/scripts/src/infra/infra-destroy.ts ${libraryRoot}`,\n })\n : withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk destroy --require-approval=never',\n }),\n };\n config.targets['destroy-ci'] = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: `cdk destroy --require-approval=never --app ${distDirFromProjectRoot}`,\n }),\n };\n config.targets.cdk = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk',\n }),\n };\n config.targets.bootstrap = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk bootstrap',\n }),\n };\n config.targets = sortObjectKeys(config.targets);\n return config;\n },\n );\n\n addTsDependencies(tree, DEPENDENCIES, { projectRoot: libraryRoot });\n\n updateJson(tree, `${libraryRoot}/tsconfig.lib.json`, (tsConfig) => ({\n ...tsConfig,\n references: mergeTsReferences(tsConfig.references, [\n {\n path: `${path.relative(\n libraryRoot,\n `${tree.root}/${PACKAGES_DIR}`,\n )}/${SHARED_CONSTRUCTS_DIR}/tsconfig.lib.json`,\n },\n ...(stageConfig\n ? [\n {\n path: `${path.relative(\n libraryRoot,\n `${tree.root}/${PACKAGES_DIR}`,\n )}/${SHARED_INFRA_CONFIG_DIR}/tsconfig.json`,\n },\n ]\n : []),\n ]),\n }));\n\n await addGeneratorMetricsIfApplicable(tree, [INFRA_APP_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript'],\n });\n}\nexport default tsInfraGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readProjectConfiguration","updateJson","path","tsProjectGenerator","getTsLibDetails","mergeTsReferences","addTsDependencies","resolveContainers","declareDependencies","ownedElsewhere","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","esmVars","kebabCase","getNpmScopePrefix","addDependencyToTargetIfNotPresent","addGeneratorMetadata","getGeneratorInfo","projectExists","sortObjectKeys","getPackageManagerDisplayCommands","uvxCommand","SHARED_CONSTRUCTS_DEPENDENCIES","sharedConstructsGenerator","PACKAGES_DIR","SHARED_CONSTRUCTS_DIR","SHARED_INFRA_CONFIG_DIR","sharedInfraConfigGenerator","SHARED_INFRA_SCRIPTS_DEPENDENCIES","sharedInfraScriptsGenerator","DEPENDENCIES","ts","name","dev","root","INFRA_APP_GENERATOR_INFO","filename","tsInfraGenerator","tree","schema","lib","fullyQualifiedName","preferInstallDependencies","containers","cdkEnv","undefined","CDK_DOCKER","withCdkEnv","opts","existingEnv","env","iac","stageConfig","synthDirFromRoot","dir","synthDirFromProject","split","map","join","distDirFromProjectRoot","projectConfig","libraryRoot","npmScopePrefix","scopeAlias","namespace","sandboxStagePattern","delete","dirname","synthDir","pkgMgrCmd","exec","overwriteStrategy","Overwrite","config","projectType","targets","compile","outputs","synth","cache","executor","inputs","dependsOn","options","cwd","command","checkov","deploy","destroy","cdk","bootstrap","projectRoot","tsConfig","references","relative","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAEjBC,wBAAwB,EAExBC,UAAU,QACL,aAAa;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,sBAAsBC,eAAe,QAAQ,4BAA4B;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F;IACT;IAGFpE,kBAAkBiC,MAAMR,cAAc;QAAE6D,aAAa9B;IAAY;IAEjE7D,WAAWsC,MAAM,GAAGuB,YAAY,kBAAkB,CAAC,EAAE,CAAC+B,WAAc,CAAA;YAClE,GAAGA,QAAQ;YACXC,YAAYzF,kBAAkBwF,SAASC,UAAU,EAAE;gBACjD;oBACE5F,MAAM,GAAGA,KAAK6F,QAAQ,CACpBjC,aACA,GAAGvB,KAAKJ,IAAI,CAAC,CAAC,EAAEV,cAAc,EAC9B,CAAC,EAAEC,sBAAsB,kBAAkB,CAAC;gBAChD;mBACI2B,cACA;oBACE;wBACEnD,MAAM,GAAGA,KAAK6F,QAAQ,CACpBjC,aACA,GAAGvB,KAAKJ,IAAI,CAAC,CAAC,EAAEV,cAAc,EAC9B,CAAC,EAAEE,wBAAwB,cAAc,CAAC;oBAC9C;iBACD,GACD,EAAE;aACP;QACH,CAAA;IAEA,MAAMf,gCAAgC2B,MAAM;QAACH;KAAyB;IAEtE,MAAM1B,qBAAqB6B;IAC3B,OAAO,IACL5B,oBAAoB4B,MAAMC,OAAOG,yBAAyB,EAAE;YAC1DqD,WAAW;gBAAC;aAAa;QAC3B;AACJ;AACA,eAAe1D,iBAAiB"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/infra/app/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n OverwriteStrategy,\n type ProjectConfiguration,\n readProjectConfiguration,\n type Tree,\n updateJson,\n} from '@nx/devkit';\nimport path from 'path';\nimport tsProjectGenerator, { getTsLibDetails } from '../../ts/lib/generator.js';\nimport { mergeTsReferences } from '../../ts/lib/ts-project-utils.js';\nimport { addTsDependencies } from '../../utils/add-dependencies.js';\nimport { resolveContainers } from '../../utils/containers.js';\nimport {\n declareDependencies,\n ownedElsewhere,\n} from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport { esmVars } from '../../utils/module-format.js';\nimport { kebabCase } from '../../utils/names.js';\nimport { getNpmScopePrefix } from '../../utils/npm-scope.js';\nimport {\n addDependencyToTargetIfNotPresent,\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n projectExists,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport { getPackageManagerDisplayCommands } from '../../utils/pkg-manager.js';\nimport { uvxCommand } from '../../utils/py.js';\nimport {\n SHARED_CONSTRUCTS_DEPENDENCIES,\n sharedConstructsGenerator,\n} from '../../utils/shared-constructs.js';\nimport {\n PACKAGES_DIR,\n SHARED_CONSTRUCTS_DIR,\n SHARED_INFRA_CONFIG_DIR,\n} from '../../utils/shared-constructs-constants.js';\nimport { sharedInfraConfigGenerator } from '../../utils/shared-infra-config.js';\nimport {\n SHARED_INFRA_SCRIPTS_DEPENDENCIES,\n sharedInfraScriptsGenerator,\n} from '../../utils/shared-infra-scripts.js';\nimport type { TsInfraGeneratorSchema } from './schema';\n\n// This generator records no metadata, so nothing a predicate could read: the\n// CDK app always needs the app libraries, and the CLI, bundler and tsx are\n// shared tooling.\nexport const DEPENDENCIES = declareDependencies()({\n ts: [\n { name: 'aws-cdk-lib' },\n { name: 'constructs' },\n { name: 'source-map-support' },\n // The `aws-cdk` CLI, esbuild (CDK bundling) and tsx are shared tooling.\n { name: 'aws-cdk', dev: true, root: true },\n { name: 'esbuild', dev: true, root: true },\n { name: 'tsx', dev: true, root: true },\n ...ownedElsewhere(SHARED_CONSTRUCTS_DEPENDENCIES),\n ...ownedElsewhere(SHARED_INFRA_SCRIPTS_DEPENDENCIES),\n ],\n});\n\nexport const INFRA_APP_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport async function tsInfraGenerator(\n tree: Tree,\n schema: TsInfraGeneratorSchema,\n): Promise<GeneratorCallback> {\n const lib = getTsLibDetails(tree, schema);\n\n if (!projectExists(tree, lib.fullyQualifiedName)) {\n await tsProjectGenerator(tree, {\n ...schema,\n preferInstallDependencies: false,\n });\n }\n\n // CDK shells out to a container engine to build image assets. Default\n // (docker) needs no env override; finch is set via CDK_DOCKER per\n // https://docs.aws.amazon.com/cdk/v2/guide/build-containers.html#build-container-replace.\n const containers = await resolveContainers(tree, 'inherit');\n const cdkEnv: Record<string, string> | undefined =\n containers === 'docker' ? undefined : { CDK_DOCKER: containers };\n const withCdkEnv = <T extends Record<string, unknown>>(opts: T): T => {\n if (!cdkEnv) return opts;\n const existingEnv = (opts.env as Record<string, string> | undefined) ?? {};\n return { ...opts, env: { ...existingEnv, ...cdkEnv } } as T;\n };\n\n // This generator IS the CDK infrastructure project, so the provider is fixed.\n addGeneratorMetadata(tree, lib.fullyQualifiedName, INFRA_APP_GENERATOR_INFO, {\n iac: 'cdk',\n });\n\n // Shared constructs always in CDK for typescript infra generator\n await sharedConstructsGenerator(\n tree,\n {\n iac: 'cdk',\n },\n DEPENDENCIES,\n );\n\n // Shared infra-config and infra-scripts packages (lazy creation, only when enabled)\n const stageConfig = schema.stageConfig ?? false;\n if (stageConfig) {\n await sharedInfraConfigGenerator(tree);\n await sharedInfraScriptsGenerator(tree, DEPENDENCIES);\n }\n\n const synthDirFromRoot = `/dist/${lib.dir}/cdk.out`;\n const synthDirFromProject =\n lib.dir\n .split('/')\n .map(() => '..')\n .join('/') + `/dist/${lib.dir}/cdk.out`;\n const distDirFromProjectRoot =\n lib.dir\n .split('/')\n .map(() => '..')\n .join('/') + '/dist/{projectRoot}/cdk.out';\n const projectConfig = readProjectConfiguration(tree, lib.fullyQualifiedName);\n const libraryRoot = projectConfig.root;\n const npmScopePrefix = getNpmScopePrefix(tree);\n const scopeAlias = npmScopePrefix;\n const fullyQualifiedName = `${npmScopePrefix}${schema.name}`;\n const namespace = kebabCase(fullyQualifiedName);\n // The stage instantiated in main.ts. Quoted so the shell does not glob `*`.\n const sandboxStagePattern = `\"${namespace}-sandbox/*\"`;\n tree.delete(joinPathFragments(libraryRoot, 'src'));\n\n generateFiles(\n tree, // the virtual file system\n joinPathFragments(import.meta.dirname, './files/app'), // path to the file templates\n libraryRoot, // destination path of the files\n {\n synthDir: synthDirFromProject,\n scopeAlias: scopeAlias,\n namespace,\n fullyQualifiedName,\n pkgMgrCmd: getPackageManagerDisplayCommands().exec,\n dir: lib.dir,\n stageConfig,\n ...schema,\n ...esmVars(tree),\n },\n {\n overwriteStrategy: OverwriteStrategy.Overwrite,\n },\n );\n\n updateJson(\n tree,\n `${libraryRoot}/project.json`,\n (config: ProjectConfiguration) => {\n config.projectType = 'application';\n addDependencyToTargetIfNotPresent(config, 'build', 'synth');\n addDependencyToTargetIfNotPresent(config, 'build', 'checkov');\n config.targets.compile.outputs = [\n '{workspaceRoot}/dist/{projectRoot}/tsc',\n ];\n config.targets.synth = {\n cache: true,\n executor: 'nx:run-commands',\n inputs: ['default'],\n outputs: ['{workspaceRoot}/dist/{projectRoot}/cdk.out'],\n dependsOn: ['^build', 'compile'], // compile clobbers dist directory, so ensure synth runs afterwards\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk synth',\n }),\n };\n config.targets.checkov = {\n cache: true,\n executor: 'nx:run-commands',\n inputs: ['{workspaceRoot}/dist/{projectRoot}/cdk.out'],\n outputs: ['{workspaceRoot}/dist/{projectRoot}/checkov'],\n dependsOn: ['synth'],\n options: {\n command: uvxCommand(\n 'checkov',\n '--config-file {projectRoot}/checkov.yml --directory dist/{projectRoot}/cdk.out --framework cloudformation',\n ),\n },\n };\n config.targets.deploy = {\n executor: 'nx:run-commands',\n dependsOn: ['^build', 'compile'],\n options: stageConfig\n ? withCdkEnv({\n command: `tsx packages/common/scripts/src/infra/infra-deploy.ts ${libraryRoot}`,\n })\n : withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk deploy --require-approval=never',\n }),\n };\n config.targets['deploy-sandbox'] = {\n executor: 'nx:run-commands',\n dependsOn: ['^build', 'compile'],\n options: stageConfig\n ? withCdkEnv({\n command: `tsx packages/common/scripts/src/infra/infra-deploy.ts ${libraryRoot} ${sandboxStagePattern}`,\n })\n : withCdkEnv({\n cwd: '{projectRoot}',\n command: `cdk deploy --require-approval=never ${sandboxStagePattern}`,\n }),\n };\n config.targets['deploy-ci'] = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: `cdk deploy --require-approval=never --app ${distDirFromProjectRoot}`,\n }),\n };\n config.targets.destroy = {\n executor: 'nx:run-commands',\n dependsOn: ['^build', 'compile'],\n options: stageConfig\n ? withCdkEnv({\n command: `tsx packages/common/scripts/src/infra/infra-destroy.ts ${libraryRoot}`,\n })\n : withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk destroy',\n }),\n };\n config.targets['destroy-sandbox'] = {\n executor: 'nx:run-commands',\n dependsOn: ['^build', 'compile'],\n options: stageConfig\n ? withCdkEnv({\n command: `tsx packages/common/scripts/src/infra/infra-destroy.ts ${libraryRoot} ${sandboxStagePattern}`,\n })\n : withCdkEnv({\n cwd: '{projectRoot}',\n command: `cdk destroy ${sandboxStagePattern}`,\n }),\n };\n config.targets['destroy-ci'] = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: `cdk destroy --app ${distDirFromProjectRoot}`,\n }),\n };\n config.targets.cdk = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk',\n }),\n };\n config.targets.bootstrap = {\n executor: 'nx:run-commands',\n options: withCdkEnv({\n cwd: '{projectRoot}',\n command: 'cdk bootstrap',\n }),\n };\n config.targets = sortObjectKeys(config.targets);\n return config;\n },\n );\n\n addTsDependencies(tree, DEPENDENCIES, { projectRoot: libraryRoot });\n\n updateJson(tree, `${libraryRoot}/tsconfig.lib.json`, (tsConfig) => ({\n ...tsConfig,\n references: mergeTsReferences(tsConfig.references, [\n {\n path: `${path.relative(\n libraryRoot,\n `${tree.root}/${PACKAGES_DIR}`,\n )}/${SHARED_CONSTRUCTS_DIR}/tsconfig.lib.json`,\n },\n ...(stageConfig\n ? [\n {\n path: `${path.relative(\n libraryRoot,\n `${tree.root}/${PACKAGES_DIR}`,\n )}/${SHARED_INFRA_CONFIG_DIR}/tsconfig.json`,\n },\n ]\n : []),\n ]),\n }));\n\n await addGeneratorMetricsIfApplicable(tree, [INFRA_APP_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, schema.preferInstallDependencies, {\n languages: ['typescript'],\n });\n}\nexport default tsInfraGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readProjectConfiguration","updateJson","path","tsProjectGenerator","getTsLibDetails","mergeTsReferences","addTsDependencies","resolveContainers","declareDependencies","ownedElsewhere","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","esmVars","kebabCase","getNpmScopePrefix","addDependencyToTargetIfNotPresent","addGeneratorMetadata","getGeneratorInfo","projectExists","sortObjectKeys","getPackageManagerDisplayCommands","uvxCommand","SHARED_CONSTRUCTS_DEPENDENCIES","sharedConstructsGenerator","PACKAGES_DIR","SHARED_CONSTRUCTS_DIR","SHARED_INFRA_CONFIG_DIR","sharedInfraConfigGenerator","SHARED_INFRA_SCRIPTS_DEPENDENCIES","sharedInfraScriptsGenerator","DEPENDENCIES","ts","name","dev","root","INFRA_APP_GENERATOR_INFO","filename","tsInfraGenerator","tree","schema","lib","fullyQualifiedName","preferInstallDependencies","containers","cdkEnv","undefined","CDK_DOCKER","withCdkEnv","opts","existingEnv","env","iac","stageConfig","synthDirFromRoot","dir","synthDirFromProject","split","map","join","distDirFromProjectRoot","projectConfig","libraryRoot","npmScopePrefix","scopeAlias","namespace","sandboxStagePattern","delete","dirname","synthDir","pkgMgrCmd","exec","overwriteStrategy","Overwrite","config","projectType","targets","compile","outputs","synth","cache","executor","inputs","dependsOn","options","cwd","command","checkov","deploy","destroy","cdk","bootstrap","projectRoot","tsConfig","references","relative","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAEjBC,wBAAwB,EAExBC,UAAU,QACL,aAAa;AACpB,OAAOC,UAAU,OAAO;AACxB,OAAOC,sBAAsBC,eAAe,QAAQ,4BAA4B;AAChF,SAASC,iBAAiB,QAAQ,mCAAmC;AACrE,SAASC,iBAAiB,QAAQ,kCAAkC;AACpE,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SACEC,mBAAmB,EACnBC,cAAc,QACT,uCAAuC;AAC9C,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,OAAO,QAAQ,+BAA+B;AACvD,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,iBAAiB,QAAQ,2BAA2B;AAC7D,SACEC,iCAAiC,EACjCC,oBAAoB,EACpBC,gBAAgB,EAEhBC,aAAa,QACR,oBAAoB;AAC3B,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,gCAAgC,QAAQ,6BAA6B;AAC9E,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SACEC,8BAA8B,EAC9BC,yBAAyB,QACpB,mCAAmC;AAC1C,SACEC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,6CAA6C;AACpD,SAASC,0BAA0B,QAAQ,qCAAqC;AAChF,SACEC,iCAAiC,EACjCC,2BAA2B,QACtB,sCAAsC;AAG7C,6EAA6E;AAC7E,2EAA2E;AAC3E,kBAAkB;AAClB,OAAO,MAAMC,eAAevB,sBAAsB;IAChDwB,IAAI;QACF;YAAEC,MAAM;QAAc;QACtB;YAAEA,MAAM;QAAa;QACrB;YAAEA,MAAM;QAAqB;QAC7B,wEAAwE;QACxE;YAAEA,MAAM;YAAWC,KAAK;YAAMC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AC3B;AACJ;AACA,eAAe1D,iBAAiB"}
@@ -65,7 +65,7 @@ ${PACKAGE_MANAGERS.map((pm)=>buildNxCommand('<options>', pm)).join(' - \n')}
65
65
  - Generate all projects into the \`packages/\` directory
66
66
  - After making changes to your projects, fix linting issues, then run a full build
67
67
  - When it's time to start testing a project, suggest to the user that infrastructure is deployed to AWS. For websites, if a runtime-config.json is needed, use the load-runtime-config target after a deployment to point a local website at a sandbox stack.
68
- - For CDK infrastructure projects, deploy the sandbox stage with the \`deploy-sandbox\` target (eg \`nx deploy-sandbox infra\`) rather than passing a stage pattern to \`deploy\` — it already targets the sandbox stage declared in \`main.ts\`.
68
+ - For CDK infrastructure projects, deploy the sandbox stage with the \`deploy-sandbox\` target (eg \`nx deploy-sandbox infra\`) rather than passing a stage pattern to \`deploy\` — it already targets the sandbox stage declared in \`main.ts\`. Likewise \`destroy-sandbox\` tears that stage back down.
69
69
 
70
70
  ## Batching Generators
71
71
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/mcp-server/tools/general-guidance.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { NxGeneratorInfo } from '../../utils/generators.js';\nimport { IAC_PROVIDERS } from '../../utils/iac-providers.js';\nimport { buildNxCommand, fetchGuidePages } from '../generator-info.js';\nimport { PACKAGE_MANAGERS } from '../schema.js';\n\nexport const TOOL_SELECTION_GUIDE = `## Tool Selection Guide\n\n- Use the \\`general-guidance\\` tool for guidance and best practices for working with Nx and the Nx Plugin for AWS.\n- Use the \\`create-workspace-command\\` tool to discover how to create a workspace to start a new project.\n- Use the \\`add-to-existing-project\\` tool when adding the plugin to an existing Nx workspace or non-Nx monorepo, or when troubleshooting configuration errors in such a workspace.\n- Use the \\`upgrade-workspace\\` tool when upgrading Nx or the Nx Plugin for AWS to a newer version.\n- Use the \\`list-generators\\` tool to discover the available generators and how to run them.\n- Use the \\`generator-guide\\` tool to retrieve detailed information about a specific generator.`;\n\n/**\n * Add a tool which provides general guidance for using Nx and the Nx Plugin for AWS\n */\nexport const addGeneralGuidanceTool = (\n server: McpServer,\n generators: NxGeneratorInfo[],\n) => {\n server.registerTool(\n 'general-guidance',\n {\n title: 'General Guidance',\n description:\n 'Tool for guidance and best practices for working with Nx and the Nx Plugin for AWS',\n },\n async () => ({\n content: [\n {\n type: 'text' as const,\n text: `# Nx Plugin for AWS Guidance\n\n${TOOL_SELECTION_GUIDE}\n\n## Getting Started\n\n- Choose a package manager first. You can choose between ${PACKAGE_MANAGERS.join(', ')}. It's recommended to use \"pnpm\" if the user has no preference\n- Choose an infrastructure as code (IaC) provider next. You can choose between ${IAC_PROVIDERS.join(', ')}. It's recommended to use CDK if the user has no preference\n- Next, you must create an Nx workspace. Use the \\`create-workspace-command\\` tool for more details, and provide it with your chosen package manager\n- After this, you can start scaffolding the main components of your application using generators. Use the \\`list-generators\\` tool to discover available generators, and the \\`generator-guide\\` tool for more detailed information about a specific generator\n\n## Nx Primer\n\n- Prefix nx commands with the appropriate prefix for your package manager, for example:\n${PACKAGE_MANAGERS.map((pm) => buildNxCommand('<options>', pm)).join(' - \\n')}\n- Each project in your workspace has a file named \\`project.json\\` which contains important project information such as its name, and defines the \"targets\" which can be run for that project, for example building or testing the project\n- Use the command \\`nx reset\\` to reset the Nx daemon when unexpected issues arise\n- After adding dependencies between TypeScript projects, use \\`nx sync\\` to ensure project references are set up correctly\n\n## General Instructions\n\n- Each project declares the third-party runtime dependencies its source imports in its own \\`package.json\\`; shared build/test tooling (test runners, bundlers, etc.) is declared in the root \\`package.json\\` \\`devDependencies\\`. Versions follow a single version policy, recorded in the package manager's dependency catalog where supported (referenced as \\`catalog:\\`). Install with the appropriate command for your package manager:\n - Add a project runtime dependency: \\`pnpm add <package> --filter <project>\\` / \\`yarn workspace <project> add <package>\\` / \\`npm install <package> -w <project>\\` / \\`bun add <package> --cwd <project-directory>\\`\n - Add a shared dev tool at the root: \\`pnpm add -Dw <package>\\` / \\`yarn add -D <package>\\` / \\`npm install --legacy-peer-deps -D <package>\\` / \\`bun install -D <package>\\`\n- The \\`noUndeclaredDependencies\\` lint rule enforces that a project's source only imports packages declared in its own \\`package.json\\`\n- Projects in the same workspace can import one another directly by package name (eg \\`@workspace-name/project-name\\`) without declaring a dependency in \\`package.json\\` — TypeScript path aliases in \\`tsconfig.base.json\\` resolve these imports\n- When specifying project names as arguments to generators, prefer the _fully qualified_ project name, for example \\`@workspace-name/project-name\\`. Check the \\`project.json\\` file for the specific package to find its fully qualified name\n- When no generator exists for a specific framework required, use the base \\`ts#project\\` and \\`py#project\\` generators and build on top.\n- Leave the \\`--infra\\` option at its default value unless the user has explicitly instructed otherwise. Generators choose a sensible default type of infrastructure to deploy the project with, so only override \\`--infra\\` when the user has specified a particular requirement.\n\n## Useful Commands\n\n- Fix lint issues with \\`nx run-many --target lint --configuration=fix --all --output-style=stream\\`\n- Build all projects with \\`nx run-many --target build --all --output-style=stream\\`\n- Prefer importing the CDK constructs vended by generators in \\`packages/common/constructs\\` over writing your own\n\n## Best Practices\n\n- After running a generator, use the \\`nx show projects\\` command to check which projects have been added (if any)\n- Carefully examine the files that have been generated and always refer back to the generator guide when working in a generated project\n- Generate all projects into the \\`packages/\\` directory\n- After making changes to your projects, fix linting issues, then run a full build\n- When it's time to start testing a project, suggest to the user that infrastructure is deployed to AWS. For websites, if a runtime-config.json is needed, use the load-runtime-config target after a deployment to point a local website at a sandbox stack.\n- For CDK infrastructure projects, deploy the sandbox stage with the \\`deploy-sandbox\\` target (eg \\`nx deploy-sandbox infra\\`) rather than passing a stage pattern to \\`deploy\\` — it already targets the sandbox stage declared in \\`main.ts\\`.\n\n## Batching Generators\n\nWhen scaffolding several projects in one go, chain generators to avoid a slow dependency install after every generator:\n\n- **Chain generators** with \\`&&\\` in a single command. Pass \\`--prefer-install-dependencies=false\\` on each generator except the last so dependencies install once at the end, for example:\n\n${PACKAGE_MANAGERS.map(\n (pm) => ` \\`\\`\\`bash\n ${buildNxCommand('g @aws/nx-plugin:ts#trpc-api --no-interactive --name=my-app-api --auth=iam --prefer-install-dependencies=false', pm)} && \\\\\n ${buildNxCommand('g @aws/nx-plugin:ts#react-website --no-interactive --name=my-app-website --prefer-install-dependencies=false', pm)} && \\\\\n ${buildNxCommand('g @aws/nx-plugin:connection --no-interactive --sourceProject=@my-app/my-app-website --targetProject=@my-app/my-app-api --prefer-install-dependencies=false', pm)} && \\\\\n ${buildNxCommand('g @aws/nx-plugin:ts#infra --no-interactive --name=infra', pm)} && \\\\\n ${buildNxCommand('sync', pm)}\n \\`\\`\\``,\n).join('\\n')}\n\n- **\\`--prefer-install-dependencies=false\\`** asks a generator to defer its dependency install so the batch installs once at the end (the final generator above omits the flag and installs everything).\n- **\\`nx sync\\`** is required before building — generators modify TypeScript project references.\n\n## Detailed Guides\n\nPlease refer to the below documentation for important details regarding workspaces and working with TypeScript or Python projects.\n\n${await fetchGuidePages(['workspace', 'typescript-project', 'python-project'], generators)}\n\n `,\n },\n ],\n }),\n );\n};\n"],"names":["IAC_PROVIDERS","buildNxCommand","fetchGuidePages","PACKAGE_MANAGERS","TOOL_SELECTION_GUIDE","addGeneralGuidanceTool","server","generators","registerTool","title","description","content","type","text","join","map","pm"],"mappings":"AAAA;;;CAGC,GAGD,SAASA,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,cAAc,EAAEC,eAAe,QAAQ,uBAAuB;AACvE,SAASC,gBAAgB,QAAQ,eAAe;AAEhD,OAAO,MAAMC,uBAAuB,CAAC;;;;;;;+FAO0D,CAAC,CAAC;AAEjG;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CACpCC,QACAC;IAEAD,OAAOE,YAAY,CACjB,oBACA;QACEC,OAAO;QACPC,aACE;IACJ,GACA,UAAa,CAAA;YACXC,SAAS;gBACP;oBACEC,MAAM;oBACNC,MAAM,CAAC;;AAEjB,EAAET,qBAAqB;;;;yDAIkC,EAAED,iBAAiBW,IAAI,CAAC,MAAM;+EACR,EAAEd,cAAcc,IAAI,CAAC,MAAM;;;;;;;AAO1G,EAAEX,iBAAiBY,GAAG,CAAC,CAACC,KAAOf,eAAe,aAAae,KAAKF,IAAI,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqC9E,EAAEX,iBAAiBY,GAAG,CACpB,CAACC,KAAO,CAAC;EACT,EAAEf,eAAe,kHAAkHe,IAAI;IACrI,EAAEf,eAAe,gHAAgHe,IAAI;IACrI,EAAEf,eAAe,8JAA8Je,IAAI;IACnL,EAAEf,eAAe,2DAA2De,IAAI;IAChF,EAAEf,eAAe,QAAQe,IAAI;QACzB,CAAC,EACPF,IAAI,CAAC,MAAM;;;;;;;;;AASb,EAAE,MAAMZ,gBAAgB;wBAAC;wBAAa;wBAAsB;qBAAiB,EAAEK,YAAY;;IAEvF,CAAC;gBACG;aACD;QACH,CAAA;AAEJ,EAAE"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/mcp-server/tools/general-guidance.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { NxGeneratorInfo } from '../../utils/generators.js';\nimport { IAC_PROVIDERS } from '../../utils/iac-providers.js';\nimport { buildNxCommand, fetchGuidePages } from '../generator-info.js';\nimport { PACKAGE_MANAGERS } from '../schema.js';\n\nexport const TOOL_SELECTION_GUIDE = `## Tool Selection Guide\n\n- Use the \\`general-guidance\\` tool for guidance and best practices for working with Nx and the Nx Plugin for AWS.\n- Use the \\`create-workspace-command\\` tool to discover how to create a workspace to start a new project.\n- Use the \\`add-to-existing-project\\` tool when adding the plugin to an existing Nx workspace or non-Nx monorepo, or when troubleshooting configuration errors in such a workspace.\n- Use the \\`upgrade-workspace\\` tool when upgrading Nx or the Nx Plugin for AWS to a newer version.\n- Use the \\`list-generators\\` tool to discover the available generators and how to run them.\n- Use the \\`generator-guide\\` tool to retrieve detailed information about a specific generator.`;\n\n/**\n * Add a tool which provides general guidance for using Nx and the Nx Plugin for AWS\n */\nexport const addGeneralGuidanceTool = (\n server: McpServer,\n generators: NxGeneratorInfo[],\n) => {\n server.registerTool(\n 'general-guidance',\n {\n title: 'General Guidance',\n description:\n 'Tool for guidance and best practices for working with Nx and the Nx Plugin for AWS',\n },\n async () => ({\n content: [\n {\n type: 'text' as const,\n text: `# Nx Plugin for AWS Guidance\n\n${TOOL_SELECTION_GUIDE}\n\n## Getting Started\n\n- Choose a package manager first. You can choose between ${PACKAGE_MANAGERS.join(', ')}. It's recommended to use \"pnpm\" if the user has no preference\n- Choose an infrastructure as code (IaC) provider next. You can choose between ${IAC_PROVIDERS.join(', ')}. It's recommended to use CDK if the user has no preference\n- Next, you must create an Nx workspace. Use the \\`create-workspace-command\\` tool for more details, and provide it with your chosen package manager\n- After this, you can start scaffolding the main components of your application using generators. Use the \\`list-generators\\` tool to discover available generators, and the \\`generator-guide\\` tool for more detailed information about a specific generator\n\n## Nx Primer\n\n- Prefix nx commands with the appropriate prefix for your package manager, for example:\n${PACKAGE_MANAGERS.map((pm) => buildNxCommand('<options>', pm)).join(' - \\n')}\n- Each project in your workspace has a file named \\`project.json\\` which contains important project information such as its name, and defines the \"targets\" which can be run for that project, for example building or testing the project\n- Use the command \\`nx reset\\` to reset the Nx daemon when unexpected issues arise\n- After adding dependencies between TypeScript projects, use \\`nx sync\\` to ensure project references are set up correctly\n\n## General Instructions\n\n- Each project declares the third-party runtime dependencies its source imports in its own \\`package.json\\`; shared build/test tooling (test runners, bundlers, etc.) is declared in the root \\`package.json\\` \\`devDependencies\\`. Versions follow a single version policy, recorded in the package manager's dependency catalog where supported (referenced as \\`catalog:\\`). Install with the appropriate command for your package manager:\n - Add a project runtime dependency: \\`pnpm add <package> --filter <project>\\` / \\`yarn workspace <project> add <package>\\` / \\`npm install <package> -w <project>\\` / \\`bun add <package> --cwd <project-directory>\\`\n - Add a shared dev tool at the root: \\`pnpm add -Dw <package>\\` / \\`yarn add -D <package>\\` / \\`npm install --legacy-peer-deps -D <package>\\` / \\`bun install -D <package>\\`\n- The \\`noUndeclaredDependencies\\` lint rule enforces that a project's source only imports packages declared in its own \\`package.json\\`\n- Projects in the same workspace can import one another directly by package name (eg \\`@workspace-name/project-name\\`) without declaring a dependency in \\`package.json\\` — TypeScript path aliases in \\`tsconfig.base.json\\` resolve these imports\n- When specifying project names as arguments to generators, prefer the _fully qualified_ project name, for example \\`@workspace-name/project-name\\`. Check the \\`project.json\\` file for the specific package to find its fully qualified name\n- When no generator exists for a specific framework required, use the base \\`ts#project\\` and \\`py#project\\` generators and build on top.\n- Leave the \\`--infra\\` option at its default value unless the user has explicitly instructed otherwise. Generators choose a sensible default type of infrastructure to deploy the project with, so only override \\`--infra\\` when the user has specified a particular requirement.\n\n## Useful Commands\n\n- Fix lint issues with \\`nx run-many --target lint --configuration=fix --all --output-style=stream\\`\n- Build all projects with \\`nx run-many --target build --all --output-style=stream\\`\n- Prefer importing the CDK constructs vended by generators in \\`packages/common/constructs\\` over writing your own\n\n## Best Practices\n\n- After running a generator, use the \\`nx show projects\\` command to check which projects have been added (if any)\n- Carefully examine the files that have been generated and always refer back to the generator guide when working in a generated project\n- Generate all projects into the \\`packages/\\` directory\n- After making changes to your projects, fix linting issues, then run a full build\n- When it's time to start testing a project, suggest to the user that infrastructure is deployed to AWS. For websites, if a runtime-config.json is needed, use the load-runtime-config target after a deployment to point a local website at a sandbox stack.\n- For CDK infrastructure projects, deploy the sandbox stage with the \\`deploy-sandbox\\` target (eg \\`nx deploy-sandbox infra\\`) rather than passing a stage pattern to \\`deploy\\` — it already targets the sandbox stage declared in \\`main.ts\\`. Likewise \\`destroy-sandbox\\` tears that stage back down.\n\n## Batching Generators\n\nWhen scaffolding several projects in one go, chain generators to avoid a slow dependency install after every generator:\n\n- **Chain generators** with \\`&&\\` in a single command. Pass \\`--prefer-install-dependencies=false\\` on each generator except the last so dependencies install once at the end, for example:\n\n${PACKAGE_MANAGERS.map(\n (pm) => ` \\`\\`\\`bash\n ${buildNxCommand('g @aws/nx-plugin:ts#trpc-api --no-interactive --name=my-app-api --auth=iam --prefer-install-dependencies=false', pm)} && \\\\\n ${buildNxCommand('g @aws/nx-plugin:ts#react-website --no-interactive --name=my-app-website --prefer-install-dependencies=false', pm)} && \\\\\n ${buildNxCommand('g @aws/nx-plugin:connection --no-interactive --sourceProject=@my-app/my-app-website --targetProject=@my-app/my-app-api --prefer-install-dependencies=false', pm)} && \\\\\n ${buildNxCommand('g @aws/nx-plugin:ts#infra --no-interactive --name=infra', pm)} && \\\\\n ${buildNxCommand('sync', pm)}\n \\`\\`\\``,\n).join('\\n')}\n\n- **\\`--prefer-install-dependencies=false\\`** asks a generator to defer its dependency install so the batch installs once at the end (the final generator above omits the flag and installs everything).\n- **\\`nx sync\\`** is required before building — generators modify TypeScript project references.\n\n## Detailed Guides\n\nPlease refer to the below documentation for important details regarding workspaces and working with TypeScript or Python projects.\n\n${await fetchGuidePages(['workspace', 'typescript-project', 'python-project'], generators)}\n\n `,\n },\n ],\n }),\n );\n};\n"],"names":["IAC_PROVIDERS","buildNxCommand","fetchGuidePages","PACKAGE_MANAGERS","TOOL_SELECTION_GUIDE","addGeneralGuidanceTool","server","generators","registerTool","title","description","content","type","text","join","map","pm"],"mappings":"AAAA;;;CAGC,GAGD,SAASA,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,cAAc,EAAEC,eAAe,QAAQ,uBAAuB;AACvE,SAASC,gBAAgB,QAAQ,eAAe;AAEhD,OAAO,MAAMC,uBAAuB,CAAC;;;;;;;+FAO0D,CAAC,CAAC;AAEjG;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CACpCC,QACAC;IAEAD,OAAOE,YAAY,CACjB,oBACA;QACEC,OAAO;QACPC,aACE;IACJ,GACA,UAAa,CAAA;YACXC,SAAS;gBACP;oBACEC,MAAM;oBACNC,MAAM,CAAC;;AAEjB,EAAET,qBAAqB;;;;yDAIkC,EAAED,iBAAiBW,IAAI,CAAC,MAAM;+EACR,EAAEd,cAAcc,IAAI,CAAC,MAAM;;;;;;;AAO1G,EAAEX,iBAAiBY,GAAG,CAAC,CAACC,KAAOf,eAAe,aAAae,KAAKF,IAAI,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqC9E,EAAEX,iBAAiBY,GAAG,CACpB,CAACC,KAAO,CAAC;EACT,EAAEf,eAAe,kHAAkHe,IAAI;IACrI,EAAEf,eAAe,gHAAgHe,IAAI;IACrI,EAAEf,eAAe,8JAA8Je,IAAI;IACnL,EAAEf,eAAe,2DAA2De,IAAI;IAChF,EAAEf,eAAe,QAAQe,IAAI;QACzB,CAAC,EACPF,IAAI,CAAC,MAAM;;;;;;;;;AASb,EAAE,MAAMZ,gBAAgB;wBAAC;wBAAa;wBAAsB;qBAAiB,EAAEK,YAAY;;IAEvF,CAAC;gBACG;aACD;QACH,CAAA;AAEJ,EAAE"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "description": "Add a destroy-sandbox target to CDK infrastructure projects which destroys the sandbox stage, and drop the --require-approval flag from cdk destroy, which has no such option"
3
+ }