-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
293 lines (231 loc) · 8.86 KB
/
Copy pathjustfile
File metadata and controls
293 lines (231 loc) · 8.86 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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# OpenPaw - Farmwork
# Run `just --list` to see all commands
# Variables
project_root := justfile_directory()
frontend_dir := project_root / "web" / "frontend"
binary_name := "openpaw"
go_tags := "-tags fts5"
# Version baked into the binary via ldflags so it's correct regardless of the
# process cwd (the desktop sidecar can't find the repo-root VERSION file).
app_version := trim(`cat VERSION 2>/dev/null || echo dev`)
go_ldflags := "-ldflags=-X main.version=" + app_version
# ============================================
# DEVELOPMENT
# ============================================
# Start frontend dev server (Vite + HMR on :5173, proxies /api to :8080)
dev:
cd {{frontend_dir}} && npm run dev
# Run the Go backend server
serve:
go run {{go_tags}} ./cmd/openpaw
# Run frontend dev + Go backend in parallel
dev-full:
@echo "Starting Go backend and Vite frontend..."
@(go run {{go_tags}} ./cmd/openpaw &) && cd {{frontend_dir}} && npm run dev
# Run linter (frontend ESLint)
lint:
cd {{frontend_dir}} && npm run lint
# Run Go vet
vet:
go vet {{go_tags}} ./...
# Run Go tests
test:
go test {{go_tags}} ./...
# ============================================
# BUILD
# ============================================
# Build frontend (TypeScript check + Vite bundle → web/frontend/dist/)
frontend-build:
cd {{frontend_dir}} && npm run build
# Build Go binary (embeds frontend dist via go:embed)
go-build:
CGO_ENABLED=1 go build {{go_tags}} "{{go_ldflags}}" -o {{binary_name}} ./cmd/openpaw
# Full build: frontend → Go binary (production single-binary)
build: frontend-build go-build
@echo "Built ./{{binary_name}} with embedded frontend"
# Rebuild and run the binary
run: build
./{{binary_name}}
# Reset database and run fresh (kills existing server, wipes DB, rebuilds, starts)
fresh: build
-pkill -f "./{{binary_name}}" 2>/dev/null
@sleep 1
rm -f data/openpaw.db data/openpaw.db-wal data/openpaw.db-shm
@echo "Database wiped. Starting fresh..."
./{{binary_name}}
# Reset database and run E2E tests from scratch
e2e-fresh: build
-pkill -f "./{{binary_name}}" 2>/dev/null
@sleep 1
rm -f data/openpaw.db data/openpaw.db-wal data/openpaw.db-shm
@echo "Database wiped. Starting server for E2E..."
@OPENPAW_NO_OPEN=1 ./{{binary_name}} & sleep 3 && npx playwright test; pkill -f "./{{binary_name}}" 2>/dev/null || true
@echo "E2E tests complete. Run 'just e2e-report' to view results."
# Install frontend dependencies
frontend-install:
cd {{frontend_dir}} && npm install
# Clean build artifacts
clean:
rm -f {{binary_name}}
rm -rf {{frontend_dir}}/dist
# ============================================
# DATABASE
# ============================================
# Show database file info
db-info:
@ls -lh data/openpaw.db 2>/dev/null || echo "No database found (created on first run)"
# Reset database (deletes all data - requires confirmation)
db-reset:
@echo "This will DELETE the database. Press Ctrl+C to cancel, Enter to continue."
@read _confirm
rm -f data/openpaw.db data/openpaw.db-wal data/openpaw.db-shm
@echo "Database deleted. Will be recreated on next run."
# Show migration files
db-migrations:
@ls -1 internal/database/migrations/
# ============================================
# E2E TESTING (Playwright)
# ============================================
# Run all Playwright E2E tests (server must be running)
e2e:
npx playwright test
# Run E2E tests with visible browser
e2e-headed:
npx playwright test --headed
# Run only the setup + auth tests
e2e-auth:
npx playwright test --project=setup && npx playwright test auth.spec.ts
# Run specific test file (e.g., just e2e-file chat)
e2e-file name:
npx playwright test {{name}}.spec.ts
# Show last E2E test report
e2e-report:
npx playwright show-report
# Run E2E with full build + server (builds, starts server, runs tests, stops server)
e2e-full: build
@echo "Starting server for E2E tests..."
@OPENPAW_NO_OPEN=1 ./{{binary_name}} & sleep 3 && npx playwright test; pkill -f "./{{binary_name}}" 2>/dev/null || true
@echo "E2E tests complete. Run 'just e2e-report' to view results."
# ============================================
# CODE QUALITY
# ============================================
# Run full quality gate (lint + vet + test + build)
quality: lint vet test build
@echo "All quality checks passed"
# The works: tidy, lint, vet, test, build, dead code — run before shipping
awesome:
#!/usr/bin/env bash
set -e
echo ""
echo "🐾 OpenPaw Awesome Check"
echo "========================"
echo ""
echo "→ [1/7] Go mod tidy..."
go mod tidy
if ! git diff --quiet go.mod go.sum 2>/dev/null; then
echo " ✗ go.mod or go.sum changed — commit the tidy first"
exit 1
fi
echo " ✓ modules clean"
echo "→ [2/7] Go vet..."
go vet -tags fts5 ./...
echo " ✓ vet passed"
echo "→ [3/7] Frontend lint..."
cd {{frontend_dir}} && npm run lint
echo " ✓ lint passed"
echo "→ [4/7] Go tests..."
cd {{project_root}} && go test -tags fts5 ./...
echo " ✓ tests passed"
echo "→ [5/7] Frontend build (TypeScript + Vite)..."
cd {{frontend_dir}} && npm run build
echo " ✓ frontend built"
echo "→ [6/7] Go build..."
cd {{project_root}} && CGO_ENABLED=1 go build -tags fts5 -o {{binary_name}} ./cmd/openpaw
echo " ✓ binary built"
echo "→ [7/7] Dead code scan (knip)..."
cd {{frontend_dir}} && npx knip --reporter compact 2>&1 || true
echo " ✓ dead code scan complete"
echo ""
echo "========================"
echo "🐾 All checks passed — ready to ship!"
echo ""
# Run knip dead code detection
dead-code:
cd {{frontend_dir}} && npx knip
# Check Go module tidiness
tidy:
go mod tidy
# ============================================
# API & DEBUG
# ============================================
# Show all API routes (grep from server.go)
routes:
@grep -E '\.(Get|Post|Put|Delete|Patch)\(' internal/server/server.go | sed 's/.*r\.//' | sort
# Check if Claude Code CLI is installed
check-claude:
@claude --version 2>/dev/null || echo "Claude Code CLI not found"
# Show system info (port, data dir, etc.)
info:
@echo "Binary: {{binary_name}}"
@echo "Frontend: {{frontend_dir}}"
@echo "Port: 41295 (default)"
@echo "Data dir: ./data/"
@echo "Database: ./data/openpaw.db"
@echo "Go module: github.com/openpaw/openpaw"
# ============================================
# DESKTOP (Tauri)
# ============================================
# Build Go sidecar with target-triple name for Tauri
desktop-sidecar: frontend-build
@mkdir -p desktop/src-tauri/binaries
CGO_ENABLED=1 go build {{go_tags}} "{{go_ldflags}}" -o desktop/src-tauri/binaries/openpaw-$(rustc --print host-tuple) ./cmd/openpaw
# Run Tauri dev mode (rebuilds sidecar first)
desktop-dev: desktop-sidecar
cd desktop && npm run tauri dev
# Build production Tauri app (rebuilds sidecar first, unsigned)
desktop-build: desktop-sidecar
cd desktop && npm run tauri build
# Build a SIGNED + NOTARIZED macOS app (rebuilds sidecar first).
# Requires a "Developer ID Application" cert in the keychain and
# APPLE_ID / APPLE_PASSWORD (app-specific) / APPLE_TEAM_ID in the environment.
# Override the cert with APPLE_SIGNING_IDENTITY=... if needed.
desktop-release: desktop-sidecar
cd desktop && APPLE_SIGNING_IDENTITY="${APPLE_SIGNING_IDENTITY:-Developer ID Application: Wynter Jones (7X2UF4FZHC)}" npm run tauri build
./scripts/notarize-dmg.sh
# Clean desktop build artifacts
desktop-clean:
rm -rf desktop/src-tauri/binaries/openpaw-*
rm -rf desktop/src-tauri/target
# Generate desktop app icons from square icon (requires npx)
desktop-icons:
cd desktop && npx @tauri-apps/cli icon ../assets/icon.png
# ============================================
# NAVIGATION
# ============================================
# Go to audit folder
audit:
@echo "{{project_root}}/_AUDIT" && cd {{project_root}}/_AUDIT
# Go to plans folder
plans:
@echo "{{project_root}}/_PLANS" && cd {{project_root}}/_PLANS
# Go to research folder
research:
@echo "{{project_root}}/_RESEARCH" && cd {{project_root}}/_RESEARCH
# Go to commands folder
commands:
@echo "{{project_root}}/.claude/commands" && cd {{project_root}}/.claude/commands
# Go to agents folder
agents:
@echo "{{project_root}}/.claude/agents" && cd {{project_root}}/.claude/agents
# ============================================
# UTILITIES
# ============================================
# Show project structure
overview:
@tree -L 2 -I 'node_modules|.git|dist|coverage|__pycache__|.venv|data' 2>/dev/null || find . -maxdepth 2 -type d | head -30
# Search for files by name
search pattern:
@find . -name "*{{pattern}}*" -not -path "./node_modules/*" -not -path "./.git/*" -not -path "./data/*" 2>/dev/null
# Show git status
status:
@git status --short