@su-record/vibe 2.5.9 → 2.5.11
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.md +448 -348
- package/LICENSE +21 -21
- package/README.md +262 -262
- package/agents/architect-low.md +41 -0
- package/agents/architect-medium.md +59 -0
- package/agents/architect.md +80 -0
- package/agents/build-error-resolver.md +115 -115
- package/agents/compounder.md +261 -261
- package/agents/diagrammer.md +178 -178
- package/agents/e2e-tester.md +266 -266
- package/agents/explorer-low.md +42 -0
- package/agents/explorer-medium.md +59 -0
- package/agents/explorer.md +48 -48
- package/agents/implementer-low.md +43 -0
- package/agents/implementer-medium.md +52 -0
- package/agents/implementer.md +54 -54
- package/agents/refactor-cleaner.md +143 -143
- package/agents/research/best-practices-agent.md +189 -189
- package/agents/research/codebase-patterns-agent.md +147 -147
- package/agents/research/framework-docs-agent.md +178 -178
- package/agents/research/security-advisory-agent.md +203 -203
- 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 +150 -150
- 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 +120 -120
- package/agents/tester.md +49 -49
- package/agents/ui-previewer.md +129 -129
- package/commands/vibe.analyze.md +356 -356
- package/commands/vibe.reason.md +329 -329
- package/commands/vibe.review.md +326 -326
- package/commands/vibe.run.md +1051 -1031
- package/commands/vibe.spec.md +1058 -1022
- package/commands/vibe.utils.md +296 -296
- package/commands/vibe.verify.md +375 -375
- package/dist/cli/collaborator.js +52 -52
- package/dist/cli/detect.js +32 -32
- package/dist/cli/index.js +102 -102
- package/dist/cli/llm.js +144 -144
- package/dist/lib/DeepInit.d.ts +62 -0
- package/dist/lib/DeepInit.d.ts.map +1 -0
- package/dist/lib/DeepInit.js +247 -0
- package/dist/lib/DeepInit.js.map +1 -0
- package/dist/lib/IterationTracker.d.ts +81 -0
- package/dist/lib/IterationTracker.d.ts.map +1 -0
- package/dist/lib/IterationTracker.js +190 -0
- package/dist/lib/IterationTracker.js.map +1 -0
- package/dist/lib/ModelRouter.d.ts +50 -0
- package/dist/lib/ModelRouter.d.ts.map +1 -0
- package/dist/lib/ModelRouter.js +218 -0
- package/dist/lib/ModelRouter.js.map +1 -0
- package/dist/lib/OrchestrateWorkflow.d.ts +90 -0
- package/dist/lib/OrchestrateWorkflow.d.ts.map +1 -0
- package/dist/lib/OrchestrateWorkflow.js +261 -0
- package/dist/lib/OrchestrateWorkflow.js.map +1 -0
- package/dist/lib/PythonParser.js +108 -108
- package/dist/lib/SkillFrontmatter.d.ts +64 -0
- package/dist/lib/SkillFrontmatter.d.ts.map +1 -0
- package/dist/lib/SkillFrontmatter.js +221 -0
- package/dist/lib/SkillFrontmatter.js.map +1 -0
- package/dist/lib/SkillQualityGate.d.ts +40 -0
- package/dist/lib/SkillQualityGate.d.ts.map +1 -0
- package/dist/lib/SkillQualityGate.js +218 -0
- package/dist/lib/SkillQualityGate.js.map +1 -0
- package/dist/lib/UltraQA.d.ts +70 -0
- package/dist/lib/UltraQA.d.ts.map +1 -0
- package/dist/lib/UltraQA.js +234 -0
- package/dist/lib/UltraQA.js.map +1 -0
- package/dist/lib/gpt-api.js +4 -4
- package/dist/lib/memory/KnowledgeGraph.js +4 -4
- package/dist/lib/memory/MemorySearch.js +20 -20
- package/dist/lib/memory/MemoryStorage.js +64 -64
- package/dist/tools/convention/analyzeComplexity.test.js +115 -115
- package/dist/tools/convention/validateCodeQuality.test.js +104 -104
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +12 -0
- package/dist/tools/index.js.map +1 -1
- package/hooks/hooks.json +222 -204
- package/hooks/scripts/code-check.js +22 -22
- package/hooks/scripts/code-review.js +22 -22
- package/hooks/scripts/complexity.js +22 -22
- package/hooks/scripts/compound.js +23 -23
- package/hooks/scripts/context-save.js +33 -33
- package/hooks/scripts/hud-multiline.js +264 -0
- package/hooks/scripts/hud-status.js +293 -0
- package/hooks/scripts/keyword-detector.js +216 -0
- package/hooks/scripts/llm-orchestrate.js +171 -171
- package/hooks/scripts/post-edit.js +97 -97
- package/hooks/scripts/post-tool-verify.js +212 -0
- package/hooks/scripts/pre-tool-guard.js +127 -0
- package/hooks/scripts/recall.js +22 -22
- package/hooks/scripts/session-start.js +30 -30
- package/hooks/scripts/skill-injector.js +193 -0
- package/hooks/scripts/utils.js +97 -97
- package/languages/csharp-unity.md +515 -515
- package/languages/gdscript-godot.md +470 -470
- package/languages/ruby-rails.md +489 -489
- package/languages/typescript-angular.md +433 -433
- package/languages/typescript-astro.md +416 -416
- package/languages/typescript-electron.md +406 -406
- package/languages/typescript-nestjs.md +524 -524
- package/languages/typescript-svelte.md +407 -407
- package/languages/typescript-tauri.md +365 -365
- package/package.json +83 -83
- package/skills/context7-usage.md +102 -102
- package/skills/git-worktree.md +181 -181
- package/skills/parallel-research.md +77 -77
- package/skills/priority-todos.md +239 -239
- package/skills/tool-fallback.md +190 -190
- package/skills/vibe-capabilities.md +161 -161
- package/vibe/constitution.md +227 -227
- package/vibe/rules/core/communication-guide.md +98 -98
- package/vibe/rules/core/development-philosophy.md +52 -52
- package/vibe/rules/core/quick-start.md +102 -102
- package/vibe/rules/quality/bdd-contract-testing.md +393 -393
- package/vibe/rules/quality/checklist.md +276 -276
- package/vibe/rules/quality/testing-strategy.md +440 -440
- package/vibe/rules/standards/anti-patterns.md +541 -541
- package/vibe/rules/standards/code-structure.md +291 -291
- package/vibe/rules/standards/complexity-metrics.md +313 -313
- package/vibe/rules/standards/naming-conventions.md +198 -198
- package/vibe/setup.sh +31 -31
- package/vibe/templates/constitution-template.md +252 -252
- package/vibe/templates/contract-backend-template.md +526 -526
- package/vibe/templates/contract-frontend-template.md +599 -599
- package/vibe/templates/feature-template.md +96 -96
- package/vibe/templates/spec-template.md +221 -221
- package/dist/cli/mcp.d.ts +0 -49
- package/dist/cli/mcp.d.ts.map +0 -1
- package/dist/cli/mcp.js +0 -169
- package/dist/cli/mcp.js.map +0 -1
- package/dist/lib/gemini-mcp.d.ts +0 -10
- package/dist/lib/gemini-mcp.d.ts.map +0 -1
- package/dist/lib/gemini-mcp.js +0 -353
- package/dist/lib/gemini-mcp.js.map +0 -1
- package/dist/lib/gpt-mcp.d.ts +0 -10
- package/dist/lib/gpt-mcp.d.ts.map +0 -1
- package/dist/lib/gpt-mcp.js +0 -352
- package/dist/lib/gpt-mcp.js.map +0 -1
- package/dist/tools/analytics/getUsageAnalytics.d.ts +0 -10
- package/dist/tools/analytics/getUsageAnalytics.d.ts.map +0 -1
- package/dist/tools/analytics/getUsageAnalytics.js +0 -246
- package/dist/tools/analytics/getUsageAnalytics.js.map +0 -1
- package/dist/tools/analytics/index.d.ts +0 -5
- package/dist/tools/analytics/index.d.ts.map +0 -1
- package/dist/tools/analytics/index.js +0 -5
- package/dist/tools/analytics/index.js.map +0 -1
- package/dist/tools/convention/getCodingGuide.d.ts +0 -7
- package/dist/tools/convention/getCodingGuide.d.ts.map +0 -1
- package/dist/tools/convention/getCodingGuide.js +0 -69
- package/dist/tools/convention/getCodingGuide.js.map +0 -1
- package/dist/tools/planning/analyzeRequirements.d.ts +0 -9
- package/dist/tools/planning/analyzeRequirements.d.ts.map +0 -1
- package/dist/tools/planning/analyzeRequirements.js +0 -171
- package/dist/tools/planning/analyzeRequirements.js.map +0 -1
- package/dist/tools/planning/createUserStories.d.ts +0 -9
- package/dist/tools/planning/createUserStories.d.ts.map +0 -1
- package/dist/tools/planning/createUserStories.js +0 -124
- package/dist/tools/planning/createUserStories.js.map +0 -1
- package/dist/tools/planning/featureRoadmap.d.ts +0 -10
- package/dist/tools/planning/featureRoadmap.d.ts.map +0 -1
- package/dist/tools/planning/featureRoadmap.js +0 -207
- package/dist/tools/planning/featureRoadmap.js.map +0 -1
- package/dist/tools/planning/generatePrd.d.ts +0 -11
- package/dist/tools/planning/generatePrd.d.ts.map +0 -1
- package/dist/tools/planning/generatePrd.js +0 -161
- package/dist/tools/planning/generatePrd.js.map +0 -1
- package/dist/tools/planning/index.d.ts +0 -8
- package/dist/tools/planning/index.d.ts.map +0 -1
- package/dist/tools/planning/index.js +0 -8
- package/dist/tools/planning/index.js.map +0 -1
- package/dist/tools/prompt/analyzePrompt.d.ts +0 -7
- package/dist/tools/prompt/analyzePrompt.d.ts.map +0 -1
- package/dist/tools/prompt/analyzePrompt.js +0 -150
- package/dist/tools/prompt/analyzePrompt.js.map +0 -1
- package/dist/tools/prompt/enhancePrompt.d.ts +0 -8
- package/dist/tools/prompt/enhancePrompt.d.ts.map +0 -1
- package/dist/tools/prompt/enhancePrompt.js +0 -110
- package/dist/tools/prompt/enhancePrompt.js.map +0 -1
- package/dist/tools/prompt/enhancePromptGemini.d.ts +0 -8
- package/dist/tools/prompt/enhancePromptGemini.d.ts.map +0 -1
- package/dist/tools/prompt/enhancePromptGemini.js +0 -332
- package/dist/tools/prompt/enhancePromptGemini.js.map +0 -1
- package/dist/tools/prompt/index.d.ts +0 -7
- package/dist/tools/prompt/index.d.ts.map +0 -1
- package/dist/tools/prompt/index.js +0 -7
- package/dist/tools/prompt/index.js.map +0 -1
- package/dist/tools/reasoning/applyReasoningFramework.d.ts +0 -8
- package/dist/tools/reasoning/applyReasoningFramework.d.ts.map +0 -1
- package/dist/tools/reasoning/applyReasoningFramework.js +0 -266
- package/dist/tools/reasoning/applyReasoningFramework.js.map +0 -1
- package/dist/tools/reasoning/index.d.ts +0 -5
- package/dist/tools/reasoning/index.d.ts.map +0 -1
- package/dist/tools/reasoning/index.js +0 -5
- package/dist/tools/reasoning/index.js.map +0 -1
- package/dist/tools/thinking/analyzeProblem.d.ts +0 -7
- package/dist/tools/thinking/analyzeProblem.d.ts.map +0 -1
- package/dist/tools/thinking/analyzeProblem.js +0 -55
- package/dist/tools/thinking/analyzeProblem.js.map +0 -1
- package/dist/tools/thinking/breakDownProblem.d.ts +0 -8
- package/dist/tools/thinking/breakDownProblem.d.ts.map +0 -1
- package/dist/tools/thinking/breakDownProblem.js +0 -145
- package/dist/tools/thinking/breakDownProblem.js.map +0 -1
- package/dist/tools/thinking/createThinkingChain.d.ts +0 -7
- package/dist/tools/thinking/createThinkingChain.d.ts.map +0 -1
- package/dist/tools/thinking/createThinkingChain.js +0 -44
- package/dist/tools/thinking/createThinkingChain.js.map +0 -1
- package/dist/tools/thinking/formatAsPlan.d.ts +0 -9
- package/dist/tools/thinking/formatAsPlan.d.ts.map +0 -1
- package/dist/tools/thinking/formatAsPlan.js +0 -78
- package/dist/tools/thinking/formatAsPlan.js.map +0 -1
- package/dist/tools/thinking/index.d.ts +0 -10
- package/dist/tools/thinking/index.d.ts.map +0 -1
- package/dist/tools/thinking/index.js +0 -10
- package/dist/tools/thinking/index.js.map +0 -1
- package/dist/tools/thinking/stepByStepAnalysis.d.ts +0 -8
- package/dist/tools/thinking/stepByStepAnalysis.d.ts.map +0 -1
- package/dist/tools/thinking/stepByStepAnalysis.js +0 -63
- package/dist/tools/thinking/stepByStepAnalysis.js.map +0 -1
- package/dist/tools/thinking/thinkAloudProcess.d.ts +0 -8
- package/dist/tools/thinking/thinkAloudProcess.d.ts.map +0 -1
- package/dist/tools/thinking/thinkAloudProcess.js +0 -80
- package/dist/tools/thinking/thinkAloudProcess.js.map +0 -1
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PostToolUse Hook - Edit 후 자동 포맷팅 및 TypeScript 체크
|
|
3
|
-
*
|
|
4
|
-
* 기능:
|
|
5
|
-
* - TypeScript/JavaScript 파일 수정 시 자동 Prettier 포맷팅
|
|
6
|
-
* - TypeScript 파일 수정 시 타입 체크
|
|
7
|
-
* - console.log 감지 및 경고
|
|
8
|
-
*/
|
|
9
|
-
import { execSync } from 'child_process';
|
|
10
|
-
import { existsSync } from 'fs';
|
|
11
|
-
import { PROJECT_DIR } from './utils.js';
|
|
12
|
-
|
|
13
|
-
// Claude Code에서 전달받는 환경변수에서 파일 경로 추출
|
|
14
|
-
const toolInput = process.env.TOOL_INPUT || '{}';
|
|
15
|
-
|
|
16
|
-
function main() {
|
|
17
|
-
try {
|
|
18
|
-
const input = JSON.parse(toolInput);
|
|
19
|
-
const filePath = input.file_path || input.path || '';
|
|
20
|
-
|
|
21
|
-
if (!filePath) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// TypeScript/JavaScript 파일인지 확인
|
|
26
|
-
const isTs = /\.(ts|tsx)$/.test(filePath);
|
|
27
|
-
const isJs = /\.(js|jsx|mjs|cjs)$/.test(filePath);
|
|
28
|
-
|
|
29
|
-
if (!isTs && !isJs) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const results = [];
|
|
34
|
-
|
|
35
|
-
// Prettier 포맷팅 (prettier가 설치된 경우만)
|
|
36
|
-
const prettierConfig = [
|
|
37
|
-
`${PROJECT_DIR}/.prettierrc`,
|
|
38
|
-
`${PROJECT_DIR}/.prettierrc.json`,
|
|
39
|
-
`${PROJECT_DIR}/.prettierrc.js`,
|
|
40
|
-
`${PROJECT_DIR}/prettier.config.js`,
|
|
41
|
-
].find(p => existsSync(p));
|
|
42
|
-
|
|
43
|
-
if (prettierConfig || existsSync(`${PROJECT_DIR}/node_modules/.bin/prettier`)) {
|
|
44
|
-
try {
|
|
45
|
-
execSync(`npx prettier --write "${filePath}" 2>/dev/null`, {
|
|
46
|
-
cwd: PROJECT_DIR,
|
|
47
|
-
stdio: 'pipe',
|
|
48
|
-
timeout: 10000,
|
|
49
|
-
});
|
|
50
|
-
results.push('formatted');
|
|
51
|
-
} catch {
|
|
52
|
-
// Prettier 실패는 무시
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// TypeScript 타입 체크 (tsconfig가 있는 경우만)
|
|
57
|
-
if (isTs && existsSync(`${PROJECT_DIR}/tsconfig.json`)) {
|
|
58
|
-
try {
|
|
59
|
-
execSync(`npx tsc --noEmit --skipLibCheck 2>&1 | head -5`, {
|
|
60
|
-
cwd: PROJECT_DIR,
|
|
61
|
-
stdio: 'pipe',
|
|
62
|
-
timeout: 30000,
|
|
63
|
-
});
|
|
64
|
-
results.push('types OK');
|
|
65
|
-
} catch (e) {
|
|
66
|
-
const output = e.stdout?.toString() || '';
|
|
67
|
-
const errorCount = (output.match(/error TS/g) || []).length;
|
|
68
|
-
if (errorCount > 0) {
|
|
69
|
-
results.push(`${errorCount} type errors`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// console.log 감지
|
|
75
|
-
try {
|
|
76
|
-
const grepResult = execSync(
|
|
77
|
-
`grep -n "console\\.log" "${filePath}" 2>/dev/null | head -3`,
|
|
78
|
-
{ cwd: PROJECT_DIR, stdio: 'pipe', encoding: 'utf-8' }
|
|
79
|
-
);
|
|
80
|
-
if (grepResult.trim()) {
|
|
81
|
-
const lines = grepResult.trim().split('\n').map(l => l.split(':')[0]).join(',');
|
|
82
|
-
results.push(`console.log at line ${lines}`);
|
|
83
|
-
}
|
|
84
|
-
} catch {
|
|
85
|
-
// grep 실패는 console.log 없음을 의미
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (results.length > 0) {
|
|
89
|
-
console.log(`[POST-EDIT] ${filePath.split('/').pop()}: ${results.join(' | ')}`);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
} catch {
|
|
93
|
-
// 조용히 실패
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
main();
|
|
1
|
+
/**
|
|
2
|
+
* PostToolUse Hook - Edit 후 자동 포맷팅 및 TypeScript 체크
|
|
3
|
+
*
|
|
4
|
+
* 기능:
|
|
5
|
+
* - TypeScript/JavaScript 파일 수정 시 자동 Prettier 포맷팅
|
|
6
|
+
* - TypeScript 파일 수정 시 타입 체크
|
|
7
|
+
* - console.log 감지 및 경고
|
|
8
|
+
*/
|
|
9
|
+
import { execSync } from 'child_process';
|
|
10
|
+
import { existsSync } from 'fs';
|
|
11
|
+
import { PROJECT_DIR } from './utils.js';
|
|
12
|
+
|
|
13
|
+
// Claude Code에서 전달받는 환경변수에서 파일 경로 추출
|
|
14
|
+
const toolInput = process.env.TOOL_INPUT || '{}';
|
|
15
|
+
|
|
16
|
+
function main() {
|
|
17
|
+
try {
|
|
18
|
+
const input = JSON.parse(toolInput);
|
|
19
|
+
const filePath = input.file_path || input.path || '';
|
|
20
|
+
|
|
21
|
+
if (!filePath) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// TypeScript/JavaScript 파일인지 확인
|
|
26
|
+
const isTs = /\.(ts|tsx)$/.test(filePath);
|
|
27
|
+
const isJs = /\.(js|jsx|mjs|cjs)$/.test(filePath);
|
|
28
|
+
|
|
29
|
+
if (!isTs && !isJs) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const results = [];
|
|
34
|
+
|
|
35
|
+
// Prettier 포맷팅 (prettier가 설치된 경우만)
|
|
36
|
+
const prettierConfig = [
|
|
37
|
+
`${PROJECT_DIR}/.prettierrc`,
|
|
38
|
+
`${PROJECT_DIR}/.prettierrc.json`,
|
|
39
|
+
`${PROJECT_DIR}/.prettierrc.js`,
|
|
40
|
+
`${PROJECT_DIR}/prettier.config.js`,
|
|
41
|
+
].find(p => existsSync(p));
|
|
42
|
+
|
|
43
|
+
if (prettierConfig || existsSync(`${PROJECT_DIR}/node_modules/.bin/prettier`)) {
|
|
44
|
+
try {
|
|
45
|
+
execSync(`npx prettier --write "${filePath}" 2>/dev/null`, {
|
|
46
|
+
cwd: PROJECT_DIR,
|
|
47
|
+
stdio: 'pipe',
|
|
48
|
+
timeout: 10000,
|
|
49
|
+
});
|
|
50
|
+
results.push('formatted');
|
|
51
|
+
} catch {
|
|
52
|
+
// Prettier 실패는 무시
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// TypeScript 타입 체크 (tsconfig가 있는 경우만)
|
|
57
|
+
if (isTs && existsSync(`${PROJECT_DIR}/tsconfig.json`)) {
|
|
58
|
+
try {
|
|
59
|
+
execSync(`npx tsc --noEmit --skipLibCheck 2>&1 | head -5`, {
|
|
60
|
+
cwd: PROJECT_DIR,
|
|
61
|
+
stdio: 'pipe',
|
|
62
|
+
timeout: 30000,
|
|
63
|
+
});
|
|
64
|
+
results.push('types OK');
|
|
65
|
+
} catch (e) {
|
|
66
|
+
const output = e.stdout?.toString() || '';
|
|
67
|
+
const errorCount = (output.match(/error TS/g) || []).length;
|
|
68
|
+
if (errorCount > 0) {
|
|
69
|
+
results.push(`${errorCount} type errors`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// console.log 감지
|
|
75
|
+
try {
|
|
76
|
+
const grepResult = execSync(
|
|
77
|
+
`grep -n "console\\.log" "${filePath}" 2>/dev/null | head -3`,
|
|
78
|
+
{ cwd: PROJECT_DIR, stdio: 'pipe', encoding: 'utf-8' }
|
|
79
|
+
);
|
|
80
|
+
if (grepResult.trim()) {
|
|
81
|
+
const lines = grepResult.trim().split('\n').map(l => l.split(':')[0]).join(',');
|
|
82
|
+
results.push(`console.log at line ${lines}`);
|
|
83
|
+
}
|
|
84
|
+
} catch {
|
|
85
|
+
// grep 실패는 console.log 없음을 의미
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (results.length > 0) {
|
|
89
|
+
console.log(`[POST-EDIT] ${filePath.split('/').pop()}: ${results.join(' | ')}`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
} catch {
|
|
93
|
+
// 조용히 실패
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
main();
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Post-Tool Verify
|
|
4
|
+
* 도구 실행 후 결과 검증 및 에러 복구 힌트 제공
|
|
5
|
+
*
|
|
6
|
+
* Inspired by oh-my-claudecode's PostToolUse hooks
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { VIBE_PATH, PROJECT_DIR } from './utils.js';
|
|
10
|
+
|
|
11
|
+
// 에러 패턴 및 복구 힌트
|
|
12
|
+
const ERROR_RECOVERY_HINTS = {
|
|
13
|
+
// Edit 에러
|
|
14
|
+
'old_string not found': {
|
|
15
|
+
hint: 'The text to replace was not found. Common causes:',
|
|
16
|
+
suggestions: [
|
|
17
|
+
'File was modified since last read - re-read the file first',
|
|
18
|
+
'Whitespace mismatch (tabs vs spaces, trailing spaces)',
|
|
19
|
+
'Line endings differ (CRLF vs LF)',
|
|
20
|
+
'Text spans multiple lines - try smaller chunks',
|
|
21
|
+
],
|
|
22
|
+
action: 'Read the file again to get the current content',
|
|
23
|
+
},
|
|
24
|
+
'not unique': {
|
|
25
|
+
hint: 'Multiple matches found for old_string.',
|
|
26
|
+
suggestions: [
|
|
27
|
+
'Include more surrounding context to make it unique',
|
|
28
|
+
'Use replace_all: true if you want to replace all occurrences',
|
|
29
|
+
'Add line numbers or function names for context',
|
|
30
|
+
],
|
|
31
|
+
action: 'Expand the old_string to include more unique context',
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
// Bash 에러
|
|
35
|
+
'command not found': {
|
|
36
|
+
hint: 'Command is not installed or not in PATH.',
|
|
37
|
+
suggestions: [
|
|
38
|
+
'Check if the package is installed',
|
|
39
|
+
'Try using the full path to the command',
|
|
40
|
+
'For npm packages, ensure node_modules/.bin is in PATH or use npx',
|
|
41
|
+
],
|
|
42
|
+
action: 'Install the required package or use an alternative command',
|
|
43
|
+
},
|
|
44
|
+
'permission denied': {
|
|
45
|
+
hint: 'Insufficient permissions for this operation.',
|
|
46
|
+
suggestions: [
|
|
47
|
+
'Check file/directory permissions',
|
|
48
|
+
'For sudo operations, ensure user has proper access',
|
|
49
|
+
'On Windows, run as Administrator if needed',
|
|
50
|
+
],
|
|
51
|
+
action: 'Check and fix permissions, or use a different approach',
|
|
52
|
+
},
|
|
53
|
+
'ENOENT': {
|
|
54
|
+
hint: 'File or directory does not exist.',
|
|
55
|
+
suggestions: [
|
|
56
|
+
'Verify the path is correct',
|
|
57
|
+
'Create parent directories first with mkdir -p',
|
|
58
|
+
'Check for typos in the path',
|
|
59
|
+
],
|
|
60
|
+
action: 'Create the missing directories or fix the path',
|
|
61
|
+
},
|
|
62
|
+
'EACCES': {
|
|
63
|
+
hint: 'Access denied to file or directory.',
|
|
64
|
+
suggestions: [
|
|
65
|
+
'Check file ownership and permissions',
|
|
66
|
+
'Ensure the directory is not read-only',
|
|
67
|
+
],
|
|
68
|
+
action: 'Fix permissions or choose a different location',
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
// Git 에러
|
|
72
|
+
'merge conflict': {
|
|
73
|
+
hint: 'Git merge conflict detected.',
|
|
74
|
+
suggestions: [
|
|
75
|
+
'Review conflicting files',
|
|
76
|
+
'Choose which changes to keep',
|
|
77
|
+
'Use git mergetool for complex conflicts',
|
|
78
|
+
],
|
|
79
|
+
action: 'Resolve conflicts in the marked files, then git add and commit',
|
|
80
|
+
},
|
|
81
|
+
'detached HEAD': {
|
|
82
|
+
hint: 'Git is in detached HEAD state.',
|
|
83
|
+
suggestions: [
|
|
84
|
+
'Create a branch to save your work: git checkout -b new-branch',
|
|
85
|
+
'Return to a branch: git checkout main',
|
|
86
|
+
],
|
|
87
|
+
action: 'Create a branch if you want to keep changes',
|
|
88
|
+
},
|
|
89
|
+
'diverged': {
|
|
90
|
+
hint: 'Local and remote branches have diverged.',
|
|
91
|
+
suggestions: [
|
|
92
|
+
'Pull with rebase: git pull --rebase',
|
|
93
|
+
'Or merge: git pull',
|
|
94
|
+
'Review differences first: git log HEAD..origin/main',
|
|
95
|
+
],
|
|
96
|
+
action: 'Decide whether to rebase or merge',
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
// TypeScript/Build 에러
|
|
100
|
+
'Cannot find module': {
|
|
101
|
+
hint: 'Module import failed.',
|
|
102
|
+
suggestions: [
|
|
103
|
+
'Run npm install to ensure dependencies are installed',
|
|
104
|
+
'Check if the module path is correct',
|
|
105
|
+
'For local modules, verify the file exists',
|
|
106
|
+
'Check tsconfig.json paths configuration',
|
|
107
|
+
],
|
|
108
|
+
action: 'Install missing dependencies or fix the import path',
|
|
109
|
+
},
|
|
110
|
+
'Type error': {
|
|
111
|
+
hint: 'TypeScript type mismatch.',
|
|
112
|
+
suggestions: [
|
|
113
|
+
'Check the expected type in the function/variable definition',
|
|
114
|
+
'Use type assertion if confident (value as Type)',
|
|
115
|
+
'Add proper type guards for union types',
|
|
116
|
+
],
|
|
117
|
+
action: 'Fix the type mismatch or add proper type handling',
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// 성공 패턴 감지
|
|
122
|
+
const SUCCESS_PATTERNS = [
|
|
123
|
+
/✓|✅|success|passed|complete|done/i,
|
|
124
|
+
/^0 errors?$/im,
|
|
125
|
+
/all tests passed/i,
|
|
126
|
+
/build succeeded/i,
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 출력에서 에러 감지 및 힌트 생성
|
|
131
|
+
*/
|
|
132
|
+
function analyzeOutput(toolName, output, exitCode) {
|
|
133
|
+
const result = {
|
|
134
|
+
hasError: exitCode !== 0,
|
|
135
|
+
hints: [],
|
|
136
|
+
suggestions: [],
|
|
137
|
+
recoveryAction: null,
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// 성공 패턴 확인
|
|
141
|
+
if (SUCCESS_PATTERNS.some(p => p.test(output))) {
|
|
142
|
+
result.hasError = false;
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// 에러 패턴 매칭
|
|
147
|
+
for (const [pattern, recovery] of Object.entries(ERROR_RECOVERY_HINTS)) {
|
|
148
|
+
if (output.toLowerCase().includes(pattern.toLowerCase())) {
|
|
149
|
+
result.hints.push(recovery.hint);
|
|
150
|
+
result.suggestions.push(...recovery.suggestions);
|
|
151
|
+
if (!result.recoveryAction) {
|
|
152
|
+
result.recoveryAction = recovery.action;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// 에러가 감지됐는데 힌트가 없으면 일반 힌트 제공
|
|
158
|
+
if (result.hasError && result.hints.length === 0) {
|
|
159
|
+
result.hints.push('An error occurred. Check the output for details.');
|
|
160
|
+
result.suggestions.push(
|
|
161
|
+
'Review the full error message',
|
|
162
|
+
'Search for the error message online',
|
|
163
|
+
'Check if similar issues exist in the project',
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* 출력 포맷
|
|
172
|
+
*/
|
|
173
|
+
function formatRecoveryHint(toolName, analysis) {
|
|
174
|
+
if (!analysis.hasError || analysis.hints.length === 0) {
|
|
175
|
+
return '';
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const lines = [];
|
|
179
|
+
lines.push(`💡 POST-TOOL HINT: ${toolName} encountered an issue`);
|
|
180
|
+
lines.push('');
|
|
181
|
+
|
|
182
|
+
for (const hint of analysis.hints) {
|
|
183
|
+
lines.push(`📌 ${hint}`);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (analysis.suggestions.length > 0) {
|
|
187
|
+
lines.push('');
|
|
188
|
+
lines.push('Possible solutions:');
|
|
189
|
+
for (const suggestion of analysis.suggestions) {
|
|
190
|
+
lines.push(` • ${suggestion}`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (analysis.recoveryAction) {
|
|
195
|
+
lines.push('');
|
|
196
|
+
lines.push(`🔧 Recommended action: ${analysis.recoveryAction}`);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return lines.join('\n');
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// 메인 실행
|
|
203
|
+
const toolName = process.argv[2] || 'unknown';
|
|
204
|
+
const exitCode = parseInt(process.argv[3] || '0', 10);
|
|
205
|
+
const output = process.argv[4] || process.env.TOOL_OUTPUT || '';
|
|
206
|
+
|
|
207
|
+
const analysis = analyzeOutput(toolName, output, exitCode);
|
|
208
|
+
const hint = formatRecoveryHint(toolName, analysis);
|
|
209
|
+
|
|
210
|
+
if (hint) {
|
|
211
|
+
console.log(hint);
|
|
212
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Pre-Tool Guard
|
|
4
|
+
* 위험한 도구 사용 전 검증 및 경고
|
|
5
|
+
*
|
|
6
|
+
* Inspired by oh-my-claudecode's PreToolUse hooks
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { VIBE_PATH, PROJECT_DIR } from './utils.js';
|
|
10
|
+
|
|
11
|
+
// 위험한 명령어 패턴
|
|
12
|
+
const DANGEROUS_PATTERNS = {
|
|
13
|
+
bash: [
|
|
14
|
+
{ pattern: /rm\s+-rf?\s+[\/~]/, severity: 'critical', message: 'Deleting root or home directory' },
|
|
15
|
+
{ pattern: /rm\s+-rf?\s+\*/, severity: 'high', message: 'Wildcard deletion detected' },
|
|
16
|
+
{ pattern: /git\s+push\s+.*--force/, severity: 'high', message: 'Force push detected' },
|
|
17
|
+
{ pattern: /git\s+reset\s+--hard/, severity: 'medium', message: 'Hard reset will discard changes' },
|
|
18
|
+
{ pattern: /drop\s+(table|database)/i, severity: 'critical', message: 'Database drop detected' },
|
|
19
|
+
{ pattern: /truncate\s+table/i, severity: 'high', message: 'Table truncate detected' },
|
|
20
|
+
{ pattern: /:(){ :|:& };:/, severity: 'critical', message: 'Fork bomb detected' },
|
|
21
|
+
{ pattern: /mkfs|fdisk|dd\s+if=/, severity: 'critical', message: 'Disk operation detected' },
|
|
22
|
+
{ pattern: /chmod\s+-R\s+777/, severity: 'medium', message: 'Insecure permission change' },
|
|
23
|
+
{ pattern: /curl.*\|\s*(ba)?sh/, severity: 'high', message: 'Piping curl to shell' },
|
|
24
|
+
],
|
|
25
|
+
edit: [
|
|
26
|
+
{ pattern: /\.env|credentials|secret|password|api[_-]?key/i, severity: 'medium', message: 'Editing sensitive file' },
|
|
27
|
+
{ pattern: /package-lock\.json|yarn\.lock|pnpm-lock/, severity: 'low', message: 'Editing lock file directly' },
|
|
28
|
+
],
|
|
29
|
+
write: [
|
|
30
|
+
{ pattern: /\.env|credentials|secret/i, severity: 'medium', message: 'Writing to sensitive file' },
|
|
31
|
+
{ pattern: /\/etc\/|\/usr\/|C:\\Windows/i, severity: 'critical', message: 'Writing to system directory' },
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// 안전한 대안 제안
|
|
36
|
+
const SAFE_ALTERNATIVES = {
|
|
37
|
+
'rm -rf': 'Use trash-cli (trash-put) or move to a backup directory first',
|
|
38
|
+
'git push --force': 'Use git push --force-with-lease instead',
|
|
39
|
+
'git reset --hard': 'Create a backup branch first: git branch backup-$(date +%s)',
|
|
40
|
+
'drop table': 'Consider soft delete or backup first',
|
|
41
|
+
'chmod 777': 'Use specific permissions (e.g., chmod 755 for directories)',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 명령어 검증
|
|
46
|
+
*/
|
|
47
|
+
function validateCommand(toolName, input) {
|
|
48
|
+
const results = {
|
|
49
|
+
allowed: true,
|
|
50
|
+
severity: 'none',
|
|
51
|
+
warnings: [],
|
|
52
|
+
suggestions: [],
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const patterns = DANGEROUS_PATTERNS[toolName.toLowerCase()] || [];
|
|
56
|
+
|
|
57
|
+
for (const { pattern, severity, message } of patterns) {
|
|
58
|
+
if (pattern.test(input)) {
|
|
59
|
+
results.warnings.push(`[${severity.toUpperCase()}] ${message}`);
|
|
60
|
+
|
|
61
|
+
// 심각도에 따른 처리
|
|
62
|
+
if (severity === 'critical') {
|
|
63
|
+
results.allowed = false;
|
|
64
|
+
results.severity = 'critical';
|
|
65
|
+
} else if (severity === 'high' && results.severity !== 'critical') {
|
|
66
|
+
results.severity = 'high';
|
|
67
|
+
} else if (results.severity === 'none') {
|
|
68
|
+
results.severity = severity;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// 대안 제안
|
|
72
|
+
for (const [dangerous, safe] of Object.entries(SAFE_ALTERNATIVES)) {
|
|
73
|
+
if (input.includes(dangerous)) {
|
|
74
|
+
results.suggestions.push(safe);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return results;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 출력 포맷
|
|
85
|
+
*/
|
|
86
|
+
function formatOutput(toolName, validation) {
|
|
87
|
+
const lines = [];
|
|
88
|
+
|
|
89
|
+
if (validation.warnings.length === 0) {
|
|
90
|
+
return ''; // 경고 없으면 출력 없음
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
lines.push(`⚠️ PRE-TOOL GUARD: ${toolName}`);
|
|
94
|
+
|
|
95
|
+
for (const warning of validation.warnings) {
|
|
96
|
+
lines.push(` ${warning}`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (validation.suggestions.length > 0) {
|
|
100
|
+
lines.push('');
|
|
101
|
+
lines.push('💡 Suggestions:');
|
|
102
|
+
for (const suggestion of validation.suggestions) {
|
|
103
|
+
lines.push(` - ${suggestion}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (!validation.allowed) {
|
|
108
|
+
lines.push('');
|
|
109
|
+
lines.push('🚫 BLOCKED: This operation is too dangerous. Please review and modify.');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return lines.join('\n');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// 메인 실행
|
|
116
|
+
const toolName = process.argv[2] || 'Bash';
|
|
117
|
+
const toolInput = process.argv[3] || process.env.TOOL_INPUT || '';
|
|
118
|
+
|
|
119
|
+
const validation = validateCommand(toolName, toolInput);
|
|
120
|
+
const output = formatOutput(toolName, validation);
|
|
121
|
+
|
|
122
|
+
if (output) {
|
|
123
|
+
console.log(output);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Exit code: 0 = allowed, 1 = blocked
|
|
127
|
+
process.exit(validation.allowed ? 0 : 1);
|
package/hooks/scripts/recall.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UserPromptSubmit Hook - 메모리 검색
|
|
3
|
-
*/
|
|
4
|
-
import { getToolsBaseUrl, PROJECT_DIR } from './utils.js';
|
|
5
|
-
|
|
6
|
-
const BASE_URL = getToolsBaseUrl();
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
try {
|
|
10
|
-
const module = await import(`${BASE_URL}memory/index.js`);
|
|
11
|
-
const result = await module.listMemories({
|
|
12
|
-
limit: 10,
|
|
13
|
-
projectPath: PROJECT_DIR,
|
|
14
|
-
});
|
|
15
|
-
const lines = result.content[0].text.split('\n');
|
|
16
|
-
console.log(`[RECALL] ✓ Found ${lines.length} memories:`, lines.slice(0, 7).join(' | '));
|
|
17
|
-
} catch (e) {
|
|
18
|
-
console.log('[RECALL] Error:', e.message);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
main();
|
|
1
|
+
/**
|
|
2
|
+
* UserPromptSubmit Hook - 메모리 검색
|
|
3
|
+
*/
|
|
4
|
+
import { getToolsBaseUrl, PROJECT_DIR } from './utils.js';
|
|
5
|
+
|
|
6
|
+
const BASE_URL = getToolsBaseUrl();
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
try {
|
|
10
|
+
const module = await import(`${BASE_URL}memory/index.js`);
|
|
11
|
+
const result = await module.listMemories({
|
|
12
|
+
limit: 10,
|
|
13
|
+
projectPath: PROJECT_DIR,
|
|
14
|
+
});
|
|
15
|
+
const lines = result.content[0].text.split('\n');
|
|
16
|
+
console.log(`[RECALL] ✓ Found ${lines.length} memories:`, lines.slice(0, 7).join(' | '));
|
|
17
|
+
} catch (e) {
|
|
18
|
+
console.log('[RECALL] Error:', e.message);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
main();
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SessionStart Hook - 세션 시작 시 메모리/시간 로드
|
|
3
|
-
*/
|
|
4
|
-
import { getToolsBaseUrl, PROJECT_DIR } from './utils.js';
|
|
5
|
-
|
|
6
|
-
const BASE_URL = getToolsBaseUrl();
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
try {
|
|
10
|
-
const [memoryModule, timeModule] = await Promise.all([
|
|
11
|
-
import(`${BASE_URL}memory/index.js`),
|
|
12
|
-
import(`${BASE_URL}time/index.js`),
|
|
13
|
-
]);
|
|
14
|
-
|
|
15
|
-
const [session, time, memories] = await Promise.all([
|
|
16
|
-
memoryModule.startSession({ projectPath: PROJECT_DIR }),
|
|
17
|
-
timeModule.getCurrentTime({ format: 'human', timezone: 'Asia/Seoul' }),
|
|
18
|
-
memoryModule.listMemories({ limit: 5, projectPath: PROJECT_DIR }),
|
|
19
|
-
]);
|
|
20
|
-
|
|
21
|
-
console.log(session.content[0].text);
|
|
22
|
-
console.log('\n' + time.content[0].text);
|
|
23
|
-
console.log('\n[Recent Memories]');
|
|
24
|
-
console.log(memories.content[0].text);
|
|
25
|
-
} catch (e) {
|
|
26
|
-
console.log('[Session] Error:', e.message);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
main();
|
|
1
|
+
/**
|
|
2
|
+
* SessionStart Hook - 세션 시작 시 메모리/시간 로드
|
|
3
|
+
*/
|
|
4
|
+
import { getToolsBaseUrl, PROJECT_DIR } from './utils.js';
|
|
5
|
+
|
|
6
|
+
const BASE_URL = getToolsBaseUrl();
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
try {
|
|
10
|
+
const [memoryModule, timeModule] = await Promise.all([
|
|
11
|
+
import(`${BASE_URL}memory/index.js`),
|
|
12
|
+
import(`${BASE_URL}time/index.js`),
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
const [session, time, memories] = await Promise.all([
|
|
16
|
+
memoryModule.startSession({ projectPath: PROJECT_DIR }),
|
|
17
|
+
timeModule.getCurrentTime({ format: 'human', timezone: 'Asia/Seoul' }),
|
|
18
|
+
memoryModule.listMemories({ limit: 5, projectPath: PROJECT_DIR }),
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
console.log(session.content[0].text);
|
|
22
|
+
console.log('\n' + time.content[0].text);
|
|
23
|
+
console.log('\n[Recent Memories]');
|
|
24
|
+
console.log(memories.content[0].text);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
console.log('[Session] Error:', e.message);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
main();
|