Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Reject flag tokens as values in dev-runner arg parsing

Julius Marmingec9a59a26bb85
diff --git a/scripts/dev-runner.mjs b/scripts/dev-runner.mjs
index 67ffbc2b6..1c6efcc63 100644
--- a/scripts/dev-runner.mjs
+++ b/scripts/dev-runner.mjs
@@ -131,7 +131,7 @@ export function parseDevRunnerArgs(rawArgs) {
let value = parsedFlag.value;
if (value === undefined) {
const next = args[index + 1];
- if (next === undefined) {
+ if (next === undefined || next === "--" || next.startsWith("-")) {
throw new Error(`Missing value for --${parsedFlag.name}`);
}
value = next;
diff --git a/scripts/dev-runner.test.ts b/scripts/dev-runner.test.ts
index 98dd5bd53..4501bf792 100644
--- a/scripts/dev-runner.test.ts
+++ b/scripts/dev-runner.test.ts
@@ -30,6 +30,12 @@ describe("parseDevRunnerArgs", () => {
it("throws when a value flag is missing its value", () => {
expect(() => parseDevRunnerArgs(["--state-dir"])).toThrow("Missing value for --state-dir");
});
+
+ it("throws when a value flag is followed by another flag token", () => {
+ expect(() => parseDevRunnerArgs(["--state-dir", "--continue"])).toThrow(
+ "Missing value for --state-dir",
+ );
+ });
});
describe("createDevRunnerEnv", () => {