Skip to content

feat(roadmap): Resolve devops commands and flags cited in a plan #3302

Closed

Description

@dan-petty

Problem or Motivation

The plan for #3236 (PR #3248) cites uv run devops ai ast-graph --help, uv run devops gh pages-verify --help and the tool keys ("ai", "ast-graph") and ("gh", "pages-verify"). The commands are ai ast graph and gh pages verify, and the exposure table keys are ("ai", "ast", "graph") and ("gh", "pages", "verify"). The names came from the issue text, and no step ran them. The same plan also says that ai_ast_graph writes its graph to the data directory. The command prints the graph when no --output is given.

#3266 compares the tools that a Feasibility names with the run trace. It does not check that a devops command that the plan cites exists, or that a behavior claim is true.

Proposed Solution & Architectural Design

  1. In the plan check, find each devops <words> span in Feasibility and tasks (including uv run devops ...) and resolve it with resolve_click_command (src/devops_cli/ai/mcp/generator.py) or Click directly. Refuse a span that does not resolve, and name it.
  2. Resolve each ("a", "b") key that a plan names against CONST_MCP_EXPOSURE_TABLE.
  3. Test with the names ai ast-graph (refused) and ai ast graph (accepted).

Target Subsystem

The plan check of devops roadmap (see #3200, #3201).

Source: #3248

Scope from #3299

#3299 reports the same defect from the same plan (PR #3248). It adds these items.

  1. Option flags. The check also resolves an option flag of a cited command. The plan cited --root_dir for gh pages verify. The CLI option is --dir (src/devops_cli/commands/gh.py:1139), and root_dir is only the name of the parameter. The check refuses a flag that the command does not have, and the problem names the flag.
  2. Location. Put the rule in check_proposal, so the stage job and devops roadmap plan-check both refuse. The replay judges the same rule, because the paths gate of src/devops_cli/roadmap/stage_eval_gates.py runs check_proposal.
  3. devops openspec check. fix(roadmap): stage verifies command paths in CLI tree #3299 also asks for the check in this command. The plan states a decision: run the check there too, or make it a non-goal with the reason.
  4. Failure text. resolve_click_command raises LookupError for an unknown name. The problem names the unknown subcommand. A cited help command that does not resolve cannot support a Feasibility claim: devops ai ast-graph --help and devops gh pages-verify --help both fail with No such command.
  5. Tests. Add cases to tests/roadmap/ for a command tuple that does not resolve, a subcommand that does not exist and a flag that does not exist.

Existing Tool Considered

resolve_click_command in src/devops_cli/ai/mcp/generator.py resolves a command tuple against the Click tree. module_click_command in src/devops_cli/core/command_resolver.py also exists. The change adds no dependency. Cost to build: about 5,000 tokens and 30 minutes.

Proposed design

Problem statement

The plan check accepts devops commands, option flags and MCP exposure keys that do not exist. A plan can cite uv run devops ai ast-graph --help and uv run devops gh pages verify --root_dir .. The real names are ai ast graph and --dir. The check must refuse these names and report them.

Acceptance criteria

Requirement: Resolve cited command spans

The plan check SHALL resolve every devops command span in the Feasibility text and the task text against the real command tree.

Scenario: Unknown subcommand is refused

  • WHEN A plan cites uv run devops ai ast-graph --help.
  • THEN The check returns a problem that names ai ast-graph and refuses the plan.

Requirement: Accept a resolved command span

The plan check SHALL accept a devops command span that resolves to a leaf command with valid options.

Scenario: Known subcommand is accepted

  • WHEN A plan cites uv run devops ai ast graph --help.
  • THEN The check returns no command-resolution problem for that span.

Requirement: Resolve cited option flags

The plan check SHALL resolve each option flag in a cited devops command span against that command.

Scenario: Unknown option is refused

  • WHEN A plan cites uv run devops gh pages verify --root_dir ..
  • THEN The check returns a problem that names --root_dir and devops gh pages verify and refuses the plan.

Requirement: Resolve cited MCP exposure keys

The plan check SHALL resolve each MCP exposure key that a plan names against CONST_MCP_EXPOSURE_TABLE.

Scenario: Unknown exposure key is refused

  • WHEN A plan names the key ("ai", "ast-graph").
  • THEN The check returns a problem that names the key and refuses the plan.

Requirement: Accept a known MCP exposure key

The plan check SHALL accept an MCP exposure key that exactly matches a key in CONST_MCP_EXPOSURE_TABLE.

Scenario: Known exposure key is accepted

  • WHEN A plan names the key ("ai", "ast", "graph").
  • THEN The check returns no exposure-key problem for that key.

Requirement: Run the rule in check_proposal

The rule SHALL run inside check_proposal, so the stage job, devops roadmap plan-check and the stage replay use the same check.

Scenario: Stage replay refuses a bad plan

  • WHEN The stage replay runs a case whose plan cites devops ai ast-graph.
  • THEN The paths gate reports a problem that names ai ast-graph.

Requirement: Regression tests for cited names

The change SHALL add roadmap tests for an unknown exposure key, an unknown subcommand and an unknown option flag.

Scenario: The three defects have tests

  • WHEN The roadmap test suite runs.
  • THEN It passes and one test covers each of the three defects.

Existing Tool Considered

No alternatives check has run. No external tool covers this need. The repository already has resolve_devops_argv in src/devops_cli/core/command_resolver.py; it parses a full devops command line and reports an unknown command, an unknown option or an unexpected argument without running the command. Reuse it. The remaining work is span extraction, exposure-key comparison and tests; the written cost is about 5,000 tokens and 30 minutes.

Key questions

  • Which resolver should the plan check use for a cited devops command span?: Use resolve_devops_argv from src/devops_cli/core/command_resolver.py. It parses the full command line, reports an unknown command, an unknown option or an unexpected argument, and runs no command. (best practice) [sources: src/devops_cli/core/command_resolver.py, src/devops_cli/ai/mcp/generator.py]
    • Chosen: Reuse resolve_devops_argv. It resolves the full argv, including options, and reports the three defects without running the command.
    • Rejected: Call resolve_click_command directly. It resolves a command tuple but does not parse option flags or report an unknown option.
    • Rejected: Build a new parser. It duplicates the existing resolver and adds maintenance cost.
  • Where should the command-citation rule run?: In check_proposal. The stage job, devops roadmap plan-check and the stage replay already call it. (best practice) [sources: src/devops_cli/roadmap/stage_eval_gates.py, docs/roadmap/plan-check.md:20]
    • Chosen: Run in check_proposal. One rule serves the stage job, the plan-check command and the replay.
    • Rejected: Run only in plan-check. The stage job and the replay would accept the same bad plan.
    • Rejected: Run only in the stage job. The plan-check command and the replay would accept the same bad plan.
  • Should devops openspec check also run the command-citation rule?: No. Keep it a non-goal. devops openspec check validates an OpenSpec change. The rule needs the Feasibility text and task text of a stage proposal, and the roadmap plan check owns that input. (best practice) [sources: docs/roadmap/plan-check.md:20, src/devops_cli/roadmap/stage_eval_gates.py, src/devops_cli/roadmap/stage_change.py]
    • Chosen: Keep it out of devops openspec check. The OpenSpec command has a different input contract and no stage proposal.
    • Rejected: Add it to devops openspec check. It couples OpenSpec validation to roadmap plan text and expands this change.
  • How should the check report an unknown command, subcommand or option?: Use the describe() text of CommandReferenceFinding. Add the cited span. The problem names the rejected token and the command path. (best practice) [sources: src/devops_cli/core/command_resolver.py]
    • Chosen: Reuse CommandReferenceFinding.describe(). It already names the rejected token and the command path.
    • Rejected: Write a new message for each defect. It duplicates existing text and can drift from the resolver.
  • How should the check compare an MCP exposure key with the table?: Parse each quoted tuple that the plan names. Compare the exact tuple with the keys of CONST_MCP_EXPOSURE_TABLE. Refuse a key that is absent. (best practice) [sources: src/devops_cli/config/constants.py, src/devops_cli/ai/mcp/generator.py]
    • Chosen: Exact tuple match. The table keys are exact command paths, so a near name must fail.
    • Rejected: Normalize hyphens and spaces. It would accept ai ast-graph as ai ast graph, which is the defect.
    • Rejected: Match only the first element. It accepts a wrong command path.
  • Does the plan check verify a behavior claim such as where ai_ast_graph writes its graph?: No. This issue resolves cited command names, option flags and exposure keys only. A behavior claim needs a probe or a run trace, and fix(roadmap): Refuse Feasibility claims the run did not support #3266 covers the trace comparison. (best practice) [sources: src/devops_cli/ai/mcp/generator.py, src/devops_cli/roadmap/stage_eval_gates.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-06: partly.
Tool: pallets/click (https://github.com/pallets/click), BSD-3-Clause, last activity 2026-11-06, maintained.

Activity

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

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. It adds a validation step that catches invalid command references in plans but does not block existing workflows.
    • Value: Medium. It prevents plans from citing non-existent commands, which would mislead readers and downstream automation.
    • Effort: Medium. It requires resolving arbitrary spans against the Click tree, checking exposure-table keys, and adding both accepted and refused test cases.
  3. added
    priority/p2-medium
    on Nov 2, 2026
  4. devops-cli-service commented on Nov 3, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 82d22a7 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • The proposal has no problem statement, no acceptance criterion with its requirement, scenario, WHEN and THEN, or no answer to the existing-tool question. State the problem, the requirements with their scenarios, and the open tool that covers the need or the cost of building it.
  5. added
    status/ready
    and removed
    status/new
    on Nov 5, 2026
  6. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at d72ec47 (see proposed design in issue body).

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

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Tool: pallets/click (https://github.com/pallets/click)

    • License: BSD-3-Clause
    • Last activity: 2026-11-06
    • Maintained: yes

    Covers:

    • Click parses a devops ... argv against the real command tree and raises UsageError ("No such command") for an unknown command or subcommand, without running anything.
    • Click's parser rejects an option flag that the resolved command does not declare, which is the --root_dir against --dir case.
    • Click resolves a nested path to its leaf command and exposes that command's declared params and options, so a cited name can be checked against the actual tree.

    Lacks:

    • Click does not find devops <words> spans in the Feasibility or task prose of a plan; span extraction and the call from check_proposal still have to be written.
    • Click knows nothing about CONST_MCP_EXPOSURE_TABLE, so it cannot resolve a cited ("ai", "ast-graph") key against the exposure keys.
    • Click gives no plan-check problem text: naming the rejected span and the command path, and refusing the plan, is repo work (the repository's own resolve_devops_argv / CommandReferenceFinding.describe() already wrap this).
    • Click does not verify a behavior claim such as where ai_ast_graph writes its graph.

    Searches run:

    • python library validate a CLI command line against Click command tree without executing it
    • check commands cited in documentation exist in CLI test unknown subcommand unknown option
    • click resolve command group unknown command UsageError
    • Click python CLI framework
    • click command line parser
    • argparse click validation

    Sources:

    Checked on 2026-11-06. A person decides what this means for the item. The check changes no label and closes no issue.

  8. changed the title [-]feat(roadmap): the plan check resolves the devops commands that a plan cites[/-] [+]feat(roadmap): Resolve devops commands and flags cited in a plan[/+] on Nov 6, 2026
  9. dan-petty commented on Nov 6, 2026

    @dan-petty
    OwnerAuthor

    The job shortened the title of this item. The summary had 61 characters, and the limit is 60. The type and the scope stay.

    • Before: feat(roadmap): the plan check resolves the devops commands that a plan cites
    • After: feat(roadmap): Resolve devops commands and flags cited in a plan
    • Source of the summary: the background model
  10. added
    status/in-progress
    and removed
    status/ready
    on Nov 9, 2026
  11. added a commit that references this issue on Nov 9, 2026
    585b9e0
  12. added
    status/in-review
    and removed
    status/in-progress
    on Nov 9, 2026
  13. removed
    status/in-review
    on Nov 9, 2026
  14. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor
  15. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-09 01:02 UTC

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/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions