Skip to content

Commit c484481

Browse files
rysweetclaude
andauthored
enhance(workflow): Add pre-commit hook installation check to Step 12 (#1888)
* enhance(workflow): Add pre-commit hook installation check to Step 12 (#1887) Adds automatic pre-commit hook detection and installation to Step 12 of DEFAULT_WORKFLOW.md to handle fresh git worktrees where hooks aren't yet installed. Changes: - Detects if .pre-commit-config.yaml exists (project uses pre-commit) - Checks if hooks are installed using git rev-parse (worktree-compatible) - Conditionally runs 'pre-commit install' when needed - Provides clear diagnostic output for troubleshooting This ensures developers can execute Step 12 successfully in fresh worktrees without manual pre-commit setup. Fixes #1887 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com> * refactor(workflow): Implement PR review feedback for Step 12 enhancement Addresses review feedback from PR #1888: 1. Reordered checklist: Pre-commit Hook Check now FIRST in Step 12 (better logical flow) 2. Added "(worktree-compatible)" note to hooks detection command for clarity 3. Added security warning about reviewing .pre-commit-config.yaml changes These changes improve workflow clarity and security awareness without changing functionality. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
1 parent 6dbc055 commit c484481

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

.claude/workflow/DEFAULT_WORKFLOW.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,12 @@ After investigation completes, continue with these tasks:
272272

273273
### Step 12: Run Tests and Pre-commit Hooks
274274

275+
- [ ] **Pre-commit Hook Check** (run once at start of Step 12): Ensure hooks are installed before running
276+
- Config exists? `test -f .pre-commit-config.yaml && echo "Config found" || echo "No config"`
277+
- Hooks installed? `test -f "$(git rev-parse --git-path hooks/pre-commit)" && echo "Hooks installed" || echo "Hooks missing"` (worktree-compatible)
278+
- If config exists but hooks don't: `pre-commit install`
279+
- This ensures fresh worktrees work without manual setup
280+
- ⚠️ **Security Note**: Always review `.pre-commit-config.yaml` changes before running hooks, especially when pulling updates or merging branches
275281
- [ ] **Use** pre-commit-diagnostic agent if hooks fail
276282
- [ ] **💡 TIP**: For test failures, use [parallel investigation](.claude/CLAUDE.md#parallel-agent-investigation-strategy) to explore issues while continuing work
277283
- [ ] Run all unit tests

0 commit comments

Comments
 (0)