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.
The user wants me to review a GitHub PR. Let me start by fetching the PR details including description, comments, commits, and changed files.
>cd /Users/badlogic/workspaces/pi-mono && gh pr view 775 --json title,body,comments,author,state,commits,files,labels,baseRefName,headRefName{"author":{"id":"MDQ6VXNlcjE4MTU4OTg=","is_bot":false,"login":"ribelo","name":"Rafał Krzyważnia"},"baseRefName":"main","body":"I've added a new optional `getArgumentCompletions()` method to `pi.registerCommand()`. This exposes the existing autocomplete mechanism, currently used by the built-in `/model` command, to extensions.\r\n\r\n- Motivation: I wanted to enable \"git-like\" commands for extensions, where the system provides suggestions not just for the primary slash command, but for its parameters as well. Currently, extension commands lack this discovery layer, making complex subcommands harder to use compared to built-in features.\r\n\r\n- Changes:\r\n - Updated `RegisteredCommand` to support the optional `getArgumentCompletions(argumentPrefix)` callback.\r\n - Tweaked the extension loader so it actually holds onto this callback alongside the main command handler.\r\n - Wired the interactive mode's autocomplete logic to pull suggestions from extensions when a user starts typing arguments.\r\n - Brushed up the docs and changelog to reflect the new API option.\r\n\r\n- Testing:\r\n - Created a dummy extension with nested subcommands and verified that suggestions appear correctly after the initial slash command.\r\n - Double-checked that I didn't break the existing `/model` autocomplete—everything there is still working smoothly.\r\n","comments":[],"commits":[{"authoredDate":"2026-01-16T01:30:55Z","authors":[{"email":"[REDACTED]","id":"MDQ6VXNlcjE4MTU4OTg=","login":"ribelo","name":"Rafał Krzyważnia"}],"committedDate":"2026-01-16T01:50:57Z","messageBody":"","messageHeadline":"feat(coding-agent): extension command argument autocomplete","oid":"dcde02f18b4ccf95db5a8fa512cef4d1d6b6f8ac"}],"files":[{"path":"packages/coding-agent/CHANGELOG.md","additions":1,"deletions":0},{"path":"packages/coding-agent/docs/extensions.md","additions":19,"deletions":0},{"path":"packages/coding-agent/src/core/extensions/loader.ts","additions":1,"deletions":1},{"path":"packages/coding-agent/src/core/extensions/types.ts","additions":3,"deletions":1},{"path":"packages/coding-agent/src/modes/interactive/interactive-mode.ts","additions":1,"deletions":0}],"headRefName":"feat/command-arg-autocomplete","labels":[],"state":"OPEN","title":"feat(coding-agent): extension command argument autocomplete"}>cd /Users/badlogic/workspaces/pi-mono && gh pr diff 775diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md
index 40ee6cde5..74619fcfa 100644
--- a/packages/coding-agent/CHANGELOG.md
+++ b/packages/coding-agent/CHANGELOG.md
@@ -6,6 +6,7 @@
- New `input` event in extension system for intercepting, transforming, or handling user input before the agent processes it. Supports three result types: `continue` (pass through), `transform` (modify text/images), `handled` (respond without LLM). Handlers chain transforms and short-circuit on handled.
- Extension example: `input-transform.ts` demonstrating input interception patterns (quick mode, instant commands, source routing)
+- Extension commands can provide argument auto-completions via `getArgumentCompletions` in `pi.registerCommand()`.
### Fixed
diff --git a/packages/coding-agent/docs/extensions.md b/packages/coding-agent/docs/extensions.md
index b128a35d8..eb97f1503 100644
--- a/packages/coding-agent/docs/extensions.md
+++ b/packages/coding-agent/docs/extensions.md
@@ -856,6 +856,25 @@ pi.registerCommand("stats", {
});
```
+Optional: add argument auto-completion for `/command ...`:
+
+```typescript
+import type { AutocompleteItem } from "@mariozechner/pi-tui";
+
+pi.registerCommand("deploy", {
+ description: "Deploy to an environment",
+ getArgumentCompletions: (prefix: string): AutocompleteItem[] | null => {
+ const envs = ["dev", "staging", "prod"];
+ const items = envs.map((e) => ({ value: e, label: e }));
+ const filtered = items.filter((i) => i.value.startsWith(prefix));
+ return filtered.length > 0 ? filtered : null;
+ },
+ handler: async (args, ctx) => {
+ ctx.ui.notify(`Deploying: ${args}`, "info");
+ },
+});
+```
+
**Examples:** [custom-footer.ts](../examples/extensions/custom-footer.ts), [custom-header.ts](../examples/extensions/custom-header.ts), [handoff.ts](../examples/extensions/handoff.ts), [pirate.ts](../examples/extensions/pirate.ts), [plan-mode/index.ts](../examples/extensions/plan-mode/index.ts), [preset.ts](../examples/extensions/preset.ts), [qna.ts](../examples/extensions/qna.ts), [send-user-message.ts](../examples/extensions/send-user-message.ts), [snake.ts](../examples/extensions/snake.ts), [summarize.ts](../examples/extensions/summarize.ts), [todo.ts](../examples/extensions/todo.ts), [tools.ts](../examples/extensions/tools.ts)
### pi.registerMessageRenderer(customType, renderer)
diff --git a/packages/coding-agent/src/core/extensions/loader.ts b/packages/coding-agent/src/core/extensions/loader.ts
index d581b5280..a6bcafda5 100644
--- a/packages/coding-agent/src/core/extensions/loader.ts
+++ b/packages/coding-agent/src/core/extensions/loader.ts
@@ -150,7 +150,7 @@ function createExtensionAPI(
});
},
- registerCommand(name: string, options: { description?: string; handler: RegisteredCommand["handler"] }): void {
+ registerCommand(name: string, options: Omit<RegisteredCommand, "name">): void {
extension.commands.set(name, { name, ...options });
},
diff --git a/packages/coding-agent/src/core/extensions/types.ts b/packages/coding-agent/src/core/extensions/types.ts
index e837cf409..0c2f656cc 100644
--- a/packages/coding-agent/src/core/extensions/types.ts
+++ b/packages/coding-agent/src/core/extensions/types.ts
@@ -16,6 +16,7 @@ import type {
} from "@mariozechner/pi-agent-core";
import type { ImageContent, Model, TextContent, ToolResultMessage } from "@mariozechner/pi-ai";
import type {
+ AutocompleteItem,
Component,
EditorComponent,
EditorTheme,
@@ -655,6 +656,7 @@ export type MessageRenderer<T = unknown> = (
export interface RegisteredCommand {
name: string;
description?: string;
+ getArgumentCompletions?: (argumentPrefix: string) => AutocompleteItem[] | null;
handler: (args: string, ctx: ExtensionCommandContext) => Promise<void>;
}
@@ -714,7 +716,7 @@ export interface ExtensionAPI {
// =========================================================================
/** Register a custom command. */
- registerCommand(name: string, options: { description?: string; handler: RegisteredCommand["handler"] }): void;
+ registerCommand(name: string, options: Omit<RegisteredCommand, "name">): void;
/** Register a keyboard shortcut. */
registerShortcut(
diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.ts
index d5f8b410c..174625d2e 100644
--- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts
+++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts
@@ -319,6 +319,7 @@ export class InteractiveMode {
(cmd) => ({
name: cmd.name,
description: cmd.description ?? "(extension command)",
+ getArgumentCompletions: cmd.getArgumentCompletions,
}),
);Now let me read the relevant source files to fully understand the changes and validate the implementation. I need to read:
Let me also check for any linked issues (none mentioned in the PR body) and read the full context.
Let me read the relevant source files to validate the implementation:
Let me read more of the interactive-mode.ts to see where the autocomplete is actually wired up for extension commands. I saw that extensions are mapped in setupAutocomplete, but I need to see if getArgumentCompletions is used.
Let me check how the autocomplete is used in interactive-mode.ts, specifically looking for how argument completions are handled:
>cd /Users/badlogic/workspaces/pi-mono && grep -n "getArgumentCompletions\|ArgumentCompletion" packages/coding-agent/src/modes/interactive/interactive-mode.ts266: getArgumentCompletions: (prefix: string): AutocompleteItem[] | null => {>cd /Users/badlogic/workspaces/pi-mono && grep -n "getArgumentCompletions\|ArgumentCompletion" packages/tui/src -rpackages/tui/src/autocomplete.ts:57: getArgumentCompletions?(argumentPrefix: string): AutocompleteItem[] | null;
packages/tui/src/autocomplete.ts:159: if (!command || !("getArgumentCompletions" in command) || !command.getArgumentCompletions) {
packages/tui/src/autocomplete.ts:163: const argumentSuggestions = command.getArgumentCompletions(argumentText);Now let me read the autocomplete.ts from pi-tui to understand how argument completions work, to confirm that the PR implementation is correct.
Now I understand the implementation. Let me check the CHANGELOG to see if the entry exists and follows the proper format. Let me also check if there are any tests for this functionality.
Let me check the CHANGELOG entry and look for any related tests:
>cd /Users/badlogic/workspaces/pi-mono && grep -rn "getArgumentCompletions\|argument.*completion" packages/coding-agent/test --include="*.ts" 2>/dev/null | head -20(no output)>cd /Users/badlogic/workspaces/pi-mono && npm run check 2>&1 | head -100> pi-monorepo@0.0.3 check
> biome check --write . && tsgo --noEmit && npm run check -w @mariozechner/pi-web-ui
Checked 405 files in 336ms. No fixes applied.
> @mariozechner/pi-web-ui@0.47.0 check
> biome check --write . && tsc --noEmit && cd example && biome check --write . && tsc --noEmit
Checked 73 files in 54ms. No fixes applied.
Checked 3 files in 9ms. No fixes applied.Let me check if there are any tests related to autocomplete in pi-tui and if they should test getArgumentCompletions. Also, let me check the RegisteredCommand interface again to make sure the change is complete.
Looking at the PR:
types.ts - Added getArgumentCompletions?: (argumentPrefix: string) => AutocompleteItem[] | null; to RegisteredCommand interface and updated registerCommand signatureloader.ts - Changed the type annotation from inline to Omit<RegisteredCommand, "name">interactive-mode.ts - Added getArgumentCompletions: cmd.getArgumentCompletions when mapping extension commands to SlashCommand formatdocs/extensions.md - Added documentation for the new featureCHANGELOG.md - Added a changelog entry but it's in the wrong placeWait, looking at the CHANGELOG, I don't see the entry from the PR. Let me re-check the diff. The diff shows:
+- Extension commands can provide argument auto-completions via `getArgumentCompletions` in `pi.registerCommand()`.But this entry is placed after the input event entry, which is correct. It's in the Added section under [Unreleased]. Let me verify this is the correct placement.
Actually, looking at the diff more closely:
Now let me check if the CHANGELOG entry follows the proper format:
Fixed foo ([#123](https://github.com/badlogic/pi-mono/pull/123) by [@user](https://github.com/user))The entry is: - Extension commands can provide argument auto-completions via \getArgumentCompletions` in `pi.registerCommand()`.`
The CHANGELOG entry is missing the PR link and author attribution. Since this is from @ribelo, it should include ([#775](https://github.com/badlogic/pi-mono/pull/775) by [@ribelo](https://github.com/ribelo)). I should also check if the README.md needs updates for this new extension API feature.
Let me check if the README needs updates and verify the full documentation:
>cd /Users/badlogic/workspaces/pi-mono && grep -n "registerCommand\|getArgumentCompletions" packages/coding-agent/README.md979: pi.registerCommand("stats", {
987: pi.registerCommand("todos", {
1068: pi.registerCommand("increment", {>cd /Users/badlogic/workspaces/pi-mono && ls -la packages/tui/src/index.ts && grep -n "AutocompleteItem" packages/tui/src/index.ts-rw-r--r--@ 1 badlogic staff 2649 Jan 16 04:30 packages/tui/src/index.ts
5: type AutocompleteItem,The AutocompleteItem type is exported from pi-tui, so extensions can import it. The documentation example in extensions.md correctly shows importing it:
import type { AutocompleteItem } from "@mariozechner/pi-tui";Now let me summarize what I found:
Good:
SlashCommand interface from pi-tui which already has getArgumentCompletionsOmit<RegisteredCommand, "name">Bad:
Ugly:
The implementation correctly threads the getArgumentCompletions callback through:
getArgumentCompletions via registerCommand()loader.ts stores it in extension.commandsinteractive-mode.ts retrieves commands and maps them to SlashCommand format with getArgumentCompletionsCombinedAutocompleteProvider in pi-tui handles the restThis is a well-designed minimal change that exposes existing functionality to extensions.
Now let me verify if there are any issues in the types or if the import in the documentation example is correct:
Good, AutocompleteItem is exported from pi-tui. The documentation example is correct.
Now let me provide the final review.
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?
The user is asking where getArgumentCompletions is actually called. Let me trace through the code again.
getArgumentCompletions via pi.registerCommand()loader.ts stores it in extension.commandsinteractive-mode.ts retrieves commands via getRegisteredCommands() and maps them to SlashCommand format, including getArgumentCompletionsCombinedAutocompleteProvider in setupAutocomplete()The actual call to getArgumentCompletions happens in CombinedAutocompleteProvider.getSuggestions() in packages/tui/src/autocomplete.ts at line 159-163:
if (!command || !("getArgumentCompletions" in command) || !command.getArgumentCompletions) { return null; // No argument completion for this command}
const argumentSuggestions = command.getArgumentCompletions(argumentText);So the call chain is:
/deploy (with space)CombinedAutocompleteProvider.getSuggestions() is called/command with space)command.getArgumentCompletions(argumentText)The key is that CombinedAutocompleteProvider already has the logic to call getArgumentCompletions - it's used by the built-in /model command. The PR just wires extension commands into the same system.
Let me verify this by looking at how the built-in /model command is set up and how extension commands are passed to the autocomplete provider.
You're right to ask. Let me trace the full call chain:
>cd /Users/badlogic/workspaces/pi-mono && grep -n "CombinedAutocompleteProvider\|slashCommands\|extensionCommands" packages/coding-agent/src/modes/interactive/interactive-mode.ts | head -3030: CombinedAutocompleteProvider,
140: private autocompleteProvider: CombinedAutocompleteProvider | undefined;
261: const slashCommands: SlashCommand[] = [
318: const extensionCommands: SlashCommand[] = (this.session.extensionRunner?.getRegisteredCommands() ?? []).map(
337: this.autocompleteProvider = new CombinedAutocompleteProvider(
338: [...slashCommands, ...templateCommands, ...extensionCommands, ...skillCommandList],OK, so the extension commands are mapped and passed to CombinedAutocompleteProvider at line 338. Now let me look at where getArgumentCompletions is actually called in the autocomplete provider. I already read it - it's at line 159-163 in packages/tui/src/autocomplete.ts:
const command = this.commands.find((cmd) => { const name = "name" in cmd ? cmd.name : cmd.value; return name === commandName;});if (!command || !("getArgumentCompletions" in command) || !command.getArgumentCompletions) { return null; // No argument completion for this command}
const argumentSuggestions = command.getArgumentCompletions(argumentText);So the call path is:
getSuggestions()CombinedAutocompleteProvider.getSuggestions() in packages/tui/src/autocomplete.ts/command (with space after command), lines 147-166 handle argument completion:
this.commands (which includes extension commands)command.getArgumentCompletions(argumentText) if it existsSo getArgumentCompletions is called in packages/tui/src/autocomplete.ts line 163. The PR correctly wires extension commands into this existing system by:
getArgumentCompletions to the RegisteredCommand typeSlashCommand formatLet me confirm this is working by showing the relevant code path more clearly.
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
The user wants me to merge this PR into main. According to AGENTS.md:
Let me do this step by step.
>cd /Users/badlogic/workspaces/pi-mono && git fetch origin && git checkout main && git pull origin mainAlready on 'main'
M packages/tui/src/tui.ts
Your branch is up to date with 'origin/main'.
error: cannot pull with rebase: You have unstaged changes.
error: Please commit or stash them.
Command exited with code 128There are unstaged changes. Let me stash them and try again.
>cd /Users/badlogic/workspaces/pi-mono && git stash && git pull origin mainSaved working directory and index state WIP on main: f900eb59 Fix provider feature detection to use model.provider, not just URL
From https://github.com/badlogic/pi-mono
* branch main -> FETCH_HEAD
Already up to date.Good. Now let me fetch the PR branch and merge it.
>cd /Users/badlogic/workspaces/pi-mono && gh pr checkout 775From https://github.com/badlogic/pi-mono
* [new ref] refs/pull/775/head -> feat/command-arg-autocomplete
Switched to branch 'feat/command-arg-autocomplete'Good, I'm on the PR branch. Let me rebase it on main to resolve any conflicts.
>cd /Users/badlogic/workspaces/pi-mono && git rebase mainRebasing (1/1)
Auto-merging packages/coding-agent/CHANGELOG.md
CONFLICT (content): Merge conflict in packages/coding-agent/CHANGELOG.md
Auto-merging packages/coding-agent/docs/extensions.md
Auto-merging packages/coding-agent/src/modes/interactive/interactive-mode.ts
error: could not apply dcde02f1... feat(coding-agent): extension command argument autocomplete
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Could not apply dcde02f1... # feat(coding-agent): extension command argument autocomplete
Command exited with code 1There's a conflict in the CHANGELOG.md. Let me read it and fix it. I also need to fix the attribution.
I see the conflict. The PR was based on an older version before the input event was released (0.47.0). The PR's CHANGELOG includes the input event entries that are now in the released section, plus the new getArgumentCompletions entry.
I need to:
getArgumentCompletions entry WITH proper attributionLet me fix this.
Good, now let me add the file and continue the rebase.
>cd /Users/badlogic/workspaces/pi-mono && git add packages/coding-agent/CHANGELOG.md && git rebase --continue[detached HEAD 35e48ca0] feat(coding-agent): extension command argument autocomplete
Author: Rafał Krzyważnia <[REDACTED]>
5 files changed, 25 insertions(+), 2 deletions(-)
Successfully rebased and updated refs/heads/feat/command-arg-autocomplete.The rebase succeeded. Now let me run the checks to make sure everything is good.
>cd /Users/badlogic/workspaces/pi-mono && npm run check 2>&1> pi-monorepo@0.0.3 check
> biome check --write . && tsgo --noEmit && npm run check -w @mariozechner/pi-web-ui
Checked 405 files in 325ms. No fixes applied.
> @mariozechner/pi-web-ui@0.47.0 check
> biome check --write . && tsc --noEmit && cd example && biome check --write . && tsc --noEmit
Checked 73 files in 68ms. No fixes applied.
Checked 3 files in 11ms. No fixes applied.All checks pass. Now let me switch to main and merge the feature branch.
>cd /Users/badlogic/workspaces/pi-mono && git checkout main && git merge feat/command-arg-autocomplete --no-ff -m "feat(coding-agent): extension command argument autocomplete (#775)"Switched to branch 'main'
Your branch is up to date with 'origin/main'.
Merge made by the 'ort' strategy.
packages/coding-agent/CHANGELOG.md | 1 +
packages/coding-agent/docs/extensions.md | 19 +++++++++++++++++++
packages/coding-agent/src/core/extensions/loader.ts | 2 +-
packages/coding-agent/src/core/extensions/types.ts | 4 +++-
.../src/modes/interactive/interactive-mode.ts | 1 +
5 files changed, 25 insertions(+), 2 deletions(-)Let me push to main and close the PR with a comment.
>cd /Users/badlogic/workspaces/pi-mono && git push origin mainTo https://github.com/badlogic/pi-mono.git
f900eb59..3a475fe1 main -> mainNow let me close the PR with a comment.
>cd /Users/badlogic/workspaces/pi-mono && gh pr close 775 --comment "Merged into main. Added PR link and author attribution to the changelog entry. Thanks @ribelo!" --delete-branch✓ Closed pull request badlogic/pi-mono#775 (feat(coding-agent): extension command argument autocomplete)
! Skipped deleting the remote branch of a pull request from fork
✓ Deleted branch feat/command-arg-autocompleteLet me restore the stash.
>cd /Users/badlogic/workspaces/pi-mono && git stash popOn branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: packages/tui/src/tui.ts
no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (9f71922454be88bbfe720f1dfcd4698b070581bf)Done. Let me summarize what happened.
Done. Merged PR #775 into main.
Changes made:
([#775](https://github.com/badlogic/pi-mono/pull/775) by [@ribelo](https://github.com/ribelo))+- Extension commands can provide argument auto-completions via `getArgumentCompletions` in `pi.registerCommand()`.import type { AutocompleteItem } from "@mariozechner/pi-tui";if (!command || !("getArgumentCompletions" in command) || !command.getArgumentCompletions) { return null; // No argument completion for this command}
const argumentSuggestions = command.getArgumentCompletions(argumentText);const command = this.commands.find((cmd) => { const name = "name" in cmd ? cmd.name : cmd.value; return name === commandName;});if (!command || !("getArgumentCompletions" in command) || !command.getArgumentCompletions) { return null; // No argument completion for this command}
const argumentSuggestions = command.getArgumentCompletions(argumentText);// 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], ...);