Repository navigation
Expand file tree
/
Copy pathapp.yaml
More file actions
237 lines (218 loc) · 7.15 KB
/
Copy pathapp.yaml
File metadata and controls
237 lines (218 loc) · 7.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# ratchet-cli — Multi-Service Platform Config
#
# Dogfoods the GoCodeAlone/workflow engine to describe the ratchet-cli
# system: the background daemon (gRPC over Unix socket) and the TUI client.
#
# Services modelled here:
# ratchet-daemon — background gRPC server, auto-started by the TUI client
# ratchet — interactive TUI client (connects to daemon on launch)
#
# Run locally: wfctl run app.yaml
# Validate: wfctl validate app.yaml
requires:
version: "v0.3.51"
# ---------------------------------------------------------------------------
# Config — sources, schema, defaults
# ---------------------------------------------------------------------------
modules:
- name: config-provider
type: config.provider
config:
sources:
- type: defaults
- type: env
schema:
data_dir:
env: RATCHET_DATA_DIR
default: "~/.ratchet"
desc: "Directory for SQLite DB, PID file, and Unix socket"
socket_path:
env: RATCHET_SOCKET_PATH
default: "~/.ratchet/ratchet.sock"
desc: "Unix socket path for daemon ↔ client gRPC"
idle_timeout:
env: RATCHET_IDLE_TIMEOUT
default: "30m"
desc: "Duration before idle daemon auto-exits"
default_provider:
env: RATCHET_DEFAULT_PROVIDER
default: ""
desc: "Default AI provider alias (anthropic, openai, gemini, ollama)"
log_level:
env: RATCHET_LOG_LEVEL
default: "info"
desc: "Daemon log level (debug, info, warn, error)"
# ---------------------------------------------------------------------------
# Persistence — SQLite (local, no external infra)
# ---------------------------------------------------------------------------
- name: db
type: storage.sqlite
config:
dbPath: "{{config \"data_dir\"}}/ratchet.db"
dependsOn: [config-provider]
# ---------------------------------------------------------------------------
# HTTP management API (daemon status, health)
# Daemon exposes gRPC on a Unix socket; this is a supplementary HTTP layer
# for ops tooling (health checks, metrics, daemon control).
# ---------------------------------------------------------------------------
- name: server
type: http.server
config:
address: ":7979"
- name: router
type: http.router
dependsOn: [server]
- name: cors
type: http.middleware.cors
config:
allowedOrigins: ["*"]
allowedMethods: ["GET", "POST"]
allowedHeaders: ["Content-Type"]
dependsOn: [router]
# ---------------------------------------------------------------------------
# Workflows
# ---------------------------------------------------------------------------
workflows:
http:
router: router
server: server
routes: []
# ---------------------------------------------------------------------------
# Pipelines
# ---------------------------------------------------------------------------
pipelines:
# -- Health check ----------------------------------------------------------
healthz:
trigger:
type: http
config:
path: /healthz
method: GET
steps:
- name: respond
type: step.json_response
config:
body:
status: ok
service: ratchet-daemon
# -- Daemon status ---------------------------------------------------------
daemon_status:
trigger:
type: http
config:
path: /api/v1/daemon/status
method: GET
steps:
- name: check
type: step.shell_exec
config:
command: "ratchet daemon status"
- name: respond
type: step.json_response
config:
body:
output: "{{ .steps.check.stdout }}"
exit_code: "{{ .steps.check.exit_code }}"
# -- CI: build both binaries -----------------------------------------------
# Cross-compile ratchet (TUI client) + ratchetd (daemon) for all targets.
# CGO_ENABLED=0 required for static binaries (modernc.org/sqlite pure-Go).
ci_build:
trigger:
type: http
config:
path: /api/v1/ci/build
method: POST
steps:
- name: parse
type: step.request_parse
- name: build_ratchet_linux_amd64
type: step.shell_exec
config:
command: >
GOOS=linux GOARCH=amd64 CGO_ENABLED=0
go build -ldflags="-s -w" -o dist/ratchet_linux_amd64 ./cmd/ratchet
- name: build_ratchet_linux_arm64
type: step.shell_exec
config:
command: >
GOOS=linux GOARCH=arm64 CGO_ENABLED=0
go build -ldflags="-s -w" -o dist/ratchet_linux_arm64 ./cmd/ratchet
- name: build_ratchet_darwin_amd64
type: step.shell_exec
config:
command: >
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0
go build -ldflags="-s -w" -o dist/ratchet_darwin_amd64 ./cmd/ratchet
- name: build_ratchet_darwin_arm64
type: step.shell_exec
config:
command: >
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0
go build -ldflags="-s -w" -o dist/ratchet_darwin_arm64 ./cmd/ratchet
- name: respond
type: step.json_response
config:
body:
status: built
binaries:
- dist/ratchet_linux_amd64
- dist/ratchet_linux_arm64
- dist/ratchet_darwin_amd64
- dist/ratchet_darwin_arm64
# -- CI: run tests ---------------------------------------------------------
ci_test:
trigger:
type: http
config:
path: /api/v1/ci/test
method: POST
steps:
- name: test
type: step.shell_exec
config:
command: "go test ./..."
- name: respond
type: step.json_response
config:
body:
output: "{{ .steps.test.stdout }}"
exit_code: "{{ .steps.test.exit_code }}"
# ---------------------------------------------------------------------------
# Platform — environment metadata
# GoReleaser handles the official release pipeline (see .goreleaser.yaml).
# This section documents the local and CI environments.
# ---------------------------------------------------------------------------
platform:
environments:
local:
description: "Developer workstation — daemon auto-starts on first TUI launch"
services:
ratchet-daemon:
binary: ./cmd/ratchet
runtime: process
transport: unix-socket
socket: "~/.ratchet/ratchet.sock"
persistence: sqlite
db: "~/.ratchet/ratchet.db"
ratchet:
binary: ./cmd/ratchet
runtime: process
mode: tui-client
connects_to: ratchet-daemon
ci:
description: "GitHub Actions — cross-compile + test on ubuntu-latest"
services:
ratchet-daemon:
binary: ./cmd/ratchet
build_tags: []
cross_targets:
- os: linux
arch: amd64
- os: linux
arch: arm64
- os: darwin
arch: amd64
- os: darwin
arch: arm64
cgo: false
release: goreleaser