feat(scripts): doctor.ps1 — health, updates, and self-repair in one command#29
Open
abdout wants to merge 1 commit into
Open
feat(scripts): doctor.ps1 — health, updates, and self-repair in one command#29abdout wants to merge 1 commit into
abdout wants to merge 1 commit into
Conversation
Implements spec #26. One command, three answers: is the config healthy, is it up to date, what's fixable? - New ~/.claude/scripts/doctor.ps1 — main entry point with -Fix, -Update, -Report, -Json, -Quiet, -Deep flags and 4-level exit codes (0/1/2/3) - 7 check modules in .claude/scripts/lib/: Common, Check-Core, Check-Shell, Check-Identity, Check-Repos, Check-Updates, Check-Scheduled, Check-IDE - 1 fix module in lib/: Fix-Shell (idempotent $PROFILE repair) - health.ps1 demoted to 5-line back-compat shim → doctor.ps1 - install.ps1 updated to copy lib/ recursively + mention doctor in post-install steps Exit codes (precedence errors > warnings > updates): 0 all green 1 errors 2 warnings only 3 updates available Verified end-to-end on this machine — surfaces missing config, dirty repos, scheduled-task absence, and a real claude CLI update. Closes #26 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced May 16, 2026
abdout
added a commit
that referenced
this pull request
May 16, 2026
Resolves the spec #26 acceptance criterion 'repositories.json becomes the source of truth (both doctor.ps1 and sync-repos.ps1 read it)'. - repositories.json gains a top-level 'repos' map keyed by repo name, values as $env:USERPROFILE-expanded paths. Sits alongside the richer 'repositories' object (untouched, for other tooling). - sync-repos.ps1 reads repositories.json's 'repos' map at runtime, expands env vars via ExpandString. Falls back to the previously- hardcoded hashtable when the JSON isn't yet at the install location (cold-bootstrap edge case). - Path expansion verified end-to-end on this machine — '$env:USERPROFILE\codebase' resolves to 'C:\Users\osman\codebase'. doctor.ps1's Check-Repos.ps1 already reads the same shape (shipped in PR #29). Both scripts now share a single source of truth, so adding a new active repo means editing one JSON file. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
abdout
added a commit
that referenced
this pull request
May 16, 2026
Reflects the reality on the ground after PRs #29/#30/#31 land the v2 scripts: onboarding.mdx: - Promotes 'irm https://kun.databayt.org/install | iex' to the recommended path (one paste, one UAC, three OAuth sign-ins) - Demotes Cowork-driven flow to "Alternative" — still works for Pro/Max users who want narration over a bare paste - Manual fallback updated to use databayt/kun raw URL (the codebase one is now tombstoned in databayt/codebase#2) - Adds 'doctor' to Daily entry points and 'maintain -Install' to the manual fallback chain - "What you end up with" mentions the scheduled task onboarding-reference.mdx: - Scripts contract table flipped: bootstrap, doctor, maintain are now Shipping (no longer 'Planned v2'); health.ps1 marked Deprecated; finish.ps1 reduced to 'Planned (alias for bootstrap)' - Source-of-truth URL changed from databayt/codebase to databayt/kun - Migration order section refreshed — 4 of 6 items checked off, fresh-VM test + team comms remaining Co-Authored-By: Claude Opus 4.7 (1M context) <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
Implements spec #26. One command, three answers: is my config healthy, is it up to date, what's fixable?
Output (verified on a real machine):
What's in the PR
~/.claude/scripts/doctor.ps1— main entry point (188 lines)lib/:Common.ps1— sharedNew-CheckResultaccumulator, role detection, file freshnessCheck-Core.ps1— CLAUDE.md, settings.json, mcp.json, .env, agent/command countsCheck-Shell.ps1—cfunction in$PROFILE,~/.claude/binon PATHCheck-Identity.ps1—gh auth status, claude CLI signed-in heuristicCheck-Repos.ps1— org repos cloned, branch, dirtiness (readsrepositories.jsonif present)Check-Updates.ps1— claude CLI vs latest GitHub release, kun + codebase ahead/behindCheck-Scheduled.ps1—kun-maintaintask armed (next-run + last-run + exit code)Check-IDE.ps1— WebStorm version + Claude Code [Beta] plugin loadedFix-Shell.ps1— idempotent$PROFILEblock append, double-applies safelyhealth.ps1demoted to a 5-line back-compat shim →doctor.ps1. Existing callers ofhealth.ps1 -Reportkeep working unchanged.install.ps1updated to copylib/recursively and referencedoctorin post-install stepsFlags
-Reportdatabayt/kun#config-health-Fix$PROFILEcfunction append)-Update~/.claude+~/codebase; prints (doesn't run)winget upgradefor claude CLI-Json-Quiet-DeepExit codes
0123Precedence: errors > warnings > updates.
Test plan
doctorruns on a configured machine and exits0doctoron this machine (no~/.claude/) exits1and surfaces every missing piecedoctor -Fixon a machine with nocfunction appends the block to$PROFILE; second run is no-opdoctor -Json | ConvertFrom-Jsonparses correctlyhealth.ps1 -Reportstill posts todatabayt/kun#config-health(back-compat shim works)install.ps1copieslib/to~/.claude/scripts/lib/on a fresh installParser::ParseFile) — verified locallyOpen items not blocking this PR
These are noted in spec #26 and don't block merge:
repositories.jsonis read if present; today'sinstall.ps1already creates it. Migratingsync-repos.ps1to use the same JSON instead of the hardcoded hashtable is a follow-up.databayt/codebase/.claude/scripts/install.ps1tombstone is a separate cross-repo PR.Sample run
This is real output captured against a machine that hasn't run
install.ps1yet — every error/warning is accurate:Closes #26
🤖 Generated with Claude Code