@aws/nx-plugin 1.0.0-rc.97 → 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 (207) hide show
  1. package/LICENSE-THIRD-PARTY +9 -9
  2. package/migrations.json +125 -115
  3. package/package.json +3 -3
  4. package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +1 -1
  5. package/src/infra/app/__snapshots__/generator.spec.ts.snap +4 -4
  6. package/src/infra/app/generator.js +5 -2
  7. package/src/infra/app/generator.js.map +1 -1
  8. package/src/internal/test-matrix/generator.js +2 -2
  9. package/src/internal/test-matrix/generator.js.map +1 -1
  10. package/src/license/sync/generator.d.ts +10 -0
  11. package/src/license/sync/generator.js +1 -1
  12. package/src/license/sync/generator.js.map +1 -1
  13. package/src/migrations/latest/sandbox-pattern-nested-stacks/metadata.json +3 -0
  14. package/src/migrations/latest/sandbox-pattern-nested-stacks/migration.js +68 -0
  15. package/src/migrations/latest/sandbox-pattern-nested-stacks/migration.js.map +1 -0
  16. package/src/migrations/latest/shadcn-cn-package/metadata.json +3 -0
  17. package/src/migrations/latest/shadcn-cn-package/migration.js +114 -0
  18. package/src/migrations/latest/shadcn-cn-package/migration.js.map +1 -0
  19. package/src/migrations/v1.0.0-rc.90/0001-dev-target-depends-on-pull-image/migration.js.map +1 -0
  20. package/src/migrations/v1.0.0-rc.90/0002-open-api-codegen-executor/migration.js.map +1 -0
  21. package/src/migrations/v1.0.0-rc.90/0003-terraform-provider-plugin-cache/migration.js.map +1 -0
  22. package/src/migrations/v1.0.0-rc.90/0004-python-test-input-scoping/migration.js.map +1 -0
  23. package/src/migrations/v1.0.0-rc.90/0005-vitest-coverage-output-dir/migration.js.map +1 -0
  24. package/src/migrations/v1.0.0-rc.90/0006-add-assemble-target/migration.js.map +1 -0
  25. package/src/migrations/v1.0.0-rc.90/0007-docker-target-cache-soundness/migration.js.map +1 -0
  26. package/src/migrations/v1.0.0-rc.90/0008-declare-cacheable-target-inputs/migration.js.map +1 -0
  27. package/src/migrations/v1.0.0-rc.90/0009-terraform-fmt-check/migration.js.map +1 -0
  28. package/src/migrations/v1.0.0-rc.92/0001-react-website-unique-dev-ports/migration.js.map +1 -0
  29. package/src/migrations/v1.0.0-rc.94/0001-infra-deploy-express-mode/migration.js.map +1 -0
  30. package/src/migrations/v1.0.0-rc.94/0002-shx-fs-commands/migration.js.map +1 -0
  31. package/src/migrations/v1.0.0-rc.94/0003-agent-core-vendor-target/migration.js.map +1 -0
  32. package/src/migrations/v1.0.0-rc.95/0001-rolldown-config-bundle-transient/migration.js.map +1 -0
  33. package/src/migrations/v1.0.0-rc.95/0002-agent-connection-pin-strands-peers/migration.js.map +1 -0
  34. package/src/migrations/v1.0.0-rc.95/0003-ignore-package-manager-temp-files/migration.js.map +1 -0
  35. package/src/migrations/v1.0.0-rc.95/0004-shadcn-package-imports-exports/migration.js.map +1 -0
  36. package/src/migrations/v1.0.0-rc.97/0001-gateway-url-accessor/migration.js.map +1 -0
  37. package/src/migrations/v1.0.0-rc.97/0002-checkov-scan-cache-inputs/migration.js.map +1 -0
  38. package/src/migrations/v1.0.0-rc.97/0003-terraform-validate-without-backend/migration.js.map +1 -0
  39. package/src/migrations/v1.0.0-rc.97/0004-py-lambda-powertools-context/migration.d.ts +6 -0
  40. package/src/migrations/v1.0.0-rc.97/0004-py-lambda-powertools-context/migration.js.map +1 -0
  41. package/src/migrations/v1.0.0-rc.97/0005-smithy-extension-trait-aliases/migration.js.map +1 -0
  42. package/src/migrations/v1.0.0-rc.97/0006-script-project-quality-gates/migration.d.ts +6 -0
  43. package/src/migrations/v1.0.0-rc.97/0006-script-project-quality-gates/migration.js.map +1 -0
  44. package/src/preset/__snapshots__/generator.spec.ts.snap +2 -2
  45. package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +2 -2
  46. package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +4 -4
  47. package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +4 -4
  48. package/src/py/agent/a2a-connection/generator.d.ts +1 -1
  49. package/src/py/agent/gateway-connection/generator.d.ts +1 -1
  50. package/src/py/agent/mcp-connection/generator.d.ts +1 -1
  51. package/src/py/agent/react-connection/generator.d.ts +1 -7
  52. package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
  53. package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
  54. package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
  55. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +3 -3
  56. package/src/py/rdb/__snapshots__/generator.spec.ts.snap +3 -3
  57. package/src/smithy/project/__snapshots__/generator.spec.ts.snap +5 -5
  58. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +8 -8
  59. package/src/terraform/project/schema.d.js +0 -3
  60. package/src/terraform/project/schema.d.js.map +1 -1
  61. package/src/terraform/project/schema.d.ts +0 -4
  62. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
  63. package/src/ts/agent/__snapshots__/generator.spec.ts.snap +4 -4
  64. package/src/ts/agent/a2a-connection/__snapshots__/generator.spec.ts.snap +2 -2
  65. package/src/ts/agent/gateway-connection/__snapshots__/generator.spec.ts.snap +2 -2
  66. package/src/ts/agent/mcp-connection/__snapshots__/generator.spec.ts.snap +2 -2
  67. package/src/ts/agent/react-connection/generator.d.ts +1 -9
  68. package/src/ts/astro-docs/files/translation/scripts/translate.ts.template +47 -2
  69. package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +1 -1
  70. package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +6 -6
  71. package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
  72. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +3 -3
  73. package/src/ts/mcp-server/files/app/http.ts.template +1 -1
  74. package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +2 -2
  75. package/src/ts/nx-generator/files/local/generator.spec.ts.template +2 -2
  76. package/src/ts/nx-migration/generator.js +3 -1
  77. package/src/ts/nx-migration/generator.js.map +1 -1
  78. package/src/ts/nx-plugin/__snapshots__/generator.spec.ts.snap +1 -25
  79. package/src/ts/nx-plugin/generator.js +19 -17
  80. package/src/ts/nx-plugin/generator.js.map +1 -1
  81. package/src/ts/nx-plugin/utils.d.ts +21 -0
  82. package/src/ts/nx-plugin/utils.js +41 -1
  83. package/src/ts/nx-plugin/utils.js.map +1 -1
  84. package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +10 -10
  85. package/src/ts/react-website/agui/generator.d.ts +1 -5
  86. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +26 -26
  87. package/src/ts/react-website/app/generator.d.ts +1 -5
  88. package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
  89. package/src/utils/ast.js +55 -16
  90. package/src/utils/ast.js.map +1 -1
  91. package/src/utils/dependencies.d.ts +10 -0
  92. package/src/utils/dependencies.js +93 -1
  93. package/src/utils/dependencies.js.map +1 -1
  94. package/src/utils/files/common/shadcn/src/components/ui/alert.tsx.template +1 -2
  95. package/src/utils/files/common/shadcn/src/components/ui/avatar.tsx.template +1 -2
  96. package/src/utils/files/common/shadcn/src/components/ui/breadcrumb.tsx.template +1 -2
  97. package/src/utils/files/common/shadcn/src/components/ui/button.tsx.template +1 -2
  98. package/src/utils/files/common/shadcn/src/components/ui/card.tsx.template +1 -2
  99. package/src/utils/files/common/shadcn/src/components/ui/input.tsx.template +1 -2
  100. package/src/utils/files/common/shadcn/src/components/ui/separator.tsx.template +1 -2
  101. package/src/utils/files/common/shadcn/src/components/ui/sheet.tsx.template +1 -2
  102. package/src/utils/files/common/shadcn/src/components/ui/sidebar.tsx.template +1 -1
  103. package/src/utils/files/common/shadcn/src/components/ui/skeleton.tsx.template +1 -1
  104. package/src/utils/files/common/shadcn/src/components/ui/spinner.tsx.template +1 -2
  105. package/src/utils/files/common/shadcn/src/components/ui/textarea.tsx.template +1 -2
  106. package/src/utils/files/common/shadcn/src/components/ui/tooltip.tsx.template +1 -2
  107. package/src/utils/files/common/shadcn/src/lib/utils.ts.template +1 -6
  108. package/src/utils/shared-shadcn.d.ts +1 -3
  109. package/src/utils/shared-shadcn.js +1 -4
  110. package/src/utils/shared-shadcn.js.map +1 -1
  111. package/src/utils/versions.d.ts +52 -53
  112. package/src/utils/versions.js +51 -52
  113. package/src/utils/versions.js.map +1 -1
  114. package/src/migrations/latest/add-assemble-target/migration.js.map +0 -1
  115. package/src/migrations/latest/agent-connection-pin-strands-peers/migration.js.map +0 -1
  116. package/src/migrations/latest/agent-core-vendor-target/migration.js.map +0 -1
  117. package/src/migrations/latest/checkov-scan-cache-inputs/migration.js.map +0 -1
  118. package/src/migrations/latest/declare-cacheable-target-inputs/migration.js.map +0 -1
  119. package/src/migrations/latest/dev-target-depends-on-pull-image/migration.js.map +0 -1
  120. package/src/migrations/latest/docker-target-cache-soundness/migration.js.map +0 -1
  121. package/src/migrations/latest/gateway-url-accessor/migration.js.map +0 -1
  122. package/src/migrations/latest/ignore-package-manager-temp-files/migration.js.map +0 -1
  123. package/src/migrations/latest/infra-deploy-express-mode/migration.js.map +0 -1
  124. package/src/migrations/latest/open-api-codegen-executor/migration.js.map +0 -1
  125. package/src/migrations/latest/py-lambda-powertools-context/migration.js.map +0 -1
  126. package/src/migrations/latest/python-test-input-scoping/migration.js.map +0 -1
  127. package/src/migrations/latest/react-website-unique-dev-ports/migration.js.map +0 -1
  128. package/src/migrations/latest/rolldown-config-bundle-transient/migration.js.map +0 -1
  129. package/src/migrations/latest/script-project-quality-gates/migration.js.map +0 -1
  130. package/src/migrations/latest/shadcn-package-imports-exports/migration.js.map +0 -1
  131. package/src/migrations/latest/shx-fs-commands/migration.js.map +0 -1
  132. package/src/migrations/latest/smithy-extension-trait-aliases/migration.js.map +0 -1
  133. package/src/migrations/latest/terraform-fmt-check/migration.js.map +0 -1
  134. package/src/migrations/latest/terraform-provider-plugin-cache/migration.js.map +0 -1
  135. package/src/migrations/latest/terraform-validate-without-backend/migration.js.map +0 -1
  136. package/src/migrations/latest/vitest-coverage-output-dir/migration.js.map +0 -1
  137. /package/src/migrations/latest/{add-assemble-target → sandbox-pattern-nested-stacks}/migration.d.ts +0 -0
  138. /package/src/migrations/latest/{agent-core-vendor-target → shadcn-cn-package}/migration.d.ts +0 -0
  139. /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
  140. /package/src/migrations/{latest/checkov-scan-cache-inputs → v1.0.0-rc.90/0001-dev-target-depends-on-pull-image}/migration.d.ts +0 -0
  141. /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
  142. /package/src/migrations/{latest/open-api-codegen-executor → v1.0.0-rc.90/0002-open-api-codegen-executor}/metadata.json +0 -0
  143. /package/src/migrations/{latest/declare-cacheable-target-inputs → v1.0.0-rc.90/0002-open-api-codegen-executor}/migration.d.ts +0 -0
  144. /package/src/migrations/{latest/open-api-codegen-executor → v1.0.0-rc.90/0002-open-api-codegen-executor}/migration.js +0 -0
  145. /package/src/migrations/{latest/terraform-provider-plugin-cache → v1.0.0-rc.90/0003-terraform-provider-plugin-cache}/metadata.json +0 -0
  146. /package/src/migrations/{latest/dev-target-depends-on-pull-image → v1.0.0-rc.90/0003-terraform-provider-plugin-cache}/migration.d.ts +0 -0
  147. /package/src/migrations/{latest/terraform-provider-plugin-cache → v1.0.0-rc.90/0003-terraform-provider-plugin-cache}/migration.js +0 -0
  148. /package/src/migrations/{latest/python-test-input-scoping → v1.0.0-rc.90/0004-python-test-input-scoping}/metadata.json +0 -0
  149. /package/src/migrations/{latest/docker-target-cache-soundness → v1.0.0-rc.90/0004-python-test-input-scoping}/migration.d.ts +0 -0
  150. /package/src/migrations/{latest/python-test-input-scoping → v1.0.0-rc.90/0004-python-test-input-scoping}/migration.js +0 -0
  151. /package/src/migrations/{latest/vitest-coverage-output-dir → v1.0.0-rc.90/0005-vitest-coverage-output-dir}/metadata.json +0 -0
  152. /package/src/migrations/{latest/infra-deploy-express-mode → v1.0.0-rc.90/0005-vitest-coverage-output-dir}/migration.d.ts +0 -0
  153. /package/src/migrations/{latest/vitest-coverage-output-dir → v1.0.0-rc.90/0005-vitest-coverage-output-dir}/migration.js +0 -0
  154. /package/src/migrations/{latest/add-assemble-target → v1.0.0-rc.90/0006-add-assemble-target}/metadata.json +0 -0
  155. /package/src/migrations/{latest/open-api-codegen-executor → v1.0.0-rc.90/0006-add-assemble-target}/migration.d.ts +0 -0
  156. /package/src/migrations/{latest/add-assemble-target → v1.0.0-rc.90/0006-add-assemble-target}/migration.js +0 -0
  157. /package/src/migrations/{latest/docker-target-cache-soundness → v1.0.0-rc.90/0007-docker-target-cache-soundness}/metadata.json +0 -0
  158. /package/src/migrations/{latest/py-lambda-powertools-context → v1.0.0-rc.90/0007-docker-target-cache-soundness}/migration.d.ts +0 -0
  159. /package/src/migrations/{latest/docker-target-cache-soundness → v1.0.0-rc.90/0007-docker-target-cache-soundness}/migration.js +0 -0
  160. /package/src/migrations/{latest/declare-cacheable-target-inputs → v1.0.0-rc.90/0008-declare-cacheable-target-inputs}/metadata.json +0 -0
  161. /package/src/migrations/{latest/python-test-input-scoping → v1.0.0-rc.90/0008-declare-cacheable-target-inputs}/migration.d.ts +0 -0
  162. /package/src/migrations/{latest/declare-cacheable-target-inputs → v1.0.0-rc.90/0008-declare-cacheable-target-inputs}/migration.js +0 -0
  163. /package/src/migrations/{latest/terraform-fmt-check → v1.0.0-rc.90/0009-terraform-fmt-check}/metadata.json +0 -0
  164. /package/src/migrations/{latest/react-website-unique-dev-ports → v1.0.0-rc.90/0009-terraform-fmt-check}/migration.d.ts +0 -0
  165. /package/src/migrations/{latest/terraform-fmt-check → v1.0.0-rc.90/0009-terraform-fmt-check}/migration.js +0 -0
  166. /package/src/migrations/{latest/react-website-unique-dev-ports → v1.0.0-rc.92/0001-react-website-unique-dev-ports}/metadata.json +0 -0
  167. /package/src/migrations/{latest/rolldown-config-bundle-transient → v1.0.0-rc.92/0001-react-website-unique-dev-ports}/migration.d.ts +0 -0
  168. /package/src/migrations/{latest/react-website-unique-dev-ports → v1.0.0-rc.92/0001-react-website-unique-dev-ports}/migration.js +0 -0
  169. /package/src/migrations/{latest/infra-deploy-express-mode → v1.0.0-rc.94/0001-infra-deploy-express-mode}/metadata.json +0 -0
  170. /package/src/migrations/{latest/script-project-quality-gates → v1.0.0-rc.94/0001-infra-deploy-express-mode}/migration.d.ts +0 -0
  171. /package/src/migrations/{latest/infra-deploy-express-mode → v1.0.0-rc.94/0001-infra-deploy-express-mode}/migration.js +0 -0
  172. /package/src/migrations/{latest/shx-fs-commands → v1.0.0-rc.94/0002-shx-fs-commands}/metadata.json +0 -0
  173. /package/src/migrations/{latest/shadcn-package-imports-exports → v1.0.0-rc.94/0002-shx-fs-commands}/migration.d.ts +0 -0
  174. /package/src/migrations/{latest/shx-fs-commands → v1.0.0-rc.94/0002-shx-fs-commands}/migration.js +0 -0
  175. /package/src/migrations/{latest/agent-core-vendor-target → v1.0.0-rc.94/0003-agent-core-vendor-target}/metadata.json +0 -0
  176. /package/src/migrations/{latest/shx-fs-commands → v1.0.0-rc.94/0003-agent-core-vendor-target}/migration.d.ts +0 -0
  177. /package/src/migrations/{latest/agent-core-vendor-target → v1.0.0-rc.94/0003-agent-core-vendor-target}/migration.js +0 -0
  178. /package/src/migrations/{latest/rolldown-config-bundle-transient → v1.0.0-rc.95/0001-rolldown-config-bundle-transient}/metadata.json +0 -0
  179. /package/src/migrations/{latest/terraform-fmt-check → v1.0.0-rc.95/0001-rolldown-config-bundle-transient}/migration.d.ts +0 -0
  180. /package/src/migrations/{latest/rolldown-config-bundle-transient → v1.0.0-rc.95/0001-rolldown-config-bundle-transient}/migration.js +0 -0
  181. /package/src/migrations/{latest/agent-connection-pin-strands-peers → v1.0.0-rc.95/0002-agent-connection-pin-strands-peers}/metadata.json +0 -0
  182. /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
  183. /package/src/migrations/{latest/agent-connection-pin-strands-peers → v1.0.0-rc.95/0002-agent-connection-pin-strands-peers}/migration.js +0 -0
  184. /package/src/migrations/{latest/ignore-package-manager-temp-files → v1.0.0-rc.95/0003-ignore-package-manager-temp-files}/metadata.json +0 -0
  185. /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
  186. /package/src/migrations/{latest/ignore-package-manager-temp-files → v1.0.0-rc.95/0003-ignore-package-manager-temp-files}/migration.js +0 -0
  187. /package/src/migrations/{latest/shadcn-package-imports-exports → v1.0.0-rc.95/0004-shadcn-package-imports-exports}/metadata.json +0 -0
  188. /package/src/migrations/{latest/terraform-provider-plugin-cache → v1.0.0-rc.95/0004-shadcn-package-imports-exports}/migration.d.ts +0 -0
  189. /package/src/migrations/{latest/shadcn-package-imports-exports → v1.0.0-rc.95/0004-shadcn-package-imports-exports}/migration.js +0 -0
  190. /package/src/migrations/{latest/gateway-url-accessor → v1.0.0-rc.97/0001-gateway-url-accessor}/__snapshots__/migration.spec.ts.snap +0 -0
  191. /package/src/migrations/{latest/gateway-url-accessor → v1.0.0-rc.97/0001-gateway-url-accessor}/metadata.json +0 -0
  192. /package/src/migrations/{latest/gateway-url-accessor → v1.0.0-rc.97/0001-gateway-url-accessor}/migration.d.ts +0 -0
  193. /package/src/migrations/{latest/gateway-url-accessor → v1.0.0-rc.97/0001-gateway-url-accessor}/migration.js +0 -0
  194. /package/src/migrations/{latest/checkov-scan-cache-inputs → v1.0.0-rc.97/0002-checkov-scan-cache-inputs}/metadata.json +0 -0
  195. /package/src/migrations/{latest/terraform-validate-without-backend → v1.0.0-rc.97/0002-checkov-scan-cache-inputs}/migration.d.ts +0 -0
  196. /package/src/migrations/{latest/checkov-scan-cache-inputs → v1.0.0-rc.97/0002-checkov-scan-cache-inputs}/migration.js +0 -0
  197. /package/src/migrations/{latest/terraform-validate-without-backend → v1.0.0-rc.97/0003-terraform-validate-without-backend}/metadata.json +0 -0
  198. /package/src/migrations/{latest/vitest-coverage-output-dir → v1.0.0-rc.97/0003-terraform-validate-without-backend}/migration.d.ts +0 -0
  199. /package/src/migrations/{latest/terraform-validate-without-backend → v1.0.0-rc.97/0003-terraform-validate-without-backend}/migration.js +0 -0
  200. /package/src/migrations/{latest/py-lambda-powertools-context → v1.0.0-rc.97/0004-py-lambda-powertools-context}/metadata.json +0 -0
  201. /package/src/migrations/{latest/py-lambda-powertools-context → v1.0.0-rc.97/0004-py-lambda-powertools-context}/migration.js +0 -0
  202. /package/src/migrations/{latest/smithy-extension-trait-aliases → v1.0.0-rc.97/0005-smithy-extension-trait-aliases}/__snapshots__/migration.spec.ts.snap +0 -0
  203. /package/src/migrations/{latest/smithy-extension-trait-aliases → v1.0.0-rc.97/0005-smithy-extension-trait-aliases}/metadata.json +0 -0
  204. /package/src/migrations/{latest/smithy-extension-trait-aliases → v1.0.0-rc.97/0005-smithy-extension-trait-aliases}/migration.d.ts +0 -0
  205. /package/src/migrations/{latest/smithy-extension-trait-aliases → v1.0.0-rc.97/0005-smithy-extension-trait-aliases}/migration.js +0 -0
  206. /package/src/migrations/{latest/script-project-quality-gates → v1.0.0-rc.97/0006-script-project-quality-gates}/metadata.json +0 -0
  207. /package/src/migrations/{latest/script-project-quality-gates → v1.0.0-rc.97/0006-script-project-quality-gates}/migration.js +0 -0
@@ -1,13 +1,13 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
3
  exports[`ts#agent#a2a-connection generator > should match snapshot for agent-connection src files > agent-connection-index.ts 1`] = `
4
- "export * from './app/remote-client-strands.js';
4
+ "// Export your library code here
5
+ export * from './app/remote-client-strands.js';
5
6
  export * from './core/tool-errors-strands.js';
6
7
  export * from './core/model-errors-strands.js';
7
8
  export * from './core/with-session-id-strands.js';
8
9
  export * from './core/runtime-config.js';
9
10
  export * from './core/session-context.js';
10
- // Export your library code here
11
11
  "
12
12
  `;
13
13
 
@@ -1,13 +1,13 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
3
  exports[`ts#agent#gateway-connection generator > should match snapshot for agent-connection src files > agent-connection-index.ts 1`] = `
4
- "export * from './app/my-gateway-client-strands.js';
4
+ "// Export your library code here
5
+ export * from './app/my-gateway-client-strands.js';
5
6
  export * from './core/tool-errors-strands.js';
6
7
  export * from './core/model-errors-strands.js';
7
8
  export * from './core/with-session-id-strands.js';
8
9
  export * from './core/runtime-config.js';
9
10
  export * from './core/session-context.js';
10
- // Export your library code here
11
11
  "
12
12
  `;
13
13
 
@@ -1,13 +1,13 @@
1
1
  // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
3
  exports[`ts#agent#mcp-connection generator > should match snapshot for agent-connection src files > agent-connection-index.ts 1`] = `
4
- "export * from './app/inventory-mcp-client-strands.js';
4
+ "// Export your library code here
5
+ export * from './app/inventory-mcp-client-strands.js';
5
6
  export * from './core/tool-errors-strands.js';
6
7
  export * from './core/model-errors-strands.js';
7
8
  export * from './core/with-session-id-strands.js';
8
9
  export * from './core/runtime-config.js';
9
10
  export * from './core/session-context.js';
10
- // Export your library code here
11
11
  "
12
12
  `;
13
13
 
@@ -127,15 +127,7 @@ export declare const DEPENDENCIES: import("../../../utils/declared-dependencies.
127
127
  } & {
128
128
  versionOnly: true;
129
129
  }, Omit<{
130
- readonly name: "clsx";
131
- } & {
132
- versionOnly: true;
133
- }, "when"> & {
134
- when: (m: TsAgentReactConnectionMetadata) => boolean;
135
- } & {
136
- versionOnly: true;
137
- }, Omit<{
138
- readonly name: "tailwind-merge";
130
+ readonly name: "cn";
139
131
  } & {
140
132
  versionOnly: true;
141
133
  }, "when"> & {
@@ -237,7 +237,9 @@ Translate the prose. Everything else is copied from the source exactly as it is:
237
237
  Two things do change:
238
238
 
239
239
  - In frontmatter, translate only \`title\` and \`description\`. Leave every other key and value alone. Frontmatter is YAML, so wrap a value in double quotes whenever it would otherwise begin with a character YAML reserves — for example a title starting with \`@aws/nx-plugin\` must be written as \`"@aws/nx-plugin ..."\`.
240
- - Rewrite link paths that embed the source locale (\`/${config.sourceLanguage}/foo\` becomes \`/${targetLang}/foo\`), and make a \`parentHeading\` match the translated heading it sits under.
240
+ - A \`parentHeading\` matches the translated heading it sits under.
241
+
242
+ One thing that looks like it should change does not: a \`<Link path="...">\` value is locale-agnostic — the component resolves it against the reader's locale — so copy it exactly and never prepend \`${targetLang}\` to it.
241
243
 
242
244
  Write the finished file in one \`create\` call, and never with \`str_replace\` — a partial replacement silently duplicates or splices sections. Do not wrap the file in triple backticks.
243
245
 
@@ -332,6 +334,43 @@ async function restoreCodeBlocks(
332
334
  await fs.writeFile(targetAbsPath, merged.join('\n'), 'utf-8');
333
335
  }
334
336
 
337
+ /**
338
+ * Drop a leading locale segment from every `<Link path>` in the translation.
339
+ *
340
+ * The component resolves `path` against the reader's locale, so a value that
341
+ * already names one renders a doubled segment (`/jp/jp/...`) and 404s. The
342
+ * prompt says to copy these verbatim; this makes it so regardless.
343
+ *
344
+ * Only fenced code is skipped — a snippet demonstrating the component is
345
+ * documentation, not a link to resolve.
346
+ */
347
+ async function stripLocaleFromLinkPaths(
348
+ targetAbsPath: string,
349
+ locales: string[],
350
+ ): Promise<void> {
351
+ const linkPath = new RegExp(
352
+ `(<Link\\b[^>]*?\\bpath=")/?(?:${locales.join('|')})(/|")`,
353
+ 'g',
354
+ );
355
+
356
+ const original = await fs.readFile(targetAbsPath, 'utf-8');
357
+ const { prose, code } = splitOnFences(original);
358
+ const stripped = prose.map((chunk) =>
359
+ chunk.replace(linkPath, (_match, before: string, after: string) =>
360
+ // A bare locale is the locale's landing page, which is the docs root.
361
+ after === '"' ? `${before}"` : `${before}${after}`,
362
+ ),
363
+ );
364
+
365
+ const merged = stripped.flatMap((chunk, i) =>
366
+ i < code.length ? [chunk, code[i]] : [chunk],
367
+ );
368
+ const result = merged.join('\n');
369
+ if (result !== original) {
370
+ await fs.writeFile(targetAbsPath, result, 'utf-8');
371
+ }
372
+ }
373
+
335
374
  /**
336
375
  * Number of times to retry a single (file x language) translation. Large files
337
376
  * occasionally hit transient Bedrock streaming errors; a fresh agent invocation
@@ -344,6 +383,7 @@ const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
344
383
  async function translateFileForLanguage(
345
384
  file: FileToTranslate,
346
385
  targetLang: string,
386
+ locales: string[],
347
387
  ): Promise<void> {
348
388
  const targetAbsPath = path.join(DOCS_DIR, targetLang, file.relativePath);
349
389
 
@@ -384,6 +424,7 @@ async function translateFileForLanguage(
384
424
  try {
385
425
  assertFrontmatterIsParseable(await fs.readFile(targetAbsPath, 'utf-8'));
386
426
  await restoreCodeBlocks(file.sourceAbsPath, targetAbsPath);
427
+ await stripLocaleFromLinkPaths(targetAbsPath, locales);
387
428
  return;
388
429
  } catch (err) {
389
430
  lastError = err;
@@ -510,6 +551,10 @@ async function main() {
510
551
  return;
511
552
  }
512
553
 
554
+ // Every configured locale, not just the requested ones — a `<Link path>` can
555
+ // pick up any of them, whichever languages this run happens to cover.
556
+ const locales = [config.sourceLanguage, ...config.targetLanguages];
557
+
513
558
  // Build one task per (file × target language) — each is a fresh agent invocation,
514
559
  // so context windows stay small no matter how big the docs site is. A single
515
560
  // failing translation records its error rather than aborting the whole run, so
@@ -519,7 +564,7 @@ async function main() {
519
564
  files.map((file) => async () => {
520
565
  log.info(` ${file.relativePath} → ${lang}`);
521
566
  try {
522
- await translateFileForLanguage(file, lang);
567
+ await translateFileForLanguage(file, lang, locales);
523
568
  } catch (err) {
524
569
  log.error(
525
570
  `${file.relativePath} → ${lang}: ${err instanceof Error ? err.message : String(err)}`,
@@ -579,7 +579,7 @@ terraform {
579
579
  required_providers {
580
580
  aws = {
581
581
  source = "hashicorp/aws"
582
- version = "6.62.0"
582
+ version = "6.63.0"
583
583
  }
584
584
  archive = {
585
585
  source = "hashicorp/archive"
@@ -35,7 +35,7 @@ exports[`ts#dynamodb generator > should generate terraform modules when iac is t
35
35
  required_providers {
36
36
  aws = {
37
37
  source = "hashicorp/aws"
38
- version = "6.62.0"
38
+ version = "6.63.0"
39
39
  }
40
40
  }
41
41
  }
@@ -232,7 +232,7 @@ exports[`ts#dynamodb generator > should generate terraform modules when iac is t
232
232
  required_providers {
233
233
  aws = {
234
234
  source = "hashicorp/aws"
235
- version = "6.62.0"
235
+ version = "6.63.0"
236
236
  }
237
237
  random = {
238
238
  source = "hashicorp/random"
@@ -797,9 +797,9 @@ exports[`ts#dynamodb generator > should generate the dynamodb project > packages
797
797
  `;
798
798
 
799
799
  exports[`ts#dynamodb generator > should generate the dynamodb project > packages/my-table/src/index.ts 1`] = `
800
- "export { getDynamoDBClient, resolveTableName } from './client.js';
800
+ "// Export your library code here
801
+ export { getDynamoDBClient, resolveTableName } from './client.js';
801
802
  export * from './entities/index.js';
802
- // Export your library code here
803
803
  "
804
804
  `;
805
805
 
@@ -1451,8 +1451,8 @@ exports[`ts#dynamodb generator > should generate with infra=none then upgrade to
1451
1451
  `;
1452
1452
 
1453
1453
  exports[`ts#dynamodb generator > should generate with infra=none then upgrade to infra=dynamodb > packages/my-table/src/index.ts 1`] = `
1454
- "export { getDynamoDBClient, resolveTableName } from './client.js';
1454
+ "// Export your library code here
1455
+ export { getDynamoDBClient, resolveTableName } from './client.js';
1455
1456
  export * from './entities/index.js';
1456
- // Export your library code here
1457
1457
  "
1458
1458
  `;
@@ -141,7 +141,7 @@ exports[`ts-lambda-function generator > terraform iac > should generate terrafor
141
141
  required_providers {
142
142
  aws = {
143
143
  source = "hashicorp/aws"
144
- version = "6.62.0"
144
+ version = "6.63.0"
145
145
  }
146
146
  archive = {
147
147
  source = "hashicorp/archive"
@@ -326,7 +326,7 @@ exports[`ts-lambda-function generator > terraform iac > should match snapshot fo
326
326
  required_providers {
327
327
  aws = {
328
328
  source = "hashicorp/aws"
329
- version = "6.62.0"
329
+ version = "6.63.0"
330
330
  }
331
331
  archive = {
332
332
  source = "hashicorp/archive"
@@ -155,7 +155,7 @@ exports[`ts#mcp-server generator > should match snapshot for Terraform generated
155
155
  required_providers {
156
156
  aws = {
157
157
  source = "hashicorp/aws"
158
- version = "6.62.0"
158
+ version = "6.63.0"
159
159
  }
160
160
  null = {
161
161
  source = "hashicorp/null"
@@ -514,7 +514,7 @@ resource "null_resource" "runtime_ready" {
514
514
 
515
515
  provisioner "local-exec" {
516
516
  command = <<-EOT
517
- uv run --with boto3==1.43.83 python -c "
517
+ uv run --with boto3==1.43.89 python -c "
518
518
  import boto3
519
519
  import json
520
520
  import os
@@ -737,9 +737,9 @@ output "security_group_id" {
737
737
 
738
738
  exports[`ts#mcp-server generator > should match snapshot for generated files > mcp-server-http.ts 1`] = `
739
739
  "#!/usr/bin/env node
740
- import { createServer } from './server.js';
741
740
  import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
742
741
  import express, { Request, Response } from 'express';
742
+ import { createServer } from './server.js';
743
743
 
744
744
  const PORT = parseInt(process.env.PORT || '8000');
745
745
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { createServer } from './server<% if (esm) { %>.js<% } %>';
3
2
  import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
4
3
  import express, { Request, Response } from 'express';
4
+ import { createServer } from './server<% if (esm) { %>.js<% } %>';
5
5
 
6
6
  const PORT = parseInt(process.env.PORT || '8000');
7
7
 
@@ -204,7 +204,7 @@ exports[`nx-generator generator > within @aws/nx-plugin > should update generato
204
204
  `;
205
205
 
206
206
  exports[`nx-generator generator > within another workspace > should generate an example schema, generator and test > local-generator.spec.ts 1`] = `
207
- "import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
207
+ "import { createTreeUsingTsSolutionSetup } from '@aws/nx-plugin/sdk/utils/test';
208
208
  import { Tree } from '@nx/devkit';
209
209
  import { fooBarGenerator } from './generator.js';
210
210
 
@@ -212,7 +212,7 @@ describe('foo#bar generator', () => {
212
212
  let tree: Tree;
213
213
 
214
214
  beforeEach(() => {
215
- tree = createTreeWithEmptyWorkspace();
215
+ tree = createTreeUsingTsSolutionSetup();
216
216
  });
217
217
 
218
218
  it('should run successfully', async () => {
@@ -1,4 +1,4 @@
1
- import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
1
+ import { createTreeUsingTsSolutionSetup } from '@aws/nx-plugin/sdk/utils/test';
2
2
  import { Tree } from '@nx/devkit';
3
3
  import { <%- nameCamelCase %>Generator } from './generator<% if (esm) { %>.js<% } %>';
4
4
 
@@ -6,7 +6,7 @@ describe('<%- name %> generator', () => {
6
6
  let tree: Tree;
7
7
 
8
8
  beforeEach(() => {
9
- tree = createTreeWithEmptyWorkspace();
9
+ tree = createTreeUsingTsSolutionSetup();
10
10
  });
11
11
 
12
12
  it('should run successfully', async () => {
@@ -14,7 +14,7 @@ import { isEsmWorkspace } from "../../utils/module-format.js";
14
14
  import { kebabCase } from "../../utils/names.js";
15
15
  import { getGeneratorInfo, isNxPluginForAwsWorkspace } from "../../utils/nx.js";
16
16
  import { sortObjectKeys } from "../../utils/object.js";
17
- import { addNxPluginDependencies, configureNxPluginPackageJson, NX_PLUGIN_DEPENDENCIES, readNxPluginProject } from "../nx-plugin/utils.js";
17
+ import { addNxPluginDependencies, addNxPluginManifestAssets, configureNxPluginPackageJson, NX_PLUGIN_DEPENDENCIES, readNxPluginProject } from "../nx-plugin/utils.js";
18
18
  export const DEPENDENCIES = declareDependencies()({
19
19
  ts: [
20
20
  ...NX_PLUGIN_DEPENDENCIES
@@ -55,6 +55,8 @@ export const NX_MIGRATION_GENERATOR_INFO = getGeneratorInfo(import.meta.filename
55
55
  const pluginPackageJsonPath = configureNxPluginPackageJson(tree, plugin, 'nx-migrations', {
56
56
  migrations: './migrations.json'
57
57
  });
58
+ // migrations.json must reach the published tarball the package.json points at
59
+ addNxPluginManifestAssets(tree, plugin);
58
60
  // Migrations sit three levels below the source root, so in this repo the
59
61
  // shared utils are relative. Elsewhere they come from the SDK.
60
62
  const formatImportPath = isNxPluginForAws ? '../../../utils/format' : `${PackageJson.name}/sdk/utils/format`;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/nx-migration/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 readJson,\n type Tree,\n writeJson,\n} from '@nx/devkit';\nimport PackageJson from '../../../package.json' with { type: 'json' };\nimport { declareDependencies } from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport {\n LATEST_MIGRATIONS_DIR,\n migrationKey,\n} from '../../utils/migration-versions.js';\nimport { isEsmWorkspace } from '../../utils/module-format.js';\nimport { kebabCase } from '../../utils/names.js';\nimport {\n getGeneratorInfo,\n isNxPluginForAwsWorkspace,\n type NxGeneratorInfo,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport {\n addNxPluginDependencies,\n configureNxPluginPackageJson,\n NX_PLUGIN_DEPENDENCIES,\n readNxPluginProject,\n} from '../nx-plugin/utils.js';\nimport type { TsNxMigrationGeneratorSchema } from './schema';\n\nexport const DEPENDENCIES = declareDependencies()({\n ts: [...NX_PLUGIN_DEPENDENCIES],\n});\n\nexport const NX_MIGRATION_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\n/**\n * Scaffolds a migration in an Nx Plugin project and registers it in the\n * plugin's `migrations.json` (creating the manifest and wiring the\n * `nx-migrations` field into the plugin's `package.json` if absent), so\n * `nx migrate` applies it when users upgrade the plugin.\n *\n * Supports all three migration kinds:\n * - `deterministic`: a codemod (`implementation`).\n * - `agentic`: a `prompt` markdown file applied by the user's agent.\n * - `hybrid`: both — the codemod does the mechanical part and returns\n * `agentContext`, then the prompt hands off to the agent for the rest.\n *\n * No `version` is written — the plugin author stamps versions at release time.\n */\nexport const tsNxMigrationGenerator = async (\n tree: Tree,\n options: TsNxMigrationGeneratorSchema,\n): Promise<GeneratorCallback | void> => {\n const name = kebabCase(options.name);\n // Shown by `nx migrate` when the migration runs, so it needs to say something\n const description =\n options.description ?? 'TODO: Add short description of the migration';\n const kind = options.kind ?? 'deterministic';\n\n const hasImplementation = kind === 'deterministic' || kind === 'hybrid';\n const hasPrompt = kind === 'agentic' || kind === 'hybrid';\n const isHybrid = kind === 'hybrid';\n\n const plugin = readNxPluginProject(tree, options.project);\n\n const sourceRoot = plugin.sourceRoot ?? joinPathFragments(plugin.root, 'src');\n const srcDir = sourceRoot.split('/').filter(Boolean).pop();\n // Migrations are grouped by the release that ships them. A new one lands in\n // `latest` — the release that picks it up moves it into its version folder.\n const migrationPath = `${srcDir}/migrations/${LATEST_MIGRATIONS_DIR}/${name}`;\n const migrationDir = joinPathFragments(\n sourceRoot,\n 'migrations',\n LATEST_MIGRATIONS_DIR,\n name,\n );\n const key = migrationKey(LATEST_MIGRATIONS_DIR, name);\n\n const isNxPluginForAws = isNxPluginForAwsWorkspace(tree);\n\n // Point the plugin at its migrations manifest so `nx migrate` finds them\n const pluginPackageJsonPath = configureNxPluginPackageJson(\n tree,\n plugin,\n 'nx-migrations',\n { migrations: './migrations.json' },\n );\n\n // Migrations sit three levels below the source root, so in this repo the\n // shared utils are relative. Elsewhere they come from the SDK.\n const formatImportPath = isNxPluginForAws\n ? '../../../utils/format'\n : `${PackageJson.name}/sdk/utils/format`;\n const testImportPath = isNxPluginForAws\n ? '../../../utils/test'\n : `${PackageJson.name}/sdk/utils/test`;\n // A generated workspace resolves with `nodenext`, which needs the explicit\n // extension on the spec's sibling import; this repo resolves with `bundler`,\n // which takes it extensionless.\n const esm = !isNxPluginForAws && isEsmWorkspace(tree);\n\n // One template set covers all kinds — scaffold it, then prune what this kind\n // doesn't use.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files'),\n migrationDir,\n {\n name,\n description,\n isHybrid,\n formatImportPath,\n testImportPath,\n esm,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n if (!hasImplementation) {\n tree.delete(joinPathFragments(migrationDir, 'migration.ts'));\n tree.delete(joinPathFragments(migrationDir, 'migration.spec.ts'));\n }\n if (!hasPrompt) {\n tree.delete(joinPathFragments(migrationDir, 'prompt.md'));\n }\n\n if (isNxPluginForAws) {\n // In the plugin's own repo migrations.json is assembled from these folders\n // at build time (see utils/migration-manifest.ts), so registration is just\n // the description beside the code — its kind comes from the files present.\n // Two migration PRs then touch disjoint files rather than one shared manifest.\n const metadataPath = joinPathFragments(migrationDir, 'metadata.json');\n if (!tree.exists(metadataPath)) {\n writeJson(tree, metadataPath, { description });\n }\n } else {\n // Elsewhere, register the migration under its folder-prefixed key. The fields\n // present discriminate the kind for nx, and paths are relative to\n // migrations.json. No version is written, but an already-stamped one is kept.\n const migrationsJsonPath = joinPathFragments(\n plugin.root,\n 'migrations.json',\n );\n const migrationsJson = tree.exists(migrationsJsonPath)\n ? readJson(tree, migrationsJsonPath)\n : {\n $schema: 'http://json-schema.org/schema',\n name: readJson(tree, pluginPackageJsonPath).name ?? plugin.name,\n generators: {},\n };\n writeJson(tree, migrationsJsonPath, {\n ...migrationsJson,\n generators: sortObjectKeys({\n ...migrationsJson.generators,\n [key]: {\n ...(migrationsJson.generators?.[key]?.version\n ? { version: migrationsJson.generators[key].version }\n : {}),\n description,\n ...(hasImplementation\n ? { implementation: `./${migrationPath}/migration` }\n : {}),\n ...(hasPrompt ? { prompt: `./${migrationPath}/prompt.md` } : {}),\n },\n }),\n });\n }\n\n // Codemods import @nx/devkit and the @aws/nx-plugin SDK, both of which must\n // resolve for nx to run them\n if (hasImplementation) {\n addNxPluginDependencies(tree, pluginPackageJsonPath, DEPENDENCIES);\n }\n\n await addGeneratorMetricsIfApplicable(tree, [NX_MIGRATION_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n\n if (hasImplementation && !isNxPluginForAws) {\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n ensureResolvable: ['@nx/devkit'],\n });\n }\n};\n\nexport default tsNxMigrationGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readJson","writeJson","PackageJson","type","declareDependencies","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","LATEST_MIGRATIONS_DIR","migrationKey","isEsmWorkspace","kebabCase","getGeneratorInfo","isNxPluginForAwsWorkspace","sortObjectKeys","addNxPluginDependencies","configureNxPluginPackageJson","NX_PLUGIN_DEPENDENCIES","readNxPluginProject","DEPENDENCIES","ts","NX_MIGRATION_GENERATOR_INFO","filename","tsNxMigrationGenerator","tree","options","name","description","kind","hasImplementation","hasPrompt","isHybrid","plugin","project","sourceRoot","root","srcDir","split","filter","Boolean","pop","migrationPath","migrationDir","key","isNxPluginForAws","pluginPackageJsonPath","migrations","formatImportPath","testImportPath","esm","dirname","overwriteStrategy","KeepExisting","delete","metadataPath","exists","migrationsJsonPath","migrationsJson","$schema","generators","version","implementation","prompt","preferInstallDependencies","languages","ensureResolvable"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EACjBC,QAAQ,EAERC,SAAS,QACJ,aAAa;AACpB,OAAOC,iBAAiB,6BAA6B;IAAEC,MAAM;AAAO,EAAE;AACtE,SAASC,mBAAmB,QAAQ,uCAAuC;AAC3E,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SACEC,qBAAqB,EACrBC,YAAY,QACP,oCAAoC;AAC3C,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,S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,EAAE;oBACL,GAAIc,eAAeE,UAAU,EAAE,CAAChB,IAAI,EAAEiB,UAClC;wBAAEA,SAASH,eAAeE,UAAU,CAAChB,IAAI,CAACiB,OAAO;oBAAC,IAClD,CAAC,CAAC;oBACNjC;oBACA,GAAIE,oBACA;wBAAEgC,gBAAgB,CAAC,EAAE,EAAEpB,cAAc,UAAU,CAAC;oBAAC,IACjD,CAAC,CAAC;oBACN,GAAIX,YAAY;wBAAEgC,QAAQ,CAAC,EAAE,EAAErB,cAAc,UAAU,CAAC;oBAAC,IAAI,CAAC,CAAC;gBACjE;YACF;QACF;IACF;IAEA,4EAA4E;IAC5E,6BAA6B;IAC7B,IAAIZ,mBAAmB;QACrBd,wBAAwBS,MAAMqB,uBAAuB1B;IACvD;IAEA,MAAMZ,gCAAgCiB,MAAM;QAACH;KAA4B;IAEzE,MAAMhB,qBAAqBmB;IAE3B,IAAIK,qBAAqB,CAACe,kBAAkB;QAC1C,OAAO,IACLtC,oBAAoBkB,MAAMC,QAAQsC,yBAAyB,EAAE;gBAC3DC,WAAW;oBAAC;iBAAa;gBACzBC,kBAAkB;oBAAC;iBAAa;YAClC;IACJ;AACF,EAAE;AAEF,eAAe1C,uBAAuB"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/nx-migration/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 readJson,\n type Tree,\n writeJson,\n} from '@nx/devkit';\nimport PackageJson from '../../../package.json' with { type: 'json' };\nimport { declareDependencies } from '../../utils/declared-dependencies.js';\nimport { formatFilesInSubtree } from '../../utils/format.js';\nimport { installDependencies } from '../../utils/install.js';\nimport { addGeneratorMetricsIfApplicable } from '../../utils/metrics.js';\nimport {\n LATEST_MIGRATIONS_DIR,\n migrationKey,\n} from '../../utils/migration-versions.js';\nimport { isEsmWorkspace } from '../../utils/module-format.js';\nimport { kebabCase } from '../../utils/names.js';\nimport {\n getGeneratorInfo,\n isNxPluginForAwsWorkspace,\n type NxGeneratorInfo,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport {\n addNxPluginDependencies,\n addNxPluginManifestAssets,\n configureNxPluginPackageJson,\n NX_PLUGIN_DEPENDENCIES,\n readNxPluginProject,\n} from '../nx-plugin/utils.js';\nimport type { TsNxMigrationGeneratorSchema } from './schema';\n\nexport const DEPENDENCIES = declareDependencies()({\n ts: [...NX_PLUGIN_DEPENDENCIES],\n});\n\nexport const NX_MIGRATION_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\n/**\n * Scaffolds a migration in an Nx Plugin project and registers it in the\n * plugin's `migrations.json` (creating the manifest and wiring the\n * `nx-migrations` field into the plugin's `package.json` if absent), so\n * `nx migrate` applies it when users upgrade the plugin.\n *\n * Supports all three migration kinds:\n * - `deterministic`: a codemod (`implementation`).\n * - `agentic`: a `prompt` markdown file applied by the user's agent.\n * - `hybrid`: both — the codemod does the mechanical part and returns\n * `agentContext`, then the prompt hands off to the agent for the rest.\n *\n * No `version` is written — the plugin author stamps versions at release time.\n */\nexport const tsNxMigrationGenerator = async (\n tree: Tree,\n options: TsNxMigrationGeneratorSchema,\n): Promise<GeneratorCallback | void> => {\n const name = kebabCase(options.name);\n // Shown by `nx migrate` when the migration runs, so it needs to say something\n const description =\n options.description ?? 'TODO: Add short description of the migration';\n const kind = options.kind ?? 'deterministic';\n\n const hasImplementation = kind === 'deterministic' || kind === 'hybrid';\n const hasPrompt = kind === 'agentic' || kind === 'hybrid';\n const isHybrid = kind === 'hybrid';\n\n const plugin = readNxPluginProject(tree, options.project);\n\n const sourceRoot = plugin.sourceRoot ?? joinPathFragments(plugin.root, 'src');\n const srcDir = sourceRoot.split('/').filter(Boolean).pop();\n // Migrations are grouped by the release that ships them. A new one lands in\n // `latest` — the release that picks it up moves it into its version folder.\n const migrationPath = `${srcDir}/migrations/${LATEST_MIGRATIONS_DIR}/${name}`;\n const migrationDir = joinPathFragments(\n sourceRoot,\n 'migrations',\n LATEST_MIGRATIONS_DIR,\n name,\n );\n const key = migrationKey(LATEST_MIGRATIONS_DIR, name);\n\n const isNxPluginForAws = isNxPluginForAwsWorkspace(tree);\n\n // Point the plugin at its migrations manifest so `nx migrate` finds them\n const pluginPackageJsonPath = configureNxPluginPackageJson(\n tree,\n plugin,\n 'nx-migrations',\n { migrations: './migrations.json' },\n );\n\n // migrations.json must reach the published tarball the package.json points at\n addNxPluginManifestAssets(tree, plugin);\n\n // Migrations sit three levels below the source root, so in this repo the\n // shared utils are relative. Elsewhere they come from the SDK.\n const formatImportPath = isNxPluginForAws\n ? '../../../utils/format'\n : `${PackageJson.name}/sdk/utils/format`;\n const testImportPath = isNxPluginForAws\n ? '../../../utils/test'\n : `${PackageJson.name}/sdk/utils/test`;\n // A generated workspace resolves with `nodenext`, which needs the explicit\n // extension on the spec's sibling import; this repo resolves with `bundler`,\n // which takes it extensionless.\n const esm = !isNxPluginForAws && isEsmWorkspace(tree);\n\n // One template set covers all kinds — scaffold it, then prune what this kind\n // doesn't use.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files'),\n migrationDir,\n {\n name,\n description,\n isHybrid,\n formatImportPath,\n testImportPath,\n esm,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n if (!hasImplementation) {\n tree.delete(joinPathFragments(migrationDir, 'migration.ts'));\n tree.delete(joinPathFragments(migrationDir, 'migration.spec.ts'));\n }\n if (!hasPrompt) {\n tree.delete(joinPathFragments(migrationDir, 'prompt.md'));\n }\n\n if (isNxPluginForAws) {\n // In the plugin's own repo migrations.json is assembled from these folders\n // at build time (see utils/migration-manifest.ts), so registration is just\n // the description beside the code — its kind comes from the files present.\n // Two migration PRs then touch disjoint files rather than one shared manifest.\n const metadataPath = joinPathFragments(migrationDir, 'metadata.json');\n if (!tree.exists(metadataPath)) {\n writeJson(tree, metadataPath, { description });\n }\n } else {\n // Elsewhere, register the migration under its folder-prefixed key. The fields\n // present discriminate the kind for nx, and paths are relative to\n // migrations.json. No version is written, but an already-stamped one is kept.\n const migrationsJsonPath = joinPathFragments(\n plugin.root,\n 'migrations.json',\n );\n const migrationsJson = tree.exists(migrationsJsonPath)\n ? readJson(tree, migrationsJsonPath)\n : {\n $schema: 'http://json-schema.org/schema',\n name: readJson(tree, pluginPackageJsonPath).name ?? plugin.name,\n generators: {},\n };\n writeJson(tree, migrationsJsonPath, {\n ...migrationsJson,\n generators: sortObjectKeys({\n ...migrationsJson.generators,\n [key]: {\n ...(migrationsJson.generators?.[key]?.version\n ? { version: migrationsJson.generators[key].version }\n : {}),\n description,\n ...(hasImplementation\n ? { implementation: `./${migrationPath}/migration` }\n : {}),\n ...(hasPrompt ? { prompt: `./${migrationPath}/prompt.md` } : {}),\n },\n }),\n });\n }\n\n // Codemods import @nx/devkit and the @aws/nx-plugin SDK, both of which must\n // resolve for nx to run them\n if (hasImplementation) {\n addNxPluginDependencies(tree, pluginPackageJsonPath, DEPENDENCIES);\n }\n\n await addGeneratorMetricsIfApplicable(tree, [NX_MIGRATION_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n\n if (hasImplementation && !isNxPluginForAws) {\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n ensureResolvable: ['@nx/devkit'],\n });\n }\n};\n\nexport default tsNxMigrationGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","readJson","writeJson","PackageJson","type","declareDependencies","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","LATEST_MIGRATIONS_DIR","migrationKey","isEsmWorkspace","kebabCase","getGeneratorInfo","isNxPluginForAwsWorkspace","sortObjectKeys","addNxPluginDependencies","addNxPluginManifestAssets","configureNxPluginPackageJson","NX_PLUGIN_DEPENDENCIES","readNxPluginProject","DEPENDENCIES","ts","NX_MIGRATION_GENERATOR_INFO","filename","tsNxMigrationGenerator","tree","options","name","description","kind","hasImplementation","hasPrompt","isHybrid","plugin","project","sourceRoot","root","srcDir","split","filter","Boolean","pop","migrationPath","migrationDir","key","isNxPluginForAws","pluginPackageJsonPath","migrations","formatImportPath","testImportPath","esm","dirname","overwriteStrategy","KeepExisting","delete","metadataPath","exists","migrationsJsonPath","migrationsJson","$schema","generators","version","implementation","prompt","preferInstallDependencies","languages","ensureResolvable"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EACjBC,QAAQ,EAERC,SAAS,QACJ,aAAa;AACpB,OAAOC,iBAAiB,6BAA6B;IAAEC,MAAM;AAAO,EAAE;AACtE,SAASC,mBAAmB,QAAQ,uCAAuC;AAC3E,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SACEC,qBAAqB,EACrBC,YAAY,QACP,oCAAoC;AAC3C,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SACEC,gBAAgB,EAChBC,yBAAyB,QAEpB,oBAAoB;AAC3B,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SACEC,uBAAuB,EACvBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,EACtBC,mBAAmB,QACd,wBAAwB;AAG/B,OAAO,MAAMC,eAAehB,sBAAsB;IAChDiB,IAAI;WAAIH;KAAuB;AACjC,GAAG;AAEH,OAAO,MAAMI,8BAA+CV,iBAC1D,YAAYW,QAAQ,EACpB;AAEF;;;;;;;;;;;;;CAaC,GACD,OAAO,MAAMC,yBAAyB,OACpCC,MACAC;IAEA,MAAMC,OAAOhB,UAAUe,QAAQC,IAAI;IACnC,8EAA8E;IAC9E,MAAMC,cACJF,QAAQE,WAAW,IAAI;IACzB,MAAMC,OAAOH,QAAQG,IAAI,IAAI;IAE7B,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CAAgCkB,MAAM;QAACH;KAA4B;IAEzE,MAAMjB,qBAAqBoB;IAE3B,IAAIK,qBAAqB,CAACe,kBAAkB;QAC1C,OAAO,IACLvC,oBAAoBmB,MAAMC,QAAQsC,yBAAyB,EAAE;gBAC3DC,WAAW;oBAAC;iBAAa;gBACzBC,kBAAkB;oBAAC;iBAAa;YAClC;IACJ;AACF,EAAE;AAEF,eAAe1C,uBAAuB"}
@@ -2,9 +2,9 @@
2
2
 
3
3
  exports[`ts#nx-plugin generator > should generate MCP server files > test-plugin/src/mcp-server/http.ts 1`] = `
4
4
  "#!/usr/bin/env node
5
- import { createServer } from './server.js';
6
5
  import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
7
6
  import express, { Request, Response } from 'express';
7
+ import { createServer } from './server.js';
8
8
 
9
9
  const PORT = parseInt(process.env.PORT || '8000');
10
10
 
@@ -271,30 +271,6 @@ Then, install the plugin package to ensure generators are available:
271
271
  "
272
272
  `;
273
273
 
274
- exports[`ts#nx-plugin generator > should generate MCP server files > test-plugin/src/mcp-server/tools/divide.ts 1`] = `
275
- "import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
276
- import { z } from 'zod';
277
-
278
- export const registerDivideTool = (server: McpServer) => {
279
- server.registerTool(
280
- 'divide',
281
- {
282
- description: 'divides two numbers',
283
- inputSchema: {
284
- a: z.number(),
285
- b: z
286
- .number()
287
- .refine((n) => n !== 0, { message: 'Cannot divide by zero' }),
288
- },
289
- },
290
- async ({ a, b }) => ({
291
- content: [{ type: 'text' as const, text: String(a / b) }],
292
- }),
293
- );
294
- };
295
- "
296
- `;
297
-
298
274
  exports[`ts#nx-plugin generator > should generate MCP server files > test-plugin/src/mcp-server/tools/general-guidance.ts 1`] = `
299
275
  "import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
300
276
  import * as fs from 'fs';
@@ -11,7 +11,7 @@ import { addDependencyToTargetIfNotPresent, addGeneratorMetadata, getGeneratorIn
11
11
  import { sortObjectKeys } from "../../utils/object.js";
12
12
  import tsProjectGenerator, { getTsLibDetails } from "../lib/generator.js";
13
13
  import tsMcpServerGenerator from "../mcp-server/generator.js";
14
- import { configureTsProjectAsNxPlugin, NX_PLUGIN_DEPENDENCIES } from "./utils.js";
14
+ import { configureTsProjectAsNxPlugin, NX_PLUGIN_DEPENDENCIES, nxPluginManifestAssets } from "./utils.js";
15
15
  export const DEPENDENCIES = declareDependencies()({
16
16
  ts: [
17
17
  ...NX_PLUGIN_DEPENDENCIES
@@ -54,16 +54,7 @@ export const tsNxPluginGenerator = async (tree, options)=>{
54
54
  glob: '**/*.d.ts',
55
55
  output: './src'
56
56
  },
57
- {
58
- input: './{projectRoot}',
59
- glob: 'generators.json',
60
- output: '.'
61
- },
62
- {
63
- input: './{projectRoot}',
64
- glob: 'executors.json',
65
- output: '.'
66
- }
57
+ ...nxPluginManifestAssets()
67
58
  ]
68
59
  }
69
60
  },
@@ -77,6 +68,17 @@ export const tsNxPluginGenerator = async (tree, options)=>{
77
68
  // Sort targets so their order is stable regardless of insertion order.
78
69
  project.targets = sortObjectKeys(project.targets);
79
70
  updateProjectConfiguration(tree, fullyQualifiedName, project);
71
+ const mcpPath = joinPathFragments(project.sourceRoot, 'mcp-server');
72
+ // The sample server and tools ts#mcp-server scaffolds are replaced by the
73
+ // generator MCP server below. Only the ones it creates in this run are
74
+ // removed, so a re-run leaves the server the user owns and has customised.
75
+ const SAMPLE_MCP_FILES = [
76
+ 'server.ts',
77
+ 'tools/add.ts',
78
+ 'tools/divide.ts',
79
+ 'resources/sample-guidance.ts'
80
+ ];
81
+ const preexistingSampleFiles = new Set(SAMPLE_MCP_FILES.filter((file)=>tree.exists(joinPathFragments(mcpPath, file))));
80
82
  // Add an MCP Server
81
83
  await tsMcpServerGenerator(tree, {
82
84
  project: fullyQualifiedName,
@@ -84,12 +86,12 @@ export const tsNxPluginGenerator = async (tree, options)=>{
84
86
  iac: 'cdk',
85
87
  preferInstallDependencies: false
86
88
  });
87
- const mcpPath = joinPathFragments(project.sourceRoot, 'mcp-server');
88
- const mcpServerPath = joinPathFragments(mcpPath, 'server.ts');
89
- // Remove the sample server and tools
90
- tree.delete(mcpServerPath);
91
- tree.delete(joinPathFragments(mcpPath, 'tools', 'add.ts'));
92
- tree.delete(joinPathFragments(mcpPath, 'resources', 'sample-guidance.ts'));
89
+ for (const file of SAMPLE_MCP_FILES){
90
+ const sampleFilePath = joinPathFragments(mcpPath, file);
91
+ if (!preexistingSampleFiles.has(file) && tree.exists(sampleFilePath)) {
92
+ tree.delete(sampleFilePath);
93
+ }
94
+ }
93
95
  // Add generator MCP server
94
96
  generateFiles(tree, joinPathFragments(import.meta.dirname, 'files', 'mcp-server'), mcpPath, {
95
97
  name: fullyQualifiedName,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/nx-plugin/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 Tree,\n updateJson,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { declareDependencies } 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 {\n addDependencyToTargetIfNotPresent,\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport tsProjectGenerator, { getTsLibDetails } from '../lib/generator.js';\nimport tsMcpServerGenerator from '../mcp-server/generator.js';\nimport type { TsNxPluginGeneratorSchema } from './schema';\nimport {\n configureTsProjectAsNxPlugin,\n NX_PLUGIN_DEPENDENCIES,\n} from './utils.js';\n\nexport const DEPENDENCIES = declareDependencies()({\n ts: [...NX_PLUGIN_DEPENDENCIES],\n});\n\nexport const TS_NX_PLUGIN_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const tsNxPluginGenerator = async (\n tree: Tree,\n options: TsNxPluginGeneratorSchema,\n): Promise<GeneratorCallback> => {\n // Generate a TypeScript project as the base\n const { fullyQualifiedName, dir } = getTsLibDetails(tree, options);\n await tsProjectGenerator(tree, {\n ...options,\n preferInstallDependencies: false,\n });\n\n // Configure the typescript project as an Nx Plugin\n configureTsProjectAsNxPlugin(tree, fullyQualifiedName, DEPENDENCIES);\n\n // Add a \"package\" target which creates a package which can be published to NPM\n const project = readProjectConfigurationUnqualified(tree, fullyQualifiedName);\n project.targets = {\n ...project.targets,\n package: {\n executor: '@nx/js:tsc',\n outputs: ['{options.outputPath}'],\n options: {\n outputPath: `dist/{projectRoot}/package`,\n main: `{projectRoot}/src/index.ts`,\n tsConfig: `{projectRoot}/tsconfig.lib.json`,\n assets: [\n `{projectRoot}/*.md`,\n `{projectRoot}/LICENSE*`,\n `{projectRoot}/NOTICE`,\n {\n input: './{projectRoot}/src',\n glob: '**/!(*.ts)',\n output: './src',\n },\n {\n input: './{projectRoot}/src',\n glob: '**/*.d.ts',\n output: './src',\n },\n {\n input: './{projectRoot}',\n glob: 'generators.json',\n output: '.',\n },\n {\n input: './{projectRoot}',\n glob: 'executors.json',\n output: '.',\n },\n ],\n },\n },\n build: {\n ...project.targets?.build,\n },\n };\n // Append the package dependency without moving an existing entry, so re-runs\n // do not reorder the build dependencies.\n addDependencyToTargetIfNotPresent(project, 'build', 'package');\n // Sort targets so their order is stable regardless of insertion order.\n project.targets = sortObjectKeys(project.targets);\n updateProjectConfiguration(tree, fullyQualifiedName, project);\n\n // Add an MCP Server\n await tsMcpServerGenerator(tree, {\n project: fullyQualifiedName,\n infra: 'none',\n iac: 'cdk', // not used\n preferInstallDependencies: false,\n });\n\n const mcpPath = joinPathFragments(project.sourceRoot, 'mcp-server');\n const mcpServerPath = joinPathFragments(mcpPath, 'server.ts');\n\n // Remove the sample server and tools\n tree.delete(mcpServerPath);\n tree.delete(joinPathFragments(mcpPath, 'tools', 'add.ts'));\n tree.delete(joinPathFragments(mcpPath, 'resources', 'sample-guidance.ts'));\n\n // Add generator MCP server\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'mcp-server'),\n mcpPath,\n {\n name: fullyQualifiedName,\n ...esmVars(tree),\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n addGeneratorMetadata(tree, project.name, TS_NX_PLUGIN_GENERATOR_INFO);\n\n await addGeneratorMetricsIfApplicable(tree, [TS_NX_PLUGIN_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default tsNxPluginGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","declareDependencies","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","esmVars","addDependencyToTargetIfNotPresent","addGeneratorMetadata","getGeneratorInfo","readProjectConfigurationUnqualified","sortObjectKeys","tsProjectGenerator","getTsLibDetails","tsMcpServerGenerator","configureTsProjectAsNxPlugin","NX_PLUGIN_DEPENDENCIES","DEPENDENCIES","ts","TS_NX_PLUGIN_GENERATOR_INFO","filename","tsNxPluginGenerator","tree","options","fullyQualifiedName","dir","preferInstallDependencies","project","targets","package","executor","outputs","outputPath","main","tsConfig","assets","input","glob","output","build","infra","iac","mcpPath","sourceRoot","mcpServerPath","delete","dirname","name","overwriteStrategy","KeepExisting","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAGjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,mBAAmB,QAAQ,uCAAuC;AAC3E,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ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AAQ;oBACV;oBACA;wBACEF,OAAO;wBACPC,MAAM;wBACNC,QAAQ;oBACV;iBACD;YACH;QACF;QACAC,OAAO;YACL,GAAGZ,QAAQC,OAAO,EAAEW,KAAK;QAC3B;IACF;IACA,6EAA6E;IAC7E,yCAAyC;IACzChC,kCAAkCoB,SAAS,SAAS;IACpD,uEAAuE;IACvEA,QAAQC,OAAO,GAAGjB,eAAegB,QAAQC,OAAO;IAChD3B,2BAA2BqB,MAAME,oBAAoBG;IAErD,oBAAoB;IACpB,MAAMb,qBAAqBQ,MAAM;QAC/BK,SAASH;QACTgB,OAAO;QACPC,KAAK;QACLf,2BAA2B;IAC7B;IAEA,MAAMgB,UAAU3C,kBAAkB4B,QAAQgB,UAAU,EAAE;IACtD,MAAMC,gBAAgB7C,kBAAkB2C,SAAS;IAEjD,qCAAqC;IACrCpB,KAAKuB,MAAM,CAACD;IACZtB,KAAKuB,MAAM,CAAC9C,kBAAkB2C,SAAS,SAAS;IAChDpB,KAAKuB,MAAM,CAAC9C,kBAAkB2C,SAAS,aAAa;IAEpD,2BAA2B;IAC3B5C,cACEwB,MACAvB,kBAAkB,YAAY+C,OAAO,EAAE,SAAS,eAChDJ,SACA;QACEK,MAAMvB;QACN,GAAGlB,QAAQgB,KAAK;IAClB,GACA;QAAE0B,mBAAmBhD,kBAAkBiD,YAAY;IAAC;IAGtDzC,qBAAqBc,MAAMK,QAAQoB,IAAI,EAAE5B;IAEzC,MAAMd,gCAAgCiB,MAAM;QAACH;KAA4B;IAEzE,MAAMhB,qBAAqBmB;IAC3B,OAAO,IACLlB,oBAAoBkB,MAAMC,QAAQG,yBAAyB,EAAE;YAC3DwB,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AAEF,eAAe7B,oBAAoB"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/ts/nx-plugin/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 Tree,\n updateJson,\n updateProjectConfiguration,\n} from '@nx/devkit';\nimport { declareDependencies } 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 {\n addDependencyToTargetIfNotPresent,\n addGeneratorMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../utils/nx.js';\nimport { sortObjectKeys } from '../../utils/object.js';\nimport tsProjectGenerator, { getTsLibDetails } from '../lib/generator.js';\nimport tsMcpServerGenerator from '../mcp-server/generator.js';\nimport type { TsNxPluginGeneratorSchema } from './schema';\nimport {\n configureTsProjectAsNxPlugin,\n NX_PLUGIN_DEPENDENCIES,\n nxPluginManifestAssets,\n} from './utils.js';\n\nexport const DEPENDENCIES = declareDependencies()({\n ts: [...NX_PLUGIN_DEPENDENCIES],\n});\n\nexport const TS_NX_PLUGIN_GENERATOR_INFO: NxGeneratorInfo = getGeneratorInfo(\n import.meta.filename,\n);\n\nexport const tsNxPluginGenerator = async (\n tree: Tree,\n options: TsNxPluginGeneratorSchema,\n): Promise<GeneratorCallback> => {\n // Generate a TypeScript project as the base\n const { fullyQualifiedName, dir } = getTsLibDetails(tree, options);\n await tsProjectGenerator(tree, {\n ...options,\n preferInstallDependencies: false,\n });\n\n // Configure the typescript project as an Nx Plugin\n configureTsProjectAsNxPlugin(tree, fullyQualifiedName, DEPENDENCIES);\n\n // Add a \"package\" target which creates a package which can be published to NPM\n const project = readProjectConfigurationUnqualified(tree, fullyQualifiedName);\n project.targets = {\n ...project.targets,\n package: {\n executor: '@nx/js:tsc',\n outputs: ['{options.outputPath}'],\n options: {\n outputPath: `dist/{projectRoot}/package`,\n main: `{projectRoot}/src/index.ts`,\n tsConfig: `{projectRoot}/tsconfig.lib.json`,\n assets: [\n `{projectRoot}/*.md`,\n `{projectRoot}/LICENSE*`,\n `{projectRoot}/NOTICE`,\n {\n input: './{projectRoot}/src',\n glob: '**/!(*.ts)',\n output: './src',\n },\n {\n input: './{projectRoot}/src',\n glob: '**/*.d.ts',\n output: './src',\n },\n ...nxPluginManifestAssets(),\n ],\n },\n },\n build: {\n ...project.targets?.build,\n },\n };\n // Append the package dependency without moving an existing entry, so re-runs\n // do not reorder the build dependencies.\n addDependencyToTargetIfNotPresent(project, 'build', 'package');\n // Sort targets so their order is stable regardless of insertion order.\n project.targets = sortObjectKeys(project.targets);\n updateProjectConfiguration(tree, fullyQualifiedName, project);\n\n const mcpPath = joinPathFragments(project.sourceRoot, 'mcp-server');\n\n // The sample server and tools ts#mcp-server scaffolds are replaced by the\n // generator MCP server below. Only the ones it creates in this run are\n // removed, so a re-run leaves the server the user owns and has customised.\n const SAMPLE_MCP_FILES = [\n 'server.ts',\n 'tools/add.ts',\n 'tools/divide.ts',\n 'resources/sample-guidance.ts',\n ];\n const preexistingSampleFiles = new Set(\n SAMPLE_MCP_FILES.filter((file) =>\n tree.exists(joinPathFragments(mcpPath, file)),\n ),\n );\n\n // Add an MCP Server\n await tsMcpServerGenerator(tree, {\n project: fullyQualifiedName,\n infra: 'none',\n iac: 'cdk', // not used\n preferInstallDependencies: false,\n });\n\n for (const file of SAMPLE_MCP_FILES) {\n const sampleFilePath = joinPathFragments(mcpPath, file);\n if (!preexistingSampleFiles.has(file) && tree.exists(sampleFilePath)) {\n tree.delete(sampleFilePath);\n }\n }\n\n // Add generator MCP server\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'mcp-server'),\n mcpPath,\n {\n name: fullyQualifiedName,\n ...esmVars(tree),\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n addGeneratorMetadata(tree, project.name, TS_NX_PLUGIN_GENERATOR_INFO);\n\n await addGeneratorMetricsIfApplicable(tree, [TS_NX_PLUGIN_GENERATOR_INFO]);\n\n await formatFilesInSubtree(tree);\n return () =>\n installDependencies(tree, options.preferInstallDependencies, {\n languages: ['typescript'],\n });\n};\n\nexport default tsNxPluginGenerator;\n"],"names":["generateFiles","joinPathFragments","OverwriteStrategy","updateProjectConfiguration","declareDependencies","formatFilesInSubtree","installDependencies","addGeneratorMetricsIfApplicable","esmVars","addDependencyToTargetIfNotPresent","addGeneratorMetadata","getGeneratorInfo","readProjectConfigurationUnqualified","sortObjectKeys","tsProjectGenerator","getTsLibDetails","tsMcpServerGenerator","configureTsProjectAsNxPlugin","NX_PLUGIN_DEPENDENCIES","nxPluginManifestAssets","DEPENDENCIES","ts","TS_NX_PLUGIN_GENERATOR_INFO","filename","tsNxPluginGenerator","tree","options","fullyQualifiedName","dir","preferInstallDependencies","project","targets","package","executor","outputs","outputPath","main","tsConfig","assets","input","glob","output","build","mcpPath","sourceRoot","SAMPLE_MCP_FILES","preexistingSampleFiles","Set","filter","file","exists","infra","iac","sampleFilePath","has","delete","dirname","name","overwriteStrategy","KeepExisting","languages"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,iBAAiB,EAGjBC,0BAA0B,QACrB,aAAa;AACpB,SAASC,mBAAmB,QAAQ,uCAAuC;AAC3E,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,SAASC,OAAO,QAAQ,+BAA+B;AACvD,SACEC,iCAAiC,EACjCC,oBAAoB,EACpBC,gBAAgB,EAEhBC,mCAAmC,QAC9B,oBAAoB;AAC3B,SAASC,cAAc,QAAQ,wBAAwB;AACvD,OAAOC,sBAAsBC,eAAe,QAAQ,sBAAsB;AAC1E,OAAOC,0BAA0B,6BAA6B;AAE9D,SACEC,4BAA4B,EAC5BC,sBAAsB,EACtBC,sBAAsB,QACjB,aAAa;AAEpB,OAAO,MAAMC,eAAehB,sBAAsB;I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AAMC,yBAAyB,IAAIC,IACjCF,iBAAiBG,MAAM,CAAC,CAACC,OACvBxB,KAAKyB,MAAM,CAACjD,kBAAkB0C,SAASM;IAI3C,oBAAoB;IACpB,MAAMjC,qBAAqBS,MAAM;QAC/BK,SAASH;QACTwB,OAAO;QACPC,KAAK;QACLvB,2BAA2B;IAC7B;IAEA,KAAK,MAAMoB,QAAQJ,iBAAkB;QACnC,MAAMQ,iBAAiBpD,kBAAkB0C,SAASM;QAClD,IAAI,CAACH,uBAAuBQ,GAAG,CAACL,SAASxB,KAAKyB,MAAM,CAACG,iBAAiB;YACpE5B,KAAK8B,MAAM,CAACF;QACd;IACF;IAEA,2BAA2B;IAC3BrD,cACEyB,MACAxB,kBAAkB,YAAYuD,OAAO,EAAE,SAAS,eAChDb,SACA;QACEc,MAAM9B;QACN,GAAGnB,QAAQiB,KAAK;IAClB,GACA;QAAEiC,mBAAmBxD,kBAAkByD,YAAY;IAAC;IAGtDjD,qBAAqBe,MAAMK,QAAQ2B,IAAI,EAAEnC;IAEzC,MAAMf,gCAAgCkB,MAAM;QAACH;KAA4B;IAEzE,MAAMjB,qBAAqBoB;IAC3B,OAAO,IACLnB,oBAAoBmB,MAAMC,QAAQG,yBAAyB,EAAE;YAC3D+B,WAAW;gBAAC;aAAa;QAC3B;AACJ,EAAE;AAEF,eAAepC,oBAAoB"}
@@ -16,6 +16,27 @@ export declare const NX_PLUGIN_DEPENDENCIES: readonly [{
16
16
  export declare const readNxPluginProject: (tree: Tree, projectName: string) => ProjectConfiguration;
17
17
  /** `package.json` field pointing Nx at one of a plugin's manifests. */
18
18
  type NxPluginManifestField = 'generators' | 'nx-migrations';
19
+ /**
20
+ * The manifests Nx reads from a published plugin, copied beside the compiled
21
+ * code by the `package` target. `nx migrate` resolves `migrations.json` from the
22
+ * tarball, so it ships even though only `ts#nx-migration` writes it.
23
+ */
24
+ export declare const NX_PLUGIN_MANIFESTS: readonly ["generators.json", "executors.json", "migrations.json"];
25
+ /** The `package` target assets that copy the plugin's manifests into dist. */
26
+ export declare const nxPluginManifestAssets: () => {
27
+ input: string;
28
+ glob: string;
29
+ output: string;
30
+ }[];
31
+ /**
32
+ * Ensure the plugin's `package` target copies every manifest into dist, so a
33
+ * manifest added after the project was generated is still published.
34
+ *
35
+ * Anchored to the `generators.json` asset the target is vended with: a `package`
36
+ * target without it belongs to something other than an Nx Plugin, or has been
37
+ * rewritten, so it is left as it is.
38
+ */
39
+ export declare const addNxPluginManifestAssets: (tree: Tree, project: ProjectConfiguration) => void;
19
40
  /**
20
41
  * Create the plugin project's package.json if absent and point it at the given
21
42
  * manifest, returning its path.
@@ -1,7 +1,7 @@
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, updateJson, writeJson } from "@nx/devkit";
4
+ */ import { joinPathFragments, updateJson, updateProjectConfiguration, writeJson } from "@nx/devkit";
5
5
  import { forDependencies } from "../../utils/declared-dependencies.js";
6
6
  import { addDependenciesToPackageJson } from "../../utils/dependencies.js";
7
7
  import { isEsmWorkspace } from "../../utils/module-format.js";
@@ -23,6 +23,46 @@ import { withVersions } from "../../utils/versions.js";
23
23
  }
24
24
  return project;
25
25
  };
26
+ /**
27
+ * The manifests Nx reads from a published plugin, copied beside the compiled
28
+ * code by the `package` target. `nx migrate` resolves `migrations.json` from the
29
+ * tarball, so it ships even though only `ts#nx-migration` writes it.
30
+ */ export const NX_PLUGIN_MANIFESTS = [
31
+ 'generators.json',
32
+ 'executors.json',
33
+ 'migrations.json'
34
+ ];
35
+ /** The `package` target assets that copy the plugin's manifests into dist. */ export const nxPluginManifestAssets = ()=>NX_PLUGIN_MANIFESTS.map((glob)=>({
36
+ input: './{projectRoot}',
37
+ glob,
38
+ output: '.'
39
+ }));
40
+ /**
41
+ * Ensure the plugin's `package` target copies every manifest into dist, so a
42
+ * manifest added after the project was generated is still published.
43
+ *
44
+ * Anchored to the `generators.json` asset the target is vended with: a `package`
45
+ * target without it belongs to something other than an Nx Plugin, or has been
46
+ * rewritten, so it is left as it is.
47
+ */ export const addNxPluginManifestAssets = (tree, project)=>{
48
+ const assets = project.targets?.package?.options?.assets;
49
+ if (!Array.isArray(assets)) {
50
+ return;
51
+ }
52
+ const globs = new Set(assets.filter((asset)=>typeof asset === 'object' && asset !== null).map((asset)=>asset.glob));
53
+ if (!globs.has('generators.json')) {
54
+ return;
55
+ }
56
+ const missing = nxPluginManifestAssets().filter((asset)=>!globs.has(asset.glob));
57
+ if (missing.length === 0) {
58
+ return;
59
+ }
60
+ project.targets.package.options.assets = [
61
+ ...assets,
62
+ ...missing
63
+ ];
64
+ updateProjectConfiguration(tree, project.name, project);
65
+ };
26
66
  /**
27
67
  * Create the plugin project's package.json if absent and point it at the given
28
68
  * manifest, returning its path.