@aws/nx-plugin 1.0.0-rc.96 → 1.0.0-rc.98

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 (313) hide show
  1. package/LICENSE-THIRD-PARTY +9 -9
  2. package/migrations.json +124 -84
  3. package/package.json +3 -3
  4. package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +2 -2
  5. package/src/agentcore-gateway/generator.js +6 -0
  6. package/src/agentcore-gateway/generator.js.map +1 -1
  7. package/src/agentcore-gateway/react-connection/__snapshots__/generator.spec.ts.snap +4 -1
  8. package/src/agentcore-harness/__snapshots__/generator.spec.ts.snap +68 -4
  9. package/src/agentcore-harness/generator.js +6 -0
  10. package/src/agentcore-harness/generator.js.map +1 -1
  11. package/src/connection/gateway-runtime-config.js +1 -1
  12. package/src/connection/gateway-runtime-config.js.map +1 -1
  13. package/src/infra/app/__snapshots__/generator.spec.ts.snap +10 -10
  14. package/src/infra/app/generator.js +39 -9
  15. package/src/infra/app/generator.js.map +1 -1
  16. package/src/init/generator.d.ts +1 -1
  17. package/src/init/generator.js +8 -6
  18. package/src/init/generator.js.map +1 -1
  19. package/src/init/schema.d.js.map +1 -1
  20. package/src/init/schema.d.ts +1 -0
  21. package/src/init/schema.json +5 -0
  22. package/src/internal/test-matrix/generator.js +2 -2
  23. package/src/internal/test-matrix/generator.js.map +1 -1
  24. package/src/license/sync/generator.d.ts +10 -0
  25. package/src/license/sync/generator.js +1 -1
  26. package/src/license/sync/generator.js.map +1 -1
  27. package/src/mcp-server/server.js +2 -0
  28. package/src/mcp-server/server.js.map +1 -1
  29. package/src/mcp-server/tools/best-practices.d.ts +28 -0
  30. package/src/mcp-server/tools/best-practices.js +43 -0
  31. package/src/mcp-server/tools/best-practices.js.map +1 -0
  32. package/src/mcp-server/tools/general-guidance.d.ts +1 -1
  33. package/src/mcp-server/tools/general-guidance.js +13 -4
  34. package/src/mcp-server/tools/general-guidance.js.map +1 -1
  35. package/src/migrations/latest/sandbox-pattern-nested-stacks/metadata.json +3 -0
  36. package/src/migrations/latest/sandbox-pattern-nested-stacks/migration.js +68 -0
  37. package/src/migrations/latest/sandbox-pattern-nested-stacks/migration.js.map +1 -0
  38. package/src/migrations/latest/shadcn-cn-package/metadata.json +3 -0
  39. package/src/migrations/latest/shadcn-cn-package/migration.js +114 -0
  40. package/src/migrations/latest/shadcn-cn-package/migration.js.map +1 -0
  41. package/src/migrations/v1.0.0-rc.90/0001-dev-target-depends-on-pull-image/migration.js.map +1 -0
  42. package/src/migrations/v1.0.0-rc.90/0002-open-api-codegen-executor/migration.js.map +1 -0
  43. package/src/migrations/v1.0.0-rc.90/0003-terraform-provider-plugin-cache/migration.js.map +1 -0
  44. package/src/migrations/v1.0.0-rc.90/0004-python-test-input-scoping/migration.js.map +1 -0
  45. package/src/migrations/v1.0.0-rc.90/0005-vitest-coverage-output-dir/migration.js.map +1 -0
  46. package/src/migrations/v1.0.0-rc.90/0006-add-assemble-target/migration.js.map +1 -0
  47. package/src/migrations/v1.0.0-rc.90/0007-docker-target-cache-soundness/migration.js.map +1 -0
  48. package/src/migrations/v1.0.0-rc.90/0008-declare-cacheable-target-inputs/migration.js.map +1 -0
  49. package/src/migrations/v1.0.0-rc.90/0009-terraform-fmt-check/migration.js.map +1 -0
  50. package/src/migrations/v1.0.0-rc.92/0001-react-website-unique-dev-ports/migration.js.map +1 -0
  51. package/src/migrations/v1.0.0-rc.94/0001-infra-deploy-express-mode/metadata.json +3 -0
  52. package/src/migrations/{latest/infra-deploy-express-mode → v1.0.0-rc.94/0001-infra-deploy-express-mode}/migration.js +26 -28
  53. package/src/migrations/v1.0.0-rc.94/0001-infra-deploy-express-mode/migration.js.map +1 -0
  54. package/src/migrations/v1.0.0-rc.94/0002-shx-fs-commands/migration.js.map +1 -0
  55. package/src/migrations/v1.0.0-rc.94/0003-agent-core-vendor-target/migration.js.map +1 -0
  56. package/src/migrations/v1.0.0-rc.95/0001-rolldown-config-bundle-transient/migration.d.ts +6 -0
  57. package/src/migrations/v1.0.0-rc.95/0001-rolldown-config-bundle-transient/migration.js.map +1 -0
  58. package/src/migrations/v1.0.0-rc.95/0002-agent-connection-pin-strands-peers/migration.js.map +1 -0
  59. package/src/migrations/v1.0.0-rc.95/0003-ignore-package-manager-temp-files/migration.js.map +1 -0
  60. package/src/migrations/v1.0.0-rc.95/0004-shadcn-package-imports-exports/migration.d.ts +6 -0
  61. package/src/migrations/v1.0.0-rc.95/0004-shadcn-package-imports-exports/migration.js.map +1 -0
  62. package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/__snapshots__/migration.spec.ts.snap +84 -0
  63. package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/metadata.json +3 -0
  64. package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/migration.d.ts +6 -0
  65. package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/migration.js +94 -0
  66. package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/migration.js.map +1 -0
  67. package/src/migrations/v1.0.0-rc.97/0002-checkov-scan-cache-inputs/metadata.json +3 -0
  68. package/src/migrations/v1.0.0-rc.97/0002-checkov-scan-cache-inputs/migration.d.ts +6 -0
  69. package/src/migrations/v1.0.0-rc.97/0002-checkov-scan-cache-inputs/migration.js +58 -0
  70. package/src/migrations/v1.0.0-rc.97/0002-checkov-scan-cache-inputs/migration.js.map +1 -0
  71. package/src/migrations/v1.0.0-rc.97/0003-terraform-validate-without-backend/metadata.json +3 -0
  72. package/src/migrations/v1.0.0-rc.97/0003-terraform-validate-without-backend/migration.d.ts +6 -0
  73. package/src/migrations/v1.0.0-rc.97/0003-terraform-validate-without-backend/migration.js +84 -0
  74. package/src/migrations/v1.0.0-rc.97/0003-terraform-validate-without-backend/migration.js.map +1 -0
  75. package/src/migrations/v1.0.0-rc.97/0004-py-lambda-powertools-context/metadata.json +3 -0
  76. package/src/migrations/v1.0.0-rc.97/0004-py-lambda-powertools-context/migration.d.ts +6 -0
  77. package/src/migrations/v1.0.0-rc.97/0004-py-lambda-powertools-context/migration.js +58 -0
  78. package/src/migrations/v1.0.0-rc.97/0004-py-lambda-powertools-context/migration.js.map +1 -0
  79. package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/__snapshots__/migration.spec.ts.snap +25 -0
  80. package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/metadata.json +3 -0
  81. package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/migration.d.ts +28 -0
  82. package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/migration.js +75 -0
  83. package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/migration.js.map +1 -0
  84. package/src/migrations/v1.0.0-rc.97/0006-script-project-quality-gates/metadata.json +3 -0
  85. package/src/migrations/v1.0.0-rc.97/0006-script-project-quality-gates/migration.d.ts +6 -0
  86. package/src/migrations/v1.0.0-rc.97/0006-script-project-quality-gates/migration.js +53 -0
  87. package/src/migrations/v1.0.0-rc.97/0006-script-project-quality-gates/migration.js.map +1 -0
  88. package/src/preset/__snapshots__/generator.spec.ts.snap +2 -2
  89. package/src/preset/generator.js +4 -25
  90. package/src/preset/generator.js.map +1 -1
  91. package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +2 -2
  92. package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +4 -4
  93. package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +4 -4
  94. package/src/py/agent/a2a-connection/generator.d.ts +1 -1
  95. package/src/py/agent/gateway-connection/generator.d.ts +1 -1
  96. package/src/py/agent/mcp-connection/generator.d.ts +1 -1
  97. package/src/py/agent/react-connection/__snapshots__/generator.spec.ts.snap +4 -1
  98. package/src/py/agent/react-connection/generator.d.ts +1 -7
  99. package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +10 -12
  100. package/src/py/dynamodb/generator.js +34 -7
  101. package/src/py/dynamodb/generator.js.map +1 -1
  102. package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
  103. package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +4 -3
  104. package/src/py/lambda-function/files/handler/__lambdaFunctionSnakeCase__.py.template +2 -1
  105. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +3 -3
  106. package/src/py/project/schema.json +3 -1
  107. package/src/py/rdb/__snapshots__/generator.spec.ts.snap +31 -15
  108. package/src/py/rdb/files/Dockerfile.create-db-user.template +7 -3
  109. package/src/py/rdb/files/Dockerfile.migration.template +7 -3
  110. package/src/py/rdb/generator.js +29 -28
  111. package/src/py/rdb/generator.js.map +1 -1
  112. package/src/smithy/project/__snapshots__/generator.spec.ts.snap +5 -5
  113. package/src/smithy/react-connection/files/model/extensions.smithy.template +3 -3
  114. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +8 -8
  115. package/src/smithy/ts/api/generator.js +7 -2
  116. package/src/smithy/ts/api/generator.js.map +1 -1
  117. package/src/terraform/project/generator.js +34 -10
  118. package/src/terraform/project/generator.js.map +1 -1
  119. package/src/terraform/project/schema.d.js +0 -3
  120. package/src/terraform/project/schema.d.js.map +1 -1
  121. package/src/terraform/project/schema.d.ts +0 -4
  122. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
  123. package/src/trpc/backend/generator.js +7 -1
  124. package/src/trpc/backend/generator.js.map +1 -1
  125. package/src/trpc/react/generator.js +6 -0
  126. package/src/trpc/react/generator.js.map +1 -1
  127. package/src/ts/agent/__snapshots__/generator.spec.ts.snap +4 -4
  128. package/src/ts/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +2 -2
  129. package/src/ts/agent/gateway-connection/__snapshots__/generator.spec.ts.snap +2 -2
  130. package/src/ts/agent/generator.js +3 -3
  131. package/src/ts/agent/generator.js.map +1 -1
  132. package/src/ts/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +2 -2
  133. package/src/ts/agent/react-connection/generator.d.ts +1 -9
  134. package/src/ts/astro-docs/files/translation/scripts/translate.ts.template +47 -2
  135. package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +1 -1
  136. package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +6 -4
  137. package/src/ts/dynamodb/generator.js +30 -6
  138. package/src/ts/dynamodb/generator.js.map +1 -1
  139. package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
  140. package/src/ts/lib/biome.d.ts +15 -1
  141. package/src/ts/lib/biome.js +79 -63
  142. package/src/ts/lib/biome.js.map +1 -1
  143. package/src/ts/lib/generator.js +11 -7
  144. package/src/ts/lib/generator.js.map +1 -1
  145. package/src/ts/lib/ts-project-utils.d.ts +14 -0
  146. package/src/ts/lib/ts-project-utils.js +24 -0
  147. package/src/ts/lib/ts-project-utils.js.map +1 -1
  148. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +3 -3
  149. package/src/ts/mcp-server/files/app/http.ts.template +1 -1
  150. package/src/ts/mcp-server/generator.js +3 -3
  151. package/src/ts/mcp-server/generator.js.map +1 -1
  152. package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +2 -2
  153. package/src/ts/nx-generator/files/local/generator.spec.ts.template +2 -2
  154. package/src/ts/nx-migration/generator.js +3 -1
  155. package/src/ts/nx-migration/generator.js.map +1 -1
  156. package/src/ts/nx-plugin/__snapshots__/generator.spec.ts.snap +1 -25
  157. package/src/ts/nx-plugin/generator.js +19 -17
  158. package/src/ts/nx-plugin/generator.js.map +1 -1
  159. package/src/ts/nx-plugin/utils.d.ts +21 -0
  160. package/src/ts/nx-plugin/utils.js +41 -1
  161. package/src/ts/nx-plugin/utils.js.map +1 -1
  162. package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +13 -8
  163. package/src/ts/rdb/files/Dockerfile.template +5 -0
  164. package/src/ts/rdb/generator.d.ts +8 -0
  165. package/src/ts/rdb/generator.js +28 -24
  166. package/src/ts/rdb/generator.js.map +1 -1
  167. package/src/ts/rdb/trpc-connection/__snapshots__/generator.spec.ts.snap +39 -0
  168. package/src/ts/rdb/trpc-connection/generator.js +13 -0
  169. package/src/ts/rdb/trpc-connection/generator.js.map +1 -1
  170. package/src/ts/react-website/agui/files/common/src/components/__agentNameKebabCase__-chat.tsx.template +9 -0
  171. package/src/ts/react-website/agui/files/common/src/hooks/useAgui__agentNameClassName__.tsx.template +4 -1
  172. package/src/ts/react-website/agui/generator.d.ts +1 -5
  173. package/src/ts/react-website/agui/generator.js +6 -2
  174. package/src/ts/react-website/agui/generator.js.map +1 -1
  175. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +26 -26
  176. package/src/ts/react-website/app/generator.d.ts +1 -5
  177. package/src/ts/react-website/app/generator.js +3 -8
  178. package/src/ts/react-website/app/generator.js.map +1 -1
  179. package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
  180. package/src/utils/agent-connection/agent-connection.d.ts +2 -1
  181. package/src/utils/agent-connection/agent-connection.js +6 -1
  182. package/src/utils/agent-connection/agent-connection.js.map +1 -1
  183. package/src/utils/agent-core-constructs/files/cdk/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.ts.template +11 -7
  184. package/src/utils/agent-core-constructs/files/cdk/core/agentcore-gateway/agentcore-gateway.ts.template +14 -6
  185. package/src/utils/agent-core-packaging.js +5 -5
  186. package/src/utils/agent-core-packaging.js.map +1 -1
  187. package/src/utils/api-constructs/api-constructs.d.ts +5 -0
  188. package/src/utils/api-constructs/api-constructs.js +8 -0
  189. package/src/utils/api-constructs/api-constructs.js.map +1 -1
  190. package/src/utils/api-constructs/files/cdk/app/apis/http/__apiNameKebabCase__.ts.template +4 -2
  191. package/src/utils/api-constructs/files/cdk/app/apis/rest/__apiNameKebabCase__.ts.template +4 -2
  192. package/src/utils/ast.d.ts +10 -0
  193. package/src/utils/ast.js +87 -15
  194. package/src/utils/ast.js.map +1 -1
  195. package/src/utils/dependencies.d.ts +10 -0
  196. package/src/utils/dependencies.js +93 -1
  197. package/src/utils/dependencies.js.map +1 -1
  198. package/src/utils/docker.d.ts +11 -0
  199. package/src/utils/docker.js +16 -3
  200. package/src/utils/docker.js.map +1 -1
  201. package/src/utils/dynamodb-config.d.ts +48 -0
  202. package/src/utils/dynamodb-config.js +44 -0
  203. package/src/utils/dynamodb-config.js.map +1 -0
  204. package/src/utils/dynamodb-constructs/files/cdk/app/dynamodb/__nameKebabCase__.ts.template +8 -4
  205. package/src/utils/files/common/shadcn/src/components/ui/alert.tsx.template +1 -2
  206. package/src/utils/files/common/shadcn/src/components/ui/avatar.tsx.template +1 -2
  207. package/src/utils/files/common/shadcn/src/components/ui/breadcrumb.tsx.template +1 -2
  208. package/src/utils/files/common/shadcn/src/components/ui/button.tsx.template +1 -2
  209. package/src/utils/files/common/shadcn/src/components/ui/card.tsx.template +1 -2
  210. package/src/utils/files/common/shadcn/src/components/ui/input.tsx.template +1 -2
  211. package/src/utils/files/common/shadcn/src/components/ui/separator.tsx.template +1 -2
  212. package/src/utils/files/common/shadcn/src/components/ui/sheet.tsx.template +1 -2
  213. package/src/utils/files/common/shadcn/src/components/ui/sidebar.tsx.template +1 -1
  214. package/src/utils/files/common/shadcn/src/components/ui/skeleton.tsx.template +1 -1
  215. package/src/utils/files/common/shadcn/src/components/ui/spinner.tsx.template +1 -2
  216. package/src/utils/files/common/shadcn/src/components/ui/textarea.tsx.template +1 -2
  217. package/src/utils/files/common/shadcn/src/components/ui/tooltip.tsx.template +1 -2
  218. package/src/utils/files/common/shadcn/src/lib/utils.ts.template +1 -6
  219. package/src/utils/git-secrets.d.ts +28 -0
  220. package/src/utils/git-secrets.js +66 -0
  221. package/src/utils/git-secrets.js.map +1 -0
  222. package/src/utils/init.js +7 -6
  223. package/src/utils/init.js.map +1 -1
  224. package/src/utils/local-project-dependency.d.ts +28 -0
  225. package/src/utils/local-project-dependency.js +40 -0
  226. package/src/utils/local-project-dependency.js.map +1 -0
  227. package/src/utils/nx.d.ts +14 -0
  228. package/src/utils/nx.js +30 -0
  229. package/src/utils/nx.js.map +1 -1
  230. package/src/utils/rdb-constructs/files/cdk/app/dbs/__nameKebabCase__.ts.template +11 -6
  231. package/src/utils/script-project-targets.d.ts +26 -0
  232. package/src/utils/script-project-targets.js +75 -0
  233. package/src/utils/script-project-targets.js.map +1 -0
  234. package/src/utils/shared-shadcn.d.ts +1 -3
  235. package/src/utils/shared-shadcn.js +1 -4
  236. package/src/utils/shared-shadcn.js.map +1 -1
  237. package/src/utils/versions.d.ts +52 -50
  238. package/src/utils/versions.js +55 -49
  239. package/src/utils/versions.js.map +1 -1
  240. package/src/utils/website-constructs/files/cdk/app/static-websites/__websiteNameKebabCase__.ts.template +8 -4
  241. package/src/migrations/latest/add-assemble-target/migration.js.map +0 -1
  242. package/src/migrations/latest/agent-connection-pin-strands-peers/migration.js.map +0 -1
  243. package/src/migrations/latest/agent-core-vendor-target/migration.js.map +0 -1
  244. package/src/migrations/latest/declare-cacheable-target-inputs/migration.js.map +0 -1
  245. package/src/migrations/latest/dev-target-depends-on-pull-image/migration.js.map +0 -1
  246. package/src/migrations/latest/docker-target-cache-soundness/migration.js.map +0 -1
  247. package/src/migrations/latest/ignore-package-manager-temp-files/migration.js.map +0 -1
  248. package/src/migrations/latest/infra-deploy-express-mode/metadata.json +0 -3
  249. package/src/migrations/latest/infra-deploy-express-mode/migration.js.map +0 -1
  250. package/src/migrations/latest/open-api-codegen-executor/migration.js.map +0 -1
  251. package/src/migrations/latest/python-test-input-scoping/migration.js.map +0 -1
  252. package/src/migrations/latest/react-website-unique-dev-ports/migration.js.map +0 -1
  253. package/src/migrations/latest/rolldown-config-bundle-transient/migration.js.map +0 -1
  254. package/src/migrations/latest/shadcn-package-imports-exports/migration.js.map +0 -1
  255. package/src/migrations/latest/shx-fs-commands/migration.js.map +0 -1
  256. package/src/migrations/latest/terraform-fmt-check/migration.js.map +0 -1
  257. package/src/migrations/latest/terraform-provider-plugin-cache/migration.js.map +0 -1
  258. package/src/migrations/latest/vitest-coverage-output-dir/migration.js.map +0 -1
  259. package/src/py/dynamodb/files/__name__/__init__.py.template +0 -6
  260. package/src/py/dynamodb/files/__name__/entities/__init__.py.template +0 -4
  261. package/src/py/dynamodb/files/config.json.template +0 -24
  262. package/src/ts/dynamodb/files/config.json.template +0 -24
  263. package/src/ts/dynamodb/files/src/entities/index.ts.template +0 -1
  264. package/src/ts/dynamodb/files/src/index.ts.template +0 -2
  265. /package/src/migrations/latest/{add-assemble-target → sandbox-pattern-nested-stacks}/migration.d.ts +0 -0
  266. /package/src/migrations/latest/{agent-core-vendor-target → shadcn-cn-package}/migration.d.ts +0 -0
  267. /package/src/migrations/{latest/dev-target-depends-on-pull-image → v1.0.0-rc.90/0001-dev-target-depends-on-pull-image}/metadata.json +0 -0
  268. /package/src/migrations/{latest/declare-cacheable-target-inputs → v1.0.0-rc.90/0001-dev-target-depends-on-pull-image}/migration.d.ts +0 -0
  269. /package/src/migrations/{latest/dev-target-depends-on-pull-image → v1.0.0-rc.90/0001-dev-target-depends-on-pull-image}/migration.js +0 -0
  270. /package/src/migrations/{latest/open-api-codegen-executor → v1.0.0-rc.90/0002-open-api-codegen-executor}/metadata.json +0 -0
  271. /package/src/migrations/{latest/dev-target-depends-on-pull-image → v1.0.0-rc.90/0002-open-api-codegen-executor}/migration.d.ts +0 -0
  272. /package/src/migrations/{latest/open-api-codegen-executor → v1.0.0-rc.90/0002-open-api-codegen-executor}/migration.js +0 -0
  273. /package/src/migrations/{latest/terraform-provider-plugin-cache → v1.0.0-rc.90/0003-terraform-provider-plugin-cache}/metadata.json +0 -0
  274. /package/src/migrations/{latest/docker-target-cache-soundness → v1.0.0-rc.90/0003-terraform-provider-plugin-cache}/migration.d.ts +0 -0
  275. /package/src/migrations/{latest/terraform-provider-plugin-cache → v1.0.0-rc.90/0003-terraform-provider-plugin-cache}/migration.js +0 -0
  276. /package/src/migrations/{latest/python-test-input-scoping → v1.0.0-rc.90/0004-python-test-input-scoping}/metadata.json +0 -0
  277. /package/src/migrations/{latest/infra-deploy-express-mode → v1.0.0-rc.90/0004-python-test-input-scoping}/migration.d.ts +0 -0
  278. /package/src/migrations/{latest/python-test-input-scoping → v1.0.0-rc.90/0004-python-test-input-scoping}/migration.js +0 -0
  279. /package/src/migrations/{latest/vitest-coverage-output-dir → v1.0.0-rc.90/0005-vitest-coverage-output-dir}/metadata.json +0 -0
  280. /package/src/migrations/{latest/open-api-codegen-executor → v1.0.0-rc.90/0005-vitest-coverage-output-dir}/migration.d.ts +0 -0
  281. /package/src/migrations/{latest/vitest-coverage-output-dir → v1.0.0-rc.90/0005-vitest-coverage-output-dir}/migration.js +0 -0
  282. /package/src/migrations/{latest/add-assemble-target → v1.0.0-rc.90/0006-add-assemble-target}/metadata.json +0 -0
  283. /package/src/migrations/{latest/python-test-input-scoping → v1.0.0-rc.90/0006-add-assemble-target}/migration.d.ts +0 -0
  284. /package/src/migrations/{latest/add-assemble-target → v1.0.0-rc.90/0006-add-assemble-target}/migration.js +0 -0
  285. /package/src/migrations/{latest/docker-target-cache-soundness → v1.0.0-rc.90/0007-docker-target-cache-soundness}/metadata.json +0 -0
  286. /package/src/migrations/{latest/react-website-unique-dev-ports → v1.0.0-rc.90/0007-docker-target-cache-soundness}/migration.d.ts +0 -0
  287. /package/src/migrations/{latest/docker-target-cache-soundness → v1.0.0-rc.90/0007-docker-target-cache-soundness}/migration.js +0 -0
  288. /package/src/migrations/{latest/declare-cacheable-target-inputs → v1.0.0-rc.90/0008-declare-cacheable-target-inputs}/metadata.json +0 -0
  289. /package/src/migrations/{latest/rolldown-config-bundle-transient → v1.0.0-rc.90/0008-declare-cacheable-target-inputs}/migration.d.ts +0 -0
  290. /package/src/migrations/{latest/declare-cacheable-target-inputs → v1.0.0-rc.90/0008-declare-cacheable-target-inputs}/migration.js +0 -0
  291. /package/src/migrations/{latest/terraform-fmt-check → v1.0.0-rc.90/0009-terraform-fmt-check}/metadata.json +0 -0
  292. /package/src/migrations/{latest/shadcn-package-imports-exports → v1.0.0-rc.90/0009-terraform-fmt-check}/migration.d.ts +0 -0
  293. /package/src/migrations/{latest/terraform-fmt-check → v1.0.0-rc.90/0009-terraform-fmt-check}/migration.js +0 -0
  294. /package/src/migrations/{latest/react-website-unique-dev-ports → v1.0.0-rc.92/0001-react-website-unique-dev-ports}/metadata.json +0 -0
  295. /package/src/migrations/{latest/shx-fs-commands → v1.0.0-rc.92/0001-react-website-unique-dev-ports}/migration.d.ts +0 -0
  296. /package/src/migrations/{latest/react-website-unique-dev-ports → v1.0.0-rc.92/0001-react-website-unique-dev-ports}/migration.js +0 -0
  297. /package/src/migrations/{latest/terraform-fmt-check → v1.0.0-rc.94/0001-infra-deploy-express-mode}/migration.d.ts +0 -0
  298. /package/src/migrations/{latest/shx-fs-commands → v1.0.0-rc.94/0002-shx-fs-commands}/metadata.json +0 -0
  299. /package/src/migrations/{latest/terraform-provider-plugin-cache → v1.0.0-rc.94/0002-shx-fs-commands}/migration.d.ts +0 -0
  300. /package/src/migrations/{latest/shx-fs-commands → v1.0.0-rc.94/0002-shx-fs-commands}/migration.js +0 -0
  301. /package/src/migrations/{latest/agent-core-vendor-target → v1.0.0-rc.94/0003-agent-core-vendor-target}/metadata.json +0 -0
  302. /package/src/migrations/{latest/vitest-coverage-output-dir → v1.0.0-rc.94/0003-agent-core-vendor-target}/migration.d.ts +0 -0
  303. /package/src/migrations/{latest/agent-core-vendor-target → v1.0.0-rc.94/0003-agent-core-vendor-target}/migration.js +0 -0
  304. /package/src/migrations/{latest/rolldown-config-bundle-transient → v1.0.0-rc.95/0001-rolldown-config-bundle-transient}/metadata.json +0 -0
  305. /package/src/migrations/{latest/rolldown-config-bundle-transient → v1.0.0-rc.95/0001-rolldown-config-bundle-transient}/migration.js +0 -0
  306. /package/src/migrations/{latest/agent-connection-pin-strands-peers → v1.0.0-rc.95/0002-agent-connection-pin-strands-peers}/metadata.json +0 -0
  307. /package/src/migrations/{latest/agent-connection-pin-strands-peers → v1.0.0-rc.95/0002-agent-connection-pin-strands-peers}/migration.d.ts +0 -0
  308. /package/src/migrations/{latest/agent-connection-pin-strands-peers → v1.0.0-rc.95/0002-agent-connection-pin-strands-peers}/migration.js +0 -0
  309. /package/src/migrations/{latest/ignore-package-manager-temp-files → v1.0.0-rc.95/0003-ignore-package-manager-temp-files}/metadata.json +0 -0
  310. /package/src/migrations/{latest/ignore-package-manager-temp-files → v1.0.0-rc.95/0003-ignore-package-manager-temp-files}/migration.d.ts +0 -0
  311. /package/src/migrations/{latest/ignore-package-manager-temp-files → v1.0.0-rc.95/0003-ignore-package-manager-temp-files}/migration.js +0 -0
  312. /package/src/migrations/{latest/shadcn-package-imports-exports → v1.0.0-rc.95/0004-shadcn-package-imports-exports}/metadata.json +0 -0
  313. /package/src/migrations/{latest/shadcn-package-imports-exports → v1.0.0-rc.95/0004-shadcn-package-imports-exports}/migration.js +0 -0
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */ import { getProjects, joinPathFragments, updateProjectConfiguration } from "@nx/devkit";
5
+ import { relative } from "path";
6
+ import { TERRAFORM_PROJECT_GENERATOR_INFO } from "../../../terraform/project/generator.js";
7
+ import { formatFilesInSubtree } from "../../../utils/format.js";
8
+ /**
9
+ * Run `validate` against a backendless `terraform init` of its own, so it works
10
+ * on a fresh workspace.
11
+ *
12
+ * It previously depended on the `init` target. On an application project that
13
+ * runs the vended `scripts/init.ts`, which configures the S3 backend and fails
14
+ * with a raw `NoSuchBucket` trace until `bootstrap` has created the state
15
+ * bucket — so the first target the guide invites the reader to try was
16
+ * unrunnable, while `lint`, `test` and `checkov` all worked.
17
+ *
18
+ * `-backend=false` installs the modules and providers validation needs without
19
+ * configuring the backend, exactly as `test` already does, so no credentials are
20
+ * involved. `TF_DATA_DIR` keeps that `.terraform` out of `src` so it never races
21
+ * the backend-configured targets over the shared one, and the shared plugin
22
+ * cache means the providers are linked rather than re-downloaded.
23
+ */ const VALIDATE_TARGET = 'validate';
24
+ /** The command the pre-fix target ran, on its own. */ const VENDED_COMMAND = 'terraform validate';
25
+ const divergedMessage = (projectName)=>`${projectName}:${VALIDATE_TARGET}: has diverged from the generated shape - left untouched. To run it before \`bootstrap\`, have it run \`terraform init -backend=false\` ahead of \`terraform validate\` rather than depending on the \`init\` target, which configures the S3 backend.`;
26
+ /** Path from a target running in `{projectRoot}/src` to the workspace root. */ const rootRelativePathFrom = (projectRoot)=>(relative(joinPathFragments(projectRoot, 'src'), '.') || '.').replace(/\\/g, '/');
27
+ /** Whether the target is the exact shape the pre-fix generator produced. */ const hasVendedShape = (target)=>target.executor === 'nx:run-commands' && target.options?.command === VENDED_COMMAND && !target.options?.commands && target.options?.cwd === '{projectRoot}/src' && target.dependsOn?.length === 1 && target.dependsOn[0] === 'init';
28
+ export default async function migration(tree) {
29
+ const nextSteps = [];
30
+ for (const [projectName, project] of getProjects(tree)){
31
+ const generator = project.metadata?.generator;
32
+ if (generator !== TERRAFORM_PROJECT_GENERATOR_INFO.id) continue;
33
+ const target = project.targets?.[VALIDATE_TARGET];
34
+ if (!target) continue;
35
+ // A target already running its own init needs nothing, which also makes a
36
+ // re-run — and a project generated after the fix — a no-op.
37
+ if (target.options?.env?.TF_DATA_DIR) continue;
38
+ if (!hasVendedShape(target)) {
39
+ nextSteps.push(divergedMessage(projectName));
40
+ continue;
41
+ }
42
+ const rootRelativePath = rootRelativePathFrom(project.root);
43
+ const pluginCacheDir = joinPathFragments(rootRelativePath, '.terraform', 'plugin-cache', '{projectRoot}').replace(/\\/g, '/');
44
+ const validateDataDir = joinPathFragments(rootRelativePath, 'dist', '{projectRoot}', 'terraform-validate').replace(/\\/g, '/');
45
+ const { command: _command, ...options } = target.options;
46
+ const { dependsOn: _dependsOn, ...rest } = target;
47
+ project.targets[VALIDATE_TARGET] = {
48
+ ...rest,
49
+ // `^production` mirrors `test`: validation resolves the relative modules a
50
+ // project consumes, so a change in one must invalidate it.
51
+ inputs: [
52
+ 'default',
53
+ '^production'
54
+ ],
55
+ // `TF_DATA_DIR` is terraform's working directory, not an artifact — its
56
+ // provider entries are symlinks into the shared plugin cache.
57
+ outputs: [],
58
+ options: {
59
+ ...options,
60
+ commands: [
61
+ {
62
+ command: `shx mkdir -p ${pluginCacheDir}`,
63
+ forwardAllArgs: false
64
+ },
65
+ 'terraform init -backend=false',
66
+ VENDED_COMMAND
67
+ ],
68
+ parallel: false,
69
+ env: {
70
+ ...options.env,
71
+ TF_DATA_DIR: validateDataDir,
72
+ TF_PLUGIN_CACHE_DIR: pluginCacheDir
73
+ }
74
+ }
75
+ };
76
+ updateProjectConfiguration(tree, projectName, project);
77
+ }
78
+ await formatFilesInSubtree(tree);
79
+ return {
80
+ nextSteps
81
+ };
82
+ }
83
+
84
+ //# sourceMappingURL=migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/v1.0.0-rc.97/0003-terraform-validate-without-backend/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n getProjects,\n joinPathFragments,\n type MigrationReturnObject,\n type ProjectConfiguration,\n type TargetConfiguration,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { relative } from 'path';\nimport { TERRAFORM_PROJECT_GENERATOR_INFO } from '../../../terraform/project/generator.js';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\n\n/**\n * Run `validate` against a backendless `terraform init` of its own, so it works\n * on a fresh workspace.\n *\n * It previously depended on the `init` target. On an application project that\n * runs the vended `scripts/init.ts`, which configures the S3 backend and fails\n * with a raw `NoSuchBucket` trace until `bootstrap` has created the state\n * bucket — so the first target the guide invites the reader to try was\n * unrunnable, while `lint`, `test` and `checkov` all worked.\n *\n * `-backend=false` installs the modules and providers validation needs without\n * configuring the backend, exactly as `test` already does, so no credentials are\n * involved. `TF_DATA_DIR` keeps that `.terraform` out of `src` so it never races\n * the backend-configured targets over the shared one, and the shared plugin\n * cache means the providers are linked rather than re-downloaded.\n */\n\nconst VALIDATE_TARGET = 'validate';\n\n/** The command the pre-fix target ran, on its own. */\nconst VENDED_COMMAND = 'terraform validate';\n\nconst divergedMessage = (projectName: string) =>\n `${projectName}:${VALIDATE_TARGET}: has diverged from the generated shape - left untouched. To run it before \\`bootstrap\\`, have it run \\`terraform init -backend=false\\` ahead of \\`terraform validate\\` rather than depending on the \\`init\\` target, which configures the S3 backend.`;\n\n/** Path from a target running in `{projectRoot}/src` to the workspace root. */\nconst rootRelativePathFrom = (projectRoot: string) =>\n (relative(joinPathFragments(projectRoot, 'src'), '.') || '.').replace(\n /\\\\/g,\n '/',\n );\n\n/** Whether the target is the exact shape the pre-fix generator produced. */\nconst hasVendedShape = (target: TargetConfiguration): boolean =>\n target.executor === 'nx:run-commands' &&\n target.options?.command === VENDED_COMMAND &&\n !target.options?.commands &&\n target.options?.cwd === '{projectRoot}/src' &&\n target.dependsOn?.length === 1 &&\n target.dependsOn[0] === 'init';\n\nexport default async function migration(\n tree: Tree,\n): Promise<MigrationReturnObject> {\n const nextSteps: string[] = [];\n\n for (const [projectName, project] of getProjects(tree)) {\n const generator = (project.metadata as { generator?: string } | undefined)\n ?.generator;\n if (generator !== TERRAFORM_PROJECT_GENERATOR_INFO.id) continue;\n\n const target = project.targets?.[VALIDATE_TARGET];\n if (!target) continue;\n\n // A target already running its own init needs nothing, which also makes a\n // re-run — and a project generated after the fix — a no-op.\n if (target.options?.env?.TF_DATA_DIR) continue;\n\n if (!hasVendedShape(target)) {\n nextSteps.push(divergedMessage(projectName));\n continue;\n }\n\n const rootRelativePath = rootRelativePathFrom(project.root);\n const pluginCacheDir = joinPathFragments(\n rootRelativePath,\n '.terraform',\n 'plugin-cache',\n '{projectRoot}',\n ).replace(/\\\\/g, '/');\n const validateDataDir = joinPathFragments(\n rootRelativePath,\n 'dist',\n '{projectRoot}',\n 'terraform-validate',\n ).replace(/\\\\/g, '/');\n\n const { command: _command, ...options } = target.options;\n const { dependsOn: _dependsOn, ...rest } = target;\n\n project.targets[VALIDATE_TARGET] = {\n ...rest,\n // `^production` mirrors `test`: validation resolves the relative modules a\n // project consumes, so a change in one must invalidate it.\n inputs: ['default', '^production'],\n // `TF_DATA_DIR` is terraform's working directory, not an artifact — its\n // provider entries are symlinks into the shared plugin cache.\n outputs: [],\n options: {\n ...options,\n commands: [\n { command: `shx mkdir -p ${pluginCacheDir}`, forwardAllArgs: false },\n 'terraform init -backend=false',\n VENDED_COMMAND,\n ],\n parallel: false,\n env: {\n ...options.env,\n TF_DATA_DIR: validateDataDir,\n TF_PLUGIN_CACHE_DIR: pluginCacheDir,\n },\n },\n };\n\n updateProjectConfiguration(\n tree,\n projectName,\n project as ProjectConfiguration,\n );\n }\n\n await formatFilesInSubtree(tree);\n\n return { nextSteps };\n}\n"],"names":["getProjects","joinPathFragments","updateProjectConfiguration","relative","TERRAFORM_PROJECT_GENERATOR_INFO","formatFilesInSubtree","VALIDATE_TARGET","VENDED_COMMAND","divergedMessage","projectName","rootRelativePathFrom","projectRoot","replace","hasVendedShape","target","executor","options","command","commands","cwd","dependsOn","length","migration","tree","nextSteps","project","generator","metadata","id","targets","env","TF_DATA_DIR","push","rootRelativePath","root","pluginCacheDir","validateDataDir","_command","_dependsOn","rest","inputs","outputs","forwardAllArgs","parallel","TF_PLUGIN_CACHE_DIR"],"mappings":"AAAA;;;CAGC,GACD,SACEA,WAAW,EACXC,iBAAiB,EAKjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,QAAQ,QAAQ,OAAO;AAChC,SAASC,gCAAgC,QAAQ,0CAA0C;AAC3F,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE;;;;;;;;;;;;;;;CAeC,GAED,MAAMC,kBAAkB;AAExB,oDAAoD,GACpD,MAAMC,iBAAiB;AAEvB,MAAMC,kBAAkB,CAACC,cACvB,GAAGA,YAAY,CAAC,EAAEH,gBAAgB,sPAAsP,CAAC;AAE3R,6EAA6E,GAC7E,MAAMI,uBA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AA2D;YAC3DC,QAAQ;gBAAC;gBAAW;aAAc;YAClC,wEAAwE;YACxE,8DAA8D;YAC9DC,SAAS,EAAE;YACXzB,SAAS;gBACP,GAAGA,OAAO;gBACVE,UAAU;oBACR;wBAAED,SAAS,CAAC,aAAa,EAAEkB,gBAAgB;wBAAEO,gBAAgB;oBAAM;oBACnE;oBACAnC;iBACD;gBACDoC,UAAU;gBACVb,KAAK;oBACH,GAAGd,QAAQc,GAAG;oBACdC,aAAaK;oBACbQ,qBAAqBT;gBACvB;YACF;QACF;QAEAjC,2BACEqB,MACAd,aACAgB;IAEJ;IAEA,MAAMpB,qBAAqBkB;IAE3B,OAAO;QAAEC;IAAU;AACrB"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "description": "Add powertools Lambda context injection and cold start metrics to Python Lambda handlers"
3
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { type MigrationReturnObject, type Tree } from '@nx/devkit';
6
+ export default function migration(tree: Tree): Promise<MigrationReturnObject>;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */ import { getProjects, joinPathFragments } from "@nx/devkit";
5
+ import { LAMBDA_FUNCTION_GENERATOR_INFO } from "../../../py/lambda-function/generator.js";
6
+ import { applyGritQL, matchGritQL } from "../../../utils/ast.js";
7
+ import { formatFilesInSubtree } from "../../../utils/format.js";
8
+ /**
9
+ * Wire powertools Lambda context injection and the cold start metric into
10
+ * handlers generated by py#lambda-function.
11
+ *
12
+ * `@logger.inject_lambda_context` is what annotates each log record with the
13
+ * function name, request id, memory size and cold start flag, and
14
+ * `capture_cold_start_metric` is what emits the `ColdStart` metric.
15
+ *
16
+ * Both rewrites are scoped to the decorator list of the `lambda_handler`
17
+ * definition, so a `@metrics.log_metrics` decorating another function in the
18
+ * same module is left alone.
19
+ */ const INJECT_CONTEXT = '@logger.inject_lambda_context';
20
+ const LOG_METRICS_OLD = '@metrics.log_metrics';
21
+ const LOG_METRICS_NEW = '@metrics.log_metrics(capture_cold_start_metric=True)';
22
+ const HANDLER_DECORATORS = (body)=>`language python
23
+ decorated_definition($decorators, $definition) where {
24
+ $definition <: contains \`lambda_handler\`,
25
+ ${body}
26
+ }`;
27
+ /** The shape the generator produces: a bare `log_metrics` below the tracer. */ const GENERATED_SHAPE = HANDLER_DECORATORS(`$decorators <: contains \`@tracer.capture_lambda_handler\`,
28
+ $decorators <: contains \`${LOG_METRICS_OLD}\``);
29
+ const ALREADY_MIGRATED = HANDLER_DECORATORS(`$decorators <: contains \`${INJECT_CONTEXT}\`,
30
+ $decorators <: contains \`${LOG_METRICS_NEW}\``);
31
+ const REWRITE = HANDLER_DECORATORS(`$decorators <: contains \`@tracer.capture_lambda_handler\` => raw\`@tracer.capture_lambda_handler
32
+ ${INJECT_CONTEXT}\`,
33
+ $decorators <: contains \`${LOG_METRICS_OLD}\` => \`${LOG_METRICS_NEW}\``);
34
+ const migrateHandler = async (tree, handlerPath, nextSteps)=>{
35
+ if (!tree.exists(handlerPath)) return;
36
+ if (await matchGritQL(tree, handlerPath, ALREADY_MIGRATED)) return;
37
+ if (!await matchGritQL(tree, handlerPath, GENERATED_SHAPE)) {
38
+ nextSteps.push(`${handlerPath}: diverged from the generated py#lambda-function shape - left untouched. To annotate logs with the Lambda context and emit a ColdStart metric, add \`${INJECT_CONTEXT}\` to the handler and change \`${LOG_METRICS_OLD}\` to \`${LOG_METRICS_NEW}\`.`);
39
+ return;
40
+ }
41
+ await applyGritQL(tree, handlerPath, REWRITE);
42
+ };
43
+ export default async function migration(tree) {
44
+ const nextSteps = [];
45
+ for (const project of getProjects(tree).values()){
46
+ const components = (project.metadata?.components ?? []).filter((component)=>component.generator === LAMBDA_FUNCTION_GENERATOR_INFO.id);
47
+ for (const component of components){
48
+ if (!component.path) continue;
49
+ await migrateHandler(tree, joinPathFragments(project.root, component.path), nextSteps);
50
+ }
51
+ }
52
+ await formatFilesInSubtree(tree);
53
+ return {
54
+ nextSteps
55
+ };
56
+ }
57
+
58
+ //# sourceMappingURL=migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/v1.0.0-rc.97/0004-py-lambda-powertools-context/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n getProjects,\n joinPathFragments,\n type MigrationReturnObject,\n type Tree,\n} from '@nx/devkit';\nimport { LAMBDA_FUNCTION_GENERATOR_INFO } from '../../../py/lambda-function/generator.js';\nimport { applyGritQL, matchGritQL } from '../../../utils/ast.js';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\nimport type { ComponentMetadata } from '../../../utils/nx.js';\n\n/**\n * Wire powertools Lambda context injection and the cold start metric into\n * handlers generated by py#lambda-function.\n *\n * `@logger.inject_lambda_context` is what annotates each log record with the\n * function name, request id, memory size and cold start flag, and\n * `capture_cold_start_metric` is what emits the `ColdStart` metric.\n *\n * Both rewrites are scoped to the decorator list of the `lambda_handler`\n * definition, so a `@metrics.log_metrics` decorating another function in the\n * same module is left alone.\n */\nconst INJECT_CONTEXT = '@logger.inject_lambda_context';\nconst LOG_METRICS_OLD = '@metrics.log_metrics';\nconst LOG_METRICS_NEW = '@metrics.log_metrics(capture_cold_start_metric=True)';\n\nconst HANDLER_DECORATORS = (body: string) => `language python\ndecorated_definition($decorators, $definition) where {\n $definition <: contains \\`lambda_handler\\`,\n ${body}\n}`;\n\n/** The shape the generator produces: a bare `log_metrics` below the tracer. */\nconst GENERATED_SHAPE =\n HANDLER_DECORATORS(`$decorators <: contains \\`@tracer.capture_lambda_handler\\`,\n $decorators <: contains \\`${LOG_METRICS_OLD}\\``);\n\nconst ALREADY_MIGRATED =\n HANDLER_DECORATORS(`$decorators <: contains \\`${INJECT_CONTEXT}\\`,\n $decorators <: contains \\`${LOG_METRICS_NEW}\\``);\n\nconst REWRITE =\n HANDLER_DECORATORS(`$decorators <: contains \\`@tracer.capture_lambda_handler\\` => raw\\`@tracer.capture_lambda_handler\n${INJECT_CONTEXT}\\`,\n $decorators <: contains \\`${LOG_METRICS_OLD}\\` => \\`${LOG_METRICS_NEW}\\``);\n\nconst migrateHandler = async (\n tree: Tree,\n handlerPath: string,\n nextSteps: string[],\n): Promise<void> => {\n if (!tree.exists(handlerPath)) return;\n\n if (await matchGritQL(tree, handlerPath, ALREADY_MIGRATED)) return;\n\n if (!(await matchGritQL(tree, handlerPath, GENERATED_SHAPE))) {\n nextSteps.push(\n `${handlerPath}: diverged from the generated py#lambda-function shape - left untouched. To annotate logs with the Lambda context and emit a ColdStart metric, add \\`${INJECT_CONTEXT}\\` to the handler and change \\`${LOG_METRICS_OLD}\\` to \\`${LOG_METRICS_NEW}\\`.`,\n );\n return;\n }\n\n await applyGritQL(tree, handlerPath, REWRITE);\n};\n\nexport default async function migration(\n tree: Tree,\n): Promise<MigrationReturnObject> {\n const nextSteps: string[] = [];\n\n for (const project of getProjects(tree).values()) {\n const components = (\n (project.metadata as { components?: ComponentMetadata[] })?.components ??\n []\n ).filter(\n (component) => component.generator === LAMBDA_FUNCTION_GENERATOR_INFO.id,\n );\n\n for (const component of components) {\n if (!component.path) continue;\n await migrateHandler(\n tree,\n joinPathFragments(project.root, component.path),\n nextSteps,\n );\n }\n }\n\n await formatFilesInSubtree(tree);\n\n return { nextSteps };\n}\n"],"names":["getProjects","joinPathFragments","LAMBDA_FUNCTION_GENERATOR_INFO","applyGritQL","matchGritQL","formatFilesInSubtree","INJECT_CONTEXT","LOG_METRICS_OLD","LOG_METRICS_NEW","HANDLER_DECORATORS","body","GENERATED_SHAPE","ALREADY_MIGRATED","REWRITE","migrateHandler","tree","handlerPath","nextSteps","exists","push","migration","project","values","components","metadata","filter","component","generator","id","path","root"],"mappings":"AAAA;;;CAGC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B,+BAA+B0B,EAAE;QAG1E,KAAK,MAAMF,aAAaH,WAAY;YAClC,IAAI,CAACG,UAAUG,IAAI,EAAE;YACrB,MAAMf,eACJC,MACAd,kBAAkBoB,QAAQS,IAAI,EAAEJ,UAAUG,IAAI,GAC9CZ;QAEJ;IACF;IAEA,MAAMZ,qBAAqBU;IAE3B,OAAO;QAAEE;IAAU;AACrB"}
@@ -0,0 +1,25 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`smithy-extension-trait-aliases migration > should alias every vended trait 1`] = `
4
+ "$version: "2.0"
5
+
6
+ namespace com.example
7
+
8
+ use smithy.openapi#specificationExtension
9
+
10
+ @trait
11
+ @specificationExtension(as: "x-query")
12
+ structure query {}
13
+
14
+ @trait
15
+ @specificationExtension(as: "x-mutation")
16
+ structure mutation {}
17
+
18
+ @trait
19
+ @specificationExtension(as: "x-cursor")
20
+ structure cursor {
21
+ inputToken: String
22
+ enabled: Boolean
23
+ }
24
+ "
25
+ `;
@@ -0,0 +1,3 @@
1
+ {
2
+ "description": "Alias the extensions.smithy vendor-extension traits so Smithy emits x-query / x-mutation / x-cursor"
3
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { type MigrationReturnObject, type Tree } from '@nx/devkit';
6
+ /**
7
+ * Give each trait in a Smithy model's `extensions.smithy` an explicit
8
+ * `@specificationExtension(as: "...")` alias.
9
+ *
10
+ * Without the alias Smithy derives the OpenAPI key from the trait's shape id and
11
+ * emits a namespace-prefixed key (`x-<namespace>-query`), which the client code
12
+ * generator does not read — so the `@query`, `@mutation` and `@cursor` traits
13
+ * have no effect on the generated client. The alias pins each key to the
14
+ * unprefixed name the generator recognises.
15
+ *
16
+ * How to write a migration:
17
+ * - https://nx.dev/docs/kb/migration-generators
18
+ * - What `nextSteps` means: https://nx.dev/docs/reference/devkit/MigrationReturnObject
19
+ *
20
+ * Guardrails:
21
+ * - Smithy IDL is not a language GritQL parses, so each edit is anchored to the
22
+ * exact `@trait` + `@specificationExtension` + `structure <name>` triple the
23
+ * generator vends.
24
+ * - A declaration that already carries an `as:` argument, or that has diverged
25
+ * from the vended shape, is left alone and reported via `nextSteps`.
26
+ * - Idempotent: an aliased declaration no longer matches the bare pattern.
27
+ */
28
+ export default function migration(tree: Tree): Promise<MigrationReturnObject>;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */ import { getProjects, joinPathFragments } from "@nx/devkit";
5
+ import { SMITHY_PROJECT_GENERATOR_INFO } from "../../../smithy/project/generator.js";
6
+ import { formatFilesInSubtree } from "../../../utils/format.js";
7
+ /** The traits the connection generator vends, each named after its OpenAPI key. */ const TRAITS = [
8
+ 'query',
9
+ 'mutation',
10
+ 'cursor'
11
+ ];
12
+ /**
13
+ * Matches a bare `@specificationExtension` applied to the named structure, with
14
+ * the `@trait` and `@specificationExtension` traits adjacent to the `structure`
15
+ * they annotate. A declaration that already carries an argument does not match.
16
+ */ const bareDeclaration = (trait)=>new RegExp(`(@trait\\s*\\n\\s*@specificationExtension)(\\s*\\n\\s*structure\\s+${trait}\\s*\\{)`);
17
+ /**
18
+ * Give each trait in a Smithy model's `extensions.smithy` an explicit
19
+ * `@specificationExtension(as: "...")` alias.
20
+ *
21
+ * Without the alias Smithy derives the OpenAPI key from the trait's shape id and
22
+ * emits a namespace-prefixed key (`x-<namespace>-query`), which the client code
23
+ * generator does not read — so the `@query`, `@mutation` and `@cursor` traits
24
+ * have no effect on the generated client. The alias pins each key to the
25
+ * unprefixed name the generator recognises.
26
+ *
27
+ * How to write a migration:
28
+ * - https://nx.dev/docs/kb/migration-generators
29
+ * - What `nextSteps` means: https://nx.dev/docs/reference/devkit/MigrationReturnObject
30
+ *
31
+ * Guardrails:
32
+ * - Smithy IDL is not a language GritQL parses, so each edit is anchored to the
33
+ * exact `@trait` + `@specificationExtension` + `structure <name>` triple the
34
+ * generator vends.
35
+ * - A declaration that already carries an `as:` argument, or that has diverged
36
+ * from the vended shape, is left alone and reported via `nextSteps`.
37
+ * - Idempotent: an aliased declaration no longer matches the bare pattern.
38
+ */ export default async function migration(tree) {
39
+ const nextSteps = [];
40
+ for (const [, project] of getProjects(tree)){
41
+ if ((project.metadata ?? {}).generator !== SMITHY_PROJECT_GENERATOR_INFO.id) {
42
+ continue;
43
+ }
44
+ const extensionsPath = joinPathFragments(project.sourceRoot ?? joinPathFragments(project.root, 'src'), 'extensions.smithy');
45
+ if (!tree.exists(extensionsPath)) {
46
+ continue;
47
+ }
48
+ const before = tree.read(extensionsPath, 'utf-8') ?? '';
49
+ let after = before;
50
+ const skipped = [];
51
+ for (const trait of TRAITS){
52
+ if (after.includes(`@specificationExtension(as: "x-${trait}")`)) {
53
+ continue;
54
+ }
55
+ const bare = bareDeclaration(trait);
56
+ if (!bare.test(after)) {
57
+ skipped.push(trait);
58
+ continue;
59
+ }
60
+ after = after.replace(bare, `$1(as: "x-${trait}")$2`);
61
+ }
62
+ if (after !== before) {
63
+ tree.write(extensionsPath, after);
64
+ }
65
+ if (skipped.length > 0) {
66
+ nextSteps.push(`${extensionsPath}: add ${skipped.map((trait)=>`\`(as: "x-${trait}")\``).join(', ')} to the \`@specificationExtension\` trait on ${skipped.map((trait)=>`\`${trait}\``).join(', ')}, so Smithy emits the ${skipped.map((trait)=>`\`x-${trait}\``).join(', ')} OpenAPI ${skipped.length === 1 ? 'key' : 'keys'} the client generator reads.`);
67
+ }
68
+ }
69
+ await formatFilesInSubtree(tree);
70
+ return {
71
+ nextSteps
72
+ };
73
+ }
74
+
75
+ //# sourceMappingURL=migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n getProjects,\n joinPathFragments,\n type MigrationReturnObject,\n type Tree,\n} from '@nx/devkit';\nimport { SMITHY_PROJECT_GENERATOR_INFO } from '../../../smithy/project/generator.js';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\n\n/** The traits the connection generator vends, each named after its OpenAPI key. */\nconst TRAITS = ['query', 'mutation', 'cursor'] as const;\n\n/**\n * Matches a bare `@specificationExtension` applied to the named structure, with\n * the `@trait` and `@specificationExtension` traits adjacent to the `structure`\n * they annotate. A declaration that already carries an argument does not match.\n */\nconst bareDeclaration = (trait: string) =>\n new RegExp(\n `(@trait\\\\s*\\\\n\\\\s*@specificationExtension)(\\\\s*\\\\n\\\\s*structure\\\\s+${trait}\\\\s*\\\\{)`,\n );\n\n/**\n * Give each trait in a Smithy model's `extensions.smithy` an explicit\n * `@specificationExtension(as: \"...\")` alias.\n *\n * Without the alias Smithy derives the OpenAPI key from the trait's shape id and\n * emits a namespace-prefixed key (`x-<namespace>-query`), which the client code\n * generator does not read — so the `@query`, `@mutation` and `@cursor` traits\n * have no effect on the generated client. The alias pins each key to the\n * unprefixed name the generator recognises.\n *\n * How to write a migration:\n * - https://nx.dev/docs/kb/migration-generators\n * - What `nextSteps` means: https://nx.dev/docs/reference/devkit/MigrationReturnObject\n *\n * Guardrails:\n * - Smithy IDL is not a language GritQL parses, so each edit is anchored to the\n * exact `@trait` + `@specificationExtension` + `structure <name>` triple the\n * generator vends.\n * - A declaration that already carries an `as:` argument, or that has diverged\n * from the vended shape, is left alone and reported via `nextSteps`.\n * - Idempotent: an aliased declaration no longer matches the bare pattern.\n */\nexport default async function migration(\n tree: Tree,\n): Promise<MigrationReturnObject> {\n const nextSteps: string[] = [];\n\n for (const [, project] of getProjects(tree)) {\n if (\n ((project.metadata as any) ?? {}).generator !==\n SMITHY_PROJECT_GENERATOR_INFO.id\n ) {\n continue;\n }\n\n const extensionsPath = joinPathFragments(\n project.sourceRoot ?? joinPathFragments(project.root, 'src'),\n 'extensions.smithy',\n );\n if (!tree.exists(extensionsPath)) {\n continue;\n }\n\n const before = tree.read(extensionsPath, 'utf-8') ?? '';\n let after = before;\n const skipped: string[] = [];\n\n for (const trait of TRAITS) {\n if (after.includes(`@specificationExtension(as: \"x-${trait}\")`)) {\n // Already aliased.\n continue;\n }\n const bare = bareDeclaration(trait);\n if (!bare.test(after)) {\n skipped.push(trait);\n continue;\n }\n after = after.replace(bare, `$1(as: \"x-${trait}\")$2`);\n }\n\n if (after !== before) {\n tree.write(extensionsPath, after);\n }\n\n if (skipped.length > 0) {\n nextSteps.push(\n `${extensionsPath}: add ${skipped\n .map((trait) => `\\`(as: \"x-${trait}\")\\``)\n .join(\n ', ',\n )} to the \\`@specificationExtension\\` trait on ${skipped.map((trait) => `\\`${trait}\\``).join(', ')}, so Smithy emits the ${skipped.map((trait) => `\\`x-${trait}\\``).join(', ')} OpenAPI ${skipped.length === 1 ? 'key' : 'keys'} the client generator reads.`,\n );\n }\n }\n\n await formatFilesInSubtree(tree);\n\n return { nextSteps };\n}\n"],"names":["getProjects","joinPathFragments","SMITHY_PROJECT_GENERATOR_INFO","formatFilesInSubtree","TRAITS","bareDeclaration","trait","RegExp","migration","tree","nextSteps","project","metadata","generator","id","extensionsPath","sourceRoot","root","exists","before","read","after","skipped","includes","bare","test","push","replace","write","length","map","join"],"mappings":"AAAA;;;CAGC,GACD,SACEA,WAAW,EACXC,iBAAiB,QAGZ,aAAa;AACpB,SAASC,6BAA6B,QAAQ,uCAAuC;AACrF,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,iFAAiF,GACjF,MAAMC,SAAS;IAAC;IAAS;IAAY;CAAS;AAE9C;;;;CAIC,GACD,MAAMC,kBAAkB,CAACC,QACvB,IAAIC,OACF,CAAC,mEAAmE,EAAED,MAAM,QAAQ,CAAC;AAGzF;;;;;;;;;;;;;;;;;;;;;CAqBC,GACD,eAAe,eAAeE,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AAE,CAAC,EAAEyB,IAAI,CAAC,MAAM,SAAS,EAAET,QAAQO,MAAM,KAAK,IAAI,QAAQ,OAAO,4BAA4B,CAAC;QAEnQ;IACF;IAEA,MAAM1B,qBAAqBM;IAE3B,OAAO;QAAEC;IAAU;AACrB"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "description": "Add build, lint, format and typecheck targets plus a tsconfig.json to AgentCore Gateway and Harness projects"
3
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { type MigrationReturnObject, type Tree } from '@nx/devkit';
6
+ export default function migration(tree: Tree): Promise<MigrationReturnObject>;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */ import { getProjects, joinPathFragments, updateProjectConfiguration } from "@nx/devkit";
5
+ import { AGENTCORE_GATEWAY_GENERATOR_INFO } from "../../../agentcore-gateway/generator.js";
6
+ import { AGENTCORE_HARNESS_GENERATOR_INFO } from "../../../agentcore-harness/generator.js";
7
+ import { formatFilesInSubtree } from "../../../utils/format.js";
8
+ import { addScriptProjectTargets } from "../../../utils/script-project-targets.js";
9
+ /**
10
+ * AgentCore Gateway and Harness projects host TypeScript that runs through
11
+ * `tsx` — a Gateway's `local-dev.ts` (which the connection generators edit) and
12
+ * a Harness's `scripts/chat.ts`. Neither project had a `tsconfig.json` or a
13
+ * `build`, `lint`, `format` or `typecheck` target, so that code was invisible to
14
+ * `nx run-many --target build --all` and a type error in it only surfaced at
15
+ * runtime.
16
+ *
17
+ * How to write a migration:
18
+ * - https://nx.dev/docs/kb/migration-generators
19
+ * - What `nextSteps` means: https://nx.dev/docs/reference/devkit/MigrationReturnObject
20
+ */ /** The generators whose projects gain the gates. */ const SCRIPT_PROJECT_GENERATORS = [
21
+ AGENTCORE_GATEWAY_GENERATOR_INFO.id,
22
+ AGENTCORE_HARNESS_GENERATOR_INFO.id
23
+ ];
24
+ export default async function migration(tree) {
25
+ const nextSteps = [];
26
+ for (const [, project] of getProjects(tree)){
27
+ const generator = project.metadata?.generator;
28
+ if (!generator || !SCRIPT_PROJECT_GENERATORS.includes(generator)) {
29
+ continue;
30
+ }
31
+ // Already migrated (or the user added their own gates).
32
+ if (project.targets?.typecheck) {
33
+ continue;
34
+ }
35
+ // A project that has been reworked into a compiled `ts#project` owns its own
36
+ // tsconfig graph, so leave it alone rather than layering a `noEmit` config on
37
+ // top of one that emits.
38
+ if (tree.exists(joinPathFragments(project.root, 'tsconfig.lib.json'))) {
39
+ nextSteps.push(`Project '${project.name}' has a tsconfig.lib.json, so its quality gates were left as they are. Confirm its build covers the TypeScript at ${project.root}.`);
40
+ continue;
41
+ }
42
+ addScriptProjectTargets(tree, {
43
+ project
44
+ });
45
+ updateProjectConfiguration(tree, project.name, project);
46
+ }
47
+ await formatFilesInSubtree(tree);
48
+ return {
49
+ nextSteps
50
+ };
51
+ }
52
+
53
+ //# sourceMappingURL=migration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/migrations/v1.0.0-rc.97/0006-script-project-quality-gates/migration.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n getProjects,\n joinPathFragments,\n type MigrationReturnObject,\n type Tree,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { AGENTCORE_GATEWAY_GENERATOR_INFO } from '../../../agentcore-gateway/generator.js';\nimport { AGENTCORE_HARNESS_GENERATOR_INFO } from '../../../agentcore-harness/generator.js';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\nimport { addScriptProjectTargets } from '../../../utils/script-project-targets.js';\n\n/**\n * AgentCore Gateway and Harness projects host TypeScript that runs through\n * `tsx` — a Gateway's `local-dev.ts` (which the connection generators edit) and\n * a Harness's `scripts/chat.ts`. Neither project had a `tsconfig.json` or a\n * `build`, `lint`, `format` or `typecheck` target, so that code was invisible to\n * `nx run-many --target build --all` and a type error in it only surfaced at\n * runtime.\n *\n * How to write a migration:\n * - https://nx.dev/docs/kb/migration-generators\n * - What `nextSteps` means: https://nx.dev/docs/reference/devkit/MigrationReturnObject\n */\n\n/** The generators whose projects gain the gates. */\nconst SCRIPT_PROJECT_GENERATORS = [\n AGENTCORE_GATEWAY_GENERATOR_INFO.id,\n AGENTCORE_HARNESS_GENERATOR_INFO.id,\n];\n\nexport default async function migration(\n tree: Tree,\n): Promise<MigrationReturnObject> {\n const nextSteps: string[] = [];\n\n for (const [, project] of getProjects(tree)) {\n const generator = (project.metadata as { generator?: string } | undefined)\n ?.generator;\n if (!generator || !SCRIPT_PROJECT_GENERATORS.includes(generator)) {\n continue;\n }\n // Already migrated (or the user added their own gates).\n if (project.targets?.typecheck) {\n continue;\n }\n // A project that has been reworked into a compiled `ts#project` owns its own\n // tsconfig graph, so leave it alone rather than layering a `noEmit` config on\n // top of one that emits.\n if (tree.exists(joinPathFragments(project.root, 'tsconfig.lib.json'))) {\n nextSteps.push(\n `Project '${project.name}' has a tsconfig.lib.json, so its quality gates were left as they are. Confirm its build covers the TypeScript at ${project.root}.`,\n );\n continue;\n }\n\n addScriptProjectTargets(tree, { project });\n updateProjectConfiguration(tree, project.name, project);\n }\n\n await formatFilesInSubtree(tree);\n\n return { nextSteps };\n}\n"],"names":["getProjects","joinPathFragments","updateProjectConfiguration","AGENTCORE_GATEWAY_GENERATOR_INFO","AGENTCORE_HARNESS_GENERATOR_INFO","formatFilesInSubtree","addScriptProjectTargets","SCRIPT_PROJECT_GENERATORS","id","migration","tree","nextSteps","project","generator","metadata","includes","targets","typecheck","exists","root","push","name"],"mappings":"AAAA;;;CAGC,GACD,SACEA,WAAW,EACXC,iBAAiB,EAGjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,gCAAgC,QAAQ,0CAA0C;AAC3F,SAASC,gCAAgC,QAAQ,0CAA0C;AAC3F,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,uBAAuB,QAAQ,2CAA2C;AAEnF;;;;;;;;;;;CAWC,GAED,kDAAkD,GAClD,MAAMC,4BAA4B;IAChCJ,iCAAiCK,EAAE;IACnCJ,iCAAiCI,EAAE;CACpC;AAED,eAAe,eAAeC,UAC5BC,IAAU;IAEV,MAAMC,YAAsB,EAAE;IAE9B,KAAK,MAAM,GAAGC,QAAQ,IAAIZ,YAAYU,MAAO;QAC3C,MAAMG,YAAaD,QAAQE,QAAQ,EAC/BD;QACJ,IAAI,CAACA,aAAa,CAACN,0BAA0BQ,QAAQ,CAACF,YAAY;YAChE;QACF;QACA,wDAAwD;QACxD,IAAID,QAAQI,OAAO,EAAEC,WAAW;YAC9B;QACF;QACA,6EAA6E;QAC7E,8EAA8E;QAC9E,yBAAyB;QACzB,IAAIP,KAAKQ,MAAM,CAACjB,kBAAkBW,QAAQO,IAAI,EAAE,uBAAuB;YACrER,UAAUS,IAAI,CACZ,CAAC,SAAS,EAAER,QAAQS,IAAI,CAAC,kHAAkH,EAAET,QAAQO,IAAI,CAAC,CAAC,CAAC;YAE9J;QACF;QAEAb,wBAAwBI,MAAM;YAAEE;QAAQ;QACxCV,2BAA2BQ,MAAME,QAAQS,IAAI,EAAET;IACjD;IAEA,MAAMP,qBAAqBK;IAE3B,OAAO;QAAEC;IAAU;AACrB"}
@@ -253,7 +253,7 @@ export default {
253
253
 
254
254
  exports[`preset generator > should run successfully > biome.json 1`] = `
255
255
  "{
256
- "$schema": "https://biomejs.dev/schemas/2.5.11/schema.json",
256
+ "$schema": "https://biomejs.dev/schemas/2.5.12/schema.json",
257
257
  "root": true,
258
258
  "formatter": {
259
259
  "enabled": true,
@@ -422,7 +422,7 @@ catalog:
422
422
  '@nx/js': 23.2.0
423
423
  '@nx/workspace': 23.2.0
424
424
  typescript: ~6.0.3
425
- '@biomejs/biome': 2.5.11
425
+ '@biomejs/biome': 2.5.12
426
426
  '@aws/nx-plugin': ^0.0.0
427
427
  '@aws/nx-plugin-mcp': ^0.0.0
428
428
  "
@@ -1,23 +1,19 @@
1
1
  /**
2
2
  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
- */ import { joinPathFragments, OverwriteStrategy, updateJson } from "@nx/devkit";
4
+ */ import { OverwriteStrategy, updateJson } from "@nx/devkit";
5
5
  import { execSync } from "child_process";
6
6
  import enquirer from "enquirer";
7
- import { readFileSync } from "fs";
8
7
  import { ensureAwsNxPluginConfig, updateAwsNxPluginConfig } from "../utils/config/utils.js";
9
8
  import { declareDependencies } from "../utils/declared-dependencies.js";
10
- import { addDependenciesToPackageJson } from "../utils/dependencies.js";
11
9
  import { formatFilesInSubtree } from "../utils/format.js";
10
+ import { GIT_SECRETS_DEPENDENCIES, setUpGitSecrets } from "../utils/git-secrets.js";
12
11
  import { applyWorkspaceInit, INIT_DEPENDENCIES } from "../utils/init.js";
13
12
  import { installDependencies } from "../utils/install.js";
14
13
  import { getGeneratorInfo } from "../utils/nx.js";
15
- import { withVersions } from "../utils/versions.js";
16
14
  export const DEPENDENCIES = declareDependencies()({
17
15
  ts: [
18
- {
19
- name: 'husky'
20
- },
16
+ ...GIT_SECRETS_DEPENDENCIES,
21
17
  ...INIT_DEPENDENCIES
22
18
  ]
23
19
  });
@@ -68,23 +64,6 @@ export const PRESET_GENERATOR_INFO = getGeneratorInfo(import.meta.filename);
68
64
  return false;
69
65
  }
70
66
  }
71
- const setUpGitSecrets = (tree)=>{
72
- const gitSecretsDir = joinPathFragments(import.meta.dirname, 'git-secrets-files', 'git-secrets-dir');
73
- const huskyDir = joinPathFragments(import.meta.dirname, 'git-secrets-files', 'husky-dir');
74
- tree.write('.git-secrets/git-secrets', readFileSync(joinPathFragments(gitSecretsDir, 'git-secrets'), 'utf-8'));
75
- tree.write('.husky/pre-commit', readFileSync(joinPathFragments(huskyDir, 'pre-commit'), 'utf-8'));
76
- tree.write('.gitallowed', '\\.git-secrets/git-secrets:\n');
77
- updateJson(tree, 'package.json', (json)=>({
78
- ...json,
79
- scripts: {
80
- ...json.scripts,
81
- prepare: 'husky'
82
- }
83
- }));
84
- addDependenciesToPackageJson(tree, {}, withVersions(DEPENDENCIES, [
85
- 'husky'
86
- ]));
87
- };
88
67
  export const presetGenerator = async (tree, { iac, gitSecrets, mcp, containers, module, catalog, preferInstallDependencies })=>{
89
68
  if (isAmazonian() && !process.env.VITEST && !process.env.CI && process.env.NX_DRY_RUN !== 'true' && process.env.NX_INTERACTIVE !== 'false') {
90
69
  const { engagementId } = await enquirer.prompt([
@@ -126,7 +105,7 @@ export const presetGenerator = async (tree, { iac, gitSecrets, mcp, containers,
126
105
  tree.delete('libs/.gitkeep');
127
106
  tree.write('packages/.gitkeep', '');
128
107
  if (gitSecrets !== false) {
129
- setUpGitSecrets(tree);
108
+ setUpGitSecrets(tree, DEPENDENCIES);
130
109
  }
131
110
  await formatFilesInSubtree(tree);
132
111
  return ()=>installDependencies(tree, preferInstallDependencies, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/nx-plugin/src/preset/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 joinPathFragments,\n OverwriteStrategy,\n type Tree,\n updateJson,\n} from '@nx/devkit';\nimport { execSync } from 'child_process';\nimport enquirer from 'enquirer';\nimport { readFileSync } from 'fs';\nimport {\n ensureAwsNxPluginConfig,\n updateAwsNxPluginConfig,\n} from '../utils/config/utils.js';\nimport { declareDependencies } from '../utils/declared-dependencies.js';\nimport { addDependenciesToPackageJson } from '../utils/dependencies.js';\nimport { formatFilesInSubtree } from '../utils/format.js';\nimport { applyWorkspaceInit, INIT_DEPENDENCIES } from '../utils/init.js';\nimport { installDependencies } from '../utils/install.js';\nimport { getGeneratorInfo, type NxGeneratorInfo } from '../utils/nx.js';\nimport { withVersions } from '../utils/versions.js';\nimport type { PresetGeneratorSchema } from './schema';\n\nexport const DEPENDENCIES = declareDependencies()({\n ts: [{ name: 'husky' }, ...INIT_DEPENDENCIES],\n});\n\nexport const PRESET_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\n/**\n * Determines if the current user is an Amazon employee based on their git configuration.\n *\n * This function checks the git user email configuration to identify Amazon employees\n * by looking for email addresses with Amazon domains (e.g., @amazon.com, @amazon.co.uk).\n *\n * @returns {boolean} True if the user's git email has an Amazon domain, false otherwise\n *\n * @example\n * // Returns true for Amazon employee emails\n * // git config user.email = \"john.doe@amazon.com\"\n * isAmazonian(); // true\n *\n * @example\n * // Returns false for non-Amazon emails\n * // git config user.email = \"user@example.com\"\n * isAmazonian(); // false\n *\n * @example\n * // Returns false when git config is not available or throws an error\n * isAmazonian(); // false\n */\nexport function isAmazonian(): boolean {\n try {\n // Execute git command to retrieve the user's configured email address\n const gitEmail = execSync('git config user.email', {\n encoding: 'utf8',\n }).trim();\n\n // Return false if no email is configured\n if (!gitEmail) {\n return false;\n }\n\n // Split email address to extract domain part\n const emailParts = gitEmail.split('@');\n if (emailParts.length < 2) {\n return false;\n }\n\n // Extract domain and normalize to lowercase for comparison\n const domain = emailParts[1].toLowerCase();\n\n // Check if domain starts with 'amazon.' (covers amazon.com, amazon.co.uk, etc.)\n return domain.startsWith('amazon.');\n } catch (error) {\n // Return false if git command fails or any other error occurs\n // This handles cases where git is not installed or configured\n return false;\n }\n}\n\nconst setUpGitSecrets = (tree: Tree) => {\n const gitSecretsDir = joinPathFragments(\n import.meta.dirname,\n 'git-secrets-files',\n 'git-secrets-dir',\n );\n const huskyDir = joinPathFragments(\n import.meta.dirname,\n 'git-secrets-files',\n 'husky-dir',\n );\n\n tree.write(\n '.git-secrets/git-secrets',\n readFileSync(joinPathFragments(gitSecretsDir, 'git-secrets'), 'utf-8'),\n );\n tree.write(\n '.husky/pre-commit',\n readFileSync(joinPathFragments(huskyDir, 'pre-commit'), 'utf-8'),\n );\n tree.write('.gitallowed', '\\\\.git-secrets/git-secrets:\\n');\n\n updateJson(tree, 'package.json', (json) => ({\n ...json,\n scripts: {\n ...json.scripts,\n prepare: 'husky',\n },\n }));\n\n addDependenciesToPackageJson(tree, {}, withVersions(DEPENDENCIES, ['husky']));\n};\n\nexport const presetGenerator = async (\n tree: Tree,\n {\n iac,\n gitSecrets,\n mcp,\n containers,\n module,\n catalog,\n preferInstallDependencies,\n }: PresetGeneratorSchema,\n): Promise<GeneratorCallback> => {\n if (\n isAmazonian() &&\n !process.env.VITEST &&\n !process.env.CI &&\n process.env.NX_DRY_RUN !== 'true' &&\n process.env.NX_INTERACTIVE !== 'false'\n ) {\n const { engagementId } = await enquirer.prompt<{ engagementId?: string }>([\n {\n name: 'engagementId',\n message: 'Please enter your engagementId (if known)',\n type: 'input',\n initial: 'None',\n },\n ]);\n\n if (engagementId != 'None') {\n await ensureAwsNxPluginConfig(tree);\n await updateAwsNxPluginConfig(tree, { tags: [engagementId] });\n }\n }\n\n // The preset owns the greenfield workspace's module format: write the root\n // `type` explicitly from the chosen `--module` so later generators can\n // infer it. The `init` generator never touches an existing workspace's\n // `type` field.\n updateJson(tree, 'package.json', (packageJson) => ({\n ...packageJson,\n type: (module ?? 'esm') === 'esm' ? 'module' : 'commonjs',\n }));\n\n // Apply the deterministic workspace configuration shared with the `init`\n // generator. The preset owns the README of a greenfield workspace.\n await applyWorkspaceInit(\n tree,\n {\n iac,\n containers,\n mcp,\n catalogs: catalog ?? true,\n readmeOverwriteStrategy: OverwriteStrategy.Overwrite,\n overwriteScripts: true,\n },\n DEPENDENCIES,\n );\n\n tree.delete('apps/.gitkeep');\n tree.delete('libs/.gitkeep');\n tree.write('packages/.gitkeep', '');\n\n if (gitSecrets !== false) {\n setUpGitSecrets(tree);\n }\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default presetGenerator;\n"],"names":["joinPathFragments","OverwriteStrategy","updateJson","execSync","enquirer","readFileSync","ensureAwsNxPluginConfig","updateAwsNxPluginConfig","declareDependencies","addDependenciesToPackageJson","formatFilesInSubtree","applyWorkspaceInit","INIT_DEPENDENCIES","installDependencies","getGeneratorInfo","withVersions","DEPENDENCIES","ts","name","PRESET_GENERATOR_INFO","filename","isAmazonian","gitEmail","encoding","trim","emailParts","split","length","domain","toLowerCase","startsWith","error","setUpGitSecrets","tree","gitSecretsDir","dirname","huskyDir","write","json","scripts","prepare","presetGenerator","iac","gitSecrets","mcp","containers","module","catalog","preferInstallDependencies","process","env","VITEST","CI","NX_DRY_RUN","NX_INTERACTIVE","engagementId","prompt","message","type","initial","tags","packageJson","catalogs","readmeOverwriteStrategy","Overwrite","overwriteScripts","delete","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,iBAAiB,EACjBC,iBAAiB,EAEjBC,UAAU,QACL,aAAa;AACpB,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,cAAc,WAAW;AAChC,SAASC,YAAY,QAAQ,KAAK;AAClC,SACEC,uBAAuB,EACvBC,uBAAuB,QAClB,2BAA2B;AAClC,SAASC,mBAAmB,QAAQ,oCAAoC;AACxE,SAASC,4BAA4B,QAAQ,2BAA2B;AACxE,SAASC,oBAAoB,QAAQ,qBAAqB;AAC1D,SAASC,kBAAkB,EAAEC,iBAAiB,QAAQ,mBAAmB;AACzE,SAASC,mBAAmB,QAAQ,sBAAsB;AAC1D,SAASC,gBAAgB,QAA8B,iBAAiB;AACxE,SAASC,YAAY,QAAQ,uBAAuB;AAGpD,OAAO,MAAMC,eAAeR,sBAAsB;IAChDS,IAAI;QAAC;YAAEC,MAAM;QAAQ;WAAMN;KAAkB;AAC/C,GAAG;AAEH,OAAO,MAAMO,wBAAyCL,iBACpD,YAAYM,QAAQ,EACpB;AAEF;;;;;;;;;;;;;;;;;;;;;CAqBC,GACD,OAAO,SAASC;IACd,IAAI;QACF,sE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cAAc,KAAK,SAC/B;QACA,MAAM,EAAEC,YAAY,EAAE,GAAG,MAAMnD,SAASoD,MAAM,CAA4B;YACxE;gBACEtC,MAAM;gBACNuC,SAAS;gBACTC,MAAM;gBACNC,SAAS;YACX;SACD;QAED,IAAIJ,gBAAgB,QAAQ;YAC1B,MAAMjD,wBAAwB2B;YAC9B,MAAM1B,wBAAwB0B,MAAM;gBAAE2B,MAAM;oBAACL;iBAAa;YAAC;QAC7D;IACF;IAEA,2EAA2E;IAC3E,uEAAuE;IACvE,uEAAuE;IACvE,gBAAgB;IAChBrD,WAAW+B,MAAM,gBAAgB,CAAC4B,cAAiB,CAAA;YACjD,GAAGA,WAAW;YACdH,MAAM,AAACZ,CAAAA,UAAU,KAAI,MAAO,QAAQ,WAAW;QACjD,CAAA;IAEA,yEAAyE;IACzE,mEAAmE;IACnE,MAAMnC,mBACJsB,MACA;QACES;QACAG;QACAD;QACAkB,UAAUf,WAAW;QACrBgB,yBAAyB9D,kBAAkB+D,SAAS;QACpDC,kBAAkB;IACpB,GACAjD;IAGFiB,KAAKiC,MAAM,CAAC;IACZjC,KAAKiC,MAAM,CAAC;IACZjC,KAAKI,KAAK,CAAC,qBAAqB;IAEhC,IAAIM,eAAe,OAAO;QACxBX,gBAAgBC;IAClB;IAEA,MAAMvB,qBAAqBuB;IAC3B,OAAO,IACLpB,oBAAoBoB,MAAMe,2BAA2B;YACnDmB,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AAEF,eAAe1B,gBAAgB"}
1
+ {"version":3,"sources":["../../../../../packages/nx-plugin/src/preset/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 OverwriteStrategy,\n type Tree,\n updateJson,\n} from '@nx/devkit';\nimport { execSync } from 'child_process';\nimport enquirer from 'enquirer';\nimport {\n ensureAwsNxPluginConfig,\n updateAwsNxPluginConfig,\n} from '../utils/config/utils.js';\nimport { declareDependencies } from '../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../utils/format.js';\nimport {\n GIT_SECRETS_DEPENDENCIES,\n setUpGitSecrets,\n} from '../utils/git-secrets.js';\nimport { applyWorkspaceInit, INIT_DEPENDENCIES } from '../utils/init.js';\nimport { installDependencies } from '../utils/install.js';\nimport { getGeneratorInfo, type NxGeneratorInfo } from '../utils/nx.js';\nimport type { PresetGeneratorSchema } from './schema';\n\nexport const DEPENDENCIES = declareDependencies()({\n ts: [...GIT_SECRETS_DEPENDENCIES, ...INIT_DEPENDENCIES],\n});\n\nexport const PRESET_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\n/**\n * Determines if the current user is an Amazon employee based on their git configuration.\n *\n * This function checks the git user email configuration to identify Amazon employees\n * by looking for email addresses with Amazon domains (e.g., @amazon.com, @amazon.co.uk).\n *\n * @returns {boolean} True if the user's git email has an Amazon domain, false otherwise\n *\n * @example\n * // Returns true for Amazon employee emails\n * // git config user.email = \"john.doe@amazon.com\"\n * isAmazonian(); // true\n *\n * @example\n * // Returns false for non-Amazon emails\n * // git config user.email = \"user@example.com\"\n * isAmazonian(); // false\n *\n * @example\n * // Returns false when git config is not available or throws an error\n * isAmazonian(); // false\n */\nexport function isAmazonian(): boolean {\n try {\n // Execute git command to retrieve the user's configured email address\n const gitEmail = execSync('git config user.email', {\n encoding: 'utf8',\n }).trim();\n\n // Return false if no email is configured\n if (!gitEmail) {\n return false;\n }\n\n // Split email address to extract domain part\n const emailParts = gitEmail.split('@');\n if (emailParts.length < 2) {\n return false;\n }\n\n // Extract domain and normalize to lowercase for comparison\n const domain = emailParts[1].toLowerCase();\n\n // Check if domain starts with 'amazon.' (covers amazon.com, amazon.co.uk, etc.)\n return domain.startsWith('amazon.');\n } catch (error) {\n // Return false if git command fails or any other error occurs\n // This handles cases where git is not installed or configured\n return false;\n }\n}\n\nexport const presetGenerator = async (\n tree: Tree,\n {\n iac,\n gitSecrets,\n mcp,\n containers,\n module,\n catalog,\n preferInstallDependencies,\n }: PresetGeneratorSchema,\n): Promise<GeneratorCallback> => {\n if (\n isAmazonian() &&\n !process.env.VITEST &&\n !process.env.CI &&\n process.env.NX_DRY_RUN !== 'true' &&\n process.env.NX_INTERACTIVE !== 'false'\n ) {\n const { engagementId } = await enquirer.prompt<{ engagementId?: string }>([\n {\n name: 'engagementId',\n message: 'Please enter your engagementId (if known)',\n type: 'input',\n initial: 'None',\n },\n ]);\n\n if (engagementId != 'None') {\n await ensureAwsNxPluginConfig(tree);\n await updateAwsNxPluginConfig(tree, { tags: [engagementId] });\n }\n }\n\n // The preset owns the greenfield workspace's module format: write the root\n // `type` explicitly from the chosen `--module` so later generators can\n // infer it. The `init` generator never touches an existing workspace's\n // `type` field.\n updateJson(tree, 'package.json', (packageJson) => ({\n ...packageJson,\n type: (module ?? 'esm') === 'esm' ? 'module' : 'commonjs',\n }));\n\n // Apply the deterministic workspace configuration shared with the `init`\n // generator. The preset owns the README of a greenfield workspace.\n await applyWorkspaceInit(\n tree,\n {\n iac,\n containers,\n mcp,\n catalogs: catalog ?? true,\n readmeOverwriteStrategy: OverwriteStrategy.Overwrite,\n overwriteScripts: true,\n },\n DEPENDENCIES,\n );\n\n tree.delete('apps/.gitkeep');\n tree.delete('libs/.gitkeep');\n tree.write('packages/.gitkeep', '');\n\n if (gitSecrets !== false) {\n setUpGitSecrets(tree, DEPENDENCIES);\n }\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default presetGenerator;\n"],"names":["OverwriteStrategy","updateJson","execSync","enquirer","ensureAwsNxPluginConfig","updateAwsNxPluginConfig","declareDependencies","formatFilesInSubtree","GIT_SECRETS_DEPENDENCIES","setUpGitSecrets","applyWorkspaceInit","INIT_DEPENDENCIES","installDependencies","getGeneratorInfo","DEPENDENCIES","ts","PRESET_GENERATOR_INFO","filename","isAmazonian","gitEmail","encoding","trim","emailParts","split","length","domain","toLowerCase","startsWith","error","presetGenerator","tree","iac","gitSecrets","mcp","containers","module","catalog","preferInstallDependencies","process","env","VITEST","CI","NX_DRY_RUN","NX_INTERACTIVE","engagementId","prompt","name","message","type","initial","tags","packageJson","catalogs","readmeOverwriteStrategy","Overwrite","overwriteScripts","delete","write","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,iBAAiB,EAEjBC,UAAU,QACL,aAAa;AACpB,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,cAAc,WAAW;AAChC,SACEC,uBAAuB,EACvBC,uBAAuB,QAClB,2BAA2B;AAClC,SAASC,mBAAmB,QAAQ,oCAAoC;AACxE,SAASC,oBAAoB,QAAQ,qBAAqB;AAC1D,SACEC,wBAAwB,EACxBC,eAAe,QACV,0BAA0B;AACjC,SAASC,kBAAkB,EAAEC,iBAAiB,QAAQ,mBAAmB;AACzE,SAASC,mBAAmB,QAAQ,sBAAsB;AAC1D,SAASC,gBAAgB,QAA8B,iBAAiB;AAGxE,OAAO,MAAMC,eAAeR,sBAAsB;IAChDS,IAAI;WAAIP;WAA6BG;KAAkB;AACzD,GAAG;AAEH,OAAO,MAAMK,wBAAyCH,iBACpD,YAAYI,QAAQ,EACpB;AAEF;;;;;;;;;;;;;;;;;;;;;CAqBC,GACD,OAAO,SAASC;IACd,IAAI;QACF,sEAAsE;QACtE,MAAMC,WAAWjB,SAAS,yBAAyB;YACjDkB,UAAU;QACZ,GAAGC,IAAI;QAEP,yCAAyC;QACzC,IAAI,CAACF,UAAU;YACb,OAAO;QACT;QAEA,6CAA6C;QAC7C,MAAMG,aAAaH,SAASI,KAAK,CAAC;QAClC,IAAID,WAAWE,MAAM,GAAG,GAAG;YACzB,OAAO;QACT;QAEA,2DAA2D;QAC3D,MAAMC,SAASH,UAAU,CAAC,EAAE,CAACI,WAAW;QAExC,gFAAgF;QAChF,OAAOD,OAAOE,UAAU,CAAC;IAC3B,EAAE,OAAOC,OAAO;QACd,8DA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;QAC3B;AACJ,EAAE;AAEF,eAAe7B,gBAAgB"}
@@ -766,11 +766,11 @@ dependencies = [
766
766
  "aws-lambda-powertools==3.34.0",
767
767
  "aws-opentelemetry-distro==0.19.0",
768
768
  "bedrock-agentcore==1.22.0",
769
- "boto3==1.43.83",
769
+ "boto3==1.43.89",
770
770
  "fastapi==0.141.1",
771
771
  "mcp==1.28.1",
772
772
  "strands-agents==1.54.0",
773
- "strands-agents-tools==0.8.7",
773
+ "strands-agents-tools==0.8.8",
774
774
  "uvicorn==0.52.4"
775
775
  ]
776
776
 
@@ -704,15 +704,15 @@ dependencies = [
704
704
  "aws-lambda-powertools==3.34.0",
705
705
  "aws-opentelemetry-distro==0.19.0",
706
706
  "bedrock-agentcore==1.22.0",
707
- "boto3==1.43.83",
707
+ "boto3==1.43.89",
708
708
  "fastapi==0.141.1",
709
709
  "mcp==1.28.1",
710
- "langchain==1.3.18",
711
- "langchain-aws==1.7.4",
710
+ "langchain==1.4.0",
711
+ "langchain-aws==1.7.5",
712
712
  "langgraph==1.2.11",
713
713
  "langgraph-checkpoint-sqlite==3.1.1",
714
714
  "aiosqlite==0.22.1",
715
- "ag-ui-protocol==0.1.21",
715
+ "ag-ui-protocol==0.1.22",
716
716
  "ag-ui-langgraph==0.0.44",
717
717
  "uvicorn==0.52.4"
718
718
  ]
@@ -5,7 +5,7 @@ exports[`py#agent generator > should create DynamoDB checkpoint table and S3 off
5
5
  required_providers {
6
6
  aws = {
7
7
  source = "hashicorp/aws"
8
- version = "6.62.0"
8
+ version = "6.63.0"
9
9
  }
10
10
  random = {
11
11
  source = "hashicorp/random"
@@ -381,7 +381,7 @@ exports[`py#agent generator > should match snapshot for Terraform generated file
381
381
  required_providers {
382
382
  aws = {
383
383
  source = "hashicorp/aws"
384
- version = "6.62.0"
384
+ version = "6.63.0"
385
385
  }
386
386
  random = {
387
387
  source = "hashicorp/random"
@@ -704,7 +704,7 @@ exports[`py#agent generator > should match snapshot for Terraform generated file
704
704
  required_providers {
705
705
  aws = {
706
706
  source = "hashicorp/aws"
707
- version = "6.62.0"
707
+ version = "6.63.0"
708
708
  }
709
709
  null = {
710
710
  source = "hashicorp/null"
@@ -1063,7 +1063,7 @@ resource "null_resource" "runtime_ready" {
1063
1063
 
1064
1064
  provisioner "local-exec" {
1065
1065
  command = <<-EOT
1066
- uv run --with boto3==1.43.83 python -c "
1066
+ uv run --with boto3==1.43.89 python -c "
1067
1067
  import boto3
1068
1068
  import json
1069
1069
  import os