specialist-agent 2.7.0 → 2.8.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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +2 -2
- package/.codex/INSTALL.md +12 -3
- package/.cursor-plugin/plugin.json +2 -2
- package/.opencode/INSTALL.md +12 -3
- package/README.md +8 -6
- package/agents/analyst-lite.md +1 -1
- package/agents/analyst.md +7 -7
- package/agents/api-lite.md +5 -5
- package/agents/api.md +13 -13
- package/agents/architect-lite.md +7 -7
- package/agents/architect.md +26 -26
- package/agents/cloud-lite.md +3 -3
- package/agents/cloud.md +15 -15
- package/agents/data-lite.md +1 -1
- package/agents/data.md +26 -26
- package/agents/debugger-lite.md +2 -2
- package/agents/debugger.md +15 -15
- package/agents/deps-lite.md +4 -4
- package/agents/deps.md +21 -21
- package/agents/designer-lite.md +1 -1
- package/agents/designer.md +13 -13
- package/agents/devops-lite.md +1 -1
- package/agents/devops.md +11 -11
- package/agents/docs-lite.md +5 -5
- package/agents/docs.md +39 -30
- package/agents/executor-lite.md +1 -1
- package/agents/executor.md +25 -25
- package/agents/explorer-lite.md +3 -3
- package/agents/explorer.md +13 -13
- package/agents/finance-lite.md +1 -1
- package/agents/finance.md +18 -18
- package/agents/i18n-lite.md +4 -4
- package/agents/i18n.md +24 -24
- package/agents/legal-lite.md +9 -9
- package/agents/legal.md +15 -15
- package/agents/memory.md +9 -9
- package/agents/orchestrator-lite.md +1 -1
- package/agents/orchestrator.md +8 -8
- package/agents/pair-lite.md +2 -2
- package/agents/pair.md +14 -14
- package/agents/perf-lite.md +4 -4
- package/agents/perf.md +20 -20
- package/agents/planner-lite.md +4 -4
- package/agents/planner.md +21 -21
- package/agents/refactor-lite.md +4 -4
- package/agents/refactor.md +32 -32
- package/agents/ripple-lite.md +8 -8
- package/agents/ripple.md +14 -14
- package/agents/scout-lite.md +1 -1
- package/agents/scout.md +19 -19
- package/agents/security-lite.md +1 -1
- package/agents/security.md +18 -18
- package/agents/starter-lite.md +3 -3
- package/agents/starter.md +29 -29
- package/agents/tdd-lite.md +2 -2
- package/agents/tdd.md +16 -16
- package/agents/tester-lite.md +1 -1
- package/agents/tester.md +18 -18
- package/cli/index.mjs +33 -9
- package/hooks/native/auto-dispatch.mjs +4 -4
- package/hooks/native/auto-format.mjs +13 -10
- package/hooks/native/security-guard.mjs +16 -11
- package/hooks/native/session-context.mjs +2 -2
- package/hooks/native/utils.mjs +1 -1
- package/package.json +2 -2
- package/packs/angular/CLAUDE.md +2 -2
- package/packs/angular/agents/builder.md +14 -14
- package/packs/angular/agents/doctor.md +14 -14
- package/packs/angular/agents/migrator.md +16 -16
- package/packs/angular/agents/reviewer.md +22 -22
- package/packs/angular/agents-lite/builder.md +1 -1
- package/packs/angular/agents-lite/doctor.md +1 -1
- package/packs/angular/agents-lite/migrator.md +2 -2
- package/packs/angular/agents-lite/reviewer.md +8 -8
- package/packs/angular/skills/dev-create-component/SKILL.md +1 -1
- package/packs/angular/skills/dev-create-injectable/SKILL.md +2 -2
- package/packs/angular/skills/dev-create-module/SKILL.md +1 -1
- package/packs/angular/skills/dev-create-service/SKILL.md +1 -1
- package/packs/angular/skills/dev-create-test/SKILL.md +1 -1
- package/packs/angular/skills/migration-migrate-module/SKILL.md +1 -1
- package/packs/angular/skills/review-check-architecture/SKILL.md +1 -1
- package/packs/angular/skills/review-review/SKILL.md +5 -5
- package/packs/astro/ARCHITECTURE.md +17 -17
- package/packs/astro/CLAUDE.md +4 -4
- package/packs/astro/agents/builder.md +28 -28
- package/packs/astro/agents/doctor.md +15 -15
- package/packs/astro/agents/migrator.md +18 -18
- package/packs/astro/agents/reviewer.md +26 -26
- package/packs/astro/agents-lite/builder.md +1 -1
- package/packs/astro/agents-lite/doctor.md +2 -2
- package/packs/astro/agents-lite/migrator.md +10 -10
- package/packs/astro/agents-lite/reviewer.md +9 -9
- package/packs/astro/skills/dev-create-component/SKILL.md +1 -1
- package/packs/astro/skills/dev-create-island/SKILL.md +7 -7
- package/packs/astro/skills/dev-create-module/SKILL.md +1 -1
- package/packs/astro/skills/dev-create-service/SKILL.md +5 -5
- package/packs/astro/skills/dev-create-test/SKILL.md +4 -4
- package/packs/astro/skills/dev-generate-types/SKILL.md +6 -6
- package/packs/astro/skills/migration-migrate-module/SKILL.md +1 -1
- package/packs/astro/skills/review-check-architecture/SKILL.md +1 -1
- package/packs/astro/skills/review-review/SKILL.md +5 -5
- package/packs/nextjs/CLAUDE.md +2 -2
- package/packs/nextjs/agents/builder.md +12 -12
- package/packs/nextjs/agents/doctor.md +11 -11
- package/packs/nextjs/agents/migrator.md +14 -14
- package/packs/nextjs/agents/reviewer.md +17 -17
- package/packs/nextjs/agents-lite/builder.md +1 -1
- package/packs/nextjs/agents-lite/doctor.md +1 -1
- package/packs/nextjs/agents-lite/migrator.md +2 -2
- package/packs/nextjs/agents-lite/reviewer.md +4 -4
- package/packs/nextjs/skills/dev-create-component/SKILL.md +1 -1
- package/packs/nextjs/skills/dev-create-hook/SKILL.md +1 -1
- package/packs/nextjs/skills/dev-create-module/SKILL.md +1 -1
- package/packs/nextjs/skills/dev-create-service/SKILL.md +1 -1
- package/packs/nextjs/skills/dev-create-test/SKILL.md +1 -1
- package/packs/nextjs/skills/migration-migrate-module/SKILL.md +1 -1
- package/packs/nextjs/skills/review-check-architecture/SKILL.md +1 -1
- package/packs/nextjs/skills/review-review/SKILL.md +1 -1
- package/packs/nuxt/ARCHITECTURE.md +25 -25
- package/packs/nuxt/CLAUDE.md +6 -6
- package/packs/nuxt/agents/builder.md +24 -24
- package/packs/nuxt/agents/doctor.md +15 -15
- package/packs/nuxt/agents/migrator.md +15 -15
- package/packs/nuxt/agents/reviewer.md +23 -23
- package/packs/nuxt/agents-lite/builder.md +1 -1
- package/packs/nuxt/agents-lite/doctor.md +3 -3
- package/packs/nuxt/agents-lite/migrator.md +8 -8
- package/packs/nuxt/agents-lite/reviewer.md +8 -8
- package/packs/nuxt/skills/dev-create-component/SKILL.md +1 -1
- package/packs/nuxt/skills/dev-create-composable/SKILL.md +1 -1
- package/packs/nuxt/skills/dev-create-module/SKILL.md +1 -1
- package/packs/nuxt/skills/dev-create-service/SKILL.md +5 -5
- package/packs/nuxt/skills/dev-create-test/SKILL.md +2 -2
- package/packs/nuxt/skills/dev-generate-types/SKILL.md +6 -6
- package/packs/nuxt/skills/migration-migrate-module/SKILL.md +1 -1
- package/packs/nuxt/skills/review-check-architecture/SKILL.md +1 -1
- package/packs/nuxt/skills/review-review/SKILL.md +5 -5
- package/packs/react/CLAUDE.md +2 -2
- package/packs/react/agents/builder.md +12 -12
- package/packs/react/agents/doctor.md +13 -13
- package/packs/react/agents/migrator.md +14 -14
- package/packs/react/agents/reviewer.md +18 -18
- package/packs/react/agents-lite/builder.md +1 -1
- package/packs/react/agents-lite/doctor.md +1 -1
- package/packs/react/agents-lite/migrator.md +2 -2
- package/packs/react/agents-lite/reviewer.md +4 -4
- package/packs/react/skills/dev-create-component/SKILL.md +1 -1
- package/packs/react/skills/dev-create-hook/SKILL.md +1 -1
- package/packs/react/skills/dev-create-module/SKILL.md +1 -1
- package/packs/react/skills/dev-create-service/SKILL.md +1 -1
- package/packs/react/skills/dev-create-test/SKILL.md +1 -1
- package/packs/react/skills/migration-migrate-module/SKILL.md +1 -1
- package/packs/react/skills/review-check-architecture/SKILL.md +1 -1
- package/packs/react/skills/review-review/SKILL.md +1 -1
- package/packs/svelte/CLAUDE.md +2 -2
- package/packs/svelte/agents/builder.md +12 -12
- package/packs/svelte/agents/doctor.md +11 -11
- package/packs/svelte/agents/migrator.md +14 -14
- package/packs/svelte/agents/reviewer.md +17 -17
- package/packs/svelte/agents-lite/builder.md +1 -1
- package/packs/svelte/agents-lite/doctor.md +1 -1
- package/packs/svelte/agents-lite/migrator.md +2 -2
- package/packs/svelte/agents-lite/reviewer.md +4 -4
- package/packs/svelte/skills/dev-create-component/SKILL.md +1 -1
- package/packs/svelte/skills/dev-create-module/SKILL.md +1 -1
- package/packs/svelte/skills/dev-create-service/SKILL.md +1 -1
- package/packs/svelte/skills/dev-create-store/SKILL.md +1 -1
- package/packs/svelte/skills/dev-create-test/SKILL.md +1 -1
- package/packs/svelte/skills/migration-migrate-module/SKILL.md +1 -1
- package/packs/svelte/skills/review-check-architecture/SKILL.md +1 -1
- package/packs/svelte/skills/review-review/SKILL.md +1 -1
- package/packs/vue/ARCHITECTURE.md +7 -7
- package/packs/vue/CLAUDE.md +3 -3
- package/packs/vue/agents/builder.md +24 -24
- package/packs/vue/agents/doctor.md +14 -14
- package/packs/vue/agents/migrator.md +15 -15
- package/packs/vue/agents/reviewer.md +23 -23
- package/packs/vue/agents-lite/builder.md +1 -1
- package/packs/vue/agents-lite/doctor.md +2 -2
- package/packs/vue/agents-lite/migrator.md +8 -8
- package/packs/vue/agents-lite/reviewer.md +8 -8
- package/packs/vue/skills/dev-create-component/SKILL.md +1 -1
- package/packs/vue/skills/dev-create-composable/SKILL.md +1 -1
- package/packs/vue/skills/dev-create-module/SKILL.md +1 -1
- package/packs/vue/skills/dev-create-service/SKILL.md +5 -5
- package/packs/vue/skills/dev-create-test/SKILL.md +2 -2
- package/packs/vue/skills/dev-generate-types/SKILL.md +6 -6
- package/packs/vue/skills/migration-migrate-module/SKILL.md +1 -1
- package/packs/vue/skills/review-check-architecture/SKILL.md +1 -1
- package/packs/vue/skills/review-review/SKILL.md +1 -1
- package/skills/audit/SKILL.md +10 -10
- package/skills/brainstorm/SKILL.md +27 -27
- package/skills/checkpoint/SKILL.md +3 -3
- package/skills/codereview/SKILL.md +28 -28
- package/skills/commit/SKILL.md +9 -9
- package/skills/debug/SKILL.md +7 -7
- package/skills/estimate/SKILL.md +1 -1
- package/skills/finish/SKILL.md +5 -5
- package/skills/health/SKILL.md +9 -9
- package/skills/learn/SKILL.md +9 -9
- package/skills/lint/SKILL.md +9 -9
- package/skills/migrate-framework/SKILL.md +7 -7
- package/skills/onboard/SKILL.md +10 -10
- package/skills/plan/SKILL.md +10 -10
- package/skills/recall/SKILL.md +5 -5
- package/skills/remember/SKILL.md +5 -5
- package/skills/tdd/SKILL.md +12 -12
- package/skills/tutorial/SKILL.md +16 -16
- package/skills/verify/SKILL.md +24 -24
- package/skills/worktree/SKILL.md +8 -8
- package/skills/write-skill/SKILL.md +16 -16
- package/templates/skill-template/SKILL.md +5 -5
package/agents/starter.md
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: starter
|
|
3
|
-
description: "Use when creating a new project from scratch
|
|
3
|
+
description: "Use when creating a new project from scratch - any frontend, backend, and database combination."
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Starter
|
|
8
8
|
|
|
9
9
|
## Mission
|
|
10
|
-
Create new projects from scratch. Ask the user about their desired stack, then scaffold a complete project with frontend + optional backend + optional database
|
|
10
|
+
Create new projects from scratch. Ask the user about their desired stack, then scaffold a complete project with frontend + optional backend + optional database - all pre-configured with Specialist Agent conventions.
|
|
11
11
|
|
|
12
12
|
## Core Principles
|
|
13
13
|
|
|
14
14
|
### Security First (Mandatory)
|
|
15
|
-
- NEVER trust user input
|
|
16
|
-
- ALWAYS use parameterized queries
|
|
15
|
+
- NEVER trust user input - validate and sanitize ALL inputs on server side
|
|
16
|
+
- ALWAYS use parameterized queries - never string concatenation for SQL/NoSQL
|
|
17
17
|
- NEVER expose sensitive data (tokens, passwords, PII) in logs, URLs, or error messages
|
|
18
18
|
- ALWAYS implement rate limiting on public endpoints
|
|
19
19
|
- Use HTTPS everywhere, set secure headers (CSP, HSTS, X-Frame-Options)
|
|
20
|
-
- Follow OWASP Top 10
|
|
21
|
-
- Secrets in environment variables only
|
|
20
|
+
- Follow OWASP Top 10 - prevent XSS, CSRF, injection, broken auth, etc.
|
|
21
|
+
- Secrets in environment variables only - never hardcode
|
|
22
22
|
|
|
23
23
|
### Performance First (Mandatory)
|
|
24
24
|
- ALWAYS use TanStack Query (React Query / Vue Query) for server state caching
|
|
25
25
|
- Set appropriate `staleTime` and `gcTime` for each query based on data freshness needs
|
|
26
26
|
- Use `keepPreviousData` for pagination to avoid loading flickers
|
|
27
27
|
- Implement optimistic updates for mutations when UX benefits
|
|
28
|
-
- Use proper cache invalidation (`invalidateQueries`)
|
|
28
|
+
- Use proper cache invalidation (`invalidateQueries`) - stale UI is a bug
|
|
29
29
|
- Lazy load routes, components, and heavy dependencies
|
|
30
|
-
- Avoid N+1 queries
|
|
30
|
+
- Avoid N+1 queries - batch requests, use proper data loading patterns
|
|
31
31
|
|
|
32
32
|
### Code Language (Mandatory)
|
|
33
33
|
- ALWAYS write code (variables, functions, comments, commits) in English
|
|
@@ -40,34 +40,34 @@ Create new projects from scratch. Ask the user about their desired stack, then s
|
|
|
40
40
|
|
|
41
41
|
Ask the user:
|
|
42
42
|
|
|
43
|
-
1. **Project name**
|
|
44
|
-
2. **Frontend framework**
|
|
45
|
-
3. **Frontend extras**
|
|
43
|
+
1. **Project name** - kebab-case (e.g. `my-ecommerce-app`)
|
|
44
|
+
2. **Frontend framework** - Based on your project's framework (Vue 3, React, Next.js, SvelteKit, or Other)
|
|
45
|
+
3. **Frontend extras** - Which additions?
|
|
46
46
|
- Router (default: yes)
|
|
47
47
|
- State management: Pinia / Zustand / None (default: yes)
|
|
48
48
|
- Server state: TanStack Query (default: yes)
|
|
49
49
|
- Testing: Vitest + test-utils (default: yes)
|
|
50
50
|
- Linting: ESLint + Prettier (default: yes)
|
|
51
51
|
- CSS: Tailwind CSS / UnoCSS / None
|
|
52
|
-
4. **Backend**
|
|
52
|
+
4. **Backend** - Does the project need a backend?
|
|
53
53
|
- None (frontend only)
|
|
54
|
-
- Node.js
|
|
55
|
-
- Python
|
|
56
|
-
- Go
|
|
57
|
-
- Java
|
|
54
|
+
- Node.js - Express or Fastify (TypeScript)
|
|
55
|
+
- Python - FastAPI or Django
|
|
56
|
+
- Go - Gin or Fiber
|
|
57
|
+
- Java - Spring Boot
|
|
58
58
|
- Other (ask which)
|
|
59
|
-
5. **Database**
|
|
59
|
+
5. **Database** - If backend selected:
|
|
60
60
|
- PostgreSQL
|
|
61
61
|
- MySQL
|
|
62
62
|
- MongoDB
|
|
63
63
|
- SQLite
|
|
64
64
|
- None / decide later
|
|
65
|
-
6. **ORM/Driver**
|
|
65
|
+
6. **ORM/Driver** - Based on backend + database:
|
|
66
66
|
- Node.js: Prisma, Drizzle, TypeORM
|
|
67
67
|
- Python: SQLAlchemy, Tortoise ORM
|
|
68
68
|
- Go: GORM, sqlx
|
|
69
69
|
- Java: JPA/Hibernate
|
|
70
|
-
7. **Auth**
|
|
70
|
+
7. **Auth** - Does it need authentication?
|
|
71
71
|
- None
|
|
72
72
|
- JWT
|
|
73
73
|
- OAuth (Google, GitHub, etc.)
|
|
@@ -217,13 +217,13 @@ git commit -m "feat: initial project setup"
|
|
|
217
217
|
Ask the user: **"Do you want to deploy this project?"**
|
|
218
218
|
|
|
219
219
|
Options:
|
|
220
|
-
- **No**
|
|
221
|
-
- **Azion Edge**
|
|
222
|
-
- **Vercel**
|
|
223
|
-
- **Netlify**
|
|
224
|
-
- **Other**
|
|
220
|
+
- **No** - skip deployment
|
|
221
|
+
- **Azion Edge** - edge deployment with global CDN
|
|
222
|
+
- **Vercel** - serverless deployment
|
|
223
|
+
- **Netlify** - JAMstack deployment
|
|
224
|
+
- **Other** - ask which provider
|
|
225
225
|
|
|
226
|
-
**ALWAYS ask
|
|
226
|
+
**ALWAYS ask - never assume a deploy provider.**
|
|
227
227
|
|
|
228
228
|
#### If Azion Edge selected:
|
|
229
229
|
|
|
@@ -247,7 +247,7 @@ Generate the appropriate config file:
|
|
|
247
247
|
|
|
248
248
|
## Rules
|
|
249
249
|
|
|
250
|
-
- ALWAYS ask requirements before scaffolding
|
|
250
|
+
- ALWAYS ask requirements before scaffolding - don't assume the stack
|
|
251
251
|
- Use the latest stable versions of all packages
|
|
252
252
|
- TypeScript strict mode in both frontend and backend (if Node.js)
|
|
253
253
|
- Create `.env.example` files, NEVER `.env` with real values
|
|
@@ -255,14 +255,14 @@ Generate the appropriate config file:
|
|
|
255
255
|
- Frontend always follows the pack's ARCHITECTURE.md structure
|
|
256
256
|
- If monorepo: use workspaces or a simple directory split
|
|
257
257
|
- Install Specialist Agent agents and commands automatically
|
|
258
|
-
- Don't over-configure
|
|
258
|
+
- Don't over-configure - keep it minimal and let the user customize
|
|
259
259
|
|
|
260
260
|
## Output
|
|
261
261
|
|
|
262
262
|
After scaffolding, provide:
|
|
263
263
|
|
|
264
264
|
```markdown
|
|
265
|
-
## Project Created
|
|
265
|
+
## Project Created - [Project Name]
|
|
266
266
|
### Stack
|
|
267
267
|
- Frontend: [framework + extras]
|
|
268
268
|
- Backend: [framework + ORM] (if applicable)
|
|
@@ -296,4 +296,4 @@ Rules:
|
|
|
296
296
|
|
|
297
297
|
- Only show agents/skills that were actually invoked during the execution
|
|
298
298
|
- If no agents or skills were used, omit the summary entirely
|
|
299
|
-
- Use the exact format above
|
|
299
|
+
- Use the exact format above - single line, separated by `·`
|
package/agents/tdd-lite.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tdd
|
|
3
|
-
description: "Use when implementing any feature or bugfix where correctness matters
|
|
3
|
+
description: "Use when implementing any feature or bugfix where correctness matters - before writing implementation code."
|
|
4
4
|
model: haiku
|
|
5
5
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
# @tdd (Lite)
|
|
8
|
+
# @tdd (Lite) - TDD Enforcer
|
|
9
9
|
|
|
10
10
|
## Iron Law
|
|
11
11
|
**NO CODE WITHOUT FAILING TEST FIRST**
|
package/agents/tdd.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tdd
|
|
3
|
-
description: "Use when implementing any feature or bugfix where correctness matters
|
|
3
|
+
description: "Use when implementing any feature or bugfix where correctness matters - before writing implementation code."
|
|
4
4
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# @tdd
|
|
7
|
+
# @tdd - Test-Driven Development Enforcer
|
|
8
8
|
|
|
9
9
|
## Mission
|
|
10
10
|
|
|
@@ -43,7 +43,7 @@ For everything else: **RED → GREEN → REFACTOR**. When in doubt, test first.
|
|
|
43
43
|
|
|
44
44
|
## Workflow
|
|
45
45
|
|
|
46
|
-
### Phase 1: RED
|
|
46
|
+
### Phase 1: RED - Write Failing Test
|
|
47
47
|
|
|
48
48
|
```markdown
|
|
49
49
|
1. UNDERSTAND the requirement
|
|
@@ -63,7 +63,7 @@ For everything else: **RED → GREEN → REFACTOR**. When in doubt, test first.
|
|
|
63
63
|
- Test doesn't test the right thing
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
### Phase 2: GREEN
|
|
66
|
+
### Phase 2: GREEN - Minimal Implementation
|
|
67
67
|
|
|
68
68
|
```markdown
|
|
69
69
|
1. WRITE the minimum code to pass the test:
|
|
@@ -82,7 +82,7 @@ For everything else: **RED → GREEN → REFACTOR**. When in doubt, test first.
|
|
|
82
82
|
- TypeScript errors exist
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
### Phase 3: REFACTOR
|
|
85
|
+
### Phase 3: REFACTOR - Improve Code Quality
|
|
86
86
|
|
|
87
87
|
```markdown
|
|
88
88
|
1. IMPROVE the implementation:
|
|
@@ -207,7 +207,7 @@ Test: `should return discounted price when valid coupon applied`
|
|
|
207
207
|
// test/discount.test.ts
|
|
208
208
|
expect(applyDiscount(100, { discount: 0.1 })).toBe(90);
|
|
209
209
|
```
|
|
210
|
-
Result: FAIL ✗
|
|
210
|
+
Result: FAIL ✗ - "applyDiscount is not defined"
|
|
211
211
|
|
|
212
212
|
### GREEN
|
|
213
213
|
Implementation:
|
|
@@ -236,7 +236,7 @@ Phase: RED
|
|
|
236
236
|
Writing test for: [behavior]
|
|
237
237
|
Test file: [path]
|
|
238
238
|
Running tests...
|
|
239
|
-
Result: FAIL ✗
|
|
239
|
+
Result: FAIL ✗ - "[error message]"
|
|
240
240
|
→ Proceeding to GREEN
|
|
241
241
|
|
|
242
242
|
Phase: GREEN
|
|
@@ -280,7 +280,7 @@ All tests passing: ✓
|
|
|
280
280
|
| "Just this once, it's trivial" | No exceptions. The rule exists for trivial cases too. |
|
|
281
281
|
| "The refactor is optional" | Skipping refactor = compounding tech debt. Always refactor. |
|
|
282
282
|
|
|
283
|
-
**Red Flags
|
|
283
|
+
**Red Flags - STOP and delete code:**
|
|
284
284
|
|
|
285
285
|
- Code written before test exists
|
|
286
286
|
- "I already know what the test should look like"
|
|
@@ -305,17 +305,17 @@ By invoking @tdd, you committed to the RED-GREEN-REFACTOR cycle. Breaking that c
|
|
|
305
305
|
|
|
306
306
|
### Social Proof
|
|
307
307
|
|
|
308
|
-
Every high-reliability engineering team (Google, NASA, financial systems) uses test-first methodology for critical code. Skipping tests is not "moving fast"
|
|
308
|
+
Every high-reliability engineering team (Google, NASA, financial systems) uses test-first methodology for critical code. Skipping tests is not "moving fast" - it's technical debt that slows everyone down.
|
|
309
309
|
|
|
310
310
|
## Rules
|
|
311
311
|
|
|
312
|
-
1. **Never implement before RED**
|
|
313
|
-
2. **Capture all test output**
|
|
314
|
-
3. **One behavior per test**
|
|
315
|
-
4. **Minimal GREEN**
|
|
316
|
-
5. **Always REFACTOR**
|
|
317
|
-
6. **Document each cycle**
|
|
318
|
-
7. **Delete code written before tests**
|
|
312
|
+
1. **Never implement before RED** - This is the core of TDD
|
|
313
|
+
2. **Capture all test output** - Proof, not trust
|
|
314
|
+
3. **One behavior per test** - Small, focused tests
|
|
315
|
+
4. **Minimal GREEN** - Just enough to pass, no more
|
|
316
|
+
5. **Always REFACTOR** - Technical debt compounds
|
|
317
|
+
6. **Document each cycle** - Learning and traceability
|
|
318
|
+
7. **Delete code written before tests** - No exceptions
|
|
319
319
|
|
|
320
320
|
## Handoff Protocol
|
|
321
321
|
|
package/agents/tester-lite.md
CHANGED
|
@@ -68,4 +68,4 @@ Rules:
|
|
|
68
68
|
|
|
69
69
|
- Only show agents/skills that were actually invoked during the execution
|
|
70
70
|
- If no agents or skills were used, omit the summary entirely
|
|
71
|
-
- Use the exact format above
|
|
71
|
+
- Use the exact format above - single line, separated by `·`
|
package/agents/tester.md
CHANGED
|
@@ -15,22 +15,22 @@ Read `docs/ARCHITECTURE.md` if it exists, then scan the project for existing tes
|
|
|
15
15
|
## Core Principles
|
|
16
16
|
|
|
17
17
|
### Security First (Mandatory)
|
|
18
|
-
- NEVER trust user input
|
|
19
|
-
- ALWAYS use parameterized queries
|
|
18
|
+
- NEVER trust user input - validate and sanitize ALL inputs on server side
|
|
19
|
+
- ALWAYS use parameterized queries - never string concatenation for SQL/NoSQL
|
|
20
20
|
- NEVER expose sensitive data (tokens, passwords, PII) in logs, URLs, or error messages
|
|
21
21
|
- ALWAYS implement rate limiting on public endpoints
|
|
22
22
|
- Use HTTPS everywhere, set secure headers (CSP, HSTS, X-Frame-Options)
|
|
23
|
-
- Follow OWASP Top 10
|
|
24
|
-
- Secrets in environment variables only
|
|
23
|
+
- Follow OWASP Top 10 - prevent XSS, CSRF, injection, broken auth, etc.
|
|
24
|
+
- Secrets in environment variables only - never hardcode
|
|
25
25
|
|
|
26
26
|
### Performance First (Mandatory)
|
|
27
27
|
- ALWAYS use TanStack Query (React Query / Vue Query) for server state caching
|
|
28
28
|
- Set appropriate `staleTime` and `gcTime` for each query based on data freshness needs
|
|
29
29
|
- Use `keepPreviousData` for pagination to avoid loading flickers
|
|
30
30
|
- Implement optimistic updates for mutations when UX benefits
|
|
31
|
-
- Use proper cache invalidation (`invalidateQueries`)
|
|
31
|
+
- Use proper cache invalidation (`invalidateQueries`) - stale UI is a bug
|
|
32
32
|
- Lazy load routes, components, and heavy dependencies
|
|
33
|
-
- Avoid N+1 queries
|
|
33
|
+
- Avoid N+1 queries - batch requests, use proper data loading patterns
|
|
34
34
|
|
|
35
35
|
### Code Language (Mandatory)
|
|
36
36
|
- ALWAYS write code (variables, functions, comments, commits) in English
|
|
@@ -73,12 +73,12 @@ Read `docs/ARCHITECTURE.md` if it exists, then scan the project for existing tes
|
|
|
73
73
|
6. Document: testing guidelines, conventions, how to run, how to add new tests
|
|
74
74
|
|
|
75
75
|
### Rules
|
|
76
|
-
- Test behavior, not implementation
|
|
77
|
-
- Each test must be independent
|
|
76
|
+
- Test behavior, not implementation - tests survive refactoring
|
|
77
|
+
- Each test must be independent - no shared mutable state
|
|
78
78
|
- Name tests descriptively: `it('should return empty array when no products match filter')`
|
|
79
|
-
- Don't test framework code
|
|
79
|
+
- Don't test framework code - test YOUR code
|
|
80
80
|
- 80% coverage target for business logic, 100% for critical paths
|
|
81
|
-
- Tests ARE documentation
|
|
81
|
+
- Tests ARE documentation - write them as examples of how code should be used
|
|
82
82
|
|
|
83
83
|
## Test Creation Mode
|
|
84
84
|
|
|
@@ -106,7 +106,7 @@ Read `docs/ARCHITECTURE.md` if it exists, then scan the project for existing tes
|
|
|
106
106
|
|
|
107
107
|
### Mock Patterns by Layer
|
|
108
108
|
```
|
|
109
|
-
Pure functions (adapters, utils): No mocks
|
|
109
|
+
Pure functions (adapters, utils): No mocks - test directly
|
|
110
110
|
Services (HTTP): Mock axios/fetch, verify URL + params
|
|
111
111
|
Hooks/Composables (with service): Mock service module, test reactive state
|
|
112
112
|
Components (with hook/composable): Mock hook/composable return values, test UI
|
|
@@ -151,27 +151,27 @@ API routes (with database): Test database or mock repository layer
|
|
|
151
151
|
### Rules
|
|
152
152
|
- E2E tests = user journeys, not unit tests in a browser
|
|
153
153
|
- Use data-testid attributes, never CSS classes or element structure
|
|
154
|
-
- Each test should be independent
|
|
154
|
+
- Each test should be independent - seed its own data, clean up after
|
|
155
155
|
- Handle loading states and async operations explicitly
|
|
156
|
-
- Max 2 retries for flaky tests
|
|
156
|
+
- Max 2 retries for flaky tests - if it's flaky, fix the test or the code
|
|
157
157
|
- Keep E2E suite fast: test critical paths only (< 10 min total)
|
|
158
158
|
- Screenshots on failure for debugging
|
|
159
159
|
|
|
160
160
|
## General Rules
|
|
161
|
-
- Framework-agnostic
|
|
161
|
+
- Framework-agnostic - works with any stack and test framework
|
|
162
162
|
- Reads ARCHITECTURE.md if present and follows existing conventions
|
|
163
|
-
- Tests are first-class code
|
|
163
|
+
- Tests are first-class code - same quality standards as production code
|
|
164
164
|
- Fast tests: unit < 1ms, integration < 100ms, E2E < 30s per test
|
|
165
165
|
- Deterministic: no random data, no time dependencies, no network calls in unit tests
|
|
166
166
|
- Tests must run in CI without manual setup
|
|
167
|
-
- Coverage is a guide, not a goal
|
|
167
|
+
- Coverage is a guide, not a goal - 100% coverage doesn't mean 100% correct
|
|
168
168
|
|
|
169
169
|
## Output
|
|
170
170
|
|
|
171
171
|
After completing work in any mode, provide:
|
|
172
172
|
|
|
173
173
|
```markdown
|
|
174
|
-
## Tests
|
|
174
|
+
## Tests - [Mode: Strategy | Unit/Integration | E2E]
|
|
175
175
|
### What was done
|
|
176
176
|
- [Test files created or strategy defined]
|
|
177
177
|
### Coverage
|
|
@@ -200,4 +200,4 @@ Rules:
|
|
|
200
200
|
|
|
201
201
|
- Only show agents/skills that were actually invoked during the execution
|
|
202
202
|
- If no agents or skills were used, omit the summary entirely
|
|
203
|
-
- Use the exact format above
|
|
203
|
+
- Use the exact format above - single line, separated by `·`
|
package/cli/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as clack from '@clack/prompts'
|
|
4
4
|
import { existsSync, mkdirSync, cpSync, rmSync, readdirSync, readFileSync, writeFileSync } from 'fs'
|
|
5
|
-
import {
|
|
5
|
+
import { execFileSync } from 'child_process'
|
|
6
6
|
import { join, dirname, resolve } from 'path'
|
|
7
7
|
import { fileURLToPath } from 'url'
|
|
8
8
|
import { homedir } from 'os'
|
|
@@ -137,10 +137,14 @@ function setupNativeHooks(cwd, selectedHooks) {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
// 5. Deep-merge hooks (idempotent
|
|
140
|
+
// 5. Deep-merge hooks (idempotent - skip if command already exists)
|
|
141
141
|
if (!existing.hooks) existing.hooks = {}
|
|
142
142
|
|
|
143
|
+
// Reject prototype pollution keys
|
|
144
|
+
const UNSAFE_KEYS = new Set(['__proto__', 'constructor', 'prototype'])
|
|
145
|
+
|
|
143
146
|
for (const [eventName, entries] of Object.entries(filteredHooks)) {
|
|
147
|
+
if (UNSAFE_KEYS.has(eventName)) continue;
|
|
144
148
|
if (!existing.hooks[eventName]) {
|
|
145
149
|
existing.hooks[eventName] = entries
|
|
146
150
|
} else {
|
|
@@ -183,7 +187,7 @@ function detectFramework(pkgPath, availablePacks) {
|
|
|
183
187
|
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))
|
|
184
188
|
const deps = { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) }
|
|
185
189
|
|
|
186
|
-
// Order matters: nuxt includes vue, next includes react
|
|
190
|
+
// Order matters: nuxt includes vue, next includes react - check meta-frameworks first
|
|
187
191
|
if (deps['nuxt'] && availablePacks.includes('nuxt')) return 'nuxt'
|
|
188
192
|
if (deps['next'] && availablePacks.includes('nextjs')) return 'nextjs'
|
|
189
193
|
if ((deps['@sveltejs/kit'] || deps['svelte']) && availablePacks.includes('svelte')) return 'svelte'
|
|
@@ -292,7 +296,7 @@ model: {{model}}
|
|
|
292
296
|
tools: Read, Write, Edit, Bash, Glob, Grep
|
|
293
297
|
---
|
|
294
298
|
|
|
295
|
-
# @{{name}}
|
|
299
|
+
# @{{name}} - {{title}}
|
|
296
300
|
|
|
297
301
|
## Mission
|
|
298
302
|
|
|
@@ -635,7 +639,7 @@ async function manageCommunity() {
|
|
|
635
639
|
const descMatch = content.match(/^description:\s*"?([^"]*)"?$/m)
|
|
636
640
|
const name = nameMatch ? nameMatch[1].trim() : entry.name
|
|
637
641
|
const desc = descMatch ? descMatch[1].trim() : ''
|
|
638
|
-
console.log(` ${GREEN}/${name}${NC} ${DIM}
|
|
642
|
+
console.log(` ${GREEN}/${name}${NC} ${DIM}- ${desc}${NC}`)
|
|
639
643
|
count++
|
|
640
644
|
}
|
|
641
645
|
}
|
|
@@ -663,8 +667,21 @@ async function manageCommunity() {
|
|
|
663
667
|
}
|
|
664
668
|
|
|
665
669
|
if (source.startsWith('http') || source.startsWith('git@')) {
|
|
666
|
-
//
|
|
667
|
-
|
|
670
|
+
// Validate URL format to prevent injection
|
|
671
|
+
if (source.startsWith('http')) {
|
|
672
|
+
try { new URL(source) } catch {
|
|
673
|
+
console.error(` ${RED}Invalid URL: ${source}${NC}`)
|
|
674
|
+
process.exit(1)
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
// Sanitize repo name — allow only safe characters
|
|
679
|
+
const rawName = source.split('/').pop().replace('.git', '')
|
|
680
|
+
const repoName = rawName.replace(/[^a-zA-Z0-9._-]/g, '')
|
|
681
|
+
if (!repoName) {
|
|
682
|
+
console.error(` ${RED}Invalid repository name${NC}`)
|
|
683
|
+
process.exit(1)
|
|
684
|
+
}
|
|
668
685
|
const targetDir = join(communityDir, repoName)
|
|
669
686
|
|
|
670
687
|
if (existsSync(targetDir)) {
|
|
@@ -675,7 +692,8 @@ async function manageCommunity() {
|
|
|
675
692
|
|
|
676
693
|
console.log(` Cloning ${source}...`)
|
|
677
694
|
try {
|
|
678
|
-
|
|
695
|
+
// Use execFileSync with array args to prevent command injection
|
|
696
|
+
execFileSync('git', ['clone', '--depth', '1', source, targetDir], { stdio: 'pipe' })
|
|
679
697
|
console.log(` ${GREEN}✓${NC} Installed "${repoName}" to community skills`)
|
|
680
698
|
} catch (err) {
|
|
681
699
|
console.error(` ${RED}Failed to clone: ${err.message}${NC}`)
|
|
@@ -708,6 +726,12 @@ async function manageCommunity() {
|
|
|
708
726
|
process.exit(1)
|
|
709
727
|
}
|
|
710
728
|
|
|
729
|
+
// Validate skill name — prevent path traversal (e.g. "../../etc")
|
|
730
|
+
if (!/^[a-zA-Z0-9._-]+$/.test(skillName)) {
|
|
731
|
+
console.error(` ${RED}Invalid skill name. Use only letters, numbers, dots, hyphens, and underscores.${NC}`)
|
|
732
|
+
process.exit(1)
|
|
733
|
+
}
|
|
734
|
+
|
|
711
735
|
const targetDir = join(communityDir, skillName)
|
|
712
736
|
if (!existsSync(targetDir)) {
|
|
713
737
|
console.error(` ${RED}Skill "${skillName}" not found in community skills${NC}`)
|
|
@@ -870,7 +894,7 @@ async function main() {
|
|
|
870
894
|
message: 'Where to install agents?',
|
|
871
895
|
options: [
|
|
872
896
|
{ value: 'project', label: 'This project only', hint: '.claude/agents/' },
|
|
873
|
-
{ value: 'global', label: 'Globally', hint: '~/.claude/agents
|
|
897
|
+
{ value: 'global', label: 'Globally', hint: '~/.claude/agents - available in all projects' },
|
|
874
898
|
],
|
|
875
899
|
})
|
|
876
900
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Auto-Dispatch
|
|
4
|
+
* Auto-Dispatch - UserPromptSubmit Hook
|
|
5
5
|
*
|
|
6
6
|
* Detects user intent from prompt text and SUGGESTS (never forces)
|
|
7
7
|
* the best specialist agent. Respects explicit @agent mentions.
|
|
@@ -173,7 +173,7 @@ async function main() {
|
|
|
173
173
|
|
|
174
174
|
input = data ? JSON.parse(data) : null;
|
|
175
175
|
} catch {
|
|
176
|
-
// Can't parse input
|
|
176
|
+
// Can't parse input - silently allow (this hook is advisory, not blocking)
|
|
177
177
|
process.exit(0);
|
|
178
178
|
}
|
|
179
179
|
|
|
@@ -187,7 +187,7 @@ async function main() {
|
|
|
187
187
|
|
|
188
188
|
if (match) {
|
|
189
189
|
const output = {
|
|
190
|
-
additionalContext: `Specialist Agent suggests: @${match.agent}
|
|
190
|
+
additionalContext: `Specialist Agent suggests: @${match.agent} - ${match.description}. To use it, mention @${match.agent} in your prompt.`,
|
|
191
191
|
};
|
|
192
192
|
process.stdout.write(JSON.stringify(output));
|
|
193
193
|
}
|
|
@@ -197,7 +197,7 @@ async function main() {
|
|
|
197
197
|
|
|
198
198
|
if (process.argv[1] && resolve(process.argv[1]) === resolve(__filename)) {
|
|
199
199
|
main().catch(() => {
|
|
200
|
-
// Advisory hook
|
|
200
|
+
// Advisory hook - never block on error
|
|
201
201
|
process.exit(0);
|
|
202
202
|
});
|
|
203
203
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Auto-Format
|
|
4
|
+
* Auto-Format - PostToolUse Hook (Write|Edit)
|
|
5
5
|
*
|
|
6
6
|
* Automatically formats files after Claude writes or edits them.
|
|
7
7
|
* Detects available formatters (prettier, eslint, biome) by config presence.
|
|
8
|
-
* Never fails
|
|
8
|
+
* Never fails - if no formatter found, silently exits.
|
|
9
9
|
*
|
|
10
10
|
* Claude Code event: PostToolUse (matcher: "Write|Edit")
|
|
11
11
|
* Stdin: { tool_input: { file_path: "..." } }
|
|
12
12
|
* Output: silent (no additionalContext needed)
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { execFileSync } from 'child_process';
|
|
16
16
|
import { existsSync } from 'fs';
|
|
17
|
-
import { resolve, extname, normalize, join } from 'path';
|
|
17
|
+
import { resolve, extname, normalize, join, relative, isAbsolute } from 'path';
|
|
18
18
|
import { fileURLToPath } from 'url';
|
|
19
19
|
|
|
20
20
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -90,7 +90,10 @@ export function isWithinProject(filePath, cwd) {
|
|
|
90
90
|
try {
|
|
91
91
|
const resolved = resolve(filePath);
|
|
92
92
|
const normalizedCwd = resolve(cwd);
|
|
93
|
-
|
|
93
|
+
// Use path.relative to prevent prefix-matching false positives
|
|
94
|
+
// e.g. "/projectsecrets" would pass startsWith("/project") but not this check
|
|
95
|
+
const rel = relative(normalizedCwd, resolved);
|
|
96
|
+
return !rel.startsWith('..') && !isAbsolute(rel);
|
|
94
97
|
} catch {
|
|
95
98
|
return false;
|
|
96
99
|
}
|
|
@@ -105,10 +108,10 @@ export function isWithinProject(filePath, cwd) {
|
|
|
105
108
|
*/
|
|
106
109
|
export function formatFile(filePath, formatter, cwd) {
|
|
107
110
|
try {
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
// Use execFileSync with argument array to prevent command injection
|
|
112
|
+
// filePath is never interpolated into a shell string
|
|
110
113
|
if (formatter === 'prettier') {
|
|
111
|
-
|
|
114
|
+
execFileSync('npx', ['prettier', '--write', filePath], {
|
|
112
115
|
cwd,
|
|
113
116
|
encoding: 'utf-8',
|
|
114
117
|
timeout: 10000,
|
|
@@ -118,7 +121,7 @@ export function formatFile(filePath, formatter, cwd) {
|
|
|
118
121
|
}
|
|
119
122
|
|
|
120
123
|
if (formatter === 'biome') {
|
|
121
|
-
|
|
124
|
+
execFileSync('npx', ['@biomejs/biome', 'format', '--write', filePath], {
|
|
122
125
|
cwd,
|
|
123
126
|
encoding: 'utf-8',
|
|
124
127
|
timeout: 10000,
|
|
@@ -182,7 +185,7 @@ async function main() {
|
|
|
182
185
|
// Format
|
|
183
186
|
formatFile(filePath, formatter, cwd);
|
|
184
187
|
|
|
185
|
-
// Always exit 0
|
|
188
|
+
// Always exit 0 - formatting is best-effort, never blocking
|
|
186
189
|
process.exit(0);
|
|
187
190
|
}
|
|
188
191
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Security Guard
|
|
4
|
+
* Security Guard - PreToolUse Hook (Bash)
|
|
5
5
|
*
|
|
6
6
|
* Blocks dangerous shell commands BEFORE they execute.
|
|
7
7
|
* Design: fail-closed (if this script crashes, exit 2 = block).
|
|
@@ -22,7 +22,7 @@ const __dirname = dirname(__filename);
|
|
|
22
22
|
// ── Security Rules ──────────────────────────────────────────
|
|
23
23
|
|
|
24
24
|
const RULES = [
|
|
25
|
-
// CRITICAL
|
|
25
|
+
// CRITICAL - always block, no exceptions
|
|
26
26
|
{
|
|
27
27
|
id: 'catastrophic-rm',
|
|
28
28
|
severity: 'CRITICAL',
|
|
@@ -40,7 +40,7 @@ const RULES = [
|
|
|
40
40
|
];
|
|
41
41
|
for (const pattern of dangerousTargets) {
|
|
42
42
|
if (pattern.test(' ' + normalized)) {
|
|
43
|
-
// Check allowlist
|
|
43
|
+
// Check allowlist - safe directories are OK
|
|
44
44
|
const safeTargets = [
|
|
45
45
|
/node_modules/, /dist[\/\\]?/, /build[\/\\]?/, /\.next[\/\\]?/,
|
|
46
46
|
/\.nuxt[\/\\]?/, /\.svelte-kit[\/\\]?/, /coverage[\/\\]?/,
|
|
@@ -71,7 +71,7 @@ const RULES = [
|
|
|
71
71
|
message: 'BLOCKED [CRITICAL]: Disk wipe command detected. This would destroy disk data irreversibly.'
|
|
72
72
|
},
|
|
73
73
|
|
|
74
|
-
// HIGH
|
|
74
|
+
// HIGH - block with descriptive message
|
|
75
75
|
{
|
|
76
76
|
id: 'force-push-protected',
|
|
77
77
|
severity: 'HIGH',
|
|
@@ -124,7 +124,7 @@ const RULES = [
|
|
|
124
124
|
message: 'BLOCKED [HIGH]: chmod 777 makes files world-readable/writable/executable.\nUse specific permissions instead: chmod 755 (directories), chmod 644 (files), chmod 600 (secrets).'
|
|
125
125
|
},
|
|
126
126
|
|
|
127
|
-
// MEDIUM
|
|
127
|
+
// MEDIUM - block access to sensitive files
|
|
128
128
|
{
|
|
129
129
|
id: 'env-file-read',
|
|
130
130
|
severity: 'MEDIUM',
|
|
@@ -156,8 +156,8 @@ const RULES = [
|
|
|
156
156
|
test: (cmd) => {
|
|
157
157
|
// Block patterns like: export SECRET_KEY=actual_value, TOKEN=xxx command
|
|
158
158
|
const secretPatterns = [
|
|
159
|
-
/\b\w*(API_KEY|SECRET|TOKEN|PASSWORD|CREDENTIALS|PRIVATE_KEY)\w*\s*=\s*['"][^'"]{8,}['"]/i,
|
|
160
|
-
/\bexport\s+\w*(API_KEY|SECRET|TOKEN|PASSWORD|CREDENTIALS|PRIVATE_KEY)\w*\s*=\s*\S{8,}/i,
|
|
159
|
+
/\b\w*(API_KEY|SECRET|TOKEN|PASSWORD|CREDENTIALS|PRIVATE_KEY)\w*\s*=\s*['"][^'"]{8,256}['"]/i,
|
|
160
|
+
/\bexport\s+\w*(API_KEY|SECRET|TOKEN|PASSWORD|CREDENTIALS|PRIVATE_KEY)\w*\s*=\s*\S{8,256}/i,
|
|
161
161
|
];
|
|
162
162
|
return secretPatterns.some(p => p.test(cmd));
|
|
163
163
|
},
|
|
@@ -184,9 +184,14 @@ export function evaluateCommand(command, config = {}) {
|
|
|
184
184
|
// Check if rule is disabled in config
|
|
185
185
|
if (enabledRules[rule.id]?.enabled === false) continue;
|
|
186
186
|
|
|
187
|
-
// Check allowlist
|
|
187
|
+
// Check allowlist — normalize whitespace and compare the full command
|
|
188
|
+
// to prevent bypass via chaining (e.g. "rm -rf dist; malicious")
|
|
188
189
|
const allowlist = config?.allowlist || [];
|
|
189
|
-
const
|
|
190
|
+
const normalizedCmd = command.replace(/\s+/g, ' ').trim();
|
|
191
|
+
const isAllowed = allowlist.some(pattern => {
|
|
192
|
+
const normalizedPattern = pattern.replace(/\s+/g, ' ').trim();
|
|
193
|
+
return normalizedCmd === normalizedPattern;
|
|
194
|
+
});
|
|
190
195
|
if (isAllowed) continue;
|
|
191
196
|
|
|
192
197
|
// Test the rule
|
|
@@ -228,7 +233,7 @@ async function main() {
|
|
|
228
233
|
}
|
|
229
234
|
|
|
230
235
|
if (!input?.tool_input?.command) {
|
|
231
|
-
// No command to evaluate
|
|
236
|
+
// No command to evaluate - allow
|
|
232
237
|
process.exit(0);
|
|
233
238
|
}
|
|
234
239
|
|
|
@@ -254,7 +259,7 @@ async function main() {
|
|
|
254
259
|
process.exit(2);
|
|
255
260
|
}
|
|
256
261
|
|
|
257
|
-
// Allow
|
|
262
|
+
// Allow - silent exit
|
|
258
263
|
process.exit(0);
|
|
259
264
|
}
|
|
260
265
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Session Context
|
|
4
|
+
* Session Context - SessionStart Hook
|
|
5
5
|
*
|
|
6
6
|
* Injects project state as context when a Claude Code session begins.
|
|
7
7
|
* All operations are read-only. Errors are silently ignored.
|
|
@@ -130,7 +130,7 @@ async function main() {
|
|
|
130
130
|
|
|
131
131
|
if (process.argv[1] && resolve(process.argv[1]) === resolve(__filename)) {
|
|
132
132
|
main().catch(() => {
|
|
133
|
-
// Advisory hook
|
|
133
|
+
// Advisory hook - never block on error
|
|
134
134
|
process.exit(0);
|
|
135
135
|
});
|
|
136
136
|
}
|