Skip to content

feat(subagent): add getArgumentCompletions for agent names#58

Open
monkeyxite wants to merge 1 commit into
HazAT:mainfrom
monkeyxite:fix/subagent-argument-completions
Open

feat(subagent): add getArgumentCompletions for agent names#58
monkeyxite wants to merge 1 commit into
HazAT:mainfrom
monkeyxite:fix/subagent-argument-completions

Conversation

@monkeyxite

Copy link
Copy Markdown

Summary

Pi's SDK supports getArgumentCompletions on pi.registerCommand (see docs/extensions.md), but the /subagent slash command didn't implement it — so typing /subagent and pressing Tab showed no suggestions even though this extension is precisely the one that knows what agents are available.

Change

Wire getArgumentCompletions to the existing discoverAgentDefinitions() (already used elsewhere in the file). One import added (AutocompleteItem from @mariozechner/pi-tui), one callback added to the /subagent command options at index.ts:1981.

Behaviour:

  • Case-insensitive prefix filter on agent name.
  • Returns { value, label } items where label combines name + description.
  • Returns null (per SDK contract) when the filtered list is empty.
  • Returns null when the prefix contains a space — the user is in the freeform task-arg territory, no completion appropriate.

Scope discipline: only pi-extension/subagents/index.ts is touched. /plan and /iterate are untouched.

Verification

  • grep confirms exactly one usage of getArgumentCompletions inside the /subagent block (plus the import).
  • No new test failures (existing ERR_MODULE_NOT_FOUND on npm test is pre-existing on main, unrelated to this change).
  • Manually verified in a live pi session: agent names now auto-complete on Tab.

Not changed

  • /plan and /iterate — same completion gap exists there but is out of scope.
  • No refactor, no dependency bumps, no agent-frontmatter changes.

The /subagent slash command previously had no argument autocompletion.
Pi's SDK supports getArgumentCompletions on registerCommand (docs/extensions.md);
this wires it to discoverAgentDefinitions() so agent names complete on Tab.

Only completes the agent-name arg — task argument stays freeform.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant