diff --git a/src/cli/argv.test.ts b/src/cli/argv.test.ts index 63ecac5c4e9..3c719783d93 100644 --- a/src/cli/argv.test.ts +++ b/src/cli/argv.test.ts @@ -9,6 +9,7 @@ import { hasHelpOrVersion, hasFlag, isRootHelpRequest, + isRootNoCommandRequest, isRootVersionRequest, shouldMigrateState, shouldMigrateStateFromPath, @@ -384,4 +385,29 @@ describe("argv helpers", () => { ])("isRootHelpRequest: $name", ({ argv, expected }) => { expect(isRootHelpRequest(argv)).toBe(expected); }); + + it.each([ + { + name: "no args", + argv: ["node", "openclaw"], + expected: true, + }, + { + name: "only root flags", + argv: ["node", "openclaw", "--dev", "--profile", "work"], + expected: true, + }, + { + name: "subcommand present", + argv: ["node", "openclaw", "status"], + expected: false, + }, + { + name: "non-flag token after terminator is ignored", + argv: ["node", "openclaw", "--", "status"], + expected: true, + }, + ])("isRootNoCommandRequest: $name", ({ argv, expected }) => { + expect(isRootNoCommandRequest(argv)).toBe(expected); + }); });