You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dispatch doctor prints a useful setup report, but it always exits 0, even when the config, session store, session-state directory, or Copilot CLI binary is missing. That makes it useless as a gate in an install script or CI step. Right now the only way to check setup programmatically is to run dispatch doctor --json and parse every field yourself.
flowchart TD
A[dispatch doctor --strict] --> B[Collect doctor report]
B --> C{Any critical check failing?}
C -->|no| D[Print report, exit 0]
C -->|yes| E[Print report, exit non-zero]
F[dispatch doctor --json] --> G[Report includes ok: true/false]
Loading
Proposed solution
Make the doctor report scriptable without changing the default behavior:
Add an ok boolean to the --json output that is false when any critical check (config path resolvable, session store present, session-state directory present, Copilot CLI found) is failing.
Add a --strict flag: dispatch doctor --strict prints the same report but exits non-zero when ok is false. --strict works with --json too.
Leave plain dispatch doctor and dispatch doctor --json exiting 0 as they do now, so existing usage does not change.
Define "critical" narrowly: a missing or wrong-type config, session store, or session-state path, or a missing Copilot CLI binary. The Copilot CLI version string and session count stay informational and never fail the check on their own.
Acceptance criteria
dispatch doctor --json includes an ok boolean reflecting whether all critical checks passed.
dispatch doctor --strict exits non-zero when a critical check fails and 0 when everything passes.
--strict combines with --json.
Plain dispatch doctor and dispatch doctor --json still exit 0 regardless of check results.
Help text documents --strict; completion lists it.
Unit tests cover the healthy path (ok true, exit 0) and a failing path (ok false, strict exit non-zero).
Notes
collectDoctorReport already gathers every check into a struct, so ok is a small addition. The doctor branch in handleArgs returns an error to main, which already exits 1 on a non-nil error without printing extra text, so wiring the strict exit is straightforward.
Problem
dispatch doctorprints a useful setup report, but it always exits 0, even when the config, session store, session-state directory, or Copilot CLI binary is missing. That makes it useless as a gate in an install script or CI step. Right now the only way to check setup programmatically is to rundispatch doctor --jsonand parse every field yourself.flowchart TD A[dispatch doctor --strict] --> B[Collect doctor report] B --> C{Any critical check failing?} C -->|no| D[Print report, exit 0] C -->|yes| E[Print report, exit non-zero] F[dispatch doctor --json] --> G[Report includes ok: true/false]Proposed solution
Make the doctor report scriptable without changing the default behavior:
okboolean to the--jsonoutput that is false when any critical check (config path resolvable, session store present, session-state directory present, Copilot CLI found) is failing.--strictflag:dispatch doctor --strictprints the same report but exits non-zero whenokis false.--strictworks with--jsontoo.dispatch doctoranddispatch doctor --jsonexiting 0 as they do now, so existing usage does not change.Define "critical" narrowly: a missing or wrong-type config, session store, or session-state path, or a missing Copilot CLI binary. The Copilot CLI version string and session count stay informational and never fail the check on their own.
Acceptance criteria
dispatch doctor --jsonincludes anokboolean reflecting whether all critical checks passed.dispatch doctor --strictexits non-zero when a critical check fails and 0 when everything passes.--strictcombines with--json.dispatch doctoranddispatch doctor --jsonstill exit 0 regardless of check results.--strict; completion lists it.Notes
collectDoctorReportalready gathers every check into a struct, sookis a small addition. Thedoctorbranch inhandleArgsreturns an error tomain, which already exits 1 on a non-nil error without printing extra text, so wiring the strict exit is straightforward.