feat: add /clear as alias for /new slash command (#59)

Registers /clear as a command that calls ctx.newSession(), identical to /new.
Shows in autocomplete when typing /cl with 'Alias for /new' description.
This commit is contained in:
jonathancostin 2026-03-11 16:45:34 -05:00 committed by GitHub
parent 7b28162ade
commit 3b9a8c1c63
2 changed files with 12 additions and 0 deletions

View file

@ -0,0 +1,10 @@
import type { ExtensionAPI, ExtensionCommandContext } from "@mariozechner/pi-coding-agent";
export default function clearCommand(pi: ExtensionAPI) {
pi.registerCommand("clear", {
description: "Alias for /new — start a new session",
async handler(_args: string, ctx: ExtensionCommandContext) {
await ctx.newSession();
},
});
}

View file

@ -3,10 +3,12 @@ import createSlashCommand from "./create-slash-command.js";
import createExtension from "./create-extension.js";
import auditCommand from "./audit.js";
import gsdRun from "./gsd-run.js";
import clearCommand from "./clear.js";
export default function slashCommands(pi: ExtensionAPI) {
createSlashCommand(pi);
createExtension(pi);
auditCommand(pi);
gsdRun(pi);
clearCommand(pi);
}