@su-record/vibe 2.3.0 → 2.3.2
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/settings.json +35 -35
- package/.claude/settings.local.json +24 -25
- package/.claude/vibe/constitution.md +184 -184
- package/.claude/vibe/rules/core/communication-guide.md +104 -104
- package/.claude/vibe/rules/core/development-philosophy.md +52 -52
- package/.claude/vibe/rules/core/quick-start.md +120 -120
- package/.claude/vibe/rules/languages/dart-flutter.md +509 -509
- package/.claude/vibe/rules/languages/go.md +396 -396
- package/.claude/vibe/rules/languages/java-spring.md +586 -586
- package/.claude/vibe/rules/languages/kotlin-android.md +491 -491
- package/.claude/vibe/rules/languages/python-django.md +371 -371
- package/.claude/vibe/rules/languages/python-fastapi.md +386 -386
- package/.claude/vibe/rules/languages/rust.md +425 -425
- package/.claude/vibe/rules/languages/swift-ios.md +516 -516
- package/.claude/vibe/rules/languages/typescript-nextjs.md +441 -441
- package/.claude/vibe/rules/languages/typescript-node.md +375 -375
- package/.claude/vibe/rules/languages/typescript-nuxt.md +521 -521
- package/.claude/vibe/rules/languages/typescript-react-native.md +446 -446
- package/.claude/vibe/rules/languages/typescript-react.md +525 -525
- package/.claude/vibe/rules/languages/typescript-vue.md +353 -353
- package/.claude/vibe/rules/quality/bdd-contract-testing.md +388 -388
- package/.claude/vibe/rules/quality/checklist.md +276 -276
- package/.claude/vibe/rules/quality/testing-strategy.md +437 -437
- package/.claude/vibe/rules/standards/anti-patterns.md +369 -369
- package/.claude/vibe/rules/standards/code-structure.md +291 -291
- package/.claude/vibe/rules/standards/complexity-metrics.md +312 -312
- package/.claude/vibe/rules/standards/naming-conventions.md +198 -198
- package/.claude/vibe/setup.sh +31 -31
- package/.claude/vibe/templates/constitution-template.md +184 -184
- package/.claude/vibe/templates/contract-backend-template.md +517 -517
- package/.claude/vibe/templates/contract-frontend-template.md +594 -594
- package/.claude/vibe/templates/feature-template.md +96 -96
- package/.claude/vibe/templates/spec-template.md +199 -199
- package/CLAUDE.md +345 -323
- package/LICENSE +21 -21
- package/README.md +744 -724
- package/agents/compounder.md +261 -261
- package/agents/diagrammer.md +178 -178
- package/agents/e2e-tester.md +266 -266
- package/agents/explorer.md +48 -48
- package/agents/implementer.md +53 -53
- package/agents/research/best-practices-agent.md +139 -139
- package/agents/research/codebase-patterns-agent.md +147 -147
- package/agents/research/framework-docs-agent.md +181 -181
- package/agents/research/security-advisory-agent.md +167 -167
- package/agents/review/architecture-reviewer.md +107 -107
- package/agents/review/complexity-reviewer.md +116 -116
- package/agents/review/data-integrity-reviewer.md +88 -88
- package/agents/review/git-history-reviewer.md +103 -103
- package/agents/review/performance-reviewer.md +86 -86
- package/agents/review/python-reviewer.md +152 -152
- package/agents/review/rails-reviewer.md +139 -139
- package/agents/review/react-reviewer.md +144 -144
- package/agents/review/security-reviewer.md +80 -80
- package/agents/review/simplicity-reviewer.md +140 -140
- package/agents/review/test-coverage-reviewer.md +116 -116
- package/agents/review/typescript-reviewer.md +127 -127
- package/agents/searcher.md +54 -54
- package/agents/simplifier.md +119 -119
- package/agents/tester.md +49 -49
- package/agents/ui-previewer.md +137 -137
- package/commands/vibe.analyze.md +245 -180
- package/commands/vibe.reason.md +223 -183
- package/commands/vibe.review.md +200 -136
- package/commands/vibe.run.md +838 -836
- package/commands/vibe.spec.md +419 -383
- package/commands/vibe.utils.md +101 -101
- package/commands/vibe.verify.md +282 -241
- package/dist/cli/index.js +385 -385
- package/dist/lib/MemoryManager.d.ts.map +1 -1
- package/dist/lib/MemoryManager.js +119 -114
- package/dist/lib/MemoryManager.js.map +1 -1
- package/dist/lib/PythonParser.js +108 -108
- package/dist/lib/gemini-mcp.js +15 -15
- package/dist/lib/gemini-oauth.js +35 -35
- package/dist/lib/gpt-mcp.js +17 -17
- package/dist/lib/gpt-oauth.js +44 -44
- package/dist/tools/analytics/getUsageAnalytics.js +12 -12
- package/dist/tools/index.d.ts +50 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +61 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/memory/createMemoryTimeline.js +10 -10
- package/dist/tools/memory/getMemoryGraph.js +12 -12
- package/dist/tools/memory/getSessionContext.js +9 -9
- package/dist/tools/memory/linkMemories.js +14 -14
- package/dist/tools/memory/listMemories.js +4 -4
- package/dist/tools/memory/recallMemory.js +4 -4
- package/dist/tools/memory/saveMemory.js +4 -4
- package/dist/tools/memory/searchMemoriesAdvanced.js +22 -22
- package/dist/tools/planning/generatePrd.js +46 -46
- package/dist/tools/prompt/enhancePromptGemini.js +160 -160
- package/dist/tools/reasoning/applyReasoningFramework.js +56 -56
- package/dist/tools/semantic/analyzeDependencyGraph.js +12 -12
- package/hooks/hooks.json +121 -103
- package/package.json +73 -69
- package/skills/git-worktree.md +178 -178
- package/skills/priority-todos.md +236 -236
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
# TypeScript Reviewer Agent
|
|
2
|
-
|
|
3
|
-
TypeScript 코드 전문 리뷰 에이전트
|
|
4
|
-
|
|
5
|
-
## Role
|
|
6
|
-
|
|
7
|
-
- 타입 안전성 검증
|
|
8
|
-
- ESLint/Prettier 규칙 준수
|
|
9
|
-
- 모던 TS 패턴 제안
|
|
10
|
-
- React/Node.js 베스트 프랙티스
|
|
11
|
-
|
|
12
|
-
## Model
|
|
13
|
-
|
|
14
|
-
**Haiku** (inherit) - 빠른 병렬 실행
|
|
15
|
-
|
|
16
|
-
## Checklist
|
|
17
|
-
|
|
18
|
-
### Type Safety
|
|
19
|
-
- [ ] `any` 타입 사용 최소화?
|
|
20
|
-
- [ ] 타입 가드 적절히 사용?
|
|
21
|
-
- [ ] `unknown` 대신 `any`?
|
|
22
|
-
- [ ] 유니온 타입 narrowing?
|
|
23
|
-
- [ ] 제네릭 적절히 활용?
|
|
24
|
-
|
|
25
|
-
### Strict Mode
|
|
26
|
-
- [ ] strictNullChecks 준수?
|
|
27
|
-
- [ ] noImplicitAny 준수?
|
|
28
|
-
- [ ] optional chaining (?.) 활용?
|
|
29
|
-
- [ ] nullish coalescing (??) 활용?
|
|
30
|
-
|
|
31
|
-
### Modern Patterns
|
|
32
|
-
- [ ] const assertion (as const)?
|
|
33
|
-
- [ ] satisfies 연산자?
|
|
34
|
-
- [ ] Template literal types?
|
|
35
|
-
- [ ] Discriminated unions?
|
|
36
|
-
|
|
37
|
-
### Error Handling
|
|
38
|
-
- [ ] 에러 타입 정의?
|
|
39
|
-
- [ ] Result/Either 패턴?
|
|
40
|
-
- [ ] async 에러 처리?
|
|
41
|
-
- [ ] 사용자 친화적 에러 메시지?
|
|
42
|
-
|
|
43
|
-
### Imports/Exports
|
|
44
|
-
- [ ] 배럴 exports 사용?
|
|
45
|
-
- [ ] 순환 의존성 없음?
|
|
46
|
-
- [ ] 타입 전용 import (import type)?
|
|
47
|
-
- [ ] 사용하지 않는 import?
|
|
48
|
-
|
|
49
|
-
### Performance
|
|
50
|
-
- [ ] 불필요한 리렌더링?
|
|
51
|
-
- [ ] 메모이제이션 (useMemo, useCallback)?
|
|
52
|
-
- [ ] 번들 사이즈 영향?
|
|
53
|
-
- [ ] 동적 import 활용?
|
|
54
|
-
|
|
55
|
-
## Framework Specific
|
|
56
|
-
|
|
57
|
-
### React
|
|
58
|
-
- [ ] 훅 규칙 준수 (Rules of Hooks)?
|
|
59
|
-
- [ ] 의존성 배열 완전?
|
|
60
|
-
- [ ] key prop 적절?
|
|
61
|
-
- [ ] 컴포넌트 분리 적절?
|
|
62
|
-
- [ ] 상태 관리 적절?
|
|
63
|
-
|
|
64
|
-
### Node.js/Express
|
|
65
|
-
- [ ] async 에러 미들웨어?
|
|
66
|
-
- [ ] 입력 검증 (zod, joi)?
|
|
67
|
-
- [ ] 환경 변수 타입 안전?
|
|
68
|
-
- [ ] 로깅 적절?
|
|
69
|
-
|
|
70
|
-
### Next.js
|
|
71
|
-
- [ ] App Router 패턴?
|
|
72
|
-
- [ ] Server/Client 컴포넌트 구분?
|
|
73
|
-
- [ ] 메타데이터 설정?
|
|
74
|
-
- [ ] 이미지 최적화?
|
|
75
|
-
|
|
76
|
-
## Output Format
|
|
77
|
-
|
|
78
|
-
```markdown
|
|
79
|
-
## 📘 TypeScript Review
|
|
80
|
-
|
|
81
|
-
### 🔴 P1 Critical
|
|
82
|
-
1. **Unsafe Type Assertion**
|
|
83
|
-
- 📍 Location: src/api/user.ts:42
|
|
84
|
-
```typescript
|
|
85
|
-
// Bad
|
|
86
|
-
const user = data as User; // No runtime check
|
|
87
|
-
|
|
88
|
-
// Good
|
|
89
|
-
const user = userSchema.parse(data); // Runtime validation
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### 🟡 P2 Important
|
|
93
|
-
2. **Missing Type Guard**
|
|
94
|
-
- 📍 Location: src/utils/parse.ts:23
|
|
95
|
-
```typescript
|
|
96
|
-
// Before
|
|
97
|
-
if (response.type === 'success') {
|
|
98
|
-
// response still has union type
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// After
|
|
102
|
-
function isSuccess(r: Response): r is SuccessResponse {
|
|
103
|
-
return r.type === 'success';
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### 🔵 P3 Suggestions
|
|
108
|
-
3. **Use satisfies for Type Checking**
|
|
109
|
-
- 📍 Location: src/config/routes.ts:5
|
|
110
|
-
```typescript
|
|
111
|
-
// Before
|
|
112
|
-
const routes: Routes = { ... };
|
|
113
|
-
|
|
114
|
-
// After (preserves literal types)
|
|
115
|
-
const routes = { ... } satisfies Routes;
|
|
116
|
-
```
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## Usage
|
|
120
|
-
|
|
121
|
-
```
|
|
122
|
-
Task(
|
|
123
|
-
model: "haiku",
|
|
124
|
-
subagent_type: "Explore",
|
|
125
|
-
prompt: "TypeScript review for [files]. Check type safety, React patterns."
|
|
126
|
-
)
|
|
127
|
-
```
|
|
1
|
+
# TypeScript Reviewer Agent
|
|
2
|
+
|
|
3
|
+
TypeScript 코드 전문 리뷰 에이전트
|
|
4
|
+
|
|
5
|
+
## Role
|
|
6
|
+
|
|
7
|
+
- 타입 안전성 검증
|
|
8
|
+
- ESLint/Prettier 규칙 준수
|
|
9
|
+
- 모던 TS 패턴 제안
|
|
10
|
+
- React/Node.js 베스트 프랙티스
|
|
11
|
+
|
|
12
|
+
## Model
|
|
13
|
+
|
|
14
|
+
**Haiku** (inherit) - 빠른 병렬 실행
|
|
15
|
+
|
|
16
|
+
## Checklist
|
|
17
|
+
|
|
18
|
+
### Type Safety
|
|
19
|
+
- [ ] `any` 타입 사용 최소화?
|
|
20
|
+
- [ ] 타입 가드 적절히 사용?
|
|
21
|
+
- [ ] `unknown` 대신 `any`?
|
|
22
|
+
- [ ] 유니온 타입 narrowing?
|
|
23
|
+
- [ ] 제네릭 적절히 활용?
|
|
24
|
+
|
|
25
|
+
### Strict Mode
|
|
26
|
+
- [ ] strictNullChecks 준수?
|
|
27
|
+
- [ ] noImplicitAny 준수?
|
|
28
|
+
- [ ] optional chaining (?.) 활용?
|
|
29
|
+
- [ ] nullish coalescing (??) 활용?
|
|
30
|
+
|
|
31
|
+
### Modern Patterns
|
|
32
|
+
- [ ] const assertion (as const)?
|
|
33
|
+
- [ ] satisfies 연산자?
|
|
34
|
+
- [ ] Template literal types?
|
|
35
|
+
- [ ] Discriminated unions?
|
|
36
|
+
|
|
37
|
+
### Error Handling
|
|
38
|
+
- [ ] 에러 타입 정의?
|
|
39
|
+
- [ ] Result/Either 패턴?
|
|
40
|
+
- [ ] async 에러 처리?
|
|
41
|
+
- [ ] 사용자 친화적 에러 메시지?
|
|
42
|
+
|
|
43
|
+
### Imports/Exports
|
|
44
|
+
- [ ] 배럴 exports 사용?
|
|
45
|
+
- [ ] 순환 의존성 없음?
|
|
46
|
+
- [ ] 타입 전용 import (import type)?
|
|
47
|
+
- [ ] 사용하지 않는 import?
|
|
48
|
+
|
|
49
|
+
### Performance
|
|
50
|
+
- [ ] 불필요한 리렌더링?
|
|
51
|
+
- [ ] 메모이제이션 (useMemo, useCallback)?
|
|
52
|
+
- [ ] 번들 사이즈 영향?
|
|
53
|
+
- [ ] 동적 import 활용?
|
|
54
|
+
|
|
55
|
+
## Framework Specific
|
|
56
|
+
|
|
57
|
+
### React
|
|
58
|
+
- [ ] 훅 규칙 준수 (Rules of Hooks)?
|
|
59
|
+
- [ ] 의존성 배열 완전?
|
|
60
|
+
- [ ] key prop 적절?
|
|
61
|
+
- [ ] 컴포넌트 분리 적절?
|
|
62
|
+
- [ ] 상태 관리 적절?
|
|
63
|
+
|
|
64
|
+
### Node.js/Express
|
|
65
|
+
- [ ] async 에러 미들웨어?
|
|
66
|
+
- [ ] 입력 검증 (zod, joi)?
|
|
67
|
+
- [ ] 환경 변수 타입 안전?
|
|
68
|
+
- [ ] 로깅 적절?
|
|
69
|
+
|
|
70
|
+
### Next.js
|
|
71
|
+
- [ ] App Router 패턴?
|
|
72
|
+
- [ ] Server/Client 컴포넌트 구분?
|
|
73
|
+
- [ ] 메타데이터 설정?
|
|
74
|
+
- [ ] 이미지 최적화?
|
|
75
|
+
|
|
76
|
+
## Output Format
|
|
77
|
+
|
|
78
|
+
```markdown
|
|
79
|
+
## 📘 TypeScript Review
|
|
80
|
+
|
|
81
|
+
### 🔴 P1 Critical
|
|
82
|
+
1. **Unsafe Type Assertion**
|
|
83
|
+
- 📍 Location: src/api/user.ts:42
|
|
84
|
+
```typescript
|
|
85
|
+
// Bad
|
|
86
|
+
const user = data as User; // No runtime check
|
|
87
|
+
|
|
88
|
+
// Good
|
|
89
|
+
const user = userSchema.parse(data); // Runtime validation
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 🟡 P2 Important
|
|
93
|
+
2. **Missing Type Guard**
|
|
94
|
+
- 📍 Location: src/utils/parse.ts:23
|
|
95
|
+
```typescript
|
|
96
|
+
// Before
|
|
97
|
+
if (response.type === 'success') {
|
|
98
|
+
// response still has union type
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// After
|
|
102
|
+
function isSuccess(r: Response): r is SuccessResponse {
|
|
103
|
+
return r.type === 'success';
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 🔵 P3 Suggestions
|
|
108
|
+
3. **Use satisfies for Type Checking**
|
|
109
|
+
- 📍 Location: src/config/routes.ts:5
|
|
110
|
+
```typescript
|
|
111
|
+
// Before
|
|
112
|
+
const routes: Routes = { ... };
|
|
113
|
+
|
|
114
|
+
// After (preserves literal types)
|
|
115
|
+
const routes = { ... } satisfies Routes;
|
|
116
|
+
```
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Usage
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
Task(
|
|
123
|
+
model: "haiku",
|
|
124
|
+
subagent_type: "Explore",
|
|
125
|
+
prompt: "TypeScript review for [files]. Check type safety, React patterns."
|
|
126
|
+
)
|
|
127
|
+
```
|
package/agents/searcher.md
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
# Searcher Agent
|
|
2
|
-
|
|
3
|
-
Web search specialist sub-agent.
|
|
4
|
-
|
|
5
|
-
## Role
|
|
6
|
-
|
|
7
|
-
- Search latest tech information
|
|
8
|
-
- Search error/bug solutions
|
|
9
|
-
- Search library usage
|
|
10
|
-
- Research best practices
|
|
11
|
-
|
|
12
|
-
## Model
|
|
13
|
-
|
|
14
|
-
- **With GPT integration**: Use GPT (mcp__vibe-gpt__search)
|
|
15
|
-
- **Default**: Haiku 4.5 + WebSearch
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
# With GPT integration
|
|
21
|
-
mcp__vibe-gpt__search("React 19 changes")
|
|
22
|
-
|
|
23
|
-
# Default (Haiku + WebSearch)
|
|
24
|
-
Task(model: "haiku", prompt: "Search React 19 changes")
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Tools
|
|
28
|
-
|
|
29
|
-
- WebSearch - Web search (default)
|
|
30
|
-
- WebFetch - Fetch page content
|
|
31
|
-
- mcp__vibe-gpt__* - GPT search (when integrated)
|
|
32
|
-
|
|
33
|
-
## Process
|
|
34
|
-
|
|
35
|
-
1. Optimize search query
|
|
36
|
-
2. Search via WebSearch
|
|
37
|
-
3. WebFetch relevant pages
|
|
38
|
-
4. Summarize key information
|
|
39
|
-
5. Return with sources
|
|
40
|
-
|
|
41
|
-
## Output
|
|
42
|
-
|
|
43
|
-
```markdown
|
|
44
|
-
## Search Results
|
|
45
|
-
|
|
46
|
-
### Key Findings
|
|
47
|
-
- Server Components now default
|
|
48
|
-
- use() hook simplifies Promise handling
|
|
49
|
-
- Actions API improves form handling
|
|
50
|
-
|
|
51
|
-
### Sources
|
|
52
|
-
- [React Official Blog](https://react.dev/blog)
|
|
53
|
-
- [React 19 Release Notes](https://github.com/facebook/react/releases)
|
|
54
|
-
```
|
|
1
|
+
# Searcher Agent
|
|
2
|
+
|
|
3
|
+
Web search specialist sub-agent.
|
|
4
|
+
|
|
5
|
+
## Role
|
|
6
|
+
|
|
7
|
+
- Search latest tech information
|
|
8
|
+
- Search error/bug solutions
|
|
9
|
+
- Search library usage
|
|
10
|
+
- Research best practices
|
|
11
|
+
|
|
12
|
+
## Model
|
|
13
|
+
|
|
14
|
+
- **With GPT integration**: Use GPT (mcp__vibe-gpt__search)
|
|
15
|
+
- **Default**: Haiku 4.5 + WebSearch
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
# With GPT integration
|
|
21
|
+
mcp__vibe-gpt__search("React 19 changes")
|
|
22
|
+
|
|
23
|
+
# Default (Haiku + WebSearch)
|
|
24
|
+
Task(model: "haiku", prompt: "Search React 19 changes")
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Tools
|
|
28
|
+
|
|
29
|
+
- WebSearch - Web search (default)
|
|
30
|
+
- WebFetch - Fetch page content
|
|
31
|
+
- mcp__vibe-gpt__* - GPT search (when integrated)
|
|
32
|
+
|
|
33
|
+
## Process
|
|
34
|
+
|
|
35
|
+
1. Optimize search query
|
|
36
|
+
2. Search via WebSearch
|
|
37
|
+
3. WebFetch relevant pages
|
|
38
|
+
4. Summarize key information
|
|
39
|
+
5. Return with sources
|
|
40
|
+
|
|
41
|
+
## Output
|
|
42
|
+
|
|
43
|
+
```markdown
|
|
44
|
+
## Search Results
|
|
45
|
+
|
|
46
|
+
### Key Findings
|
|
47
|
+
- Server Components now default
|
|
48
|
+
- use() hook simplifies Promise handling
|
|
49
|
+
- Actions API improves form handling
|
|
50
|
+
|
|
51
|
+
### Sources
|
|
52
|
+
- [React Official Blog](https://react.dev/blog)
|
|
53
|
+
- [React 19 Release Notes](https://github.com/facebook/react/releases)
|
|
54
|
+
```
|
package/agents/simplifier.md
CHANGED
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
# Code Simplifier Agent
|
|
2
|
-
|
|
3
|
-
Sub-agent that automatically validates and corrects code quality rules.
|
|
4
|
-
|
|
5
|
-
## Trigger
|
|
6
|
-
|
|
7
|
-
Automatically executed after `Write`, `Edit` operations via PostToolUse Hook.
|
|
8
|
-
|
|
9
|
-
## Rules Reference
|
|
10
|
-
|
|
11
|
-
**Validation criteria (`.claude/vibe/rules/`):**
|
|
12
|
-
|
|
13
|
-
### Required Rules
|
|
14
|
-
- `core/development-philosophy.md` - Surgical precision
|
|
15
|
-
- `core/quick-start.md` - DRY, SRP, YAGNI
|
|
16
|
-
- `quality/checklist.md` - Quality checklist
|
|
17
|
-
|
|
18
|
-
### Complexity Standards
|
|
19
|
-
- `standards/complexity-metrics.md`:
|
|
20
|
-
- Cyclomatic complexity ≤ 10
|
|
21
|
-
- Function length ≤ 20 lines
|
|
22
|
-
- Nesting depth ≤ 3 levels
|
|
23
|
-
- Parameters ≤ 5
|
|
24
|
-
- Component JSX ≤ 50 lines
|
|
25
|
-
|
|
26
|
-
### Anti-patterns
|
|
27
|
-
- `standards/anti-patterns.md` - Patterns to avoid
|
|
28
|
-
|
|
29
|
-
## Process
|
|
30
|
-
|
|
31
|
-
### 1. Analyze Changed Files
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
Check list of modified files
|
|
35
|
-
Analyze changes in each file
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### 2. Rule Validation
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
const checks = {
|
|
42
|
-
// Complexity
|
|
43
|
-
cyclomaticComplexity: '≤ 10',
|
|
44
|
-
functionLength: '≤ 20 lines',
|
|
45
|
-
nestingDepth: '≤ 3 levels',
|
|
46
|
-
parameterCount: '≤ 5',
|
|
47
|
-
|
|
48
|
-
// Code Quality
|
|
49
|
-
noAnyType: true,
|
|
50
|
-
noMagicNumbers: true,
|
|
51
|
-
singleResponsibility: true,
|
|
52
|
-
|
|
53
|
-
// Style
|
|
54
|
-
consistentNaming: true,
|
|
55
|
-
};
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### 3. Auto-correction (when possible)
|
|
59
|
-
|
|
60
|
-
- Long function → Suggest splitting
|
|
61
|
-
- Deep nesting → Early return pattern
|
|
62
|
-
- Magic numbers → Extract constants
|
|
63
|
-
- any type → Type inference/explicit typing
|
|
64
|
-
|
|
65
|
-
### 4. Report Results
|
|
66
|
-
|
|
67
|
-
```
|
|
68
|
-
✅ Quality check passed (Score: 95/100)
|
|
69
|
-
|
|
70
|
-
or
|
|
71
|
-
|
|
72
|
-
⚠️ Improvements needed:
|
|
73
|
-
- src/utils/helper.ts:15 - Function 25 lines (limit: 20)
|
|
74
|
-
- src/components/Form.tsx:42 - Nesting 4 levels (limit: 3)
|
|
75
|
-
|
|
76
|
-
🔧 Auto-corrected:
|
|
77
|
-
- 3 magic numbers → Converted to constants
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Quick Check
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
✅ Modified only requested scope?
|
|
84
|
-
✅ No any types?
|
|
85
|
-
✅ Functions ≤ 20 lines?
|
|
86
|
-
✅ Nesting ≤ 3 levels?
|
|
87
|
-
✅ Error handling included?
|
|
88
|
-
✅ Magic numbers extracted to constants?
|
|
89
|
-
✅ Tests written?
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## Grade
|
|
93
|
-
|
|
94
|
-
| Grade | Score | Action |
|
|
95
|
-
|-------|-------|--------|
|
|
96
|
-
| A+ | 95-100 | Pass |
|
|
97
|
-
| A | 90-94 | Pass |
|
|
98
|
-
| B+ | 85-89 | Show warning |
|
|
99
|
-
| B | 80-84 | Recommend improvement |
|
|
100
|
-
| C | 70-79 | Needs improvement |
|
|
101
|
-
| F | < 70 | Correction required |
|
|
102
|
-
|
|
103
|
-
## Usage
|
|
104
|
-
|
|
105
|
-
This agent is not called directly.
|
|
106
|
-
It runs automatically via PostToolUse Hook in `settings.json`.
|
|
107
|
-
|
|
108
|
-
```json
|
|
109
|
-
{
|
|
110
|
-
"hooks": {
|
|
111
|
-
"PostToolUse": [
|
|
112
|
-
{
|
|
113
|
-
"tools": ["Write", "Edit"],
|
|
114
|
-
"command": "claude --agent simplifier"
|
|
115
|
-
}
|
|
116
|
-
]
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
```
|
|
1
|
+
# Code Simplifier Agent
|
|
2
|
+
|
|
3
|
+
Sub-agent that automatically validates and corrects code quality rules.
|
|
4
|
+
|
|
5
|
+
## Trigger
|
|
6
|
+
|
|
7
|
+
Automatically executed after `Write`, `Edit` operations via PostToolUse Hook.
|
|
8
|
+
|
|
9
|
+
## Rules Reference
|
|
10
|
+
|
|
11
|
+
**Validation criteria (`.claude/vibe/rules/`):**
|
|
12
|
+
|
|
13
|
+
### Required Rules
|
|
14
|
+
- `core/development-philosophy.md` - Surgical precision
|
|
15
|
+
- `core/quick-start.md` - DRY, SRP, YAGNI
|
|
16
|
+
- `quality/checklist.md` - Quality checklist
|
|
17
|
+
|
|
18
|
+
### Complexity Standards
|
|
19
|
+
- `standards/complexity-metrics.md`:
|
|
20
|
+
- Cyclomatic complexity ≤ 10
|
|
21
|
+
- Function length ≤ 20 lines
|
|
22
|
+
- Nesting depth ≤ 3 levels
|
|
23
|
+
- Parameters ≤ 5
|
|
24
|
+
- Component JSX ≤ 50 lines
|
|
25
|
+
|
|
26
|
+
### Anti-patterns
|
|
27
|
+
- `standards/anti-patterns.md` - Patterns to avoid
|
|
28
|
+
|
|
29
|
+
## Process
|
|
30
|
+
|
|
31
|
+
### 1. Analyze Changed Files
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Check list of modified files
|
|
35
|
+
Analyze changes in each file
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2. Rule Validation
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
const checks = {
|
|
42
|
+
// Complexity
|
|
43
|
+
cyclomaticComplexity: '≤ 10',
|
|
44
|
+
functionLength: '≤ 20 lines',
|
|
45
|
+
nestingDepth: '≤ 3 levels',
|
|
46
|
+
parameterCount: '≤ 5',
|
|
47
|
+
|
|
48
|
+
// Code Quality
|
|
49
|
+
noAnyType: true,
|
|
50
|
+
noMagicNumbers: true,
|
|
51
|
+
singleResponsibility: true,
|
|
52
|
+
|
|
53
|
+
// Style
|
|
54
|
+
consistentNaming: true,
|
|
55
|
+
};
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 3. Auto-correction (when possible)
|
|
59
|
+
|
|
60
|
+
- Long function → Suggest splitting
|
|
61
|
+
- Deep nesting → Early return pattern
|
|
62
|
+
- Magic numbers → Extract constants
|
|
63
|
+
- any type → Type inference/explicit typing
|
|
64
|
+
|
|
65
|
+
### 4. Report Results
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
✅ Quality check passed (Score: 95/100)
|
|
69
|
+
|
|
70
|
+
or
|
|
71
|
+
|
|
72
|
+
⚠️ Improvements needed:
|
|
73
|
+
- src/utils/helper.ts:15 - Function 25 lines (limit: 20)
|
|
74
|
+
- src/components/Form.tsx:42 - Nesting 4 levels (limit: 3)
|
|
75
|
+
|
|
76
|
+
🔧 Auto-corrected:
|
|
77
|
+
- 3 magic numbers → Converted to constants
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Quick Check
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
✅ Modified only requested scope?
|
|
84
|
+
✅ No any types?
|
|
85
|
+
✅ Functions ≤ 20 lines?
|
|
86
|
+
✅ Nesting ≤ 3 levels?
|
|
87
|
+
✅ Error handling included?
|
|
88
|
+
✅ Magic numbers extracted to constants?
|
|
89
|
+
✅ Tests written?
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Grade
|
|
93
|
+
|
|
94
|
+
| Grade | Score | Action |
|
|
95
|
+
|-------|-------|--------|
|
|
96
|
+
| A+ | 95-100 | Pass |
|
|
97
|
+
| A | 90-94 | Pass |
|
|
98
|
+
| B+ | 85-89 | Show warning |
|
|
99
|
+
| B | 80-84 | Recommend improvement |
|
|
100
|
+
| C | 70-79 | Needs improvement |
|
|
101
|
+
| F | < 70 | Correction required |
|
|
102
|
+
|
|
103
|
+
## Usage
|
|
104
|
+
|
|
105
|
+
This agent is not called directly.
|
|
106
|
+
It runs automatically via PostToolUse Hook in `settings.json`.
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"hooks": {
|
|
111
|
+
"PostToolUse": [
|
|
112
|
+
{
|
|
113
|
+
"tools": ["Write", "Edit"],
|
|
114
|
+
"command": "claude --agent simplifier"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|