Repository navigation
Description
Problem or Motivation
No command reads rulesets, variables or org data, so devops gh api is the only path. Nine gh sub-groups show the parent help text in CLI_REFERENCE.
Order 9 of the plan in #5311. The owner approved the plan on 2026-11-13.
Proposed Solution & Architectural Design
Add registry entries for gh repo (no delete), gh ruleset (list, view, check), gh variable and gh org list. The guard of #5316 covers the write verbs. Each add_typer call gets its own help=. Update the docs and the gh-command-names spec.
Target Subsystem
SDLC, Git & PR Governance
Existing Tool Considered
gh v2.104.0 (MIT): gh repo (view, list, edit, archive, unarchive, rename, autolink, deploy-key; not delete), gh ruleset (list, view, check), gh variable, gh org list. Registry from #5223.
Cost: Build: about 250k tokens and 0.5 day after #5223 merges (about 400k tokens without the registry). Keep: about 5k tokens a month. Fix: about 50k tokens.
Acceptance Criteria
- The gh-parity name test passes.
- An agent caller is refused on write verbs.
- The dry run prints the argv.
- Each sub-group shows its own help.
Dependencies
Source: #5311
Alternatives check of 2026-11-28: in-use.
The repository already uses this tool.
Tool: cli/cli (https://github.com/cli/cli), MIT, last activity 2026-11-27, maintained.
Reason: Searches found the gh CLI, which the issue itself names as the existing tool and which already ships the gh repo, ruleset, variable and org commands the registry would mirror; only the pass-through wiring, guard and help text stay ours.
Covers:
- gh repo view, list, edit, archive, unarchive, rename, autolink, deploy-key
- gh ruleset list, view, check
- gh variable list, get, set, delete
- gh org list
Lacks:
- No refusal of an agent caller on write verbs
- No per-group help summary in the CLI reference
- No dry-run argv printing for these groups
- Upstream gh repo delete stays unwrapped
Proposed design
Problem statement
devops gh api is the only path to rulesets, variables and org data, and the gh group rows in CLI_REFERENCE show the parent gh help text because their app.add_typer call passes no help=. This change adds the pass-through commands and registry entries of gh repo (no delete), gh ruleset (list, view, check), gh variable (list, get, set, delete) and gh org list, gives every gh sub-group its own help=, refuses an agent caller on the new write verbs, and updates the generated docs and the gh-command-names spec.
Acceptance criteria
Requirement: GH group registry entries
The pass-through registry SHALL hold an entry for each approved gh repo, gh ruleset, gh variable and gh org list command, with the runner, read or write mode, owned options, MCP allowlist, page rule and timeout of its contract.
Scenario: The four approved groups appear in the registry
- WHEN tests/core/test_passthrough.py reads REGISTRY for repo, ruleset, variable and org
- THEN it finds an entry for devops gh repo view, list, edit, archive, unarchive, rename, autolink and deploy-key, devops gh ruleset list, view and check, devops gh variable list, get, set and delete, and devops gh org list, each mode is read for a read verb and write for a write verb, each devops_path resolves to a registered command, and no key equals or begins with gh repo delete.
Requirement: GH parity names
The gh noun list of the command-name test and the gh-command-names requirement SHALL name repo, ruleset, variable and org.
Scenario: Parity test covers the new names
- WHEN the command-name test runs devops gh <noun> --help for each noun of GH_NOUNS
- THEN each of repo, ruleset, variable and org exits 0 and the test reports no missing name.
Requirement: Agent write guard
The pass-through layer SHALL refuse an agent caller on each new write verb before it builds a request or starts gh.
Scenario: Agent caller is refused on a write verb
- WHEN the guard test runs devops gh repo edit, gh repo archive, gh repo unarchive, gh repo rename, gh repo autolink create, gh repo autolink delete, gh repo deploy-key add, gh repo deploy-key delete, gh variable set and gh variable delete as an agent caller
- THEN each call exits 1 with the refusal message, the test transport records no gh call, and the same verb from a person caller reaches the planned gh argv.
Requirement: Dry run prints argv
Each new gh pass-through command SHALL print its gh argv and send no request in a dry run.
Scenario: Dry run of a new command
- WHEN a caller runs devops gh repo view, gh ruleset list, gh variable list, gh org list and gh repo edit with --dry-run
- THEN stdout shows each planned gh argv and the test transport records no gh call.
Requirement: Per-group help text
Each gh sub-group SHALL show its own help text.
Scenario: Each gh sub-group shows its own summary
- WHEN the help test runs devops gh <group> --help for label, milestones, project, views, pages, issue, run, branch-protection, secret, pr, repo, ruleset, variable and org
- THEN each output holds that group's own summary from HELP and not HELP.gh.app.
Requirement: CLI reference gh rows
The generated CLI reference SHALL carry the own summary of each gh sub-group.
Scenario: docs check accepts the regenerated pages
- WHEN uv run devops docs generate runs and then uv run devops docs check runs
- THEN docs check exits 0 with no out-of-date document, so docs/CLI_REFERENCE.md holds a row and docs/commands/gh.md a block for each gh sub-group with that group's own summary.
Requirement: GH command names spec
The gh-command-names spec delta SHALL add repo, ruleset, variable and org to the requirement that lists the gh nouns.
Scenario: OpenSpec gate accepts the delta
- WHEN uv run devops openspec check runs on the change
- THEN it exits 0, and the change's gh-command-names delta validates with repo, ruleset, variable and org in its modified requirement.
Existing Tool Considered
cli/cli (gh, MIT, https://github.com/cli/cli) is the open, maintained tool and the repository already uses it; the alternatives block of the issue (Alternatives check of 2026-11-22: in-use) records what gh covers and what it lacks for the gh repo, gh ruleset, gh variable and gh org groups. The project keeps gh for the pass-through and adds the registry entries, the per-group help= wiring, the pass-through write refusal, and the docs and spec updates: about 250k tokens and 0.5 day to build on the registry now in the tree, about 5k tokens a month to keep and about 50k tokens to fix.
Key questions
- Which gh variable verbs are in scope?: The full gh variable group: list, get, set and delete. The gh variable manual lists those four commands (fetched 2026-11-27), so each gets a registry entry, with mode read for list and get and mode write for set and delete. (best practice) [sources: https://cli.github.com/manual/gh_variable, src/devops_cli/core/passthrough.py:56]
- Chosen: Full gh variable group. gh variable documents list, get, set and delete, and the item names the gh variable group; set and delete are the write verbs that the guard must refuse.
- Rejected: Read-only gh variable list and get. It leaves the approved write verbs out and leaves the registry's write mode unused for this group.
- Should the gh repo group include delete?: No. NEVER_WRAPPED holds
repo deleteand the registry spec forbids any entry that equals or begins with a never-wrapped verb, so gh repo delete gets neither a registry entry nor a devops command, although gh still ships it upstream. (best practice) [sources: src/devops_cli/core/passthrough.py:66, openspec/specs/tool-passthrough-registry/spec.md:24, docs/adr/0037-tool-commands-mirror-and-pass-through-options.md:20]- Chosen: Exclude gh repo delete. The never-wrapped list of the registry and the living spec forbid it, and ADR 0037 keeps repo delete unexposed.
- Rejected: Include gh repo delete. It would break the never-wrapped rule and add a destructive verb outside the approved plan.
- How should each gh sub-group show its own help?: Pass help= on the app.add_typer(...) call of each group: HELP.gh.<group>_app for the groups that src/devops_cli/commands/gh.py defines, HELP.pr.app for the pr group, and new HELP.gh entries for repo, ruleset, variable and org. The help= of the sub-app constructor alone does not set the row. (best practice) [sources: src/devops_cli/commands/gh.py:134, src/devops_cli/commands/gh.py:141, docs/CLI_REFERENCE.md:369, docs/CLI_REFERENCE.md:376]
- Chosen: help= on each app.add_typer call. The add_typer calls that pass help= show their own summary in the CLI reference (docs/CLI_REFERENCE.md:376-377), while the calls without it show the parent gh text (docs/CLI_REFERENCE.md:369-375).
- Rejected: Rely on the help= of the sub-app constructor. Every sub-app already sets help= (src/devops_cli/commands/gh.py:124-132), yet eight rows still show the parent text, so the constructor alone does not set the group summary.
- Rejected: One parent help= for all groups. It keeps the defect: each sub-group would show the parent gh help text.
- Do the existing gh sub-groups that lack help= get it in this change, or only the four new ones?: All eight that lack it: label, milestones, project, views, pages, issue, run and pr. branch-protection (src/devops_cli/commands/gh.py:141) and secret (src/devops_cli/commands/gh.py:142) already pass help= and show their own summaries (docs/CLI_REFERENCE.md:376-377), while the other eight rows show the parent text (docs/CLI_REFERENCE.md:369-375 and :378). The item body says nine; the tree shows eight. (best practice) [sources: src/devops_cli/commands/gh.py:134, src/devops_cli/commands/gh.py:142, docs/CLI_REFERENCE.md:369, docs/CLI_REFERENCE.md:378]
- Chosen: Fix every gh sub-group that lacks help=. The eight rows at docs/CLI_REFERENCE.md:369-375 and :378 still show the parent text, so adding help= only to the four new calls leaves the named defect in place.
- Rejected: Fix only the four new sub-groups. The eight existing rows would keep the parent gh help text.
- How do the new write verbs refuse an agent caller?: Add one guard to the pass-through layer: a function in src/devops_cli/core/passthrough.py that raises the refusal when the entry's mode is write and core.caller.is_agent_caller() is true, called at the top of every new write command before it builds a request or a dry-run plan. The feat(gh): refuse agent writes to repo and org settings routes #5316 guard in src/devops_cli/github/api_guard.py classifies REST routes of devops gh api only and covers none of these verbs. (best practice) [sources: docs/adr/0037-tool-commands-mirror-and-pass-through-options.md:19, src/devops_cli/core/passthrough.py:56, src/devops_cli/github/api_guard.py:84, src/devops_cli/core/caller.py:79]
- Chosen: Registry-level write guard. ADR 0037 puts the security bounds in the one registry rather than in ad-hoc checks, and the entry already carries the read or write mode that the guard reads.
- Rejected: Reuse the feat(gh): refuse agent writes to repo and org settings routes #5316 gh api guard. api_guard classifies HTTP routes of devops gh api and has no route for gh repo edit, gh variable set or the other pass-through verbs.
- Rejected: A per-command is_agent_caller call. It repeats the same check in about ten commands and scatters the guard that ADR 0037 keeps in the registry.
- Are the new commands explicit Typer commands or one registry-driven dispatcher?: Explicit Typer commands under the four new sub-apps, each using its registry entry's runner, mode and options, as devops gh run list is built at src/devops_cli/commands/gh.py:1724. The registry holds the contract metadata that the tests check, not option parsing or dry-run plans. (best practice) [sources: src/devops_cli/commands/gh.py:1724, src/devops_cli/core/passthrough.py:51, tests/core/test_passthrough.py:41]
- Chosen: Explicit Typer commands. The one registered command is built this way, and the registry entry carries no typed option model or dry-run plan that a dispatcher could read.
- Rejected: One registry-driven dispatcher. It would still need the per-verb options, dry-run plans and help text, and it would change the command tree that resolve_devops_argv checks.
- How should the CLI reference and the gh-command-names spec be updated?: Run uv run devops docs generate and commit the regenerated docs/CLI_REFERENCE.md and docs/commands/gh.md, and put the new nouns in a modified gh-command-names requirement in the change's spec delta; openspec archive writes the living spec when the change closes. (best practice) [sources: CONTEXT.md:20, docs/adr/0025-generated-documents-stay-in-git-and-the-project-brain-cites-them.md:19, openspec/specs/gh-command-names/spec.md:9]
- Chosen: Regenerate the docs and archive the spec delta. CONTEXT.md:20 says only openspec archive writes a living spec, and ADR 0025 has the generator run in the pull request that changes its source, checked by the docs row of CI.
- Rejected: Hand-edit docs/CLI_REFERENCE.md and the living spec. The generated documents are tool-written and the living spec is written only by openspec archive, so a hand edit is lost at the next generate or archive.
- Do feat(cli): tool commands pass unknown arguments to the tool #5223 and feat(gh): refuse agent writes to repo and org settings routes #5316 still block the work?: No. The pass-through registry is in the tree at src/devops_cli/core/passthrough.py:117 and the gh api guard at src/devops_cli/github/api_guard.py:84, so both dependencies are delivered. What remains is this change's own work: the four groups' entries, the pass-through write refusal, the help= wiring, and the docs and spec updates. [sources: src/devops_cli/core/passthrough.py:117, src/devops_cli/github/api_guard.py:84, tests/core/test_passthrough.py:15]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 13, 2026
Both add gh sub-commands that pass through to the gh tool, but #5228 covers status, label, and secret while the candidate covers repo, ruleset, variable, and org.devops-cli-service commentedon Nov 16, 2026
Alternatives check: rejected
Reason: The searches surfaced no alternative tool, and the issue itself names the GitHub CLI (gh v2.104.0) as the existing tool: gh already ships the
gh repo,gh ruleset(list, view, check),gh variableandgh org listcommands the issue wants to pass through, so it covers the need. ADR 0006 rejected routing everything through the gh CLI for the session's own requests.Rejected by ADR 0006. A newer fact can change an ADR.
Tool: cli/cli (https://github.com/cli/cli)
Covers:
Lacks:
repo delete, which the issue does not needTools considered:
Searches run:
Sources:
Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 17, 2026
Refine cannot set this item to Ready at 551a0c3 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.
devops-cli-service commentedon Nov 22, 2026
The result in the alternatives block of the issue body changed. Before this check:
rejected, tool https://github.com/cli/cli. A person decides what the new result means for the item.Searches (3)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 27, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.