@jaypie/mcp 0.7.4 → 0.7.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.
@@ -0,0 +1,332 @@
1
+ ---
2
+ description: CDK deployment workflows for sandbox and production
3
+ related: cicd, cicd-actions, cicd-environments, cdk
4
+ ---
5
+
6
+ # CDK Deployment Workflows
7
+
8
+ Complete workflow templates for deploying CDK stacks to sandbox and production environments.
9
+
10
+ ## deploy-sandbox.yml
11
+
12
+ Deploys to sandbox on feature branches and main.
13
+
14
+ ```yaml
15
+ name: deploy-sandbox
16
+
17
+ on:
18
+ push:
19
+ branches:
20
+ - main
21
+ - 'feat/*'
22
+ - 'fix/*'
23
+ - 'sandbox/*'
24
+
25
+ concurrency:
26
+ group: deploy-sandbox-${{ github.ref_name }}
27
+ cancel-in-progress: true
28
+
29
+ jobs:
30
+ lint:
31
+ runs-on: ubuntu-latest
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - uses: ./.github/actions/setup-node-and-cache
35
+ - uses: ./.github/actions/npm-install-build
36
+ with:
37
+ skip-build: 'true'
38
+ - run: npm run lint
39
+
40
+ typecheck:
41
+ runs-on: ubuntu-latest
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ - uses: ./.github/actions/setup-node-and-cache
45
+ - uses: ./.github/actions/npm-install-build
46
+ with:
47
+ skip-build: 'true'
48
+ - run: npm run typecheck
49
+
50
+ test:
51
+ runs-on: ubuntu-latest
52
+ strategy:
53
+ matrix:
54
+ node-version: [22, 24, 25]
55
+ steps:
56
+ - uses: actions/checkout@v4
57
+ - uses: ./.github/actions/setup-node-and-cache
58
+ with:
59
+ node-version: ${{ matrix.node-version }}
60
+ - uses: ./.github/actions/npm-install-build
61
+ - run: npm test
62
+
63
+ deploy:
64
+ needs: [lint, typecheck, test]
65
+ runs-on: ubuntu-latest
66
+ environment: sandbox
67
+ permissions:
68
+ id-token: write
69
+ contents: read
70
+ steps:
71
+ - uses: actions/checkout@v4
72
+
73
+ - uses: ./.github/actions/setup-environment
74
+ with:
75
+ project-key: my-project
76
+ project-env: sandbox
77
+
78
+ - uses: ./.github/actions/configure-aws
79
+ with:
80
+ role-arn: ${{ vars.AWS_ROLE_ARN }}
81
+ region: ${{ vars.AWS_REGION || 'us-east-1' }}
82
+
83
+ - uses: ./.github/actions/setup-node-and-cache
84
+
85
+ - uses: ./.github/actions/npm-install-build
86
+
87
+ - uses: ./.github/actions/cdk-deploy
88
+ with:
89
+ stack-name: '*-sandbox-*'
90
+ ```
91
+
92
+ ## deploy-production.yml
93
+
94
+ Deploys to production on release tags.
95
+
96
+ ```yaml
97
+ name: deploy-production
98
+
99
+ on:
100
+ push:
101
+ tags:
102
+ - 'production-*'
103
+ - 'v0.*'
104
+ - 'v1.*'
105
+ - 'v2.*'
106
+
107
+ concurrency:
108
+ group: deploy-production
109
+ cancel-in-progress: false
110
+
111
+ jobs:
112
+ lint:
113
+ runs-on: ubuntu-latest
114
+ steps:
115
+ - uses: actions/checkout@v4
116
+ - uses: ./.github/actions/setup-node-and-cache
117
+ - uses: ./.github/actions/npm-install-build
118
+ with:
119
+ skip-build: 'true'
120
+ - run: npm run lint
121
+
122
+ typecheck:
123
+ runs-on: ubuntu-latest
124
+ steps:
125
+ - uses: actions/checkout@v4
126
+ - uses: ./.github/actions/setup-node-and-cache
127
+ - uses: ./.github/actions/npm-install-build
128
+ with:
129
+ skip-build: 'true'
130
+ - run: npm run typecheck
131
+
132
+ test:
133
+ runs-on: ubuntu-latest
134
+ strategy:
135
+ matrix:
136
+ node-version: [22, 24, 25]
137
+ steps:
138
+ - uses: actions/checkout@v4
139
+ - uses: ./.github/actions/setup-node-and-cache
140
+ with:
141
+ node-version: ${{ matrix.node-version }}
142
+ - uses: ./.github/actions/npm-install-build
143
+ - run: npm test
144
+
145
+ deploy:
146
+ needs: [lint, typecheck, test]
147
+ runs-on: ubuntu-latest
148
+ environment: production
149
+ permissions:
150
+ id-token: write
151
+ contents: read
152
+ steps:
153
+ - uses: actions/checkout@v4
154
+
155
+ - uses: ./.github/actions/setup-environment
156
+ with:
157
+ project-key: my-project
158
+ project-env: production
159
+
160
+ - uses: ./.github/actions/configure-aws
161
+ with:
162
+ role-arn: ${{ vars.AWS_ROLE_ARN }}
163
+ region: ${{ vars.AWS_REGION || 'us-east-1' }}
164
+
165
+ - uses: ./.github/actions/setup-node-and-cache
166
+
167
+ - uses: ./.github/actions/npm-install-build
168
+
169
+ - uses: ./.github/actions/cdk-deploy
170
+ with:
171
+ stack-name: '*-production-*'
172
+ ```
173
+
174
+ ## version.yml
175
+
176
+ Manually trigger version bumps across packages.
177
+
178
+ ```yaml
179
+ name: version
180
+
181
+ on:
182
+ workflow_dispatch:
183
+ inputs:
184
+ version_type:
185
+ description: 'Version bump type'
186
+ required: true
187
+ type: choice
188
+ options:
189
+ - patch
190
+ - minor
191
+ - major
192
+ packages:
193
+ description: 'Packages to version (comma-separated, or "all")'
194
+ required: false
195
+ default: 'all'
196
+
197
+ jobs:
198
+ version:
199
+ runs-on: ubuntu-latest
200
+ permissions:
201
+ contents: write
202
+ steps:
203
+ - uses: actions/checkout@v4
204
+ with:
205
+ token: ${{ secrets.GITHUB_TOKEN }}
206
+
207
+ - uses: ./.github/actions/setup-node-and-cache
208
+
209
+ - name: Configure Git
210
+ run: |
211
+ git config user.name "github-actions[bot]"
212
+ git config user.email "github-actions[bot]@users.noreply.github.com"
213
+
214
+ - name: Bump versions
215
+ run: |
216
+ PACKAGES="${{ github.event.inputs.packages }}"
217
+ VERSION_TYPE="${{ github.event.inputs.version_type }}"
218
+
219
+ if [ "$PACKAGES" = "all" ]; then
220
+ # Bump all packages in packages/ directory
221
+ for pkg in packages/*/package.json; do
222
+ dir=$(dirname "$pkg")
223
+ echo "Bumping $dir"
224
+ npm version $VERSION_TYPE --workspace "$dir" --no-git-tag-version
225
+ done
226
+ else
227
+ # Bump specific packages
228
+ IFS=',' read -ra PKG_ARRAY <<< "$PACKAGES"
229
+ for pkg in "${PKG_ARRAY[@]}"; do
230
+ pkg=$(echo "$pkg" | xargs) # trim whitespace
231
+ echo "Bumping packages/$pkg"
232
+ npm version $VERSION_TYPE --workspace "packages/$pkg" --no-git-tag-version
233
+ done
234
+ fi
235
+
236
+ - name: Update package-lock.json
237
+ run: npm i --package-lock-only
238
+
239
+ - name: Commit and push
240
+ run: |
241
+ git add .
242
+ git commit -m "chore: bump versions (${{ github.event.inputs.version_type }})"
243
+ git push
244
+ ```
245
+
246
+ ## Environment-Specific Stack Naming
247
+
248
+ Use consistent stack naming with environment and nonce:
249
+
250
+ ```typescript
251
+ // stacks/cdk/src/app.ts
252
+ const env = process.env.PROJECT_ENV || "sandbox";
253
+ const nonce = process.env.PROJECT_NONCE || "dev";
254
+
255
+ new ApiStack(app, `api-${env}-${nonce}`, {
256
+ env: {
257
+ account: process.env.CDK_DEFAULT_ACCOUNT,
258
+ region: process.env.CDK_DEFAULT_REGION,
259
+ },
260
+ });
261
+ ```
262
+
263
+ This produces stack names like:
264
+ - `api-sandbox-feat-new-feature`
265
+ - `api-sandbox-main`
266
+ - `api-production-prod`
267
+
268
+ ## Deployment Flow
269
+
270
+ ### Sandbox Flow
271
+
272
+ ```
273
+ feat/branch → push → lint/test → deploy → sandbox stack
274
+
275
+ main branch → push → lint/test → deploy → sandbox stack
276
+ ```
277
+
278
+ ### Production Flow
279
+
280
+ ```
281
+ main branch → tag v1.0.0 → push → lint/test → deploy → production stack
282
+
283
+ (requires approval)
284
+ ```
285
+
286
+ ## Adding Approval Gates
287
+
288
+ For production, add required reviewers in GitHub Environment settings:
289
+
290
+ 1. Go to **Settings** → **Environments** → **production**
291
+ 2. Enable **Required reviewers**
292
+ 3. Add team members who can approve deployments
293
+
294
+ ## Notifications
295
+
296
+ Add Slack notifications on deploy:
297
+
298
+ ```yaml
299
+ - name: Notify Slack
300
+ if: success()
301
+ uses: slackapi/slack-github-action@v1
302
+ with:
303
+ payload: |
304
+ {
305
+ "text": "Deployed ${{ github.repository }} to ${{ vars.PROJECT_ENV }}",
306
+ "blocks": [
307
+ {
308
+ "type": "section",
309
+ "text": {
310
+ "type": "mrkdwn",
311
+ "text": "*Deployment Complete*\nRepo: ${{ github.repository }}\nEnv: ${{ vars.PROJECT_ENV }}\nRef: ${{ github.ref_name }}"
312
+ }
313
+ }
314
+ ]
315
+ }
316
+ env:
317
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
318
+ ```
319
+
320
+ ## Rollback Strategy
321
+
322
+ For quick rollbacks, use git tags:
323
+
324
+ ```bash
325
+ # Tag current production state before deploying
326
+ git tag production-backup-$(date +%Y%m%d)
327
+
328
+ # If rollback needed, push previous tag
329
+ git push origin production-backup-20250131:refs/tags/production-rollback
330
+ ```
331
+
332
+ This triggers the production workflow with the previous code.
@@ -0,0 +1,184 @@
1
+ ---
2
+ description: GitHub Environments configuration for CDK deployments
3
+ related: cicd, cicd-actions, cicd-deploy, variables
4
+ ---
5
+
6
+ # GitHub Environments Configuration
7
+
8
+ GitHub Environments provide deployment-specific variables for Jaypie CDK workflows. Each environment (sandbox, production) has its own set of variables.
9
+
10
+ ## Required Variables
11
+
12
+ | Variable | Description |
13
+ |----------|-------------|
14
+ | `AWS_ROLE_ARN` | OIDC role ARN for assuming AWS credentials |
15
+
16
+ ## Optional Variables
17
+
18
+ | Variable | Default | Description |
19
+ |----------|---------|-------------|
20
+ | `AWS_REGION` | `us-east-1` | AWS region for deployment |
21
+ | `LOG_LEVEL` | `trace` (sandbox) / `info` (production) | Application log level |
22
+ | `PROJECT_CHAOS` | `full` (sandbox) / `none` (production) | Chaos engineering mode |
23
+ | `PROJECT_ENV` | Environment name | Environment identifier |
24
+ | `PROJECT_NONCE` | Branch name or `prod` | Unique identifier for resources |
25
+
26
+ ## Environment Setup
27
+
28
+ ### Create Environment
29
+
30
+ 1. Navigate to **Settings** → **Environments**
31
+ 2. Click **New environment**
32
+ 3. Enter environment name (e.g., `sandbox`, `production`)
33
+ 4. Click **Configure environment**
34
+
35
+ ### Add Environment Variables
36
+
37
+ 1. In environment settings, click **Add variable**
38
+ 2. Add required and optional variables:
39
+
40
+ **Sandbox Environment:**
41
+
42
+ ```
43
+ AWS_ROLE_ARN = arn:aws:iam::123456789012:role/GitHubActions-Sandbox
44
+ AWS_REGION = us-east-1
45
+ PROJECT_ENV = sandbox
46
+ LOG_LEVEL = trace
47
+ PROJECT_CHAOS = full
48
+ ```
49
+
50
+ **Production Environment:**
51
+
52
+ ```
53
+ AWS_ROLE_ARN = arn:aws:iam::123456789012:role/GitHubActions-Production
54
+ AWS_REGION = us-east-1
55
+ PROJECT_ENV = production
56
+ LOG_LEVEL = info
57
+ PROJECT_CHAOS = none
58
+ ```
59
+
60
+ ### Configure Deployment Protection (Production)
61
+
62
+ For production environments:
63
+
64
+ 1. Enable **Required reviewers** and add approvers
65
+ 2. Enable **Wait timer** if needed
66
+ 3. Limit deployment branches to `main`, `production-*`, `v*`
67
+
68
+ ## AWS OIDC Role Setup
69
+
70
+ ### Trust Policy
71
+
72
+ Create an IAM role with this trust policy to allow GitHub Actions:
73
+
74
+ ```json
75
+ {
76
+ "Version": "2012-10-17",
77
+ "Statement": [
78
+ {
79
+ "Effect": "Allow",
80
+ "Principal": {
81
+ "Federated": "arn:aws:iam::123456789012:oidc-provider/token.actions.githubusercontent.com"
82
+ },
83
+ "Action": "sts:AssumeRoleWithWebIdentity",
84
+ "Condition": {
85
+ "StringEquals": {
86
+ "token.actions.githubusercontent.com:aud": "sts.amazonaws.com"
87
+ },
88
+ "StringLike": {
89
+ "token.actions.githubusercontent.com:sub": "repo:org/repo:*"
90
+ }
91
+ }
92
+ }
93
+ ]
94
+ }
95
+ ```
96
+
97
+ ### Role Permissions
98
+
99
+ Attach policies for CDK deployment:
100
+
101
+ - `PowerUserAccess` for CDK deployments, or scoped custom policy
102
+ - `iam:PassRole` for Lambda execution roles
103
+
104
+ ## Workflow Environment Usage
105
+
106
+ Reference environments in workflow files:
107
+
108
+ ```yaml
109
+ jobs:
110
+ deploy:
111
+ runs-on: ubuntu-latest
112
+ environment: sandbox
113
+ permissions:
114
+ id-token: write
115
+ contents: read
116
+ steps:
117
+ - uses: aws-actions/configure-aws-credentials@v4
118
+ with:
119
+ role-to-assume: ${{ vars.AWS_ROLE_ARN }}
120
+ aws-region: ${{ vars.AWS_REGION || 'us-east-1' }}
121
+ ```
122
+
123
+ ## Variable Precedence
124
+
125
+ Variables are resolved in order:
126
+
127
+ 1. Job/step `env:` block (highest priority)
128
+ 2. Workflow-level `env:` block
129
+ 3. Environment variables (`vars.*`)
130
+ 4. Repository variables
131
+ 5. Default values in composite actions
132
+
133
+ ## Troubleshooting
134
+
135
+ ### "No credentials" Error
136
+
137
+ **Symptoms:** `Error: Credentials could not be loaded`
138
+
139
+ **Causes:**
140
+ - Missing `id-token: write` permission
141
+ - Incorrect `AWS_ROLE_ARN`
142
+ - Role trust policy not configured for repository
143
+
144
+ **Fix:** Verify OIDC role trust policy matches repository and permissions include `id-token: write`.
145
+
146
+ ### "Access Denied" During Deploy
147
+
148
+ **Symptoms:** CDK deploy fails with permission errors
149
+
150
+ **Causes:**
151
+ - Role lacks required permissions
152
+ - Cross-account access not configured
153
+ - Resource policy restrictions
154
+
155
+ **Fix:** Review CloudTrail logs for specific denied action and update role policy.
156
+
157
+ ### Variables Not Resolving
158
+
159
+ **Symptoms:** `${{ vars.AWS_ROLE_ARN }}` is empty
160
+
161
+ **Causes:**
162
+ - Variable not defined in environment
163
+ - Environment not specified in job
164
+ - Typo in variable name
165
+
166
+ **Fix:** Verify environment is set and variable exists with exact spelling.
167
+
168
+ ### Wrong Environment Used
169
+
170
+ **Symptoms:** Deploying to wrong environment
171
+
172
+ **Causes:**
173
+ - `environment:` key missing or incorrect in job
174
+ - Branch protection rules not limiting deployments
175
+
176
+ **Fix:** Add explicit `environment:` to job and configure branch restrictions.
177
+
178
+ ## Best Practices
179
+
180
+ 1. **Use separate AWS accounts** for sandbox and production
181
+ 2. **Limit production role permissions** to specific resources
182
+ 3. **Enable deployment protection** for production
183
+ 4. **Use environment-specific secrets** when needed
184
+ 5. **Document role ARNs** in repository README or wiki
package/skills/cicd.md CHANGED
@@ -1,12 +1,20 @@
1
1
  ---
2
2
  description: GitHub Actions CI/CD workflows
3
- related: tests, cdk
3
+ related: cicd-actions, cicd-deploy, cicd-environments, cdk, tests
4
4
  ---
5
5
 
6
6
  # CI/CD with GitHub Actions
7
7
 
8
8
  Jaypie projects use GitHub Actions for continuous integration and deployment.
9
9
 
10
+ ## Sub-Skills
11
+
12
+ | Skill | Description |
13
+ |-------|-------------|
14
+ | `cicd-actions` | Reusable composite actions for workflows |
15
+ | `cicd-deploy` | CDK deployment workflows (sandbox, production) |
16
+ | `cicd-environments` | GitHub Environments configuration |
17
+
10
18
  ## Standard Workflows
11
19
 
12
20
  ### npm-check.yml
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: Coding standards, testing, and documentation
3
- related: documentation, errors, logs, mocks, style, tests
3
+ related: documentation, errors, logs, mocks, monorepo, style, subpackage, tests
4
4
  ---
5
5
 
6
6
  # Development
@@ -15,5 +15,7 @@ Coding standards and practices for Jaypie projects.
15
15
  | `errors` | Error handling with @jaypie/errors |
16
16
  | `logs` | Logging patterns and conventions |
17
17
  | `mocks` | Mock patterns via @jaypie/testkit |
18
+ | `monorepo` | Initialize a Jaypie monorepo project |
18
19
  | `style` | Code style conventions |
20
+ | `subpackage` | Create a subpackage within a monorepo |
19
21
  | `tests` | Testing patterns with Vitest |
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: AWS, CDK, CI/CD, and observability
3
- related: aws, cdk, cicd, datadog, dns, dynamodb, secrets, variables, websockets
3
+ related: aws, cdk, cicd, cicd-actions, cicd-deploy, cicd-environments, datadog, dns, dynamodb, secrets, variables, websockets
4
4
  ---
5
5
 
6
6
  # Infrastructure
@@ -13,7 +13,10 @@ Cloud infrastructure and deployment patterns.
13
13
  |-------|-------------|
14
14
  | `aws` | AWS integration and cloud services |
15
15
  | `cdk` | CDK constructs and deployment |
16
- | `cicd` | GitHub Actions workflows |
16
+ | `cicd` | GitHub Actions workflows (overview) |
17
+ | `cicd-actions` | Reusable composite actions |
18
+ | `cicd-deploy` | CDK deployment workflows |
19
+ | `cicd-environments` | GitHub Environments configuration |
17
20
  | `datadog` | Datadog and observability |
18
21
  | `dns` | DNS and domain configuration |
19
22
  | `dynamodb` | DynamoDB patterns and queries |