@su-record/vibe 2.7.0 → 2.7.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.
@@ -1,262 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Multi-Line HUD Visualization
4
- * Tree-based status display with overflow handling
5
- */
6
-
7
- import fs from 'fs';
8
- import path from 'path';
9
- import os from 'os';
10
-
11
- // State file
12
- const STATE_DIR = path.join(os.homedir(), '.claude', '.vibe-hud');
13
- const STATE_FILE = path.join(STATE_DIR, 'state.json');
14
-
15
- // Tree characters
16
- const TREE = {
17
- branch: '├─',
18
- last: '└─',
19
- vertical: '│ ',
20
- space: ' ',
21
- };
22
-
23
- // ANSI colors
24
- const COLORS = {
25
- reset: '\x1b[0m',
26
- bold: '\x1b[1m',
27
- dim: '\x1b[2m',
28
- green: '\x1b[32m',
29
- yellow: '\x1b[33m',
30
- red: '\x1b[31m',
31
- blue: '\x1b[34m',
32
- cyan: '\x1b[36m',
33
- magenta: '\x1b[35m',
34
- };
35
-
36
- // Status icons
37
- const ICONS = {
38
- running: '🔄',
39
- success: '✅',
40
- error: '❌',
41
- warning: '⚠️',
42
- pending: '⏳',
43
- agent: '🤖',
44
- phase: '📍',
45
- context: '📊',
46
- task: '📋',
47
- };
48
-
49
- /**
50
- * Load current state
51
- */
52
- function loadState() {
53
- try {
54
- if (fs.existsSync(STATE_FILE)) {
55
- return JSON.parse(fs.readFileSync(STATE_FILE, 'utf8'));
56
- }
57
- } catch {
58
- // Ignore
59
- }
60
- return {
61
- mode: 'idle',
62
- feature: null,
63
- phase: { current: 0, total: 0, name: '' },
64
- agents: [],
65
- tasks: [],
66
- context: { used: 0, total: 200000 },
67
- };
68
- }
69
-
70
- /**
71
- * Create progress bar
72
- */
73
- function createProgressBar(current, total, width = 20) {
74
- const percentage = total > 0 ? current / total : 0;
75
- const filled = Math.round(percentage * width);
76
- const empty = width - filled;
77
- return `[${'█'.repeat(filled)}${'░'.repeat(empty)}]`;
78
- }
79
-
80
- /**
81
- * Format context health
82
- */
83
- function formatContextHealth(used, total) {
84
- const percentage = Math.round((used / total) * 100);
85
- let color = COLORS.green;
86
- let icon = ICONS.success;
87
-
88
- if (percentage >= 90) {
89
- color = COLORS.red;
90
- icon = ICONS.error;
91
- } else if (percentage >= 70) {
92
- color = COLORS.yellow;
93
- icon = ICONS.warning;
94
- }
95
-
96
- return `${color}${icon} ${percentage}%${COLORS.reset}`;
97
- }
98
-
99
- /**
100
- * Multi-line render with tree structure
101
- */
102
- function renderMultiLine(state, maxLines = 10) {
103
- const lines = [];
104
- const modeIcon = state.mode === 'ultrawork' ? '🚀' :
105
- state.mode === 'spec' ? '📝' :
106
- state.mode === 'review' ? '🔍' :
107
- state.mode === 'implementing' ? '🔨' : '💤';
108
-
109
- // Header line
110
- const header = `${modeIcon} ${COLORS.bold}VIBE${COLORS.reset} ${state.mode.toUpperCase()}`;
111
- lines.push(header);
112
-
113
- // Feature name
114
- if (state.feature) {
115
- lines.push(`${TREE.branch} Feature: ${COLORS.cyan}${state.feature}${COLORS.reset}`);
116
- }
117
-
118
- // Phase progress
119
- if (state.phase.total > 0) {
120
- const phaseBar = createProgressBar(state.phase.current, state.phase.total, 15);
121
- const phaseName = state.phase.name ? ` - ${state.phase.name}` : '';
122
- lines.push(`${TREE.branch} ${ICONS.phase} Phase ${state.phase.current}/${state.phase.total}${phaseName}`);
123
- lines.push(`${TREE.vertical} ${phaseBar}`);
124
- }
125
-
126
- // Active agents
127
- if (state.agents && state.agents.length > 0) {
128
- lines.push(`${TREE.branch} ${ICONS.agent} Agents (${state.agents.length})`);
129
- const displayAgents = state.agents.slice(0, 3);
130
- const remaining = state.agents.length - displayAgents.length;
131
-
132
- displayAgents.forEach((agent, i) => {
133
- const isLast = i === displayAgents.length - 1 && remaining === 0;
134
- const prefix = isLast ? TREE.last : TREE.branch;
135
- const modelColor = agent.model === 'opus' ? COLORS.magenta :
136
- agent.model === 'sonnet' ? COLORS.blue : COLORS.green;
137
- lines.push(`${TREE.vertical} ${prefix} ${agent.name} ${modelColor}(${agent.model})${COLORS.reset}`);
138
- });
139
-
140
- if (remaining > 0) {
141
- lines.push(`${TREE.vertical} ${TREE.last} +${remaining} more...`);
142
- }
143
- }
144
-
145
- // Active tasks
146
- if (state.tasks && state.tasks.length > 0) {
147
- lines.push(`${TREE.branch} ${ICONS.task} Tasks (${state.tasks.length})`);
148
- const displayTasks = state.tasks.slice(0, 3);
149
- const remaining = state.tasks.length - displayTasks.length;
150
-
151
- displayTasks.forEach((task, i) => {
152
- const isLast = i === displayTasks.length - 1 && remaining === 0;
153
- const prefix = isLast ? TREE.last : TREE.branch;
154
- const statusIcon = task.status === 'completed' ? ICONS.success :
155
- task.status === 'failed' ? ICONS.error :
156
- task.status === 'running' ? ICONS.running : ICONS.pending;
157
- lines.push(`${TREE.vertical} ${prefix} ${statusIcon} ${task.name}`);
158
- });
159
-
160
- if (remaining > 0) {
161
- lines.push(`${TREE.vertical} ${TREE.last} +${remaining} more...`);
162
- }
163
- }
164
-
165
- // Context usage
166
- const contextHealth = formatContextHealth(state.context.used, state.context.total);
167
- lines.push(`${TREE.last} ${ICONS.context} Context: ${contextHealth}`);
168
-
169
- // Truncate if too many lines
170
- if (lines.length > maxLines) {
171
- const truncated = lines.slice(0, maxLines - 1);
172
- truncated.push(`${COLORS.dim}... (${lines.length - maxLines + 1} more lines)${COLORS.reset}`);
173
- return truncated;
174
- }
175
-
176
- return lines;
177
- }
178
-
179
- /**
180
- * Render single-line summary
181
- */
182
- function renderSingleLine(state) {
183
- const modeIcon = state.mode === 'ultrawork' ? '🚀' :
184
- state.mode === 'spec' ? '📝' :
185
- state.mode === 'review' ? '🔍' :
186
- state.mode === 'implementing' ? '🔨' : '💤';
187
-
188
- const parts = [modeIcon, state.mode];
189
-
190
- if (state.feature) {
191
- parts.push(`[${state.feature}]`);
192
- }
193
-
194
- if (state.phase.total > 0) {
195
- parts.push(`P:${state.phase.current}/${state.phase.total}`);
196
- }
197
-
198
- if (state.agents && state.agents.length > 0) {
199
- parts.push(`A:${state.agents.length}`);
200
- }
201
-
202
- const contextPct = Math.round((state.context.used / state.context.total) * 100);
203
- parts.push(`C:${contextPct}%`);
204
-
205
- return parts.join(' ');
206
- }
207
-
208
- /**
209
- * Render compact view
210
- */
211
- function renderCompact(state) {
212
- const lines = [];
213
- const modeIcon = state.mode === 'ultrawork' ? '🚀' :
214
- state.mode === 'spec' ? '📝' :
215
- state.mode === 'review' ? '🔍' :
216
- state.mode === 'implementing' ? '🔨' : '💤';
217
-
218
- // Line 1: Mode + Feature
219
- let line1 = `${modeIcon} ${state.mode}`;
220
- if (state.feature) line1 += `: ${state.feature}`;
221
- lines.push(line1);
222
-
223
- // Line 2: Phase + Agents + Context
224
- const parts = [];
225
- if (state.phase.total > 0) {
226
- parts.push(`P:${state.phase.current}/${state.phase.total}`);
227
- }
228
- if (state.agents && state.agents.length > 0) {
229
- parts.push(`A:${state.agents.length}`);
230
- }
231
- const contextPct = Math.round((state.context.used / state.context.total) * 100);
232
- const contextColor = contextPct >= 90 ? COLORS.red :
233
- contextPct >= 70 ? COLORS.yellow : COLORS.green;
234
- parts.push(`${contextColor}C:${contextPct}%${COLORS.reset}`);
235
-
236
- lines.push(` ${parts.join(' | ')}`);
237
-
238
- return lines;
239
- }
240
-
241
- /**
242
- * CLI handler
243
- */
244
- const command = process.argv[2] || 'multi';
245
- const state = loadState();
246
-
247
- switch (command) {
248
- case 'single':
249
- console.log(renderSingleLine(state));
250
- break;
251
-
252
- case 'compact':
253
- console.log(renderCompact(state).join('\n'));
254
- break;
255
-
256
- case 'multi':
257
- case 'full':
258
- default:
259
- const maxLines = parseInt(process.argv[3], 10) || 10;
260
- console.log(renderMultiLine(state, maxLines).join('\n'));
261
- break;
262
- }
@@ -1,210 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Post-Tool Verify
4
- * 도구 실행 후 결과 검증 및 에러 복구 힌트 제공
5
- */
6
-
7
- import { VIBE_PATH, PROJECT_DIR } from './utils.js';
8
-
9
- // 에러 패턴 및 복구 힌트
10
- const ERROR_RECOVERY_HINTS = {
11
- // Edit 에러
12
- 'old_string not found': {
13
- hint: 'The text to replace was not found. Common causes:',
14
- suggestions: [
15
- 'File was modified since last read - re-read the file first',
16
- 'Whitespace mismatch (tabs vs spaces, trailing spaces)',
17
- 'Line endings differ (CRLF vs LF)',
18
- 'Text spans multiple lines - try smaller chunks',
19
- ],
20
- action: 'Read the file again to get the current content',
21
- },
22
- 'not unique': {
23
- hint: 'Multiple matches found for old_string.',
24
- suggestions: [
25
- 'Include more surrounding context to make it unique',
26
- 'Use replace_all: true if you want to replace all occurrences',
27
- 'Add line numbers or function names for context',
28
- ],
29
- action: 'Expand the old_string to include more unique context',
30
- },
31
-
32
- // Bash 에러
33
- 'command not found': {
34
- hint: 'Command is not installed or not in PATH.',
35
- suggestions: [
36
- 'Check if the package is installed',
37
- 'Try using the full path to the command',
38
- 'For npm packages, ensure node_modules/.bin is in PATH or use npx',
39
- ],
40
- action: 'Install the required package or use an alternative command',
41
- },
42
- 'permission denied': {
43
- hint: 'Insufficient permissions for this operation.',
44
- suggestions: [
45
- 'Check file/directory permissions',
46
- 'For sudo operations, ensure user has proper access',
47
- 'On Windows, run as Administrator if needed',
48
- ],
49
- action: 'Check and fix permissions, or use a different approach',
50
- },
51
- 'ENOENT': {
52
- hint: 'File or directory does not exist.',
53
- suggestions: [
54
- 'Verify the path is correct',
55
- 'Create parent directories first with mkdir -p',
56
- 'Check for typos in the path',
57
- ],
58
- action: 'Create the missing directories or fix the path',
59
- },
60
- 'EACCES': {
61
- hint: 'Access denied to file or directory.',
62
- suggestions: [
63
- 'Check file ownership and permissions',
64
- 'Ensure the directory is not read-only',
65
- ],
66
- action: 'Fix permissions or choose a different location',
67
- },
68
-
69
- // Git 에러
70
- 'merge conflict': {
71
- hint: 'Git merge conflict detected.',
72
- suggestions: [
73
- 'Review conflicting files',
74
- 'Choose which changes to keep',
75
- 'Use git mergetool for complex conflicts',
76
- ],
77
- action: 'Resolve conflicts in the marked files, then git add and commit',
78
- },
79
- 'detached HEAD': {
80
- hint: 'Git is in detached HEAD state.',
81
- suggestions: [
82
- 'Create a branch to save your work: git checkout -b new-branch',
83
- 'Return to a branch: git checkout main',
84
- ],
85
- action: 'Create a branch if you want to keep changes',
86
- },
87
- 'diverged': {
88
- hint: 'Local and remote branches have diverged.',
89
- suggestions: [
90
- 'Pull with rebase: git pull --rebase',
91
- 'Or merge: git pull',
92
- 'Review differences first: git log HEAD..origin/main',
93
- ],
94
- action: 'Decide whether to rebase or merge',
95
- },
96
-
97
- // TypeScript/Build 에러
98
- 'Cannot find module': {
99
- hint: 'Module import failed.',
100
- suggestions: [
101
- 'Run npm install to ensure dependencies are installed',
102
- 'Check if the module path is correct',
103
- 'For local modules, verify the file exists',
104
- 'Check tsconfig.json paths configuration',
105
- ],
106
- action: 'Install missing dependencies or fix the import path',
107
- },
108
- 'Type error': {
109
- hint: 'TypeScript type mismatch.',
110
- suggestions: [
111
- 'Check the expected type in the function/variable definition',
112
- 'Use type assertion if confident (value as Type)',
113
- 'Add proper type guards for union types',
114
- ],
115
- action: 'Fix the type mismatch or add proper type handling',
116
- },
117
- };
118
-
119
- // 성공 패턴 감지
120
- const SUCCESS_PATTERNS = [
121
- /✓|✅|success|passed|complete|done/i,
122
- /^0 errors?$/im,
123
- /all tests passed/i,
124
- /build succeeded/i,
125
- ];
126
-
127
- /**
128
- * 출력에서 에러 감지 및 힌트 생성
129
- */
130
- function analyzeOutput(toolName, output, exitCode) {
131
- const result = {
132
- hasError: exitCode !== 0,
133
- hints: [],
134
- suggestions: [],
135
- recoveryAction: null,
136
- };
137
-
138
- // 성공 패턴 확인
139
- if (SUCCESS_PATTERNS.some(p => p.test(output))) {
140
- result.hasError = false;
141
- return result;
142
- }
143
-
144
- // 에러 패턴 매칭
145
- for (const [pattern, recovery] of Object.entries(ERROR_RECOVERY_HINTS)) {
146
- if (output.toLowerCase().includes(pattern.toLowerCase())) {
147
- result.hints.push(recovery.hint);
148
- result.suggestions.push(...recovery.suggestions);
149
- if (!result.recoveryAction) {
150
- result.recoveryAction = recovery.action;
151
- }
152
- }
153
- }
154
-
155
- // 에러가 감지됐는데 힌트가 없으면 일반 힌트 제공
156
- if (result.hasError && result.hints.length === 0) {
157
- result.hints.push('An error occurred. Check the output for details.');
158
- result.suggestions.push(
159
- 'Review the full error message',
160
- 'Search for the error message online',
161
- 'Check if similar issues exist in the project',
162
- );
163
- }
164
-
165
- return result;
166
- }
167
-
168
- /**
169
- * 출력 포맷
170
- */
171
- function formatRecoveryHint(toolName, analysis) {
172
- if (!analysis.hasError || analysis.hints.length === 0) {
173
- return '';
174
- }
175
-
176
- const lines = [];
177
- lines.push(`💡 POST-TOOL HINT: ${toolName} encountered an issue`);
178
- lines.push('');
179
-
180
- for (const hint of analysis.hints) {
181
- lines.push(`📌 ${hint}`);
182
- }
183
-
184
- if (analysis.suggestions.length > 0) {
185
- lines.push('');
186
- lines.push('Possible solutions:');
187
- for (const suggestion of analysis.suggestions) {
188
- lines.push(` • ${suggestion}`);
189
- }
190
- }
191
-
192
- if (analysis.recoveryAction) {
193
- lines.push('');
194
- lines.push(`🔧 Recommended action: ${analysis.recoveryAction}`);
195
- }
196
-
197
- return lines.join('\n');
198
- }
199
-
200
- // 메인 실행
201
- const toolName = process.argv[2] || 'unknown';
202
- const exitCode = parseInt(process.argv[3] || '0', 10);
203
- const output = process.argv[4] || process.env.TOOL_OUTPUT || '';
204
-
205
- const analysis = analyzeOutput(toolName, output, exitCode);
206
- const hint = formatRecoveryHint(toolName, analysis);
207
-
208
- if (hint) {
209
- console.log(hint);
210
- }
@@ -1,22 +0,0 @@
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();