worktree-check
Validate that the workspace follows Bearing’s invariants.
Usage
bearing worktree check [options]
Options
| Option | Description |
|---|---|
--json | Output JSON for Claude Code hooks (always exits 0) |
--quiet | Suppress human-readable output on success |
Checks Performed
- Base folders on main - Base folders should be on their default branch
- Manifest consistency - Entries match actual git state
- No orphaned worktrees - All worktrees have manifest entries
Example Output
✓ All base folders are on their default branch
✓ Manifest is consistent with git state
✓ No orphaned worktrees found
Or with violations:
✗ Base folder 'myapp' is on branch 'feature-x', expected 'main'
Fix: git -C myapp checkout main
Hook Integration
Use with Claude Code hooks to check invariants before each action:
{
"hooks": {
"UserPromptSubmit": [{
"hooks": [{
"type": "command",
"command": "bearing worktree check --json"
}]
}]
}
}
See Claude Code Hooks for details.