From 6a3fcc98fa1c40e640b6d74f9b46979297067afe Mon Sep 17 00:00:00 2001 From: roboomp Date: Sat, 25 Jul 2026 11:21:43 +0000 Subject: [PATCH] fix(tui): restored GitHub refs in slash arguments Preserved numeric GitHub reference completion after slash-command argument providers decline an input while leaving prompt-action tokens literal. Added a provider-level regression for prompt-bearing skill commands. Fixes #6604 --- packages/coding-agent/CHANGELOG.md | 4 ++++ .../src/modes/prompt-action-autocomplete.ts | 8 +++++--- .../modes/github-ref-autocomplete.test.ts | 20 +++++++++++++++++-- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 7c9fcf50c..9ea3e25c4 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Fixed + +- Fixed numeric GitHub issue/PR autocomplete being suppressed inside prompt-bearing skill slash-command arguments while preserving literal prompt-action tokens such as `#copy` ([#6604](https://github.com/can1357/oh-my-pi/issues/6604)). + ## [17.1.3] - 2026-07-24 ### Fixed diff --git a/packages/coding-agent/src/modes/prompt-action-autocomplete.ts b/packages/coding-agent/src/modes/prompt-action-autocomplete.ts index ccb9952d2..5f681292b 100644 --- a/packages/coding-agent/src/modes/prompt-action-autocomplete.ts +++ b/packages/coding-agent/src/modes/prompt-action-autocomplete.ts @@ -158,9 +158,11 @@ export class PromptActionAutocompleteProvider implements AutocompleteProvider { if (command && (!("allowArgs" in command) || command.allowArgs !== false)) { const argumentSuggestions = await this.#baseProvider.getSuggestions(lines, cursorLine, cursorCol); if (argumentSuggestions) return argumentSuggestions; - // No slash-argument completion for this input: fall through to - // internal-url completion only. `#` prompt-action tokens stay - // literal text inside slash command arguments. + // No slash-argument completion for this input: preserve numeric + // GitHub references and internal URLs while keeping prompt-action + // tokens such as `#copy` literal. + const githubRefSuggestions = getGithubRefSuggestions(textBeforeCursor); + if (githubRefSuggestions) return githubRefSuggestions; return getInternalUrlSuggestions(textBeforeCursor, this.#basePath); } } diff --git a/packages/coding-agent/test/modes/github-ref-autocomplete.test.ts b/packages/coding-agent/test/modes/github-ref-autocomplete.test.ts index 0cd330b42..85bd622c2 100644 --- a/packages/coding-agent/test/modes/github-ref-autocomplete.test.ts +++ b/packages/coding-agent/test/modes/github-ref-autocomplete.test.ts @@ -2,10 +2,11 @@ import { describe, expect, it } from "bun:test"; import { KeybindingsManager as AppKeybindingsManager } from "@oh-my-pi/pi-coding-agent/config/keybindings"; import { getGithubRefContext, getGithubRefSuggestions } from "@oh-my-pi/pi-coding-agent/modes/github-ref-autocomplete"; import { createPromptActionAutocompleteProvider } from "@oh-my-pi/pi-coding-agent/modes/prompt-action-autocomplete"; +import type { SlashCommand } from "@oh-my-pi/pi-tui"; -function makeProvider() { +function makeProvider(commands: SlashCommand[] = []) { return createPromptActionAutocompleteProvider({ - commands: [], + commands, basePath: "/tmp", keybindings: AppKeybindingsManager.inMemory({}), copyCurrentLine: () => {}, @@ -119,6 +120,21 @@ describe("github-ref autocomplete — provider integration", () => { expect(issueResult.lines).toEqual(["review issue://3164 "]); }); + it("offers GitHub references inside prompt-bearing skill command arguments", async () => { + const provider = makeProvider([{ name: "skill:code-review", description: "Review code", allowArgs: true }]); + const line = "/skill:code-review inspect #123"; + + const suggestions = await provider.getSuggestions([line], 0, line.length); + + expect(suggestions).toEqual({ + prefix: "#123", + items: [ + { value: "pr://123", label: "PR #123", description: "GitHub pull request" }, + { value: "issue://123", label: "Issue #123", description: "GitHub issue" }, + ], + }); + }); + it("constrains to the named type and consumes the qualifier on accept", async () => { const provider = makeProvider(); const suggestions = await provider.getSuggestions(["review pr #3164"], 0, 15);