Files
poimen-workflows/go.mod
T
Test b0313ae818 feat(T3.2): implement workflow templates system
- Add WorkflowTemplate for YAML-based workflow definition
- Implement WorkflowTemplateManager for template lifecycle
- Save/load templates from disk (YAML format)
- Validate templates (name, planner, dependencies)
- Export templates to JSON
- Task configuration with dependency tracking
- Orchestrator configuration per template
- Template metadata (author, version, description)
- Default variables and tags support
- Template usage tracking and statistics
- Batch load templates from directory
- 26 workflow template tests, all passing

Features:
- WorkflowTemplate structure with metadata
- OrchestratorConfig per template (URLs, timeouts, retries)
- TaskConfig with dependencies and priority
- Save to YAML (human-readable)
- Load from YAML (auto-cached)
- Validate dependencies (no cycles, all tasks exist)
- Export to JSON for external systems
- Usage tracking (exec count, last used time)
- Directory loading for multi-template setups

Template Structure:
- Metadata: name, version, author, description
- Timestamps: created_at, updated_at
- Orchestrator config: planner/judge/implementer URLs
- Task list with dependencies
- Default variables
- Tags for organization

Validation:
- Template name required
- Planner URL required
- At least one task required
- All dependencies must reference existing tasks
- No circular dependencies

Operations:
- SaveTemplate() - persist to YAML
- LoadTemplate() - load from file
- GetTemplate() - retrieve cached
- ListTemplates() - enumerate all
- DeleteTemplate() - remove from disk
- ValidateTemplate() - check validity
- ExportTemplateJSON() - external format
- RecordUsage() - track usage stats
- LoadTemplateDirectory() - batch load

Test Coverage:
- 26 workflow template tests
- Save/load cycle verified
- Validation logic tested
- Dependency checking tested
- JSON export tested
- Usage tracking tested
- Directory loading tested
- Timestamp management tested
- Defaults and tags support tested
- Error handling comprehensive

Performance:
- Fast YAML parsing (single file)
- Cached templates in memory
- O(1) lookup by name
- Minimal disk I/O

Format Example:
---
name: golang-project
version: 1.0.0
author: platform-team
orchestrator:
  planner_url: http://planner:8000
  judge_url: http://judge:8000
  timeout_seconds: 300
tasks:
  - id: T0.1
    title: Analyze Requirements
    type: feature
    priority: high
  - id: T0.2
    title: Implement
    type: feature
    depends_on: [T0.1]

Next: T3.3 (Task dependency graph)
2026-08-23 17:31:37 -07:00

43 lines
1.7 KiB
AMPL

module github.com/rockliang/poimen/workflows
go 1.25.4
require (
github.com/prometheus/client_golang v1.24.1
github.com/stretchr/testify v1.12.1
go.temporal.io/sdk v1.48.0
go.uber.org/zap v1.28.0
)
require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nexus-rpc/nexus-proto-annotations v0.1.0 // indirect
github.com/nexus-rpc/sdk-go v0.7.0 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.70.1 // indirect
github.com/prometheus/procfs v0.21.1 // indirect
github.com/robfig/cron v1.2.0 // indirect
github.com/stretchr/objx v0.5.3 // indirect
go.temporal.io/api v1.63.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.yaml.in/yaml/v3 v3.0.5 // indirect
golang.org/x/net v0.57.0 // indirect
golang.org/x/sync v0.22.0 // indirect
golang.org/x/sys v0.47.0 // indirect
golang.org/x/text v0.40.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 // indirect
google.golang.org/grpc v1.82.1 // indirect
google.golang.org/protobuf v1.36.12 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)