feat: add dcode doctor and dcode update subcommands#3
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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 two new subcommands to
dcode:dcode doctor [PATH]— diagnoses the local environment (editor, devcontainer extension, container runtime, git, WSL setup, target devcontainer, dcode version, install method) and prints a "what woulddcode <PATH>do" plan summary. Read-only — never patchessettings.jsonor spawns the editor. Exit code:0if no failing checks,1otherwise. Warnings do not fail.dcode update— shells out touv tool upgrade dcode. Detects when uv is missing or dcode wasn't installed viauv tooland prints actionable hints instead of forwarding the raw error.dcode update --check— checks GitHub Releases for a newer version without installing. Exit0if up-to-date or ahead (dev build),1if behind,2on network error.Output is rendered with
rich— colored status glyphs, per-section panels, and a clickable release URL on supporting terminals. Auto-disables color on non-TTY and whenNO_COLOR=1.Commits
The two refactors land first as pure code-moves so the feature commits read against a clean per-module structure. Each commit passes the full test suite individually.
Module layout (new)
New runtime dependency
rich >= 13.0(added topyproject.toml). Pure-Python, widely used. Auto-disables color on non-TTY /NO_COLOR.No other new deps. The GitHub API call uses stdlib
urllib.request.Tests
(status, message, hint)tuples → 95% of doctor tests assert on the data, not the rendering, so they're robust against future UI changes.unittest.mock.patchagainsturllib.request.urlopen,subprocess.run,shutil.which.NO_COLOR=1produces zero ANSI escape sequences indoctorandupdate --check.Verification on this machine
uv run pytest -q→156 passeduv run ruff check→All checks passed!python -m dcode doctor→ 7 ok / 2 warn / 0 fail (onlycode-insidersand the absent.devcontainer/warn — both expected on this repo). Plan-summary prints. Exit 0.python -m dcode doctor /tmp→ confirms[PATH]argument routes correctly.python -m dcode update --check→ correctly reports the local hatch-vcs dev version as ahead ofv0.4.2(the dev-build vs released-version case is covered explicitly in the version comparator and unit-tested).Release-please / version bump
Multiple
feat:commits → release-please should propose a minor bump from 0.4.2 → 0.5.0. Conventional Commit messages are intact for changelog generation.Notable design choices
dcode ./somepathas an invalid subcommand when subparsers are mixed with a top-level positional. Solved with a_looks_like_subcommandpeek oversys.argv[1:]against a_SUBCOMMANDS = ("update", "doctor")tuple. The escape hatchdcode ./doctor(open a folder literally nameddoctor) works as documented in the README.doctoris read-only — even on WSL, where the existingdcode <path>flow auto-patchessettings.json, doctor only reports what would change.code-insidersis installed, the plan replays asdcode -iinstead of the defaultdcodepath. If neither editor exists, the plan-summary section says "no editor available" and is omitted from the exit-code calculation.Acceptance against the original plan
All criteria from
project/plans/2026-04-29-doctor-update/plan.md§10 satisfied. Real-output excerpts captured inproject/plans/2026-04-29-doctor-update/implementation-notes.mdunder "Commit 3/4 validation" and "Rich UI validation" sections.