Skip to content

feat(vault): vault commands take the Vault API route names #5234

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). The project pins no vault CLI and no bao CLI, so devops vault is an API command. Sources: commands/vault.py, security/vault_plans.py and config/constants.py.

devops command Route
vault status GET /v1/sys/health
vault get <path> --key GET /v1/<path> (Vault: read)
vault set <path> k=v POST /v1/<path> (Vault: write)
vault leases --revoke <id> POST /v1/sys/leases/revoke. The action is in an option.
vault logout POST /v1/auth/token/revoke-self
vault audit The local devops audit trail. In Vault, sys/audit means audit devices.

Loki holds no usage error for this group in the 7 days to 2026-11-12.

Proposed Solution & Architectural Design

  • Rename to vault health, vault read <path>, vault write <path> k=v and vault leases revoke <lease_id>. vault logout becomes the command revoke-self in the group vault token. The mounts /v1/sys and /v1/auth are base paths, so they give no word. The route /v1/<path> has no fixed word, so the Vault names of its operations, read and write, are the verbs (ADR 0026).
  • vault login --method already matches POST /v1/auth/{method}/login: the config gives method by default, so it is an option. --role-id and --secret-id match the body fields.
  • The local trail becomes vault audit-log, a word that no Vault route uses.
  • vault sync stays a project verb: it copies Vault into the keyring.
  • Change the MCP rows vault get (to vault read) and vault status (to vault health).
  • Add vault to the groups of tests/commands/test_api_command_names.py.
  • Premise check: list the callers of vault get and vault set in documents, the Makefile, k8s/ and the skills, and change them.

Target Subsystem

Secrets (devops vault).

Existing Tool Considered

The Vault HTTP API reference gives the names. Nothing is built.

Acceptance Criteria

  • devops vault read secret/data/x --dry-run prints GET /v1/secret/data/x and sends 0 requests.
  • devops vault leases revoke <id> --dry-run prints POST /v1/sys/leases/revoke.
  • devops vault get and devops vault status exit 2.
  • tests/commands/test_api_command_names.py passes for vault.
  • devops docs check passes.

Dependencies

Open the pull request after the pull request of #5232 merges (generated command reference, CONST_MCP_EXPOSURE_TABLE, the API name test).

Source: #5223

Alternatives check of 2026-11-19: none.
Tool: none found.
Reason: Searches found no open, maintained tool or library that renames CLI commands or derives command names from API routes; the HashiCorp Vault CLI is a client for Vault, not a tool that renames this project's Typer commands, MCP rows, docs and tests.

Lacks:

  • Renaming existing Typer command names from API routes
  • Updating MCP exposure rows and generated command reference
  • Changing callers in docs, Makefile, k8s and skills

Proposed design

Problem statement

The devops vault commands use names that do not match the Vault API routes: status, get, set, logout and audit. The owner asked on 2026-11-12 that a devops command on an HTTP API take its names from the routes. Rename them to health, read, write, token revoke-self and audit-log. Update the MCP rows, the documents and the tests.

Acceptance criteria

Requirement: Health command name

The vault command group SHALL name its health command health, after the route GET /v1/sys/health.

Scenario: Health command requests sys health

  • WHEN devops vault health --addr http://example.com:8200 runs in tests/commands/test_vault_cmd.py with a fake Vault
  • THEN The command requests GET /v1/sys/health and exits 0.

Requirement: Read command name

The vault command group SHALL name its read command read and SHALL keep the option --key.

Scenario: Dry run of vault read

  • WHEN devops vault read secret/data/x --dry-run runs in tests/commands/test_vault_cmd.py
  • THEN The output holds GET /v1/secret/data/x and the command sends 0 requests.

Requirement: Read key option

The vault read command SHALL keep the option --key.

Scenario: Read one field with a key

  • WHEN devops vault read secret/data/x --key token --show runs in tests/commands/test_vault_cmd.py with a fake Vault that returns token with value value
  • THEN The output holds token (from vault): value and the command exits 0.

Requirement: Write command name

The vault command group SHALL name its write command write and SHALL take the field pairs k=v as arguments.

Scenario: Dry run of vault write

  • WHEN devops vault write secret/data/x k=v --dry-run runs in tests/commands/test_vault_cmd.py
  • THEN The output holds POST /v1/secret/data/x and the command sends 0 requests.

Requirement: Leases revoke subcommand

The vault leases group SHALL hold the subcommand revoke and SHALL NOT hold the option --revoke.

Scenario: Dry run of vault leases revoke

  • WHEN devops vault leases revoke lease-1 --dry-run runs in tests/commands/test_vault_cmd.py
  • THEN The output holds POST /v1/sys/leases/revoke and the command sends 0 requests.

Requirement: Removed leases option

The vault leases group SHALL refuse the option --revoke.

Scenario: Old leases option exits 2

  • WHEN devops vault leases --revoke lease-1 runs in tests/commands/test_vault_cmd.py
  • THEN The command exits with code 2.

Requirement: Token revoke-self command

The command vault logout SHALL become revoke-self in the group vault token.

Scenario: Token revoke-self sends the revoke request

  • WHEN devops vault token revoke-self runs in tests/commands/test_vault_cmd.py with a fake Vault and a usable token
  • THEN The command requests POST /v1/auth/token/revoke-self and exits 0.

Requirement: Removed command names

The names get, set, status and logout SHALL NOT stay as commands of the group vault.

Scenario: Removed names exit 2

  • WHEN devops vault get, devops vault status, devops vault set p k=v and devops vault logout run in tests/commands/test_vault_cmd.py
  • THEN Each command exits with code 2.

Requirement: Local audit trail name

The command of the local devops audit trail SHALL be named audit-log.

Scenario: Audit log name

  • WHEN devops vault --help runs in tests/commands/test_vault_cmd.py
  • THEN The output lists audit-log and holds no command named audit.

Requirement: Project verb sync kept

The command vault sync SHALL keep its name and its behavior.

Scenario: Dry run of vault sync

  • WHEN devops vault sync secret/data/x --dry-run runs in tests/commands/test_vault_cmd.py
  • THEN The command exits 0 and sends 0 requests.

Requirement: MCP rows take the new names

The vault rows of CONST_MCP_EXPOSURE_TABLE SHALL take the command paths vault read and vault health.

Scenario: Exposure table rows

  • WHEN uv run pytest tests/ai/mcp/test_mcp_exposure_table.py runs after the exposure table changes
  • THEN The test passes with no row named vault_get or vault_status, and with rows named vault_read and vault_health.

Requirement: API name test covers vault

The group vault SHALL be a case of tests/commands/test_api_command_names.py.

Scenario: API name test for vault

  • WHEN uv run pytest tests/commands/test_api_command_names.py -k vault runs
  • THEN The test passes.

Requirement: Generated command reference

The change SHALL leave the generated command reference equal to the output of its generator.

Scenario: Docs check

  • WHEN uv run devops docs check runs after the reference regenerates
  • THEN The command exits 0.

Existing Tool Considered

The alternatives check of 2026-11-19 in the issue body returned none; see its block for the searches and the lacks. No open, maintained tool or library covers the need. The change edits existing Typer commands, the MCP exposure table, the generated command reference and their callers. It builds no new module to keep and fix, so it has no token or elapsed-time cost for new code.

Key questions

  • Which names do the operations of the route /v1/<path> take?: The command names are read for GET and write for POST. The route has no fixed path word, so the Vault names of its two operations give the verbs. (best practice) [sources: src/devops_cli/commands/vault.py, tests/commands/test_vault_cmd.py]
    • Chosen: read and write. The Vault API names the two operations of /v1/<path> read and write. The route gives no other word.
    • Rejected: get and set. The Vault API names no get or set operation on this route. The words do not come from the route.
    • Rejected: kv get and kv put. The group covers every mount, not only the KV secrets engine. A KV word is too narrow.
  • Does the mount word sys or auth stay in a command name?: No. /v1/sys and /v1/auth are base paths. status becomes health and logout becomes token revoke-self. (best practice) [sources: src/devops_cli/commands/vault.py, tests/commands/test_vault_cmd.py]
    • Chosen: Drop the mount word. A base path gives no word of the operation. The body records this rule for /v1/sys and /v1/auth.
    • Rejected: Keep sys and auth in the names. The words repeat the mount on each command and add nothing to the operation name.
  • Which name does the local audit trail take?: vault audit-log. In Vault, sys/audit means audit devices. A command named audit would read as that route. (best practice) [sources: src/devops_cli/commands/vault.py]
    • Chosen: audit-log. No Vault route uses audit-log, so the name reads as the local devops trail and not as sys/audit.
    • Rejected: audit. sys/audit names audit devices in Vault. The name reads as a Vault route that the command does not call.
    • Rejected: logs. The word is too broad. It reads as each log of the project, not only the local audit trail.
  • Does vault logout become vault token revoke-self?: Yes. The route POST /v1/auth/token/revoke-self gives token and revoke-self. /v1/auth is a base path. (best practice) [sources: tests/commands/test_vault_cmd.py, src/devops_cli/commands/vault.py]
    • Chosen: token revoke-self. The name takes each word of the route after the base path. The action is the subcommand.
    • Rejected: Keep logout. No Vault route names logout. The name does not come from the API.
    • Rejected: revoke-self at the top level. The name drops the token word of the route.
  • How does the leases revoke action become a command?: The group vault leases holds the subcommand revoke. The lease id is its argument. The route POST /v1/sys/leases/revoke gives the word revoke. (best practice) [sources: tests/commands/test_vault_cmd.py, src/devops_cli/commands/vault.py]
    • Chosen: Subcommand leases revoke. The route ends in the action word revoke. A subcommand puts the action in the command path.
    • Rejected: Keep the option --revoke. The action stays an option. The command path does not take the route name.
    • Rejected: Top-level vault revoke. The name drops the leases word of the route.
  • Does vault login keep its current form?: Yes. The route POST /v1/auth/{method}/login gives login. The config supplies method by default, so --method stays an option. --role-id and --secret-id match body fields. (best practice) [sources: tests/commands/test_vault_cmd.py, src/devops_cli/commands/vault.py]
    • Chosen: Keep vault login --method. The command name is the route word. The method has a config default, so it stays an option.
    • Rejected: Rename to vault auth login. /v1/auth is a base path. It gives no word of the operation.
  • Does vault sync keep its name?: Yes. It copies Vault into the keyring. No Vault route covers that work, so it stays a project verb. (best practice) [sources: tests/commands/test_vault_cmd.py, src/devops_cli/commands/vault.py]
    • Chosen: Keep vault sync. The command copies Vault into the keyring. No API route names that work.
    • Rejected: Rename it to a route name. No route covers the keyring copy. A route name would state a request that the command does not send.
  • How do the MCP rows of the group change?: The rows follow their command paths: vault_get becomes vault_read and vault_status becomes vault_health. [sources: src/devops_cli/config/constants.py:306, tests/ai/mcp/test_mcp_exposure_table.py, src/devops_cli/ai/mcp/generator.py]

Fit

Fits in one pull request.

Suspected block

A person must remove one edge of the dependency cycle #5234 -> #5232 -> #5228 -> #5234 before work starts.
The item is in a dependency cycle: #5234 → #5232 → #5231 → #5230 → #5229 → #5234. A person removes one edge of the cycle, so that its items no longer wait on each other.

Dependencies

#5232

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/feature
    scope/vault
    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.

    The next refine round also looks at the item again when a commit on the default branch changes one of these files: src/devops_cli/config/constants.py, docs/CLI_REFERENCE.md.

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

    @devops-cli-service
    Contributor

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

  7. 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 (8)

    Tools considered:

    Searches run:

    • HashiCorp Vault CLI command names reference read write, results: 5
    • generate CLI command names from OpenAPI spec tool, results: 5
    • Vault HTTP API sys/health read write sys/leases/revoke documentation, results: 5
    • openapi-generator-cli generate CLI from OpenAPI python click, results: 5
    • hashicorp vault command line interface github, results: 5
    • python click command rename migration tool, results: 5
    • openapi cli generator, results: 5
    • "vault read" "vault write" CLI reference site:developer.hashicorp.com, results: 5

    Sources:

  8. 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

  9. 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

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/vaultsource/agentstatus/newtype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions