Repository navigation
Description
Problem Description
The stage planner generates command checks that only search for string literals.
In pull request #4112 for issue #3296, the planner generated checks to detect new CLI commands. The check searched only for double-quoted strings such as f'"{word}"' in the command file.
Many CLI commands in src/devops_cli/commands/ use @app.command() with standard function definitions such as def <command_name>(. They do not pass a string literal to the decorator. A check that only searches for string literals fails to detect these commands. The check then treats edits to existing commands as new command additions. This causes false-positive failures during planning and implementation checks.
Reproduction Steps
- Inspect pull request docs(openspec): plan #3296 Require a new command's companion registrations #4112 for issue feat(roadmap): check new commands register dry-run and mcp #3296.
- Review the generated
design.mdandspecs/roadmap-stage/spec.md. - Observe that command detection logic checked only double-quoted strings.
- Compare against
src/devops_cli/commands/workspace.pyandsrc/devops_cli/commands/branches.py. - Notice that commands define names through function names without literal arguments.
Expected vs Actual Behavior
Expected: Stage planning instructions and checks detect CLI commands registered either as string literals or as function names.
Actual: Stage planning generated checks that only search for double-quoted string literals.
Proposed Solution
- Update stage prompt instructions in
src/devops_cli/ai/tasks/roadmap_stage_change.md. - State that CLI command detection must inspect both string literals and function definitions under command decorators.
- Update AST parsing or regex checks in roadmap stage verification to recognize
def <command_name>(under@app.command()or@<group>.command().
Environment Diagnostics
- DevOps CLI Version: 0.86.0
- Python Version: 3.14.10
- Execution Environment: Roadmap Service Stage Job
Source: #4112
Alternatives check of 2026-11-10: partly.
Tool: griffe (https://pypi.org/project/griffe), ISC, last activity 2026-10-22, maintained.
Proposed design
Problem statement
The stage prompt does not state that a CLI command can register by a string literal or by a function name. A planner can write a negative search that looks only for a quoted literal. The stage form refuses that search, or the search misses the function form. The AST detector in the issue adds no refusal, so the change leaves it out. The change updates the prompt to name both forms and the bare-name search.
Acceptance criteria
Requirement: Stage prompt states both command registration forms
The stage prompt SHALL state that CLI command detection checks both the string literal in a command decorator and the function name under a command decorator.
Scenario: Prompt names literal and function forms
- WHEN A reader opens
src/devops_cli/ai/tasks/roadmap_stage_change.md. - THEN The text states that
@app.command("name")registers the string literal and that@app.command()or@<group>.command()registers the function name.
Requirement: Stage prompt states the bare-name negative search
The stage prompt SHALL state that a negative search for a command name uses the bare name, so the search finds both the quoted literal and the def <name>( form.
Scenario: Prompt names the bare-name search
- WHEN A reader opens
src/devops_cli/ai/tasks/roadmap_stage_change.md. - THEN The text states that
! git grep -n -F <name> <path>finds both@app.command("<name>")anddef <name>(.
Existing Tool Considered
griffe (https://pypi.org/project/griffe) is an open, maintained tool. It parses decorators and function names. It lacks the roadmap-stage rule for which decorators count as command registrations, the stage-verification refusal, and the prompt text. This change adopts no parser and builds no code: it updates the stage prompt only.
Key questions
- Which command registration forms do the command files use?: The files show both forms.
src/devops_cli/commands/workspace.pydefines@app.command()abovedef add(.src/devops_cli/commands/branches.pydefines@app.command("sync")and@app.command()abovedef update(. [sources: src/devops_cli/commands/workspace.py, src/devops_cli/commands/branches.py] - Where does the stage prompt hold the command detection rule?: The stage prompt is
src/devops_cli/ai/tasks/roadmap_stage_change.md. [sources: src/devops_cli/ai/tasks/roadmap_stage_change.md] - How should the stage prompt tell the planner to detect a CLI command name?: Use the bare command name in a negative search. The search then finds the quoted literal and the
def <name>(form. The stage check already refuses a search with a surviving hit. (best practice) [sources: src/devops_cli/ai/tasks/roadmap_stage_change.md, src/devops_cli/commands/workspace.py, src/devops_cli/commands/branches.py]- Chosen: Bare-name negative search. It finds both registration forms and the stage check refuses a surviving hit.
- Rejected: Quoted literal only. It misses the function form and the negative-search grammar refuses the quoted literal.
- Rejected: AST parser in the stage check. It adds no refusal and no test can trigger it.
- Does the stage verification need an AST detector for function-defined commands?: No. A negative search for the bare name finds
def add(insrc/devops_cli/commands/workspace.py, so the existing no-hit rule refuses the plan. A quoted literal is refused by the negative-search grammar, andshlex.splitremoves the quotes. An AST detector adds no refusal. (best practice) [sources: src/devops_cli/commands/workspace.py, src/devops_cli/roadmap/stage/stage_form.py, src/devops_cli/roadmap/stage/stage_paths.py]- Chosen: Update the stage prompt only. The stage check already refuses a negative search that has a surviving hit.
- Rejected: Add an AST detector to the stage verification. It adds no refusal, and no test can trigger the proposed criteria.
- Rejected: Change the negative-search grammar. The grammar already refuses a quoted literal, and the bare name matches the function definition.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 8, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(roadmap)scope of the title gives the scope.The defect causes false-positive check failures that block valid PRs from passing stage verification.False positives in command detection block valid work and erode trust in the stage planner.The fix targets prompt instructions and one regex or AST pattern in the stage verification path.Both deal with new CLI command checks in the stage planner, but #3296 adds companion registration checks while the candidate fixes how commands are detected.devops-cli-service commentedon Nov 8, 2026
Status set to Ready at 54e5d46 (see proposed design in issue body).
devops-cli-service commentedon Nov 10, 2026
Alternatives check: partly
Reason: The searches turned up only general Python static-analysis and CLI-introspection packages; griffe is the closest, since it parses decorators and function names from source and so detects both command forms the issue reports. It does not supply the project's own rule for which decorators are command registrations, nor the stage-verification refusal of a negative search, so it covers only the parsing part of the need. No ADR in force names a tool for this.
Tool: griffe (https://pypi.org/project/griffe)
Covers:
@app.command("name") and the function name under@app.command() or @<group>.command()Lacks:
Tools considered:
Searches run:
Sources:
Checked on 2026-11-10. A person decides what this means for the item. The check changes no label and closes no issue.
dan-petty commentedon Nov 15, 2026
Returned: the refined acceptance criteria cannot trigger on the current stage grammar. Proof, read on 2026-11-15 (origin/main ca62d6a, pip 0.158.0): (1)
git grep -F add src/devops_cli/commands/workspace.pygives 5 hits, among themdef add(at line 143, so a negative search for a function-defined command finds it and the no-hit rule refuses the plan; there is no false pass. (2) A quoted literal that would dodge the definition is refused before any check:read_negative_search(shlex.split('! git grep -n -F -e "add" -- src/devops_cli/commands/workspace.py'))answers 'the text is not a literal of letters, digits, spaces and the signs ...'. (3)shlex.splitremoves the shell quotes, so-F '"add"'reaches the check asadd, which matches the definition again. The stage check therefore cannot treat an existing function-defined command as new through a negative search, and an AST detector adds no refusal. File a new item if the prompt should still name both registration forms.devops-cli-service commentedon Nov 15, 2026
Status set to Ready at ca62d6a (see proposed design in issue body).
devops-cli-service commentedon Nov 17, 2026
Released in v0.171.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.171.0
devops-cli-service commentedon Nov 17, 2026
Live since 2026-11-17 09:25 UTC