diff --git a/.ciagent/ARCHITECTURE.md b/.ciagent/ARCHITECTURE.md index 083fde1..7dc2177 100644 --- a/.ciagent/ARCHITECTURE.md +++ b/.ciagent/ARCHITECTURE.md @@ -2,7 +2,7 @@ ## System Overview -Orca is a single-binary, offline-first orchestration engine. The system consists of three logical components, all compiled into one `orca` binary and selected via subcommands. +Orca is a single-binary, offline-first orchestration engine. The system consists of six logical components, all compiled into one `orca` binary and selected via subcommands. ``` ┌─────────────────────────────────────────────────────────────┐ @@ -22,6 +22,13 @@ Orca is a single-binary, offline-first orchestration engine. The system consists │ ├── /v1/nodes/* (node registry API) │ │ └── /v1/tasks/* (task lifecycle API) │ ├─────────────────────────────────────────────────────────────┤ +│ Job Spec Parser (hashicorp/hcl/v2) │ +│ └── reads .hcl files → validates → hands to engine │ +├─────────────────────────────────────────────────────────────┤ +│ Domain Model (internal/model) │ +│ ├── Node, Job, Task structs (no I/O) │ +│ └── shared by store, engine, daemon │ +├─────────────────────────────────────────────────────────────┤ │ Core Engine │ │ ├── Node Registry (in-memory + SQLite persistence) │ │ ├── Task Executor (os/exec with WaitDelay, Go 1.25+) │ @@ -59,6 +66,16 @@ Orca is a single-binary, offline-first orchestration engine. The system consists - **Schema**: `nodes`, `jobs`, `tasks`, `audit_log` tables - **Migrations**: Embedded SQL files, applied on startup +### 5. Job Spec Parser (`internal/jobspec`) +- **Parser**: `hashicorp/hcl/v2` (industry-standard, familiar to Nomad users) +- **Format**: HCL files (`.hcl`); YAML fallback considered but deferred +- **Use**: `orca job run ` reads and validates the spec, hands off to the engine + +### 6. Domain Model (`internal/model`) +- **Types**: `Node`, `Job`, `Task` — pure data structs with no I/O +- **State machines**: Node (pending/ready/left), Task (pending/running/complete/failed) +- **Use**: shared by `internal/store`, `internal/engine`, `internal/daemon` to avoid circular dependencies + ## Data Model ### Node diff --git a/.ciagent/PLANS.md b/.ciagent/PLANS.md index a103df7..310b1bf 100644 --- a/.ciagent/PLANS.md +++ b/.ciagent/PLANS.md @@ -7,7 +7,7 @@ All 6 phases with vertical-slice structure, wave ordering, and REQ-ID mapping. ## Phase 1: CLI Skeleton (Wave 1) **Branch**: `phase/01-cli-skeleton` -**REQ Coverage**: REQ-001, REQ-002, REQ-013, REQ-015, REQ-016, REQ-019, REQ-024 +**REQ Coverage**: REQ-001 (Go 1.25), REQ-002 (CLI-first single binary), REQ-003 (offline-first — no network deps in CLI), REQ-008 (slog structured logging), REQ-010 (`--json` output flag), REQ-013 (pre-push hook), REQ-015 (MIT LICENSE), REQ-016 (README quickstart), REQ-019 (Cobra), REQ-024 (Makefile) ### Must-Haves - [ ] `go.mod` with `go 1.25` @@ -61,7 +61,7 @@ All 6 phases with vertical-slice structure, wave ordering, and REQ-ID mapping. ## Phase 3: Task Execution Engine (Wave 2) **Branch**: `phase/03-task-exec` -**REQ Coverage**: REQ-004, REQ-009, REQ-021, REQ-022 +**REQ Coverage**: REQ-004 (task execution), REQ-009 (HCL/YAML parsing), REQ-020 (hashicorp/hcl parser), REQ-021 (os/exec with WaitDelay), REQ-022 (iter.Seq streaming — deferred) ### Must-Haves - [ ] `internal/store/migrations/0002_jobs_tasks.sql` — jobs + tasks tables diff --git a/.ciagent/PROJECT.md b/.ciagent/PROJECT.md index 0f7f216..bb849db 100644 --- a/.ciagent/PROJECT.md +++ b/.ciagent/PROJECT.md @@ -1,5 +1,8 @@ # Project: Orca +## What This Is +A minimalist, offline-first, CLI-first orchestration engine inspired by HashiCorp Nomad, prioritizing stability, security, and simplicity over feature richness. Single-binary distribution, no container runtime, no cloud dependencies, no K8s-level complexity. + ## Vision A minimalist, offline-first, CLI-first orchestration engine inspired by HashiCorp Nomad, prioritizing stability, security, and simplicity over feature richness. @@ -44,3 +47,17 @@ Build a lightweight system to manage and execute workloads across a set of nodes - Container runtime integration. - Service mesh / sidecar injection. - Auto-scaling / horizontal pod autoscaler. + +## Key Decisions +- **Single binary** (D-001): one `orca` binary with subcommands — no multi-binary distribution. +- **modernc/sqlite** (D-002): CGO-free SQLite for state — single file, cross-compile friendly. +- **Embedded HTTP over loopback** (D-003): net/http for v0.1; mTLS for cross-node (REQ-011, REQ-023 deferred to v0.2). +- **Single-node only** (D-004): no multi-node scheduling in v0.1 (deferred to v0.2). +- **Human-readable + `--json`** (D-005): both outputs supported from the start. +- **HCL/YAML specs** (D-006): familiar to Nomad/HashiCorp users. +- **mTLS for v0.1, tokens deferred** (D-007): most secure default; tokens if needed later. +- **Direct process execution** (D-008): no container runtime — pure process management. +- **`~/.orca/config.hcl` and `/etc/orca/orca.hcl`** (D-009): standard XDG-style paths. +- **Structured JSON via `log/slog`** (D-010): native Go 1.21+ slog, no external dependency. + +See **Clarified Decisions** below for full table with confidence scores.