feat(scripts): macOS/Linux port — doctor.sh + maintain.sh#33
Open
abdout wants to merge 1 commit into
Open
Conversation
Cross-platform parity for the two most-used commands. Same check categories, same exit codes, same notification matrix as the PowerShell versions. doctor.sh: - Same 7 check categories as doctor.ps1 (Core, Shell, Identity, Repos, Updates, Scheduled, IDE) — single-file ~340 lines bash - Detects $SHELL_RC by shell ($HOME/.zshrc or $HOME/.bashrc) - Reads $HOME/.claude/memory/repositories.json same shape as PS - Update check via api.github.com/repos/anthropics/claude-code - Scheduled task check via launchctl list (instead of schtasks) - WebStorm plugin glob at ~/Library/Application Support/JetBrains/ - Exit codes: 0/1/2/3 same as doctor.ps1 - --fix appends canonical c/cc/env-loader block to shell rc maintain.sh: - Same 5-step flow (sync → self-update → doctor → notify → log) - --install writes launchd plist at ~/Library/LaunchAgents/com.databayt.kun-maintain.plist - Idempotent install (unload-then-load on re-run) - macOS toast via osascript display-notification - Slack via curl POST (SLACK_WEBHOOK_URL from ~/.claude/.env) - Weekly GitHub snapshot Mondays via doctor --report - Log rotation: find -mtime +30 -delete - Self-update diff-gated identical to PS version health.sh demoted to a 1-line back-compat shim → doctor.sh. install.sh updated: - Now copies lib/ recursively (matches install.ps1 fix) - Shell rc append finally writes the actual c/cc aliases + env loader + PATH prepend, not just an export PATH (same bug as install.ps1 had — fixed in #32 for Windows, fixed here for *nix) All four scripts pass bash -n. doctor.sh and maintain.sh smoke-tested under Git Bash on Windows — exit codes correct, all check categories render, real claude CLI update detected (2.1.140 → 2.1.143). True macOS validation still needs a Mac — plist load behavior, osascript notifications, and Spotlight indexing of cloned repos are environment-specific. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
5 tasks
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
macOS/Linux port of the two most-used commands. Same architecture as the PowerShell versions, translated to bash idioms. Closes the "macOS/Linux equivalents follow-up" item from spec #28.
What's in the PR
~/.claude/scripts/doctor.sh(340 lines) — single-file bash equivalent ofdoctor.ps1~/.claude/scripts/maintain.sh(180 lines) — launchd-based daily heartbeat~/.claude/scripts/health.sh— demoted to a 1-line back-compat shim →doctor.sh~/.claude/scripts/install.sh— fixed$PROFILEbug + recursivelib/copyCross-platform parity
doctor.ps1)doctor.sh)-Report-Fix-Update-Json-Quiet-Deep--report--fix--update--json--quiet--deep$PROFILE.CurrentUserAllHosts~/.zshrcor~/.bashrc(auto-detect)schtasks/Get-ScheduledTasklaunchctl+~/Library/LaunchAgents/com.databayt.kun-maintain.plistBurntToastPowerShell moduleosascript -e 'display notification'%APPDATA%\JetBrains\WebStorm*~/Library/Application Support/JetBrains/WebStorm*Invoke-RestMethod+Compare-Semvercurl+ bash semver functionrepositories.json$ExecutionContext.InvokeCommand.ExpandStringinstall.sh fixes (matching the install.ps1 fix from #32)
Before (the existing bug):
The shell rc got
export PATH=$HOME/.local/bin:$PATH(wrong path —.local/binnot.claude/bin) and noc/ccaliases.After:
install.shanddoctor.sh --fixnow produce identical shell rc output.Verified locally
Both scripts smoke-tested under Git Bash on Windows (which uses the same bash interpreter):
bash -nsyntax-check: all 4 files cleandoctor.sh --quiet: all 7 check categories render correctly, exit code matches state (1 errors on this machine)doctor.shcorrectly detectedclaudeCLI 2.1.140 → 2.1.143 update via the GitHub releases APImaintain.sh --statuscorrectly reports "not loaded"maintain.sh --run --dry-runwalks the 5-step flow and writes the loghealth.sh --quietcorrectly forwards todoctor.shTest plan (needs a Mac)
bash ~/.claude/scripts/doctor.shruns cleanly on macOS 14+bash maintain.sh --installwrites plist andlaunchctl list | grep com.databayt.kun-maintainshows it--installdoesn't duplicatemaintain.sh --uninstallremoves plist and unloads — idempotentdoctor --quiet, notifies via osascript when non-greenSLACK_WEBHOOK_URLin~/.claude/.envdoctor --fixcorrectly identifies and writes to~/.zshrc(most Macs default to zsh)Linux compatibility
The scripts auto-detect
~/.bashrcwhen~/.zshrcis absent, and usefind -mtimeand other POSIX-compatible flags. WebStorm/launchd checks degrade gracefully on Linux (just show "paused" / "not installed"). No hard macOS-only dependencies.Dependencies
Stacks on
feat/polish(PR #32). Merge order:🤖 Generated with Claude Code