Files
openclaw/src/auto-reply/reply/debug-commands.ts
2026-02-18 23:09:09 +00:00

27 lines
776 B
TypeScript

import { parseStandardSetUnsetSlashCommand } from "./commands-setunset-standard.js";
export type DebugCommand =
| { action: "show" }
| { action: "reset" }
| { action: "set"; path: string; value: unknown }
| { action: "unset"; path: string }
| { action: "error"; message: string };
export function parseDebugCommand(raw: string): DebugCommand | null {
return parseStandardSetUnsetSlashCommand<DebugCommand>({
raw,
slash: "/debug",
invalidMessage: "Invalid /debug syntax.",
usageMessage: "Usage: /debug show|set|unset|reset",
onKnownAction: (action) => {
if (action === "show") {
return { action: "show" };
}
if (action === "reset") {
return { action: "reset" };
}
return undefined;
},
});
}