mirror of https://github.com/openclaw/openclaw.git
CLI: route sessions cleanup through subcommand parser
This commit is contained in:
parent
e536dcde28
commit
382bdce4b3
|
|
@ -68,6 +68,7 @@ describe("command-registry", () => {
|
|||
expect(names).toContain("memory");
|
||||
expect(names).toContain("agents");
|
||||
expect(names).toContain("browser");
|
||||
expect(names).toContain("sessions");
|
||||
expect(names).not.toContain("agent");
|
||||
expect(names).not.toContain("status");
|
||||
expect(names).not.toContain("doctor");
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ const coreEntries: CoreCliEntry[] = [
|
|||
{
|
||||
name: "sessions",
|
||||
description: "List stored conversation sessions",
|
||||
hasSubcommands: false,
|
||||
hasSubcommands: true,
|
||||
},
|
||||
],
|
||||
register: async ({ program }) => {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ describe("program routes", () => {
|
|||
await expectRunFalse(["sessions"], ["node", "openclaw", "sessions", "--active"]);
|
||||
});
|
||||
|
||||
it("does not fast-route sessions subcommands", () => {
|
||||
expect(findRoutedCommand(["sessions", "cleanup"])).toBeNull();
|
||||
});
|
||||
|
||||
it("does not match unknown routes", () => {
|
||||
expect(findRoutedCommand(["definitely-not-real"])).toBeNull();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -43,7 +43,9 @@ const routeStatus: RouteSpec = {
|
|||
};
|
||||
|
||||
const routeSessions: RouteSpec = {
|
||||
match: (path) => path[0] === "sessions",
|
||||
// Fast-path only bare `sessions`; subcommands (e.g. `sessions cleanup`)
|
||||
// must fall through to Commander so nested handlers run.
|
||||
match: (path) => path[0] === "sessions" && !path[1],
|
||||
run: async (argv) => {
|
||||
const json = hasFlag(argv, "--json");
|
||||
const store = getFlagValue(argv, "--store");
|
||||
|
|
|
|||
Loading…
Reference in New Issue