⚠️ Definition of Done: this issue must be completed in full, in a single PR. Do not split this
work across multiple PRs, and do not defer any Deliverable below to a follow-up issue. A PR that
satisfies only some of the Deliverables, stubs a required test, or leaves a checkbox
partially-done does NOT resolve this issue and will be closed.
Context
packages/loopover-mcp/bin/loopover-mcp.ts:5462-5499's parseOptions has a generic --key=value
inline-equals handler (added for --format=table, per its own comment referencing #2231) that
applies uniformly to every flag, storing the raw string value. Every consumer of options.json (23
call sites, e.g. lines 4214, 4278, 4407, 4599, 4877, 5024, 6220, emitList at 5512, and
cli-error.ts's argsWantJson) checks plain truthiness (if (options.json) /
arg?.startsWith("--json=")). So --json=false sets options.json = "false" — a non-empty string,
which is truthy — meaning JSON output turns ON, the opposite of what the flag says.
The identical bug affects --exit-code in doctor: bin/loopover-mcp.ts:5940:
options.exitCode && payload.status === "needs_attention" ? 1 : 0 — --exit-code=false is also
truthy.
This is a real inconsistency with the codebase's own established convention, not a theoretical edge
case: the same file already hardened every other boolean flag against exactly this ambiguity —
--refresh (line 4033, whose comment explicitly explains why === true is required) and --help
(10 sites, all === true), plus --all/--activate. Every options.json and options.exitCode
check was simply missed when that hardening was applied elsewhere.
Requirements
- Change every
options.json truthiness check to the same === true (or equivalent explicit
boolean-parsing) pattern already used for --refresh/--help/--all/--activate.
- Apply the identical fix to
options.exitCode in doctor.
- Ensure
--json (no explicit value, defaulting to true) and --json=true both still work as
before — only --json=false/--exit-code=false should change behavior (to correctly disable).
Deliverables
All Deliverables above are required in the same PR.
Test Coverage Requirements
packages/loopover-mcp/** is measured by codecov/patch (99%+ target, branch-counted). The new
tests must exercise both the =false and default/=true branches for both flags.
Expected Outcome
--json=false and --exit-code=false behave as their names claim (disabling, not enabling),
matching the boolean-parsing convention already established for every other boolean flag in this
CLI.
Links & Resources
packages/loopover-mcp/bin/loopover-mcp.ts:5462-5499 (parseOptions), :4033 (--refresh's
already-correct pattern), :5940 (doctor's --exit-code check)
packages/loopover-mcp/lib/cli-error.ts (argsWantJson)
test/unit/mcp-cli-basics.test.ts (existing in-process test harness to use)
Context
packages/loopover-mcp/bin/loopover-mcp.ts:5462-5499'sparseOptionshas a generic--key=valueinline-equals handler (added for
--format=table, per its own comment referencing #2231) thatapplies uniformly to every flag, storing the raw string value. Every consumer of
options.json(23call sites, e.g. lines 4214, 4278, 4407, 4599, 4877, 5024, 6220,
emitListat 5512, andcli-error.ts'sargsWantJson) checks plain truthiness (if (options.json)/arg?.startsWith("--json=")). So--json=falsesetsoptions.json = "false"— a non-empty string,which is truthy — meaning JSON output turns ON, the opposite of what the flag says.
The identical bug affects
--exit-codeindoctor:bin/loopover-mcp.ts:5940:options.exitCode && payload.status === "needs_attention" ? 1 : 0—--exit-code=falseis alsotruthy.
This is a real inconsistency with the codebase's own established convention, not a theoretical edge
case: the same file already hardened every other boolean flag against exactly this ambiguity —
--refresh(line 4033, whose comment explicitly explains why=== trueis required) and--help(10 sites, all
=== true), plus--all/--activate. Everyoptions.jsonandoptions.exitCodecheck was simply missed when that hardening was applied elsewhere.
Requirements
options.jsontruthiness check to the same=== true(or equivalent explicitboolean-parsing) pattern already used for
--refresh/--help/--all/--activate.options.exitCodeindoctor.--json(no explicit value, defaulting to true) and--json=trueboth still work asbefore — only
--json=false/--exit-code=falseshould change behavior (to correctly disable).Deliverables
options.jsonconsumers use the same explicit boolean-comparison pattern as--refresh/--help, so--json=falsecorrectly disables JSON output.doctor'soptions.exitCodecheck has the same fix, so--exit-code=falsecorrectly keepsthe exit code at 0.
runCli/parseOptionsharness (pattern already usedin
test/unit/mcp-cli-basics.test.ts) calls["whoami", "--json=false"]and asserts plain-textoutput, not JSON.
["doctor", "--exit-code=false"]against a failing check and asserts theexit code stays 0.
--jsonand--json=truestill enable JSON output as before.All Deliverables above are required in the same PR.
Test Coverage Requirements
packages/loopover-mcp/**is measured bycodecov/patch(99%+ target, branch-counted). The newtests must exercise both the
=falseand default/=truebranches for both flags.Expected Outcome
--json=falseand--exit-code=falsebehave as their names claim (disabling, not enabling),matching the boolean-parsing convention already established for every other boolean flag in this
CLI.
Links & Resources
packages/loopover-mcp/bin/loopover-mcp.ts:5462-5499(parseOptions),:4033(--refresh'salready-correct pattern),
:5940(doctor's--exit-codecheck)packages/loopover-mcp/lib/cli-error.ts(argsWantJson)test/unit/mcp-cli-basics.test.ts(existing in-process test harness to use)