-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
314 lines (260 loc) · 8.76 KB
/
Copy pathmise.toml
File metadata and controls
314 lines (260 loc) · 8.76 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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
[tools]
rust = "latest"
# =============================================================================
# Setup Tasks (one-time setup for faster builds)
# =============================================================================
[tasks.setup-linker]
description = "Install fast linker for your platform (mold on Linux, lld on macOS)"
run = """
#!/usr/bin/env bash
set -e
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "macOS detected - installing lld via Homebrew..."
if ! command -v lld &> /dev/null; then
brew install llvm
LLVM_PATH="$(brew --prefix llvm)/bin"
echo "lld installed. Add to your shell profile:"
echo " export PATH=$LLVM_PATH:$""PATH"
else
echo "lld already installed"
fi
elif [[ "$OSTYPE" == "linux"* ]]; then
echo "Linux detected - installing mold..."
if ! command -v mold &> /dev/null; then
if command -v apt-get &> /dev/null; then
sudo apt-get update && sudo apt-get install -y mold clang
elif command -v dnf &> /dev/null; then
sudo dnf install -y mold clang
elif command -v pacman &> /dev/null; then
sudo pacman -S mold clang
else
echo "Please install mold manually: https://github.com/rui314/mold"
exit 1
fi
else
echo "mold already installed"
fi
fi
echo "Done! Your builds should now link much faster."
"""
[tasks.setup-tools]
description = "Install optional dev tools (cargo-nextest for faster tests, bacon for watching)"
run = """
#!/usr/bin/env bash
set -e
echo "Installing cargo-nextest (faster test runner)..."
cargo install cargo-nextest --locked
echo "Installing bacon (cargo watcher with better UX)..."
cargo install bacon --locked
echo "Installing cargo-watch (for cargo watch commands)..."
cargo install cargo-watch --locked
echo "Done! Use 'mise run test-fast' for faster tests."
"""
# =============================================================================
# Frontend Build Tasks
# =============================================================================
[tasks.build-docs]
description = "Build the documentation site"
sources = ["docs/src/**/*", "docs/public/**/*", "docs/astro.config.mjs", "docs/package.json"]
outputs = ["docs/dist/**/*"]
run = "cd docs && bun install && bun run build"
[tasks.build-web]
description = "Build the web frontend"
sources = ["web/shared/src/**/*", "web/client/src/**/*", "web/frontend/src/**/*", "web/*/package.json"]
outputs = ["web/frontend/dist/**/*", "web/client/dist/**/*", "web/shared/dist/**/*"]
run = "cd web && bun install && bun run build"
[tasks.lint-web]
description = "Lint web packages"
run = "cd web && bun run lint"
[tasks.typecheck-web]
description = "Typecheck web packages"
run = "cd web && bun run typecheck"
[tasks.typecheck-docs]
description = "Typecheck documentation"
run = "cd docs && bun run typecheck"
# =============================================================================
# Mobile Tasks
# =============================================================================
[tasks.lint-mobile]
description = "Lint mobile package"
run = "cd mobile && bun run lint"
[tasks.typecheck-mobile]
description = "Typecheck mobile package"
run = "cd mobile && bun run typecheck"
[tasks.test-mobile]
description = "Run mobile tests"
run = "cd mobile && bun run test"
[tasks.format-mobile]
description = "Format mobile package"
run = "cd mobile && bun run format"
[tasks.format-check-mobile]
description = "Check mobile formatting"
run = "cd mobile && bun run format:check"
# =============================================================================
# Rust Build Tasks
# =============================================================================
[tasks.build]
description = "Build the project (builds docs and web first)"
depends = ["build-docs", "build-web"]
run = "cargo build"
[tasks.release]
description = "Build in release mode (builds docs and web first)"
depends = ["build-docs", "build-web"]
run = "cargo build --release"
[tasks.install]
description = "Install clauderon binary (debug mode, fast build)"
depends = ["build-docs", "build-web"]
run = """
cargo install --path . --debug
pkill -f 'clauderon daemon' 2>/dev/null || true
"""
[tasks.install-release]
description = "Install clauderon binary (release mode, optimized but slow build)"
depends = ["build-docs", "build-web"]
run = """
cargo install --path .
pkill -f 'clauderon daemon' 2>/dev/null || true
"""
# =============================================================================
# Rust Quality Tasks
# =============================================================================
[tasks.test]
description = "Run Rust tests"
depends = ["build-docs", "build-web"]
run = "cargo test"
[tasks.test-fast]
description = "Run Rust tests with nextest (faster, requires cargo-nextest)"
depends = ["build-docs", "build-web"]
run = "cargo nextest run"
[tasks.test-config]
description = "Run fast config isolation tests"
depends = ["build-docs", "build-web"]
run = "cargo nextest run --test config_isolation_tests"
[tasks.check]
description = "Run cargo check"
depends = ["build-docs", "build-web"]
run = "cargo check"
[tasks.clippy]
description = "Run clippy linter"
depends = ["build-docs", "build-web"]
run = "cargo clippy"
[tasks.clippy-strict]
description = "Run clippy with warnings as errors (for CI)"
depends = ["build-docs", "build-web"]
run = "cargo clippy -- -D warnings"
[tasks.fmt]
description = "Format Rust code"
run = "cargo fmt"
[tasks.fmt-check]
description = "Check Rust formatting"
run = "cargo fmt --check"
# =============================================================================
# Cleanup Tasks
# =============================================================================
[tasks.clean]
description = "Clean all build artifacts"
run = """
cargo clean
rm -rf docs/dist
rm -rf web/shared/dist web/client/dist web/frontend/dist
rm -rf web/shared/src/generated/*
"""
[tasks.clean-rust]
description = "Clean only Rust build artifacts"
run = "cargo clean"
[tasks.clean-web]
description = "Clean only web build artifacts"
run = "cd web && bun run clean"
# =============================================================================
# CI Tasks
# =============================================================================
[tasks.ci]
description = "Run all CI checks (format, lint, typecheck, test, build)"
depends = ["fmt-check", "build-docs", "build-web"]
run = """
cargo clippy -- -D warnings
cd web && bun run lint
cd docs && bun run typecheck
cd web && bun run typecheck
cd mobile && bun run lint
cd mobile && bun run typecheck
cd mobile && bun run format:check
cd mobile && bun run test
cargo test
cargo build --release
"""
[tasks.ci-quick]
description = "Quick CI check (no release build)"
depends = ["fmt-check", "build-docs", "build-web"]
run = """
cargo clippy -- -D warnings
cargo test
cargo check
"""
# =============================================================================
# Development Tasks
# =============================================================================
[tasks.dev]
description = "Build and run daemon in dev mode (one-shot)"
depends = ["install"]
run = "CLAUDERON_DEV=1 clauderon daemon"
[tasks.watch]
description = "Watch for changes and run cargo check (requires bacon or cargo-watch)"
run = """
#!/usr/bin/env bash
if command -v bacon &> /dev/null; then
bacon
elif command -v cargo-watch &> /dev/null; then
cargo watch -x check
else
echo "Please install bacon or cargo-watch: mise run setup-tools"
exit 1
fi
"""
[tasks.watch-test]
description = "Watch for changes and run tests"
run = """
#!/usr/bin/env bash
if command -v bacon &> /dev/null; then
bacon test
elif command -v cargo-watch &> /dev/null; then
cargo watch -x test
else
echo "Please install bacon or cargo-watch: mise run setup-tools"
exit 1
fi
"""
[tasks.dev-watch]
description = "Watch for git changes, rebuild, and run daemon in dev mode"
run = """
#!/usr/bin/env bash
set -e
# Kill any existing daemon
pkill -f 'clauderon daemon' 2>/dev/null || true
# Initial build if binary doesn't exist
if ! command -v clauderon &> /dev/null; then
echo "Initial build..."
mise run install
fi
while true; do
# Check if origin/main has new commits
OLD_REMOTE=$(git rev-parse origin/main)
git fetch origin main --quiet
NEW_REMOTE=$(git rev-parse origin/main)
if [ "$OLD_REMOTE" != "$NEW_REMOTE" ]; then
echo "New commits on origin/main, pulling..."
git pull --rebase --autostash --quiet
echo "Rebuilding (docs, web, binary)..."
mise run install
echo "Restarting daemon..."
pkill -f 'clauderon daemon' 2>/dev/null || true
sleep 1
fi
# Ensure daemon is running
if ! pgrep -f 'clauderon daemon' > /dev/null; then
echo "Starting daemon in dev mode..."
CLAUDERON_DEV=1 clauderon daemon &
fi
sleep 10
done
"""