()
| 233 | } |
| 234 | |
| 235 | _getTools() { |
| 236 | const fs = require('fs'); |
| 237 | // Minimal tool set for programmatic use |
| 238 | const tools = [ |
| 239 | { type: 'function', function: { name: 'read_file', description: 'Read a file. Returns content with line numbers.', parameters: { type: 'object', properties: { path: { type: 'string', description: 'File path relative to cwd' } }, required: ['path'] } } }, |
| 240 | { type: 'function', function: { name: 'write_file', description: 'Create or overwrite a file.', parameters: { type: 'object', properties: { path: { type: 'string', description: 'File path' }, content: { type: 'string', description: 'Full file content' } }, required: ['path', 'content'] } } }, |
| 241 | { type: 'function', function: { name: 'patch', description: 'Edit file by replacing old_str with new_str. old_str must match exactly ONE location.', parameters: { type: 'object', properties: { path: { type: 'string', description: 'File to edit' }, old_str: { type: 'string', description: 'Exact text to find' }, new_str: { type: 'string', description: 'Replacement text' } }, required: ['path', 'old_str', 'new_str'] } } }, |
| 242 | { type: 'function', function: { name: 'bash', description: 'Run a shell command. Returns stdout/stderr.', parameters: { type: 'object', properties: { command: { type: 'string', description: 'Shell command' } }, required: ['command'] } } }, |
| 243 | { type: 'function', function: { name: 'search', description: 'Search file contents using regex. Returns matching lines.', parameters: { type: 'object', properties: { pattern: { type: 'string', description: 'Regex pattern' } }, required: ['pattern'] } } }, |
| 244 | { type: 'function', function: { name: 'find_files', description: 'Find files matching a glob pattern.', parameters: { type: 'object', properties: { pattern: { type: 'string', description: 'Glob pattern' } }, required: ['pattern'] } } }, |
| 245 | { type: 'function', function: { name: 'run_tests', description: 'Run the project\'s test suite and return structured results: pass/fail counts and per-failing-test names and messages.', parameters: { type: 'object', properties: { test_filter: { type: 'string', description: 'Optional: run only tests matching this pattern.' } }, required: [] } } }, |
| 246 | { type: 'function', function: { name: 'tdd_loop', description: 'Start a TDD loop for a list of requirements. Harness enforces Red→Green automatically on every file write.', parameters: { type: 'object', properties: { requirements: { type: 'array', items: { type: 'string' } } }, required: ['requirements'] } } }, |
| 247 | { type: 'function', function: { name: 'tdd_status', description: 'Show current TDD phase and requirements checklist.', parameters: { type: 'object', properties: {}, required: [] } } }, |
| 248 | ]; |
| 249 | |
| 250 | if (this.config.tools) { |
| 251 | return tools.filter(t => this.config.tools.includes(t.function.name)); |
| 252 | } |
| 253 | return tools; |
| 254 | } |
| 255 | |
| 256 | async _tddPostWrite(filePath, toolResult) { |
| 257 | try { |
no outgoing calls
no test coverage detected