@jjdenhertog/ai-driven-development
Version:
AI-driven development workflow with learning capabilities for Claude
56 lines • 2.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createToolEntry = createToolEntry;
function createToolEntry(toolName, input, response, timestamp, duration) {
const entry = {
type: 'tool',
name: toolName,
timestamp,
duration_ms: duration,
stats: `${(duration / 1000).toFixed(1)}s`
};
// Handle specific tools
switch (toolName) {
case 'Write':
case 'Edit':
case 'MultiEdit':
if (response === null || response === void 0 ? void 0 : response.filePath) {
entry.file_path = response.filePath;
entry.description = response.filePath;
}
if (response === null || response === void 0 ? void 0 : response.content) {
const lines = response.content.split('\n');
entry.summary = `Wrote ${lines.length} lines to ${response.filePath || 'file'}`;
entry.preview = lines.slice(0, 10).join('\n');
entry.full_content = response.content;
entry.expandable = true;
}
break;
case 'WebSearch':
if (input === null || input === void 0 ? void 0 : input.query) {
entry.description = input.query;
}
if (response === null || response === void 0 ? void 0 : response.results) {
entry.summary = `Found ${response.results.length} results`;
}
break;
case 'Task':
if (input === null || input === void 0 ? void 0 : input.description) {
entry.description = input.description;
}
entry.details = {
tools_used: (response === null || response === void 0 ? void 0 : response.tools_used) || [],
tokens: (response === null || response === void 0 ? void 0 : response.tokens) || 0
};
break;
case 'TodoWrite':
if (response === null || response === void 0 ? void 0 : response.newTodos) {
const todos = response.newTodos;
entry.summary = `Updated ${todos.length} todos`;
entry.details = todos;
}
break;
}
return entry;
}
//# sourceMappingURL=createToolEntry.js.map