doctor
v0.1.0+Diagnose issues with your stack and repository. Checks for common problems and provides actionable suggestions.
rung doctorrung doctor --jsonAliases
Section titled “Aliases”rung doc— shorthand forrung doctor
What It Checks
Section titled “What It Checks”Stack Integrity
Section titled “Stack Integrity”- Branches exist — All branches in the stack still exist in git
- Parents are valid — Each branch’s parent exists and is correct
- No circular dependencies — The stack doesn’t have any cycles
Git State
Section titled “Git State”- Clean working directory — No uncommitted changes
- Not detached HEAD — You’re on a branch, not a commit
- No rebase in progress — No interrupted operations
Sync State
Section titled “Sync State”- Branches need rebasing — Which branches are out of sync
- Sync operations in progress — Interrupted syncs that need attention
Forge Connectivity
Section titled “Forge Connectivity”Works with both GitHub and GitLab — the check targets whichever forge your origin remote points at, and the progress line names it (e.g. Checking GitLab...).
- Authentication — forge auth is configured and working (GitHub
gh/GITHUB_TOKEN, or GitLabglab/GITLAB_TOKEN) - PR/MR status — pull requests (GitHub) or merge requests (GitLab) are open/closed/merged correctly
Example Output
Section titled “Example Output”All Good
Section titled “All Good”$ rung doctor
Checking rung initialization... ✓ Checking git state... ✓ Checking stack integrity... ✓ Checking sync state... ✓ Checking GitHub... ✓
✓ No issues found!(On a GitLab repository, the last check line reads Checking GitLab... ✓.)
Issues Found
Section titled “Issues Found”$ rung doctor
Checking rung initialization... ✓ Checking git state... ⚠ Checking stack integrity... ✓ Checking sync state... ✗ Checking GitLab... ✓
⚠ Uncommitted changes detected → Commit or stash changes before syncing ✗ feat-add-user-api is 3 commits behind parent → Run `rung sync` to update
✗ Found 2 issue(s) (1 error(s), 1 warning(s))Issue Severities
Section titled “Issue Severities”| Severity | Meaning |
|---|---|
| ✓ | No issues |
| ⚠ | Warning — may cause problems |
| ✗ | Error — needs attention |
JSON Output
Section titled “JSON Output”$ rung doctor --jsonThe --json output is a flat report: overall health, error/warning counts, and a single list of issues aggregated across all checks (git state, stack integrity, sync state, and forge connectivity). It is forge-neutral — issue messages name the forge where relevant.
{ "healthy": false, "errors": 1, "warnings": 1, "issues": [ { "severity": "warning", "message": "Uncommitted changes detected", "suggestion": "Commit or stash changes before syncing" }, { "severity": "error", "message": "feat-add-user-api is 3 commits behind parent", "suggestion": "Run `rung sync` to update" } ]}Each issue has a severity (error or warning) and message; suggestion is present only when there’s a recommended fix.
Common Issues and Solutions
Section titled “Common Issues and Solutions”Uncommitted Changes
Section titled “Uncommitted Changes”⚠ Git state: uncommitted changes in 2 filesSolution: Commit or stash your changes:
git add . && git commit -m "WIP"# orgit stashBranches Need Rebasing
Section titled “Branches Need Rebasing”✗ Sync state: 2 branches need rebasingSolution: Run sync:
rung syncMissing Branch
Section titled “Missing Branch”✗ Stack integrity: branch 'feat-old' not foundSolution: Remove the orphaned branch from the stack, or recreate it:
# Remove from stack (edit .git/rung/stack.json)# Or recreate the branchgit checkout -b feat-old origin/feat-oldForge Authentication Failed
Section titled “Forge Authentication Failed” ✗ GitHub authentication failedThe message names the detected forge — on a GitLab remote it reads GitLab authentication failed.
Solution: Re-authenticate with the matching forge:
# GitHubgh auth login# or: export GITHUB_TOKEN=ghp_...
# GitLabglab auth login# or: export GITLAB_TOKEN=glpat_...Sync In Progress
Section titled “Sync In Progress”⚠ Sync state: sync operation in progressSolution: Continue or abort the sync:
rung sync --continue# orrung sync --abortWhen to Run Doctor
Section titled “When to Run Doctor”- Before starting a new day’s work
- When commands fail unexpectedly
- After resolving merge conflicts
- When the stack seems out of sync
