Co-authored-by: Max Tuzzolino <maxtuzz@Maxs-MacBook-Pro.local> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Max Tuzzolino <max.tuzsmith@gmail.com> Co-authored-by: Ralph Khreish <35776126+Crunchyman-ralph@users.noreply.github.com>
37 lines
1.3 KiB
Plaintext
37 lines
1.3 KiB
Plaintext
# Task ID: 4
|
|
# Title: Implement claude-code executor
|
|
# Status: pending
|
|
# Dependencies: 3
|
|
# Priority: high
|
|
# Description: Add functionality to execute the claude-code command with the built prompt
|
|
# Details:
|
|
Implement the functionality to execute the claude command with the built prompt. This should use Node.js child_process.exec() to run the command directly in the terminal.
|
|
|
|
```typescript
|
|
import { exec } from 'child_process';
|
|
|
|
// Inside execute method, after task validation
|
|
private async executeClaude(prompt: string): Promise<void> {
|
|
console.log('Starting claude-code to implement the task...');
|
|
|
|
try {
|
|
// Execute claude with the prompt
|
|
const claudeCommand = `claude "${prompt.replace(/"/g, '\\"')}"`;
|
|
|
|
// Use execSync to wait for the command to complete
|
|
const { execSync } = require('child_process');
|
|
execSync(claudeCommand, { stdio: 'inherit' });
|
|
|
|
console.log('Claude session completed.');
|
|
} catch (error) {
|
|
console.error('Error executing claude-code:', error.message);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
```
|
|
|
|
Then call this method from the execute method after building the prompt.
|
|
|
|
# Test Strategy:
|
|
Test by running the command with a valid task ID and verifying that the claude command is executed with the correct prompt. Check that the command handles errors appropriately if claude-code is not available.
|