Context
packages/loopover-miner/lib/governor-pause-cli.js's runGovernorPause (lines 86-87, 112-113), runGovernorResume (lines ~120-121, 145-146), and runGovernorStatus (lines ~153-154, 168-169) each handle parse errors and catch-block errors with raw console.error(...); return 2;. Every sibling CLI module in packages/loopover-miner/lib/ (claim-ledger-cli.js, event-ledger-cli.js, governor-ledger-cli.js, governor-metrics-cli.js, loop-cli.js, metrics-cli.js, plan-store-cli.js, run-state-cli.js) instead routes error paths through the shared reportCliFailure(argsWantJson(args), ...) contract from cli-error.js, which emits a {ok:false,error} JSON envelope on stdout when --json was requested.
Because governor-pause-cli.js never imports or calls reportCliFailure/argsWantJson, running loopover-miner governor pause --reason x --json on an error path (a bad flag, or a real governor-state open/write failure) prints plain text to stderr instead of the documented JSON envelope — breaking any script or the MCP layer parsing --json output for this specific command family.
Requirements
runGovernorPause, runGovernorResume, and runGovernorStatus must route their parse-error and catch-error paths through reportCliFailure(argsWantJson(args) or parsed.json, ...), matching the convention already used by every sibling CLI module.
- Behavior for non-
--json invocations must be unchanged (still prints a human-readable error to stderr with exit code 2).
Deliverables
Test Coverage Requirements
This repo's Codecov patch gate is 99%+ hard, branch-counted — both the --json and non---json arm of every touched error path need a direct test.
Expected Outcome
loopover-miner governor pause|resume|status --json on any error path (bad flag, governor-state failure) emits the standard {ok:false,error} JSON envelope on stdout, consistent with every other CLI module in this package.
Links & Resources
packages/loopover-miner/lib/cli-error.js — the shared contract to adopt.
packages/loopover-miner/lib/claim-ledger-cli.js — reference implementation already using reportCliFailure/argsWantJson correctly.
Context
packages/loopover-miner/lib/governor-pause-cli.js'srunGovernorPause(lines 86-87, 112-113),runGovernorResume(lines ~120-121, 145-146), andrunGovernorStatus(lines ~153-154, 168-169) each handle parse errors and catch-block errors with rawconsole.error(...); return 2;. Every sibling CLI module inpackages/loopover-miner/lib/(claim-ledger-cli.js,event-ledger-cli.js,governor-ledger-cli.js,governor-metrics-cli.js,loop-cli.js,metrics-cli.js,plan-store-cli.js,run-state-cli.js) instead routes error paths through the sharedreportCliFailure(argsWantJson(args), ...)contract fromcli-error.js, which emits a{ok:false,error}JSON envelope on stdout when--jsonwas requested.Because
governor-pause-cli.jsnever imports or callsreportCliFailure/argsWantJson, runningloopover-miner governor pause --reason x --jsonon an error path (a bad flag, or a real governor-state open/write failure) prints plain text to stderr instead of the documented JSON envelope — breaking any script or the MCP layer parsing--jsonoutput for this specific command family.Requirements
runGovernorPause,runGovernorResume, andrunGovernorStatusmust route their parse-error and catch-error paths throughreportCliFailure(argsWantJson(args) or parsed.json, ...), matching the convention already used by every sibling CLI module.--jsoninvocations must be unchanged (still prints a human-readable error to stderr with exit code 2).Deliverables
argsWantJson/reportCliFailure/describeCliErrorfrom./cli-error.jsingovernor-pause-cli.js.console.error(...); return 2;error paths across the three functions with the shared contract.test/unit/miner-governor-pause-cli.test.tscovering each error path invoked WITH--json, asserting the JSON envelope shape (the existing error-path tests at lines 119-247 never pass--jsonalongside an error trigger).Test Coverage Requirements
This repo's Codecov patch gate is 99%+ hard, branch-counted — both the
--jsonand non---jsonarm of every touched error path need a direct test.Expected Outcome
loopover-miner governor pause|resume|status --jsonon any error path (bad flag, governor-state failure) emits the standard{ok:false,error}JSON envelope on stdout, consistent with every other CLI module in this package.Links & Resources
packages/loopover-miner/lib/cli-error.js— the shared contract to adopt.packages/loopover-miner/lib/claim-ledger-cli.js— reference implementation already usingreportCliFailure/argsWantJsoncorrectly.