@brainst0rm/core 0.13.0 → 0.14.1

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.
Files changed (51) hide show
  1. package/dist/chunk-M7BBX56R.js +340 -0
  2. package/dist/chunk-M7BBX56R.js.map +1 -0
  3. package/dist/{chunk-SWXTFHC7.js → chunk-Z5D2QZY6.js} +3 -3
  4. package/dist/chunk-Z5D2QZY6.js.map +1 -0
  5. package/dist/chunk-Z6ZWNWWR.js +34 -0
  6. package/dist/index.d.ts +2717 -188
  7. package/dist/index.js +16178 -7949
  8. package/dist/index.js.map +1 -1
  9. package/dist/self-extend-47LWSK3E.js +52 -0
  10. package/dist/self-extend-47LWSK3E.js.map +1 -0
  11. package/dist/skills/builtin/api-and-interface-design/SKILL.md +300 -0
  12. package/dist/skills/builtin/browser-testing-with-devtools/SKILL.md +307 -0
  13. package/dist/skills/builtin/ci-cd-and-automation/SKILL.md +391 -0
  14. package/dist/skills/builtin/code-review-and-quality/SKILL.md +353 -0
  15. package/dist/skills/builtin/code-simplification/SKILL.md +340 -0
  16. package/dist/skills/builtin/context-engineering/SKILL.md +301 -0
  17. package/dist/skills/builtin/daemon-operations/SKILL.md +55 -0
  18. package/dist/skills/builtin/debugging-and-error-recovery/SKILL.md +306 -0
  19. package/dist/skills/builtin/deprecation-and-migration/SKILL.md +207 -0
  20. package/dist/skills/builtin/documentation-and-adrs/SKILL.md +295 -0
  21. package/dist/skills/builtin/frontend-ui-engineering/SKILL.md +333 -0
  22. package/dist/skills/builtin/git-workflow-and-versioning/SKILL.md +303 -0
  23. package/dist/skills/builtin/github-collaboration/SKILL.md +215 -0
  24. package/dist/skills/builtin/godmode-operations/SKILL.md +68 -0
  25. package/dist/skills/builtin/idea-refine/SKILL.md +186 -0
  26. package/dist/skills/builtin/idea-refine/examples.md +244 -0
  27. package/dist/skills/builtin/idea-refine/frameworks.md +101 -0
  28. package/dist/skills/builtin/idea-refine/refinement-criteria.md +126 -0
  29. package/dist/skills/builtin/idea-refine/scripts/idea-refine.sh +15 -0
  30. package/dist/skills/builtin/incremental-implementation/SKILL.md +243 -0
  31. package/dist/skills/builtin/memory-init/SKILL.md +54 -0
  32. package/dist/skills/builtin/memory-reflection/SKILL.md +59 -0
  33. package/dist/skills/builtin/multi-model-routing/SKILL.md +56 -0
  34. package/dist/skills/builtin/performance-optimization/SKILL.md +291 -0
  35. package/dist/skills/builtin/planning-and-task-breakdown/SKILL.md +240 -0
  36. package/dist/skills/builtin/security-and-hardening/SKILL.md +368 -0
  37. package/dist/skills/builtin/shipping-and-launch/SKILL.md +310 -0
  38. package/dist/skills/builtin/spec-driven-development/SKILL.md +212 -0
  39. package/dist/skills/builtin/test-driven-development/SKILL.md +376 -0
  40. package/dist/skills/builtin/using-agent-skills/SKILL.md +173 -0
  41. package/dist/trajectory-analyzer-ZAI2XUAI.js +14 -0
  42. package/dist/{trajectory-capture-RF7TUN6I.js → trajectory-capture-ERPIVYQJ.js} +3 -3
  43. package/package.json +14 -11
  44. package/dist/chunk-OU3NPQBH.js +0 -87
  45. package/dist/chunk-OU3NPQBH.js.map +0 -1
  46. package/dist/chunk-PZ5AY32C.js +0 -10
  47. package/dist/chunk-SWXTFHC7.js.map +0 -1
  48. package/dist/trajectory-MOCIJBV6.js +0 -8
  49. /package/dist/{chunk-PZ5AY32C.js.map → chunk-Z6ZWNWWR.js.map} +0 -0
  50. /package/dist/{trajectory-MOCIJBV6.js.map → trajectory-analyzer-ZAI2XUAI.js.map} +0 -0
  51. /package/dist/{trajectory-capture-RF7TUN6I.js.map → trajectory-capture-ERPIVYQJ.js.map} +0 -0
@@ -0,0 +1,391 @@
1
+ ---
2
+ name: ci-cd-and-automation
3
+ description: Automates CI/CD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test runners in CI, or establish deployment strategies.
4
+ ---
5
+
6
+ # CI/CD and Automation
7
+
8
+ ## Overview
9
+
10
+ Automate quality gates so that no change reaches production without passing tests, lint, type checking, and build. CI/CD is the enforcement mechanism for every other skill — it catches what humans and agents miss, and it does so consistently on every single change.
11
+
12
+ **Shift Left:** Catch problems as early in the pipeline as possible. A bug caught in linting costs minutes; the same bug caught in production costs hours. Move checks upstream — static analysis before tests, tests before staging, staging before production.
13
+
14
+ **Faster is Safer:** Smaller batches and more frequent releases reduce risk, not increase it. A deployment with 3 changes is easier to debug than one with 30. Frequent releases build confidence in the release process itself.
15
+
16
+ ## When to Use
17
+
18
+ - Setting up a new project's CI pipeline
19
+ - Adding or modifying automated checks
20
+ - Configuring deployment pipelines
21
+ - When a change should trigger automated verification
22
+ - Debugging CI failures
23
+
24
+ ## The Quality Gate Pipeline
25
+
26
+ Every change goes through these gates before merge:
27
+
28
+ ```
29
+ Pull Request Opened
30
+
31
+
32
+ ┌─────────────────┐
33
+ │ LINT CHECK │ eslint, prettier
34
+ │ ↓ pass │
35
+ │ TYPE CHECK │ tsc --noEmit
36
+ │ ↓ pass │
37
+ │ UNIT TESTS │ jest/vitest
38
+ │ ↓ pass │
39
+ │ BUILD │ npm run build
40
+ │ ↓ pass │
41
+ │ INTEGRATION │ API/DB tests
42
+ │ ↓ pass │
43
+ │ E2E (optional) │ Playwright/Cypress
44
+ │ ↓ pass │
45
+ │ SECURITY AUDIT │ npm audit
46
+ │ ↓ pass │
47
+ │ BUNDLE SIZE │ bundlesize check
48
+ └─────────────────┘
49
+
50
+
51
+ Ready for review
52
+ ```
53
+
54
+ **No gate can be skipped.** If lint fails, fix lint — don't disable the rule. If a test fails, fix the code — don't skip the test.
55
+
56
+ ## GitHub Actions Configuration
57
+
58
+ ### Basic CI Pipeline
59
+
60
+ ```yaml
61
+ # .github/workflows/ci.yml
62
+ name: CI
63
+
64
+ on:
65
+ pull_request:
66
+ branches: [main]
67
+ push:
68
+ branches: [main]
69
+
70
+ jobs:
71
+ quality:
72
+ runs-on: ubuntu-latest
73
+ steps:
74
+ - uses: actions/checkout@v4
75
+
76
+ - uses: actions/setup-node@v4
77
+ with:
78
+ node-version: "22"
79
+ cache: "npm"
80
+
81
+ - name: Install dependencies
82
+ run: npm ci
83
+
84
+ - name: Lint
85
+ run: npm run lint
86
+
87
+ - name: Type check
88
+ run: npx tsc --noEmit
89
+
90
+ - name: Test
91
+ run: npm test -- --coverage
92
+
93
+ - name: Build
94
+ run: npm run build
95
+
96
+ - name: Security audit
97
+ run: npm audit --audit-level=high
98
+ ```
99
+
100
+ ### With Database Integration Tests
101
+
102
+ ```yaml
103
+ integration:
104
+ runs-on: ubuntu-latest
105
+ services:
106
+ postgres:
107
+ image: postgres:16
108
+ env:
109
+ POSTGRES_DB: testdb
110
+ POSTGRES_USER: ci_user
111
+ POSTGRES_PASSWORD: ${{ secrets.CI_DB_PASSWORD }}
112
+ ports:
113
+ - 5432:5432
114
+ options: >-
115
+ --health-cmd pg_isready
116
+ --health-interval 10s
117
+ --health-timeout 5s
118
+ --health-retries 5
119
+
120
+ steps:
121
+ - uses: actions/checkout@v4
122
+ - uses: actions/setup-node@v4
123
+ with:
124
+ node-version: "22"
125
+ cache: "npm"
126
+ - run: npm ci
127
+ - name: Run migrations
128
+ run: npx prisma migrate deploy
129
+ env:
130
+ DATABASE_URL: postgresql://ci_user:${{ secrets.CI_DB_PASSWORD }}@localhost:5432/testdb
131
+ - name: Integration tests
132
+ run: npm run test:integration
133
+ env:
134
+ DATABASE_URL: postgresql://ci_user:${{ secrets.CI_DB_PASSWORD }}@localhost:5432/testdb
135
+ ```
136
+
137
+ > **Note:** Even for CI-only test databases, use GitHub Secrets for credentials rather than hardcoding values. This builds good habits and prevents accidental reuse of test credentials in other contexts.
138
+
139
+ ### E2E Tests
140
+
141
+ ```yaml
142
+ e2e:
143
+ runs-on: ubuntu-latest
144
+ steps:
145
+ - uses: actions/checkout@v4
146
+ - uses: actions/setup-node@v4
147
+ with:
148
+ node-version: "22"
149
+ cache: "npm"
150
+ - run: npm ci
151
+ - name: Install Playwright
152
+ run: npx playwright install --with-deps chromium
153
+ - name: Build
154
+ run: npm run build
155
+ - name: Run E2E tests
156
+ run: npx playwright test
157
+ - uses: actions/upload-artifact@v4
158
+ if: failure()
159
+ with:
160
+ name: playwright-report
161
+ path: playwright-report/
162
+ ```
163
+
164
+ ## Feeding CI Failures Back to Agents
165
+
166
+ The power of CI with AI agents is the feedback loop. When CI fails:
167
+
168
+ ```
169
+ CI fails
170
+
171
+
172
+ Copy the failure output
173
+
174
+
175
+ Feed it to the agent:
176
+ "The CI pipeline failed with this error:
177
+ [paste specific error]
178
+ Fix the issue and verify locally before pushing again."
179
+
180
+
181
+ Agent fixes → pushes → CI runs again
182
+ ```
183
+
184
+ **Key patterns:**
185
+
186
+ ```
187
+ Lint failure → Agent runs `npm run lint --fix` and commits
188
+ Type error → Agent reads the error location and fixes the type
189
+ Test failure → Agent follows debugging-and-error-recovery skill
190
+ Build error → Agent checks config and dependencies
191
+ ```
192
+
193
+ ## Deployment Strategies
194
+
195
+ ### Preview Deployments
196
+
197
+ Every PR gets a preview deployment for manual testing:
198
+
199
+ ```yaml
200
+ # Deploy preview on PR (Vercel/Netlify/etc.)
201
+ deploy-preview:
202
+ runs-on: ubuntu-latest
203
+ if: github.event_name == 'pull_request'
204
+ steps:
205
+ - uses: actions/checkout@v4
206
+ - name: Deploy preview
207
+ run: npx vercel --token=${{ secrets.VERCEL_TOKEN }}
208
+ ```
209
+
210
+ ### Feature Flags
211
+
212
+ Feature flags decouple deployment from release. Deploy incomplete or risky features behind flags so you can:
213
+
214
+ - **Ship code without enabling it.** Merge to main early, enable when ready.
215
+ - **Roll back without redeploying.** Disable the flag instead of reverting code.
216
+ - **Canary new features.** Enable for 1% of users, then 10%, then 100%.
217
+ - **Run A/B tests.** Compare behavior with and without the feature.
218
+
219
+ ```typescript
220
+ // Simple feature flag pattern
221
+ if (featureFlags.isEnabled("new-checkout-flow", { userId })) {
222
+ return renderNewCheckout();
223
+ }
224
+ return renderLegacyCheckout();
225
+ ```
226
+
227
+ **Flag lifecycle:** Create → Enable for testing → Canary → Full rollout → Remove the flag and dead code. Flags that live forever become technical debt — set a cleanup date when you create them.
228
+
229
+ ### Staged Rollouts
230
+
231
+ ```
232
+ PR merged to main
233
+
234
+
235
+ Staging deployment (auto)
236
+ │ Manual verification
237
+
238
+ Production deployment (manual trigger or auto after staging)
239
+
240
+
241
+ Monitor for errors (15-minute window)
242
+
243
+ ├── Errors detected → Rollback
244
+ └── Clean → Done
245
+ ```
246
+
247
+ ### Rollback Plan
248
+
249
+ Every deployment should be reversible:
250
+
251
+ ```yaml
252
+ # Manual rollback workflow
253
+ name: Rollback
254
+ on:
255
+ workflow_dispatch:
256
+ inputs:
257
+ version:
258
+ description: "Version to rollback to"
259
+ required: true
260
+
261
+ jobs:
262
+ rollback:
263
+ runs-on: ubuntu-latest
264
+ steps:
265
+ - name: Rollback deployment
266
+ run: |
267
+ # Deploy the specified previous version
268
+ npx vercel rollback ${{ inputs.version }}
269
+ ```
270
+
271
+ ## Environment Management
272
+
273
+ ```
274
+ .env.example → Committed (template for developers)
275
+ .env → NOT committed (local development)
276
+ .env.test → Committed (test environment, no real secrets)
277
+ CI secrets → Stored in GitHub Secrets / vault
278
+ Production secrets → Stored in deployment platform / vault
279
+ ```
280
+
281
+ CI should never have production secrets. Use separate secrets for CI testing.
282
+
283
+ ## Automation Beyond CI
284
+
285
+ ### Dependabot / Renovate
286
+
287
+ ```yaml
288
+ # .github/dependabot.yml
289
+ version: 2
290
+ updates:
291
+ - package-ecosystem: npm
292
+ directory: /
293
+ schedule:
294
+ interval: weekly
295
+ open-pull-requests-limit: 5
296
+ ```
297
+
298
+ ### Build Cop Role
299
+
300
+ Designate someone responsible for keeping CI green. When the build breaks, the Build Cop's job is to fix or revert — not the person whose change caused the break. This prevents broken builds from accumulating while everyone assumes someone else will fix it.
301
+
302
+ ### PR Checks
303
+
304
+ - **Required reviews:** At least 1 approval before merge
305
+ - **Required status checks:** CI must pass before merge
306
+ - **Branch protection:** No force-pushes to main
307
+ - **Auto-merge:** If all checks pass and approved, merge automatically
308
+
309
+ ## CI Optimization
310
+
311
+ When the pipeline exceeds 10 minutes, apply these strategies in order of impact:
312
+
313
+ ```
314
+ Slow CI pipeline?
315
+ ├── Cache dependencies
316
+ │ └── Use actions/cache or setup-node cache option for node_modules
317
+ ├── Run jobs in parallel
318
+ │ └── Split lint, typecheck, test, build into separate parallel jobs
319
+ ├── Only run what changed
320
+ │ └── Use path filters to skip unrelated jobs (e.g., skip e2e for docs-only PRs)
321
+ ├── Use matrix builds
322
+ │ └── Shard test suites across multiple runners
323
+ ├── Optimize the test suite
324
+ │ └── Remove slow tests from the critical path, run them on a schedule instead
325
+ └── Use larger runners
326
+ └── GitHub-hosted larger runners or self-hosted for CPU-heavy builds
327
+ ```
328
+
329
+ **Example: caching and parallelism**
330
+
331
+ ```yaml
332
+ jobs:
333
+ lint:
334
+ runs-on: ubuntu-latest
335
+ steps:
336
+ - uses: actions/checkout@v4
337
+ - uses: actions/setup-node@v4
338
+ with: { node-version: "22", cache: "npm" }
339
+ - run: npm ci
340
+ - run: npm run lint
341
+
342
+ typecheck:
343
+ runs-on: ubuntu-latest
344
+ steps:
345
+ - uses: actions/checkout@v4
346
+ - uses: actions/setup-node@v4
347
+ with: { node-version: "22", cache: "npm" }
348
+ - run: npm ci
349
+ - run: npx tsc --noEmit
350
+
351
+ test:
352
+ runs-on: ubuntu-latest
353
+ steps:
354
+ - uses: actions/checkout@v4
355
+ - uses: actions/setup-node@v4
356
+ with: { node-version: "22", cache: "npm" }
357
+ - run: npm ci
358
+ - run: npm test -- --coverage
359
+ ```
360
+
361
+ ## Common Rationalizations
362
+
363
+ | Rationalization | Reality |
364
+ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
365
+ | "CI is too slow" | Optimize the pipeline (see CI Optimization below), don't skip it. A 5-minute pipeline prevents hours of debugging. |
366
+ | "This change is trivial, skip CI" | Trivial changes break builds. CI is fast for trivial changes anyway. |
367
+ | "The test is flaky, just re-run" | Flaky tests mask real bugs and waste everyone's time. Fix the flakiness. |
368
+ | "We'll add CI later" | Projects without CI accumulate broken states. Set it up on day one. |
369
+ | "Manual testing is enough" | Manual testing doesn't scale and isn't repeatable. Automate what you can. |
370
+
371
+ ## Red Flags
372
+
373
+ - No CI pipeline in the project
374
+ - CI failures ignored or silenced
375
+ - Tests disabled in CI to make the pipeline pass
376
+ - Production deploys without staging verification
377
+ - No rollback mechanism
378
+ - Secrets stored in code or CI config files (not secrets manager)
379
+ - Long CI times with no optimization effort
380
+
381
+ ## Verification
382
+
383
+ After setting up or modifying CI:
384
+
385
+ - [ ] All quality gates are present (lint, types, tests, build, audit)
386
+ - [ ] Pipeline runs on every PR and push to main
387
+ - [ ] Failures block merge (branch protection configured)
388
+ - [ ] CI results feed back into the development loop
389
+ - [ ] Secrets are stored in the secrets manager, not in code
390
+ - [ ] Deployment has a rollback mechanism
391
+ - [ ] Pipeline runs in under 10 minutes for the test suite