@gracefultools/astrid-sdk 0.1.0

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.
@@ -0,0 +1,654 @@
1
+ "use strict";
2
+ /**
3
+ * Claude Agent SDK Executor
4
+ *
5
+ * Executes code implementation using Claude Code's native tools (Read, Write, Edit, Bash)
6
+ * instead of generating code via API and parsing JSON responses.
7
+ *
8
+ * This provides:
9
+ * - Better code quality (real file editing vs generated text)
10
+ * - Native error handling and recovery
11
+ * - Actual test execution
12
+ * - Real git operations
13
+ */
14
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ var desc = Object.getOwnPropertyDescriptor(m, k);
17
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
+ desc = { enumerable: true, get: function() { return m[k]; } };
19
+ }
20
+ Object.defineProperty(o, k2, desc);
21
+ }) : (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ o[k2] = m[k];
24
+ }));
25
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
27
+ }) : function(o, v) {
28
+ o["default"] = v;
29
+ });
30
+ var __importStar = (this && this.__importStar) || (function () {
31
+ var ownKeys = function(o) {
32
+ ownKeys = Object.getOwnPropertyNames || function (o) {
33
+ var ar = [];
34
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
+ return ar;
36
+ };
37
+ return ownKeys(o);
38
+ };
39
+ return function (mod) {
40
+ if (mod && mod.__esModule) return mod;
41
+ var result = {};
42
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
+ __setModuleDefault(result, mod);
44
+ return result;
45
+ };
46
+ })();
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.planWithClaude = planWithClaude;
49
+ exports.executeWithClaude = executeWithClaude;
50
+ exports.prepareRepository = prepareRepository;
51
+ const claude_agent_sdk_1 = require("@anthropic-ai/claude-agent-sdk");
52
+ const fs = __importStar(require("fs/promises"));
53
+ const path = __importStar(require("path"));
54
+ // ============================================================================
55
+ // REPOSITORY CONTEXT LOADING
56
+ // ============================================================================
57
+ /**
58
+ * Load ASTRID.md from the repository if it exists
59
+ */
60
+ async function loadAstridMd(repoPath) {
61
+ const astridPath = path.join(repoPath, 'ASTRID.md');
62
+ try {
63
+ const content = await fs.readFile(astridPath, 'utf-8');
64
+ return content.length > 8000 ? content.substring(0, 8000) + '\n\n[ASTRID.md truncated...]' : content;
65
+ }
66
+ catch {
67
+ return null;
68
+ }
69
+ }
70
+ /**
71
+ * Detect the test command for the repository
72
+ */
73
+ async function detectTestCommand(repoPath) {
74
+ const packageJsonPath = path.join(repoPath, 'package.json');
75
+ try {
76
+ const content = await fs.readFile(packageJsonPath, 'utf-8');
77
+ const pkg = JSON.parse(content);
78
+ if (pkg.scripts?.test) {
79
+ return 'npm test';
80
+ }
81
+ if (pkg.scripts?.['predeploy:quick']) {
82
+ return 'npm run predeploy:quick';
83
+ }
84
+ if (pkg.scripts?.predeploy) {
85
+ return 'npm run predeploy';
86
+ }
87
+ }
88
+ catch {
89
+ // No package.json or invalid JSON
90
+ }
91
+ return null;
92
+ }
93
+ /**
94
+ * Detect iOS project and return build info
95
+ */
96
+ async function detectiOSProject(repoPath) {
97
+ const possiblePaths = ['ios-app', 'ios', 'iOS', '.'];
98
+ for (const subdir of possiblePaths) {
99
+ const searchPath = path.join(repoPath, subdir);
100
+ try {
101
+ const entries = await fs.readdir(searchPath);
102
+ const xcodeproj = entries.find(e => e.endsWith('.xcodeproj'));
103
+ if (xcodeproj) {
104
+ const schemeName = xcodeproj.replace('.xcodeproj', '');
105
+ const projectPath = subdir === '.' ? xcodeproj : `${subdir}/${xcodeproj}`;
106
+ return {
107
+ hasIOSProject: true,
108
+ projectPath,
109
+ schemeName,
110
+ buildCommand: `cd ${subdir === '.' ? '.' : subdir} && xcodebuild -scheme "${schemeName}" -destination "platform=iOS Simulator,name=iPhone 16" -configuration Debug build 2>&1 | tail -50`
111
+ };
112
+ }
113
+ }
114
+ catch {
115
+ // Directory doesn't exist
116
+ }
117
+ }
118
+ return null;
119
+ }
120
+ // ============================================================================
121
+ // PLANNING
122
+ // ============================================================================
123
+ /**
124
+ * Generate an implementation plan using Claude Agent SDK
125
+ */
126
+ async function planWithClaude(taskTitle, taskDescription, config) {
127
+ const log = config.logger || (() => { });
128
+ const onProgress = config.onProgress || (() => { });
129
+ log('info', 'Starting Claude Agent SDK planning', {
130
+ repoPath: config.repoPath,
131
+ taskTitle
132
+ });
133
+ onProgress('Initializing Claude Code for planning...');
134
+ const astridMd = await loadAstridMd(config.repoPath);
135
+ if (astridMd) {
136
+ log('info', 'Loaded ASTRID.md from repository');
137
+ onProgress('Loaded project context from ASTRID.md');
138
+ }
139
+ if (config.previousContext?.hasBeenProcessedBefore) {
140
+ log('info', 'Task has previous context', {
141
+ attempts: config.previousContext.previousAttempts.length,
142
+ feedbackItems: config.previousContext.userFeedback.length
143
+ });
144
+ onProgress('Considering previous attempts and user feedback...');
145
+ }
146
+ const prompt = buildPlanningPrompt(taskTitle, taskDescription, astridMd, config.previousContext);
147
+ const options = {
148
+ cwd: config.repoPath,
149
+ permissionMode: 'default',
150
+ maxTurns: config.maxTurns || 30,
151
+ maxBudgetUsd: config.maxBudgetUsd || 2.0,
152
+ allowedTools: ['Read', 'Glob', 'Grep', 'Bash'],
153
+ settingSources: [],
154
+ systemPrompt: {
155
+ type: 'preset',
156
+ preset: 'claude_code',
157
+ append: `
158
+ You are analyzing a codebase to create an implementation plan for a coding task.
159
+
160
+ CRITICAL RULES:
161
+ 1. DO NOT modify any files - this is READ-ONLY exploration
162
+ 2. DO NOT use Write or Edit tools
163
+ 3. Explore the codebase to understand the structure and patterns
164
+ 4. Read relevant files to understand existing implementations
165
+ 5. Create a focused, surgical implementation plan
166
+
167
+ After exploring, output ONLY a JSON block with this exact structure:
168
+ \`\`\`json
169
+ {
170
+ "summary": "Brief summary of what needs to be done",
171
+ "approach": "High-level approach to implementing the changes",
172
+ "files": [
173
+ {
174
+ "path": "path/to/file.ts",
175
+ "purpose": "Why this file needs changes",
176
+ "changes": "Specific changes to make"
177
+ }
178
+ ],
179
+ "estimatedComplexity": "simple|medium|complex",
180
+ "considerations": ["Important consideration 1", "Important consideration 2"]
181
+ }
182
+ \`\`\`
183
+
184
+ PLANNING RULES:
185
+ - Maximum 5 files in the plan
186
+ - Be SURGICAL: only list files that MUST change
187
+ - Include specific file paths you discovered
188
+ - Consider existing patterns in the codebase
189
+ `
190
+ }
191
+ };
192
+ const env = { ...process.env };
193
+ if (config.apiKey) {
194
+ env.ANTHROPIC_API_KEY = config.apiKey;
195
+ }
196
+ options.env = env;
197
+ try {
198
+ const messages = [];
199
+ let result = null;
200
+ const exploredFiles = [];
201
+ onProgress('Claude Code is exploring the codebase...');
202
+ for await (const message of (0, claude_agent_sdk_1.query)({ prompt, options })) {
203
+ messages.push(message);
204
+ if (message.type === 'assistant') {
205
+ const content = message.message.content;
206
+ if (Array.isArray(content)) {
207
+ for (const block of content) {
208
+ if (block.type === 'text' && block.text) {
209
+ onProgress(`Analyzing: ${block.text.substring(0, 100)}...`);
210
+ }
211
+ if (block.type === 'tool_use') {
212
+ onProgress(`Exploring: ${block.name}`);
213
+ log('info', 'Tool use (planning)', { tool: block.name, input: block.input });
214
+ if (block.name === 'Read' && typeof block.input === 'object' && block.input !== null) {
215
+ const input = block.input;
216
+ if (input.file_path) {
217
+ exploredFiles.push({
218
+ path: input.file_path,
219
+ content: '',
220
+ relevance: 'Explored during planning'
221
+ });
222
+ }
223
+ }
224
+ }
225
+ }
226
+ }
227
+ }
228
+ if (message.type === 'result') {
229
+ result = message;
230
+ }
231
+ }
232
+ if (!result) {
233
+ throw new Error('No result received from Claude Agent SDK');
234
+ }
235
+ if (result.subtype !== 'success') {
236
+ const errorResult = result;
237
+ throw new Error(`Planning failed: ${result.subtype} - ${errorResult.errors?.join(', ') || 'Unknown error'}`);
238
+ }
239
+ log('info', 'Claude Agent SDK planning completed', {
240
+ turns: result.num_turns,
241
+ costUsd: result.total_cost_usd,
242
+ filesExplored: exploredFiles.length
243
+ });
244
+ const plan = parsePlanFromResult(result, exploredFiles, log);
245
+ if (!plan) {
246
+ throw new Error('Could not parse implementation plan from Claude output');
247
+ }
248
+ return {
249
+ success: true,
250
+ plan,
251
+ usage: {
252
+ inputTokens: result.usage.input_tokens,
253
+ outputTokens: result.usage.output_tokens,
254
+ costUSD: result.total_cost_usd
255
+ }
256
+ };
257
+ }
258
+ catch (error) {
259
+ const errorMessage = error instanceof Error ? error.message : String(error);
260
+ log('error', 'Claude Agent SDK planning failed', { error: errorMessage });
261
+ return {
262
+ success: false,
263
+ error: errorMessage
264
+ };
265
+ }
266
+ }
267
+ // ============================================================================
268
+ // EXECUTION
269
+ // ============================================================================
270
+ /**
271
+ * Execute an implementation plan using Claude Agent SDK
272
+ */
273
+ async function executeWithClaude(plan, taskTitle, taskDescription, config) {
274
+ const log = config.logger || (() => { });
275
+ const onProgress = config.onProgress || (() => { });
276
+ log('info', 'Starting Claude Agent SDK execution', {
277
+ repoPath: config.repoPath,
278
+ filesInPlan: plan.files.length,
279
+ complexity: plan.estimatedComplexity
280
+ });
281
+ onProgress('Initializing Claude Code agent...');
282
+ const astridMd = await loadAstridMd(config.repoPath);
283
+ const testCommand = await detectTestCommand(config.repoPath);
284
+ const iosProject = await detectiOSProject(config.repoPath);
285
+ if (astridMd)
286
+ log('info', 'Loaded ASTRID.md from repository');
287
+ if (testCommand)
288
+ log('info', `Detected test command: ${testCommand}`);
289
+ if (iosProject?.hasIOSProject) {
290
+ log('info', `Detected iOS project: ${iosProject.projectPath}`);
291
+ onProgress(`Found iOS project: ${iosProject.schemeName}`);
292
+ }
293
+ const prompt = buildImplementationPrompt(plan, taskTitle, taskDescription, astridMd, testCommand, iosProject);
294
+ let testingInstructions = '';
295
+ if (testCommand) {
296
+ testingInstructions += `
297
+ WEB/NODE TESTING:
298
+ 1. After making code changes, run: ${testCommand}
299
+ 2. If tests fail, fix the issues before completing`;
300
+ }
301
+ if (iosProject?.hasIOSProject) {
302
+ testingInstructions += `
303
+
304
+ iOS BUILD REQUIREMENTS (CRITICAL):
305
+ 1. If you modified ANY Swift files, you MUST run the iOS build
306
+ 2. Build command: ${iosProject.buildCommand}
307
+ 3. If the build fails, FIX THE ERRORS before completing`;
308
+ }
309
+ const options = {
310
+ cwd: config.repoPath,
311
+ permissionMode: 'acceptEdits',
312
+ maxTurns: config.maxTurns || 50,
313
+ maxBudgetUsd: config.maxBudgetUsd || 5.0,
314
+ allowedTools: ['Read', 'Write', 'Edit', 'Glob', 'Grep', 'Bash'],
315
+ settingSources: [],
316
+ systemPrompt: {
317
+ type: 'preset',
318
+ preset: 'claude_code',
319
+ append: `
320
+ You are implementing a coding task from an approved plan.
321
+
322
+ CRITICAL RULES:
323
+ 1. Follow the implementation plan exactly
324
+ 2. Create/modify ONLY the files specified in the plan
325
+ 3. Write complete, working code - no placeholders or TODOs
326
+ 4. Run tests/builds after making changes - they MUST pass
327
+ 5. Do NOT commit changes - just make the file edits
328
+ ${testingInstructions}
329
+
330
+ After completing all changes, output a JSON block:
331
+ \`\`\`json
332
+ {
333
+ "completed": true,
334
+ "filesModified": ["path/to/file1.ts"],
335
+ "testsRun": true,
336
+ "testsPassed": true,
337
+ "commitMessage": "brief commit message",
338
+ "prTitle": "PR title",
339
+ "prDescription": "What this PR does"
340
+ }
341
+ \`\`\`
342
+ `
343
+ }
344
+ };
345
+ const env = { ...process.env };
346
+ if (config.apiKey) {
347
+ env.ANTHROPIC_API_KEY = config.apiKey;
348
+ }
349
+ options.env = env;
350
+ try {
351
+ const messages = [];
352
+ let result = null;
353
+ onProgress('Claude Code is analyzing the codebase...');
354
+ for await (const message of (0, claude_agent_sdk_1.query)({ prompt, options })) {
355
+ messages.push(message);
356
+ if (message.type === 'assistant') {
357
+ const content = message.message.content;
358
+ if (Array.isArray(content)) {
359
+ for (const block of content) {
360
+ if (block.type === 'text' && block.text) {
361
+ onProgress(`Working: ${block.text.substring(0, 100)}...`);
362
+ }
363
+ if (block.type === 'tool_use') {
364
+ onProgress(`Using tool: ${block.name}`);
365
+ log('info', 'Tool use', { tool: block.name, input: block.input });
366
+ }
367
+ }
368
+ }
369
+ }
370
+ if (message.type === 'result') {
371
+ result = message;
372
+ }
373
+ }
374
+ if (!result) {
375
+ throw new Error('No result received from Claude Agent SDK');
376
+ }
377
+ if (result.subtype !== 'success') {
378
+ const errorResult = result;
379
+ throw new Error(`Execution failed: ${result.subtype} - ${errorResult.errors?.join(', ') || 'Unknown error'}`);
380
+ }
381
+ log('info', 'Claude Agent SDK execution completed', {
382
+ turns: result.num_turns,
383
+ costUsd: result.total_cost_usd,
384
+ inputTokens: result.usage.input_tokens,
385
+ outputTokens: result.usage.output_tokens
386
+ });
387
+ const executionResult = await parseExecutionResult(config.repoPath, result, plan, log);
388
+ return {
389
+ ...executionResult,
390
+ usage: {
391
+ inputTokens: result.usage.input_tokens,
392
+ outputTokens: result.usage.output_tokens,
393
+ costUSD: result.total_cost_usd
394
+ }
395
+ };
396
+ }
397
+ catch (error) {
398
+ const errorMessage = error instanceof Error ? error.message : String(error);
399
+ log('error', 'Claude Agent SDK execution failed', { error: errorMessage });
400
+ return {
401
+ success: false,
402
+ files: [],
403
+ commitMessage: '',
404
+ prTitle: '',
405
+ prDescription: '',
406
+ error: errorMessage
407
+ };
408
+ }
409
+ }
410
+ // ============================================================================
411
+ // REPOSITORY PREPARATION
412
+ // ============================================================================
413
+ /**
414
+ * Prepare a repository for execution
415
+ */
416
+ async function prepareRepository(repoOwner, repoName, branch, githubToken, workDir) {
417
+ const { execSync } = await import('child_process');
418
+ const os = await import('os');
419
+ const tempDir = workDir || await fs.mkdtemp(path.join(os.tmpdir(), 'claude-agent-'));
420
+ const repoPath = path.join(tempDir, repoName);
421
+ const cloneUrl = `https://x-access-token:${githubToken}@github.com/${repoOwner}/${repoName}.git`;
422
+ execSync(`git clone --depth 1 --branch ${branch} ${cloneUrl} ${repoPath}`, {
423
+ stdio: 'pipe',
424
+ timeout: 120000
425
+ });
426
+ execSync('git config user.email "ai-agent@astrid.cc"', { cwd: repoPath });
427
+ execSync('git config user.name "Astrid AI Agent"', { cwd: repoPath });
428
+ return {
429
+ repoPath,
430
+ cleanup: async () => {
431
+ try {
432
+ await fs.rm(tempDir, { recursive: true, force: true });
433
+ }
434
+ catch {
435
+ // Ignore cleanup errors
436
+ }
437
+ }
438
+ };
439
+ }
440
+ // ============================================================================
441
+ // HELPER FUNCTIONS
442
+ // ============================================================================
443
+ function buildPlanningPrompt(taskTitle, taskDescription, astridMd, previousContext) {
444
+ const contextSection = astridMd
445
+ ? `## Project Context (from ASTRID.md)\n\n${astridMd}\n\n---\n\n`
446
+ : '';
447
+ let previousAttemptsSection = '';
448
+ if (previousContext?.hasBeenProcessedBefore) {
449
+ previousAttemptsSection = `## Previous Attempts & User Feedback\n\n`;
450
+ if (previousContext.previousAttempts.length > 0) {
451
+ previousAttemptsSection += `### Previous Attempts\n`;
452
+ previousContext.previousAttempts.forEach((attempt, i) => {
453
+ previousAttemptsSection += `\n**Attempt ${i + 1}:**\n`;
454
+ if (attempt.planSummary)
455
+ previousAttemptsSection += `- Previous plan: ${attempt.planSummary}\n`;
456
+ if (attempt.filesModified?.length)
457
+ previousAttemptsSection += `- Files modified: ${attempt.filesModified.slice(0, 5).join(', ')}\n`;
458
+ if (attempt.prUrl)
459
+ previousAttemptsSection += `- PR created: ${attempt.prUrl}\n`;
460
+ if (attempt.outcome)
461
+ previousAttemptsSection += `- Outcome: ${attempt.outcome}\n`;
462
+ });
463
+ }
464
+ if (previousContext.userFeedback.length > 0) {
465
+ previousAttemptsSection += `\n### User Feedback (Address These)\n`;
466
+ previousContext.userFeedback.forEach(feedback => {
467
+ previousAttemptsSection += `\n> "${feedback.content}"\n`;
468
+ });
469
+ }
470
+ previousAttemptsSection += `\n---\n\n`;
471
+ }
472
+ return `# Planning Task
473
+
474
+ ${contextSection}${previousAttemptsSection}## Task to Implement
475
+ **${taskTitle}**
476
+
477
+ ${taskDescription || 'No additional description provided.'}
478
+
479
+ ## Your Mission
480
+
481
+ 1. **Check for ASTRID.md** - Read project context
482
+ 2. **Explore the codebase** - Understand structure and patterns
483
+ 3. **Read key files** - Understand implementations you'll change
484
+ 4. **Create an implementation plan** - List specific files to modify
485
+
486
+ Begin exploration now.`;
487
+ }
488
+ function buildImplementationPrompt(plan, taskTitle, taskDescription, astridMd, testCommand, iosProject) {
489
+ const filesSection = plan.files
490
+ .map(f => `- **${f.path}**: ${f.purpose}\n Changes: ${f.changes}`)
491
+ .join('\n');
492
+ const contextSection = astridMd
493
+ ? `## Project Context\n\n${astridMd.substring(0, 4000)}${astridMd.length > 4000 ? '\n\n[truncated...]' : ''}\n\n---\n\n`
494
+ : '';
495
+ let testingSection = '## Testing Requirements\n\n';
496
+ if (testCommand) {
497
+ testingSection += `**Test Command:** \`${testCommand}\`\n\n`;
498
+ }
499
+ if (iosProject?.hasIOSProject) {
500
+ testingSection += `**iOS Build:** \`${iosProject.buildCommand}\`\n\n`;
501
+ }
502
+ return `# Implementation Task
503
+
504
+ ${contextSection}## Task
505
+ **${taskTitle}**
506
+ ${taskDescription || ''}
507
+
508
+ ## Approved Implementation Plan
509
+
510
+ ### Summary
511
+ ${plan.summary}
512
+
513
+ ### Approach
514
+ ${plan.approach}
515
+
516
+ ### Files to Modify
517
+ ${filesSection}
518
+
519
+ ### Complexity
520
+ ${plan.estimatedComplexity}
521
+
522
+ ${testingSection}
523
+
524
+ Begin implementation now.`;
525
+ }
526
+ function parsePlanFromResult(result, exploredFiles, log) {
527
+ const resultText = result.result || '';
528
+ const jsonMatch = resultText.match(/```json\s*([\s\S]*?)\s*```/);
529
+ if (!jsonMatch) {
530
+ log('warn', 'No JSON block found in planning output', {});
531
+ return null;
532
+ }
533
+ try {
534
+ const parsed = JSON.parse(jsonMatch[1]);
535
+ if (!parsed.summary || !parsed.files || !Array.isArray(parsed.files)) {
536
+ log('warn', 'Invalid plan structure', { parsed });
537
+ return null;
538
+ }
539
+ const plan = {
540
+ summary: parsed.summary,
541
+ approach: parsed.approach || parsed.summary,
542
+ files: parsed.files.map((f) => ({
543
+ path: f.path,
544
+ purpose: f.purpose || 'Implementation',
545
+ changes: f.changes || 'See plan'
546
+ })),
547
+ estimatedComplexity: parsed.estimatedComplexity || 'medium',
548
+ considerations: parsed.considerations || [],
549
+ exploredFiles
550
+ };
551
+ log('info', 'Successfully parsed implementation plan', {
552
+ filesInPlan: plan.files.length,
553
+ filesExplored: plan.exploredFiles?.length || 0
554
+ });
555
+ return plan;
556
+ }
557
+ catch (error) {
558
+ log('error', 'Failed to parse plan JSON', { error: String(error), jsonText: jsonMatch[1] });
559
+ return null;
560
+ }
561
+ }
562
+ async function parseExecutionResult(repoPath, result, plan, log) {
563
+ const { execSync } = await import('child_process');
564
+ try {
565
+ const gitStatusRaw = execSync('git status --porcelain', {
566
+ cwd: repoPath,
567
+ encoding: 'utf-8'
568
+ });
569
+ const lines = gitStatusRaw.split('\n').filter(line => line.trim().length > 0);
570
+ if (lines.length === 0) {
571
+ log('warn', 'No file changes detected by git', {});
572
+ return {
573
+ success: false,
574
+ files: [],
575
+ commitMessage: '',
576
+ prTitle: '',
577
+ prDescription: '',
578
+ error: 'No file changes were made'
579
+ };
580
+ }
581
+ const files = [];
582
+ for (const line of lines) {
583
+ const status = line.substring(0, 2).trim();
584
+ const filePath = line.substring(3).trim();
585
+ let action;
586
+ if (status === 'D' || status === ' D') {
587
+ action = 'delete';
588
+ }
589
+ else if (status === '?' || status === 'A' || status === '??') {
590
+ action = 'create';
591
+ }
592
+ else {
593
+ action = 'modify';
594
+ }
595
+ let content = '';
596
+ if (action !== 'delete') {
597
+ const fullPath = path.join(repoPath, filePath);
598
+ try {
599
+ content = await fs.readFile(fullPath, 'utf-8');
600
+ }
601
+ catch {
602
+ log('warn', `Could not read file: ${filePath}`, {});
603
+ }
604
+ }
605
+ files.push({ path: filePath, content, action });
606
+ }
607
+ log('info', 'Parsed file changes from git', {
608
+ totalFiles: files.length,
609
+ created: files.filter(f => f.action === 'create').length,
610
+ modified: files.filter(f => f.action === 'modify').length,
611
+ deleted: files.filter(f => f.action === 'delete').length
612
+ });
613
+ const resultText = result.result || '';
614
+ const jsonMatch = resultText.match(/```json\s*([\s\S]*?)\s*```/);
615
+ let commitMessage = `feat: ${plan.summary.substring(0, 50)}`;
616
+ let prTitle = plan.summary;
617
+ let prDescription = plan.approach;
618
+ if (jsonMatch) {
619
+ try {
620
+ const parsed = JSON.parse(jsonMatch[1]);
621
+ if (parsed.commitMessage)
622
+ commitMessage = parsed.commitMessage;
623
+ if (parsed.prTitle)
624
+ prTitle = parsed.prTitle;
625
+ if (parsed.prDescription)
626
+ prDescription = parsed.prDescription;
627
+ }
628
+ catch {
629
+ log('warn', 'Could not parse JSON output from Claude', {});
630
+ }
631
+ }
632
+ return {
633
+ success: true,
634
+ files,
635
+ commitMessage,
636
+ prTitle,
637
+ prDescription
638
+ };
639
+ }
640
+ catch (error) {
641
+ log('error', 'Failed to parse execution result', {
642
+ error: error instanceof Error ? error.message : String(error)
643
+ });
644
+ return {
645
+ success: false,
646
+ files: [],
647
+ commitMessage: '',
648
+ prTitle: '',
649
+ prDescription: '',
650
+ error: `Failed to parse file changes: ${error instanceof Error ? error.message : String(error)}`
651
+ };
652
+ }
653
+ }
654
+ //# sourceMappingURL=claude.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/executors/claude.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsHH,wCAoKC;AASD,8CA+JC;AASD,8CAgCC;AAzeD,qEAA4G;AAC5G,gDAAiC;AACjC,2CAA4B;AAU5B,+EAA+E;AAC/E,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