# Poimen CLI — Dynamic JSON-Based Design ## Overview New CLI (`cmd/cli`) that accepts JSON WorkflowSpecs and dynamically understands activity sequences—same mechanism as HTTP API, but command-line interface. ## Key Commands ```bash # Submit workflow from JSON poimen-cli submit workflow.json poimen-cli submit workflow.json --wait poimen-cli submit workflow.json --watch # Check status poimen-cli status wf-abc123 poimen-cli status wf-abc123 --wait # Template management poimen-cli template list poimen-cli template show code-review-v1 # Execute immediately (sync) poimen-cli execute template code-review-v1 --input-file input.json ``` ## Workflow JSON Example ```json { "name": "code-review-pipeline", "input": {"repo": "https://github.com/..."}, "activities": [ { "name": "Clone", "resource": "CloneRepoActivity", "parameters": {"repo": "${input.repo}"}, "timeout": "5m", "next": "Analyze" }, { "name": "Analyze", "resource": "AnalyzeCodeActivity", "parameters": {"path": "${Clone.output.path}"}, "timeout": "10m", "retry": {"maxAttempts": 3}, "catch": [{"errorEquals": ["Timeout"], "next": "HandleTimeout"}], "next": "Judge" } ] } ``` ## File Structure ``` cmd/ ├─ cli/ (NEW) │ ├─ main.go │ └─ commands/ │ ├─ submit.go │ ├─ status.go │ ├─ template.go │ ├─ execute.go │ └─ history.go ├─ starter/ (OLD: keep for backward compat) └─ worker/ ``` ## Three Entry Points (Same Core) | Interface | Endpoint | Input | Output | |-----------|----------|-------|--------| | **CLI** | `submit workflow.json` | JSON file | workflow_id | | **CLI** | `execute template T` | Template name | Results (sync) | | **API** | `POST /api/v1/workflows` | JSON body | workflow_id | | **API** | `POST /api/v1/execute` | JSON body | Results (sync) | All use same `RoutingWorkflow` internally—just different interfaces. See CLI_DESIGN.md in repo for full implementation details.