Skip to content

Commit 636f719

Browse files
committed
fix spaces in autocomplete for agent names
1 parent 595db99 commit 636f719

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

npm-app/src/cli.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,10 @@ export class CLI {
484484
}
485485

486486
// Handle @ prefix for agent name completion
487-
if (lastWord.startsWith('@')) {
488-
const searchTerm = lastWord.substring(1).toLowerCase() // Remove @ prefix
487+
if (line.includes('@')) {
488+
const $split = line.split('@')
489+
const atAgentPrefix = `@${$split[$split.length - 1]}`
490+
const searchTerm = atAgentPrefix.substring(1).toLowerCase() // Remove @ prefix
489491

490492
// Get all agent names using functional API
491493
const localAgentInfo = getCachedLocalAgentInfo()
@@ -503,12 +505,12 @@ export class CLI {
503505
if (matchingAgents.length > 0) {
504506
// Return completions with @ prefix
505507
const completions = matchingAgents.map((name) => `@${name}`)
506-
return [completions, lastWord]
508+
return [completions, atAgentPrefix]
507509
}
508510

509511
// If no agent matches, return empty completions for better UX
510512
// Users typing @ likely intend to mention an agent
511-
return [[], lastWord]
513+
return [[], atAgentPrefix]
512514
}
513515

514516
// Original file path completion logic (unchanged)

0 commit comments

Comments
 (0)