feat(coding-agent,tui): support argument-hint frontmatter in prompt templates (#2780)
* feat(coding-agent,tui): support argument-hint frontmatter in prompt templates Parse argument-hint from prompt template frontmatter and display it in the autocomplete dropdown description, matching Claude Code's convention for custom commands. Frontmatter format: --- description: Code review argument-hint: "[file | #PR | PR-URL]" --- The hint renders in the description column of the autocomplete list: review [file | #PR | PR-URL] — Code review Closes #2761 * docs(coding-agent,tui): add argument-hint documentation, tests, and built-in hints - Document argument-hint frontmatter in prompt-templates.md with <required>/[optional] convention - Add argument-hint to built-in prompts: pr, is, wr - Expand tests: required/optional hints, missing hints, empty hints, special characters - Add changelog entries for coding-agent and tui
This commit is contained in:
@@ -62,6 +62,10 @@
|
||||
- Fixed slash-command argument autocomplete to await async `getArgumentCompletions()` results and ignore invalid return values, preventing crashes when extension commands provide asynchronous completions ([#2719](https://github.com/badlogic/pi-mono/issues/2719))
|
||||
- Fixed non-capturing overlay padding from inflating scrollback and corrupting the viewport on terminal widen ([#2758](https://github.com/badlogic/pi-mono/pull/2758) by [@dotBeeps](https://github.com/dotBeeps))
|
||||
|
||||
### Added
|
||||
|
||||
- Added `argumentHint` to `SlashCommand` interface, displayed before the description in the autocomplete dropdown ([#2761](https://github.com/badlogic/pi-mono/issues/2761))
|
||||
|
||||
## [0.64.0] - 2026-03-29
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -223,6 +223,7 @@ type Awaitable<T> = T | Promise<T>;
|
||||
export interface SlashCommand {
|
||||
name: string;
|
||||
description?: string;
|
||||
argumentHint?: string;
|
||||
// Function to get argument completions for this command
|
||||
// Returns null if no argument completion is available
|
||||
getArgumentCompletions?(argumentPrefix: string): Awaitable<AutocompleteItem[] | null>;
|
||||
@@ -303,11 +304,17 @@ export class CombinedAutocompleteProvider implements AutocompleteProvider {
|
||||
|
||||
if (spaceIndex === -1) {
|
||||
const prefix = textBeforeCursor.slice(1);
|
||||
const commandItems = this.commands.map((cmd) => ({
|
||||
name: "name" in cmd ? cmd.name : cmd.value,
|
||||
label: "name" in cmd ? cmd.name : cmd.label,
|
||||
description: cmd.description,
|
||||
}));
|
||||
const commandItems = this.commands.map((cmd) => {
|
||||
const name = "name" in cmd ? cmd.name : cmd.value;
|
||||
const hint = "argumentHint" in cmd && cmd.argumentHint ? cmd.argumentHint : undefined;
|
||||
const desc = cmd.description ?? "";
|
||||
const fullDesc = hint ? (desc ? `${hint} — ${desc}` : hint) : desc;
|
||||
return {
|
||||
name,
|
||||
label: name,
|
||||
description: fullDesc || undefined,
|
||||
};
|
||||
});
|
||||
|
||||
const filtered = fuzzyFilter(commandItems, prefix, (item) => item.name).map((item) => ({
|
||||
value: item.name,
|
||||
|
||||
Reference in New Issue
Block a user