mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 02:01:29 +00:00
fix: file @ autocomplete performance using fd
- Replace slow synchronous directory walking with fd for fuzzy file search - Auto-download fd to ~/.pi/agent/tools/ if not found in PATH - Performance improved from ~900ms to ~10ms per keystroke on large repos - Remove minimatch dependency from tui package - Graceful degradation if fd unavailable (empty results) Fixes #69
This commit is contained in:
parent
754e745b1f
commit
a61eca5dee
7 changed files with 250 additions and 108 deletions
|
|
@ -12,6 +12,7 @@ import { SessionManager } from "./session-manager.js";
|
|||
import { SettingsManager } from "./settings-manager.js";
|
||||
import { initTheme } from "./theme/theme.js";
|
||||
import { codingTools } from "./tools/index.js";
|
||||
import { ensureTool } from "./tools-manager.js";
|
||||
import { SessionSelectorComponent } from "./tui/session-selector.js";
|
||||
import { TuiRenderer } from "./tui/tui-renderer.js";
|
||||
|
||||
|
|
@ -612,6 +613,7 @@ async function runInteractiveMode(
|
|||
initialMessages: string[] = [],
|
||||
initialMessage?: string,
|
||||
initialAttachments?: Attachment[],
|
||||
fdPath: string | null = null,
|
||||
): Promise<void> {
|
||||
const renderer = new TuiRenderer(
|
||||
agent,
|
||||
|
|
@ -621,6 +623,7 @@ async function runInteractiveMode(
|
|||
changelogMarkdown,
|
||||
newVersion,
|
||||
scopedModels,
|
||||
fdPath,
|
||||
);
|
||||
|
||||
// Initialize TUI (subscribes to agent events internally)
|
||||
|
|
@ -1133,6 +1136,9 @@ export async function main(args: string[]) {
|
|||
console.log(chalk.dim(`Model scope: ${modelList} ${chalk.gray("(Ctrl+P to cycle)")}`));
|
||||
}
|
||||
|
||||
// Ensure fd tool is available for file autocomplete
|
||||
const fdPath = await ensureTool("fd");
|
||||
|
||||
// Interactive mode - use TUI (may have initial messages from CLI args)
|
||||
await runInteractiveMode(
|
||||
agent,
|
||||
|
|
@ -1146,6 +1152,7 @@ export async function main(args: string[]) {
|
|||
parsed.messages,
|
||||
initialMessage,
|
||||
initialAttachments,
|
||||
fdPath,
|
||||
);
|
||||
} else {
|
||||
// Non-interactive mode (--print flag or --mode flag)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue