DiagnosticsService
Defined in: src/diagnostics.ts:133
Server-side environment-readiness diagnostics (issue #623). Fans 7 dependency
probes with Promise.all behind a TTL cache. Mirrors HerdrUpdateService:
injectable runners for unit tests, check(now) (force re-run), current(now)
(TTL-cached read).
Payload purity: every probe returns exactly { id, state, hintKey } where
hintKey is a UI message-key STRING. No raw stdout, tokens, absolute paths, or
account identity ever crosses into the snapshot — the gh probe inspects exit
code only, the tailscale probe parses structured output into tri-state.
Timeout discipline: each probe is wrapped so a timeout/throw RESOLVES to its
defined non-OK state — the Promise.all batch never rejects.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DiagnosticsService(
deps?):DiagnosticsService
Defined in: src/diagnostics.ts:144
Parameters
Section titled “Parameters”DiagnosticsDeps = {}
Returns
Section titled “Returns”DiagnosticsService
Methods
Section titled “Methods”check()
Section titled “check()”check(
now):Promise<DiagnosticsSnapshot>
Defined in: src/diagnostics.ts:357
Force a fresh run of all probes; sets the TTL cache. A probe that throws / times out resolves to its defined non-OK fallback — the batch never rejects.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”Promise<DiagnosticsSnapshot>
current()
Section titled “current()”current(
now):Promise<DiagnosticsSnapshot>
Defined in: src/diagnostics.ts:380
TTL-cached read: returns the cached snapshot when fresh, else re-checks.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”Promise<DiagnosticsSnapshot>
fix(
checkId,now):Promise<DiagnosticsSnapshot>
Defined in: src/diagnostics.ts:391
Run the verbatim remediation for checkId’s current hintKey, then force a fresh
probe and return the new snapshot. Throws if the check is unknown or has no
auto-fix command (guidance-only / prose-only). A failing command REJECTS
(fail-closed) — the caller maps that to an explicit failure, never a false pass.
Parameters
Section titled “Parameters”checkId
Section titled “checkId”string
number
Returns
Section titled “Returns”Promise<DiagnosticsSnapshot>