start-vibing 2.0.1 → 2.0.3
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/package.json +1 -1
- package/template/.claude/agents/01-orchestration/agent-selector.md +122 -0
- package/template/.claude/agents/01-orchestration/checkpoint-manager.md +130 -0
- package/template/.claude/agents/01-orchestration/context-manager.md +123 -0
- package/template/.claude/agents/01-orchestration/error-recovery.md +175 -0
- package/template/.claude/agents/01-orchestration/orchestrator.md +107 -0
- package/template/.claude/agents/01-orchestration/parallel-coordinator.md +129 -0
- package/template/.claude/agents/01-orchestration/task-decomposer.md +118 -0
- package/template/.claude/agents/01-orchestration/workflow-router.md +110 -0
- package/template/.claude/agents/02-typescript/bun-runtime-expert.md +179 -0
- package/template/.claude/agents/02-typescript/esm-resolver.md +186 -0
- package/template/.claude/agents/02-typescript/import-alias-enforcer.md +148 -0
- package/template/.claude/agents/02-typescript/ts-generics-helper.md +164 -0
- package/template/.claude/agents/02-typescript/ts-migration-helper.md +226 -0
- package/template/.claude/agents/02-typescript/ts-strict-checker.md +161 -0
- package/template/.claude/agents/02-typescript/ts-types-analyzer.md +184 -0
- package/template/.claude/agents/02-typescript/type-definition-writer.md +182 -0
- package/template/.claude/agents/02-typescript/zod-schema-designer.md +197 -0
- package/template/.claude/agents/02-typescript/zod-validator.md +152 -0
- package/template/.claude/agents/03-testing/playwright-assertions.md +254 -0
- package/template/.claude/agents/03-testing/playwright-e2e.md +245 -0
- package/template/.claude/agents/03-testing/playwright-fixtures.md +240 -0
- package/template/.claude/agents/03-testing/playwright-multi-viewport.md +261 -0
- package/template/.claude/agents/03-testing/playwright-page-objects.md +246 -0
- package/template/.claude/agents/03-testing/test-cleanup-manager.md +255 -0
- package/template/.claude/agents/03-testing/test-data-generator.md +265 -0
- package/template/.claude/agents/03-testing/tester-integration.md +278 -0
- package/template/.claude/agents/03-testing/tester-unit.md +204 -0
- package/template/.claude/agents/03-testing/vitest-config.md +288 -0
- package/template/.claude/agents/04-docker/container-health.md +238 -0
- package/template/.claude/agents/04-docker/deployment-validator.md +216 -0
- package/template/.claude/agents/04-docker/docker-compose-designer.md +267 -0
- package/template/.claude/agents/04-docker/docker-env-manager.md +227 -0
- package/template/.claude/agents/04-docker/docker-multi-stage.md +228 -0
- package/template/.claude/agents/04-docker/dockerfile-optimizer.md +203 -0
- package/template/.claude/agents/05-database/data-migration.md +292 -0
- package/template/.claude/agents/05-database/database-seeder.md +269 -0
- package/template/.claude/agents/05-database/mongodb-query-optimizer.md +218 -0
- package/template/.claude/agents/05-database/mongoose-aggregation.md +279 -0
- package/template/.claude/agents/05-database/mongoose-index-optimizer.md +173 -0
- package/template/.claude/agents/05-database/mongoose-schema-designer.md +267 -0
- package/template/.claude/agents/06-security/auth-session-validator.md +65 -0
- package/template/.claude/agents/06-security/input-sanitizer.md +80 -0
- package/template/.claude/agents/06-security/owasp-checker.md +87 -0
- package/template/.claude/agents/06-security/permission-auditor.md +94 -0
- package/template/.claude/agents/06-security/security-auditor.md +82 -0
- package/template/.claude/agents/06-security/sensitive-data-scanner.md +84 -0
- package/template/.claude/agents/07-documentation/api-documenter.md +130 -0
- package/template/.claude/agents/07-documentation/changelog-manager.md +95 -0
- package/template/.claude/agents/07-documentation/documenter.md +73 -0
- package/template/.claude/agents/07-documentation/domain-updater.md +74 -0
- package/template/.claude/agents/07-documentation/jsdoc-generator.md +113 -0
- package/template/.claude/agents/07-documentation/readme-generator.md +131 -0
- package/template/.claude/agents/08-git/branch-manager.md +57 -0
- package/template/.claude/agents/08-git/commit-manager.md +61 -0
- package/template/.claude/agents/08-git/pr-creator.md +71 -0
- package/template/.claude/agents/09-quality/code-reviewer.md +63 -0
- package/template/.claude/agents/09-quality/quality-checker.md +67 -0
- package/template/.claude/agents/10-research/best-practices-finder.md +82 -0
- package/template/.claude/agents/10-research/competitor-analyzer.md +96 -0
- package/template/.claude/agents/10-research/pattern-researcher.md +86 -0
- package/template/.claude/agents/10-research/research-cache-manager.md +75 -0
- package/template/.claude/agents/10-research/research-web.md +91 -0
- package/template/.claude/agents/10-research/tech-evaluator.md +94 -0
- package/template/.claude/agents/11-ui-ux/accessibility-auditor.md +128 -0
- package/template/.claude/agents/11-ui-ux/design-system-enforcer.md +116 -0
- package/template/.claude/agents/11-ui-ux/skeleton-generator.md +120 -0
- package/template/.claude/agents/11-ui-ux/ui-desktop.md +126 -0
- package/template/.claude/agents/11-ui-ux/ui-mobile.md +94 -0
- package/template/.claude/agents/11-ui-ux/ui-tablet.md +111 -0
- package/template/.claude/agents/12-performance/api-latency-analyzer.md +148 -0
- package/template/.claude/agents/12-performance/bundle-analyzer.md +106 -0
- package/template/.claude/agents/12-performance/memory-leak-detector.md +125 -0
- package/template/.claude/agents/12-performance/performance-profiler.md +107 -0
- package/template/.claude/agents/12-performance/query-optimizer.md +116 -0
- package/template/.claude/agents/12-performance/render-optimizer.md +147 -0
- package/template/.claude/agents/13-debugging/build-error-fixer.md +187 -0
- package/template/.claude/agents/13-debugging/debugger.md +136 -0
- package/template/.claude/agents/13-debugging/error-stack-analyzer.md +130 -0
- package/template/.claude/agents/13-debugging/network-debugger.md +184 -0
- package/template/.claude/agents/13-debugging/runtime-error-fixer.md +172 -0
- package/template/.claude/agents/13-debugging/type-error-resolver.md +172 -0
- package/template/.claude/agents/14-validation/final-validator.md +83 -0
- package/template/.claude/hooks/SETUP.md +85 -11
- package/template/.claude/hooks/run-hook.cmd +46 -0
- package/template/.claude/hooks/run-hook.sh +43 -0
- package/template/.claude/hooks/run-hook.ts +158 -0
- package/template/.claude/hooks/stop-validator.ts +339 -0
- package/template/.claude/hooks/user-prompt-submit.ts +298 -0
- package/template/.claude/settings.json +4 -3
- package/template/.claude/skills/bun-runtime/SKILL.md +430 -0
- package/template/.claude/skills/codebase-knowledge/domains/claude-system.md +46 -4
- package/template/.claude/skills/mongoose-patterns/SKILL.md +512 -0
- package/template/.claude/skills/nextjs-app-router/SKILL.md +337 -0
- package/template/.claude/skills/playwright-automation/SKILL.md +438 -0
- package/template/.claude/skills/react-patterns/SKILL.md +376 -0
- package/template/.claude/skills/shadcn-ui/SKILL.md +520 -0
- package/template/.claude/skills/tailwind-patterns/SKILL.md +467 -0
- package/template/.claude/skills/trpc-api/SKILL.md +435 -0
- package/template/.claude/skills/typescript-strict/SKILL.md +368 -0
- package/template/.claude/skills/zod-validation/SKILL.md +405 -0
- /package/template/.claude/agents/{analyzer.md → _backup/analyzer.md} +0 -0
- /package/template/.claude/agents/{code-reviewer.md → _backup/code-reviewer.md} +0 -0
- /package/template/.claude/agents/{commit-manager.md → _backup/commit-manager.md} +0 -0
- /package/template/.claude/agents/{debugger.md → _backup/debugger.md} +0 -0
- /package/template/.claude/agents/{documenter.md → _backup/documenter.md} +0 -0
- /package/template/.claude/agents/{domain-updater.md → _backup/domain-updater.md} +0 -0
- /package/template/.claude/agents/{final-validator.md → _backup/final-validator.md} +0 -0
- /package/template/.claude/agents/{orchestrator.md → _backup/orchestrator.md} +0 -0
- /package/template/.claude/agents/{performance.md → _backup/performance.md} +0 -0
- /package/template/.claude/agents/{quality-checker.md → _backup/quality-checker.md} +0 -0
- /package/template/.claude/agents/{research.md → _backup/research.md} +0 -0
- /package/template/.claude/agents/{security-auditor.md → _backup/security-auditor.md} +0 -0
- /package/template/.claude/agents/{tester.md → _backup/tester.md} +0 -0
- /package/template/.claude/agents/{ui-ux-reviewer.md → _backup/ui-ux-reviewer.md} +0 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* UserPromptSubmit Hook - TypeScript version (fallback when Python not available)
|
|
4
|
+
*
|
|
5
|
+
* This hook runs BEFORE Claude processes any user prompt and ENFORCES:
|
|
6
|
+
* 1. MANDATORY detailed todo list creation from prompt
|
|
7
|
+
* 2. MANDATORY research agent for new features
|
|
8
|
+
* 3. STRICT workflow: audit -> branch -> implement -> document -> quality -> PR
|
|
9
|
+
* 4. Separate UI for mobile/tablet/desktop (NOT just responsive)
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { existsSync, readFileSync } from 'fs';
|
|
13
|
+
import { join } from 'path';
|
|
14
|
+
|
|
15
|
+
const PROJECT_DIR = process.env['CLAUDE_PROJECT_DIR'] || process.cwd();
|
|
16
|
+
const WORKFLOW_STATE_PATH = join(PROJECT_DIR, '.claude', 'workflow-state.json');
|
|
17
|
+
|
|
18
|
+
const STRICT_WORKFLOW = `
|
|
19
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
20
|
+
│ STRICT WORKFLOW (MANDATORY) │
|
|
21
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
22
|
+
│ 0. INIT TASK → Run commit-manager to REGISTER task start │
|
|
23
|
+
│ 1. TODO LIST → Create DETAILED todo list from prompt │
|
|
24
|
+
│ 2. RESEARCH → Run research agent for NEW features │
|
|
25
|
+
│ 3. AUDIT → Check last audit docs OR run fresh audit │
|
|
26
|
+
│ 4. BRANCH → Create feature/ | fix/ | refactor/ | test/ │
|
|
27
|
+
│ 5. IMPLEMENT → Follow rules + analyzer approval │
|
|
28
|
+
│ 6. DOCUMENT → Document ALL modified files (MANDATORY) │
|
|
29
|
+
│ 7. QUALITY → typecheck + lint + test (Husky enforced) │
|
|
30
|
+
│ 8. FINISH → commit-manager creates PR with task summary │
|
|
31
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
32
|
+
|
|
33
|
+
⚠️ STOP HOOK ACTIVE - Task completion will be BLOCKED if:
|
|
34
|
+
- Working directly on main branch (must use feature/fix branch)
|
|
35
|
+
- Source files not documented (must run documenter agent)
|
|
36
|
+
- Documenter agent not executed for code changes
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
interface AgentInfo {
|
|
40
|
+
description: string;
|
|
41
|
+
triggers: string[];
|
|
42
|
+
priority: number;
|
|
43
|
+
when: string;
|
|
44
|
+
can_veto?: boolean;
|
|
45
|
+
mandatory_for?: string[];
|
|
46
|
+
enforces?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const AGENTS: Record<string, AgentInfo> = {
|
|
50
|
+
'orchestrator': {
|
|
51
|
+
description: 'Coordinates entire development flow',
|
|
52
|
+
triggers: ['implement feature', 'build', 'create', 'fix and test', 'full workflow', 'multi-step'],
|
|
53
|
+
priority: 1,
|
|
54
|
+
when: 'Task requires >2 agents or touches >3 files'
|
|
55
|
+
},
|
|
56
|
+
'analyzer': {
|
|
57
|
+
description: 'Analyzes impact before code modification',
|
|
58
|
+
triggers: ['implement', 'add feature', 'fix bug', 'refactor', 'change', 'modify', 'update code'],
|
|
59
|
+
priority: 2,
|
|
60
|
+
when: 'BEFORE any Edit/Write to source files'
|
|
61
|
+
},
|
|
62
|
+
'research': {
|
|
63
|
+
description: 'Researches best practices (2024-2025) - MANDATORY for new features',
|
|
64
|
+
triggers: ['research', 'investigate', 'study', 'best practice', 'how to', 'pattern', 'new feature', 'implement'],
|
|
65
|
+
priority: 3,
|
|
66
|
+
when: 'MANDATORY for ANY new feature or complex bug fix',
|
|
67
|
+
mandatory_for: ['feature', 'fix']
|
|
68
|
+
},
|
|
69
|
+
'ui-ux-reviewer': {
|
|
70
|
+
description: 'Reviews UI/UX - ENFORCES separate mobile/tablet/desktop UIs',
|
|
71
|
+
triggers: ['ui', 'component', 'page', 'design', 'layout', 'style', 'frontend', 'mobile', 'desktop'],
|
|
72
|
+
priority: 3,
|
|
73
|
+
when: 'Files in components/, app/, or .tsx with JSX',
|
|
74
|
+
enforces: 'SEPARATE UIs for each platform (NOT just responsive)'
|
|
75
|
+
},
|
|
76
|
+
'documenter': {
|
|
77
|
+
description: 'Documents results with commit hash references',
|
|
78
|
+
triggers: ['document', 'readme', 'docs', 'explain'],
|
|
79
|
+
priority: 4,
|
|
80
|
+
when: 'After implementation - MUST include commit hash for audit trail'
|
|
81
|
+
},
|
|
82
|
+
'tester': {
|
|
83
|
+
description: 'Creates unit tests (Vitest) and E2E tests (Playwright)',
|
|
84
|
+
triggers: ['test', 'coverage', 'spec', 'e2e'],
|
|
85
|
+
priority: 5,
|
|
86
|
+
when: 'After any code implementation'
|
|
87
|
+
},
|
|
88
|
+
'security-auditor': {
|
|
89
|
+
description: 'Audits security (CAN VETO)',
|
|
90
|
+
triggers: ['auth', 'session', 'password', 'token', 'api', 'database', 'user data', 'security'],
|
|
91
|
+
priority: 6,
|
|
92
|
+
when: 'Code touches auth/, api/, server/, or sensitive data',
|
|
93
|
+
can_veto: true
|
|
94
|
+
},
|
|
95
|
+
'quality-checker': {
|
|
96
|
+
description: 'Runs typecheck, lint, test, build (Husky pre-commit)',
|
|
97
|
+
triggers: ['check', 'verify', 'validate', 'run tests', 'quality'],
|
|
98
|
+
priority: 7,
|
|
99
|
+
when: 'BEFORE any commit - Husky enforces this'
|
|
100
|
+
},
|
|
101
|
+
'final-validator': {
|
|
102
|
+
description: 'Final validation before commit (CAN VETO)',
|
|
103
|
+
triggers: ['final', 'commit ready', 'approve'],
|
|
104
|
+
priority: 8,
|
|
105
|
+
when: 'Before any commit operation',
|
|
106
|
+
can_veto: true
|
|
107
|
+
},
|
|
108
|
+
'domain-updater': {
|
|
109
|
+
description: 'Updates domain knowledge with session learnings',
|
|
110
|
+
triggers: ['update domain', 'document learnings', 'session end'],
|
|
111
|
+
priority: 9,
|
|
112
|
+
when: 'BEFORE commit-manager - updates domains so git stays clean'
|
|
113
|
+
},
|
|
114
|
+
'commit-manager': {
|
|
115
|
+
description: 'Creates conventional commits and completes workflow',
|
|
116
|
+
triggers: ['commit', 'save changes', 'push', 'finalize', 'git'],
|
|
117
|
+
priority: 10,
|
|
118
|
+
when: 'FINAL step - after domain-updater, runs complete-task'
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const WORKFLOWS: Record<string, string[]> = {
|
|
123
|
+
'feature': ['analyzer', 'research', 'ui-ux-reviewer', 'documenter', 'tester', 'security-auditor', 'quality-checker', 'final-validator', 'domain-updater', 'commit-manager'],
|
|
124
|
+
'fix': ['analyzer', 'research', 'tester', 'security-auditor', 'quality-checker', 'final-validator', 'domain-updater', 'commit-manager'],
|
|
125
|
+
'refactor': ['analyzer', 'tester', 'quality-checker', 'final-validator', 'domain-updater', 'commit-manager'],
|
|
126
|
+
'config': ['quality-checker', 'domain-updater', 'commit-manager']
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
interface WorkflowState {
|
|
130
|
+
currentTask?: {
|
|
131
|
+
id?: string;
|
|
132
|
+
type?: string;
|
|
133
|
+
description?: string;
|
|
134
|
+
agents?: Record<string, { executed?: boolean }>;
|
|
135
|
+
approvedFiles?: string[];
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function loadWorkflowState(): WorkflowState | null {
|
|
140
|
+
if (!existsSync(WORKFLOW_STATE_PATH)) return null;
|
|
141
|
+
try {
|
|
142
|
+
return JSON.parse(readFileSync(WORKFLOW_STATE_PATH, 'utf8'));
|
|
143
|
+
} catch {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function detectTaskType(prompt: string): string {
|
|
149
|
+
const promptLower = prompt.toLowerCase();
|
|
150
|
+
|
|
151
|
+
if (['bug', 'fix', 'error', 'broken', 'not working', 'issue'].some(w => promptLower.includes(w))) {
|
|
152
|
+
return 'fix';
|
|
153
|
+
} else if (['refactor', 'restructure', 'reorganize', 'clean up'].some(w => promptLower.includes(w))) {
|
|
154
|
+
return 'refactor';
|
|
155
|
+
} else if (['config', 'setting', 'env', 'package.json', 'tsconfig'].some(w => promptLower.includes(w))) {
|
|
156
|
+
return 'config';
|
|
157
|
+
}
|
|
158
|
+
return 'feature';
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function detectBestAgent(prompt: string): [string, string] {
|
|
162
|
+
const promptLower = prompt.toLowerCase();
|
|
163
|
+
|
|
164
|
+
const multiStepIndicators = ['and then', 'after that', 'also', 'implement', 'build', 'create feature'];
|
|
165
|
+
if (multiStepIndicators.some(ind => promptLower.includes(ind))) {
|
|
166
|
+
return ['orchestrator', 'Multi-step task detected - orchestrator will coordinate all agents'];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const matches: Array<[string, number, string]> = [];
|
|
170
|
+
for (const [agentName, agentInfo] of Object.entries(AGENTS)) {
|
|
171
|
+
for (const trigger of agentInfo.triggers) {
|
|
172
|
+
if (promptLower.includes(trigger)) {
|
|
173
|
+
matches.push([agentName, agentInfo.priority, trigger]);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (matches.length > 0) {
|
|
179
|
+
matches.sort((a, b) => a[1] - b[1]);
|
|
180
|
+
const best = matches[0];
|
|
181
|
+
return [best[0], `Matched trigger '${best[2]}'`];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return ['orchestrator', 'No specific trigger matched - orchestrator will analyze'];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function formatAgentList(): string {
|
|
188
|
+
const sorted = Object.entries(AGENTS).sort((a, b) => a[1].priority - b[1].priority);
|
|
189
|
+
return sorted.map(([name, info]) => {
|
|
190
|
+
const veto = info.can_veto ? ' [CAN VETO]' : '';
|
|
191
|
+
return ` - ${name}: ${info.description}${veto}`;
|
|
192
|
+
}).join('\n');
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function formatWorkflowStatus(state: WorkflowState | null): string {
|
|
196
|
+
if (!state || !state.currentTask) {
|
|
197
|
+
return 'STATUS: No active task. Start with orchestrator agent';
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const task = state.currentTask;
|
|
201
|
+
const agents = task.agents || {};
|
|
202
|
+
|
|
203
|
+
const executed = Object.entries(agents).filter(([, s]) => s.executed).map(([n]) => n);
|
|
204
|
+
const pending = Object.entries(agents).filter(([, s]) => !s.executed).map(([n]) => n);
|
|
205
|
+
|
|
206
|
+
return `STATUS: Task active
|
|
207
|
+
ID: ${task.id || 'unknown'}
|
|
208
|
+
Type: ${task.type || 'unknown'}
|
|
209
|
+
Description: ${task.description || 'unknown'}
|
|
210
|
+
Executed: ${executed.length > 0 ? executed.join(', ') : 'none'}
|
|
211
|
+
Pending: ${pending.length > 0 ? pending.join(', ') : 'none'}
|
|
212
|
+
Approved files: ${(task.approvedFiles || []).length}`;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
async function readStdinWithTimeout(timeoutMs: number): Promise<string> {
|
|
216
|
+
return new Promise((resolve) => {
|
|
217
|
+
const timeout = setTimeout(() => resolve('{}'), timeoutMs);
|
|
218
|
+
|
|
219
|
+
Bun.stdin.text().then((text) => {
|
|
220
|
+
clearTimeout(timeout);
|
|
221
|
+
resolve(text || '{}');
|
|
222
|
+
}).catch(() => {
|
|
223
|
+
clearTimeout(timeout);
|
|
224
|
+
resolve('{}');
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
async function main(): Promise<void> {
|
|
230
|
+
let hookInput: { user_prompt?: string; prompt?: string } = {};
|
|
231
|
+
try {
|
|
232
|
+
const stdin = await readStdinWithTimeout(1000);
|
|
233
|
+
if (stdin && stdin.trim()) {
|
|
234
|
+
hookInput = JSON.parse(stdin);
|
|
235
|
+
}
|
|
236
|
+
} catch {
|
|
237
|
+
hookInput = {};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const prompt = hookInput.user_prompt || hookInput.prompt || '';
|
|
241
|
+
const state = loadWorkflowState();
|
|
242
|
+
const taskType = prompt ? detectTaskType(prompt) : 'unknown';
|
|
243
|
+
const [bestAgent, reason] = prompt ? detectBestAgent(prompt) : ['orchestrator', 'Default'];
|
|
244
|
+
|
|
245
|
+
const isNewFeature = taskType === 'feature' || ['new', 'implement', 'create', 'add'].some(w => prompt.toLowerCase().includes(w));
|
|
246
|
+
const isUiTask = ['ui', 'component', 'page', 'design', 'layout', 'mobile', 'desktop', 'tablet'].some(w => prompt.toLowerCase().includes(w));
|
|
247
|
+
|
|
248
|
+
const output = `
|
|
249
|
+
================================================================================
|
|
250
|
+
STRICT WORKFLOW ENFORCEMENT - UserPromptSubmit Hook
|
|
251
|
+
================================================================================
|
|
252
|
+
${STRICT_WORKFLOW}
|
|
253
|
+
|
|
254
|
+
${isNewFeature ? '⚠️ NEW FEATURE DETECTED - RESEARCH AGENT IS MANDATORY!' : ''}
|
|
255
|
+
${isUiTask ? '⚠️ UI TASK DETECTED - SEPARATE UIs FOR MOBILE/TABLET/DESKTOP REQUIRED!' : ''}
|
|
256
|
+
|
|
257
|
+
================================================================================
|
|
258
|
+
STEP 1: CREATE DETAILED TODO LIST (MANDATORY)
|
|
259
|
+
================================================================================
|
|
260
|
+
|
|
261
|
+
BEFORE doing anything, you MUST use TodoWrite to create a detailed todo list.
|
|
262
|
+
Break down the user's prompt into specific, actionable items.
|
|
263
|
+
|
|
264
|
+
================================================================================
|
|
265
|
+
AVAILABLE AGENTS:
|
|
266
|
+
${formatAgentList()}
|
|
267
|
+
|
|
268
|
+
TASK ANALYSIS:
|
|
269
|
+
Detected type: ${taskType}
|
|
270
|
+
Recommended agent: ${bestAgent}
|
|
271
|
+
Reason: ${reason}
|
|
272
|
+
Research required: ${isNewFeature ? 'YES (MANDATORY)' : 'Optional'}
|
|
273
|
+
Separate UIs required: ${isUiTask ? 'YES (MANDATORY)' : 'N/A'}
|
|
274
|
+
Workflow sequence: ${(WORKFLOWS[taskType] || WORKFLOWS['feature']).join(' -> ')}
|
|
275
|
+
|
|
276
|
+
${formatWorkflowStatus(state)}
|
|
277
|
+
|
|
278
|
+
================================================================================
|
|
279
|
+
AGENT INVOCATION (VIA TASK TOOL ONLY)
|
|
280
|
+
================================================================================
|
|
281
|
+
|
|
282
|
+
You MUST use the Task tool with subagent_type to invoke agents.
|
|
283
|
+
DO NOT execute agent logic manually - INVOKE the agent properly.
|
|
284
|
+
|
|
285
|
+
================================================================================
|
|
286
|
+
`;
|
|
287
|
+
|
|
288
|
+
const result = { continue: true, systemMessage: output };
|
|
289
|
+
console.log(JSON.stringify(result));
|
|
290
|
+
process.exit(0);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
main().catch((err) => {
|
|
294
|
+
console.error('Hook error:', err);
|
|
295
|
+
const result = { continue: true, systemMessage: 'Hook error occurred, continuing...' };
|
|
296
|
+
console.log(JSON.stringify(result));
|
|
297
|
+
process.exit(0);
|
|
298
|
+
});
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"Bash(bun run typecheck:*)",
|
|
48
48
|
"Bash(git add:*)",
|
|
49
49
|
"Bash(git commit:*)",
|
|
50
|
-
"Bash(python .claude/hooks/*)"
|
|
50
|
+
"Bash(python .claude/hooks/*)",
|
|
51
|
+
"Bash(bun .claude/hooks/*)"
|
|
51
52
|
]
|
|
52
53
|
},
|
|
53
54
|
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
"hooks": [
|
|
59
60
|
{
|
|
60
61
|
"type": "command",
|
|
61
|
-
"command": "
|
|
62
|
+
"command": "bun .claude/hooks/run-hook.ts user-prompt-submit",
|
|
62
63
|
"timeout": 10
|
|
63
64
|
}
|
|
64
65
|
]
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
"hooks": [
|
|
70
71
|
{
|
|
71
72
|
"type": "command",
|
|
72
|
-
"command": "
|
|
73
|
+
"command": "bun .claude/hooks/run-hook.ts stop-validator",
|
|
73
74
|
"timeout": 30
|
|
74
75
|
}
|
|
75
76
|
]
|