mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:50:43 +00:00
feat(commands): add side alias for btw
This commit is contained in:
@@ -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") {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user