Skip to content

feat(cloudflare): cloudflare commands take the API route names #5232

Open

Description

@dan-petty

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: cloudflare/client.py and cloudflare/cloudflare_plans.py.

devops command Route
`cloudflare dns list sync
`cloudflare tunnel routes sync`
`cloudflare access status sync

The pinned cloudflared uses tunnel route for DNS, IP and load-balancer routes, which is another thing than ingress configurations. -f is --format in dns list but --force in dns delete. Loki holds no usage error for this group in the 7 days to 2026-11-12.

Proposed Solution & Architectural Design

  • Rename to cloudflare dns-records list|sync|delete, cloudflare tunnel configurations get|sync, cloudflare access apps list|sync and cloudflare access apps policies list <app_id>. The parents zones/{zone_id} and accounts/{account_id} give no word, and cfd_tunnel gives tunnel (ADR 0026).
  • --zone-id, --account-id, --type and --name keep the names of the route fields.
  • sync reads the wanted state and sends several requests, so it is a project verb.
  • cloudflare status stays a project verb, because it reads two routes (user/tokens/verify, zones/{zone_id}).
  • dns-records delete --force loses the short form -f, so -f means only --format in the group.
  • feat(gh): gh status, label list and secret list run gh #5228 already removes cloudflare service-status.
  • Add cloudflare to the groups of tests/commands/test_api_command_names.py.

Target Subsystem

Cloudflare (devops cloudflare).

Existing Tool Considered

The Cloudflare API v4 reference gives the names. Nothing is built.

Acceptance Criteria

  • devops cloudflare dns-records list --dry-run prints GET /zones/<zone_id>/dns_records and sends 0 requests.
  • devops cloudflare dns list and devops cloudflare tunnel routes exit 2.
  • tests/commands/test_api_command_names.py passes for cloudflare.
  • devops docs check passes.

Dependencies

Merge first: #5228. Open the pull request after the pull request of #5231 merges (generated command reference, the API name test).

Source: #5223

Alternatives check of 2026-11-29: none.
Tool: none found.
Reason: Searches for OpenAPI-to-CLI naming generators and Cloudflare endpoint references returned only unrelated documentation; no open tool renames a project's own Typer commands, so nothing covers the need.

Lacks:

  • Renaming cloudflare dns to dns-records with list, sync, delete
  • Nesting tunnel configurations get and sync under tunnel
  • Nesting access apps list, sync and policies list under apps
  • Dropping the -f alias of --force in the group
  • Updating the generated CLI reference and the API name test

Proposed design

Problem statement

The devops cloudflare group names commands after internal words, not the API routes. A command does not show which route it calls. -f means --format in one command and --force in another. The change renames the commands to the route words, keeps sync and status as project verbs, and drops the -f alias of --force.

Acceptance criteria

Requirement: DNS record command group

The devops cloudflare group SHALL hold the DNS record commands under dns-records as list, sync and delete.

Scenario: DNS record command list

  • WHEN a test reads the commands of the devops cloudflare dns-records group
  • THEN the group holds list, sync and delete.

Requirement: DNS record list dry run

The cloudflare dns-records list command SHALL print the GET /zones/<zone_id>/dns_records route and send no HTTP request in a dry run.

Scenario: Dry run of the DNS record list

  • WHEN a test runs devops cloudflare dns-records list --zone-id <zone_id> --dry-run
  • THEN the command exits 0, prints GET /zones/<zone_id>/dns_records and sends 0 requests.

Requirement: Old DNS group rejected

The cloudflare group MUST reject the removed dns group with a usage error.

Scenario: Removed dns group

  • WHEN a test runs devops cloudflare dns list, devops cloudflare dns sync and devops cloudflare dns delete
  • THEN each command exits 2.

Requirement: Tunnel configuration read

The cloudflare tunnel group SHALL hold configurations get for the tunnel configurations route.

Scenario: Dry run of tunnel configurations get

  • WHEN a test runs devops cloudflare tunnel configurations get --account-id <account_id> --tunnel-id <tunnel_id> --dry-run
  • THEN the command exits 0 and prints GET /accounts/<account_id>/cfd_tunnel/<tunnel_id>/configurations.

Requirement: Tunnel configuration write

The cloudflare tunnel configurations sync command SHALL send a PUT request to the tunnel configurations route.

Scenario: Dry run of tunnel configurations sync

  • WHEN a test runs devops cloudflare tunnel configurations sync --account-id <account_id> --tunnel-id <tunnel_id> --dry-run
  • THEN the command exits 0 and prints PUT /accounts/<account_id>/cfd_tunnel/<tunnel_id>/configurations.

Requirement: Old tunnel commands rejected

The cloudflare tunnel group MUST reject the removed routes and sync commands with a usage error.

Scenario: Removed tunnel commands

  • WHEN a test runs devops cloudflare tunnel routes and devops cloudflare tunnel sync
  • THEN each command exits 2.

Requirement: Access app command group

The cloudflare access apps group SHALL hold list and sync for the access applications route.

Scenario: Access app command list

  • WHEN a test reads the commands of the devops cloudflare access apps group
  • THEN the group holds list and sync.

Requirement: Access app list dry run

The cloudflare access apps list command SHALL print the GET /accounts/<account_id>/access/apps route in a dry run.

Scenario: Dry run of access apps list

  • WHEN a test runs devops cloudflare access apps list --account-id <account_id> --dry-run
  • THEN the command exits 0 and prints GET /accounts/<account_id>/access/apps.

Requirement: Access policies nest under app

The cloudflare access apps policies list command SHALL take the app id as its argument.

Scenario: Dry run of access policies list

  • WHEN a test runs devops cloudflare access apps policies list <app_id> --account-id <account_id> --dry-run
  • THEN the command exits 0 and prints GET /accounts/<account_id>/access/apps/<app_id>/policies.

Requirement: Old access commands rejected

The cloudflare access group MUST reject the removed status, sync and policies commands with a usage error.

Scenario: Removed access commands

  • WHEN a test runs devops cloudflare access status, devops cloudflare access sync and devops cloudflare access policies
  • THEN each command exits 2.

Requirement: Force has no short form

The cloudflare dns-records delete command MUST keep --force with no short form, so that -f means --format only in the group.

Scenario: Short form of force

  • WHEN a test reads the parameters of the dns-records delete command
  • THEN --force declares no short form and no parameter of the command binds -f.

Requirement: Format short form

The cloudflare dns-records list command SHALL keep -f as the short form of --format.

Scenario: Short form of format

  • WHEN a test reads the parameters of the dns-records list command
  • THEN --format declares -f.

Requirement: Route field option names

The cloudflare commands SHALL keep the route field names --zone-id, --account-id, --tunnel-id, --type and --name as option names.

Scenario: Route field options

  • WHEN a test reads the options of the dns-records, tunnel configurations and access apps commands
  • THEN the dns-records commands hold --zone-id, --type and --name, the tunnel configurations commands hold --account-id and --tunnel-id, and the access apps commands hold --account-id.

Requirement: Status stays a project verb

The cloudflare group SHALL keep status as a project verb because it reads the token verify route and the zone route.

Scenario: Status in the command list

  • WHEN a test reads the commands of the devops cloudflare group
  • THEN status is present.

Requirement: Cloudflare command tests pass

The change SHALL keep the Cloudflare command tests passing after the rename.

Scenario: Cloudflare command tests

  • WHEN a test runs uv run pytest tests/commands/test_cloudflare_commands.py tests/commands/test_cloudflare_dry_run.py
  • THEN the run passes.

Requirement: Generated command reference current

The change SHALL keep docs/CLI_REFERENCE.md current with the renamed commands.

Scenario: Docs check

  • WHEN a test runs uv run devops docs check
  • THEN the command exits 0.

Existing Tool Considered

The alternatives check of 2026-11-19 in the issue body records verdict none and names no tool. No open, maintained tool or library covers the rename. The change renames the project's own cloudflare commands, so it builds no code of its own and has no build cost.

Key questions

  • Which words name the DNS record command group?: Use cloudflare dns-records. The route segment dns_records gives the noun. A hyphen joins its words. The parent zones/{zone_id} gives no word. (best practice) [sources: src/devops_cli/cloudflare/client.py, src/devops_cli/cloudflare/dns.py]
    • Chosen: dns-records. The route segment dns_records gives the noun, and a hyphen joins its words.
    • Rejected: dns. It drops the records word that the route gives, so the command does not show the route.
    • Rejected: zones dns-records. The route parent zones/{zone_id} is an identifier, and the body says it gives no word.
  • Which command names should the tunnel configuration route use?: Use cloudflare tunnel configurations get for the read. Use cloudflare tunnel configurations sync for the write. The path segment configurations gives the noun. One object gives get. sync sends several requests. (best practice) [sources: src/devops_cli/cloudflare/client.py, src/devops_cli/cloudflare/cloudflare_plans.py]
    • Chosen: tunnel configurations get|sync. The path segment configurations gives the noun, one object gives get, and sync sends several requests.
    • Rejected: tunnel routes|sync. tunnel route in the pinned cloudflared names DNS, IP and load-balancer routes, not ingress configurations.
    • Rejected: tunnel config get|sync. The route segment is configurations, and the command name takes the route words.
  • Where do the access policy commands sit, and how does the command take the app id?: Use cloudflare access apps policies list <app_id>. The route nests policies under apps/{app_id}. apps is the parent command. The app id is a positional argument. (best practice) [sources: src/devops_cli/cloudflare/client.py:777, src/devops_cli/commands/cloudflare.py:772]
    • Chosen: access apps policies list <app_id>. The route nests the policies under the app, so the parent gives the noun and the id is an argument.
    • Rejected: access policies list --app-id. The flat form drops the apps parent that the route gives.
  • Does dns-records delete keep -f for --force?: No. --force keeps its long form only. -f means --format in every command of the group. (best practice) [sources: src/devops_cli/commands/cloudflare.py, tests/commands/test_cloudflare_commands.py]
    • Chosen: Drop the -f alias of --force. -f is --format in dns-records list, so one group would give one short form two meanings.
    • Rejected: Keep -f for --force. A wrong action follows when a user types -f for the format and gets a forced delete.
  • Is sync a project verb for the DNS record, tunnel configuration and access app commands?: Yes. Each sync command reads the wanted state and sends several requests. No single route verb names it. (best practice) [sources: src/devops_cli/cloudflare/cloudflare_plans.py, tests/cloudflare/test_dns.py]
    • Chosen: Keep sync as a project verb. One command sends several requests, so the route verbs create and update would not name it.
    • Rejected: Name each command after one route verb. The command sends more than one request, so a single route verb is wrong.
  • Does cloudflare status stay a project verb?: Yes. It reads the user/tokens/verify route and the zones/{zone_id} route. No single route names it. (best practice) [sources: src/devops_cli/commands/cloudflare.py, src/devops_cli/cloudflare/client.py]
    • Chosen: Keep status. It reports one summary from two routes, and the group keeps one project verb.
    • Rejected: Split it into tokens verify and zones get. Two route-named commands replace one summary and change what the command reports.
  • Do the route field names stay as option names?: Yes. --zone-id, --account-id, --tunnel-id, --type and --name keep the names of the route fields. (best practice) [sources: src/devops_cli/cloudflare/client.py, src/devops_cli/commands/cloudflare.py]
    • Chosen: Keep the route field names. The option names match the API fields and avoid a second vocabulary.
    • Rejected: Shorten the option names. A short name hides which route field the option sets.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Moved to new items

#7299

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/feature
    scope/cloudflare
    status/new
    value/medium
    effort/medium
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 12, 2026
  5. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 4d085f1 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.

  6. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    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 (3)

    Searches run:

    • generate CLI commands from OpenAPI routes tool, results: 5
    • Cloudflare API v4 dns_records cfd_tunnel configurations access apps policies, results: 5
    • lint CLI command names match REST API route segments, results: 5

    Sources:

  7. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Owner question: See Suspected block in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  8. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    Owner question: See Suspected block in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  9. added
    status/ready
    and removed
    status/new
    on Nov 26, 2026
  10. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/cloudflaresource/agentstatus/readytype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions