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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user