Summary
Add 4 DX commands to reduce support burden and improve onboarding: codelens doctor (environment audit + auto-fix), codelens sessions (installer session log viewer), codelens upgrade (in-place self-update), install.sh --dry-run/--self-test/--uninstall.
Worker consensus (2 reports)
| Worker |
Source |
Contribution |
| UBS |
update!/CodeLens_UBS_Upgrade_Analysis.md #3 |
codelens doctor — audit Python version, tree-sitter + 6 grammars, PyYAML, watchdog, git, SQLite, urllib, writable .codelens/. --fix auto-installs missing deps. --verbose, --format=json. Exit codes 0/1/2. Integrate with setup.sh. |
| UBS |
same file #13 |
codelens sessions — setup.sh appends Markdown session log to ~/.codelens/session.md per install. --entries=N, --raw, --config-dir, --json. Rotate if >1MB (keep last 50). |
| UBS |
same file #25 |
install.sh --dry-run (print actions without touching disk), --self-test (run smoke test post-install), --uninstall (delete binary, remove RC snippets, remove ~/.codelens/, remove agent hooks, --non-interactive). Track written files in ~/.codelens/installed-files.txt. |
| CodeGraph |
update!/CodeLens_CodeGraph_Upgrade_Analysis.md #12 |
codelens upgrade [version] — detect install method (pip, homebrew, source, binary), update accordingly. --check, --force, codelens upgrade <version> (pin). Windows: spawn DETACHED helper. |
Proposed scope (P2, 3-4 weeks total)
Phase 1 — codelens doctor (P1, 3-5 days, quick win)
- New
scripts/commands/doctor.py
- Audit:
- Python version (3.8+)
- tree-sitter core
- 6 grammar packages (html, css, javascript, typescript, rust, python)
- PyYAML
- watchdog (optional)
- git (optional, for ownership)
- SQLite
- urllib
- Writable
.codelens/ dirs
- Latest available CodeLens version (via GitHub Releases API)
--fix auto-install missing deps via pip install --user
--verbose shows full diagnostic
--format=json for CI parsing
- Color output with ✓/✗ symbols
- Exit codes: 0 OK / 1 warning / 2 critical missing
- Integrate with
setup.sh to run at end of setup
Phase 2 — codelens sessions (P2, 3-5 days)
setup.sh appends Markdown session log to ~/.codelens/session.md per install
- Log fields: duration, Python/OS/arch, detected agents with ✓/✗, configured integrations, dependencies installed, warnings, errors
- JSON sidecar at
~/.codelens/session.json for programmatic access
- New
scripts/commands/sessions.py
--entries=N (last N sessions, default 5)
--raw (full unformatted)
--config-dir=<path>
--json
- Rotate if >1MB (keep last 50 sessions)
- Integrate with
doctor for diagnosis
Phase 3 — install.sh safety flags (P2, 3-5 days, depends on distribution issue)
--dry-run — print all install actions without touching disk, "WOULD: ..." for every write op
--self-test — run smoke test post-install via pytest test-suite/install/, exit non-zero on failure
--uninstall — delete binary, remove shell RC snippets/aliases, remove ~/.codelens/, remove agent hooks
--non-interactive for scripted uninstall
- Track all written files in
~/.codelens/installed-files.txt for clean uninstall
Phase 4 — codelens upgrade (P2, 1 week, depends on distribution issue)
- New
scripts/commands/upgrade.py
- Detect install method: pip, homebrew, source (via
.git), binary
codelens upgrade — update to latest
codelens upgrade <version> — pin to specific version
codelens upgrade --check — compare current vs latest GitHub Release, exit 0/1
codelens upgrade --force — force reinstall
- Windows wrinkle: spawn DETACHED helper (
subprocess.Popen with CREATE_NEW_PROCESS_GROUP) that waits for current process exit then runs installer (rustup/nvm-windows pattern)
- Version check fetches
https://api.github.com/repos/Wolfvin/CodeLens/releases/latest, compares tag_name with CODELENS_VERSION
Acceptance criteria
Files
- New:
scripts/commands/{doctor,sessions,upgrade}.py, scripts/install.py (Python replacement for install.sh), scripts/templates/install/
- Update:
setup.sh, scripts/commands/__init__.py
Summary
Add 4 DX commands to reduce support burden and improve onboarding:
codelens doctor(environment audit + auto-fix),codelens sessions(installer session log viewer),codelens upgrade(in-place self-update),install.sh --dry-run/--self-test/--uninstall.Worker consensus (2 reports)
update!/CodeLens_UBS_Upgrade_Analysis.md#3codelens doctor— audit Python version, tree-sitter + 6 grammars, PyYAML, watchdog, git, SQLite, urllib, writable.codelens/.--fixauto-installs missing deps.--verbose,--format=json. Exit codes 0/1/2. Integrate withsetup.sh.codelens sessions—setup.shappends Markdown session log to~/.codelens/session.mdper install.--entries=N,--raw,--config-dir,--json. Rotate if >1MB (keep last 50).install.sh --dry-run(print actions without touching disk),--self-test(run smoke test post-install),--uninstall(delete binary, remove RC snippets, remove~/.codelens/, remove agent hooks,--non-interactive). Track written files in~/.codelens/installed-files.txt.update!/CodeLens_CodeGraph_Upgrade_Analysis.md#12codelens upgrade [version]— detect install method (pip, homebrew, source, binary), update accordingly.--check,--force,codelens upgrade <version>(pin). Windows: spawn DETACHED helper.Proposed scope (P2, 3-4 weeks total)
Phase 1 —
codelens doctor(P1, 3-5 days, quick win)scripts/commands/doctor.py.codelens/dirs--fixauto-install missing deps viapip install --user--verboseshows full diagnostic--format=jsonfor CI parsingsetup.shto run at end of setupPhase 2 —
codelens sessions(P2, 3-5 days)setup.shappends Markdown session log to~/.codelens/session.mdper install~/.codelens/session.jsonfor programmatic accessscripts/commands/sessions.py--entries=N(last N sessions, default 5)--raw(full unformatted)--config-dir=<path>--jsondoctorfor diagnosisPhase 3 —
install.shsafety flags (P2, 3-5 days, depends on distribution issue)--dry-run— print all install actions without touching disk, "WOULD: ..." for every write op--self-test— run smoke test post-install viapytest test-suite/install/, exit non-zero on failure--uninstall— delete binary, remove shell RC snippets/aliases, remove~/.codelens/, remove agent hooks--non-interactivefor scripted uninstall~/.codelens/installed-files.txtfor clean uninstallPhase 4 —
codelens upgrade(P2, 1 week, depends on distribution issue)scripts/commands/upgrade.py.git), binarycodelens upgrade— update to latestcodelens upgrade <version>— pin to specific versioncodelens upgrade --check— compare current vs latest GitHub Release, exit 0/1codelens upgrade --force— force reinstallsubprocess.PopenwithCREATE_NEW_PROCESS_GROUP) that waits for current process exit then runs installer (rustup/nvm-windows pattern)https://api.github.com/repos/Wolfvin/CodeLens/releases/latest, comparestag_namewithCODELENS_VERSIONAcceptance criteria
codelens doctorcorrectly detects all missing dependenciescodelens doctor --fixinstalls missing deps without errorcodelens sessionsshows last 5 install sessionsinstall.sh --dry-runproduces no filesystem changesinstall.sh --uninstallremoves all installed files (verified byinstalled-files.txt)codelens upgrade --checkcorrectly compares versionscodelens upgradeworks for pip / homebrew / source install methodsFiles
scripts/commands/{doctor,sessions,upgrade}.py,scripts/install.py(Python replacement forinstall.sh),scripts/templates/install/setup.sh,scripts/commands/__init__.py