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
This commit is contained in:
roboomp
2026-07-25 11:21:43 +00:00
parent 59619623e1
commit 6a3fcc98fa
3 changed files with 27 additions and 5 deletions
+4
View File
@@ -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
@@ -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);
}
}
@@ -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);