Files
poimen-workflows/CLI_DESIGN.md
T
Test c32f3e7077
ci / test (push) Successful in 1m50s
refactor: rename await-kmsvc pattern to awaitTaskComplete
- Better describes the intent: awaiting task completion via queue
- More descriptive than 'await-kmsvc'
- Applied to all workflow design documents
- Reflects the actual operation: wait for external task to complete

Updated files:
- DESIGN_MASTER_REVIEW.md
- SERVICE_INTEGRATION.md
- IMPLEMENTATION_PLAN.md
- CLI_DESIGN.md
- FINAL_COMPREHENSIVE_DESIGN.md
2026-08-31 18:30:11 -07:00

2.0 KiB

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

# 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

{
  "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.