@jaypie/mcp 0.3.2 → 0.4.0
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/createMcpServer.d.ts +7 -1
- package/dist/index.js +26 -3135
- package/dist/index.js.map +1 -1
- package/dist/suite.d.ts +1 -0
- package/dist/suite.js +2442 -0
- package/dist/suite.js.map +1 -0
- package/package.json +8 -3
- package/release-notes/constructs/1.2.17.md +11 -0
- package/release-notes/fabric/0.1.2.md +11 -0
- package/release-notes/fabric/0.1.3.md +25 -0
- package/release-notes/fabric/0.1.4.md +42 -0
- package/release-notes/mcp/0.3.3.md +12 -0
- package/release-notes/mcp/0.3.4.md +36 -0
- package/release-notes/mcp/0.4.0.md +27 -0
- package/release-notes/testkit/1.2.15.md +23 -0
- package/skills/agents.md +25 -0
- package/skills/aws.md +107 -0
- package/skills/cdk.md +141 -0
- package/skills/cicd.md +152 -0
- package/skills/datadog.md +129 -0
- package/skills/debugging.md +148 -0
- package/skills/dns.md +134 -0
- package/skills/dynamodb.md +140 -0
- package/skills/errors.md +142 -0
- package/skills/fabric.md +191 -0
- package/skills/index.md +7 -0
- package/skills/jaypie.md +100 -0
- package/skills/legacy.md +97 -0
- package/skills/logs.md +160 -0
- package/skills/mocks.md +174 -0
- package/skills/models.md +195 -0
- package/skills/releasenotes.md +94 -0
- package/skills/secrets.md +155 -0
- package/skills/services.md +175 -0
- package/skills/style.md +190 -0
- package/skills/tests.md +209 -0
- package/skills/tools.md +127 -0
- package/skills/topics.md +116 -0
- package/skills/variables.md +146 -0
- package/skills/writing.md +153 -0
- package/prompts/Branch_Management.md +0 -34
- package/prompts/Development_Process.md +0 -89
- package/prompts/Jaypie_Agent_Rules.md +0 -110
- package/prompts/Jaypie_Auth0_Express_Mongoose.md +0 -736
- package/prompts/Jaypie_Browser_and_Frontend_Web_Packages.md +0 -18
- package/prompts/Jaypie_CDK_Constructs_and_Patterns.md +0 -430
- package/prompts/Jaypie_CICD_with_GitHub_Actions.md +0 -371
- package/prompts/Jaypie_Commander_CLI_Package.md +0 -166
- package/prompts/Jaypie_Core_Errors_and_Logging.md +0 -39
- package/prompts/Jaypie_DynamoDB_Package.md +0 -774
- package/prompts/Jaypie_Eslint_NPM_Package.md +0 -78
- package/prompts/Jaypie_Express_Package.md +0 -630
- package/prompts/Jaypie_Fabric_Commander.md +0 -411
- package/prompts/Jaypie_Fabric_LLM.md +0 -312
- package/prompts/Jaypie_Fabric_Lambda.md +0 -308
- package/prompts/Jaypie_Fabric_MCP.md +0 -316
- package/prompts/Jaypie_Fabric_Package.md +0 -513
- package/prompts/Jaypie_Fabricator.md +0 -617
- package/prompts/Jaypie_Ideal_Project_Structure.md +0 -78
- package/prompts/Jaypie_Init_CICD_with_GitHub_Actions.md +0 -1186
- package/prompts/Jaypie_Init_Express_on_Lambda.md +0 -115
- package/prompts/Jaypie_Init_Jaypie_CDK_Package.md +0 -35
- package/prompts/Jaypie_Init_Lambda_Package.md +0 -505
- package/prompts/Jaypie_Init_Monorepo_Project.md +0 -44
- package/prompts/Jaypie_Init_Project_Subpackage.md +0 -65
- package/prompts/Jaypie_Legacy_Patterns.md +0 -15
- package/prompts/Jaypie_Llm_Calls.md +0 -449
- package/prompts/Jaypie_Llm_Tools.md +0 -155
- package/prompts/Jaypie_MCP_Package.md +0 -281
- package/prompts/Jaypie_Mocks_and_Testkit.md +0 -137
- package/prompts/Jaypie_Repokit.md +0 -103
- package/prompts/Jaypie_Scrub.md +0 -177
- package/prompts/Jaypie_Streaming.md +0 -467
- package/prompts/Templates_CDK_Subpackage.md +0 -115
- package/prompts/Templates_Express_Subpackage.md +0 -187
- package/prompts/Templates_Project_Monorepo.md +0 -326
- package/prompts/Templates_Project_Subpackage.md +0 -93
- package/prompts/Write_Efficient_Prompt_Guides.md +0 -48
- package/prompts/Write_and_Maintain_Engaging_Readme.md +0 -67
|
@@ -1,371 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: conventions around deployment and environment variables, especially CDK_ENV_ and PROJECT_
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Jaypie CI/CD with GitHub Actions
|
|
6
|
-
|
|
7
|
-
Reference for Jaypie CI/CD conventions. For setup instructions, see `Jaypie_Init_CICD_with_GitHub_Actions.md`.
|
|
8
|
-
|
|
9
|
-
## Workspace Naming Conventions
|
|
10
|
-
|
|
11
|
-
| Directory | Purpose |
|
|
12
|
-
|-----------|---------|
|
|
13
|
-
| `packages/` | Default workspace for npm packages (preferred when only one namespace needed) |
|
|
14
|
-
| `stacks/` | CDK-deployed infrastructure and sites (as opposed to npm-published) |
|
|
15
|
-
| `workspaces/` | Generic workspace for other work |
|
|
16
|
-
|
|
17
|
-
## Jaypie Environments
|
|
18
|
-
|
|
19
|
-
Jaypie assumes multiple deployed environments:
|
|
20
|
-
|
|
21
|
-
| Environment | Purpose |
|
|
22
|
-
|-------------|---------|
|
|
23
|
-
| production | Live environment, standalone |
|
|
24
|
-
| development | Validates multi-environment deployment works |
|
|
25
|
-
| sandbox | Shared testing environment |
|
|
26
|
-
| personal | Developer-specific builds tied to GitHub actor |
|
|
27
|
-
|
|
28
|
-
## Naming Conventions
|
|
29
|
-
|
|
30
|
-
### Workflow File Naming
|
|
31
|
-
|
|
32
|
-
| Pattern | Purpose | Example |
|
|
33
|
-
|---------|---------|---------|
|
|
34
|
-
| `deploy-env-$ENV.yml` | Deploy all stacks to an environment | `deploy-env-sandbox.yml` |
|
|
35
|
-
| `deploy-$ENV.yml` | Legacy alias for environment deploy | `deploy-sandbox.yml` |
|
|
36
|
-
| `deploy-stack-$STACK.yml` | Deploy specific stack content | `deploy-stack-documentation.yml` |
|
|
37
|
-
|
|
38
|
-
### Tag Naming
|
|
39
|
-
|
|
40
|
-
| Pattern | Purpose | Example |
|
|
41
|
-
|---------|---------|---------|
|
|
42
|
-
| `v*` | Production version release | `v1.2.3` |
|
|
43
|
-
| `$ENV-*` | Deploy to specific environment | `sandbox-hotfix` |
|
|
44
|
-
| `stack-$STACK-*` | Deploy specific stack | `stack-documentation-v1.0.0` |
|
|
45
|
-
|
|
46
|
-
Always prefer full words for maximum clarity.
|
|
47
|
-
|
|
48
|
-
## File Structure
|
|
49
|
-
|
|
50
|
-
Workflow files follow this order:
|
|
51
|
-
|
|
52
|
-
```yaml
|
|
53
|
-
name:
|
|
54
|
-
on:
|
|
55
|
-
concurrency:
|
|
56
|
-
env: # alphabetical
|
|
57
|
-
jobs: # alphabetical
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Style Rules
|
|
61
|
-
|
|
62
|
-
1. Do not use secrets in the `env` section
|
|
63
|
-
2. Only pass secrets as environment variables to tasks that require them
|
|
64
|
-
3. Declare programmatic variables in `env` with empty string and comment:
|
|
65
|
-
```yaml
|
|
66
|
-
env:
|
|
67
|
-
PROJECT_VERSION: "" # Set from package.json during build
|
|
68
|
-
```
|
|
69
|
-
4. Static variables should be set in `env`, not in job steps
|
|
70
|
-
|
|
71
|
-
## Triggers
|
|
72
|
-
|
|
73
|
-
| Environment | Trigger |
|
|
74
|
-
|-------------|---------|
|
|
75
|
-
| production | tags: `v*`, `production-*` |
|
|
76
|
-
| development | branches: `[main, development/*]`, tags: `development-*` |
|
|
77
|
-
| sandbox | branches: `[feat/*, sandbox/*]`, tags: `sandbox-*` |
|
|
78
|
-
| personal | branches-ignore: `[main, develop, nobuild-*, nobuild/*, sandbox, sandbox-*, sandbox/*]` |
|
|
79
|
-
|
|
80
|
-
### Stack Triggers
|
|
81
|
-
|
|
82
|
-
| Stack | Trigger |
|
|
83
|
-
|-------|---------|
|
|
84
|
-
| documentation | Push to `main` with path filter, tags: `stack-documentation-*` |
|
|
85
|
-
|
|
86
|
-
### Dependencies
|
|
87
|
-
|
|
88
|
-
| Environment | Lint/Test Dependency |
|
|
89
|
-
|-------------|----------------------|
|
|
90
|
-
| production | Required to pass before deploy |
|
|
91
|
-
| development | Required to pass before deploy |
|
|
92
|
-
| sandbox | Runs in parallel with deploy |
|
|
93
|
-
| personal | Runs in parallel with deploy |
|
|
94
|
-
|
|
95
|
-
### Linting and Testing
|
|
96
|
-
|
|
97
|
-
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.
|
|
98
|
-
|
|
99
|
-
## Concurrency
|
|
100
|
-
|
|
101
|
-
Use concurrency groups without `cancel-in-progress` to avoid stuck deployments. Environments run in parallel between each other but concurrently within an environment.
|
|
102
|
-
|
|
103
|
-
### Environment Builds
|
|
104
|
-
|
|
105
|
-
```yaml
|
|
106
|
-
concurrency:
|
|
107
|
-
group: deploy-env-production
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Stack Builds
|
|
111
|
-
|
|
112
|
-
```yaml
|
|
113
|
-
concurrency:
|
|
114
|
-
group: deploy-stack-documentation-${{ github.event.inputs.environment || 'development' }}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### Personal Builds
|
|
118
|
-
|
|
119
|
-
```yaml
|
|
120
|
-
concurrency:
|
|
121
|
-
group: deploy-personal-build-${{ github.actor }}
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
## Personal Builds
|
|
125
|
-
|
|
126
|
-
Personal builds allow developers to create isolated deployments connected to shared resources. They use the sandbox environment but with a unique `PROJECT_ENV` value.
|
|
127
|
-
|
|
128
|
-
### Configuration
|
|
129
|
-
|
|
130
|
-
Set `PROJECT_ENV` to a unique value per developer:
|
|
131
|
-
|
|
132
|
-
```yaml
|
|
133
|
-
- name: Setup Environment
|
|
134
|
-
uses: ./.github/actions/setup-environment
|
|
135
|
-
with:
|
|
136
|
-
project-env: ${{ github.actor }}
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### Branch Naming
|
|
140
|
-
|
|
141
|
-
Personal builds trigger on branches not matching static environments:
|
|
142
|
-
- `feat/*` branches deploy personal builds
|
|
143
|
-
- `nobuild-*` and `nobuild/*` branches skip deployment
|
|
144
|
-
|
|
145
|
-
## GitHub Environments
|
|
146
|
-
|
|
147
|
-
Create GitHub environments matching deployment targets:
|
|
148
|
-
- `development`
|
|
149
|
-
- `production`
|
|
150
|
-
- `sandbox`
|
|
151
|
-
|
|
152
|
-
Each environment contains variables and secrets specific to that deployment target.
|
|
153
|
-
|
|
154
|
-
## GitHub Variable Scoping
|
|
155
|
-
|
|
156
|
-
Variables are configured at different levels in GitHub Settings:
|
|
157
|
-
|
|
158
|
-
### Organization Level
|
|
159
|
-
|
|
160
|
-
| Variable | Description | Default |
|
|
161
|
-
|----------|-------------|---------|
|
|
162
|
-
| `AWS_REGION` | AWS region | `us-east-1` |
|
|
163
|
-
| `LOG_LEVEL` | Application log level | `debug` |
|
|
164
|
-
| `MODULE_LOG_LEVEL` | Module log level | `warn` |
|
|
165
|
-
| `PROJECT_SPONSOR` | Organization name | `finlaysonstudio` |
|
|
166
|
-
|
|
167
|
-
### Repository Level
|
|
168
|
-
|
|
169
|
-
| Variable | Description | Default |
|
|
170
|
-
|----------|-------------|---------|
|
|
171
|
-
| `AWS_HOSTED_ZONE` | Route53 hosted zone | `example.com` |
|
|
172
|
-
| `PROJECT_KEY` | Project identifier | `myapp` |
|
|
173
|
-
| `PROJECT_SERVICE` | Service name | `stacks` |
|
|
174
|
-
|
|
175
|
-
### Environment Level
|
|
176
|
-
|
|
177
|
-
| Variable | Description | Required |
|
|
178
|
-
|----------|-------------|----------|
|
|
179
|
-
| `AWS_ROLE_ARN` | IAM role ARN for OIDC | Yes |
|
|
180
|
-
| `DATADOG_API_KEY_ARN` | Datadog API key ARN in Secrets Manager | No |
|
|
181
|
-
| `PROJECT_ENV` | Environment identifier | Yes |
|
|
182
|
-
| `PROJECT_NONCE` | Unique resource identifier | No |
|
|
183
|
-
|
|
184
|
-
### Auto-Generated Variables
|
|
185
|
-
|
|
186
|
-
These variables are set automatically from GitHub context:
|
|
187
|
-
|
|
188
|
-
| Variable | Source | Description |
|
|
189
|
-
|----------|--------|-------------|
|
|
190
|
-
| `CDK_DEFAULT_ACCOUNT` | `${{ github.repository_owner }}` | Repository owner |
|
|
191
|
-
| `CDK_DEFAULT_REGION` | `AWS_REGION` | Same as AWS region |
|
|
192
|
-
| `CDK_ENV_REPO` | `${{ github.repository }}` | Repository name (owner/repo) |
|
|
193
|
-
| `PROJECT_COMMIT` | `${{ github.sha }}` | Current commit SHA |
|
|
194
|
-
| `PROJECT_VERSION` | `package.json` | Version from package.json |
|
|
195
|
-
|
|
196
|
-
## Environment Variables Reference
|
|
197
|
-
|
|
198
|
-
### Application Variables
|
|
199
|
-
|
|
200
|
-
Application variables may be prefixed with `APP_`. Build systems and frontend frameworks may require their own prefixes (e.g., `NUXT_`, `VITE_`).
|
|
201
|
-
|
|
202
|
-
### CDK Variables
|
|
203
|
-
|
|
204
|
-
Environment-specific variables for CDK use the `CDK_ENV_` prefix.
|
|
205
|
-
|
|
206
|
-
| Variable | Source | Example |
|
|
207
|
-
|----------|--------|---------|
|
|
208
|
-
| `CDK_ENV_API_HOSTED_ZONE` | Workflow | Route53 hosted zone for API |
|
|
209
|
-
| `CDK_ENV_API_SUBDOMAIN` | Workflow | API subdomain |
|
|
210
|
-
| `CDK_ENV_REPO` | Workflow | GitHub repository |
|
|
211
|
-
| `CDK_ENV_WEB_HOSTED_ZONE` | Workflow | Route53 hosted zone for web |
|
|
212
|
-
| `CDK_ENV_WEB_SUBDOMAIN` | Workflow | Web subdomain |
|
|
213
|
-
| `CDK_ENV_BUCKET` | Stack | S3 bucket name |
|
|
214
|
-
| `CDK_ENV_QUEUE_URL` | Stack | SQS queue URL |
|
|
215
|
-
| `CDK_ENV_SNS_ROLE_ARN` | Stack | SNS role ARN |
|
|
216
|
-
| `CDK_ENV_SNS_TOPIC_ARN` | Stack | SNS topic ARN |
|
|
217
|
-
|
|
218
|
-
### Jaypie Variables
|
|
219
|
-
|
|
220
|
-
Variables for Jaypie and the application use the `PROJECT_` prefix.
|
|
221
|
-
|
|
222
|
-
| Variable | Description | Example Values |
|
|
223
|
-
|----------|-------------|----------------|
|
|
224
|
-
| `PROJECT_ENV` | Environment identifier | `development`, `production`, `sandbox`, or GitHub actor |
|
|
225
|
-
| `PROJECT_KEY` | Project shortname/slug | `myapp` |
|
|
226
|
-
| `PROJECT_NONCE` | Eight-character random string | `860b5a0f` |
|
|
227
|
-
| `PROJECT_SERVICE` | Service name | `myapp` |
|
|
228
|
-
| `PROJECT_SPONSOR` | Project sponsor/organization | `finlaysonstudio` |
|
|
229
|
-
|
|
230
|
-
### Log Levels
|
|
231
|
-
|
|
232
|
-
| Variable | Default |
|
|
233
|
-
|----------|---------|
|
|
234
|
-
| `LOG_LEVEL` | `debug` |
|
|
235
|
-
| `MODULE_LOG_LEVEL` | `warn` |
|
|
236
|
-
|
|
237
|
-
### Vendor Variables
|
|
238
|
-
|
|
239
|
-
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`).
|
|
240
|
-
|
|
241
|
-
## Secrets
|
|
242
|
-
|
|
243
|
-
By default, no secrets are required. Dependencies add secrets as needed.
|
|
244
|
-
|
|
245
|
-
### Secret Naming
|
|
246
|
-
|
|
247
|
-
Secrets follow the same conventions as variables. Use `SECRET_` prefix for secrets that will be resolved at runtime:
|
|
248
|
-
- `SECRET_MONGODB_URI` - Secret name in AWS Secrets Manager
|
|
249
|
-
- `MONGODB_URI` - Direct value (for local development)
|
|
250
|
-
|
|
251
|
-
### Passing Secrets
|
|
252
|
-
|
|
253
|
-
Secrets are passed to CDK via `JaypieEnvSecret` construct and made available at runtime.
|
|
254
|
-
|
|
255
|
-
Pass secrets only to steps that need them:
|
|
256
|
-
|
|
257
|
-
```yaml
|
|
258
|
-
- name: Deploy CDK Stack
|
|
259
|
-
uses: ./.github/actions/cdk-deploy
|
|
260
|
-
with:
|
|
261
|
-
stack-name: AppStack
|
|
262
|
-
env:
|
|
263
|
-
SECRET_API_KEY: ${{ secrets.API_KEY }}
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
Never expose secrets in logs or workflow outputs.
|
|
267
|
-
|
|
268
|
-
### Adding Dependency Secrets
|
|
269
|
-
|
|
270
|
-
When adding dependencies that require secrets, update the workflow accordingly.
|
|
271
|
-
|
|
272
|
-
#### Example: Auth0 Integration
|
|
273
|
-
|
|
274
|
-
**Environment Variables:**
|
|
275
|
-
- `AUTH0_AUDIENCE` - API identifier
|
|
276
|
-
- `AUTH0_CLIENT_ID` - Application client ID
|
|
277
|
-
- `AUTH0_DOMAIN` - Auth0 tenant domain
|
|
278
|
-
|
|
279
|
-
**Environment Secrets:**
|
|
280
|
-
- `AUTH0_CLIENT_SECRET` - Application client secret
|
|
281
|
-
|
|
282
|
-
Add to workflow:
|
|
283
|
-
```yaml
|
|
284
|
-
- name: Deploy CDK Stack
|
|
285
|
-
uses: ./.github/actions/cdk-deploy
|
|
286
|
-
with:
|
|
287
|
-
stack-name: AppStack
|
|
288
|
-
env:
|
|
289
|
-
AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }}
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
## CDK Stack Names
|
|
293
|
-
|
|
294
|
-
The `stack-name` parameter in deploy workflows must match the stack ID defined in `packages/cdk/bin/cdk.ts`:
|
|
295
|
-
|
|
296
|
-
```typescript
|
|
297
|
-
// bin/cdk.ts
|
|
298
|
-
new AppStack(app, "AppStack"); // "AppStack" is the stack ID
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
```yaml
|
|
302
|
-
# deploy-env-*.yml
|
|
303
|
-
- name: Deploy CDK Stack
|
|
304
|
-
uses: ./.github/actions/cdk-deploy
|
|
305
|
-
with:
|
|
306
|
-
stack-name: AppStack # Must match the stack ID above
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
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.
|
|
310
|
-
|
|
311
|
-
## Environment-Aware Hostnames
|
|
312
|
-
|
|
313
|
-
Jaypie CDK constructs use `envHostname()` from `@jaypie/constructs` to determine deployment hostnames based on `PROJECT_ENV`:
|
|
314
|
-
|
|
315
|
-
| `PROJECT_ENV` | Example Hostname |
|
|
316
|
-
|---------------|------------------|
|
|
317
|
-
| `production` | `example.com` (apex domain) |
|
|
318
|
-
| `sandbox` | `sandbox.example.com` |
|
|
319
|
-
| `development` | `development.example.com` |
|
|
320
|
-
| `personal` | `personal.example.com` |
|
|
321
|
-
|
|
322
|
-
**CRITICAL**: If `PROJECT_ENV` is not set or is set incorrectly in the GitHub environment, deployments may target the wrong hostname (e.g., deploying sandbox changes to production apex).
|
|
323
|
-
|
|
324
|
-
### How It Works
|
|
325
|
-
|
|
326
|
-
1. The `setup-environment` action reads `${{ vars.PROJECT_ENV }}` from the GitHub environment
|
|
327
|
-
2. This is exported as `PROJECT_ENV` to `$GITHUB_ENV`
|
|
328
|
-
3. CDK constructs read `process.env.PROJECT_ENV` via `envHostname()`
|
|
329
|
-
4. For production, the environment prefix is omitted (apex domain)
|
|
330
|
-
5. For all other environments, the prefix is prepended
|
|
331
|
-
|
|
332
|
-
### Troubleshooting Wrong Hostname
|
|
333
|
-
|
|
334
|
-
If deployment targets the wrong hostname:
|
|
335
|
-
1. Go to GitHub Settings → Environments
|
|
336
|
-
2. Select the environment (sandbox, development, production)
|
|
337
|
-
3. Verify `PROJECT_ENV` variable matches the environment name exactly
|
|
338
|
-
|
|
339
|
-
## Integrations
|
|
340
|
-
|
|
341
|
-
### AWS
|
|
342
|
-
|
|
343
|
-
Use OIDC authentication with `aws-actions/configure-aws-credentials@v4`:
|
|
344
|
-
|
|
345
|
-
```yaml
|
|
346
|
-
permissions:
|
|
347
|
-
id-token: write
|
|
348
|
-
contents: read
|
|
349
|
-
|
|
350
|
-
steps:
|
|
351
|
-
- name: Configure AWS Credentials
|
|
352
|
-
uses: aws-actions/configure-aws-credentials@v4
|
|
353
|
-
with:
|
|
354
|
-
role-to-assume: ${{ vars.AWS_ROLE_ARN }}
|
|
355
|
-
role-session-name: DeployRoleForGitHubSession
|
|
356
|
-
aws-region: us-east-1
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
Create an IAM role with trust policy for GitHub OIDC provider. Scope the trust policy to your repository.
|
|
360
|
-
|
|
361
|
-
### Datadog
|
|
362
|
-
|
|
363
|
-
Integrate Datadog for observability by storing the API key in AWS Secrets Manager:
|
|
364
|
-
|
|
365
|
-
```yaml
|
|
366
|
-
env:
|
|
367
|
-
CDK_ENV_DATADOG_API_KEY_ARN: ${{ vars.DATADOG_API_KEY_ARN }}
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
The CDK stack retrieves the key at deploy time and configures Lambda instrumentation.
|
|
371
|
-
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: setup for commander-based CLI packages
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Jaypie Commander CLI Package
|
|
6
|
-
|
|
7
|
-
Create a CLI subpackage with commander.js for command-line applications
|
|
8
|
-
|
|
9
|
-
## Goal
|
|
10
|
-
|
|
11
|
-
* TypeScript CLI application with command-line interface
|
|
12
|
-
* Commander.js integration for argument parsing
|
|
13
|
-
* Standard Jaypie project structure and npm workspace integration
|
|
14
|
-
* Version support and hello command implementation
|
|
15
|
-
|
|
16
|
-
## Guidelines
|
|
17
|
-
|
|
18
|
-
* Follow Jaypie_Init_Project_Subpackage conventions for monorepo setup
|
|
19
|
-
* Package name follows "@parent-namespace/cli" or "parent-repo-cli" based on top-level package.json naming
|
|
20
|
-
* Use commander.js for CLI functionality
|
|
21
|
-
* Include executable script configuration
|
|
22
|
-
* Default package name: `packages/cli`
|
|
23
|
-
* Default script name: `run`
|
|
24
|
-
|
|
25
|
-
## Process
|
|
26
|
-
|
|
27
|
-
1. Follow Jaypie_Init_Project_Subpackage to create basic subpackage structure
|
|
28
|
-
|
|
29
|
-
2. Install commander.js and dotenv:
|
|
30
|
-
```bash
|
|
31
|
-
npm --workspace ./packages/cli install commander dotenv
|
|
32
|
-
npm --workspace ./packages/cli install --save-dev @types/node
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
3. Create CLI entry point `src/index.ts`:
|
|
36
|
-
```typescript
|
|
37
|
-
import dotenv from 'dotenv';
|
|
38
|
-
import { Command } from 'commander';
|
|
39
|
-
import { version } from '../package.json';
|
|
40
|
-
import { registerCommands } from './commands/index.js';
|
|
41
|
-
|
|
42
|
-
dotenv.config();
|
|
43
|
-
|
|
44
|
-
const program = new Command();
|
|
45
|
-
|
|
46
|
-
program
|
|
47
|
-
.version(version)
|
|
48
|
-
.description('CLI application');
|
|
49
|
-
|
|
50
|
-
registerCommands(program);
|
|
51
|
-
|
|
52
|
-
program.parse();
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
4. Create command registrar `src/commands/index.ts`:
|
|
56
|
-
```typescript
|
|
57
|
-
import { Command } from "commander";
|
|
58
|
-
import { helloCommand } from "./hello.js";
|
|
59
|
-
|
|
60
|
-
export function registerCommands(program: Command): Command {
|
|
61
|
-
helloCommand(program);
|
|
62
|
-
|
|
63
|
-
return program;
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
5. Create example command `src/commands/hello.ts`:
|
|
68
|
-
```typescript
|
|
69
|
-
import { Command } from "commander";
|
|
70
|
-
|
|
71
|
-
export function helloCommand(program: Command): Command {
|
|
72
|
-
program
|
|
73
|
-
.command("hello")
|
|
74
|
-
.description("Say hello to the specified name")
|
|
75
|
-
.argument('[name]', 'name to greet', 'World')
|
|
76
|
-
.argument('[salutation]', 'greeting word', 'Hello')
|
|
77
|
-
.action((name: string, salutation: string) => {
|
|
78
|
-
console.log(`${salutation}, ${name}!`);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
return program;
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
6. Create test file `src/commands/hello.spec.ts`:
|
|
86
|
-
```typescript
|
|
87
|
-
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
88
|
-
import { Command } from 'commander';
|
|
89
|
-
import { helloCommand } from './hello.js';
|
|
90
|
-
|
|
91
|
-
describe('helloCommand', () => {
|
|
92
|
-
let consoleSpy: any;
|
|
93
|
-
|
|
94
|
-
beforeEach(() => {
|
|
95
|
-
consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
afterEach(() => {
|
|
99
|
-
consoleSpy.mockRestore();
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('should register hello command', () => {
|
|
103
|
-
const program = new Command();
|
|
104
|
-
helloCommand(program);
|
|
105
|
-
|
|
106
|
-
const command = program.commands.find(cmd => cmd.name() === 'hello');
|
|
107
|
-
expect(command).toBeDefined();
|
|
108
|
-
expect(command?.description()).toBe('Say hello to the specified name');
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('should use default values with no arguments', () => {
|
|
112
|
-
const program = new Command();
|
|
113
|
-
helloCommand(program);
|
|
114
|
-
|
|
115
|
-
program.parse(['node', 'test', 'hello']);
|
|
116
|
-
|
|
117
|
-
expect(consoleSpy).toHaveBeenCalledWith('Hello, World!');
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it('should use custom name with one argument', () => {
|
|
121
|
-
const program = new Command();
|
|
122
|
-
helloCommand(program);
|
|
123
|
-
|
|
124
|
-
program.parse(['node', 'test', 'hello', 'Alice']);
|
|
125
|
-
|
|
126
|
-
expect(consoleSpy).toHaveBeenCalledWith('Hello, Alice!');
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('should use custom name and salutation with two arguments', () => {
|
|
130
|
-
const program = new Command();
|
|
131
|
-
helloCommand(program);
|
|
132
|
-
|
|
133
|
-
program.parse(['node', 'test', 'hello', 'Bob', 'Hi']);
|
|
134
|
-
|
|
135
|
-
expect(consoleSpy).toHaveBeenCalledWith('Hi, Bob!');
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
7. Create executable script `bin/run`:
|
|
141
|
-
```bash
|
|
142
|
-
#!/usr/bin/env node
|
|
143
|
-
require('../dist/index.js');
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
8. Update package.json configuration:
|
|
147
|
-
* Add `"bin": { "run": "./bin/run" }`
|
|
148
|
-
* Add `"scripts": { "start": "node ./bin/run" }`
|
|
149
|
-
* Include `"resolveJsonModule": true` in tsconfig.json compilerOptions
|
|
150
|
-
|
|
151
|
-
9. Create bin directory and make script executable:
|
|
152
|
-
```bash
|
|
153
|
-
mkdir packages/cli/bin
|
|
154
|
-
chmod +x packages/cli/bin/run
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
10. Build and test:
|
|
158
|
-
```bash
|
|
159
|
-
npm run build --workspace packages/cli
|
|
160
|
-
npm start --workspace packages/cli -- hello "Mr. Bond" Goodbye
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
## Context
|
|
164
|
-
|
|
165
|
-
context/prompts/Jaypie_Init_Project_Subpackage.md
|
|
166
|
-
context/prompts/Jaypie_Project_Structure.md
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: error and logging philosophy
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Jaypie Core Errors and Logging
|
|
6
|
-
|
|
7
|
-
Execution of most Jaypie apps comes through an event "handler" function implementing jaypieHandler, most often expressHandler or lambdaHandler.
|
|
8
|
-
|
|
9
|
-
## Errors
|
|
10
|
-
|
|
11
|
-
Jaypie providers errors that will be handled properly when thrown (e.g., presenting the correct status code).
|
|
12
|
-
|
|
13
|
-
`import { BadGatewayError, BadRequestError, ConfigurationError, ForbiddenError, GatewayTimeoutError, GoneError, IllogicalError, InternalError, MethodNotAllowedError, NotFoundError, NotImplementedError, RejectedError, TeapotError, UnauthorizedError, UnavailableError, UnhandledError, UnreachableCodeError } from "jaypie";`
|
|
14
|
-
|
|
15
|
-
ConfigurationError is a special InternalError 500 that is can be thrown for incorrect types and other "developer" errors.
|
|
16
|
-
|
|
17
|
-
Though supported, rely on default error messages when throwing.
|
|
18
|
-
Custom error messages should be logged.
|
|
19
|
-
|
|
20
|
-
<Bad>
|
|
21
|
-
throw new NotFoundError("Item not found");
|
|
22
|
-
</Bad>
|
|
23
|
-
<Good>
|
|
24
|
-
log.error("Item not found");
|
|
25
|
-
throw new NotFoundError();
|
|
26
|
-
</Good>
|
|
27
|
-
|
|
28
|
-
Error messages may be returned to the user especially in express.
|
|
29
|
-
|
|
30
|
-
## Logging
|
|
31
|
-
|
|
32
|
-
`import { log } from "jaypie";`
|
|
33
|
-
|
|
34
|
-
`log` has methods `trace`, `debug`, `info`, `warn`, `error`, `fatal`, and `var`.
|
|
35
|
-
Only `trace` and `var` should be used in "happy paths".
|
|
36
|
-
`debug` should be used when execution deviates from the happy path.
|
|
37
|
-
`info` should rarely be used.
|
|
38
|
-
`var` expects a _single_ key-value pair like `log.var({ key: "value" });`.
|
|
39
|
-
Do _not_ pass multiple keys to `var`.
|