Agent Skillsdartsim/dart › dart-branch-cleanup

dart-branch-cleanup

GitHub

用于分析或清理 DART 仓库中过时的 Git 分支。支持只读分析和需审批的删除两种模式,自动处理远程同步、工作树冲突及合并状态验证,确保分支清理安全合规。

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

Trigger Scenarios

用户请求分析过时分支 用户请求清理过时分支 需要检查仓库分支健康状况

Install

npx skills add dartsim/dart --skill dart-branch-cleanup -g -y
More Options

Non-standard path

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

Use without installing

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 first-class Codex 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

Version History

  • e0d13fd Current 2026-07-05 10:37

Same Skill Collection

.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
.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-retrospect/SKILL.md
.codex/skills/dart-review-pr/SKILL.md
.codex/skills/dart-test/SKILL.md
.codex/skills/dart-triage-issue/SKILL.md

Metadata

Files
0
Version
e0d13fd
Hash
4dfc9f6f
Indexed
2026-07-05 10:37

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-09 09:32
浙ICP备14020137号-1 $Гость$