feat(commands): add side alias for btw

This commit is contained in:
Peter Steinberger
2026-05-03 18:22:13 +01:00
parent c30531ddaf
commit 2805bbd3d7
16 changed files with 174 additions and 14 deletions

View File

@@ -715,6 +715,33 @@ describe("handleSendChat", () => {
expect(host.chatMessage).toBe("/btw what changed?");
});
it("sends /side through the detached BTW path", async () => {
const request = vi.fn(async (method: string) => {
if (method === "chat.send") {
return {};
}
throw new Error(`Unexpected request: ${method}`);
});
const host = makeHost({
client: { request } as unknown as ChatHost["client"],
chatRunId: "run-main",
chatStream: "Working...",
chatMessage: "/side what changed?",
});
await handleSendChat(host);
expect(request).toHaveBeenCalledWith(
"chat.send",
expect.objectContaining({
message: "/side what changed?",
deliver: false,
}),
);
expect(host.chatQueue).toEqual([]);
expect(host.chatRunId).toBe("run-main");
});
it("sends /btw without adopting a main chat run when idle", async () => {
const request = vi.fn(async (method: string) => {
if (method === "chat.send") {

View File

@@ -146,7 +146,7 @@ function confirmChatResetCommand(text: string) {
}
function isBtwCommand(text: string) {
return /^\/btw(?::|\s|$)/i.test(text.trim());
return /^\/(?:btw|side)(?::|\s|$)/i.test(text.trim());
}
export async function handleAbortChat(host: ChatHost) {

View File

@@ -79,6 +79,10 @@ describe("parseSlashCommand", () => {
command: { key: "export-session" },
args: "",
});
expect(parseSlashCommand("/side what changed?")).toMatchObject({
command: { key: "btw", name: "btw", aliases: expect.arrayContaining(["side"]) },
args: "what changed?",
});
});
it("keeps canonical long-form slash names as the primary menu command", () => {