CLI interface aligned with the current implementation. Behavioral contracts live in
features/cli/.
Version 0.4 · Date 2026-08-11
- One command does one thing.
- Operator commands talk to a running server via
--url(defaulthttp://127.0.0.1:7400). - Operator API calls send
Authorization: Bearer <ops-token>— same secret asserve(--tokenorGITHUB_TOKEN). - Errors are clear, actionable, and written to stderr.
- The token never appears in config files or logs.
git-blinder serve --token <GITHUB_TOKEN> [--port <PORT>] [--config <PATH>]
| Flag | Required | Default | Description |
|---|---|---|---|
--token |
yes* | — | GitHub PAT (* or GITHUB_TOKEN) ; also becomes the ops Bearer for /api/* |
--port |
no | 7400 |
Listen port |
--config |
no | config.yaml |
Optional perimeter preload |
Behaviour:
- Missing token → exit with a clear error.
- Validate token against GitHub ; print identity / scopes.
- Listen on
127.0.0.1:<port>. - Expose health
/mcp, ops/mcp/root, perimeter/mcp/<id>[/<branch>], and Bearer-protected/api/*(see SPEC §9).
git-blinder tools
Prints the built-in catalogue (all tools git-blinder knows how to handle).
Commands that hit /api/* accept:
| Flag | Required | Default | Description |
|---|---|---|---|
--token |
yes* | — | Ops Bearer (* or GITHUB_TOKEN) |
--url |
no | http://127.0.0.1:7400 |
Running server base URL |
Missing ops token → clear stderr error (do not call the API unauthenticated).
git-blinder repos list [--url <url>] [--token <TOKEN>]
Lists repositories visible to the server token (GET /api/repos).
git-blinder branches list --repo <owner/repo> [--url <url>] [--token <TOKEN>]
Lists GitHub branches for a repository (operator discovery).
Not the agent surface — agents do not get list_branches on perimeter MCP.
git-blinder perimeter create <id> --repo <owner/repo> --read <glob> [--write <glob>] [--tools a,b,c] [--url <url>] [--token <TOKEN>]
git-blinder perimeter list [--url <url>] [--token <TOKEN>]
git-blinder perimeter show <id> [--url <url>] [--token <TOKEN>]
git-blinder perimeter delete <id> [--url <url>] [--token <TOKEN>]
- Id must be URL-safe (
[a-z0-9-]+). - Id
rootis reserved (ops MCP at/mcp/root) → create fails with a clear error. - Create resolves the repo default branch and seeds
branches = [default]. - Delete unbinds
/mcp/<id>(and branch bindings).
git-blinder perimeter branch list <id> [--url <url>] [--token <TOKEN>]
git-blinder perimeter branch add <id> <branch> [--url <url>] [--token <TOKEN>]
git-blinder perimeter branch remove <id> <branch> [--url <url>] [--token <TOKEN>]
addverifies the branch exists on GitHub ; otherwise error telling the operator to create it first.removecannot remove the default branch.
git-blinder perimeter commits list <id> [--branch <name>] [--url <url>] [--token <TOKEN>]
git-blinder perimeter commits show <id> <sha> [--branch <name>] [--url <url>] [--token <TOKEN>]
Same filtering rules as MCP list_commits / get_commit (path prefixes from read, opaque omitted_count).
--branch must be allowlisted ; default = perimeter default branch.
| Path | Role |
|---|---|
GET /mcp |
Health + perimeter ids (no tools) |
POST /mcp |
405 — no MCP tools here |
GET/POST /mcp/root |
Unfiltered ops MCP (not for agents) |
GET/POST /mcp/<id>[/<branch>] |
Scoped agent MCP |
/api/* |
Bearer required (same token as serve) |
| Tool | Verb | Ops /mcp/root |
Perimeter agent |
|---|---|---|---|
get_tree |
read | yes | yes |
get_file |
read | yes | yes |
get_files |
read | yes | yes |
push_files |
write | yes | yes (atomic commit on bound branch) |
list_commits |
read | yes | yes (path-filtered) |
get_commit |
read | yes | yes (files filtered + omitted_count) |
list_branches |
read | yes | no |
compare |
read | yes | no |
| Feature | Contract |
|---|---|
features/cli/01_serve.feature |
serve ; GET /mcp health ; POST /mcp → 405 ; /mcp/root tools/list |
features/cli/02_perimeter.feature |
create / list / show / id validation |
features/cli/03_perimeter_mcp.feature |
/mcp/<id> binding + tool subsets ; ops root stays unfiltered |
features/cli/04_branches.feature |
branches list |
features/cli/05_repos.feature |
repos list |
features/cli/06_perimeter_branches.feature |
allowlist add/list/remove |
features/cli/07_mcp_branch_binding.feature |
/mcp/<id>/<branch> + forced ref |
features/cli/08_commit_history.feature |
filtered commits CLI (+ MCP tools present) |
features/support/01_api_perimeters.feature |
/api CRUD + 401 without Bearer + reserved root |