Read PR details and linked issues.
UnderstandAnalyzed code diffs and relevant files.
UnderstandChecked specific code usage in interactive mode.
VerifyMerged PR into main branch with changelog updates.
EditYou are given one or more GitHub PR URLs: https://github.com/badlogic/pi-mono/pull/775
For each PR URL, do the following in order:
packages/*/CHANGELOG.md files. Report whether an entry exists. If missing, state that a changelog entry is required before merge and that you will add it if the user decides to merge. Follow the changelog format rules in AGENTS.md. Verify:
### Breaking Changes, ### Added, ### Fixed, etc.)Fixed foo ([#123](https://github.com/badlogic/pi-mono/pull/123) by [@user](https://github.com/user))### Breaking Changes, not just ### FixedOutput format per PR: PR: Changelog:
If no issues are found, say so under Bad and Ugly.
Let me read the relevant source files to validate the implementation:
Let me check how the autocomplete is used in interactive-mode.ts, specifically looking for how argument completions are handled:
Let me check the CHANGELOG entry and look for any related tests:
Let me check if the README needs updates and verify the full documentation:
Now let me verify if there are any issues in the types or if the import in the documentation example is correct:
PR: https://github.com/badlogic/pi-mono/pull/775
Changelog:
## [Unreleased] → ### Added sectionFixed foo ([#123](https://github.com/badlogic/pi-mono/pull/123) by [@user](https://github.com/user))- Extension commands can provide argument auto-completions via \getArgumentCompletions` in `pi.registerCommand()`.`- Extension commands can provide argument auto-completions via \getArgumentCompletions` in `pi.registerCommand()` (#775 by @ribelo)`Good:
SlashCommand.getArgumentCompletions interface from pi-tui rather than reinventingOmit<RegisteredCommand, "name">AutocompleteItem from @mariozechner/pi-tuiregisterCommand() → loader.ts storage → interactive-mode.ts mapping → CombinedAutocompleteProvidernpm run check clean)Bad:
CombinedAutocompleteProvider logic, but no extension-specific test verifies the wiring)Ugly:
Questions or Assumptions:
/model argument completion mechanism to extensions.Change summary:
types.ts: Added optional getArgumentCompletions to RegisteredCommand interfaceloader.ts: Changed registerCommand type to Omit<RegisteredCommand, "name"> to include the new callbackinteractive-mode.ts: Maps cmd.getArgumentCompletions when converting extension commands to SlashCommand format for autocompletedocs/extensions.md: Added documentation with working exampleCHANGELOG.md: Added entry (needs fix)Tests:
packages/tui/src/autocomplete.ts.Documentation check (packages/coding-agent):
README.md: No update needed (extension API examples use registerCommand but argument completion is an advanced feature documented in docs/extensions.md)docs/extensions.md: ✓ Updated with exampleexamples/**/*.md: No update needed (no markdown examples affected)i don't see where getArgumentCompletions is actually called?
You're right to ask. Let me trace the full call chain:
The call happens in packages/tui/src/autocomplete.ts. Here's the flow:
// In extensionpi.registerCommand("deploy", { getArgumentCompletions: (prefix) => [...], // stored in extension.commands handler: async (args, ctx) => {...}});const extensionCommands: SlashCommand[] = (this.session.extensionRunner?.getRegisteredCommands() ?? []).map( (cmd) => ({ name: cmd.name, description: cmd.description ?? "(extension command)", getArgumentCompletions: cmd.getArgumentCompletions, // <-- PR adds this line }),);this.autocompleteProvider = new CombinedAutocompleteProvider( [...slashCommands, ...templateCommands, ...extensionCommands, ...skillCommandList], ...);ah got it, so this actually works. very nice, merge into main, will have to resolve conflict locally
Done. Merged PR #775 into main.
Changes made:
([#775](https://github.com/badlogic/pi-mono/pull/775) by [@ribelo](https://github.com/ribelo))// In extensionpi.registerCommand("deploy", { getArgumentCompletions: (prefix) => [...], // stored in extension.commands handler: async (args, ctx) => {...}});const extensionCommands: SlashCommand[] = (this.session.extensionRunner?.getRegisteredCommands() ?? []).map( (cmd) => ({ name: cmd.name, description: cmd.description ?? "(extension command)", getArgumentCompletions: cmd.getArgumentCompletions, // <-- PR adds this line }),);this.autocompleteProvider = new CombinedAutocompleteProvider( [...slashCommands, ...templateCommands, ...extensionCommands, ...skillCommandList], ...);