Skip to content

[FEATURE] Developer experience suite — doctor, sessions, upgrade, install flags #64

Description

@Wolfvin

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 sessionssetup.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

  • codelens doctor correctly detects all missing dependencies
  • codelens doctor --fix installs missing deps without error
  • codelens sessions shows last 5 install sessions
  • install.sh --dry-run produces no filesystem changes
  • install.sh --uninstall removes all installed files (verified by installed-files.txt)
  • codelens upgrade --check correctly compares versions
  • codelens upgrade works for pip / homebrew / source install methods

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions