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-29: none.
Tool: none found.
Reason: Searches returned only HashiCorp Vault itself and unrelated pages. The need is renaming this repository's own Typer commands, MCP tables, generated docs and tests, which no external tool or library does.

Lacks:

  • No tool renames this project's Typer commands to route names
  • No tool rewrites the MCP exposure, restriction and confinement tables
  • No tool regenerates the command reference and the OpenSpec specs

Proposed design

Problem statement

The devops vault commands use names that do not match the Vault API routes: status, get, set and logout, and the local audit trail uses audit, a word that Vault uses for audit devices. ADR 0037 records the owner's 2026-11-12 rule that a command for an API-based tool takes the names of the API route. Rename them to health, read, write, token revoke-self and audit-log, and make the leases revoke action a leases revoke subcommand. The rename reaches the MCP exposure table, the MCP parameter restrictions, the path-confinement table, the resource://vault/status resource, the generated command reference, the OpenSpec specs, and the callers in tests, documents, the Makefile, k8s/ and the skills.

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 uv run pytest tests/commands/test_vault_cmd.py -k vault_health runs with a fake Vault
  • THEN The test passes and asserts that devops vault health --addr http://example.com:8200 requests GET /v1/sys/health and exits 0.

Requirement: Read command name

The vault command group SHALL name its read command read.

Scenario: Dry run of vault read

  • WHEN uv run pytest tests/commands/test_vault_cmd.py -k vault_read_dry_run runs
  • THEN The test passes and asserts that devops vault read secret/data/x --dry-run prints GET /v1/secret/data/x and sends 0 requests.

Requirement: Read key option

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

Scenario: Read one field with a key

  • WHEN uv run pytest tests/commands/test_vault_cmd.py -k vault_read_key runs with a fake Vault that returns token with value value
  • THEN The test passes and asserts that devops vault read secret/data/x --key token --show prints token (from vault): value and exits 0.

Requirement: Write command name

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

Scenario: Dry run of vault write

  • WHEN uv run pytest tests/commands/test_vault_cmd.py -k vault_write_dry_run runs
  • THEN The test passes and asserts that devops vault write secret/data/x k=v --dry-run prints POST /v1/secret/data/x and 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 uv run pytest tests/commands/test_vault_cmd.py -k leases_revoke_dry_run runs
  • THEN The test passes and asserts that devops vault leases revoke lease-1 --dry-run prints POST /v1/sys/leases/revoke and sends 0 requests.

Requirement: Removed leases option

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

Scenario: Old leases option exits 2

  • WHEN uv run pytest tests/commands/test_vault_cmd.py -k leases_revoke_option_refused runs
  • THEN The test passes and asserts that devops vault leases --revoke lease-1 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 uv run pytest tests/commands/test_vault_cmd.py -k token_revoke_self runs with a fake Vault and a usable token
  • THEN The test passes and asserts that devops vault token revoke-self 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 uv run pytest tests/commands/test_vault_cmd.py -k removed_vault_names runs
  • THEN The test passes and asserts that devops vault get, devops vault status, devops vault set p k=v and devops vault logout each exit 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 uv run pytest tests/commands/test_vault_cmd.py -k vault_audit_log_help and uv run pytest tests/commands/test_cli_format_adoption.py -k vault run
  • THEN The tests pass and assert that devops vault --help lists audit-log, holds no command named audit, and the value-command table names vault audit-log.

Requirement: Project verb sync kept

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

Scenario: Dry run of vault sync

  • WHEN uv run pytest tests/commands/test_vault_cmd.py -k vault_sync_dry_run runs
  • THEN The test passes and asserts that devops vault sync secret/data/x --dry-run exits 0 and sends 0 requests.

Requirement: Dry-run class table follows the renamed commands

The dry-run class table SHALL name vault read, vault write, vault health, vault leases revoke, vault token revoke-self and vault audit-log.

Scenario: Dry-run class declarations

  • WHEN uv run pytest tests/commands/test_valkey_vault_dry_run.py runs
  • THEN The test passes and asserts that the six renamed vault commands carry their dry-run classes and that the old command paths are gone.

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 and tool listing

  • WHEN uv run pytest tests/ai/mcp/test_mcp_exposure_table.py tests/ai/mcp/test_mcp_tool_listing.py runs after the exposure table changes
  • THEN The tests pass; the table holds ("vault", "read") and ("vault", "health") and no row that names a command the tree lacks, and the tool listing names vault_read and vault_health and no vault_get or vault_status.

Requirement: MCP parameter restrictions follow the new paths

The path restrictions of _PATH_PARAM_RESTRICTIONS SHALL follow the renamed command paths, so vault read publishes no show and vault health publishes no vault_addr.

Scenario: MCP schemas of the renamed vault tools

  • WHEN uv run pytest tests/ai/mcp/test_mcp_tool_secrets.py tests/ai/mcp/test_mcp_tool_registry.py tests/roadmap/stage/test_stage_run_allowlist.py -k vault runs
  • THEN The tests pass and assert that vault_read publishes no show, vault_health publishes no vault_addr, and the allowlist of ("vault", "read") is path, key and dry_run.

Requirement: MCP path confinement names vault read

The NOT_A_FILE_PATH table SHALL name the Vault read tool as vault_read.

Scenario: Path confinement entry for vault read

  • WHEN uv run pytest tests/ai/mcp/test_path_confinement.py runs
  • THEN The test passes and asserts that vault_read.path is recorded as a Vault secret path and that no entry names vault_get.

Requirement: Vault status resource runs the health command

The MCP resource resource://vault/status SHALL run devops vault health.

Scenario: Vault status resource dispatches the health command

  • WHEN uv run pytest tests/ai/mcp/test_mcp_prompts_and_resources.py -k vault runs
  • THEN The test passes and asserts that the resource dispatches uv run devops 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

Requirement: Generated command reference

The change SHALL leave the generated command reference, the MCP tool page and the generated command pages equal to the output of their generator.

Scenario: Docs check

  • WHEN uv run devops docs check runs after uv run devops docs generate
  • THEN The command exits 0.

Requirement: OpenSpec specs follow the new names

The change SHALL update the OpenSpec specs that name the vault commands and MCP tools.

Scenario: OpenSpec check

  • WHEN uv run devops openspec check runs after openspec/specs/command-dry-run-class/spec.md, openspec/specs/mcp-tool-secrets/spec.md, openspec/specs/mcp-tool-path-confinement/spec.md and openspec/specs/vault-status/spec.md take the new names
  • THEN The command exits 0.

Existing Tool Considered

No open, maintained tool or library covers the need. The alternatives check of 2026-11-19 in the issue body returned none; see its block for the searches and the lacks. hashicorp/vault is a client for Vault, not a tool that renames this project's Typer commands, MCP rows, generated documents and tests. The change edits existing Typer commands, the MCP exposure and restriction tables, the path-confinement table, the MCP resource, the generated command reference, the OpenSpec specs 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 record holds the owner's 2026-11-12 rule for API command names?: ADR 0037, 'Tool commands mirror and pass through options', records the rule that a command of an API-based tool takes the names of the API route. ADR 0026 is 'GitHub settings are OpenTofu code the owner applies', so the issue body's citation of ADR 0026 is wrong. [sources: docs/adr/0037-tool-commands-mirror-and-pass-through-options.md:14, docs/adr/README.md:173, docs/adr/README.md:184]
  • Which names do the operations of the route /v1/<path> take?: read for GET and write for POST, the Vault names of the two operations. The route has no fixed path word, so the operation names give the verbs. (best practice) [sources: docs/adr/0037-tool-commands-mirror-and-pass-through-options.md:14, src/devops_cli/security/vault_plans.py:33, src/devops_cli/security/vault_plans.py:44]
    • Chosen: read and write. ADR 0037 gives the route names, and the Vault API names the GET and POST operations of /v1/<path> read and write.
    • 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: docs/adr/0037-tool-commands-mirror-and-pass-through-options.md:14, src/devops_cli/config/constants.py:2522, src/devops_cli/config/constants.py:2523, src/devops_cli/config/constants.py:2524]
    • Chosen: Drop the mount word. A base path gives no word of the operation, and the route constants show sys/health, sys/leases/revoke and auth/token/revoke-self after the base path.
    • 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. The command reads the local devops trail, not a Vault route; 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:560, openspec/specs/command-dry-run-class/spec.md:603]
    • 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: docs/adr/0037-tool-commands-mirror-and-pass-through-options.md:14, src/devops_cli/config/constants.py:2522, src/devops_cli/security/vault_plans.py:103]
    • 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: docs/adr/0037-tool-commands-mirror-and-pass-through-options.md:14, src/devops_cli/config/constants.py:2524, src/devops_cli/security/vault_plans.py:113]
    • 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: src/devops_cli/commands/vault.py:308, src/devops_cli/config/constants.py:2517, src/devops_cli/config/constants.py:2521]
    • 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: src/devops_cli/commands/vault.py:247]
    • 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?: CONST_MCP_EXPOSURE_TABLE rows follow their command paths: ("vault", "get") becomes ("vault", "read") and ("vault", "status") becomes ("vault", "health"); ("vault", "sync") stays. [sources: src/devops_cli/config/constants.py:455, src/devops_cli/config/constants.py:456, src/devops_cli/config/constants.py:457]
  • Which MCP surfaces key on the vault command paths?: The exposure table, _PATH_PARAM_RESTRICTIONS (("vault", "status") and ("vault", "get")), the NOT_A_FILE_PATH entry vault_get, the resource://vault/status resource that runs devops vault status, the tool-listing snapshot, and the registry, secrets and allowlist tests. A rename that leaves them is a stale key: vault read would publish show, vault health would publish vault_addr, and the path-confinement test fails. [sources: src/devops_cli/ai/mcp/generator.py:189, src/devops_cli/ai/mcp/generator.py:191, src/devops_cli/ai/mcp/path_confinement.py:96, src/devops_cli/ai/mcp/server.py:298, src/devops_cli/config/constants.py:455, tests/ai/mcp/test_path_confinement.py:262, tests/roadmap/stage/test_stage_run_allowlist.py:144, tests/ai/mcp/test_mcp_tool_secrets.py:153]
  • Which files name the old vault command or tool names?: The generated command reference and command page, the MCP tool page, the MCP generator restrictions, the path-confinement table, the vault status resource, the OpenSpec specs, and the command, security, MCP and format tests. Each caller must take the new name. [sources: docs/CLI_REFERENCE.md:427, docs/commands/vault.md:9, docs/MCP_TOOLS.md:154, src/devops_cli/ai/mcp/generator.py:189, src/devops_cli/ai/mcp/path_confinement.py:96, src/devops_cli/ai/mcp/server.py:302, src/devops_cli/config/constants.py:455, tests/commands/test_valkey_vault_dry_run.py:81, tests/security/test_vault_broker.py:187, tests/ai/mcp/test_mcp_tool_registry.py:174, tests/ai/mcp/test_mcp_tool_secrets.py:153, tests/commands/test_cli_format_adoption.py:154, tests/roadmap/stage/test_stage_run_allowlist.py:146, openspec/specs/command-dry-run-class/spec.md:599, openspec/specs/mcp-tool-secrets/spec.md:9, openspec/specs/mcp-tool-path-confinement/spec.md:60, openspec/specs/vault-status/spec.md:9]
  • Does the API name test cover the group vault?: Not at this commit: tests/commands/ holds no test_api_command_names.py, because the test arrives with feat(cloudflare): cloudflare commands take the API route names #5232. This change adds vault to the groups of that test and runs it after feat(cloudflare): cloudflare commands take the API route names #5232 merges. [sources: tests/commands/test_all_commands_help_dryrun.py:138]
  • Which specs name the vault commands and tools?: command-dry-run-class names vault audit and vault leases --revoke; mcp-tool-secrets names vault_get, vault_status and vault_sync; mcp-tool-path-confinement names vault_get.path; vault-status names the tool vault_status. [sources: openspec/specs/command-dry-run-class/spec.md:599, openspec/specs/command-dry-run-class/spec.md:603, openspec/specs/mcp-tool-secrets/spec.md:9, openspec/specs/mcp-tool-path-confinement/spec.md:60, openspec/specs/vault-status/spec.md:9]

Fit

Fits in one pull request.

Suspected block

None.
The item is in a dependency cycle: #5234 → #5232 → #5228 → #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