feat: implement research command with enhanced context gathering - Add comprehensive research command with AI-powered queries - Implement ContextGatherer utility for reusable context extraction - Support multiple context types: tasks, files, custom text, project tree - Add fuzzy search integration for automatic task discovery - Implement detailed token breakdown display with syntax highlighting - Add enhanced UI with boxed output and code block formatting - Support different detail levels (low, medium, high) for responses - Include project-specific context for more relevant AI responses - Add token counting with gpt-tokens library integration - Create reusable patterns for future context-aware commands - Task 94.4 completed

This commit is contained in:
Eyal Toledano
2025-05-25 03:51:51 -04:00
parent 4234cc3d87
commit bb5a0211f4
9 changed files with 563 additions and 213 deletions

View File

@@ -1444,7 +1444,7 @@ function registerCommands(programInstance) {
'Additional custom context to include in the research prompt'
)
.option(
'-t, --tree',
'--project-tree',
'Include project file tree structure in the research context'
)
.option(
@@ -1578,7 +1578,7 @@ function registerCommands(programInstance) {
taskIds: taskIds,
filePaths: filePaths,
customContext: options.context ? options.context.trim() : null,
includeProjectTree: !!options.tree,
includeProjectTree: !!options.projectTree,
saveTarget: options.save ? options.save.trim() : null,
detailLevel: options.detail ? options.detail.toLowerCase() : 'medium',
tasksPath: tasksPath,

View File

@@ -50,7 +50,7 @@ export {
taskExists,
isTaskDependentOn,
moveTask,
performResearch,
readComplexityReport,
migrateProject
migrateProject,
performResearch
};

View File

@@ -924,6 +924,11 @@ function displayHelp() {
name: 'expand --all',
args: '[--force] [--research]',
desc: 'Expand all pending tasks with subtasks'
},
{
name: 'research',
args: '"<prompt>" [-i=<task_ids>] [-f=<file_paths>] [-c="<context>"] [--project-tree] [-s=<save_file>] [-d=<detail_level>]',
desc: 'Perform AI-powered research queries with project context'
}
]
},

View File

@@ -276,11 +276,7 @@ export class FuzzyTaskSearch {
* @returns {Array<string>} Array of task ID strings
*/
getTaskIds(searchResults) {
return searchResults.results.map((task) => {
// Use searchableId if available (for flattened tasks with subtasks)
// Otherwise fall back to regular id
return task.searchableId || task.id.toString();
});
return searchResults.results.map((task) => task.id.toString());
}
/**