Skip to content

feat(cli): riskkernel doctor — diagnose a setup - #121

Merged
prashar32 merged 1 commit into
mainfrom
feat/doctor-command
Jun 13, 2026
Merged

feat(cli): riskkernel doctor — diagnose a setup#121
prashar32 merged 1 commit into
mainfrom
feat/doctor-command

Conversation

@prashar32

Copy link
Copy Markdown
Owner

Adds riskkernel doctor — a setup diagnostic that tells a new user exactly what's missing before "why doesn't it work?". Closes #94.

$ riskkernel doctor
✓ data dir (./data)  — writable
⚠ default provider (anthropic)  — ANTHROPIC_API_KEY not set — model calls will fail
✓ default budget  — safe defaults applied (no RISKKERNEL_DEFAULT_* set)
⚠ api token  — RISKKERNEL_API_TOKEN not set — the API is unauthenticated; don't expose this port
✓ policy file  — none configured (RISKKERNEL_POLICY_FILE unset)
⚠ daemon (:7070)  — not reachable (start it with `riskkernel serve`)

Checks: data dir creatable/writable · default provider known + credential present (Ollama key-free, Bedrock flagged) · default budget not explicitly-unlimited · API token set · a configured riskkernel.yaml parses · daemon reachable. Exits non-zero on a hard failure (✗), so it's CI-friendly; warnings (⚠) don't fail.

Testing

  • The config + filesystem checks are a pure diagnose() — unit-tested across the provider matrix, budget states, token set/unset, policy-file valid/invalid/missing, and data-dir writable/uncreatable.
  • Verified end-to-end by running the built binary in two configs (output above).

go vet clean; full suite green; race detector clean across the repo.

Add a `riskkernel doctor` command that runs a checklist over a setup and prints
✓/⚠/✗ for each, exiting non-zero on a hard failure (CI-friendly):

- data dir is creatable + writable (the file the user owns must persist),
- the default provider is known and has its credential (Ollama is key-free,
  Bedrock is flagged as a stub),
- the default budget isn't explicitly unlimited (a reliability runtime shouldn't
  run unbounded),
- the API token is set (warns when the API is unauthenticated),
- a configured riskkernel.yaml parses (a bad one would fail daemon startup),
- the daemon is reachable on the configured port (info/warn — useful either way).

The config + filesystem checks are split into a pure diagnose() so they're unit
tested (provider matrix, budget states, token, policy-file valid/invalid/missing,
data-dir writable/uncreatable). Reduces time-to-first-value: a new user can see
exactly what's missing before "why doesn't it work?".
@prashar32
prashar32 merged commit 756d881 into main Jun 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a riskkernel doctor command to diagnose a setup

1 participant