mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 07:04:45 +00:00
fix(coding-agent): rename SlashCommandSource "template" to "prompt" for consistency
BREAKING CHANGE: RPC get_commands response and SlashCommandSource type now use "prompt" instead of "template" to match the rest of the codebase.
This commit is contained in:
parent
8292d7ce5d
commit
e54dff7efb
8 changed files with 15 additions and 11 deletions
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- RPC `get_commands` response and `SlashCommandSource` type: renamed `"template"` to `"prompt"` for consistency with the rest of the codebase
|
||||
|
||||
### Added
|
||||
|
||||
- Added `ExtensionAPI.getCommands()` to let extensions list available slash commands (extensions, prompt templates, skills) for invocation via `prompt` ([#1210](https://github.com/badlogic/pi-mono/pull/1210) by [@w-winter](https://github.com/w-winter))
|
||||
|
|
|
|||
|
|
@ -958,7 +958,7 @@ Each entry has this shape:
|
|||
{
|
||||
name: string; // Command name without the leading slash
|
||||
description?: string;
|
||||
source: "extension" | "template" | "skill";
|
||||
source: "extension" | "prompt" | "skill";
|
||||
location?: "user" | "project" | "path"; // For templates and skills
|
||||
path?: string; // Files backing templates, skills, and extensions
|
||||
}
|
||||
|
|
|
|||
|
|
@ -651,7 +651,7 @@ Response:
|
|||
"data": {
|
||||
"commands": [
|
||||
{"name": "session-name", "description": "Set or clear session name", "source": "extension", "path": "/home/user/.pi/agent/extensions/session.ts"},
|
||||
{"name": "fix-tests", "description": "Fix failing tests", "source": "template", "location": "project", "path": "/home/user/myproject/.pi/agent/prompts/fix-tests.md"},
|
||||
{"name": "fix-tests", "description": "Fix failing tests", "source": "prompt", "location": "project", "path": "/home/user/myproject/.pi/agent/prompts/fix-tests.md"},
|
||||
{"name": "skill:brave-search", "description": "Web search via Brave API", "source": "skill", "location": "user", "path": "/home/user/.pi/agent/skills/brave-search/SKILL.md"}
|
||||
]
|
||||
}
|
||||
|
|
@ -663,7 +663,7 @@ Each command has:
|
|||
- `description`: Human-readable description (optional for extension commands)
|
||||
- `source`: What kind of command:
|
||||
- `"extension"`: Registered via `pi.registerCommand()` in an extension
|
||||
- `"template"`: Loaded from a prompt template `.md` file
|
||||
- `"prompt"`: Loaded from a prompt template `.md` file
|
||||
- `"skill"`: Loaded from a skill directory (name is prefixed with `skill:`)
|
||||
- `location`: Where it was loaded from (optional, not present for extensions):
|
||||
- `"user"`: User-level (`~/.pi/agent/`)
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@ export default function commandsExtension(pi: ExtensionAPI) {
|
|||
pi.registerCommand("commands", {
|
||||
description: "List available slash commands",
|
||||
getArgumentCompletions: (prefix) => {
|
||||
const sources = ["extension", "template", "skill"];
|
||||
const sources = ["extension", "prompt", "skill"];
|
||||
const filtered = sources.filter((s) => s.startsWith(prefix));
|
||||
return filtered.length > 0 ? filtered.map((s) => ({ value: s, label: s })) : null;
|
||||
},
|
||||
handler: async (args, ctx) => {
|
||||
const commands = pi.getCommands();
|
||||
const sourceFilter = args.trim() as "extension" | "template" | "skill" | "";
|
||||
const sourceFilter = args.trim() as "extension" | "prompt" | "skill" | "";
|
||||
|
||||
// Filter by source if specified
|
||||
const filtered = sourceFilter ? commands.filter((c) => c.source === sourceFilter) : commands;
|
||||
|
|
@ -39,9 +39,9 @@ export default function commandsExtension(pi: ExtensionAPI) {
|
|||
};
|
||||
|
||||
const items: string[] = [];
|
||||
const sources: Array<{ key: "extension" | "template" | "skill"; label: string }> = [
|
||||
const sources: Array<{ key: "extension" | "prompt" | "skill"; label: string }> = [
|
||||
{ key: "extension", label: "Extensions" },
|
||||
{ key: "template", label: "Templates" },
|
||||
{ key: "prompt", label: "Prompts" },
|
||||
{ key: "skill", label: "Skills" },
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -1799,7 +1799,7 @@ export class AgentSession {
|
|||
const templates: SlashCommandInfo[] = this.promptTemplates.map((template) => ({
|
||||
name: template.name,
|
||||
description: template.description,
|
||||
source: "template",
|
||||
source: "prompt",
|
||||
location: normalizeLocation(template.source),
|
||||
path: template.filePath,
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export type SlashCommandSource = "extension" | "template" | "skill";
|
||||
export type SlashCommandSource = "extension" | "prompt" | "skill";
|
||||
|
||||
export type SlashCommandLocation = "user" | "project" | "path";
|
||||
|
||||
|
|
|
|||
|
|
@ -543,7 +543,7 @@ export async function runRpcMode(session: AgentSession): Promise<never> {
|
|||
commands.push({
|
||||
name: template.name,
|
||||
description: template.description,
|
||||
source: "template",
|
||||
source: "prompt",
|
||||
location: template.source as RpcSlashCommand["location"],
|
||||
path: template.filePath,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ export interface RpcSlashCommand {
|
|||
/** Human-readable description */
|
||||
description?: string;
|
||||
/** What kind of command this is */
|
||||
source: "extension" | "template" | "skill";
|
||||
source: "extension" | "prompt" | "skill";
|
||||
/** Where the command was loaded from (undefined for extensions) */
|
||||
location?: "user" | "project" | "path";
|
||||
/** File path to the command source */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue