Files
wehub-resource-sync bb5c75ce05
Component Security Validation / Security Audit (push) Has been cancelled
Deploy to Cloudflare Pages / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:38:58 +08:00

1 line
7.8 KiB
JSON

{"content": "---\nallowed-tools: Bash(git bisect:*), Bash(git log:*), Bash(git show:*), Bash(git checkout:*), Bash(npm:*), Bash(yarn:*), Bash(pnpm:*), Read, Edit, Grep\nargument-hint: [good-commit] [bad-commit] | --auto [test-command] | --reset | --continue\ndescription: Use PROACTIVELY to guide automated git bisect sessions for finding regression commits with smart test execution\n---\n\n# Git Bisect Helper & Automation\n\nAutomated git bisect session to find regression commits: $ARGUMENTS\n\n## Current Repository State\n\n- Current branch: !`git branch --show-current`\n- Recent commits: !`git log --oneline -10`\n- Git status: !`git status --porcelain`\n- Bisect status: !`git bisect log 2>/dev/null || echo \"No active bisect session\"`\n- Available tags: !`git tag --sort=-version:refname | head -10`\n\n## Task\n\nSet up and manage an intelligent git bisect session to identify the exact commit that introduced a regression or bug.\n\n## Bisect Session Management\n\n### 1. Session Initialization\n- Analyze commit history to suggest good/bad commit candidates\n- Set up bisect session with appropriate range\n- Validate that the range actually contains the regression\n- Create backup branch before starting bisect\n\n### 2. Automatic Test Execution\n- Run specified test command at each bisect point\n- Interpret test results (exit codes, output patterns)\n- Automatically mark commits as good/bad based on test outcomes\n- Handle test environment setup/teardown\n\n### 3. Manual Verification Support\n- Provide clear instructions for manual testing at each step\n- Show relevant changes in current commit\n- Guide user through good/bad decision process\n- Maintain bisect log with detailed reasoning\n\n### 4. Smart Commit Analysis\n- Analyze commit messages for relevant keywords\n- Show file changes that might be related to the issue\n- Highlight suspicious patterns or large changes\n- Skip obviously unrelated commits when possible\n\n## Bisect Modes\n\n### Automatic Bisect (`--auto [test-command]`)\n```bash\n# Automatically bisect using test command\n/git-bisect-helper --auto \"npm test\"\n/git-bisect-helper --auto \"python -m pytest tests/test_regression.py\"\n/git-bisect-helper --auto \"./scripts/check-performance.sh\"\n```\n\n**Process:**\n1. Run test command at each bisect point\n2. Mark commit as good (exit code 0) or bad (non-zero)\n3. Continue until regression commit is found\n4. Provide detailed report of findings\n\n### Manual Guided Bisect\n```bash\n# Interactive bisect with guidance\n/git-bisect-helper v1.2.0 HEAD\n/git-bisect-helper abc123 def456\n```\n\n**Process:**\n1. Show current commit details and changes\n2. Provide testing suggestions\n3. Wait for user input (good/bad)\n4. Continue to next bisect point\n5. Offer insights about current commit\n\n### Continue Existing Session (`--continue`)\n```bash\n# Resume interrupted bisect session\n/git-bisect-helper --continue\n```\n\n**Process:**\n1. Analyze current bisect state\n2. Show progress and remaining steps\n3. Continue with appropriate mode\n4. Provide context from previous steps\n\n### Reset Session (`--reset`)\n```bash\n# Clean up and reset bisect session\n/git-bisect-helper --reset\n```\n\n**Process:**\n1. End current bisect session\n2. Return to original branch\n3. Clean up temporary files\n4. Provide session summary\n\n## Intelligent Test Execution\n\n### Test Environment Detection\n- **Node.js**: Detect package.json and run appropriate package manager\n- **Python**: Identify requirements.txt, setup.py, pyproject.toml\n- **Ruby**: Look for Gemfile and use bundler\n- **Java**: Detect Maven (pom.xml) or Gradle (build.gradle)\n- **Go**: Identify go.mod and use go test\n- **Rust**: Detect Cargo.toml and use cargo test\n\n### Build System Integration\n- Run build process before testing if needed\n- Handle dependency installation for older commits\n- Manage environment variable requirements\n- Skip build for commits that don't compile (mark as bad)\n\n### Test Result Interpretation\n- Parse test output for meaningful error patterns\n- Distinguish between test failures and environment issues\n- Handle flaky tests with retry logic\n- Provide confidence levels for automated decisions\n\n## Commit Analysis Features\n\n### Change Impact Assessment\n```bash\n# Analyze current bisect commit\nFiles changed: !`git show --name-only --pretty=\"\" HEAD`\nCommit message: !`git log -1 --pretty=format:\"%s\"`\nAuthor and date: !`git log -1 --pretty=format:\"%an (%ar)\"`\n```\n\n### Regression Pattern Detection\n- Identify commits touching critical areas\n- Flag commits with suspicious change patterns\n- Highlight performance-related modifications\n- Detect dependency or configuration changes\n\n### Context Preservation\n- Maintain detailed log of bisect decisions\n- Record reasoning for each good/bad marking\n- Save test outputs for later analysis\n- Document environmental factors\n\n## Advanced Bisect Strategies\n\n### Skip Strategy for Build Issues\n- Automatically skip commits that don't compile\n- Handle dependency version conflicts\n- Skip commits with known build system issues\n- Focus bisect on functional commits only\n\n### Performance Regression Detection\n- Use performance benchmarks instead of pass/fail tests\n- Set acceptable performance thresholds\n- Track performance trends across commits\n- Identify performance cliff points\n\n### Multi-criteria Bisecting\n- Test multiple aspects simultaneously\n- Handle cases where good/bad isn't binary\n- Support complex regression scenarios\n- Provide weighted decision making\n\n## Bisect Session Reporting\n\n### Progress Tracking\n```\nBisect Progress:\n🎯 Target: Find regression in user authentication\n📊 Commits remaining: ~4 (out of 127)\n⏱️ Estimated time: 8 minutes\n🔍 Current commit: abc123 - \"refactor auth middleware\"\n```\n\n### Final Report\n```\n🎉 Regression Found!\n\nBad Commit: def456\nAuthor: John Doe\nDate: 2024-01-15 14:30:00\nMessage: \"optimize database queries\"\n\nFiles Changed:\n- src/auth/database.js\n- src/middleware/auth.js\n- tests/auth.test.js\n\nBisect Log: 15 steps, 3 manual verifications\nTotal Time: 12 minutes\n\nRecovery Commands:\ngit revert def456 # Revert the problematic commit\ngit cherry-pick def456^..def456~1 # Cherry-pick the good parts\n```\n\n## Integration with Development Workflow\n\n### CI/CD Integration\n- Use same test commands as CI pipeline\n- Respect CI environment variables\n- Handle containerized test environments\n- Integrate with existing quality gates\n\n### Team Collaboration\n- Share bisect sessions with team members\n- Document findings in issue tracking\n- Create reproducible bisect scripts\n- Establish team bisect best practices\n\n### Debugging Enhancement\n- Generate debug reports for problematic commits\n- Create minimal reproduction cases\n- Suggest fix approaches based on regression type\n- Link to relevant documentation or similar issues\n\n## Safety and Recovery\n\n### Session Backup\n- Create backup branch before starting\n- Save original HEAD position\n- Maintain recovery information\n- Handle interrupted sessions gracefully\n\n### Error Handling\n- Recover from corrupted bisect state\n- Handle repository state conflicts\n- Manage disk space issues during long bisects\n- Provide clear error messages and solutions\n\n## Example Workflows\n\n### Performance Regression\n```bash\n# Find when tests became slower\n/git-bisect-helper --auto \"timeout 30s npm test\"\n```\n\n### Feature Regression \n```bash\n# Find when feature X broke\n/git-bisect-helper --auto \"./test-feature-x.sh\"\n```\n\n### Build Regression\n```bash\n# Find when build started failing\n/git-bisect-helper --auto \"npm run build\"\n```\n\n### Manual Investigation\n```bash\n# Interactive bisect for complex issues\n/git-bisect-helper v2.1.0 HEAD\n```\n\nThe bisect helper provides intelligent automation while maintaining full control over the debugging process, making regression hunting efficient and systematic."}