Context
packages/loopover-miner/lib/purge-cli.js's runPurge (lines 168-170) handles the top-level arg-parse failure with console.error(parsed.error); return 2; instead of routing through the shared reportCliFailure/argsWantJson contract from cli-error.js that the rest of the CLI suite uses (see the related governor-pause-cli.js gap for the same bug class). The rest of runPurge's actual purge-result reporting is already correctly --json-aware — only this one parse-error path is affected.
loopover-miner purge --repo <bad-value> --json (or any other arg-parse failure) prints plain text to stderr instead of the documented {ok:false,error} JSON envelope, breaking script/automation consumers that always pass --json and expect a JSON response regardless of success/failure.
Requirements
- The arg-parse error path in
runPurge must route through reportCliFailure(argsWantJson(args), parsed.error) instead of the raw console.error/return 2.
- Non-
--json behavior must be unchanged.
Deliverables
Test Coverage Requirements
99%+ Codecov patch target, branch-counted — both --json and non---json arms of the fixed path need direct tests.
Expected Outcome
loopover-miner purge --json on an arg-parse failure emits the standard {ok:false,error} JSON envelope, consistent with the rest of the module and the rest of the CLI suite.
Links & Resources
packages/loopover-miner/lib/cli-error.js — the shared contract.
- Related: the same bug class in
governor-pause-cli.js (filed separately, this is a narrower one-path instance).
Context
packages/loopover-miner/lib/purge-cli.js'srunPurge(lines 168-170) handles the top-level arg-parse failure withconsole.error(parsed.error); return 2;instead of routing through the sharedreportCliFailure/argsWantJsoncontract fromcli-error.jsthat the rest of the CLI suite uses (see the related governor-pause-cli.js gap for the same bug class). The rest ofrunPurge's actual purge-result reporting is already correctly--json-aware — only this one parse-error path is affected.loopover-miner purge --repo <bad-value> --json(or any other arg-parse failure) prints plain text to stderr instead of the documented{ok:false,error}JSON envelope, breaking script/automation consumers that always pass--jsonand expect a JSON response regardless of success/failure.Requirements
runPurgemust route throughreportCliFailure(argsWantJson(args), parsed.error)instead of the rawconsole.error/return 2.--jsonbehavior must be unchanged.Deliverables
runPurge(lines ~168-170) to use the shared contract.test/unit/miner-purge-cli.test.tscovering the arg-parse error WITH--json(the existing test at lines 229-232 only covers the error without--json).Test Coverage Requirements
99%+ Codecov patch target, branch-counted — both
--jsonand non---jsonarms of the fixed path need direct tests.Expected Outcome
loopover-miner purge --jsonon an arg-parse failure emits the standard{ok:false,error}JSON envelope, consistent with the rest of the module and the rest of the CLI suite.Links & Resources
packages/loopover-miner/lib/cli-error.js— the shared contract.governor-pause-cli.js(filed separately, this is a narrower one-path instance).