Repository navigation
Description
Problem or Motivation
A new devops command or test touches several places, and the rules for them are scattered. In the last days, agents that added a command or a docs page broke CI for places they did not know of:
roadmap eval verifywas in neither the exposed nor the excluded list oftests/ai/mcp/test_mcp.py, andTests & Coveragefailed (feat(roadmap): the stage job verifies its plan with a model #3182).- A new
docs/roadmap/*.mdpage needed an entry inCONST_DOCS_INVENTORY, and the pages had to be linked within two steps ofAGENTS.md(docs(roadmap): shorten the help of the roadmap commands #3190). - A command help over three sentences fails a guard test, and the help must name its page.
- A new command needs its help and messages in
lang/en/, its docs regenerated withdevops docs generate --sync-readme, and a test in the mirror folder.docs/TESTING.mdstill lets a new test join a flat file "until the move into the mirror", while the stage gate of fix(roadmap): the stage job requires devops ci test verify commands and mirrored test paths #3015 now wants the mirror folder. The agents did not know which to follow. - Constants have a placement rule in CONTRIBUTING.md (
_NAME,NAME,CONST_NAME,DEFAULT_NAME) that a new constant has to follow. pytest.raisesneedsmatch=, andassertis not allowed insrc/.
Proposed Solution & Architectural Design
- Add
devops new command <group> <name>. It writes the files a command needs, in project form: the command function in the group's module, the help and message entries inlang/en/(with a command help of at most three sentences that names a page), a test in the mirror folder with a failing first test andmatch=already in place, and a docs page entry when the group has one. It prints the places it cannot edit safely, as a checklist: the MCP exposed or excluded entry, the docs inventory glob, and the regenerate command. - Add
devops new test <module>. It makes the test file at the mirror path of a source module, from a template that uses the edge fakes and the naming ofdocs/TESTING.md, and refuses a flat path that the mirror rule refuses. - Where an entry in a shared list can be computed instead of written (the MCP list, the docs inventory), the refine step should make the list derive from the command tree or the folder, so no scaffold has to edit it. A check, not a template, is then the safeguard.
- Output is deterministic and never overwrites a file.
--dry-runprints the files and their paths. - The same skill pattern as the change-folder scaffold: a short skill calls the command.
- First decide the test-location rule: update
docs/TESTING.mdso the mirror rule and the scaffold agree. The scaffold must encode one rule.
Open questions for the refine step: Copier against a built-in template set (the project has few templates and wants offline runs); which shared lists can be derived (MCP list, docs inventory) and which stay manual; whether new command belongs in the devops tree or under devops dev.
Target Subsystem
A new devops new group in src/devops_cli/commands/, templates under src/devops_cli/, docs/TESTING.md, tests/ai/mcp/test_mcp.py, src/devops_cli/config/constants.py (CONST_DOCS_INVENTORY).
Existing Tool Considered
Copier and Cookiecutter generate files from templates and can update them later. They do not edit a Python list or know the project's guard tests. devops ai generate makes failing test scaffolds for a function, but not the mirror path or the command files. Cost to build: about 150k tokens and 8 hours for both commands. To keep: the templates, which change when a rule changes, and the guard tests that keep them in step. Deriving the shared lists lowers the upkeep.
Related: the scaffold of the change folder (feat(openspec): scaffold the change folder of an issue to project form), #3202 (prompt against rules), #3015 (mirror folder rule), #3188.
Proposed design
Problem statement
Agents that add a devops command or a test must edit several scattered places. A missed place breaks CI, as #3182 and #3190 show. This change adds devops new command and devops new test to write the project-form files. The scaffold refuses to overwrite a file, prints the manual steps that remain, and derives the shared lists that can be computed.
Acceptance criteria
Requirement: New group lists scaffold commands
The devops new command group SHALL list the command and test subcommands.
Scenario: Help lists both subcommands
- WHEN A user runs
devops new --help. - THEN The output names
commandandtest.
Requirement: Command scaffold writes command files
devops new command SHALL write the command function in the group module, the help and message entries in lang/en/, and the group's docs page entry when that page exists.
Scenario: Command function and language entries are written
- WHEN A user runs
devops new command sample helloin a temporary repository. - THEN The
samplegroup module holds thehellofunction,lang/en/holds its help and message entries, and the existing docs page names the command.
Requirement: Command scaffold writes the mirror-path test
devops new command SHALL write a test at the mirror path of the group module with a failing first test and match= in its error check.
Scenario: Command test uses the mirror path and match
- WHEN A user runs
devops new command sample hello. - THEN The test file sits at the mirror path of the
samplemodule and holds a failing first test andpytest.raises(..., match=...).
Requirement: Command help has three sentences and a page
The generated command help SHALL have at most three sentences and SHALL name a documentation page.
Scenario: Generated help obeys the guard
- WHEN The scaffold writes the help for a command.
- THEN The help text has at most three sentences and contains the path of its documentation page.
Requirement: Command scaffold prints remaining manual steps
The command scaffold SHALL print a checklist of the manual steps that remain, including devops docs generate --sync-readme.
Scenario: Checklist names the regeneration command
- WHEN A user runs
devops new command sample hello. - THEN The output contains
devops docs generate --sync-readmeand names each manual step that remains.
Requirement: Test scaffold uses the mirror path
devops new test SHALL write the test file at the mirror path of the source module.
Scenario: Mirror path is used
- WHEN A user runs
devops new test src/devops_cli/config/constants.py. - THEN The scaffold writes
tests/config/test_constants.py.
Requirement: Test scaffold refuses a flat path
devops new test SHALL refuse a path outside src/devops_cli/ and a target that is not the mirror path.
Scenario: Flat test path is refused
- WHEN A user runs
devops new test tests/test_constants.py. - THEN The command exits nonzero and names the required mirror path.
Requirement: Test template uses a shared fake and a behaviour name
The generated test SHALL use the shared fake of an edge it reaches and SHALL name the behaviour in docs/TESTING.md terms.
Scenario: Generated test uses the GitHub fake
- WHEN A user runs
devops new test src/devops_cli/github/issues.py. - THEN The test asks for the
github_apifixture and its function name states the behaviour it checks.
Requirement: Scaffold refuses to overwrite a file
The scaffold SHALL refuse to write when any target file exists and SHALL name the existing path.
Scenario: Existing target is refused
- WHEN A user runs
devops new test src/devops_cli/config/constants.pytwice. - THEN The second run exits nonzero, names the test path, and leaves the file unchanged.
Requirement: Dry run writes nothing
--dry-run SHALL print every target path and SHALL write no file.
Scenario: Dry run lists target paths
- WHEN A user runs
devops new command sample hello --dry-run. - THEN The output lists the group module, the
lang/en/file and the test file, and no file changes on disk.
Requirement: MCP exclusion list derives from the command tree
The MCP coverage test SHALL derive the excluded command set from the command tree and CONST_MCP_EXPOSURE_TABLE, and SHALL fail on an exposure entry that names no command.
Scenario: New command needs no exclusion entry
- WHEN A new command joins the command tree and no exclusion entry is added.
- THEN The MCP coverage test passes, and an exposure entry for a missing command fails it.
Requirement: Docs inventory hand-written class derives as a complement
CONST_DOCS_INVENTORY SHALL classify a Markdown file that no other class matches as hand-written without a per-file entry.
Scenario: New hand-written page needs no inventory entry
- WHEN A new
docs/example.mdpage is added. - THEN The docs inventory check passes with no change to
CONST_DOCS_INVENTORY.
Requirement: TESTING.md states the mirror rule
docs/TESTING.md SHALL state that a new test file sits at the mirror path of its source module and SHALL remove the flat-file fallback.
Scenario: Layout section states one rule
- WHEN A reader opens the layout section of
docs/TESTING.md. - THEN The section names the mirror path and holds no instruction to add a new flat test file.
Requirement: Skill names both scaffold commands
A skill document under .claude/skills/ SHALL name devops new command and devops new test.
Scenario: Skill names both commands
- WHEN A test reads every
SKILL.mdunder.claude/skills/. - THEN At least one skill names
devops new commandanddevops new test.
Existing Tool Considered
No alternatives check has run. Copier and Cookiecutter are open and maintained, and both render local templates offline. They do not edit a Python command module, update lang/en/ entries, derive CONST_MCP_EXPOSURE_TABLE or CONST_DOCS_INVENTORY, or know the project's guard tests. devops ai generate makes a failing test for a function only. Cost to build both commands with built-in templates: about 150k tokens and 8 hours. Keep the templates in step with the rules and the guard tests.
Key questions
- Which test-location rule does the scaffold encode?: The mirror rule. A new test file sits at the mirror path of its source module.
docs/TESTING.mdremoves the flat-file fallback. (best practice) [sources: docs/TESTING.md, AGENTS.md]- Chosen: Mirror path only. The target layout and the stage gate use the mirror; one rule removes the conflict.
- Rejected: Keep the flat-file fallback. It contradicts the mirror target and lets a new test break the stage gate.
- Rejected: Mirror for new packages and flat for existing files. Two rules keep the ambiguity that the issue reports.
- Which template mechanism does the scaffold use?: A built-in template set in
src/devops_cli/renders the files. The scaffold computes every path, refuses an existing file, and writes only after the checks. (best practice) [sources: AGENTS.md, CONTRIBUTING.md]- Chosen: Built-in template set. The project has few templates, needs offline runs, and must edit a Python module and
lang/en/; Copier and Cookiecutter do not do that. - Rejected: Copier. It renders and updates files, but cannot insert a command function or edit the shared lists; its update mode conflicts with no-overwrite.
- Rejected: Cookiecutter. It renders files only, adds a dependency, and cannot edit the command module or the shared lists.
- Chosen: Built-in template set. The project has few templates, needs offline runs, and must edit a Python module and
- Where does the new command group live?: Top-level
devops new, undersrc/devops_cli/commands/. (best practice) [sources: CONTRIBUTING.md]- Chosen: Top-level
devops new. The target names it, and it keeps the scaffold beside the other developer commands. - Rejected: Under
devops dev. Nodevgroup exists, and it adds a level that the issue does not need.
- Chosen: Top-level
- How does the MCP coverage test treat a new command?: It derives the excluded set as every command in the command tree minus
CONST_MCP_EXPOSURE_TABLE. MCP exposure stays an explicit opt-in table. The test fails on an exposure entry that names no command. (best practice) [sources: tests/ai/mcp/test_mcp.py, src/devops_cli/config/constants.py]- Chosen: Derive excluded set, keep exposure table manual. A new command is not exposed by default, so no exclusion entry is needed; the table still names every exposed command.
- Rejected: Derive exposure table from command tree. The tree does not say which commands are safe or useful over MCP.
- Rejected: Keep both lists manual. This is the failure that feat(roadmap): the stage job verifies its plan with a model #3182 records.
- How does the docs inventory treat a new hand-written page?: The hand-written class becomes the complement of every other class. A Markdown file that no other class matches is hand-written without a per-file entry. (best practice) [sources: src/devops_cli/config/constants.py, tests/docs/test_docs_inventory.py]
- Chosen: Hand-written as complement. A new hand-written page needs no inventory edit, and the check still finds a file that no class matches.
- Rejected: Keep explicit hand-written paths. A new page under a new path fails the check and needs an edit that the scaffold cannot make.
- Rejected: Add a catch-all
docs/**/*.mdto hand-written. It hides a generated or prompt document that a class should own; the complement keeps the classes distinct.
- What does the command scaffold print when a shared list is derived?: It prints only the manual steps that remain, such as
devops docs generate --sync-readme. It prints no step for a derived list. (best practice) [sources: CONTRIBUTING.md, src/devops_cli/config/constants.py]- Chosen: Print only remaining manual steps. A derived list needs no scaffold edit, so a checklist entry would send the agent to the wrong place.
- Rejected: Print the original checklist. It tells the agent to edit a list that the change derives.
- Rejected: Print no checklist. The agent still must regenerate the docs.
- Where does the scaffold skill live?: A short skill under
.claude/skills/calls both commands and names no template path. (best practice) [sources: src/devops_cli/config/constants.py]- Chosen: Skill under
.claude/skills/. The project already keeps skills there, and a short skill calls the commands. - Rejected: No skill. The issue asks for the same skill pattern as the change-folder scaffold.
- Rejected: Separate skills for each command. One skill covers both scaffold commands and keeps the guidance short.
- Chosen: Skill under
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 2, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(cli)scope of the title gives the scope.It reduces CI breakage for new commands and tests but does not block current work.It removes scattered rules from memory and prevents repeated CI failures for agents and developers.The body estimates 150k tokens and 8 hours for both commands, plus template design and shared-list decisions.Both scaffold an artifact to project form, but #3203 targets the OpenSpec change folder while this candidate targets a CLI command and its test.devops-cli-service commentedon Nov 2, 2026
Status set to Ready at ff9ad06 (see proposed design in issue body).
devops-cli-service commentedon Nov 2, 2026
Staged: branch
feat/3204-scaffold-a-command-and-a-test, draft pull request #3277. The pull request plans the item and closes no issue.The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:
The plan run made 4 model request(s), and used 306078 input tokens and 36051 output tokens. The model made no tool call.
A model review of the plan found these points. They stop no draft, and a person judges them:
criterion_droppedat specs (new-command-scaffold) and group 5: The issue requires the command scaffold to write the group's docs page entry when that page exists. The plan spec, the tasks and the test of group 5 leave out this entry, and the plan lists no criteria. Evidence: "and the group's docs page entry when that page exists."docs(openspec): plan #3204 Add scaffold commands for a command and a …
docs(openspec): fix plan #3204 skill roots and docs page entry
docs(openspec): plan #3204 Add scaffold commands for a command and a …
docs(openspec): fit the scaffold plan of #3204 to the code
feat(cli): scaffold a command and a test to project form
docs(openspec): archive the change of #3204
devops-cli-service commentedon Nov 7, 2026
Released in v0.76.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.76.0
devops-cli-service commentedon Nov 7, 2026
Live since 2026-11-07 00:45 UTC
docs(openspec): plan #3296 Require a new command's companion registra…