Gatefile

io.github.CloudCorpRecords由 GitHub 账号 CloudCorpRecords 发布v0.1.4更新于 Oct 26, 2026

Extract a repo's contribution gates into machine-readable contribution-gates.json.

已验证STDIO仅桌面知识与记忆开发者工具

概览

AI 生成的概览

把仓库文档中隐藏的贡献规则提取为机器可读的 contribution-gates.json,并校验该文件是否漂移、生成 README 徽章片段。

可以做什么
  • 从仓库的 CONTRIBUTING 文档、PR 与 issue 模板、DCO/CLA 工作流和钩子中提取贡献门槛,并为每条门槛附上原文引用作为证据
  • 将已提交的 contribution-gates.json 与最新提取结果比对,报告过期、缺失或严重程度变化等漂移
  • 生成一段 README Markdown 片段,用通俗语言向人类贡献者说明这些门槛
  • 可通过 GitHub API 或本地克隆目录运行,本地模式完全离线
适用场景
适合参与开源项目贡献时,在提交 PR 前先弄清真实的规则(是否需先认领、是否需签名、CLA、担保等);也适合维护门槛文件,让 CI 或助手在文档变动时发现不一致。
运行要求
以本地 stdio 进程运行,可通过 npx 或 Docker 镜像启动;npm 包需要 Node.js 20 及以上。API 模式下 GITHUB_TOKEN 为可选项,本地目录模式可离线使用。未声明任何环境变量或请求头。
安装前请注意
API 模式会通过 GitHub API 读取仓库文档,若提供 GITHUB_TOKEN 会发送给 GitHub;本地模式可避免。工具本身只读取和生成文件,但 validate_gates 会报告漂移,CLI 在漂移时以退出码 1 结束,可能导致 CI 任务失败。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

gatefile

Hidden contribution gates, extracted into a file machines can read.

Every repo hides its real rules for outside contributors: comment before you start, wait to be assigned, sign off your commits, get vouched, sign a CLA. Today you discover those rules by getting your PR auto-closed. gatefile extracts them from the repo's own docs into contribution-gates.json, a machine-readable format that tools (like Greenlight) and CI can consume.

The problem

A contributor picks an issue, writes the code, opens the PR, and a bot closes it: "you were not assigned", "unvouched authors are auto-closed", "missing Signed-off-by". The rules were always in CONTRIBUTING.md, buried in prose, different on every repo. Maintainers repeat the same corrections; contributors waste the same evenings.

What gatefile does

  1. extract: reads CONTRIBUTING.md, PR and issue templates, DCO/CLA workflow files, lefthook hooks, and CLA files (from the GitHub API or a local directory) and emits the gates it finds, each with a real quoted line as evidence. In API mode, a repo with no CONTRIBUTING file or no PR template of its own also inherits the organization level default from the org's .github repository, exactly the fallback GitHub itself applies; inherited files are labelled owner/.github:<path> in generatedFrom and as the gate source, and a repo file always wins over the org default for its group.
  2. validate: compares a committed contribution-gates.json against a fresh extraction and reports drift (STALE, MISSING, SEVERITY_CHANGED). Exit code 1 on drift, so CI can enforce it.
  3. badge: renders a README snippet that tells humans the gates in plain language.

The contribution-gates.json format

json
{  "version": 1,  "repo": "shadcn-labs/pdfcn",  "generatedFrom": ["CONTRIBUTING.md"],  "gates": [    {      "id": "claim_first",      "kind": "claim_first",      "severity": "blocker",      "evidence": "Comment before starting work, and check the thread first in case someone else is already working on it.",      "source": "CONTRIBUTING.md"    }  ],  "conventions": {    "branchNaming": "Name your branch feat/block-name",    "prTitleFormat": "PR titles should follow Conventional Commits",    "requiredChecks": []  }}

Gate kinds

kindseveritymeaning
claim_firstblockerComment on the issue before starting work
assignment_requiredblockerWait to be assigned before opening a PR
discuss_firstblockerOpen a discussion or issue before coding
issue_firstblockerEvery PR must be tied to an issue
vouch_requiredblockerAn existing member must vouch for you
collaborators_onlyblockerOnly repo collaborators may open PRs
no_direct_prsblockerDirect PRs are not accepted
dco_requiredwarnCommits need a Signed-off-by trailer (DCO)
cla_requiredwarnA Contributor License Agreement must be signed

Severity: blocker gates can get a PR closed or rejected before review. warn gates can be fixed after the PR opens. Evidence is always a real quote from the source file, trimmed to about 140 characters, never invented.

Run it with Docker

gatefile also ships as a container image on GHCR: ghcr.io/cloudcorprecords/gatefile.

Use it as a stdio MCP server:

bash
docker run -i ghcr.io/cloudcorprecords/gatefile

Any CLI command can be passed after the image name instead of the default mcp argument:

bash
docker run ghcr.io/cloudcorprecords/gatefile <command> [args]

Usage

CLI

bash
# Extract gates from a repo (GitHub API, GITHUB_TOKEN optional)gatefile extract shadcn-labs/pdfcn
# Extract from a local clone instead (fully offline)gatefile extract local --local ./pdfcn --out contribution-gates.json
# Validate the committed file against fresh docs, exit 1 on driftgatefile validate shadcn-labs/pdfcn --file contribution-gates.json
# Print a README snippet for humansgatefile badge shadcn-labs/pdfcn

MCP server

Add to your MCP client config:

json
{  "mcpServers": {    "gatefile": {      "command": "node",      "args": ["/path/to/gatefile/dist/mcp.js"]    }  }}

Tools:

toolinputswhat it returns
extract_gatesrepo or localPaththe full contribution-gates.json object
validate_gatesrecorded, repo or localPath{ ok, drift[] }
gates_badgerepo or localPathREADME markdown snippet

CI example

Keep the gates file honest in a GitHub Actions workflow:

yaml
name: gateson:  pull_request:    paths: ["CONTRIBUTING.md", ".github/**", "contribution-gates.json"]jobs:  validate:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v4      - uses: actions/setup-node@v4        with: { node-version: 20 }      - run: npx -y gatefile extract ${{ github.repository }} --out /tmp/fresh.json      - run: npx -y gatefile validate ${{ github.repository }} --file contribution-gates.json

Development

bash
npm installnpm test        # tsx --test, offline, 35 testsnpm run build   # tsc to dist/npm run dev -- extract owner/repo --json

TypeScript ESM, Node 20+, zod for schemas, native fetch for the GitHub API. Tests use real-world fixtures in test/fixtures/ modeled on documented cases (comment-before-starting plus DCO plus issue-first; assignment-first; vouch-only; permissive).

License

MIT, Rene Turcios 2026.

The toolkit

This tool is one of four in a lifecycle for open-source contribution work, all published under the @reneturcios npm scope and each available as a CLI and an MCP server (<tool> mcp):

  1. gatefile (npx @reneturcios/gatefile) extracts a repo's contribution gates into a committed contribution-gates.json.
  2. greenlight (npx @reneturcios/greenlight) pre-flights issues (GO / RISKY / TAKEN / GATED / STALE), consumes gatefile's output in check and scan, then claims, preps, and opens PRs.
  3. claimcheck (npx @reneturcios/claimcheck) watches for stale claims and fixes parked on forks.
  4. prwatch (npx @reneturcios/prwatch) triages your open PRs by what needs you right now.

来源:README.md,提交 f4c5f94

工具

3

extract_gates

Extract hidden contribution gates from a repo's docs into a contribution-gates.json object

输入参数repo必填localPath

validate_gates

Compare a recorded contribution-gates.json object against a fresh extraction and report drift

输入参数repo必填recorded必填localPath

gates_badge

Render a README markdown snippet summarizing a repo's contribution gates

输入参数repo必填localPath

版本历史

4
  1. v0.1.4最新Oct 26, 2026
  2. v0.1.3Oct 23, 2026
  3. v0.1.2Oct 18, 2026
  4. v0.1.1Oct 16, 2026

评分

已满足适用检查项的 90%

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

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

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

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分