@aws/nx-plugin-mcp 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.
- package/bin/aws-nx-mcp.js +41 -42
- package/docs/get_started/existing-project.mdx +1 -1
- package/docs/get_started/quick-start.mdx +50 -5
- package/docs/get_started/tutorials/dungeon-game/1.mdx +11 -6
- package/docs/get_started/tutorials/dungeon-game/2.mdx +1 -1
- package/docs/get_started/tutorials/dungeon-game/4.mdx +5 -0
- package/docs/get_started/tutorials/dungeon-game/wrap-up.mdx +10 -1
- package/docs/guides/license.mdx +30 -6
- package/docs/guides/nx-generator.mdx +11 -12
- package/docs/guides/ts-nx-plugin.mdx +17 -7
- package/docs/guides/typescript-infrastructure.mdx +3 -1
- package/docs/snippets/pdk-migration/faq/type-safe-api.mdx +1 -1
- package/docs/snippets/prerequisites.mdx +1 -1
- package/package.json +1 -1
package/bin/aws-nx-mcp.js
CHANGED
|
@@ -21915,22 +21915,22 @@ const kebabCase = (str) => {
|
|
|
21915
21915
|
const NX_VERSION = {
|
|
21916
21916
|
"@a2a-js/sdk": "0.3.14",
|
|
21917
21917
|
"@aws/aws-distro-opentelemetry-node-autoinstrumentation": "0.12.0",
|
|
21918
|
-
"@opentelemetry/propagator-jaeger": "2.
|
|
21918
|
+
"@opentelemetry/propagator-jaeger": "2.11.0",
|
|
21919
21919
|
minimatch: "10.2.6",
|
|
21920
|
-
"deepmerge-ts": "8.0.
|
|
21921
|
-
mysql2: "3.
|
|
21922
|
-
"@aws-sdk/client-dynamodb": "3.
|
|
21923
|
-
"@aws-sdk/client-api-gateway": "3.
|
|
21924
|
-
"@aws-sdk/client-iam": "3.
|
|
21925
|
-
"@aws-sdk/client-bedrock-agentcore": "3.
|
|
21926
|
-
"@aws-sdk/client-bedrock-runtime": "3.
|
|
21927
|
-
"@aws-sdk/client-s3": "3.
|
|
21928
|
-
"@aws-sdk/client-sts": "3.
|
|
21929
|
-
"@aws-sdk/client-cognito-identity-provider": "3.
|
|
21930
|
-
"@aws-sdk/credential-providers": "3.
|
|
21920
|
+
"deepmerge-ts": "8.0.2",
|
|
21921
|
+
mysql2: "3.24.3",
|
|
21922
|
+
"@aws-sdk/client-dynamodb": "3.1126.0",
|
|
21923
|
+
"@aws-sdk/client-api-gateway": "3.1126.0",
|
|
21924
|
+
"@aws-sdk/client-iam": "3.1126.0",
|
|
21925
|
+
"@aws-sdk/client-bedrock-agentcore": "3.1126.0",
|
|
21926
|
+
"@aws-sdk/client-bedrock-runtime": "3.1126.0",
|
|
21927
|
+
"@aws-sdk/client-s3": "3.1126.0",
|
|
21928
|
+
"@aws-sdk/client-sts": "3.1126.0",
|
|
21929
|
+
"@aws-sdk/client-cognito-identity-provider": "3.1126.0",
|
|
21930
|
+
"@aws-sdk/credential-providers": "3.1126.0",
|
|
21931
21931
|
"@aws-sdk/credential-provider-cognito-identity": "3.972.69",
|
|
21932
|
-
"@aws-sdk/client-secrets-manager": "3.
|
|
21933
|
-
"@aws-sdk/rds-signer": "3.
|
|
21932
|
+
"@aws-sdk/client-secrets-manager": "3.1126.0",
|
|
21933
|
+
"@aws-sdk/rds-signer": "3.1126.0",
|
|
21934
21934
|
"@smithy/server-apigateway": "0.3.3",
|
|
21935
21935
|
"@smithy/server-node": "0.3.3",
|
|
21936
21936
|
"@aws-lambda-powertools/logger": "2.35.0",
|
|
@@ -21938,7 +21938,7 @@ const NX_VERSION = {
|
|
|
21938
21938
|
"@aws-lambda-powertools/parameters": "2.35.0",
|
|
21939
21939
|
"@aws-lambda-powertools/tracer": "2.35.0",
|
|
21940
21940
|
"@aws-lambda-powertools/parser": "2.35.0",
|
|
21941
|
-
"@aws-sdk/client-appconfigdata": "3.
|
|
21941
|
+
"@aws-sdk/client-appconfigdata": "3.1126.0",
|
|
21942
21942
|
"@middy/core": "7.9.2",
|
|
21943
21943
|
"@nxlv/python": "23.0.0",
|
|
21944
21944
|
"@nx-extend/terraform": "10.4.1",
|
|
@@ -21953,14 +21953,14 @@ const NX_VERSION = {
|
|
|
21953
21953
|
"@swc-node/register": "1.12.1",
|
|
21954
21954
|
"@swc/core": "1.16.1",
|
|
21955
21955
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
21956
|
-
"@modelcontextprotocol/inspector": "2.
|
|
21956
|
+
"@modelcontextprotocol/inspector": "2.5.0",
|
|
21957
21957
|
"@ag-ui/a2ui-toolkit": "0.0.4",
|
|
21958
21958
|
"@ag-ui/aws-strands": "0.2.3",
|
|
21959
|
-
"@ag-ui/client": "0.0.
|
|
21960
|
-
"@ag-ui/core": "0.0.
|
|
21961
|
-
"@ag-ui/encoder": "0.0.
|
|
21959
|
+
"@ag-ui/client": "0.0.59",
|
|
21960
|
+
"@ag-ui/core": "0.0.59",
|
|
21961
|
+
"@ag-ui/encoder": "0.0.59",
|
|
21962
21962
|
"agent-chat-cli": "0.3.0",
|
|
21963
|
-
"@copilotkit/react-core": "1.
|
|
21963
|
+
"@copilotkit/react-core": "1.70.1",
|
|
21964
21964
|
rxjs: "7.8.2",
|
|
21965
21965
|
"@strands-agents/sdk": "1.15.0",
|
|
21966
21966
|
"@tanstack/react-router": "1.170.32",
|
|
@@ -21968,46 +21968,46 @@ const NX_VERSION = {
|
|
|
21968
21968
|
"@tanstack/router-generator": "1.167.33",
|
|
21969
21969
|
"@tanstack/virtual-file-routes": "1.162.0",
|
|
21970
21970
|
"@tanstack/router-utils": "1.162.2",
|
|
21971
|
-
"@cloudscape-design/board-components": "3.0.
|
|
21972
|
-
"@cloudscape-design/chat-components": "1.0.
|
|
21973
|
-
"@cloudscape-design/components": "3.0.
|
|
21971
|
+
"@cloudscape-design/board-components": "3.0.222",
|
|
21972
|
+
"@cloudscape-design/chat-components": "1.0.166",
|
|
21973
|
+
"@cloudscape-design/components": "3.0.1359",
|
|
21974
21974
|
"@cloudscape-design/global-styles": "1.0.67",
|
|
21975
21975
|
"@tanstack/react-query": "5.102.8",
|
|
21976
21976
|
"@tanstack/react-query-devtools": "5.102.8",
|
|
21977
21977
|
"@trpc/tanstack-react-query": "11.18.0",
|
|
21978
21978
|
"@trpc/client": "11.18.0",
|
|
21979
21979
|
"@trpc/server": "11.18.0",
|
|
21980
|
-
"@types/node": "26.4.
|
|
21981
|
-
"@types/aws-lambda": "8.10.
|
|
21980
|
+
"@types/node": "26.4.1",
|
|
21981
|
+
"@types/aws-lambda": "8.10.163",
|
|
21982
21982
|
"@types/cors": "2.8.19",
|
|
21983
21983
|
"@types/pg": "8.23.1",
|
|
21984
21984
|
"@types/ws": "8.18.1",
|
|
21985
21985
|
"@types/express": "5.0.6",
|
|
21986
21986
|
"@smithy/config-resolver": "4.7.2",
|
|
21987
21987
|
"@smithy/node-config-provider": "4.6.2",
|
|
21988
|
-
"@smithy/node-http-handler": "4.
|
|
21989
|
-
"@smithy/types": "4.
|
|
21988
|
+
"@smithy/node-http-handler": "4.12.1",
|
|
21989
|
+
"@smithy/types": "4.18.0",
|
|
21990
21990
|
"@vitest/coverage-v8": "4.1.11",
|
|
21991
21991
|
"@vitest/ui": "4.1.11",
|
|
21992
|
-
"@astrojs/react": "6.0.
|
|
21993
|
-
"@astrojs/starlight": "0.
|
|
21994
|
-
astro: "7.
|
|
21992
|
+
"@astrojs/react": "6.0.5",
|
|
21993
|
+
"@astrojs/starlight": "0.42.0",
|
|
21994
|
+
astro: "7.3.1",
|
|
21995
21995
|
cookie: "2.0.1",
|
|
21996
21996
|
aws4fetch: "1.0.20",
|
|
21997
21997
|
"aws-cdk": "2.1139.0",
|
|
21998
|
-
"aws-cdk-lib": "2.
|
|
21998
|
+
"aws-cdk-lib": "2.268.0",
|
|
21999
21999
|
"aws-xray-sdk-core": "3.12.0",
|
|
22000
22000
|
constructs: "10.8.1",
|
|
22001
22001
|
cors: "2.8.6",
|
|
22002
22002
|
chalk: "6.0.0",
|
|
22003
22003
|
"class-variance-authority": "0.7.1",
|
|
22004
|
-
|
|
22004
|
+
cn: "0.2.5",
|
|
22005
22005
|
commander: "15.0.0",
|
|
22006
22006
|
electrodb: "3.9.3",
|
|
22007
22007
|
esbuild: "0.28.2",
|
|
22008
22008
|
"event-source-polyfill": "1.0.31",
|
|
22009
22009
|
"@types/event-source-polyfill": "1.0.5",
|
|
22010
|
-
"@biomejs/biome": "2.5.
|
|
22010
|
+
"@biomejs/biome": "2.5.12",
|
|
22011
22011
|
"@prisma/adapter-mariadb": "7.10.0",
|
|
22012
22012
|
"@prisma/adapter-pg": "7.10.0",
|
|
22013
22013
|
"@prisma/client": "7.10.0",
|
|
@@ -22018,8 +22018,8 @@ const NX_VERSION = {
|
|
|
22018
22018
|
husky: "9.1.7",
|
|
22019
22019
|
"fs-extra": "11.4.0",
|
|
22020
22020
|
"@types/fs-extra": "11.0.4",
|
|
22021
|
-
mariadb: "3.5.
|
|
22022
|
-
mise: "2026.
|
|
22021
|
+
mariadb: "3.5.4",
|
|
22022
|
+
mise: "2026.9.1",
|
|
22023
22023
|
npm: "12.0.2",
|
|
22024
22024
|
"npm-check-updates": "23.1.0",
|
|
22025
22025
|
"oidc-client-ts": "3.5.0",
|
|
@@ -22028,24 +22028,23 @@ const NX_VERSION = {
|
|
|
22028
22028
|
"react-oidc-context": "3.3.1",
|
|
22029
22029
|
react: "19.2.8",
|
|
22030
22030
|
"react-dom": "19.2.8",
|
|
22031
|
-
rolldown: "1.2.
|
|
22032
|
-
"rolldown-plugin-dts": "0.28.
|
|
22031
|
+
rolldown: "1.2.7",
|
|
22032
|
+
"rolldown-plugin-dts": "0.28.5",
|
|
22033
22033
|
shx: "0.4.0",
|
|
22034
22034
|
"simple-git": "3.36.0",
|
|
22035
22035
|
"source-map-support": "0.5.21",
|
|
22036
22036
|
"starlight-blog": "0.29.0",
|
|
22037
22037
|
tailwindcss: "4.3.3",
|
|
22038
22038
|
"@tailwindcss/vite": "4.3.3",
|
|
22039
|
-
tsx: "4.23.
|
|
22040
|
-
"lucide-react": "1.
|
|
22039
|
+
tsx: "4.23.13",
|
|
22040
|
+
"lucide-react": "1.40.0",
|
|
22041
22041
|
"radix-ui": "1.6.7",
|
|
22042
|
-
shadcn: "4.
|
|
22042
|
+
shadcn: "4.21.0",
|
|
22043
22043
|
"tw-animate-css": "1.4.0",
|
|
22044
|
-
"tailwind-merge": "3.6.0",
|
|
22045
22044
|
vite: "8.2.2",
|
|
22046
22045
|
typescript: "6.0.3",
|
|
22047
22046
|
vitest: "4.1.11",
|
|
22048
|
-
jsdom: "
|
|
22047
|
+
jsdom: "29.1.1",
|
|
22049
22048
|
zod: "4.5.4",
|
|
22050
22049
|
ws: "8.21.3"
|
|
22051
22050
|
}.nx;
|
|
@@ -56,7 +56,7 @@ Nx and the plugin are distributed as npm packages, so a project with no Node.js
|
|
|
56
56
|
}
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
Create that file, then run `nx init` and [add the plugin](#adding-the-plugin) as usual. Your existing language tooling is untouched — Nx projects generated by the plugin (including <Link path="guides/
|
|
59
|
+
Create that file, then run `nx init` and [add the plugin](#adding-the-plugin) as usual. Your existing language tooling is untouched — Nx projects generated by the plugin (including <Link path="guides/python-project">Python projects</Link>) live alongside your existing code, and you can wire your existing build into Nx incrementally.
|
|
60
60
|
|
|
61
61
|
To bring your existing projects under Nx, you have a few options depending on the language:
|
|
62
62
|
|
|
@@ -3,6 +3,7 @@ title: Quick Start Guide
|
|
|
3
3
|
description: "A quick start on how to use @aws/nx-plugin."
|
|
4
4
|
---
|
|
5
5
|
import { Steps } from '@astrojs/starlight/components';
|
|
6
|
+
import Drawer from '@components/drawer.astro';
|
|
6
7
|
import Link from '@components/link.astro';
|
|
7
8
|
import Snippet from '@components/snippet.astro';
|
|
8
9
|
import CreateNxWorkspaceCommand from '@components/create-nx-workspace-command.astro';
|
|
@@ -42,6 +43,8 @@ You will be prompted for your preferred infrastructure as code (IaC) provider, e
|
|
|
42
43
|
<CreateNxWorkspaceCommand workspace="my-project" iac="terraform" />
|
|
43
44
|
</Fragment>
|
|
44
45
|
</Infrastructure>
|
|
46
|
+
|
|
47
|
+
You are also prompted for the container engine used by generators which build container images. Accept the default (`infer`) to select Docker if it is installed, otherwise Finch.
|
|
45
48
|
:::
|
|
46
49
|
|
|
47
50
|
Once complete, navigate to the project directory:
|
|
@@ -122,8 +125,12 @@ Changes to both your website and API will be reflected in real-time as both the
|
|
|
122
125
|
Open `packages/infra/src/stacks/application-stack.ts` and add the following code:
|
|
123
126
|
|
|
124
127
|
```typescript
|
|
128
|
+
import {
|
|
129
|
+
DemoApi,
|
|
130
|
+
DemoWebsite,
|
|
131
|
+
UserIdentity,
|
|
132
|
+
} from '@my-project/common-constructs';
|
|
125
133
|
import { Stack, StackProps } from 'aws-cdk-lib';
|
|
126
|
-
import { DemoApi, DemoWebsite, UserIdentity } from '@my-project/common-constructs';
|
|
127
134
|
import { Construct } from 'constructs';
|
|
128
135
|
|
|
129
136
|
export class ApplicationStack extends Stack {
|
|
@@ -178,8 +185,8 @@ resource "aws_iam_policy" "api_invoke_policy" {
|
|
|
178
185
|
Version = "2012-10-17"
|
|
179
186
|
Statement = [
|
|
180
187
|
{
|
|
181
|
-
Effect
|
|
182
|
-
Action
|
|
188
|
+
Effect = "Allow"
|
|
189
|
+
Action = "execute-api:Invoke"
|
|
183
190
|
Resource = "${module.demo_api.api_execution_arn}/*/*"
|
|
184
191
|
}
|
|
185
192
|
]
|
|
@@ -218,8 +225,8 @@ Next, run the following command to build your project:
|
|
|
218
225
|
|
|
219
226
|
<PackageManagerShortCommand commands={["build"]} />
|
|
220
227
|
|
|
221
|
-
:::tip[Fixing Lint Errors]
|
|
222
|
-
If you encounter any lint errors, you can run the following command to automatically fix them.
|
|
228
|
+
:::tip[Fixing Lint and Formatting Errors]
|
|
229
|
+
If you encounter any lint or formatting errors, you can run the following command to automatically fix them.
|
|
223
230
|
|
|
224
231
|
<PackageManagerShortCommand commands={["lint"]} />
|
|
225
232
|
:::
|
|
@@ -280,6 +287,44 @@ This command will first run `terraform plan` to show you what changes will be ma
|
|
|
280
287
|
|
|
281
288
|
Your website will be available at `http://localhost:4200`, and will point to the resources you deployed for the API and authentication.
|
|
282
289
|
|
|
290
|
+
To sign in, you will need to [create a user in the Cognito user pool](https://docs.aws.amazon.com/cognito/latest/developerguide/how-to-create-user-accounts.html).
|
|
291
|
+
|
|
292
|
+
<Drawer title="Creating a user with the AWS CLI" trigger="Click here for instructions using the AWS CLI">
|
|
293
|
+
|
|
294
|
+
The following command creates a user in a user pool. You can find the user pool id in your deployment outputs, or in the [Amazon Cognito console](https://console.aws.amazon.com/cognito/). Substitute values for username, email, first and last name, and the temporary password.
|
|
295
|
+
|
|
296
|
+
```sh
|
|
297
|
+
aws cognito-idp admin-create-user \
|
|
298
|
+
--user-pool-id <user pool id> \
|
|
299
|
+
--username <username> \
|
|
300
|
+
--user-attributes Name=email,Value=<email> Name=email_verified,Value=true Name=given_name,Value=<first name> Name=family_name,Value=<last name> \
|
|
301
|
+
--temporary-password '<temporary password>' \
|
|
302
|
+
--message-action SUPPRESS
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
The first time you sign in as this user you are prompted to choose a new password, then to set up multi-factor authentication with either a code sent by SMS or a time-based one time password from an authenticator app.
|
|
306
|
+
|
|
307
|
+
</Drawer>
|
|
308
|
+
|
|
309
|
+
Your website is also served from CloudFront. Open its distribution domain name (which is printed to your terminal after deployment) to use the version running entirely on AWS.
|
|
310
|
+
|
|
311
|
+
## Step 6: Clean Up
|
|
312
|
+
|
|
313
|
+
When you have finished, delete the resources you deployed to avoid ongoing costs:
|
|
314
|
+
|
|
315
|
+
<Infrastructure>
|
|
316
|
+
<Fragment slot="cdk">
|
|
317
|
+
<NxCommands commands={['destroy-sandbox infra']} />
|
|
318
|
+
</Fragment>
|
|
319
|
+
<Fragment slot="terraform">
|
|
320
|
+
<NxCommands commands={['destroy infra']} />
|
|
321
|
+
</Fragment>
|
|
322
|
+
</Infrastructure>
|
|
323
|
+
|
|
324
|
+
:::note[Retained Resources]
|
|
325
|
+
The Cognito user pool is created with deletion protection enabled, so it is not removed automatically. Delete it (and the IAM role Cognito uses to send SMS messages) manually if you no longer need them.
|
|
326
|
+
:::
|
|
327
|
+
|
|
283
328
|
---
|
|
284
329
|
|
|
285
330
|
Congratulations! 🎉 You have successfully built and deployed a full-stack application using `@aws/nx-plugin`!
|
|
@@ -282,7 +282,10 @@ export class GameApi<
|
|
|
282
282
|
} as FunctionProps,
|
|
283
283
|
buildDefaultIntegration: (op, props: FunctionProps) => {
|
|
284
284
|
const handler = new Function(scope, `GameApi${op}Handler`, props);
|
|
285
|
-
handler.addEnvironment(
|
|
285
|
+
handler.addEnvironment(
|
|
286
|
+
'RUNTIME_CONFIG_APP_ID',
|
|
287
|
+
rc.appConfigApplicationId,
|
|
288
|
+
);
|
|
286
289
|
rc.grantReadAppConfig(handler);
|
|
287
290
|
return {
|
|
288
291
|
handler,
|
|
@@ -1397,6 +1400,7 @@ The `connection` generator generates/updates these files:
|
|
|
1397
1400
|
- copilot/
|
|
1398
1401
|
- **index.tsx** Shadcn-themed `CopilotChat` / `CopilotSidebar` / `CopilotPopup`
|
|
1399
1402
|
- ShadcnAssistantMessage.tsx, ShadcnUserMessage.tsx, ShadcnChatInput.tsx, ShadcnCursor.tsx, copilot.css
|
|
1403
|
+
- story-agent-chat.tsx a `CopilotChat` pre-bound to the Story Agent's `agentId`
|
|
1400
1404
|
- hooks/
|
|
1401
1405
|
- **useAguiStoryAgent.tsx** Builds an `HttpAgent`, injects the Cognito bearer token, and pads `threadId` to AgentCore's 33-char session id
|
|
1402
1406
|
- **main.tsx** Wraps `<App />` in `<AguiProvider>`
|
|
@@ -1476,6 +1480,8 @@ new ApplicationStage(app, 'dungeon-adventure-infra-sandbox', {
|
|
|
1476
1480
|
},
|
|
1477
1481
|
});
|
|
1478
1482
|
|
|
1483
|
+
// Define other instances of stages, such as beta and prod, below
|
|
1484
|
+
|
|
1479
1485
|
app.synth();
|
|
1480
1486
|
```
|
|
1481
1487
|
|
|
@@ -1523,7 +1529,7 @@ The `run-many` command will run a target on multiple listed subprojects (`--all`
|
|
|
1523
1529
|
|
|
1524
1530
|
You can also trigger a build (or any other task) for a single project target by running the target on the project directly. For example, to build the `@dungeon-adventure/infra` project, run the following command:
|
|
1525
1531
|
|
|
1526
|
-
<NxCommands commands={['build infra']} />
|
|
1532
|
+
<NxCommands commands={['build @dungeon-adventure/infra']} />
|
|
1527
1533
|
|
|
1528
1534
|
You can also omit the scope, and use the Nx shorthand syntax if you prefer:
|
|
1529
1535
|
|
|
@@ -1562,16 +1568,15 @@ You may be prompted with the following:
|
|
|
1562
1568
|
```bash
|
|
1563
1569
|
NX The workspace is out of sync
|
|
1564
1570
|
|
|
1565
|
-
[@nx/js:typescript-sync]: Some TypeScript configuration files are missing project references to the projects they depend on or
|
|
1566
|
-
|
|
1567
|
-
This will result in an error in CI.
|
|
1571
|
+
[@nx/js:typescript-sync]: Some TypeScript configuration files are missing project references to the projects they depend on, contain stale project references, or have duplicate project references.
|
|
1572
|
+
[@aws/nx-plugin:ts#sync]: Some files are out of sync.
|
|
1568
1573
|
|
|
1569
1574
|
? Would you like to sync the identified changes to get your workspace up to date? …
|
|
1570
1575
|
Yes, sync the changes and run the tasks
|
|
1571
1576
|
No, run the tasks without syncing the changes
|
|
1572
1577
|
```
|
|
1573
1578
|
|
|
1574
|
-
This message indicates that NX has detected some files which can be updated automatically for you. In this case, it is referring to the `tsconfig.json` files which do not have Typescript references set up on
|
|
1579
|
+
This message indicates that NX has detected some files which can be updated automatically for you. In this case, it is referring to the `tsconfig.json` files which do not have Typescript references set up on referenced projects, and to the workspace dependencies the `@aws/nx-plugin` sync generator declares for you.
|
|
1575
1580
|
|
|
1576
1581
|
Select the **Yes, sync the changes and run the tasks** option to proceed. You should notice all of you IDE related import errors get automatically resolved as the sync generator will add the missing typescript references automatically!
|
|
1577
1582
|
|
|
@@ -248,6 +248,6 @@ We can try out the MCP server's tools with the [MCP Inspector](https://github.co
|
|
|
248
248
|
|
|
249
249
|
<NxCommands commands={["mcp-server-inspect inventory"]} />
|
|
250
250
|
|
|
251
|
-
This serves the MCP server locally (booting DynamoDB Local too) and launches the MCP Inspector at `http://localhost:6274` pre-configured to connect to it.
|
|
251
|
+
This serves the MCP server locally (booting DynamoDB Local too) and launches the MCP Inspector at `http://localhost:6274` pre-configured to connect to it. Toggle the switch next to the `localhost:8000` server to connect, switch to the **Tools** tab, and try `add-to-inventory` (e.g. `playerName: Alice`, `itemName: Rusty Sword`, `emoji: ⚔️`) followed by `list-inventory-items` to see it persisted to DynamoDB Local. Stop the server (`Ctrl+C`) when you're done.
|
|
252
252
|
|
|
253
253
|
Congratulations, you have built and tested your first tRPC API and MCP server against a local DynamoDB table! 🎉🎉🎉
|
|
@@ -48,6 +48,7 @@ When you ran the `connection` generator for `game-ui → story` in <Link path="g
|
|
|
48
48
|
- copilot/
|
|
49
49
|
- index.tsx Re-exports themed `CopilotChat` / `CopilotSidebar` / `CopilotPopup`.
|
|
50
50
|
- ShadcnAssistantMessage.tsx, ShadcnUserMessage.tsx, ShadcnChatInput.tsx, ShadcnCursor.tsx, copilot.css
|
|
51
|
+
- story-agent-chat.tsx A `CopilotChat` pre-bound to the Story Agent's `agentId`.
|
|
51
52
|
- hooks/
|
|
52
53
|
- useAguiStoryAgent.tsx Instantiates an `@ag-ui/client` `HttpAgent` pointing at the deployed Story Agent and pads `threadId` to AgentCore's 33-character minimum session id.
|
|
53
54
|
- main.tsx Wraps `<App />` in `<AguiProvider>`
|
|
@@ -146,6 +147,10 @@ dungeon-adventure-infra-sandbox-Application.UserIdentityUserIdentityUserPoolIdXX
|
|
|
146
147
|
|
|
147
148
|
Navigate to your CloudFront URL (`GameUIDistributionDomainName` from the CDK outputs), sign up for a new account, and play your game running entirely on AWS!
|
|
148
149
|
|
|
150
|
+
:::note[Signing up for the first time]
|
|
151
|
+
Cognito emails you a code to confirm your account, then asks you to set up multi-factor authentication (an authenticator app or an SMS code) before your first sign-in — the user pool `ts#website#auth` vends requires MFA. See <Link path="guides/react-website-auth#multi-factor-authentication-mfa">Multi-factor authentication</Link> for how to relax that.
|
|
152
|
+
:::
|
|
153
|
+
|
|
149
154
|
## Task 6: Mixing local and deployed components
|
|
150
155
|
|
|
151
156
|
You've seen two ends of the spectrum: everything local (`dev`) and everything deployed. During day-to-day development it's often useful to mix the two — for example, iterate on website code against the *real* deployed API and agent, or run the API locally against the *real* DynamoDB table.
|
|
@@ -38,4 +38,13 @@ We recommend you try your hand at extending the codebase with the following capa
|
|
|
38
38
|
|
|
39
39
|
This will prompt you for a list of stacks to delete which should comprise of the `dungeon-adventure-infra-sandbox/Application/GameUI/waf` and `dungeon-adventure-infra-sandbox/Application`.
|
|
40
40
|
|
|
41
|
-
2. Enter `
|
|
41
|
+
2. Enter `y` to continue. CloudFormation will destroy your stacks.
|
|
42
|
+
|
|
43
|
+
:::caution[Two resources are kept on purpose]
|
|
44
|
+
Deleting the stacks leaves two resources behind, so a teardown can't take your users or their stories with it:
|
|
45
|
+
|
|
46
|
+
- The **Cognito user pool**, which `ts#website#auth` creates with deletion protection enabled.
|
|
47
|
+
- The **Story Agent's session bucket**, which holds the conversation history and defaults to `RemovalPolicy.RETAIN`.
|
|
48
|
+
|
|
49
|
+
Delete them by hand once you no longer need them — for the user pool, turn deletion protection off first.
|
|
50
|
+
:::
|
package/docs/guides/license.mdx
CHANGED
|
@@ -9,7 +9,6 @@ import GeneratorParameters from '@components/generator-parameters.astro';
|
|
|
9
9
|
import Drawer from '@components/drawer.astro';
|
|
10
10
|
import LicenseAllowlist from '@components/license-allowlist.astro';
|
|
11
11
|
import NxCommands from '@components/nx-commands.astro';
|
|
12
|
-
import PackageManagerShortCommand from '@components/package-manager-short-command.astro';
|
|
13
12
|
|
|
14
13
|
Manage licensing across your workspace: synchronise `LICENSE` files and source code headers for your own code (`license.source`), and check that every dependency conforms to a license allowlist (`license.dependencies`).
|
|
15
14
|
|
|
@@ -45,7 +44,7 @@ Whenever you build your projects (and a `lint` target runs), the license sync ge
|
|
|
45
44
|
|
|
46
45
|
[@aws/nx-plugin:license#sync]: Project LICENSE files are out of sync:
|
|
47
46
|
- LICENSE
|
|
48
|
-
- packages/<my-project
|
|
47
|
+
- packages/<my-project>/LICENSE
|
|
49
48
|
|
|
50
49
|
Project package.json files are out of sync:
|
|
51
50
|
- package.json
|
|
@@ -348,7 +347,7 @@ This means you don't need to run the check explicitly, though you can still do s
|
|
|
348
347
|
|
|
349
348
|
The wiring is a cross-project `dependsOn` on each project's `lint` target that points at the root `license-check` target. To skip the check during a lint or build, set the `LICENSE_DEPENDENCY_CHECK=skip` environment variable:
|
|
350
349
|
|
|
351
|
-
<
|
|
350
|
+
<NxCommands commands={['run-many --target lint --all']} env={{ LICENSE_DEPENDENCY_CHECK: 'skip' }} />
|
|
352
351
|
|
|
353
352
|
### Configuration
|
|
354
353
|
|
|
@@ -381,7 +380,14 @@ To restrict the allowlist, replace `DEFAULT_LICENSE_ALLOWLIST` with your own arr
|
|
|
381
380
|
|
|
382
381
|
#### Per-package exceptions
|
|
383
382
|
|
|
384
|
-
Use `exceptions` for packages that fail the check — either because their license is not in the allowlist, or because they ship without detectable license metadata.
|
|
383
|
+
Use `exceptions` for packages that fail the check — either because their license is not in the allowlist, or because they ship without detectable license metadata.
|
|
384
|
+
|
|
385
|
+
Each entry accepts:
|
|
386
|
+
|
|
387
|
+
- `package` (required): the package name the exception applies to
|
|
388
|
+
- `reason` (required): why the exception was granted, so reviewers can see it
|
|
389
|
+
- `version` (optional): restrict the exception to a single version, so a later version is checked again
|
|
390
|
+
- `spdx` (optional): the license to treat the package as declaring, for a package that ships license text without declaring it in its metadata. This is what the `onDependency` hook below reports
|
|
385
391
|
|
|
386
392
|
```typescript
|
|
387
393
|
exceptions: [
|
|
@@ -389,6 +395,7 @@ exceptions: [
|
|
|
389
395
|
package: 'union',
|
|
390
396
|
version: '0.5.0',
|
|
391
397
|
reason: 'Package ships verbatim MIT text without declaring license',
|
|
398
|
+
spdx: 'MIT',
|
|
392
399
|
},
|
|
393
400
|
];
|
|
394
401
|
```
|
|
@@ -397,7 +404,24 @@ Generators that introduce dependencies with problematic metadata (e.g. the MCP s
|
|
|
397
404
|
|
|
398
405
|
#### Collectors
|
|
399
406
|
|
|
400
|
-
Collectors discover dependencies and extract license metadata. The built-in collectors are `npmCollector()` (scans `node_modules`) and `pythonCollector()` (scans Python virtual environments)
|
|
407
|
+
Collectors discover dependencies and extract license metadata. The built-in collectors are `npmCollector()` (scans `node_modules`) and `pythonCollector()` (scans Python virtual environments), both exported from `@aws/nx-plugin/sdk/license`. The license generator configures `npmCollector()` by default and adds `pythonCollector()` when Python projects are present.
|
|
408
|
+
|
|
409
|
+
```typescript title="aws-nx-plugin.config.mts"
|
|
410
|
+
import {
|
|
411
|
+
DEFAULT_LICENSE_ALLOWLIST,
|
|
412
|
+
npmCollector,
|
|
413
|
+
pythonCollector,
|
|
414
|
+
} from '@aws/nx-plugin/sdk/license';
|
|
415
|
+
|
|
416
|
+
export default {
|
|
417
|
+
license: {
|
|
418
|
+
dependencies: {
|
|
419
|
+
allow: DEFAULT_LICENSE_ALLOWLIST,
|
|
420
|
+
collectors: [npmCollector(), pythonCollector()],
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
} satisfies AwsNxPluginConfig;
|
|
424
|
+
```
|
|
401
425
|
|
|
402
426
|
To implement a custom collector, conform to the `LicenseCollector` interface:
|
|
403
427
|
|
|
@@ -443,6 +467,6 @@ Dependency license checking is enabled by the presence of the `license.dependenc
|
|
|
443
467
|
|
|
444
468
|
To disable the checks for a single run, set the `LICENSE_DEPENDENCY_CHECK=skip` environment variable:
|
|
445
469
|
|
|
446
|
-
<
|
|
470
|
+
<NxCommands commands={['run-many --target lint --all']} env={{ LICENSE_DEPENDENCY_CHECK: 'skip' }} />
|
|
447
471
|
|
|
448
472
|
To disable permanently, remove the `license.dependencies` key from your configuration in `aws-nx-plugin.config.mts`. You can also re-run the `license` generator with `--dependencyCheck=false` to scaffold without it.
|
|
@@ -40,15 +40,14 @@ The generator will create the following project files within the given `project`
|
|
|
40
40
|
- generator.ts Stub generator implementation
|
|
41
41
|
- generator.spec.ts Tests for your generator
|
|
42
42
|
- README.md Documentation for your generator
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
-
|
|
43
|
+
- files/
|
|
44
|
+
- hello.ts.template Example template rendered by the stub generator
|
|
45
|
+
- src/index.ts Updated to export your generator
|
|
46
|
+
- generators.json Created or updated to define your generators
|
|
47
|
+
- project.json Updated to record the generator against the project
|
|
48
|
+
- package.json Created if absent, and pointed at `generators.json`
|
|
46
49
|
</FileTree>
|
|
47
50
|
|
|
48
|
-
:::warning[Project Modification]
|
|
49
|
-
This generator will update the selected `project` to use CommonJS, as Nx Generators only support CommonJS at present ([refer to this GitHub issue for ESM support](https://github.com/nrwl/nx/issues/15682)).
|
|
50
|
-
:::
|
|
51
|
-
|
|
52
51
|
## Local Generators
|
|
53
52
|
|
|
54
53
|
:::tip[Dedicated Plugin Project]
|
|
@@ -452,7 +451,7 @@ export const myGenerator = async (tree: Tree, schema: MyGeneratorSchema) => {
|
|
|
452
451
|
We also expose a method which allows you to build a data structure that can be used to iterate over operations in an OpenAPI specification and therefore instrument your own code generation, for example:
|
|
453
452
|
|
|
454
453
|
```ts
|
|
455
|
-
import { buildOpenApiCodeGenerationData } from '@aws/nx-plugin/sdk/open-api
|
|
454
|
+
import { buildOpenApiCodeGenerationData } from '@aws/nx-plugin/sdk/open-api';
|
|
456
455
|
|
|
457
456
|
export const myGenerator = async (tree: Tree, schema: MyGeneratorSchema) => {
|
|
458
457
|
const data = await buildOpenApiCodeGenerationData(tree, 'path/to/spec.json');
|
|
@@ -496,15 +495,15 @@ If you don't see your generator in the VSCode plugin UI, you can refresh your Nx
|
|
|
496
495
|
Unit tests for generators are straightforward to implement. Here's a typical pattern:
|
|
497
496
|
|
|
498
497
|
```typescript
|
|
499
|
-
import {
|
|
498
|
+
import { createTreeUsingTsSolutionSetup } from '@aws/nx-plugin/sdk/utils/test';
|
|
500
499
|
import { yourGenerator } from './generator.js';
|
|
501
500
|
|
|
502
501
|
describe('your generator', () => {
|
|
503
502
|
let tree;
|
|
504
503
|
|
|
505
504
|
beforeEach(() => {
|
|
506
|
-
// Create
|
|
507
|
-
tree =
|
|
505
|
+
// Create a workspace tree matching the shape our preset generates
|
|
506
|
+
tree = createTreeUsingTsSolutionSetup();
|
|
508
507
|
|
|
509
508
|
// Add any files that should already exist in the tree
|
|
510
509
|
tree.write(
|
|
@@ -562,7 +561,7 @@ describe('your generator', () => {
|
|
|
562
561
|
|
|
563
562
|
Key points for testing generators:
|
|
564
563
|
|
|
565
|
-
- Use `
|
|
564
|
+
- Use `createTreeUsingTsSolutionSetup()` from `@aws/nx-plugin/sdk/utils/test` to create a virtual file system. It seeds the workspace markers our preset writes (`tsconfig.base.json`, `pnpm-workspace.yaml`, `biome.json`, a `type: module` root `package.json`), which any generator composing an `@aws/nx-plugin` generator needs
|
|
566
565
|
- Set up any prerequisite files before running the generator
|
|
567
566
|
- Test both the creation of new files and updates to existing files
|
|
568
567
|
- Use snapshots for complex file content
|
|
@@ -33,22 +33,30 @@ The generator will create the following project structure:
|
|
|
33
33
|
<FileTree>
|
|
34
34
|
- your-plugin/
|
|
35
35
|
- src/
|
|
36
|
-
- index.ts
|
|
36
|
+
- index.ts Entry point for your plugin
|
|
37
37
|
- mcp-server/
|
|
38
38
|
- index.ts Exports your server
|
|
39
39
|
- server.ts Main MCP server configuration
|
|
40
40
|
- stdio.ts Entry point for your MCP server with STDIO transport
|
|
41
41
|
- http.ts Entry point for your MCP server with Streamable HTTP transport
|
|
42
|
+
- schema.ts Shared schemas for the MCP server's tools
|
|
43
|
+
- utils.ts Utility functions for the MCP server
|
|
44
|
+
- resources/
|
|
45
|
+
- GENERAL_GUIDANCE.md Guidance served by the `general-guidance` tool
|
|
42
46
|
- tools/
|
|
43
47
|
- create-workspace-command.ts Tool for workspace creation guidance
|
|
44
48
|
- general-guidance.ts Tool for general Nx and plugin guidance
|
|
45
49
|
- list-generators.ts Tool to list available generators
|
|
46
50
|
- generator-guide.ts Tool for detailed generator information
|
|
47
|
-
- utils.ts Utility functions for the MCP server
|
|
48
51
|
- generators.json Nx generator configuration (initially empty)
|
|
49
52
|
- package.json Plugin package configuration
|
|
50
|
-
- tsconfig.json TypeScript configuration (CommonJS for Nx compatibility)
|
|
51
53
|
- project.json Nx project configuration with build and package targets
|
|
54
|
+
- tsconfig.json TypeScript configuration, referencing the two below
|
|
55
|
+
- tsconfig.lib.json TypeScript configuration for your plugin's source
|
|
56
|
+
- tsconfig.spec.json TypeScript configuration for your plugin's tests
|
|
57
|
+
- vitest.config.mts Vitest configuration for your plugin's tests
|
|
58
|
+
- README.md Documentation for your plugin, served by the `generator-guide` tool
|
|
59
|
+
- LICENSE Written by the `license` generator's sync, when configured
|
|
52
60
|
</FileTree>
|
|
53
61
|
|
|
54
62
|
## Working with Your Nx Plugin
|
|
@@ -84,7 +92,7 @@ Creates a distributable package ready for NPM publishing:
|
|
|
84
92
|
The package target includes all necessary assets:
|
|
85
93
|
- Compiled JavaScript files
|
|
86
94
|
- TypeScript declaration files
|
|
87
|
-
-
|
|
95
|
+
- The `generators.json`, `executors.json` and `migrations.json` manifests Nx reads from a published plugin
|
|
88
96
|
- Documentation and license files
|
|
89
97
|
|
|
90
98
|
## MCP Server Integration
|
|
@@ -114,14 +122,16 @@ For more details about writing MCP Servers, refer to the <Link path="/guides/ts-
|
|
|
114
122
|
|
|
115
123
|
### Preparing for Publication
|
|
116
124
|
|
|
117
|
-
1. **Update Package Information**: Edit your plugin's [`package.json`](https://docs.npmjs.com/cli/v10/configuring-npm/package-json) with proper name, version, description, and repository information.
|
|
125
|
+
1. **Update Package Information**: Edit your plugin's [`package.json`](https://docs.npmjs.com/cli/v10/configuring-npm/package-json) with proper name, version, description, and repository information. Also remove `"private": true`.
|
|
118
126
|
|
|
119
127
|
2. **Build the Package**:
|
|
120
128
|
<NxCommands commands={['package your-plugin']} />
|
|
121
129
|
|
|
130
|
+
The package lands in `dist/<your-plugin's project root>/package` — for a plugin generated with `--name=nx-plugin --directory=tools`, that's `dist/tools/nx-plugin/package`.
|
|
131
|
+
|
|
122
132
|
3. **Test Locally**: You can test your plugin locally by installing it in another workspace:
|
|
123
133
|
```bash
|
|
124
|
-
npm install /path/to/your/workspace/dist/
|
|
134
|
+
npm install /path/to/your/workspace/dist/tools/nx-plugin/package
|
|
125
135
|
```
|
|
126
136
|
|
|
127
137
|
### Publishing to NPM
|
|
@@ -129,7 +139,7 @@ For more details about writing MCP Servers, refer to the <Link path="/guides/ts-
|
|
|
129
139
|
Once your plugin is ready:
|
|
130
140
|
|
|
131
141
|
```bash
|
|
132
|
-
cd dist/
|
|
142
|
+
cd dist/tools/nx-plugin/package
|
|
133
143
|
npm publish
|
|
134
144
|
```
|
|
135
145
|
|
|
@@ -467,7 +467,9 @@ Destroying is irreversible, so CDK asks you to confirm the stacks it is about to
|
|
|
467
467
|
|
|
468
468
|
The `destroy` target tears down whichever stage or stacks you name:
|
|
469
469
|
|
|
470
|
-
<NxCommands commands={['destroy <my-infra> <my-infra>-sandbox
|
|
470
|
+
<NxCommands commands={['destroy <my-infra> <my-infra>-sandbox/**']} />
|
|
471
|
+
|
|
472
|
+
Use `/**` rather than `/*` for a whole stage: destroying only deletes the stacks the pattern selects, and `/*` misses stacks nested below the stage's stacks, such as the `us-east-1` WebACL stack a website creates for its CloudFront distribution.
|
|
471
473
|
|
|
472
474
|
To tear down an individual stack, give the full stack name:
|
|
473
475
|
|
|
@@ -199,6 +199,6 @@ Another option is to use GraphQL APIs with websockets on [AppSync](https://aws.a
|
|
|
199
199
|
|
|
200
200
|
You can also consider rolling your own code generators which interpret the same vendor extensions as Type Safe API. Refer to the [APIs Modelled with OpenAPI](#apis-modelled-with-openapi) section for details around building custom OpenAPI-based code generators. You can find the templates Type Safe API uses for API Gateway Websocket API Lambda handlers [here](https://github.com/aws/aws-pdk/tree/mainline/packages/type-safe-api/scripts/type-safe-api/generators/typescript-async-runtime/templates), and the client [here](https://github.com/aws/aws-pdk/blob/mainline/packages/type-safe-api/scripts/type-safe-api/generators/typescript-websocket-client/templates/client.ejs).
|
|
201
201
|
|
|
202
|
-
You can also consider migrating to use the <Link path="/guides/trpc
|
|
202
|
+
You can also consider migrating to use the <Link path="/guides/trpc">`ts#trpc-api` generator</Link> to use tRPC. At the time of writing we don't yet have support for subscriptions/streaming but if this is something you need do add a +1 to our [GitHub issue tracking this](https://github.com/awslabs/nx-plugin-for-aws/issues/194).
|
|
203
203
|
|
|
204
204
|
Smithy is protocol agnostic, but does not yet have support for the Websocket protocol, refer to [this GitHub issue tracking support](https://github.com/smithy-lang/smithy/issues/1505).
|
|
@@ -13,5 +13,5 @@ import Snippet from '@components/snippet.astro';
|
|
|
13
13
|
<Snippet name="recommended-prerequisites" parentHeading="Recommended" />
|
|
14
14
|
|
|
15
15
|
:::tip[AI Assistant Setup]
|
|
16
|
-
If you use an AI Assistant such as Kiro, Kiro CLI, Cursor, Claude Code or
|
|
16
|
+
If you use an AI Assistant such as Kiro, Kiro CLI, Cursor, Claude Code or Codex, you may also wish to <Link path="/get_started/building-with-ai">install the Nx Plugin for AWS MCP server.</Link>
|
|
17
17
|
:::
|