Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
144 lines (123 loc) · 4.31 KB
/
Copy pathTaskfile.yml
File metadata and controls
144 lines (123 loc) · 4.31 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
# dynodoc task runner (go-task — https://taskfile.dev).
# Cross-platform; chosen over GNU Make for first-class Windows/PowerShell support.
#
# Quick start:
# task setup # one-time: copy runtime/operator examples, install frontend deps
# task migrate # separate operator process; provision the runtime login next
# task dev # boot Postgres, start the already-provisioned API + frontend
# task test # run all test suites
version: "3"
dotenv: [".env"]
vars:
COMPOSE: docker compose -f infra/docker-compose.yml
FRONTEND: frontend/researcher
tasks:
default:
cmds:
- task --list
silent: true
setup:
desc: One-time local setup — create .env and install frontend deps.
cmds:
- cmd: test -f .env || cp .env.example .env
platforms: [linux, darwin]
- cmd: test -f .env.migrate || cp migration.env.example .env.migrate
platforms: [linux, darwin]
- cmd: powershell -NoProfile -Command "if (-not (Test-Path .env)) { Copy-Item .env.example .env }"
platforms: [windows]
- cmd: powershell -NoProfile -Command "if (-not (Test-Path .env.migrate)) { Copy-Item migration.env.example .env.migrate }"
platforms: [windows]
- cd {{.FRONTEND}} && pnpm install
# --- Infrastructure ---
up:
desc: Start the Postgres container in the background.
cmds:
- "{{.COMPOSE}} up -d"
- "{{.COMPOSE}} exec -T postgres sh -c 'until pg_isready -U dynodoc -d dynodoc; do sleep 1; done'"
down:
desc: Stop the Postgres container (keeps data volume).
cmds:
- "{{.COMPOSE}} down"
# --- Migrations (schema lands in stage 13) ---
migrate:
desc: Apply migrations in a separate operator process using .env.migrate.
dotenv: [".env.migrate"]
deps: [up]
cmds:
- cargo run -p engine-cli -- migrate
db:grant-runtime:
desc: Provision an existing dynodoc_runtime login; does not create a password.
dotenv: [".env.migrate"]
cmds:
- cargo run -p engine-cli -- grant-runtime dynodoc_runtime
db:check:
desc: Check schema and runtime privileges without changing them.
cmds:
- cargo run -p engine-cli -- check-runtime
migrate-reset:
desc: DEV ONLY — drop the database and re-apply all migrations.
deps: [up]
dotenv: [".env.migrate"]
requires:
vars: [MIGRATION_DATABASE_URL]
env:
DATABASE_URL: '{{.MIGRATION_DATABASE_URL}}'
cmds:
- sqlx database drop -y
- sqlx database create
- cargo run -p engine-cli -- migrate
# --- Dev (long-running; runs API + frontend concurrently) ---
dev:
desc: Start the provisioned local stack (Postgres, API, frontend).
deps: [up]
cmds:
- task: dev:run
dev:run:
internal: true
deps: [dev:api, dev:frontend]
dev:api:
internal: true
cmds:
- cargo run -p engine-api
dev:frontend:
internal: true
cmds:
- cd {{.FRONTEND}} && pnpm dev
# --- Quality ---
test:
desc: Run all test suites (Rust + frontend).
cmds:
- cargo test --workspace
- cd {{.FRONTEND}} && pnpm test
lint:
desc: Lint Rust (clippy) and frontend (eslint + svelte-check).
cmds:
- cargo clippy --workspace --all-targets -- -D warnings
- cd {{.FRONTEND}} && pnpm lint
fmt:
desc: Format Rust and frontend code.
cmds:
- cargo fmt --all
- cd {{.FRONTEND}} && pnpm format
fmt-check:
desc: Verify formatting without writing changes (used by CI).
cmds:
- cargo fmt --all -- --check
- cd {{.FRONTEND}} && pnpm format:check
# --- OpenAPI (stage 18) ---
openapi:
desc: Regenerate the committed OpenAPI spec from the annotated handlers.
cmds:
- cargo run -p engine-cli -- openapi --out openapi.yaml
openapi-check:
desc: Fail if the committed openapi.yaml drifts from the generated spec (CI gate).
cmds:
- cargo run -p engine-cli -- openapi | diff - openapi.yaml
clean:
desc: Remove build artifacts (target/, .svelte-kit/, node_modules/).
cmds:
- cargo clean
- cmd: rm -rf {{.FRONTEND}}/.svelte-kit {{.FRONTEND}}/build {{.FRONTEND}}/node_modules
platforms: [linux, darwin]
- cmd: powershell -NoProfile -Command "Remove-Item -Recurse -Force -ErrorAction SilentlyContinue {{.FRONTEND}}/.svelte-kit,{{.FRONTEND}}/build,{{.FRONTEND}}/node_modules"
platforms: [windows]