Repository navigation
Description
Problem or Motivation
The owner asked on 2026-11-12 that a devops command on an HTTP API take its names from the API routes (ADR 0026, #5223). Sources: grafana/client.py and prometheus/client.py.
| devops command | Route | Mismatch |
|---|---|---|
grafana alerts |
GET /api/v1/provisioning/alert-rules |
The resource is alert rules. Grafana serves firing alerts at another route. |
grafana dashboards export <uid> |
GET /api/dashboards/uid/{uid} |
GET of one dashboard |
grafana dashboards import <file> |
POST /api/dashboards/db (Create / Update dashboard) |
Grafana has a route POST /api/dashboards/import with another meaning. |
grafana datasources |
GET /api/datasources |
A collection with no list |
prometheus rules, prometheus targets |
GET /api/v1/rules, GET /api/v1/targets |
Collections with no list |
These commands already match their routes: grafana search, grafana dashboards list, prometheus query and prometheus query-range. Loki holds no usage error for these groups in the 7 days to 2026-11-12.
Proposed Solution & Architectural Design
- Rename to
grafana alert-rules list,grafana dashboards get <uid> [-o <file>],grafana dashboards update <file>,grafana datasources list,prometheus rules listandprometheus targets list. dashboards update: the command sendsoverwrite: true(grafana/client.py:80-81,122), so the operation is an upsert, which ADR 0026 namesupdate. The segmentsuidanddbgive no word (key selector and storage form).dashboards sync,dashboards lintandprometheus analyzestay project verbs: they read files or send several reads.- Change the MCP rows of the renamed commands.
grafana dashboards listandprometheus querydo not change. - Add
grafanaandprometheusto the groups oftests/commands/test_api_command_names.py.
Target Subsystem
Monitoring (devops grafana, devops prometheus).
Existing Tool Considered
The Grafana and Prometheus HTTP API references give the names. Nothing is built.
Acceptance Criteria
devops grafana alert-rules list --dry-runprintsGET /api/v1/provisioning/alert-rulesand sends 0 requests.devops grafana alerts,devops grafana dashboards exportanddevops grafana dashboards importexit 2.devops prometheus rules list --dry-runprintsGET /api/v1/rules.tests/commands/test_api_command_names.pypasses for both groups.devops docs checkpasses.
Dependencies
Open the pull request after the pull request of #5230 merges (generated command reference, CONST_MCP_EXPOSURE_TABLE, the API name test).
Source: #5223
Alternatives check of 2026-11-29: none.
Tool: none found.
Reason: Searches returned only Grafana container images and generic API pages, no open tool that renames this project's own grafana and prometheus Typer command paths to route names; the work edits existing command modules.
Lacks:
- Route-named command paths for grafana and prometheus groups
- Dry run that prints the route and sends no request
- Removal of the old grafana alerts, export and import paths
Proposed design
Problem statement
Rename the devops grafana and devops prometheus command paths that do not match their HTTP API routes. ADR 0037 requires this, and the issue body names ADR 0026 by mistake. Remove the old Grafana paths and keep the commands that already match or read files. Update the MCP exposure table and the generated command reference.
Acceptance criteria
Requirement: Grafana alert-rules list
The devops grafana alert-rules list command SHALL read the Grafana alert-rules route.
Scenario: Dry run prints the alert-rules route
- WHEN A test runs
uv run devops grafana alert-rules list --dry-run. - THEN The command exits 0, prints a GET request whose target ends in
/api/v1/provisioning/alert-rules, and sends 0 HTTP requests.
Requirement: Grafana dashboards get
The devops grafana dashboards get <uid> command SHALL read one dashboard by UID and write it to the file of -o.
Scenario: Get sends the item route
- WHEN A test runs
uv run devops grafana dashboards get abc123 -o out.jsonagainst a fake Grafana server. - THEN The command sends
GET /api/dashboards/uid/abc123and writes the dashboard JSON toout.json.
Requirement: Grafana dashboards update
The devops grafana dashboards update <file> command SHALL create or replace a dashboard.
Scenario: Update sends overwrite true
- WHEN A test runs
uv run devops grafana dashboards update dashboard.jsonagainst a fake Grafana server. - THEN The command sends
POST /api/dashboards/dbwithoverwritetrue in the request body.
Requirement: Grafana datasources list
The devops grafana datasources list command SHALL read the data sources collection.
Scenario: Data sources list sends the collection route
- WHEN A test runs
uv run devops grafana datasources listagainst a fake Grafana server. - THEN The command sends
GET /api/datasourcesand prints the data sources.
Requirement: Prometheus rules list
The devops prometheus rules list command SHALL read the Prometheus rules route.
Scenario: Dry run prints the rules route
- WHEN A test runs
uv run devops prometheus rules list --dry-run. - THEN The command exits 0, prints a GET request whose target ends in
/api/v1/rules, and sends 0 HTTP requests.
Requirement: Prometheus targets list
The devops prometheus targets list command SHALL read the Prometheus targets route.
Scenario: Targets list sends the targets route
- WHEN A test runs
uv run devops prometheus targets listagainst a fake Prometheus server. - THEN The command sends
GET /api/v1/targetsand prints the targets.
Requirement: Removed Grafana command paths
The old paths devops grafana alerts, devops grafana dashboards export and devops grafana dashboards import MUST exit with code 2.
Scenario: Removed Grafana command paths fail
- WHEN A test runs each old path with the arguments that the old command accepted.
- THEN Each command exits with code 2 and prints no request.
Requirement: Retained command paths
The commands grafana search, grafana dashboards list, grafana dashboards sync, grafana dashboards lint, prometheus query, prometheus query-range and prometheus analyze MUST keep their current paths.
Scenario: Retained command paths answer help
- WHEN A test runs
--helpfor each of these seven paths. - THEN Each command exits with code 0.
Requirement: MCP exposure table
CONST_MCP_EXPOSURE_TABLE MUST name no removed monitoring path and MUST name a new path wherever it named an old path.
Scenario: MCP exposure table test passes
- WHEN A test runs
uv run pytest tests/ai/mcp/test_mcp_exposure_table.py. - THEN The test passes, because no entry names a command that the rename removed.
Requirement: API command name test
tests/commands/test_api_command_names.py SHALL cover the renamed commands of the grafana and prometheus groups whose route gives the new path.
Scenario: API command name test passes for both groups
- WHEN A test runs
uv run pytest tests/commands/test_api_command_names.py -k 'grafana or prometheus'. - THEN The test passes for the five covered commands of the two groups.
Requirement: Dry-run class ratchet
Each renamed monitoring command MUST keep the dry-run class that its old path had.
Scenario: Dry-run class ratchet passes
- WHEN A test runs
uv run pytest tests/invariants/test_dry_run_class_ratchet.py. - THEN The test passes with the renamed command paths.
Requirement: Generated command reference
The generated command reference MUST name the renamed commands and MUST NOT name a removed path.
Scenario: Documentation check passes
- WHEN A test runs
uv run devops docs check. - THEN The command exits with code 0.
Existing Tool Considered
No open, maintained tool or library covers the need. The alternatives check of 2026-11-29 in the issue body records verdict none with no tool, and lists what a tool would lack. The change renames paths in existing command modules and builds no code, so it has no build cost.
Key questions
- Which project record requires an API-based command to take its HTTP API route names?: ADR 0037 records the owner request of 2026-11-12 in feat(cli): tool commands pass unknown arguments to the tool #5223: a command for an API-based tool takes the names of the API route. The issue body cites ADR 0026, which records GitHub settings in OpenTofu. [sources: docs/adr/0037-tool-commands-mirror-and-pass-through-options.md, docs/adr/0026-github-settings-are-opentofu-code-the-owner-applies.md]
- Which name does the dashboard write command take:
import,createorupdate?: Useupdate. The client setsoverwritetrue onPOST /api/dashboards/db, so the call creates or replaces a dashboard.importnames a different Grafana route. (best practice) [sources: src/devops_cli/grafana/client.py, src/devops_cli/commands/grafana.py, docs/adr/0037-tool-commands-mirror-and-pass-through-options.md]- Chosen: update. The call sets
overwritetrue, so it creates or replaces a dashboard. - Rejected: create. The call can replace an existing dashboard, so
createalone is wrong. - Rejected: import. Grafana serves
POST /api/dashboards/importwith another meaning.
- Chosen: update. The call sets
- Which name does the single-dashboard read command take:
exportorget?: Useget. The routeGET /api/dashboards/uid/{uid}reads one dashboard by UID, and the name test maps GET of an item route toget. The-o <file>option writes the result to a file. (best practice) [sources: tests/commands/test_api_command_names.py, src/devops_cli/grafana/client.py, src/devops_cli/commands/grafana.py]- Chosen: get. The route reads one dashboard by UID, and the name test maps an item GET to
get. - Rejected: export.
exportnames a file write and not the API read.
- Chosen: get. The route reads one dashboard by UID, and the name test maps an item GET to
- Do the collection commands take a
listsubcommand?: Addlist. The name test maps GET of a collection route tolist, andgrafana dashboards listalready uses this form. (best practice) [sources: tests/commands/test_api_command_names.py, src/devops_cli/commands/grafana.py, src/devops_cli/commands/prometheus.py]- Chosen: add list. A collection read is a list, and
grafana dashboards listalready uses this form. - Rejected: keep the bare name. A bare name hides the read operation and breaks the group pattern.
- Chosen: add list. A collection read is a list, and
- Which monitoring command paths stay as they are?:
grafana search,grafana dashboards list,grafana dashboards sync,grafana dashboards lint,prometheus query,prometheus query-rangeandprometheus analyzestay. These commands read files, send several reads, or already name their route. (best practice) [sources: src/devops_cli/commands/grafana.py, src/devops_cli/commands/prometheus.py, docs/adr/0037-tool-commands-mirror-and-pass-through-options.md]- Chosen: keep the seven paths. No single API route names sync, lint or analyze, and the body keeps query and query-range.
- Rejected: rename all seven to route names. No single route names the file reads and the multi-read commands.
- Which monitoring commands join
COVERED_API_COMMANDSof the API command name test?: Add the five commands whose route gives the new path: alert-rules list, dashboards get, datasources list, rules list and targets list.POST /api/dashboards/dbderivesdevops grafana db create, so a test intests/commands/test_grafana.pyasserts thedashboards updatepath and its request instead. (best practice) [sources: tests/commands/test_api_command_names.py, tests/commands/test_grafana.py]- Chosen: cover the five matching commands. Each of the five route targets derives the new command path.
- Rejected: cover all six with an override in the derivation. It changes the shared derivation of feat(argo): argo cd commands take the Argo CD route names #5230 for one route.
- Rejected: cover no monitoring command. The body asks for both groups in the test.
- Do the old Grafana command paths stay as aliases after the rename?: Remove the old paths.
devops grafana alerts,devops grafana dashboards exportanddevops grafana dashboards importexit with code 2, as the removed Argo CD paths do. (best practice) [sources: docs/adr/0037-tool-commands-mirror-and-pass-through-options.md, tests/commands/test_api_command_names.py]- Chosen: remove the old paths. The route name is the only command name, so the old path exits with code 2.
- Rejected: keep aliases. An alias keeps a name that does not match the route and hides the rename.
- Which rows of
CONST_MCP_EXPOSURE_TABLEchange?: The table keeps itsgrafana dashboards listandprometheus queryrows. Each row that names a renamed path takes the new path.tests/ai/mcp/test_mcp_exposure_table.pyfails on an entry that names no command of the tree. [sources: src/devops_cli/config/constants.py:306, tests/ai/mcp/test_mcp_exposure_table.py] - Does this item still wait on feat(argo): argo cd commands take the Argo CD route names #5230?: No.
tests/commands/test_api_command_names.pyexists at this commit and coversargo cd applicationsand the removedargo cd appspaths, which feat(argo): argo cd commands take the Argo CD route names #5230 delivered. [sources: tests/commands/test_api_command_names.py, docs/CLI_REFERENCE.md]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 12, 2026
Both items implement ADR 0026 (#5223) but for different tools: this item renames grafana and prometheus API commands, while #5228 renames gh CLI commands.devops-cli-service commentedon Nov 17, 2026
Refine cannot set this item to Ready at 90a3d2a 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 19, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (4)
Searches run:
Sources:
devops-cli-service commentedon Nov 21, 2026
Owner question: See Suspected block in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 26, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
devops-cli-service commentedon Nov 29, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
devops-cli-service commentedon Nov 29, 2026
Released in v0.248.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.248.0
devops-cli-service commentedon Nov 29, 2026
Live since 2026-11-29 16:50 UTC