@jaypie/mcp 0.2.5 → 0.2.7

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/dist/index.js CHANGED
@@ -885,7 +885,7 @@ function listLlmProviders() {
885
885
  };
886
886
  }
887
887
 
888
- const BUILD_VERSION_STRING = "@jaypie/mcp@0.2.5#b58bafc3"
888
+ const BUILD_VERSION_STRING = "@jaypie/mcp@0.2.7#8fb79282"
889
889
  ;
890
890
  const __filename$1 = fileURLToPath(import.meta.url);
891
891
  const __dirname$1 = path.dirname(__filename$1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaypie/mcp",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "Jaypie MCP",
5
5
  "repository": {
6
6
  "type": "git",
@@ -153,12 +153,44 @@ Note: API Gateway has a 29-second timeout limit. For longer streaming operations
153
153
 
154
154
  ### Stack Types
155
155
 
156
- Use specialized stacks for different purposes:
156
+ Always extend Jaypie stack classes instead of raw CDK classes:
157
+
158
+ | Use | Instead of |
159
+ |-----|------------|
160
+ | `JaypieAppStack` | `cdk.Stack` |
161
+ | `JaypieInfrastructureStack` | `cdk.Stack` |
162
+
163
+ Jaypie stacks automatically configure:
164
+ - `env` with `CDK_DEFAULT_ACCOUNT` and `CDK_DEFAULT_REGION` (required for context providers)
165
+ - Standard tagging
166
+ - Removal policies based on environment
167
+
157
168
  ```typescript
158
169
  new JaypieAppStack(scope, "AppStack"); // Application resources
159
170
  new JaypieInfrastructureStack(scope, "InfraStack"); // Infrastructure resources
160
171
  ```
161
172
 
173
+ #### Error: Using cdk.Stack with Context Providers
174
+
175
+ Using `cdk.Stack` directly with constructs that need context providers causes:
176
+
177
+ ```
178
+ ValidationError: Cannot retrieve value from context provider hosted-zone since
179
+ account/region are not specified at the stack level.
180
+ ```
181
+
182
+ **Solution:** Change the base class:
183
+
184
+ ```typescript
185
+ // Wrong
186
+ import * as cdk from "aws-cdk-lib";
187
+ export class AppStack extends cdk.Stack { ... }
188
+
189
+ // Correct
190
+ import { JaypieAppStack } from "@jaypie/constructs";
191
+ export class AppStack extends JaypieAppStack { ... }
192
+ ```
193
+
162
194
  ### Secrets Management
163
195
 
164
196
  Use `JaypieEnvSecret` for cross-stack secret sharing:
@@ -291,6 +323,76 @@ Common usage:
291
323
  - `resolveHostedZone(scope, { zone })`: Gets IHostedZone from string or object
292
324
  - `extendDatadogRole(lambda)`: Adds Datadog IAM permissions when CDK_ENV_DATADOG_ROLE_ARN set
293
325
 
326
+ ### DynamoDB Tables
327
+
328
+ Use `JaypieDynamoDb` for single-table design with Jaypie GSI patterns:
329
+ ```typescript
330
+ // Shorthand: tableName becomes "myApp", construct id is "JaypieDynamoDb-myApp"
331
+ const table = new JaypieDynamoDb(this, "myApp");
332
+
333
+ // No GSIs
334
+ const table = new JaypieDynamoDb(this, "MyTable", {
335
+ globalSecondaryIndexes: false,
336
+ });
337
+
338
+ // Use only specific GSIs
339
+ const table = new JaypieDynamoDb(this, "MyTable", {
340
+ globalSecondaryIndexes: [
341
+ JaypieDynamoDb.GlobalSecondaryIndex.Ou,
342
+ JaypieDynamoDb.GlobalSecondaryIndex.Type,
343
+ ],
344
+ });
345
+
346
+ // Connect table to Lambda
347
+ new JaypieLambda(this, "Worker", {
348
+ code: "dist",
349
+ tables: [table], // Grants read/write, sets DYNAMODB_TABLE_NAME
350
+ });
351
+ ```
352
+
353
+ Features:
354
+ - Default partition key: `model` (string), sort key: `id` (string)
355
+ - PAY_PER_REQUEST billing mode by default
356
+ - RETAIN removal policy in production, DESTROY otherwise
357
+ - GSI options: `true`/omit = all five, `false` = none, array = specific GSIs
358
+ - Static constants: `JaypieDynamoDb.GlobalSecondaryIndex.*` and `JaypieDynamoDb.GlobalSecondaryIndexes`
359
+ - All GSIs use partition key (string) + `sequence` (number) sort key
360
+ - Implements `ITableV2` interface
361
+
362
+ For single-table design patterns, key builders, and query utilities, see `Jaypie_DynamoDB_Package.md`.
363
+
364
+ ### Next.js Applications
365
+
366
+ Use `JaypieNextJs` for Next.js deployments with CloudFront and custom domains:
367
+ ```typescript
368
+ const nextjs = new JaypieNextJs(this, "Web", {
369
+ domainName: "app.example.com",
370
+ hostedZone: "example.com",
371
+ nextjsPath: "../nextjs", // Path to Next.js project
372
+ environment: ["NODE_ENV", { CUSTOM_VAR: "value" }],
373
+ secrets: ["AUTH0_CLIENT_SECRET", "AUTH0_SECRET"],
374
+ tables: [dynamoTable],
375
+ });
376
+ ```
377
+
378
+ Features:
379
+ - Uses `cdk-nextjs-standalone` under the hood
380
+ - CloudFront distribution with SSL certificate
381
+ - Custom domain via Route53
382
+ - Automatic Datadog integration
383
+ - Parameter Store/Secrets Manager layer
384
+ - Server-side function with secrets and tables access
385
+ - NEXT_PUBLIC_* environment variables automatically included
386
+ - `domainName` accepts string or config object: `{ component, domain, env, subdomain }`
387
+
388
+ Properties exposed:
389
+ - `bucket`: S3 bucket for static assets
390
+ - `distribution`: CloudFront distribution
391
+ - `domain`: Route53 domain configuration
392
+ - `serverFunction`: Next.js server Lambda function
393
+ - `imageOptimizationFunction`: Image optimization Lambda
394
+ - `url`: CloudFront distribution URL
395
+
294
396
  ## Additional Constructs
295
397
 
296
398
  Other constructs available but not commonly used:
@@ -4,72 +4,79 @@ description: conventions around deployment and environment variables, especially
4
4
 
5
5
  # Jaypie CI/CD with GitHub Actions
6
6
 
7
+ Reference for Jaypie CI/CD conventions. For setup instructions, see `Jaypie_Init_CICD_with_GitHub_Actions.md`.
8
+
7
9
  ## Jaypie Environments
8
10
 
9
- Jaypie assumes multiple deployed environments, usually some combination of development, production, and sandbox.
10
- Sandbox environments usually allow developers to create personal builds connected to shared resources.
11
- Personal builds are tied to the GitHub actor (user).
12
- Production should stand alone in its own environment.
13
- Development environments assure deployments to multiple environments is working.
14
- They are sometimes duplicates of sandbox or production and therefore skipped.
11
+ Jaypie assumes multiple deployed environments:
15
12
 
16
- ## Naming Conventions
13
+ | Environment | Purpose |
14
+ |-------------|---------|
15
+ | production | Live environment, standalone |
16
+ | development | Validates multi-environment deployment works |
17
+ | sandbox | Shared testing environment |
18
+ | personal | Developer-specific builds tied to GitHub actor |
17
19
 
18
- Workflow files should lead with the most important keyword, usually a service or action, and end with the environment.
19
- E.g., `deploy-personal-build.yml`, `deploy-sandbox.yml`, `e2b-deploy-development.yml`, `npm-deploy.yml`
20
+ ## Naming Conventions
20
21
 
21
- There are often as many workflows as there are deployed environments.
22
- Applications usually have development, sandbox, and production.
23
- NPM only has production.
22
+ Workflow files lead with the most important keyword and end with the environment:
23
+ - `deploy-personal-build.yml`
24
+ - `deploy-sandbox.yml`
25
+ - `deploy-production.yml`
26
+ - `npm-deploy.yml`
24
27
 
25
28
  Always prefer full words for maximum clarity.
26
29
 
27
30
  ## File Structure
28
31
 
29
- name
30
- on
31
- concurrency
32
- env (alphabetical)
33
- jobs (alphabetical)
32
+ Workflow files follow this order:
33
+
34
+ ```yaml
35
+ name:
36
+ on:
37
+ concurrency:
38
+ env: # alphabetical
39
+ jobs: # alphabetical
40
+ ```
34
41
 
35
- ### Style
42
+ ### Style Rules
36
43
 
37
- Do not use secrets in the env section.
38
- Only pass secrets as environment variables to tasks that require them.
39
- Any variables that will be programmatically set and used in jobs should be declared in the env section by setting it to en empty string with a comment about its purpose.
40
- Static variables should be set in the env section, NEVER declared in the job: <bad>`echo "ENV=development" >> $GITHUB_ENV`</bad>.
44
+ 1. Do not use secrets in the `env` section
45
+ 2. Only pass secrets as environment variables to tasks that require them
46
+ 3. Declare programmatic variables in `env` with empty string and comment:
47
+ ```yaml
48
+ env:
49
+ PROJECT_VERSION: "" # Set from package.json during build
50
+ ```
51
+ 4. Static variables should be set in `env`, not in job steps
41
52
 
42
53
  ## Triggers
43
54
 
44
- Environments are triggered by common events across projects:
45
-
46
- * Production
47
- * tags: `v*`
48
- * Development
49
- * branches: [main]
50
- * Sandbox
51
- * branches: [main, develop, sandbox, sandbox-*, sandbox/*]
52
- * Personal Builds
53
- * branches-ignore: [main, develop, nobuild-*, nobuild/*, sandbox, sandbox-*, sandbox/*]
55
+ | Environment | Trigger |
56
+ |-------------|---------|
57
+ | production | tags: `v*` |
58
+ | development | branches: `[main]` |
59
+ | sandbox | branches: `[main, develop, sandbox, sandbox-*, sandbox/*]` |
60
+ | personal | branches-ignore: `[main, develop, nobuild-*, nobuild/*, sandbox, sandbox-*, sandbox/*]` |
54
61
 
55
62
  ### Dependencies
56
63
 
57
- In production and development builds, it makes sense for deployment to depend on linting and testing.
58
- In personal and sandbox builds, linting and testing should run in parallel so the build still deploys even if the workflow fails.
64
+ | Environment | Lint/Test Dependency |
65
+ |-------------|----------------------|
66
+ | production | Required to pass before deploy |
67
+ | development | Required to pass before deploy |
68
+ | sandbox | Runs in parallel with deploy |
69
+ | personal | Runs in parallel with deploy |
59
70
 
60
- #### Linting and Testing
71
+ ### Linting and Testing
61
72
 
62
- Use npm run lint and npm run test.
63
- Check npm test script uses `vitest run` or otherwise confirm it does not watch.
64
- Propose changes to the test script if it does watch but allow a different test script or even `vitest run` to be used.
73
+ Use `npm run lint` and `npm run test`. Verify the test script uses `vitest run` or otherwise does not watch. If the script watches, propose changing it or use `vitest run` directly.
65
74
 
66
- ### Parallelization
75
+ ## Concurrency
67
76
 
68
- Static builds such as development, production, and sandbox should run in parallel between environment but concurrently within an environment.
69
- Personal builds should also run in parallel between each other but concurrently within an environment.
70
- New builds should cancel in-progress builds.
77
+ New builds cancel in-progress builds. Environments run in parallel between each other but concurrently within an environment.
71
78
 
72
- #### Static Builds
79
+ ### Static Builds
73
80
 
74
81
  ```yaml
75
82
  concurrency:
@@ -77,7 +84,7 @@ concurrency:
77
84
  cancel-in-progress: true
78
85
  ```
79
86
 
80
- #### Personal Builds
87
+ ### Personal Builds
81
88
 
82
89
  ```yaml
83
90
  concurrency:
@@ -87,65 +94,151 @@ concurrency:
87
94
 
88
95
  ## Personal Builds
89
96
 
90
- TODO
91
- _Alert the user if you believe the contents of this section would have solved the problem; an update may be available._
97
+ Personal builds allow developers to create isolated deployments connected to shared resources. They use the sandbox environment but with a unique `PROJECT_ENV` value.
98
+
99
+ ### Configuration
100
+
101
+ Set `PROJECT_ENV` to a unique value per developer:
102
+
103
+ ```yaml
104
+ - name: Setup Environment
105
+ uses: ./.github/actions/setup-environment
106
+ with:
107
+ project-env: ${{ github.actor }}
108
+ ```
109
+
110
+ ### Branch Naming
111
+
112
+ Personal builds trigger on branches not matching static environments:
113
+ - `feat/*` branches deploy personal builds
114
+ - `nobuild-*` and `nobuild/*` branches skip deployment
92
115
 
93
116
  ## GitHub Environments
94
117
 
95
- When GitHub environments are used, they should reflect the environments with a shared sandbox.
96
- Usually this is development, production, and sandbox.
118
+ Create GitHub environments matching deployment targets:
119
+ - `development`
120
+ - `production`
121
+ - `sandbox`
122
+
123
+ Each environment contains variables and secrets specific to that deployment target.
97
124
 
98
125
  ## Environment Variables Reference
99
126
 
100
127
  ### Application Variables
101
128
 
102
- Application variables may be prefixed with `APP_`.
103
- Build systems and frontend frameworks may require their own prefixes (e.g., `NUXT_`, `VITE_`).
129
+ Application variables may be prefixed with `APP_`. Build systems and frontend frameworks may require their own prefixes (e.g., `NUXT_`, `VITE_`).
104
130
 
105
131
  ### CDK Variables
106
132
 
107
- Environment-specific variables intended for or originating from CDK should be prefixed with `CDK_ENV_`.
108
- Usually these are (a) values declared as environment variables in a workflow file picked up by the stack or (b) values declared in the stack passed to the runtime as environment variables.
109
- Workflow examples: CDK_ENV_API_HOSTED_ZONE, CDK_ENV_API_SUBDOMAIN, CDK_ENV_REPO, CDK_ENV_WEB_HOSTED_ZONE, CDK_ENV_WEB_SUBDOMAIN.
110
- Stack examples: CDK_ENV_BUCKET, CDK_ENV_QUEUE_URL, CDK_ENV_SNS_ROLE_ARN, CDK_ENV_SNS_TOPIC_ARN.
133
+ Environment-specific variables for CDK use the `CDK_ENV_` prefix.
134
+
135
+ | Variable | Source | Example |
136
+ |----------|--------|---------|
137
+ | `CDK_ENV_API_HOSTED_ZONE` | Workflow | Route53 hosted zone for API |
138
+ | `CDK_ENV_API_SUBDOMAIN` | Workflow | API subdomain |
139
+ | `CDK_ENV_REPO` | Workflow | GitHub repository |
140
+ | `CDK_ENV_WEB_HOSTED_ZONE` | Workflow | Route53 hosted zone for web |
141
+ | `CDK_ENV_WEB_SUBDOMAIN` | Workflow | Web subdomain |
142
+ | `CDK_ENV_BUCKET` | Stack | S3 bucket name |
143
+ | `CDK_ENV_QUEUE_URL` | Stack | SQS queue URL |
144
+ | `CDK_ENV_SNS_ROLE_ARN` | Stack | SNS role ARN |
145
+ | `CDK_ENV_SNS_TOPIC_ARN` | Stack | SNS topic ARN |
111
146
 
112
147
  ### Jaypie Variables
113
148
 
114
- Variables intended for Jaypie as well as the application should be prefixed with `PROJECT_`.
115
- PROJECT_ENV, usually development, production, or sandbox; personal builds should be a special value, the GitHub actor all lowercase, or "build".
116
- PROJECT_KEY, shortname or slug of the project.
117
- PROJECT_NONCE, an eight-character random string to force rebuilds.
118
- PROJECT_SERVICE, service the application is part of, often the same as the application.
119
- PROJECT_SPONSOR, sponsor of the project, usually the GitHub organization or account.
149
+ Variables for Jaypie and the application use the `PROJECT_` prefix.
150
+
151
+ | Variable | Description | Example Values |
152
+ |----------|-------------|----------------|
153
+ | `PROJECT_ENV` | Environment identifier | `development`, `production`, `sandbox`, or GitHub actor |
154
+ | `PROJECT_KEY` | Project shortname/slug | `myapp` |
155
+ | `PROJECT_NONCE` | Eight-character random string | `860b5a0f` |
156
+ | `PROJECT_SERVICE` | Service name | `myapp` |
157
+ | `PROJECT_SPONSOR` | Project sponsor/organization | `finlaysonstudio` |
120
158
 
121
- #### Log Levels
159
+ ### Log Levels
122
160
 
123
- LOG_LEVEL defaults to debug.
124
- MODULE_LOG_LEVEL defaults to warn.
161
+ | Variable | Default |
162
+ |----------|---------|
163
+ | `LOG_LEVEL` | `debug` |
164
+ | `MODULE_LOG_LEVEL` | `warn` |
125
165
 
126
166
  ### Vendor Variables
127
167
 
128
- Vendor variables should follow the naming found in the vendor's documentation.
129
- If vendor documentation does not reference environment variables, use the vendor name (e.g., E2B_TEAM_ID, POSTMAN_ENVIRONMENT_UUID).
168
+ Follow naming from vendor documentation. If documentation does not reference environment variables, use the vendor name prefix (e.g., `E2B_TEAM_ID`, `POSTMAN_ENVIRONMENT_UUID`).
130
169
 
131
170
  ## Secrets
132
171
 
133
- TODO
134
- _Alert the user if you believe the contents of this section would have solved the problem; an update may be available._
172
+ ### Secret Naming
173
+
174
+ Secrets follow the same conventions as variables. Use `SECRET_` prefix for secrets that will be resolved at runtime:
175
+ - `SECRET_MONGODB_URI` - Secret name in AWS Secrets Manager
176
+ - `MONGODB_URI` - Direct value (for local development)
177
+
178
+ ### Passing Secrets
179
+
180
+ Pass secrets only to steps that need them:
181
+
182
+ ```yaml
183
+ - name: Deploy CDK Stack
184
+ uses: ./.github/actions/cdk-deploy
185
+ with:
186
+ stack-name: AppStack
187
+ env:
188
+ SECRET_API_KEY: ${{ secrets.API_KEY }}
189
+ ```
190
+
191
+ Never expose secrets in logs or workflow outputs.
192
+
193
+ ## CDK Stack Names
194
+
195
+ The `stack-name` parameter in deploy workflows must match the stack ID defined in `packages/cdk/bin/cdk.ts`:
196
+
197
+ ```typescript
198
+ // bin/cdk.ts
199
+ new AppStack(app, "AppStack"); // "AppStack" is the stack ID
200
+ ```
201
+
202
+ ```yaml
203
+ # deploy-*.yml
204
+ - name: Deploy CDK Stack
205
+ uses: ./.github/actions/cdk-deploy
206
+ with:
207
+ stack-name: AppStack # Must match the stack ID above
208
+ ```
209
+
210
+ If you rename the stack ID (e.g., to "MyProjectAppStack" for clarity in AWS), update all deploy workflows to match. Mismatched names cause "No stacks match the name(s)" errors.
135
211
 
136
212
  ## Integrations
137
213
 
138
214
  ### AWS
139
215
 
140
- TODO
141
- _Alert the user if you believe the contents of this section would have solved the problem; an update may be available._
216
+ Use OIDC authentication with `aws-actions/configure-aws-credentials@v4`:
217
+
218
+ ```yaml
219
+ permissions:
220
+ id-token: write
221
+ contents: read
222
+
223
+ steps:
224
+ - name: Configure AWS Credentials
225
+ uses: aws-actions/configure-aws-credentials@v4
226
+ with:
227
+ role-to-assume: ${{ vars.AWS_ROLE_ARN }}
228
+ role-session-name: DeployRoleForGitHubSession
229
+ aws-region: us-east-1
230
+ ```
231
+
232
+ Create an IAM role with trust policy for GitHub OIDC provider. Scope the trust policy to your repository.
142
233
 
143
234
  ### Datadog
144
235
 
145
- TODO
146
- _Alert the user if you believe the contents of this section would have solved the problem; an update may be available._
236
+ Integrate Datadog for observability by storing the API key in AWS Secrets Manager:
237
+
238
+ ```yaml
239
+ env:
240
+ CDK_ENV_DATADOG_API_KEY_ARN: ${{ vars.DATADOG_API_KEY_ARN }}
241
+ ```
147
242
 
148
- ### Postman
243
+ The CDK stack retrieves the key at deploy time and configures Lambda instrumentation.
149
244
 
150
- TODO
151
- _Alert the user if you believe the contents of this section would have solved the problem; an update may be available._