Stage 2: Architecture Design#
Objective#
Design the CLI command structure, state model, and output format based on the SOP analysis.
Inputs#
<SOFTWARE>.mdfrom Stage 1
Steps#
- Design Command Groups — map each workflow to a Click/Commander command group:
cli-anything-<SOFTWARE>
├── project (create, open, save, close, info)
├── <domain1> (domain-specific commands)
├── <domain2> (domain-specific commands)
├── export (render, compile, convert)
└── session (undo, redo, history, snapshot)
- Design State Model:
- What is the "project" concept? (file, workspace, session)
- What state changes between commands? (selections, settings, layers)
- Deep-copy undo/redo: each command snapshots state before execution
- Design Output Format:
- Human-readable: clear terminal output with color hints
- JSON (
--json): structured output for agent consumption
{
"status": "success|error",
"command": "<command.subcommand>",
"data": { ... },
"metadata": { "duration_ms": 123, "software_version": "x.y.z" }
}
- Design Backend Calls:
- Map each command to specific software invocations
- Define subprocess timeout per command category
- Define error detection patterns (exit codes, stderr patterns)
- Generate
architecture.json:
{
"commandGroups": [...],
"stateModel": {...},
"outputFormat": {...},
"backendCalls": [...]
}
Output#
architecture.json— the complete design specification