Token导航 LogoToken导航TokenDH.com
待分类执行命令github未标认证来源可访问许可证需确认审计通过

git-hunk吉特大块头

Agent Skill

git-hunk 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

2,595

周安装

106

GitHub Stars

227

下载量

831
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/diodeinc/pcb --skill git-hunk

简介

git-hunk skill 用于精确检查、暂存与提交代码变更,支持快照、change_id 与 change_key 多种定位方式。

  • 适用于需要精准控制代码提交粒度的开发场景,如修复热补丁或审查特定代码块修改。
  • 推荐使用 change_key 作为稳定选择器,避免依赖易变的行号范围,并通过 snapshot_id 保障操作安全。
  • 安装前请确保 git 环境可用,并注意该 skill 可能执行 shell 命令,建议在受控仓库中测试后再投入生产使用。
  • git-hunk 属于待分类类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Git Hunk

Use git-hunk to inspect, stage, unstage, and commit precise text changes without interactive prompts.

Prefer change_key over raw line ranges when you need selectors that survive unrelated rescans. Keep snapshot_id for safety, treat change_id as snapshot-local, and treat raw line ranges as a last resort.

Quick Start

  1. Scan the repo and capture a snapshot:
git-hunk scan --mode stage --json
  1. Inspect a selectable unit:
git-hunk show --mode stage <hunk-id>
git-hunk show --mode stage <change-id> --json
git-hunk show --mode stage <change-key> --json
  1. Apply a selection:
git-hunk stage --snapshot <snapshot-id> --hunk <hunk-id>
git-hunk stage --snapshot <snapshot-id> --change <change-id>
git-hunk stage --snapshot <snapshot-id> --change-key <change-key>
git-hunk stage --snapshot <snapshot-id> --hunk <hunk-id>:new:41-44
git-hunk stage --snapshot <snapshot-id> --change-key <change-key> --dry-run --json
  1. Commit the exact selection directly:
git-hunk commit -m "feat: message" --snapshot <snapshot-id> --change <change-id>
git-hunk commit -m "feat: message" --snapshot <snapshot-id> --change-key <change-key>
git-hunk commit -m "fix: message" --snapshot <snapshot-id> --hunk <hunk-id>:old:18-22
git-hunk commit -m "feat: message" --snapshot <snapshot-id> --change-key <change-key> --dry-run --json
  1. Resolve a file+line hint into durable selectors:
git-hunk resolve --mode stage --snapshot <snapshot-id> --path src/lib.rs --start 42 --json
  1. Recover stale selections without mutating anything:
git-hunk validate --mode stage --snapshot <snapshot-id> --change-key <change-key> --compact --json

Workflow

Stage mode

  • Use scan --mode stage for worktree changes relative to the index.
  • Select by whole hunk, change_id, change_key, or line range.
  • Prefer --json for agents; ids and snapshot_id come from scan output.
  • Use scan --compact --json when you want short previews and metadata without the full line arrays.
  • Use selector bundles from JSON output instead of reconstructing selectors by hand.

Unstage mode

  • Use scan --mode unstage for staged changes relative to HEAD.
  • Use the same selectors with unstage to remove only part of the index.
git-hunk unstage --snapshot <snapshot-id> --change <change-id>
git-hunk unstage --snapshot <snapshot-id> --change-key <change-key>
git-hunk unstage --snapshot <snapshot-id> --hunk <hunk-id>:old:10-12

Change keys

  • change_id is snapshot-bound and should be treated as ephemeral.
  • change_key_scheme is currently v1.
  • change_key is derived from the change content plus nearby context so it survives unrelated rescans, duplicate disambiguation, and hunk splitting caused by unrelated edits.
  • change_key is not guaranteed to survive nearby context edits, renames, or future scheme changes.
  • Prefer --change-key for multi-step agent workflows where a fresh scan may happen before mutation.
  • Use show, stage, unstage, and commit with a change_key exactly like a change_id.

Resolve helper

  • Use resolve when you know a file and approximate line range but do not want to reason about diff internals.
  • resolve returns recommended change_ids, change_keys, hunk selectors, selector bundles, and candidate metadata.
  • --side auto is the default; it prefers new lines in stage mode and old lines in unstage mode.
git-hunk resolve --mode stage --snapshot <snapshot-id> --path src/lib.rs --start 42 --end 47 --json
git-hunk resolve --mode unstage --snapshot <snapshot-id> --path src/lib.rs --start 42 --side old --json

Validation and dry-run previews

  • Use validate to compare an old snapshot_id against the current repo state and recover change_key selections before retrying a mutation.
  • Use stage --dry-run to preview what the index would look like after staging a selection.
  • Use unstage --dry-run to preview what would remain staged after removing a selection.
  • Use commit --dry-run to preview the exact files, diffstat, and patch that would be committed.
  • All dry-run commands use the real selection path against a temporary index, so they reflect actual behavior without mutating the repo.

Line-range selectors

  • Syntax: <hunk-id>:<old|new>:<start-end>.
  • Use new when selecting added or replacement lines from stage mode.
  • Use old when selecting the preimage side, especially in unstage mode.
  • Use show without --json when you want numbered lines in terminal output.
  • Agents should almost always prefer change_key, then change_id, then resolve, and only use raw line ranges when reproducing a user-specified range exactly.

Snapshot Discipline

  • Treat snapshot_id as mandatory for any mutating command.
  • Rescan after every successful stage, unstage, or commit.
  • If the command returns stale_snapshot, do not retry blindly; inspect error.details or run validate to recover with the fresh snapshot.
  • change_key can survive rescans, but the mutation still needs a fresh snapshot_id before it applies.

Plan Files

Use a plan file when passing many selectors or when another tool is driving the workflow.

{
  "snapshot_id": "s_123",
  "selectors": [
    { "type": "hunk", "id": "h_abc" },
    { "type": "change", "id": "c_def" },
    { "type": "change_key", "key": "ck_xyz" },
    {
      "type": "line_range",
      "hunk_id": "h_xyz",
      "side": "new",
      "start": 41,
      "end": 44
    }
  ]
}

Run it with:

git-hunk stage --plan plan.json --json
git-hunk stage --plan - --json < plan.json
git-hunk commit -m "refactor: split change" --plan plan.json --json

Failure Handling

  • If you get ambiguous_line_range, widen the range to cover the full atomic change or fall back to the change_id shown by scan.
  • Use error.category, error.retryable, and error.details from JSON errors to decide whether to rescan, retry, or fall back.
  • If a path appears under unsupported, do not try to force it through git-hunk; use normal git commands or a different workflow for conflicts, renames, copies, binary files, or non-UTF-8 diffs.
  • If there is nothing staged, commit fails unless --allow-empty is set.

Practical Defaults

  • Prefer change_key over line ranges whenever both are available.
  • Prefer resolve when you only have a file+line hint.
  • Prefer validate when an old snapshot goes stale but you still have change_keys.
  • Prefer stage --dry-run, unstage --dry-run, or commit --dry-run before a risky atomic mutation from a dirty tree.
  • Prefer commit with selectors when the user asked for a commit and you already know the exact changes.
  • Prefer stage first when you need to inspect the staged result before committing.
  • Keep commits atomic by scanning, selecting a minimal set, committing, then rescanning for the next commit.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

35.81%
按下载量换算298

Claude

31.63%
按下载量换算263

Cursor

17.95%
按下载量换算149

Gemini CLI

8.58%
按下载量换算71

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/diodeinc/pcb --skill git-hunk 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

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

来源信息

继续浏览同类 Skills