feat(dx): codelens doctor command — env audit + auto-fix, exit codes 0/1/2 (closes #64 phase-1)#132
Merged
Merged
Conversation
…0/1/2 (closes #64 phase-1)
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
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
Implements Phase 1 of issue #64 —
codelens doctorcommand for environment audit + auto-fix.doctoraudits the local environment for everything CodeLens needs to run well, and reports a single-pass table of checks. It's the "why doesn't this work?" debugging tool — for users, for CI, and for the setup script.Files
New:
scripts/commands/doctor.py— full doctor command: 10 audit checks,--fix,--verbose,--format {text,json}, exit codes 0/1/2tests/test_doctor.py— 32 tests covering output schema, aggregation logic, version comparison, fix mode (mocked), CLI smoke, network-failure toleranceModified:
scripts/codelens.py— dispatcher now (1) skipsformat_outputwhen doctor already printed its text table, (2) propagatesexit_codefrom doctor result; subparser--formatno longer auto-added when a command defines its owntests/test_integration.py—EXPECTED_COMMAND_COUNT67 → 68 (manual sentinel, by design not auto-synced)README.md,SKILL.md,SKILL-QUICK.md,pyproject.toml,skill.json,scripts/graph_model.py— auto-synced bypython3 scripts/sync_command_count.py --applyto reflect 67 → 68Audit checks (10 total)
tree_sittermodule — criticalyaml(PyYAML) — warning (optional)watchdog— warning (optional, for file watching)sqlite3— critical (stdlib, used for persistent registry)urllib— critical (stdlib, used for vuln-scan + upgrade)gitbinary — warning (optional, for ownership).codelens/writable — critical (creates dir + probe-write)Key design decisions
ok→ 0,warning→ 1,critical→ 2. CI pipelines can gate on doctor failures.warning(nevercritical) on network errors, so air-gapped CI doesn't fail doctor.--fixis safe — only runspip install --userfor missing Python deps. Does NOT install system binaries (git, etc.). Single pip invocation for all missing packages (faster + one dependency-resolver pass).--format jsonfor CI — machine-readable schema withstatus,exit_code,checks[],fixes[],summary{ok,warning,critical,total},platform{python,platform,machine,executable}.--format text(default) is human-readable — ASCII symbols[OK]/[WARN]/[FAIL]so output is grep-friendly and works on Windows terminals.--fix— the reported exit code reflects the post-fix state, so CI knows if the fix actually resolved the issues.--formatoverrides global — doctor is the first command to define its own--format(withtextchoice); dispatcher was updated to respect command-specific--formatinstead of conflict-erroring.Acceptance criteria
codelens doctorcorrectly detects all missing dependenciescodelens doctor --fixinstalls missing deps without error (mocked in tests)codelens doctor --format jsonproduces valid JSON for CIcodelens doctor --verboseadds detail linessync_command_count.py --applyrun — all docs reflect 68 commandsEXPECTED_COMMAND_COUNTsentinel updated 67 → 68(Phases 2–4 —
codelens sessions,install.sh --dry-run/--self-test/--uninstall,codelens upgrade— are out of scope for this Phase 1 PR.)Test results
tests/test_doctor.py— all passtests/test_command_count.py+tests/test_integration.py::TestModuleStructure— all passVerified
git applycleanly againstWolfvin/CodeLens@main.Closes #64 (phase-1).