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 分