Repository navigation
Description
Split from #6598.
ProblemThe scope of #6598 asks that an unknown option of an API command get a proposal that names the query field of its read route or the body field of its write route (the API naming rule of the ADR of #6597). The usage-error record holds the command path and the typed name only, and no argument value. No route table maps a devops command to an API route and its query or body fields: src/devops_cli/core/passthrough.py holds CLI pass-through entries only, and #6597 delivers no API route table.## Why it is deferredThe proposal cannot name a field that no route table holds. The rest of #6598 does not need the route table.## Acceptance criteria- An item builds a route table that maps a devops command to its API route, its query fields and its body fields.- The ranking names the query field of a read route or the body field of a write route in the proposal for an unknown option of an API command.- A test replays a record of an unknown option of an API command, with the command path and the typed name only, and asserts the field name of its route.- The proposal holds no argument value.
Proposed design
Problem statement
The unknown-option hint names only the typed option. The API naming rule of ADR 0037 also asks for the query field of the read route or the body field of the write route. No table maps a devops pass-through command to its API route and fields. This change adds that table and the field sentence.
Acceptance criteria
Requirement: Route table covers each pass-through path
The route table SHALL hold one entry for each devops path of the pass-through registry.
Scenario: Every registered path has a route
- WHEN A test compares the devops paths of
REGISTRYinsrc/devops_cli/core/passthrough.pywith the keys ofAPI_ROUTES. - THEN The two sets are equal, so each devops path has one route entry.
Requirement: Read and write field location
A read command MUST name query or path parameters, and a write command MUST name body properties or path parameters.
Scenario: The locations of a read command and a write command
- WHEN A test reads each field of the entry of
devops gh run listand of the entry ofdevops gh issue create. - THEN Each read field has the location
queryorpath, and each write field has the locationbodyorpath.
Requirement: The hint names the API field
The unknown-option hint SHALL name the query field of a read route or the body field of a write route.
Scenario: A write command names its body field
- WHEN A test calls
api_field_hint("devops gh issue create", "--assignes"). - THEN The result names the body field
assigneesof the routePOST /repos/{owner}/{repo}/issues.
Requirement: Each field entry names its own route
A field entry MUST carry its own method and path when its command calls more than one route.
Scenario: The close comment names the comment route
- WHEN A test calls
api_field_hint("devops gh issue close", "--coment"). - THEN The result names the body field
bodyof the routePOST /repos/{owner}/{repo}/issues/{issue_number}/comments.
Requirement: The hint holds no value
The hint MUST hold no argument value.
Scenario: The hint text holds the field and the route only
- WHEN A test calls
api_field_hint("devops gh run list", "--brnch"). - THEN The result equals
The option sets the query field branch of the route GET /repos/{owner}/{repo}/actions/runs.
Requirement: Each owned option has a field decision
Each owned option of a registered command MUST map to a field or to no field.
Scenario: The field map covers each owned option
- WHEN A test iterates the owned options of each
REGISTRYentry. - THEN Each owned option is a key of the field map of its route, and its value is a field or
None.
Existing Tool Considered
No alternatives check has run. The open, maintained tool that covers the route and field names is the GitHub REST API OpenAPI description (github/rest-api-description, https://github.com/github/rest-api-description). It holds each route, its query parameters and its body schema. It lacks the mapping from a gh flag to its REST parameter (--assignee is assignees, --reason is state_reason), because the gh flags and the REST parameters differ. The change builds only that gap: a table of 5 commands and one matcher. Cost: about 20k tokens to write and test, about 5k tokens a year to keep, about 3 hours.
Key questions
- Which API holds the read route and the write route of an API command?: The GitHub REST API holds the read route and the write route. The API commands are the pass-through commands of
REGISTRYinsrc/devops_cli/core/passthrough.py:devops gh run listis a read command, anddevops gh issue create,edit,closeandreopenare write commands. The roadmap Service API of ADR 0029 is read-only, so it holds no write route. [sources: src/devops_cli/core/passthrough.py:202, docs/adr/0029-the-roadmap-service-serves-a-read-only-api.md, https://github.com/github/rest-api-description] - Where does the route table live?: The route table lives in a new module,
src/devops_cli/core/api_routes.py. The pass-through registry stays the contract for option parsing and pass-through. (best practice) [sources: src/devops_cli/core/passthrough.py:51, src/devops_cli/core/usage_hints.py:41]- Rejected: Extend
PassthroughEntrywith route fields. The registry is the contract for option parsing and pass-through. A route change would touch it for no parsing reason, and the issue states that it holds CLI entries only. - Chosen: New module
src/devops_cli/core/api_routes.py. The route data changes for API reasons only, and the module sits beside the registry incore/. - Rejected: Generate the table from the OpenAPI description at run time. The description is large and needs the network. A test cannot run offline.
- Rejected: Extend
- How does the hint find the field of a typed unknown option?: The hint removes the dashes from the typed name. It takes the closest owned long flag of the command with
difflib.get_close_matches. It then reads the field of that flag from the route table. (best practice) [sources: src/devops_cli/core/passthrough.py:76, src/devops_cli/telemetry/usage_errors.py:123, src/devops_cli/core/usage_hints.py:186]- Chosen: Close match the typed name to the owned flags, then read the field. The typed name is a typo of an option, and the table holds one field for each owned flag.
- Rejected: Close match the typed name to the field names of the route. A typed option name resembles no field name of its route in the common case, so the hint returns nothing.
- Rejected: Exact match only. An unknown option never matches an owned flag exactly.
- Which text does the proposal add?: The hint adds one sentence. The sentence names the location, the field and the method and path of the route, and holds no value. For
devops gh issue createand--assignes, the sentence isThe option sets the body field assignees of the route POST /repos/{owner}/{repo}/issues.The hint catalog holds one line for each command path and typed name. The usage-error record holds no value. (best practice) [sources: src/devops_cli/core/usage_hints.yaml:58, src/devops_cli/core/usage_hints.py:176, openspec/specs/command-telemetry/spec.md:156]- Chosen: A fixed sentence with the field and its route. The user sees the field and the route, and the text is the same for each record, so a test compares it.
- Rejected: The field name only. The user cannot tell which route the field belongs to.
- Rejected: The field and the value. The usage-error record holds no value, and telemetry must not add one.
- A command can call more than one route. How does the table name the field of the right route?: Each field entry carries its own method and path. A field entry that names no route uses the route of its command.
devops gh issue close --commentnames the body fieldbodyofPOST /repos/{owner}/{repo}/issues/{issue_number}/comments, and--reasonnames the body fieldstate_reasonofPATCH /repos/{owner}/{repo}/issues/{issue_number}. (best practice) [sources: src/devops_cli/github/client.py:1002, src/devops_cli/github/client.py:1007, src/devops_cli/core/passthrough.py:202]- Chosen: Each field entry carries its own method and path.
gh issue closesends a PATCH and a POST comment, so one command route cannot name both fields. - Rejected: One route for each command. It cannot name the
bodyfield of the comment route. - Rejected: One entry for each route of a command. The devops path is the key, so two entries would need a second key.
- Chosen: Each field entry carries its own method and path.
- Which owned options name no query or body field?:
--repofills the path parameters{owner}and{repo}.--jsonand--jqchange only the output.--workflowselects the workflow runs route, and--projectlinks a project, so neither names a query or body field of the command route. The table maps these options to no query or body field, and the hint names no field for them. [sources: src/devops_cli/core/passthrough.py:76, src/devops_cli/core/passthrough.py:97, src/devops_cli/core/passthrough.py:132, src/devops_cli/github/client.py:901]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 29, 2026
Both use ADR 0026 API route naming, but #5232 renames CLI commands while the candidate builds a route table for error proposals.devops-cli-service commentedon Nov 29, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.