Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问许可证需确认审计提醒

git-bisectgit 二等分

Agent Skill

git-bisect 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

494

周安装

21

GitHub Stars

450

下载量

173
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:git-bisect(git 二等分)
来源仓库:https://github.com/ag-grid/ag-charts
仓库路径:skills/git-bisect
安装命令:
npx skills add https://github.com/ag-grid/ag-charts --skill git-bisect
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/ag-grid/ag-charts --skill git-bisect

简介

git-bisect 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中快速定位候选结果。

  • 适用于 Git 二分查找相关信息的检索与筛选任务。
  • 通过 npx skills add 命令从 GitHub 仓库安装,需确认权限与维护状态。
  • 使用前建议核实是否会触发联网、命令执行或文件读写操作。
  • 可结合原始 README 进一步验证具体用法和功能边界。

SKILL.md

Git Bisect - Find the Commit That Introduced Test Failures

You are an expert software engineer helping to identify the commit that introduced test failures or flakiness using git bisect.

Your goal is to systematically bisect the git history to find the exact commit that introduced the issue.

Help

If the user provides a command option of help:

  • Explain how to use this prompt.
  • Explain if they are missing any prerequisites or tooling requirements.
  • DO NOT proceed, exit the prompt immediately after these steps.

1. IMPORTANT TOOLING REQUIREMENTS - STOP IF THESE ARE NOT MET

  • Git CLI must be available.
  • The repository must be in a clean state or have only intended changes.
  • Test commands must be executable (e.g., nx test, yarn test).
  • Use NX_DAEMON=false to avoid async Nx daemon project graph re-calculation from affecting execution stability.
  • Worktree support: The script handles git worktrees automatically, but ensure node_modules are accessible (either in the worktree or the main repository).

2. Workflow

Phase 0: Parse Arguments

The user provides ${ARGUMENTS} which should contain:

  • Bad commit/branch: The commit or branch where the issue is present (default: HEAD or latest)
  • Good commit/branch: The commit or branch where the issue is NOT present (e.g., origin/bX.Y.Z)
  • Test command: The command to run to verify if the issue is present (default: ${ARGUMENTS} if it looks like a test command)

Parse ${ARGUMENTS} to extract:

  • BAD_REF: Commit/branch where tests fail
  • GOOD_REF: Commit/branch where tests pass
  • TEST_COMMAND: Command to execute for each bisect step

Example argument formats:

  • bad=HEAD good=origin/b12.3.0 test="yarn nx test package-name --testPathPattern='test.test.ts'"
  • HEAD origin/b12.3.0 "yarn nx test package-name --testPathPattern='test.test.ts'"
  • "yarn nx test package-name --testPathPattern='test.test.ts'" (uses HEAD as bad, prompts for good)

Phase 1: Verify the Issue

  1. Check current state: git status git log -1 --oneline REPO_ROOT=$(git rev-parse --show-toplevel)
  2. Validate test files exist (if test command references specific files): # Extract test file patterns from TEST_COMMAND if possible # This helps catch issues early (e.g., testing wrong package)
  3. Verify the issue exists on the bad commit: git checkout ${BAD_REF} export NX_DAEMON=false # Handle node_modules for worktrees REPO_ROOT=$(git rev-parse --show-toplevel) if [! -d "${REPO_ROOT}/node_modules/.bin"]; then MAIN_WORKTREE=$(git rev-parse --git-dir | sed 's|/\\.git/worktrees/.*|/.git|' 2>/dev/null) if [-n "$MAIN_WORKTREE"] && [-d "$MAIN_WORKTREE/../node_modules/.bin"]; then export PATH="$(dirname "$MAIN_WORKTREE")/node_modules/.bin:$PATH" fi fi ${TEST_COMMAND}

- If tests pass, inform the user that the issue is not present and ask for confirmation. - If tests fail, proceed to Phase 2. - If test files are not found, verify the package name and file path are correct.

Phase 2: Start Git Bisect

  1. Initialize bisect: git bisect start git bisect bad ${BAD_REF} git bisect good ${GOOD_REF}
  2. Verify bisect range: git bisect visualize --oneline | head -20 This shows the commits that will be tested.

Phase 3: Automated Bisect (Recommended)

  1. Determine repository root (handles worktrees): # Get the git root directory (works for both regular repos and worktrees) REPO_ROOT=$(git rev-parse --show-toplevel) echo "Repository root: $REPO_ROOT" # Check if we're in a worktree and find main worktree if needed GIT_DIR=$(git rev-parse --git-dir) MAIN_WORKTREE="" if echo "$GIT_DIR" | grep -q worktrees; then echo "Detected git worktree" # Extract main worktree path MAIN_GIT_DIR=$(echo "$GIT_DIR" | sed 's|/\\.git/worktrees/.*|/.git|') if [-d "$MAIN_GIT_DIR"]; then MAIN_WORKTREE=$(cd "$MAIN_GIT_DIR/.." && pwd) fi fi
  2. Create a test script: # Use a workspace-relative temp directory BISECT_SCRIPT="${REPO_ROOT}/tmp/bisect_test.sh" mkdir -p "$(dirname "$BISECT_SCRIPT")" cat > "$BISECT_SCRIPT" << EOF #!/bin/bash set -e cd "${REPO_ROOT}" # Export NX_DAEMON=false to avoid async daemon issues export NX_DAEMON=false # Handle node_modules location (for worktrees that share node_modules) if [! -d "node_modules/.bin"] && [-n "${MAIN_WORKTREE}"] && [-d "${MAIN_WORKTREE}/node_modules/.bin"]; then export PATH="${MAIN_WORKTREE}/node_modules/.bin:$PATH" fi # Run the test command ${TEST_COMMAND} EOF chmod +x "$BISECT_SCRIPT"
  3. Run automated bisect: git bisect run "$BISECT_SCRIPT"
  4. Handle special cases:

- Build errors (not test failures): If a commit has build errors that prevent tests from running, skip it: git bisect skip - Test files don't exist: If a test file doesn't exist in older commits, modify the test script to handle this gracefully - Unexpected test failures: If tests fail in an unexpected way, skip it: git bisect skip

Phase 4: Manual Bisect (If Automated Fails)

If automated bisect encounters issues, proceed manually:

  1. Check current commit: git log -1 --oneline
  2. Run tests: export NX_DAEMON=false ${TEST_COMMAND}
  3. Mark result:

- If tests pass (issue not present): git bisect good - If tests fail (issue present): git bisect bad - If build errors or unexpected failures: git bisect skip

  1. Repeat until git bisect identifies the culprit commit.

Phase 5: Identify the Culprit

  1. Get the culprit commit: git bisect log git log -1 --oneline
  2. Examine the commit: git show --stat ${CULPRIT_COMMIT} git show ${CULPRIT_COMMIT}
  3. Reset bisect: git bisect reset

Phase 6: Report Results

Provide a summary:

## Git Bisect Results

**Issue:** ${TEST_COMMAND} failures
**Bad commit:** ${BAD_REF} (${BAD_COMMIT_HASH})
**Good commit:** ${GOOD_REF} (${GOOD_COMMIT_HASH})
**Culprit commit:** ${CULPRIT_COMMIT_HASH}

**Culprit commit details:**

-   Author: ${AUTHOR}
-   Date: ${DATE}
-   Message: ${COMMIT_MESSAGE}
-   Files changed: ${FILES_CHANGED}

**Next steps:**

1. Review the changes in ${CULPRIT_COMMIT_HASH}
2. Identify the specific change that introduced the issue
3. Fix the issue or revert the problematic change

4. Important Guidelines

Test Command Requirements

  • Exit codes: The test command must exit with code 0 on success and non-zero on failure.
  • Timeout: Long-running tests may need timeouts. Consider wrapping: timeout 60 ${TEST_COMMAND}
  • Multiple tests: If testing multiple test files, combine with &&: yarn nx test package1 --testPathPattern="test1.test.ts" && \ yarn nx test package2 --testPathPattern="test2.test.ts"

Handling Flaky Tests

  • If tests are flaky (sometimes pass, sometimes fail), consider:

- Running tests multiple times: for i in {1..3}; do ${TEST_COMMAND} && break; done - Using a more lenient script that allows some failures - Documenting the flakiness in the report

Skipping Commits

Always skip commits that:

  • Have build/compilation errors preventing tests from running
  • Have merge conflicts
  • Fail tests in unexpected ways (different error than the target issue)
  • Are known to be broken for unrelated reasons

Performance Considerations

  • Use NX_DAEMON=false to avoid async daemon issues
  • Consider using --testPathPattern to limit test scope
  • For very large bisect ranges, consider narrowing the range first
  • Worktree performance: If using a worktree, builds may be slower if node_modules are shared

5. Common Patterns

Testing Multiple Test Files

# Test files in different packages
TEST_COMMAND="yarn nx test package1 --testPathPattern='test1.test.ts' && \
              yarn nx test package2 --testPathPattern='test2.test.ts'"

Important: When testing files in different packages, ensure:

  • Each package name matches the actual package structure
  • Test files exist in the specified packages
  • Use --passWithNoTests flag if a test file might not exist in older commits

Testing with Specific Test Names

TEST_COMMAND="yarn nx test package-name --testPathPattern='test.test.ts' --testNamePattern='specific test name'"

6. Error Recovery

If bisect gets stuck or produces unexpected results:

  1. Check bisect state: git bisect log git bisect visualize
  2. Reset and restart if needed: git bisect reset # Start over from Phase 2
  3. Narrow the range manually: # Test a commit in the middle manually git checkout ${MIDDLE_COMMIT} ${TEST_COMMAND} # Then restart bisect with narrower range

7. Command Arguments

Format: ${ARGUMENTS} can be:

  • bad=<ref> good=<ref> test="<command>" - Full specification
  • <bad-ref> <good-ref> "<test-command>" - Positional arguments
  • "<test-command>" - Test command only (prompts for bad/good refs)

Examples:

  • /git/bisect bad=HEAD good=origin/b12.3.0 test="yarn nx test package-name --testPathPattern='test.test.ts'"
  • /git/bisect HEAD origin/b12.3.0 "yarn nx test package-name --testPathPattern='test.test.ts'"
  • /git/bisect "yarn nx test package-name --testPathPattern='test.test.ts'"

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.42%
按下载量换算65

Claude

27.54%
按下载量换算48

Cursor

16.96%
按下载量换算29

Gemini CLI

9.94%
按下载量换算17

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills