feat: add kiqr doctor preflight command#12
Merged
Conversation
Add a `kiqr doctor` command that runs cheap, read-only environment checks
and reports pass/fail with actionable messages:
- Docker installed (isDockerInstalled)
- Docker running (isDockerRunning) — skipped when the CLI is absent
- Traefik port 5477 available (isPortAvailable)
- LiveReload port 35729 available (isPortAvailable)
- Platform (WSL detection via /proc/version)
The check logic lives in a pure, testable src/lib/doctor.ts returning a
list of {name, ok, detail} results; src/commands/doctor.tsx is a thin Ink
renderer that exits non-zero when any check fails. This also gives the
previously-unused isPortAvailable helper in src/lib/ports.ts a real caller.
Adds tests/lib/doctor.test.ts (10 cases) mocking node:child_process via the
docker/ports modules and node:fs for WSL detection, mirroring the existing
docker/ports test style. Lists the command in `kiqr` help and the README.
typecheck, test (80 passing), and build all green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
kiqr doctorcommand that runs cheap, read-only environment preflight checks and reports each as pass/fail with an actionable message. Useful beforekiqr upto catch the usual culprits.Checks:
isDockerInstalled)isDockerRunning) — skipped cleanly when the CLI isn't presentisPortAvailable)isPortAvailable)/proc/version(informational)Design
src/lib/doctor.tsthat returns{name, ok, detail}[].src/commands/doctor.tsxis a thin Ink renderer that exits non-zero if any check fails.src/lib/traefik.tsandsrc/lib/livereload.ts, and this gives the previously-unusedisPortAvailablehelper a real caller.Tests
tests/lib/doctor.test.ts(10 cases) mocks the docker/ports modules andnode:fs(for WSL detection), following the existingtests/lib/docker.test.ts/tests/lib/ports.test.tsstyle. Covers healthy env, missing Docker CLI (and that the daemon is then not probed), daemon down, both port checks, port-in-use, and WSL detection.Also lists
kiqr doctorin thekiqrhelp screen and the README command table.npm run typecheck,npm test(80 passing), andnpm run buildall green.🤖 Generated with Claude Code