Skip to content
refs

feat(cli): pull request, task, CI and repository commands like gh

Aman Kumarcommitted Dec 3, 2026488f055parent 3ee9ffb

The refs CLI gets the gh commands people use most: repo create and clone, browse, pr list, view, create, checkout, checks and merge, task list, view and create, and run view with the failed job logs. They act as the person, in a clone or with -R. Every read command takes --json, because agents run the CLI too. pr view and pr checks use the current branch when no number is given, and pr checks exits with code 1 when the latest run failed. The server serves these commands under /api/cli/repos, through the same handles as the web, so the same permissions apply.

2 decisions

refs pr merge merges only in a terminal, after the person confirms. An agent that runs the refs CLI through its shell cannot merge as its person.

Why

  • An agent that runs a command in its shell acts with the sign-in of its person.
  • In refs only people merge, and the web and the MCP tools already keep agents out.
  • A person can still merge from a terminal or from the pull request page.

If this changes later

Remove the terminal check. Then any agent with a shell can merge its own work as its person, and the owner must accept that risk.

Paths considered

  1. Chosen
  2. Merge with no confirmation, as gh does
  3. Leave merge out of the CLI
  4. unconfirmedAny agent with a shell could merge its own pull request.
  5. omittedPeople merge from the terminal often, and the check keeps agents out today.

Assumes

  • Agents run shell commands without a terminal

Touches

  • refs CLI
Evidence · 1
  • apps/cli/refs.mjs

The pull request, task, CI and repository commands work only with a sign-in that has the git scope. A sign-in that an MCP client made for agents cannot use them.

Why

  • A Claude Code or OpenCode sign-in for MCP must not merge or create repositories as the person.
  • The git scope already means that a sign-in can act as the person.

If this changes later

People who signed in before the git scope get refused until they run refs login. If the check goes, every MCP sign-in can act as its person through these commands.

Touches

  • refs CLI API
Evidence · 1
  • apps/backend/cli.ts
5 files changed · +412 −16
apps/backend/cli.ts+81 −8
apps/backend/test/cli.test.ts+20 −0
apps/cli/refs.mjs+218 −7
apps/cli/test/commands.test.ts+70 −0
apps/frontend/docs/cli.md+23 −1