feat: Implement association tree for LSP-based code relationship discovery

- Add `association_tree` module with components for building and processing call association trees using LSP call hierarchy capabilities.
- Introduce `AssociationTreeBuilder` for constructing call trees from seed locations with depth-first expansion.
- Create data structures: `TreeNode`, `CallTree`, and `UniqueNode` for representing nodes and relationships in the call tree.
- Implement `ResultDeduplicator` to extract unique nodes from call trees and assign relevance scores based on depth, frequency, and kind.
- Add unit tests for `AssociationTreeBuilder` and `ResultDeduplicator` to ensure functionality and correctness.
This commit is contained in:
catlog22
2026-01-20 22:09:04 +08:00
parent b85d9b9eb1
commit 261c98549d
21 changed files with 2826 additions and 94 deletions

View File

@@ -72,6 +72,44 @@ export function getActiveExecutions(): ActiveExecution[] {
return Array.from(activeExecutions.values());
}
/**
* Update active execution state from hook events
* Called by hooks-routes when CLI events are received from terminal execution
*/
export function updateActiveExecution(event: {
type: 'started' | 'output' | 'completed';
executionId: string;
tool?: string;
mode?: string;
prompt?: string;
output?: string;
success?: boolean;
}): void {
const { type, executionId, tool, mode, prompt, output, success } = event;
if (type === 'started') {
// Create new active execution
activeExecutions.set(executionId, {
id: executionId,
tool: tool || 'unknown',
mode: mode || 'analysis',
prompt: (prompt || '').substring(0, 500),
startTime: Date.now(),
output: '',
status: 'running'
});
} else if (type === 'output') {
// Append output to existing execution
const activeExec = activeExecutions.get(executionId);
if (activeExec && output) {
activeExec.output += output;
}
} else if (type === 'completed') {
// Remove from active executions
activeExecutions.delete(executionId);
}
}
/**
* Handle CLI routes
* @returns true if route was handled, false otherwise