Agent Skillsdartsim/dart › dart-branch-cleanup

dart-branch-cleanup

GitHub

用于分析或清理 DART 仓库中陈旧的 Git 分支。支持只读分析和需审批的操作模式,通过检查合并状态和工作区状态安全识别并建议删除过时分支。

.codex/skills/dart-branch-cleanup/SKILL.md dartsim/dart

触发场景

需要清理仓库中的陈旧分支时 检查哪些远程分支已合并或不再需要时

安装

npx skills add dartsim/dart --skill dart-branch-cleanup -g -y
更多选项

非标准路径

npx skills add https://github.com/dartsim/dart/tree/main/.codex/skills/dart-branch-cleanup -g -y

不安装直接使用

npx skills use dartsim/dart@dart-branch-cleanup

指定 Agent (Claude Code)

npx skills add dartsim/dart --skill dart-branch-cleanup -a claude-code -g -y

安装 repo 全部 skill

npx skills add dartsim/dart --all -g -y

预览 repo 内 skill

npx skills add dartsim/dart --list

SKILL.md

Frontmatter
{
    "name": "dart-branch-cleanup",
    "description": "DART Branch Cleanup: analyze or clean stale repository branches"
}

dart-branch-cleanup

Use this skill in Codex to run the DART dart-branch-cleanup workflow. The editable workflow source currently lives in .claude/commands/, and this generated Codex skill is a generated Codex adapter entrypoint.

Invocation

  • Claude Code/OpenCode: /dart-branch-cleanup <arguments>
  • Codex: $dart-branch-cleanup <arguments>

Treat the text after the skill name as $ARGUMENTS. When the workflow references $1, $2, etc., map those to the positional values supplied by the user.

Command Body

Analyze or clean branches: $ARGUMENTS

Required Reading

@AGENTS.md @docs/onboarding/ci-cd.md @docs/onboarding/contributing.md

Modes

  • analyze: inspect only, no deletions
  • action: prepare follow-up, or delete only after ownership/safety are clear and the maintainer/user gives explicit approval for each local or remote branch deletion

Default to analyze if the requested mode is ambiguous.

Workflow

  1. git fetch --all --no-prune
  2. List stale remote-tracking refs without deleting them:
    git remote prune origin --dry-run
    
    If origin uses SSH and port 22 is unavailable, keep the check read-only and use a temporary HTTPS rewrite instead of changing repository config:
    git -c url.https://github.com/.insteadOf=git@github.com: \
      fetch --all --no-prune
    git -c url.https://github.com/.insteadOf=git@github.com: \
      remote prune origin --dry-run
    
    To confirm that a remote PR branch was deleted without updating refs, query GitHub directly over HTTPS:
    git ls-remote --heads https://github.com/dartsim/dart.git <BRANCH>
    
  3. Determine target branch, usually origin/main.
  4. For each branch:
    git rev-list --left-right --count <TARGET>...<BRANCH>
    git log --oneline <TARGET>..<BRANCH>
    git diff --stat <TARGET>..<BRANCH>
    git cherry -v <TARGET> <BRANCH>
    
  5. Before any explicitly approved local branch deletion, check whether the branch is checked out by a linked worktree:
    git worktree list --porcelain
    git -C <WORKTREE> status --short --branch
    
    Dirty linked worktrees must not be removed, detached, or reset during branch cleanup. Only after explicit maintainer/user approval, switch that worktree to a preservation branch at the same commit to free the obsolete branch name before deleting the merged branch.
  6. The command git branch --merged may not prove ancestry for PR branches that landed through a squash or merge commit. Use the merged PR state plus an empty tree diff or equivalent git cherry -v output as the deletion signal; if the history relationship is unclear, keep the branch.
  7. Classify recommendations only; deleting a candidate requires explicit maintainer/user approval:
    • ahead=0: safe deletion candidate
    • equivalent commits already landed: deletion candidate
    • no-PR branch whose fix may already be solved differently on the target: confirm supersession with a focused A/B or content check before deciding; superseded is a deletion candidate, otherwise keep or open a follow-up
    • small, current, useful diff: keep or rebase into PR
    • large or unclear diff: document follow-up before action
  8. Ask for explicit maintainer/user approval before pruning refs or deleting any local or remote branch, even when ownership, branch purpose, and remote impact look clear.

Output

  • Branch summary with ahead/behind count and last commit date
  • Useful commits or risks
  • Recommendation: delete, keep, rebase, or needs follow-up
  • Actions taken after explicit maintainer/user approval, if action mode was explicitly requested

版本历史

  • 51b2d25 当前 2026-07-11 18:25

    澄清 AI 工作流术语 (#3289)

  • e0d13fd 2026-07-05 10:37

同 Skill 集合

.claude/skills/dart-architecture/SKILL.md
.claude/skills/dart-build/SKILL.md
.claude/skills/dart-ci/SKILL.md
.claude/skills/dart-contribute/SKILL.md
.claude/skills/dart-io/SKILL.md
.claude/skills/dart-python/SKILL.md
.claude/skills/dart-references/SKILL.md
.claude/skills/dart-test/SKILL.md
.claude/skills/dart-verify-sim/SKILL.md
.codex/skills/dart-analyze/SKILL.md
.codex/skills/dart-architecture/SKILL.md
.codex/skills/dart-audit-agent-compliance/SKILL.md
.codex/skills/dart-backport-pr/SKILL.md
.codex/skills/dart-benchmark-packet/SKILL.md
.codex/skills/dart-build/SKILL.md
.codex/skills/dart-changelog/SKILL.md
.codex/skills/dart-ci/SKILL.md
.codex/skills/dart-close-issue/SKILL.md
.codex/skills/dart-contribute/SKILL.md
.codex/skills/dart-deps/SKILL.md
.codex/skills/dart-docs-update/SKILL.md
.codex/skills/dart-downstream-fix/SKILL.md
.codex/skills/dart-execute-packet/SKILL.md
.codex/skills/dart-fix-ci/SKILL.md
.codex/skills/dart-fix-issue/SKILL.md
.codex/skills/dart-io/SKILL.md
.codex/skills/dart-manage-pr/SKILL.md
.codex/skills/dart-mechanical-refactor/SKILL.md
.codex/skills/dart-new-task/SKILL.md
.codex/skills/dart-next/SKILL.md
.codex/skills/dart-plan-update/SKILL.md
.codex/skills/dart-pr/SKILL.md
.codex/skills/dart-python/SKILL.md
.codex/skills/dart-references/SKILL.md
.codex/skills/dart-release-merge-main/SKILL.md
.codex/skills/dart-release-packaging/SKILL.md
.codex/skills/dart-resume/SKILL.md
.codex/skills/dart-retro/SKILL.md
.codex/skills/dart-retrospect/SKILL.md
.codex/skills/dart-review-pr/SKILL.md
.codex/skills/dart-test/SKILL.md
.codex/skills/dart-triage-issue/SKILL.md
.codex/skills/dart-ultrawork/SKILL.md
.codex/skills/dart-verify-sim/SKILL.md

元信息

文件数
0
版本
51b2d25
Hash
3f39ca57
收录时间
2026-07-05 10:37

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-14 04:27
浙ICP备14020137号-1 $访客地图$