Files
openclaw/src/cli/root-option-value.ts
clawsweeper[bot] d916f176e1 fix(cli): preserve equals in root option values [AI-assisted] (#84107)
Summary:
- This PR updates CLI root option parsing to preserve embedded equals signs, adds focused Vitest coverage for inline and space-separated values, and records the fix in the changelog.
- Reproducibility: yes. by source inspection: current main uses `raw.split("=", 2)`, so `--token=abc=def` returns only `abc`; the PR body also supplies after-fix live output for the same path.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix(cli): preserve equals in root option values [AI-assisted]

Validation:
- ClawSweeper review passed for head 8a15801e79.
- Required merge gates passed before the squash merge.

Prepared head SHA: 8a15801e79
Review: https://github.com/openclaw/openclaw/pull/84107#issuecomment-4487314163

Co-authored-by: Thiago Costa <thiago12_fera@hotmail.com>
Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com>
Approved-by: takhoffman
Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
2026-05-19 11:37:35 +00:00

19 lines
535 B
TypeScript

import { isValueToken } from "../infra/cli-root-options.js";
export function takeCliRootOptionValue(
raw: string,
next: string | undefined,
): {
value: string | null;
consumedNext: boolean;
} {
if (raw.includes("=")) {
const value = raw.slice(raw.indexOf("=") + 1);
const trimmed = (value ?? "").trim();
return { value: trimmed || null, consumedNext: false };
}
const consumedNext = isValueToken(next);
const trimmed = consumedNext ? next!.trim() : "";
return { value: trimmed || null, consumedNext };
}