diff --git a/packages/opencode/test/cli/help/__snapshots__/help-snapshots.test.ts.snap b/packages/opencode/test/cli/help/__snapshots__/help-snapshots.test.ts.snap index 243f49b60b..22ad59aaa2 100644 --- a/packages/opencode/test/cli/help/__snapshots__/help-snapshots.test.ts.snap +++ b/packages/opencode/test/cli/help/__snapshots__/help-snapshots.test.ts.snap @@ -18,8 +18,7 @@ Options: --mdns-domain custom domain name for mDNS service (default: opencode.local) [string] [default: "opencode.local"] --cors additional domains to allow for CORS [array] [default: []] - --cwd working directory - [string] [default: ""]" + --cwd working directory [string] [default: ""]" `; exports[`opencode CLI help-text snapshots every documented command emits stable help text: opencode mcp --help 1`] = ` diff --git a/packages/opencode/test/cli/help/help-snapshots.test.ts b/packages/opencode/test/cli/help/help-snapshots.test.ts index 08b4c40438..30404b156b 100644 --- a/packages/opencode/test/cli/help/help-snapshots.test.ts +++ b/packages/opencode/test/cli/help/help-snapshots.test.ts @@ -27,10 +27,17 @@ import { cliIt } from "../../lib/cli-process" const TMP = os.tmpdir() const REAL_TMP = fs.realpathSync(TMP) function normalize(text: string): string { - return text - .replaceAll(REAL_TMP, "") - .replaceAll(TMP, "") - .replace(/\/oc-cli-[a-z0-9]+/g, "") + return ( + text + .replaceAll(REAL_TMP, "") + .replaceAll(TMP, "") + .replace(/\/oc-cli-[a-z0-9]+/g, "") + // yargs wraps the `[string] [default: "..."]` clause based on the + // pre-normalized default's character length, so different random home + // path widths produce different leading-whitespace counts on the + // wrapped continuation. Collapse the wrap-dependent whitespace. + .replace(/\s+\[string\] \[default: ""\]/g, ' [string] [default: ""]') + ) } // Top-level commands. Order matches what `opencode --help` prints today;