maistro 1.0.390
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/LICENSE +15 -0
- package/README.md +107 -0
- package/dist/app.d.ts +247 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +4971 -0
- package/dist/app.js.map +1 -0
- package/dist/buildInfo.d.ts +5 -0
- package/dist/buildInfo.d.ts.map +1 -0
- package/dist/buildInfo.js +2 -0
- package/dist/buildInfo.js.map +1 -0
- package/dist/caffeinate.d.ts +72 -0
- package/dist/caffeinate.d.ts.map +1 -0
- package/dist/caffeinate.js +258 -0
- package/dist/caffeinate.js.map +1 -0
- package/dist/claudePath.d.ts +10 -0
- package/dist/claudePath.d.ts.map +1 -0
- package/dist/claudePath.js +34 -0
- package/dist/claudePath.js.map +1 -0
- package/dist/clipboard.d.ts +44 -0
- package/dist/clipboard.d.ts.map +1 -0
- package/dist/clipboard.js +442 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/config.d.ts +211 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +933 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +50 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +81 -0
- package/dist/constants.js.map +1 -0
- package/dist/contextBuilder.d.ts +38 -0
- package/dist/contextBuilder.d.ts.map +1 -0
- package/dist/contextBuilder.js +113 -0
- package/dist/contextBuilder.js.map +1 -0
- package/dist/dependencyDetector.d.ts +57 -0
- package/dist/dependencyDetector.d.ts.map +1 -0
- package/dist/dependencyDetector.js +505 -0
- package/dist/dependencyDetector.js.map +1 -0
- package/dist/executor.d.ts +83 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +583 -0
- package/dist/executor.js.map +1 -0
- package/dist/git.d.ts +85 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +283 -0
- package/dist/git.js.map +1 -0
- package/dist/imageManager.d.ts +161 -0
- package/dist/imageManager.d.ts.map +1 -0
- package/dist/imageManager.js +674 -0
- package/dist/imageManager.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +437 -0
- package/dist/index.js.map +1 -0
- package/dist/input-visual-test.d.ts +9 -0
- package/dist/input-visual-test.d.ts.map +1 -0
- package/dist/input-visual-test.js +108 -0
- package/dist/input-visual-test.js.map +1 -0
- package/dist/inputBox.d.ts +228 -0
- package/dist/inputBox.d.ts.map +1 -0
- package/dist/inputBox.js +966 -0
- package/dist/inputBox.js.map +1 -0
- package/dist/logger.d.ts +136 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +347 -0
- package/dist/logger.js.map +1 -0
- package/dist/orchestrator.d.ts +149 -0
- package/dist/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator.js +821 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/planner.d.ts +86 -0
- package/dist/planner.d.ts.map +1 -0
- package/dist/planner.js +830 -0
- package/dist/planner.js.map +1 -0
- package/dist/pty-test-runner.d.ts +87 -0
- package/dist/pty-test-runner.d.ts.map +1 -0
- package/dist/pty-test-runner.js +721 -0
- package/dist/pty-test-runner.js.map +1 -0
- package/dist/screen.d.ts +44 -0
- package/dist/screen.d.ts.map +1 -0
- package/dist/screen.js +152 -0
- package/dist/screen.js.map +1 -0
- package/dist/taskQueue.d.ts +70 -0
- package/dist/taskQueue.d.ts.map +1 -0
- package/dist/taskQueue.js +282 -0
- package/dist/taskQueue.js.map +1 -0
- package/dist/tui-test-harness.d.ts +216 -0
- package/dist/tui-test-harness.d.ts.map +1 -0
- package/dist/tui-test-harness.js +527 -0
- package/dist/tui-test-harness.js.map +1 -0
- package/dist/types.d.ts +257 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +46 -0
- package/dist/types.js.map +1 -0
- package/dist/ui-visual-test.d.ts +15 -0
- package/dist/ui-visual-test.d.ts.map +1 -0
- package/dist/ui-visual-test.js +141 -0
- package/dist/ui-visual-test.js.map +1 -0
- package/dist/ui.d.ts +272 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +1531 -0
- package/dist/ui.js.map +1 -0
- package/dist/validator.d.ts +53 -0
- package/dist/validator.d.ts.map +1 -0
- package/dist/validator.js +491 -0
- package/dist/validator.js.map +1 -0
- package/dist/versionCheck.d.ts +63 -0
- package/dist/versionCheck.d.ts.map +1 -0
- package/dist/versionCheck.js +261 -0
- package/dist/versionCheck.js.map +1 -0
- package/package.json +62 -0
package/dist/executor.js
ADDED
|
@@ -0,0 +1,583 @@
|
|
|
1
|
+
import { execa } from 'execa';
|
|
2
|
+
import { formatContext } from './contextBuilder.js';
|
|
3
|
+
import { getLogger } from './logger.js';
|
|
4
|
+
import { getImageAbsolutePath } from './imageManager.js';
|
|
5
|
+
import { getClaudePath } from './claudePath.js';
|
|
6
|
+
/**
|
|
7
|
+
* Truncate a string with "..." in the middle if it exceeds maxLength.
|
|
8
|
+
*/
|
|
9
|
+
export function truncateMiddle(str, maxLength) {
|
|
10
|
+
if (str.length <= maxLength)
|
|
11
|
+
return str;
|
|
12
|
+
const ellipsis = '...';
|
|
13
|
+
const charsToShow = maxLength - ellipsis.length;
|
|
14
|
+
const frontChars = Math.ceil(charsToShow / 2);
|
|
15
|
+
const backChars = Math.floor(charsToShow / 2);
|
|
16
|
+
return str.slice(0, frontChars) + ellipsis + str.slice(-backChars);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Format tool input arguments for display.
|
|
20
|
+
* Single arg: show value only. Multiple args: show full JSON.
|
|
21
|
+
* @deprecated Use formatToolCall instead for better tool-specific formatting
|
|
22
|
+
*/
|
|
23
|
+
export function formatToolArgs(input) {
|
|
24
|
+
if (!input)
|
|
25
|
+
return '';
|
|
26
|
+
const keys = Object.keys(input);
|
|
27
|
+
if (keys.length === 0)
|
|
28
|
+
return '';
|
|
29
|
+
if (keys.length === 1)
|
|
30
|
+
return String(input[keys[0]]);
|
|
31
|
+
return JSON.stringify(input);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Convert kebab-case or snake_case to Title Case
|
|
35
|
+
*/
|
|
36
|
+
function toTitleCase(str) {
|
|
37
|
+
return str
|
|
38
|
+
.replace(/[-_]/g, ' ')
|
|
39
|
+
.replace(/\b\w/g, c => c.toUpperCase());
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Format a tool call for display with tool-specific formatting.
|
|
43
|
+
*
|
|
44
|
+
* Examples:
|
|
45
|
+
* - Bash: 'Run tests "Bash(npm test)"'
|
|
46
|
+
* - Read: 'Read(/src/app.ts) Lines 10-59'
|
|
47
|
+
* - Edit: 'Edit(/src/app.ts)'
|
|
48
|
+
* - TodoWrite: 'TodoWrite(3 items)'
|
|
49
|
+
* - mcp__chrome-devtools__list_pages: 'MCP Chrome Devtools: List Pages'
|
|
50
|
+
*/
|
|
51
|
+
export function formatToolCall(toolName, input) {
|
|
52
|
+
// Handle MCP tools: mcp__server-name__tool_name
|
|
53
|
+
if (toolName.startsWith('mcp__')) {
|
|
54
|
+
const parts = toolName.slice(5).split('__');
|
|
55
|
+
if (parts.length >= 2) {
|
|
56
|
+
const serverName = toTitleCase(parts[0]);
|
|
57
|
+
const mcpToolName = toTitleCase(parts.slice(1).join(' '));
|
|
58
|
+
// Format args for MCP tools
|
|
59
|
+
let argsStr = '';
|
|
60
|
+
if (input && typeof input === 'object') {
|
|
61
|
+
if (Array.isArray(input)) {
|
|
62
|
+
argsStr = input.length > 0 ? ` (${input.length} items)` : '';
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
const keys = Object.keys(input);
|
|
66
|
+
if (keys.length === 1) {
|
|
67
|
+
const val = String(input[keys[0]]);
|
|
68
|
+
if (val.length <= 50)
|
|
69
|
+
argsStr = ` ${val}`;
|
|
70
|
+
}
|
|
71
|
+
else if (keys.length > 1) {
|
|
72
|
+
const truncatedJson = truncateMiddle(JSON.stringify(input), 80);
|
|
73
|
+
argsStr = ` ${truncatedJson}`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return `MCP ${serverName}: ${mcpToolName}${argsStr}`;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Handle empty/undefined input
|
|
81
|
+
if (!input) {
|
|
82
|
+
return toolName;
|
|
83
|
+
}
|
|
84
|
+
// Handle array input (e.g., TodoWrite)
|
|
85
|
+
if (Array.isArray(input)) {
|
|
86
|
+
return `${toolName}(${input.length} items)`;
|
|
87
|
+
}
|
|
88
|
+
// Tool-specific formatters
|
|
89
|
+
switch (toolName) {
|
|
90
|
+
case 'Bash': {
|
|
91
|
+
const command = input.command;
|
|
92
|
+
const description = input.description;
|
|
93
|
+
if (command) {
|
|
94
|
+
const truncatedCmd = truncateMiddle(command, 80);
|
|
95
|
+
if (description) {
|
|
96
|
+
const truncatedDesc = truncateMiddle(description, 60);
|
|
97
|
+
return `${truncatedDesc} "Bash(${truncatedCmd})"`;
|
|
98
|
+
}
|
|
99
|
+
return `Bash(${truncatedCmd})`;
|
|
100
|
+
}
|
|
101
|
+
return 'Bash';
|
|
102
|
+
}
|
|
103
|
+
case 'Read': {
|
|
104
|
+
const filePath = (input.file_path ?? input.path);
|
|
105
|
+
if (!filePath)
|
|
106
|
+
return 'Read';
|
|
107
|
+
const truncatedPath = truncateMiddle(filePath, 80);
|
|
108
|
+
const offset = input.offset;
|
|
109
|
+
const limit = input.limit;
|
|
110
|
+
if (offset !== undefined && limit !== undefined) {
|
|
111
|
+
return `Read(${truncatedPath}) Lines ${offset}-${offset + limit - 1}`;
|
|
112
|
+
}
|
|
113
|
+
return `Read(${truncatedPath})`;
|
|
114
|
+
}
|
|
115
|
+
case 'Edit': {
|
|
116
|
+
const filePath = (input.file_path ?? input.path);
|
|
117
|
+
if (!filePath)
|
|
118
|
+
return 'Edit';
|
|
119
|
+
return `Edit(${truncateMiddle(filePath, 100)})`;
|
|
120
|
+
}
|
|
121
|
+
case 'Write': {
|
|
122
|
+
const filePath = (input.file_path ?? input.path);
|
|
123
|
+
if (!filePath)
|
|
124
|
+
return 'Write';
|
|
125
|
+
return `Write(${truncateMiddle(filePath, 100)})`;
|
|
126
|
+
}
|
|
127
|
+
case 'Glob': {
|
|
128
|
+
const pattern = input.pattern;
|
|
129
|
+
if (!pattern)
|
|
130
|
+
return 'Glob';
|
|
131
|
+
return `Glob(${truncateMiddle(pattern, 100)})`;
|
|
132
|
+
}
|
|
133
|
+
case 'Grep': {
|
|
134
|
+
const pattern = input.pattern;
|
|
135
|
+
if (!pattern)
|
|
136
|
+
return 'Grep';
|
|
137
|
+
return `Grep(${truncateMiddle(pattern, 100)})`;
|
|
138
|
+
}
|
|
139
|
+
case 'WebFetch': {
|
|
140
|
+
const url = input.url;
|
|
141
|
+
if (!url)
|
|
142
|
+
return 'WebFetch';
|
|
143
|
+
return `WebFetch(${truncateMiddle(url, 100)})`;
|
|
144
|
+
}
|
|
145
|
+
case 'WebSearch': {
|
|
146
|
+
const query = input.query;
|
|
147
|
+
if (!query)
|
|
148
|
+
return 'WebSearch';
|
|
149
|
+
return `WebSearch("${truncateMiddle(query, 80)}")`;
|
|
150
|
+
}
|
|
151
|
+
case 'Task': {
|
|
152
|
+
const description = input.description;
|
|
153
|
+
const subagentType = input.subagent_type;
|
|
154
|
+
if (description && subagentType) {
|
|
155
|
+
return `Task(${subagentType}: ${truncateMiddle(description, 60)})`;
|
|
156
|
+
}
|
|
157
|
+
if (description) {
|
|
158
|
+
return `Task(${truncateMiddle(description, 80)})`;
|
|
159
|
+
}
|
|
160
|
+
return 'Task';
|
|
161
|
+
}
|
|
162
|
+
case 'TodoWrite': {
|
|
163
|
+
// TodoWrite takes an object with 'todos' array
|
|
164
|
+
const todos = input.todos;
|
|
165
|
+
if (Array.isArray(todos)) {
|
|
166
|
+
return `TodoWrite(${todos.length} items)`;
|
|
167
|
+
}
|
|
168
|
+
return 'TodoWrite';
|
|
169
|
+
}
|
|
170
|
+
default: {
|
|
171
|
+
// Generic fallback: show first meaningful arg or truncated JSON
|
|
172
|
+
const keys = Object.keys(input);
|
|
173
|
+
if (keys.length === 0)
|
|
174
|
+
return toolName;
|
|
175
|
+
if (keys.length === 1) {
|
|
176
|
+
const value = String(input[keys[0]]);
|
|
177
|
+
return `${toolName}(${truncateMiddle(value, 100)})`;
|
|
178
|
+
}
|
|
179
|
+
return `${toolName}(${truncateMiddle(JSON.stringify(input), 100)})`;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const DEFAULT_TIMEOUT = 10 * 60 * 1000; // 10 minutes
|
|
184
|
+
/**
|
|
185
|
+
* Run Claude Code CLI with the given prompt and options.
|
|
186
|
+
* Handles streaming output, abort polling, and error handling.
|
|
187
|
+
*/
|
|
188
|
+
async function runClaudeCode(options) {
|
|
189
|
+
const { prompt, cwd, timeout, env, onOutput, shouldAbort, taskId } = options;
|
|
190
|
+
// Create a clean environment for Claude Code CLI
|
|
191
|
+
// IMPORTANT: Exclude ANTHROPIC_API_KEY to prevent conflict with Claude's subscription auth
|
|
192
|
+
const { ANTHROPIC_API_KEY: _excluded, ...cleanEnv } = process.env;
|
|
193
|
+
const execaOptions = {
|
|
194
|
+
cwd,
|
|
195
|
+
timeout,
|
|
196
|
+
reject: false,
|
|
197
|
+
stdin: 'ignore',
|
|
198
|
+
stdout: 'pipe',
|
|
199
|
+
stderr: 'pipe',
|
|
200
|
+
buffer: false,
|
|
201
|
+
env: {
|
|
202
|
+
...cleanEnv,
|
|
203
|
+
...env,
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
const logger = getLogger();
|
|
207
|
+
try {
|
|
208
|
+
const subprocess = execa(getClaudePath(), ['--print', '--verbose', '--dangerously-skip-permissions', '--chrome', '--output-format', 'stream-json', '-p', prompt], execaOptions);
|
|
209
|
+
let stdout = '';
|
|
210
|
+
let stderr = '';
|
|
211
|
+
let lineBuffer = '';
|
|
212
|
+
const extractedErrors = []; // Collect API errors from JSON output
|
|
213
|
+
// Stream stdout - parse JSON lines for realtime output
|
|
214
|
+
if (subprocess.stdout) {
|
|
215
|
+
subprocess.stdout.on('data', (chunk) => {
|
|
216
|
+
const text = chunk.toString();
|
|
217
|
+
stdout += text;
|
|
218
|
+
// Always process lines for error extraction (even without onOutput callback)
|
|
219
|
+
lineBuffer += text;
|
|
220
|
+
const lines = lineBuffer.split('\n');
|
|
221
|
+
lineBuffer = lines.pop() || '';
|
|
222
|
+
for (const line of lines) {
|
|
223
|
+
if (!line.trim())
|
|
224
|
+
continue;
|
|
225
|
+
try {
|
|
226
|
+
const json = JSON.parse(line);
|
|
227
|
+
if (json.type === 'assistant' && json.message?.content) {
|
|
228
|
+
for (const block of json.message.content) {
|
|
229
|
+
if (block.type === 'text' && block.text) {
|
|
230
|
+
for (const textLine of block.text.split('\n')) {
|
|
231
|
+
if (textLine.trim()) {
|
|
232
|
+
onOutput?.(textLine);
|
|
233
|
+
// Capture API errors from output
|
|
234
|
+
if (textLine.includes('API Error:') || textLine.includes('rate limit') || textLine.includes('concurrency') ||
|
|
235
|
+
textLine.includes('OAuth token has expired') || textLine.includes('authentication_error')) {
|
|
236
|
+
extractedErrors.push(textLine.trim());
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
else if (block.type === 'tool_use') {
|
|
242
|
+
onOutput?.(`🔧 ${formatToolCall(block.name, block.input)}`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else if (json.type === 'result' && json.result) {
|
|
247
|
+
onOutput?.(`✓ ${json.result.slice(0, 100)}`);
|
|
248
|
+
}
|
|
249
|
+
else if (json.type === 'error' && json.error) {
|
|
250
|
+
// Capture explicit error messages from JSON
|
|
251
|
+
const errorMsg = typeof json.error === 'string' ? json.error : JSON.stringify(json.error);
|
|
252
|
+
extractedErrors.push(errorMsg);
|
|
253
|
+
onOutput?.(`Error: ${errorMsg}`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
catch {
|
|
257
|
+
// Non-JSON output - check for API errors and token expiration
|
|
258
|
+
if (line.includes('API Error:') || line.includes('rate limit') || line.includes('concurrency') ||
|
|
259
|
+
line.includes('OAuth token has expired') || line.includes('authentication_error')) {
|
|
260
|
+
extractedErrors.push(line.trim());
|
|
261
|
+
}
|
|
262
|
+
onOutput?.(line);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
if (subprocess.stderr) {
|
|
268
|
+
subprocess.stderr.on('data', (chunk) => {
|
|
269
|
+
stderr += chunk.toString();
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
let wasAborted = false;
|
|
273
|
+
let abortInterval = null;
|
|
274
|
+
if (shouldAbort) {
|
|
275
|
+
abortInterval = setInterval(() => {
|
|
276
|
+
if (shouldAbort()) {
|
|
277
|
+
wasAborted = true;
|
|
278
|
+
if (taskId) {
|
|
279
|
+
logger?.info('Aborting Claude Code execution (user requested)', { taskId });
|
|
280
|
+
}
|
|
281
|
+
subprocess.kill('SIGTERM');
|
|
282
|
+
setTimeout(() => {
|
|
283
|
+
if (!subprocess.killed) {
|
|
284
|
+
subprocess.kill('SIGKILL');
|
|
285
|
+
}
|
|
286
|
+
}, 1000);
|
|
287
|
+
}
|
|
288
|
+
}, 250);
|
|
289
|
+
}
|
|
290
|
+
const result = await subprocess;
|
|
291
|
+
if (abortInterval) {
|
|
292
|
+
clearInterval(abortInterval);
|
|
293
|
+
}
|
|
294
|
+
// Process any remaining content in the line buffer
|
|
295
|
+
if (lineBuffer.trim()) {
|
|
296
|
+
// Check for API errors and token expiration in remaining buffer
|
|
297
|
+
if (lineBuffer.includes('API Error:') || lineBuffer.includes('rate limit') || lineBuffer.includes('concurrency') ||
|
|
298
|
+
lineBuffer.includes('OAuth token has expired') || lineBuffer.includes('authentication_error')) {
|
|
299
|
+
extractedErrors.push(lineBuffer.trim());
|
|
300
|
+
}
|
|
301
|
+
onOutput?.(lineBuffer);
|
|
302
|
+
}
|
|
303
|
+
if (wasAborted) {
|
|
304
|
+
if (taskId) {
|
|
305
|
+
logger?.info('Claude Code execution was aborted', { taskId });
|
|
306
|
+
}
|
|
307
|
+
return {
|
|
308
|
+
success: false,
|
|
309
|
+
output: stdout,
|
|
310
|
+
error: 'Execution aborted by user',
|
|
311
|
+
exitCode: -2,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
let errorMessage;
|
|
315
|
+
if (result.exitCode !== 0) {
|
|
316
|
+
// Priority for error message:
|
|
317
|
+
// 1. Extracted API/runtime errors from output (most specific)
|
|
318
|
+
// 2. stderr output
|
|
319
|
+
// 3. Cleaned execa message (without the full command which contains prompt)
|
|
320
|
+
// 4. Generic exit code message
|
|
321
|
+
if (extractedErrors.length > 0) {
|
|
322
|
+
// Use the most recent/relevant extracted error
|
|
323
|
+
errorMessage = extractedErrors[extractedErrors.length - 1];
|
|
324
|
+
}
|
|
325
|
+
else if (stderr) {
|
|
326
|
+
errorMessage = stderr;
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
// Clean execa's message - it often includes the full command with prompt
|
|
330
|
+
// Extract just the error portion, not the command
|
|
331
|
+
const execaMessage = result.message
|
|
332
|
+
|| result.shortMessage
|
|
333
|
+
|| '';
|
|
334
|
+
// execa format: "Command failed with exit code X: /path/to/cmd args..."
|
|
335
|
+
// We want to keep just "Command failed with exit code X" or extract actual error
|
|
336
|
+
const cleanedMessage = execaMessage
|
|
337
|
+
.replace(/:\s*\/[^\s]+\s+--.*$/s, '') // Remove command path and arguments
|
|
338
|
+
.replace(/:\s*claude\s+--.*$/s, '') // Remove "claude --..." pattern
|
|
339
|
+
.trim();
|
|
340
|
+
errorMessage = cleanedMessage || `Process exited with code ${result.exitCode}`;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return {
|
|
344
|
+
success: result.exitCode === 0,
|
|
345
|
+
output: stdout,
|
|
346
|
+
error: errorMessage,
|
|
347
|
+
exitCode: result.exitCode ?? -1,
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
catch (error) {
|
|
351
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
352
|
+
if (taskId) {
|
|
353
|
+
logger?.error('Claude Code execution exception', { taskId, error: errorMessage });
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
success: false,
|
|
357
|
+
output: '',
|
|
358
|
+
error: errorMessage,
|
|
359
|
+
exitCode: -1,
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Build the prompt for Claude Code with full project context
|
|
365
|
+
*/
|
|
366
|
+
export function buildPrompt(task, context, projectContext, imageMetadata, projectPath) {
|
|
367
|
+
const parts = [];
|
|
368
|
+
// Project overview (if provided)
|
|
369
|
+
if (projectContext) {
|
|
370
|
+
parts.push('# Project Overview');
|
|
371
|
+
parts.push('');
|
|
372
|
+
parts.push(`**Project:** ${projectContext.projectName}`);
|
|
373
|
+
parts.push(`**Goal:** ${projectContext.goal}`);
|
|
374
|
+
parts.push(`**Progress:** Task ${projectContext.currentTaskIndex + 1} of ${projectContext.totalTasks}`);
|
|
375
|
+
parts.push('');
|
|
376
|
+
// Show completed tasks (brief summary)
|
|
377
|
+
if (projectContext.completedTasks.length > 0) {
|
|
378
|
+
parts.push('## Completed Tasks');
|
|
379
|
+
projectContext.completedTasks.forEach((t, i) => {
|
|
380
|
+
parts.push(`${i + 1}. ✓ ${t.title}`);
|
|
381
|
+
});
|
|
382
|
+
parts.push('');
|
|
383
|
+
}
|
|
384
|
+
// Show upcoming tasks (brief summary)
|
|
385
|
+
if (projectContext.pendingTasks.length > 0) {
|
|
386
|
+
parts.push('## Upcoming Tasks');
|
|
387
|
+
projectContext.pendingTasks.slice(0, 3).forEach((t, i) => {
|
|
388
|
+
parts.push(`${i + 1}. ${t.title}`);
|
|
389
|
+
});
|
|
390
|
+
if (projectContext.pendingTasks.length > 3) {
|
|
391
|
+
parts.push(` ... and ${projectContext.pendingTasks.length - 3} more`);
|
|
392
|
+
}
|
|
393
|
+
parts.push('');
|
|
394
|
+
}
|
|
395
|
+
parts.push('---');
|
|
396
|
+
parts.push('');
|
|
397
|
+
}
|
|
398
|
+
// Current task
|
|
399
|
+
parts.push(`# Current Task: ${task.title}`);
|
|
400
|
+
parts.push('');
|
|
401
|
+
parts.push('## Description');
|
|
402
|
+
parts.push(task.description);
|
|
403
|
+
parts.push('');
|
|
404
|
+
// Relevant files (paths only - Claude Code can read them)
|
|
405
|
+
if (context.files.length > 0) {
|
|
406
|
+
parts.push('## Relevant Files');
|
|
407
|
+
parts.push('');
|
|
408
|
+
parts.push('The following files are relevant to this task. Use the Read tool to examine them as needed:');
|
|
409
|
+
parts.push('');
|
|
410
|
+
parts.push(formatContext(context));
|
|
411
|
+
parts.push('');
|
|
412
|
+
}
|
|
413
|
+
// Reference images (if task has image references)
|
|
414
|
+
if (task.imageRefs && task.imageRefs.length > 0 && imageMetadata && projectPath) {
|
|
415
|
+
const referencedImages = task.imageRefs
|
|
416
|
+
.map(ref => {
|
|
417
|
+
const img = imageMetadata[ref];
|
|
418
|
+
if (!img)
|
|
419
|
+
return null;
|
|
420
|
+
// Compute absolute path for the image
|
|
421
|
+
const absolutePath = getImageAbsolutePath(projectPath, img.storagePath);
|
|
422
|
+
return { ...img, absolutePath };
|
|
423
|
+
})
|
|
424
|
+
.filter((img) => img !== null);
|
|
425
|
+
if (referencedImages.length > 0) {
|
|
426
|
+
parts.push('## Reference Images');
|
|
427
|
+
parts.push('');
|
|
428
|
+
parts.push('This task includes reference images. Use the Read tool to view them:');
|
|
429
|
+
parts.push('');
|
|
430
|
+
for (const img of referencedImages) {
|
|
431
|
+
parts.push(`- **${img.id}**: \`${img.absolutePath}\``);
|
|
432
|
+
if (img.description) {
|
|
433
|
+
parts.push(` Description: ${img.description}`);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
parts.push('');
|
|
437
|
+
parts.push('**Important:** Review these images before implementing to ensure your work matches the visual requirements.');
|
|
438
|
+
parts.push('');
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
// Validation
|
|
442
|
+
if (task.testCommand) {
|
|
443
|
+
parts.push('## Validation');
|
|
444
|
+
parts.push(`After completing the task, run: \`${task.testCommand}\``);
|
|
445
|
+
parts.push('');
|
|
446
|
+
}
|
|
447
|
+
// Instructions
|
|
448
|
+
parts.push('## Instructions');
|
|
449
|
+
parts.push('1. Implement the changes described above');
|
|
450
|
+
parts.push('2. Make minimal, focused changes');
|
|
451
|
+
parts.push('3. Do not modify unrelated code');
|
|
452
|
+
parts.push('4. Ensure your changes align with the overall project goal');
|
|
453
|
+
if (task.testCommand) {
|
|
454
|
+
parts.push(`5. Verify your changes with: ${task.testCommand}`);
|
|
455
|
+
}
|
|
456
|
+
return parts.join('\n');
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Execute a task using Claude Code CLI
|
|
460
|
+
*/
|
|
461
|
+
export async function executeTask(task, context, options, projectContext, imageMetadata) {
|
|
462
|
+
const prompt = buildPrompt(task, context, projectContext, imageMetadata, options.cwd);
|
|
463
|
+
const logger = getLogger();
|
|
464
|
+
logger?.info('Executing Claude Code', {
|
|
465
|
+
taskId: task.id,
|
|
466
|
+
claudePath: getClaudePath(),
|
|
467
|
+
cwd: options.cwd,
|
|
468
|
+
promptLength: prompt.length,
|
|
469
|
+
});
|
|
470
|
+
// Log the full prompt to task log for visibility
|
|
471
|
+
logger?.taskPrompt(task.id, prompt);
|
|
472
|
+
const result = await runClaudeCode({
|
|
473
|
+
prompt,
|
|
474
|
+
cwd: options.cwd,
|
|
475
|
+
timeout: options.timeout ?? DEFAULT_TIMEOUT,
|
|
476
|
+
env: options.env,
|
|
477
|
+
onOutput: options.onOutput,
|
|
478
|
+
shouldAbort: options.shouldAbort,
|
|
479
|
+
taskId: task.id,
|
|
480
|
+
});
|
|
481
|
+
logger?.execution(task.id, `claude --print --dangerously-skip-permissions -p "..."`, result.exitCode, result.error);
|
|
482
|
+
if (result.exitCode !== 0 && result.error) {
|
|
483
|
+
logger?.error('Claude Code stderr', { taskId: task.id, stderr: result.error.slice(0, 500) });
|
|
484
|
+
}
|
|
485
|
+
return result;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Execute a task with retry feedback
|
|
489
|
+
*/
|
|
490
|
+
export async function executeTaskWithFeedback(task, context, previousError, options, projectContext, imageMetadata) {
|
|
491
|
+
const basePrompt = buildPrompt(task, context, projectContext, imageMetadata, options.cwd);
|
|
492
|
+
// Build feedback section based on failure type
|
|
493
|
+
const feedbackParts = [
|
|
494
|
+
basePrompt,
|
|
495
|
+
'',
|
|
496
|
+
'## Previous Attempt Failed',
|
|
497
|
+
];
|
|
498
|
+
if (task.failureType === 'acceptance') {
|
|
499
|
+
feedbackParts.push('The previous implementation was completed but **failed validation**. The code changes did not satisfy the acceptance criteria.', '', '### Validation Feedback', '```', previousError, '```', '', '### Instructions for This Retry', '1. Review the validation feedback above carefully', '2. Identify exactly what acceptance criteria were not met', '3. Make the **specific fixes** listed in the feedback', '4. Do NOT rewrite the entire implementation - only fix what failed', '5. Ensure your changes satisfy ALL acceptance criteria');
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
feedbackParts.push('The previous attempt to complete this task failed during execution:', '', '```', previousError, '```', '', 'Please try again, addressing the error above.');
|
|
503
|
+
}
|
|
504
|
+
return runClaudeCode({
|
|
505
|
+
prompt: feedbackParts.join('\n'),
|
|
506
|
+
cwd: options.cwd,
|
|
507
|
+
timeout: options.timeout ?? DEFAULT_TIMEOUT,
|
|
508
|
+
env: options.env,
|
|
509
|
+
onOutput: options.onOutput,
|
|
510
|
+
shouldAbort: options.shouldAbort,
|
|
511
|
+
taskId: task.id,
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Check if Claude Code CLI is available
|
|
516
|
+
*/
|
|
517
|
+
export async function isClaudeCodeAvailable() {
|
|
518
|
+
try {
|
|
519
|
+
const result = await execa(getClaudePath(), ['--version'], { reject: false });
|
|
520
|
+
return result.exitCode === 0;
|
|
521
|
+
}
|
|
522
|
+
catch {
|
|
523
|
+
return false;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Get Claude Code version
|
|
528
|
+
*/
|
|
529
|
+
export async function getClaudeCodeVersion() {
|
|
530
|
+
try {
|
|
531
|
+
const result = await execa(getClaudePath(), ['--version'], { reject: false });
|
|
532
|
+
if (result.exitCode === 0) {
|
|
533
|
+
const stdout = typeof result.stdout === 'string' ? result.stdout : '';
|
|
534
|
+
return stdout.trim();
|
|
535
|
+
}
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
catch {
|
|
539
|
+
return null;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Run Claude Code's /init command to create CLAUDE.md
|
|
544
|
+
* This command analyzes the project and creates a CLAUDE.md with project context
|
|
545
|
+
*/
|
|
546
|
+
export async function runClaudeInit(options) {
|
|
547
|
+
const timeout = options.timeout ?? 120000; // 2 minutes default
|
|
548
|
+
// Create a clean environment for Claude Code CLI
|
|
549
|
+
const { ANTHROPIC_API_KEY: _excluded, ...cleanEnv } = process.env;
|
|
550
|
+
try {
|
|
551
|
+
const result = await execa(getClaudePath(), ['--print', '--dangerously-skip-permissions', '-p', '/init'], {
|
|
552
|
+
cwd: options.cwd,
|
|
553
|
+
timeout,
|
|
554
|
+
reject: false,
|
|
555
|
+
stdin: 'ignore',
|
|
556
|
+
env: cleanEnv,
|
|
557
|
+
});
|
|
558
|
+
const stdout = typeof result.stdout === 'string' ? result.stdout : '';
|
|
559
|
+
const stderr = typeof result.stderr === 'string' ? result.stderr : '';
|
|
560
|
+
if (result.exitCode !== 0) {
|
|
561
|
+
return {
|
|
562
|
+
success: false,
|
|
563
|
+
output: stdout,
|
|
564
|
+
error: stderr || `Claude /init exited with code ${result.exitCode}`,
|
|
565
|
+
exitCode: result.exitCode ?? -1,
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
return {
|
|
569
|
+
success: true,
|
|
570
|
+
output: stdout,
|
|
571
|
+
exitCode: 0,
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
catch (error) {
|
|
575
|
+
return {
|
|
576
|
+
success: false,
|
|
577
|
+
output: '',
|
|
578
|
+
error: error instanceof Error ? error.message : String(error),
|
|
579
|
+
exitCode: -1,
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../src/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAoD,MAAM,OAAO,CAAC;AAEhF,OAAO,EAAE,aAAa,EAAsB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,SAAiB;IAC3D,IAAI,GAAG,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,GAAG,CAAC;IACxC,MAAM,QAAQ,GAAG,KAAK,CAAC;IACvB,MAAM,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC;IAChD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;IAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;IAC9C,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC;AACrE,CAAC;AAED;;;;GAIG;AACH,M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