@aws/nx-plugin-mcp 1.0.0-rc.89 → 1.0.0-rc.90

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/aws-nx-mcp.js CHANGED
@@ -53603,6 +53603,11 @@ const filterableOptionsFromSchema = (schema) => {
53603
53603
  * SPDX-License-Identifier: Apache-2.0
53604
53604
  */
53605
53605
  /**
53606
+ * Warn agents that an experimental generator's output may change in a future
53607
+ * release without a migration to carry an existing workspace across.
53608
+ */
53609
+ const renderExperimentalWarning = (generatorId) => `> [!WARNING] Experimental: the \`${generatorId}\` generator's behaviour and generated output may change in a future release without a migration being published to apply the change to an existing workspace.`;
53610
+ /**
53606
53611
  * Render summary information about a generator
53607
53612
  */
53608
53613
  const renderGeneratorInfo = (packageManager, info) => {
@@ -53610,7 +53615,7 @@ const renderGeneratorInfo = (packageManager, info) => {
53610
53615
  return `${info.id}
53611
53616
 
53612
53617
  Description: ${info.description}
53613
-
53618
+ ${info.experimental ? `\n${renderExperimentalWarning(info.id)}\n` : ""}
53614
53619
  Available Parameters:
53615
53620
  ${renderSchema(schema)}
53616
53621
 
@@ -53697,7 +53702,7 @@ const renderUnsupportedMessage = (info, requested, predicates) => {
53697
53702
  return `## ${info.id}
53698
53703
 
53699
53704
  > [!WARNING] Unsupported combination: ${requestedDesc}. The \`${info.id}\` generator has no guide variant matching this combination — running it will likely fail.
53700
-
53705
+ ${info.experimental ? `\n${renderExperimentalWarning(info.id)}\n` : ""}
53701
53706
  Supported combinations:
53702
53707
  ${supportedList}
53703
53708
 
@@ -54150,8 +54155,16 @@ const addUpgradeWorkspaceTool = (server, generators) => {
54150
54155
  });
54151
54156
  };
54152
54157
  //#endregion
54153
- //#region ../nx-plugin/generators.json
54154
- var generators$1 = {
54158
+ //#region ../nx-plugin/src/utils/generators.ts
54159
+ /**
54160
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
54161
+ * SPDX-License-Identifier: Apache-2.0
54162
+ */
54163
+ /**
54164
+ * Typed view of the `generators.json` entries, keyed by generator id, so every
54165
+ * consumer that describes a generator reads the same declared shape.
54166
+ */
54167
+ const generatorsJsonEntries = {
54155
54168
  "init": {
54156
54169
  "factory": "./src/init/generator",
54157
54170
  "schema": "./src/init/schema.json",
@@ -54198,7 +54211,8 @@ var generators$1 = {
54198
54211
  "schema": "./src/agentcore-harness/schema.json",
54199
54212
  "description": "Generate an AgentCore Harness project",
54200
54213
  "metric": "g71",
54201
- "guidePages": ["agentcore-harness"]
54214
+ "guidePages": ["agentcore-harness"],
54215
+ "experimental": true
54202
54216
  },
54203
54217
  "connection": {
54204
54218
  "factory": "./src/connection/generator",
@@ -54697,23 +54711,18 @@ var generators$1 = {
54697
54711
  "hidden": true
54698
54712
  }
54699
54713
  };
54700
- //#endregion
54701
- //#region ../nx-plugin/src/utils/generators.ts
54702
- /**
54703
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
54704
- * SPDX-License-Identifier: Apache-2.0
54705
- */
54706
54714
  /**
54707
54715
  * Build the list of generator info, resolving schema/factory paths relative to the given base directory.
54708
54716
  */
54709
- const buildGeneratorInfoList = (baseDir) => Object.entries(generators$1).map(([id, info]) => ({
54717
+ const buildGeneratorInfoList = (baseDir) => Object.entries(generatorsJsonEntries).map(([id, info]) => ({
54710
54718
  id,
54711
54719
  metric: info.metric,
54712
54720
  resolvedFactoryPath: path$3.resolve(baseDir, info.factory),
54713
54721
  resolvedSchemaPath: path$3.resolve(baseDir, info.schema),
54714
54722
  description: info.description,
54715
- ..."hidden" in info && info.hidden ? { hidden: info.hidden } : {},
54716
- ..."guidePages" in info && info.guidePages ? { guidePages: info.guidePages } : {}
54723
+ ...info.hidden ? { hidden: info.hidden } : {},
54724
+ ...info.experimental ? { experimental: info.experimental } : {},
54725
+ ...info.guidePages ? { guidePages: info.guidePages } : {}
54717
54726
  }));
54718
54727
  //#endregion
54719
54728
  //#region src/index.ts
@@ -123,6 +123,10 @@ Migrations don't cover every change to the infrastructure we vend. Where updatin
123
123
  To pick those changes up, compare your infrastructure against what today's generators produce and apply the parts you want by hand, taking care over the deployment path for your existing resources.
124
124
  </Aside>
125
125
 
126
+ <Aside type="caution" title="Experimental generators are not migrated">
127
+ Some generators are marked as experimental — their guide page carries a banner saying so. Changes to these generators may ship without a migration to apply them to an existing workspace, so if you use one, check its guide after upgrading and reconcile any differences with your project yourself.
128
+ </Aside>
129
+
126
130
  ## Upgrading with an AI agent
127
131
 
128
132
  The whole flow can be driven by an AI coding agent end to end — nothing blocks on an interactive terminal. When `nx migrate --run-migrations` runs from inside an agent, Nx detects this, skips the agentic consent prompt, and instead of spawning a nested agent it **defers** each prompt migration back to the agent driving the run:
@@ -8,14 +8,12 @@ import NxCommands from '@components/nx-commands.astro';
8
8
  import PackageManagerShortCommand from '@components/package-manager-short-command.astro';
9
9
  import Link from '@components/link.astro';
10
10
  import Infrastructure from '@components/infrastructure.astro';
11
- import TrivyVersion from '@components/trivy-version.astro';
12
11
  import { CONTAINER_VERSIONS } from '../../../../../../packages/nx-plugin/src/utils/versions';
13
12
 
14
13
  export const trivyTarget = `{
15
14
  "targets": {
16
15
  "trivy": {
17
- "cache": true,
18
- "inputs": ["default", "^production"],
16
+ "cache": false,
19
17
  "outputs": ["{workspaceRoot}/dist/{projectRoot}/trivy"],
20
18
  "executor": "nx:run-commands",
21
19
  "options": {
@@ -68,7 +66,7 @@ The Docker build context is written to your project's `dist` folder. Your infras
68
66
  :::tip[Why bundle outside the Dockerfile?]
69
67
  Keeping the bundle step in Nx (rather than inside the `Dockerfile`) means:
70
68
 
71
- - Nx can **cache** the bundle target, so repeated builds are fast.
69
+ - Nx can **cache** the bundle target — its output is a directory on disk, so a cache hit genuinely restores it.
72
70
  - The `Dockerfile` does not need access to your monorepo, private registries, or build-time secrets.
73
71
  - The image layer is tiny — a single `COPY` of already-built artifacts, with no transitive `node_modules` or build toolchain.
74
72
  :::
@@ -84,6 +82,7 @@ Configure a `bundle` target that invokes Rolldown. If you are starting from a <L
84
82
  "targets": {
85
83
  "bundle": {
86
84
  "cache": true,
85
+ "inputs": ["default"],
87
86
  "executor": "nx:run-commands",
88
87
  "outputs": ["{workspaceRoot}/dist/{projectRoot}/bundle"],
89
88
  "options": {
@@ -167,7 +166,7 @@ Add a `docker` target which:
167
166
  {
168
167
  "targets": {
169
168
  "docker": {
170
- "cache": true,
169
+ "cache": false,
171
170
  "executor": "nx:run-commands",
172
171
  "options": {
173
172
  "commands": [
@@ -182,6 +181,10 @@ Add a `docker` target which:
182
181
  }
183
182
  ```
184
183
 
184
+ :::caution[Do not cache image builds]
185
+ Set `"cache": false` on image build targets. A built image is not written to an `outputs` path in the filesystem, so Nx has nothing to restore on a cache hit. Container engines cache image layers regardless, so there is no performance penalty.
186
+ :::
187
+
185
188
  :::tip[Cross-platform file copy]
186
189
  The `ncp` package provides a cross-platform file/directory copy command, avoiding `cp` (unavailable on Windows). Install it at the root of your workspace with `pnpm add -D -w ncp`.
187
190
  :::
@@ -256,7 +259,7 @@ Add a `docker` target which copies the `Dockerfile` into the bundle output direc
256
259
  {
257
260
  "targets": {
258
261
  "docker": {
259
- "cache": true,
262
+ "cache": false,
260
263
  "executor": "nx:run-commands",
261
264
  "options": {
262
265
  "commands": [
@@ -296,10 +299,6 @@ The scan is intentionally not wired into `build` since this can introduce unnece
296
299
  Instead we recommend running the above command as a dedicated step in your CI pipeline prior to deployment to production stages.
297
300
  :::
298
301
 
299
- :::tip[Caching skips unchanged images]
300
- Because the image is fully determined by your project source, declaring `inputs` (here `default` and `^production`, matching the `bundle` target) lets Nx cache the scan and skip re-scanning an image that hasn't changed. Pin the Trivy image version (e.g. <code>trivy:<TrivyVersion /></code>) so scans are reproducible.
301
- :::
302
-
303
302
  :::note[Suppressing findings]
304
303
  Trivy reads a `.trivyignore` file (a list of vulnerability IDs, one per line) from the root of your project. `--ignore-unfixed` skips vulnerabilities with no available fix, so the scan only fails on issues you can action by upgrading tooling in your `Dockerfile`. See the [Trivy filtering documentation](https://trivy.dev/latest/docs/configuration/filtering/#by-finding-ids) for details.
305
304
  :::
@@ -96,6 +96,7 @@ When you use your Python project as runtime code (for example as the handler for
96
96
  ...
97
97
  "bundle": {
98
98
  "cache": true,
99
+ "inputs": ["production", "^production"],
99
100
  "executor": "nx:run-commands",
100
101
  "outputs": ["{workspaceRoot}/dist/packages/my_library/bundle"],
101
102
  "options": {
@@ -139,6 +140,18 @@ Or use the shorthand command:
139
140
 
140
141
  <PackageManagerShortCommand commands={["build"]} />
141
142
 
143
+ ### Assembling
144
+
145
+ Your project also has an `assemble` target, which produces whatever your project contributes to a deployment (for example its compiled or bundled output), without running the lint, test or type-check gates.
146
+
147
+ <NxCommands commands={['assemble <project-name>']} />
148
+
149
+ The deploy targets depend on `assemble`, so deploying builds only what it is about to deploy.
150
+
151
+ :::caution[Use `build` in your pipeline]
152
+ `assemble` is used for faster iteration during development. Run `build` in your CI pipeline to ensure your project passes quality gates prior to a production deployment.
153
+ :::
154
+
142
155
  ## Testing
143
156
 
144
157
  [pytest](https://docs.pytest.org/en/stable/) is configured for testing your project.
@@ -175,6 +188,16 @@ You can run an individual test or suite of tests using the `-k` flag, specifying
175
188
 
176
189
  <NxCommands commands={["test <project-name> -k 'test_say_hello'"]} />
177
190
 
191
+ ### Test Files and Caching
192
+
193
+ Your project's `tests` directory is excluded from the `production` named input in `nx.json`.
194
+
195
+ Targets whose output cannot contain a test file - such as `compile` and any bundle targets - read `production` rather than `default`, so editing a test does not invalidate them or any task in a project which depends on yours.
196
+
197
+ The exclusion is deliberately limited to the `tests` directory. A `test_*.py` file inside your package directory is treated as production code, since it is packaged into your built distribution, and so still invalidates the build.
198
+
199
+ The `test`, `lint`, `format` and `typecheck` targets read `default` and so still re-run when you edit a test. Note that `typecheck` type checks your tests too, so a type error in a test is still reported.
200
+
178
201
  ## Type Checking
179
202
 
180
203
  Python projects use [ty](https://docs.astral.sh/ty/) for type checking.
@@ -9,6 +9,7 @@ import Link from '@components/link.astro';
9
9
  import GeneratorParameters from '@components/generator-parameters.astro';
10
10
  import NxCommands from '@components/nx-commands.astro';
11
11
  import OptionFilter from '@components/option-filter.astro';
12
+ import PackageManagerShortCommand from '@components/package-manager-short-command.astro';
12
13
 
13
14
  [Terraform](https://www.terraform.io/) is an open-source infrastructure as code software tool that enables you to safely and predictably create, change, and improve infrastructure.
14
15
 
@@ -53,6 +54,7 @@ For application projects (`--type=application`), the generator creates a complet
53
54
  - bootstrap.ts Pulls/pushes the bootstrap tfstate and runs `terraform apply`
54
55
  - bootstrap-destroy.ts Empties the state bucket and runs `terraform destroy`
55
56
  - init.ts Runs `terraform init` with the S3 backend config
57
+ - env.ts Points `terraform init` at the shared provider cache
56
58
  - checkov.yml Checkov configuration, including the checks to skip
57
59
  - project.json Project configuration and build targets
58
60
 
@@ -245,11 +247,45 @@ You can validate your Terraform configuration using the `validate` target:
245
247
 
246
248
  <NxCommands commands={['validate tf-infra']} />
247
249
 
248
- #### Formatting your Code
250
+ #### Linting
249
251
 
250
- Format your Terraform code using the `fmt` target:
252
+ Terraform projects use [`terraform fmt`](https://developer.hashicorp.com/terraform/cli/commands/fmt) to check formatting.
251
253
 
252
- <NxCommands commands={['fmt tf-infra']} />
254
+ ##### Running the Linter
255
+
256
+ To invoke the linter to check your project, you can run the `lint` target.
257
+
258
+ <NxCommands commands={["lint tf-infra"]} />
259
+
260
+ ##### Fixing Lint Issues
261
+
262
+ The majority of linting or formatting issues can be fixed automatically by running with the `--configuration=fix` argument.
263
+
264
+ <NxCommands commands={["lint tf-infra --configuration=fix"]} />
265
+
266
+ Similarly if you would like to fix all lint issues in all packages in your workspace, you can run:
267
+
268
+ <NxCommands commands={["run-many --target lint --all --configuration=fix"]} />
269
+
270
+ :::tip[Shorthand Command]
271
+ This has a shorthand command from the root of your workspace:
272
+
273
+ <PackageManagerShortCommand commands={["lint"]} />
274
+ :::
275
+
276
+ ##### Skipping Lint Issues
277
+
278
+ To avoid linting issues slowing you down during development (particularly if you have non auto-fixable issues in your project), you can run a build with the `skip-lint` configuration:
279
+
280
+ <NxCommands commands={["run-many --target build --configuration=skip-lint"]} />
281
+
282
+ This skips the format check entirely during build.
283
+
284
+ :::tip[Shorthand Command]
285
+ This has a shorthand command from the root of your workspace:
286
+
287
+ <PackageManagerShortCommand commands={["build:skip-lint"]} />
288
+ :::
253
289
 
254
290
  #### Security Testing
255
291
 
@@ -259,6 +295,8 @@ Run security checks on your infrastructure using Checkov with the `checkov` targ
259
295
 
260
296
  You will find your security test results in the root `dist` folder, under `dist/packages/<my-terraform-project>/checkov`.
261
297
 
298
+ Checkov runs as part of `build`.
299
+
262
300
  Checks are configured in the project's `checkov.yml`. Add a check id to `skip-check` to suppress it across the whole project:
263
301
 
264
302
  ```yaml title="checkov.yml"
@@ -313,6 +351,10 @@ run "plan_is_valid" {
313
351
 
314
352
  Set every variable your configuration requires in the `variables` block, otherwise the run fails with "has a required variable ... with no set value".
315
353
 
354
+ Every target that runs `terraform init` reuses a provider cache under `.terraform/plugin-cache` in your workspace root, so providers are downloaded once rather than on every run. Each project gets its own directory there: two `terraform init` runs filling one cache at the same time can each compute a different hash for the same provider, which terraform then rejects against your `.terraform.lock.hcl`. See the [Terraform documentation](https://developer.hashicorp.com/terraform/cli/config/config-file#provider-plugin-cache) for more information.
355
+
356
+ Set `TF_PLUGIN_CACHE_DIR` in your environment to point the vended `init` script at a cache you manage yourself — a volume shared between workspaces, say. Note that the `test` target reads its path from `project.json`, so change it there too.
357
+
316
358
  <OptionFilter when={{ type: 'application' }} description="Application-only targets: plan / apply / destroy / etc.">
317
359
  ### Application-Only Targets
318
360
 
@@ -326,6 +368,12 @@ Before applying changes, you can see what Terraform will do by running the `plan
326
368
 
327
369
  This will create a plan file in `dist/packages/<my-terraform-project>/terraform/dev.tfplan`.
328
370
 
371
+ `plan` depends on `assemble`, so it produces the artifacts your modules reference, such as the Lambda bundles and generated operations metadata, without running the lint, test and type-check gates.
372
+
373
+ :::caution[Use `build` in your pipeline]
374
+ `assemble` is used for faster iteration during development. Run `build` in your CI pipeline to ensure your project passes quality gates prior to a production deployment.
375
+ :::
376
+
329
377
  #### Initializing Terraform
330
378
 
331
379
  Initialize your Terraform working directory with the `init` target:
@@ -321,6 +321,8 @@ As part of your `build` target, as well as running the <Link path="guides/typesc
321
321
 
322
322
  You will find your synthesized cloud assembly in the root `dist` folder, under `dist/packages/<my-infra-project>/cdk.out`.
323
323
 
324
+ `synth` depends on `^assemble`, so synthesizing builds the artifacts your stacks deploy, such as the Lambda bundles, container images and generated specifications, without running every upstream project's lint, test and type-check gates. See <Link path="guides/typescript-project#assembling">Assembling</Link> for more detail on `assemble`.
325
+
324
326
  ## Security Testing
325
327
 
326
328
  A `checkov` target is added to your project which runs security checks on your infrastructure using [Checkov](https://www.checkov.io/).
@@ -383,6 +385,12 @@ Your project has three deploy targets, each suited to a different situation:
383
385
  | `deploy` | Deploying any stage, by naming the stage or stacks you want. |
384
386
  | `deploy-ci` | Deploying from a CI/CD pipeline, using a pre-synthesized cloud assembly. |
385
387
 
388
+ `deploy-sandbox` and `deploy` depend on `^assemble`, so they build the artifacts they are about to deploy and nothing else. `deploy-ci` deploys an assembly your pipeline already built, so it has no build dependencies at all.
389
+
390
+ :::caution[Use `build` in your pipeline]
391
+ `assemble` is used for faster iteration during development. Run `build` in your CI pipeline to ensure your project passes quality gates prior to a production deployment.
392
+ :::
393
+
386
394
  First, make sure you have AWS credentials configured. If you generated with `stageConfig` and have configured stage credentials in `packages/common/infra-config/src/stages.config.ts`, the deploy command will automatically resolve and apply the correct credentials for the target stage. Otherwise, ensure your AWS credentials are set in your environment (e.g., via `AWS_PROFILE` or environment variables). See the [AWS credentials documentation](https://docs.aws.amazon.com/sdkref/latest/guide/access.html) for the available options.
387
395
 
388
396
  ### Deploying your Sandbox Stage
@@ -332,6 +332,18 @@ Or use the shorthand command:
332
332
 
333
333
  <PackageManagerShortCommand commands={["build"]} />
334
334
 
335
+ ### Assembling
336
+
337
+ Your project also has an `assemble` target, which produces whatever your project contributes to a deployment (for example its compiled or bundled output), without running the lint, test or type-check gates.
338
+
339
+ <NxCommands commands={['assemble <project-name>']} />
340
+
341
+ The <Link path="guides/typescript-infrastructure#deploying-to-aws">deploy targets</Link> depend on `assemble`, so deploying builds only what it is about to deploy.
342
+
343
+ :::caution[Use `build` in your pipeline]
344
+ `assemble` is used for faster iteration during development. Run `build` in your CI pipeline to ensure your project passes quality gates prior to a production deployment.
345
+ :::
346
+
335
347
  ## Testing
336
348
 
337
349
  [Vitest](https://vitest.dev/) is configured for testing your project.
@@ -379,6 +391,14 @@ You can run an individual test or suite of tests using Vitest's `-t` flag. Pass
379
391
  If you are a VSCode user, we recommend installing the [Vitest Runner for VSCode that actually works](https://marketplace.visualstudio.com/items?itemName=rluvaton.vscode-vitest) extension, which allows you to run, watch or debug tests from your IDE.
380
392
  :::
381
393
 
394
+ ### Test Coverage
395
+
396
+ Pass Vitest's `--coverage` flag after a `--` separator to collect coverage:
397
+
398
+ <NxCommands commands={['test <project-name> -- --coverage']} />
399
+
400
+ Reports are written to `dist/<project-root>/test-output/vitest/coverage`, with the HTML report at `index.html`.
401
+
382
402
  ## Linting
383
403
 
384
404
  TypeScript projects use [Biome](https://biomejs.dev/) for linting and formatting. Biome is configured in the workspace root `biome.json` file — changes to this apply to all TypeScript projects in your workspace and ensure consistency.
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Experimental Generator
3
+ ---
4
+ import Link from '@components/link.astro';
5
+
6
+ :::caution[Experimental]
7
+ This generator is experimental. Its behaviour and generated output may change in a future release without a <Link path="get_started/upgrading">migration</Link> being published to apply the change to an existing workspace, so you may need to reconcile those changes yourself when you upgrade.
8
+ :::
@@ -8,7 +8,7 @@ The Docker image built for this project can be scanned for vulnerabilities using
8
8
 
9
9
  A `trivy` target is added to your project which scans the built image and **exits non-zero** if any `HIGH` or `CRITICAL` severity vulnerability is found. The generated `Dockerfile` uses a base image with no known fixable vulnerabilities of these severities at time of generation, and upgrades bundled tooling (such as `npm`) to keep it that way.
10
10
 
11
- The scan uses the same container engine as your image build (`docker` or `finch`), so no additional tooling is required. Since the scan is only re-run when the image changes, an unchanged image is not re-scanned. The vended `trivy` root script scans every image in the workspace:
11
+ The scan uses the same container engine as your image build (`docker` or `finch`), so no additional tooling is required. The scan is not cached, since the image it reads lives in the container engine rather than on disk — so it always scans the real image, and fails loudly rather than reporting a cached pass for an image that is no longer there. Each run therefore takes tens of seconds per image and refreshes Trivy's vulnerability database, so it needs network access. The vended `trivy` root script scans every image in the workspace:
12
12
 
13
13
  <PackageManagerShortCommand commands={['trivy']} />
14
14
 
package/generators.json CHANGED
@@ -49,7 +49,8 @@
49
49
  "schema": "./src/agentcore-harness/schema.json",
50
50
  "description": "Generate an AgentCore Harness project",
51
51
  "metric": "g71",
52
- "guidePages": ["agentcore-harness"]
52
+ "guidePages": ["agentcore-harness"],
53
+ "experimental": true
53
54
  },
54
55
  "connection": {
55
56
  "factory": "./src/connection/generator",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws/nx-plugin-mcp",
3
- "version": "1.0.0-rc.89",
3
+ "version": "1.0.0-rc.90",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/awslabs/nx-plugin-for-aws.git",