Gitcleanplan

io.github.CloudCorpRecords由 GitHub 账号 CloudCorpRecords 发布v0.1.0更新于 Nov 3, 2026

规划过期和已合并分支的清理:按分支保留、审查或删除,并附上理由。

AI 翻译由 AI 模型根据下方的原文描述翻译,可能有误。

原文描述

Plan stale and merged branch cleanup: keep / review / delete per branch, with reasons.

已验证STDIO仅桌面

概览

Gitcleanplan 的本地 MCP 服务;无需登录;STDIO。

暂无 AI 概览:以下信息来自注册中心条目和服务本身。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Gitcleanplan,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

gitcleanplan

Branch lists grow quietly. A feature lands, its branch stays; an experiment is abandoned, its branch stays too; the upstream disappears and the local copy lingers. Deleting branches on a hunch is how work gets lost, so gitcleanplan takes the middle road: you hand it the branch data, and it hands back a plan — lists first, deletes nothing.

For every branch you supply, the plan gives one of three decisions, each with the reason that produced it:

  • keep — the default branch, a protected branch, the branch currently checked out, or a branch that is simply still active.
  • review — merged but recently active, upstream gone but not merged, or stale but not merged: promising cleanup candidates that deserve a human look before anything else.
  • delete — merged and either its upstream is gone or it has been stale for at least stale_days. Only merged branches can ever land here.

Decisions follow a fixed rule order, so the reason is never ambiguous: the default branch wins over protection, protection wins over a merged-and-gone branch, being checked out wins over being merged, and "merged and upstream is gone" wins over "merged and stale". Staleness is inclusive — a branch whose last commit was exactly stale_days ago counts as stale.

Alongside the per-branch decisions, the result groups the branch names under each action, counts them, and lists one safe-delete command (git branch -d <name>) per branch planned for deletion, in name order. Those commands are listed, never run: gitcleanplan does not invoke git, open a repository, or delete anything. You read the plan, and you decide what to execute yourself.

Malformed input — a missing or empty branch list, a missing, empty, or duplicated branch name, a missing, negative, or non-integer last_commit_days_ago, a wrongly typed flag, a bad stale_days or default_branch — is a validation error naming the offending path (for example branches[1].last_commit_days_ago must be an integer >= 0), and no partial plan is produced. The computation is pure and local: no network, no configuration, no files read beyond the input you pass in.

CLI

bash
npx @reneturcios/gitcleanplan plan --input args.jsonnpx @reneturcios/gitcleanplan --version

args.json contains the full arguments object:

json
{  "stale_days": 90,  "branches": [    { "name": "main", "last_commit_days_ago": 0, "current": true },    { "name": "shipped-feature", "merged": true, "upstream_gone": true, "last_commit_days_ago": 45 },    { "name": "old-spike", "last_commit_days_ago": 180 }  ]}

merged, upstream_gone, protected, and current default to false per branch; stale_days defaults to 90; default_branch defaults to "main". The plan is printed as JSON:

json
{  "branches": [    { "name": "main", "action": "keep", "reason": "default branch" },    { "name": "old-spike", "action": "review", "reason": "stale but not merged" },    { "name": "shipped-feature", "action": "delete", "reason": "merged and upstream is gone" }  ],  "plan": {    "delete": ["shipped-feature"],    "review": ["old-spike"],    "keep": ["main"]  },  "counts": { "delete": 1, "review": 1, "keep": 1 },  "commands": ["git branch -d shipped-feature"]}

Exit codes: 0 on success, 1 on a runtime error (including an unreadable or invalid input file, or invalid input), 2 on a usage error.

MCP server

bash
npx -y @reneturcios/gitcleanplan mcp

MCP client config:

json
{  "mcpServers": {    "gitcleanplan": {      "command": "npx",      "args": ["-y", "@reneturcios/gitcleanplan", "mcp"]    }  }}

Tools

  • plan_branch_cleanup — Plan stale and merged branch cleanup.

    • branches (array, required, at least one) — branches as {name, last_commit_days_ago, merged?, upstream_gone?, protected?, current?} objects; name is unique across the set and last_commit_days_ago is a whole-day count of at least 0
    • stale_days (integer, optional, default 90, at least 1) — a branch is stale at this many days since its last commit
    • default_branch (string, optional, default "main") — the default branch name; it is never planned for deletion

    Returns {branches, plan, counts, commands}.

Docker

bash
docker run -i ghcr.io/cloudcorprecords/gitcleanplandocker run --rm -v "$PWD:/w" ghcr.io/cloudcorprecords/gitcleanplan plan --input /w/args.json

Development

bash
npm installnpm run build   # tsc -> dist/npm test        # tsx --test test/*.test.ts (pure local, no network)npm run dev     # run the CLI from source

License

MIT — Copyright (c) 2026 Rene Turcios

来源:README.md,提交 e6aea49

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Nov 3, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分