-
Notifications
You must be signed in to change notification settings - Fork 686
Expand file tree
/
Copy pathmise.toml
More file actions
762 lines (666 loc) · 24.2 KB
/
mise.toml
File metadata and controls
762 lines (666 loc) · 24.2 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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
# =============================================================================
# Cog Development Tasks
# =============================================================================
#
# Run `mise tasks` to see all available tasks.
#
# ## Task Caching
#
# Some build tasks use `sources` and `outputs` for caching. When sources haven't
# changed since the last run, mise skips the task. To force a rebuild:
#
# mise run build:sdk --force
# mise run build:coglet:wheel --force
#
# Cached tasks:
# - build:sdk - skips if python/**/*.py unchanged
# - build:coglet:wheel* - skips if crates/**/*.rs unchanged
# - generate:stubs - skips if coglet-python source unchanged
# - generate:compat - skips if tools/compatgen unchanged
# - docs - skips if docs/**/*.md unchanged
#
# Tasks that always run (no caching):
# - fmt:*, lint:*, test:* - always check current state
# - clean:* - always destructive
#
# =============================================================================
experimental_monorepo_root = true
[monorepo]
config_roots = ["."]
[tools]
go = "latest"
uv = "0.9.26"
"pipx:nox" = { version = "2025.11.12", uvx = true, uvx_args = "--python-preference=managed -p 3.13" }
"aqua:ziglang/zig" = "0.15.2"
"rust" = { version = "1.93.0", components = "rustfmt,clippy", targets ="x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,aarch64-apple-darwin" }
cargo-binstall = "1.16.6"
# Cargo tools - use aqua backend where available for faster binary downloads
# and better security (cosign/SLSA verification). Remaining cargo: tools use binstall.
"aqua:EmbarkStudios/cargo-deny" = "0.19.0"
"aqua:mitsuhiko/insta" = "1.46.0"
"cargo:cargo-nextest" = "0.9.120"
"cargo:maturin" = "1.11.5"
"aqua:rust-lang/rustup" = "latest"
"aqua:rust-lang/rustup/rustup-init" = "latest"
"aqua:rust-cross/cargo-zigbuild" = "0.20.1"
"aqua:gotestyourself/gotestsum" = "1.13.0"
"aqua:golangci/golangci-lint" = "2.10.1"
ruff = "0.14.13"
ty = "0.0.10"
"npm:markdownlint-cli2" = "0.22.0"
[env]
_.path = "./bin"
_.file = [".env"]
# Set REPO_ROOT only if not already set (e.g., by CI)
REPO_ROOT = "{{env.REPO_ROOT | default(value=config_root)}}"
# CGo required for go-tree-sitter (static Python schema parser)
CGO_ENABLED = "1"
[settings]
lockfile = true
experimental = true
# =============================================================================
# Helper tasks (hidden)
# =============================================================================
[tasks._setup_dist]
hide = true
silent = true
description = "Create dist directory"
run = "mkdir -p dist"
[tasks._setup_venv]
hide = true
silent = true
description = "Ensure root .venv exists with Python"
run = "test -d .venv || uv venv --quiet"
[tasks._clean_dist]
hide = true
silent = true
description = "Clean dist directory"
run = "rm -f dist/cog-*.whl dist/cog-*.tar.gz dist/coglet-*.whl"
# =============================================================================
# Build tasks
# =============================================================================
[tasks.build]
alias = "build:all"
description = "Build all components"
run = [
{ tasks = ["build:cog", "build:coglet:wheel:linux-x64", "build:sdk"] },
{ task = "_build_summary" },
]
[tasks._build_summary]
hide = true
description = "Print build artifacts summary"
run = """
#!/usr/bin/env bash
echo ""
echo "=== Build Artifacts ==="
if BINARY=$(ls dist/go/*/cog 2>/dev/null | head -1); then
VERSION=$("$BINARY" --version 2>/dev/null || echo "unknown")
echo " cli: $BINARY ($VERSION)"
fi
for whl in dist/coglet-*.whl; do
[ -f "$whl" ] && echo " coglet: $whl"
done
for whl in dist/cog-*.whl; do
[ -f "$whl" ] && echo " python-sdk: $whl"
done
echo ""
"""
[tasks.install]
depends = ["build:cog"]
description = "Build and symlink cog CLI"
usage = 'arg "[dest]" help="Directory to symlink into (e.g. ~/.local/bin)" default="~/.local/bin"'
run = """
#!/usr/bin/env bash
set -e
DEST="${usage_dest/#\\~/$HOME}"
BINARY=$(ls dist/go/*/cog 2>/dev/null | head -1)
if [ -z "$BINARY" ]; then
echo "Error: no cog binary found in dist/go/. Run 'mise run build:cog' first." >&2
exit 1
fi
BINARY="$(cd "$(dirname "$BINARY")" && pwd)/$(basename "$BINARY")"
mkdir -p "$DEST"
ln -sf "$BINARY" "$DEST/cog"
echo "Installed $DEST/cog -> $BINARY"
"""
[tasks."build:cog"]
description = "Build cog CLI (development)"
sources = ["cmd/**/*.go", "pkg/**/*.go", "go.mod", "go.sum", "VERSION.txt"]
outputs = ["dist/go/*/cog"]
run = """
#!/usr/bin/env bash
set -e
# Don't set COG_VERSION — let goreleaser's snapshot template produce a dev version
# (e.g. 0.17.1-dev+gabcdef) so local wheel auto-detection works.
GOFLAGS=-buildvcs=false go run github.com/goreleaser/goreleaser/v2@latest build --clean --snapshot --single-target --id cog --output cog
"""
[tasks."build:cog:release"]
description = "Build cog CLI (release)"
run = "go run github.com/goreleaser/goreleaser/v2@latest build --clean --single-target --id cog --output cog"
[tasks."build:rust"]
description = "Build Rust workspace"
run = "cargo build --manifest-path crates/Cargo.toml --workspace"
[tasks."build:rust:release"]
description = "Build Rust workspace (release)"
run = "cargo build --manifest-path crates/Cargo.toml --workspace --release"
[tasks."build:coglet"]
description = "Build coglet Python wheel (development, local install)"
run = [
{ task = "_setup_venv" },
"maturin develop --manifest-path crates/coglet-python/Cargo.toml",
]
[tasks."build:coglet:wheel"]
description = "Build coglet Python wheel (native platform)"
# No sources/outputs caching: the output glob dist/coglet-*.whl is too broad
# and falsely matches cross-compiled wheels (e.g. linux-x64), causing skips.
# Use --force if you need to bypass mise's staleness check.
run = [
{ tasks = ["_setup_dist", "_setup_venv"] },
"maturin build --release --out dist --manifest-path crates/coglet-python/Cargo.toml",
]
[tasks."build:coglet:wheel:linux-x64"]
description = "Build coglet Python wheel for Linux x86_64"
sources = ["crates/**/*.rs", "crates/**/Cargo.toml", "Cargo.lock"]
outputs = ["dist/coglet-*manylinux*x86_64*.whl"]
run = [
{ tasks = ["_setup_dist", "_setup_venv"] },
"maturin build --release --out dist --manifest-path crates/coglet-python/Cargo.toml --target x86_64-unknown-linux-gnu --zig",
]
[tasks."build:coglet:wheel:linux-arm64"]
description = "Build coglet Python wheel for Linux ARM64"
sources = ["crates/**/*.rs", "crates/**/Cargo.toml", "Cargo.lock"]
outputs = ["dist/coglet-*manylinux*aarch64*.whl"]
run = [
{ tasks = ["_setup_dist", "_setup_venv"] },
"maturin build --release --out dist --manifest-path crates/coglet-python/Cargo.toml --target aarch64-unknown-linux-gnu --zig",
]
[tasks."build:coglet:wheel:darwin-arm64"]
description = "Build coglet Python wheel for macOS ARM64"
sources = ["crates/**/*.rs", "crates/**/Cargo.toml", "Cargo.lock"]
outputs = ["dist/coglet-*-macosx_*_arm64.whl"]
run = [
{ tasks = ["_setup_dist", "_setup_venv"] },
"maturin build --release --out dist --manifest-path crates/coglet-python/Cargo.toml --target aarch64-apple-darwin",
]
[tasks."build:coglet:wheel:darwin-x64"]
description = "Build coglet Python wheel for macOS x86_64"
sources = ["crates/**/*.rs", "crates/**/Cargo.toml", "Cargo.lock"]
outputs = ["dist/coglet-*-macosx_*_x86_64.whl"]
run = [
{ tasks = ["_setup_dist", "_setup_venv"] },
"maturin build --release --out dist --manifest-path crates/coglet-python/Cargo.toml --target x86_64-apple-darwin",
]
[tasks."build:coglet:wheel:all"]
description = "Build coglet Python wheels for all platforms"
run = [
{ task = "_setup_dist" },
{ tasks = ["build:coglet:wheel:linux-x64", "build:coglet:wheel:linux-arm64"] },
{ task = "build:coglet:wheel" },
]
[tasks."build:sdk"]
description = "Build cog SDK wheel"
sources = ["python/**/*.py", "pyproject.toml", "VERSION.txt"]
outputs = ["dist/cog-*.whl", "dist/cog-*.tar.gz"]
run = [
{ tasks = ["_setup_dist", "_setup_venv"] },
"""
#!/usr/bin/env bash
set -euo pipefail
# Version from VERSION.txt, converted to PEP 440
RAW=$(tr -d '[:space:]' < VERSION.txt)
export SETUPTOOLS_SCM_PRETEND_VERSION=$(echo "$RAW" | sed -E 's/-alpha/a/; s/-beta/b/; s/-rc/rc/; s/-dev/.dev/')
echo "Building SDK wheel: $SETUPTOOLS_SCM_PRETEND_VERSION"
uv build --out-dir=dist .
""",
]
[tasks."build:wheels"]
description = "Build all wheels (coglet + sdk)"
run = [
{ task = "_clean_dist" },
{ task = "_setup_dist" },
{ tasks = ["build:coglet:wheel:all", "build:sdk"] },
]
# =============================================================================
# Test tasks
# =============================================================================
[tasks.test]
description = "Run all unit tests (set INTEGRATION_TESTS=1 to include integration)"
run = """
#!/usr/bin/env bash
set -e
mise run test:go
mise run test:rust
mise run test:python
if [ "${INTEGRATION_TESTS:-}" = "1" ]; then
mise run test:integration
fi
"""
[tasks."test:go"]
description = "Run Go tests"
run = "gotestsum -- -short -timeout 1200s -parallel 5 ./..."
[tasks."test:rust"]
description = "Run Rust workspace tests"
run = "cargo nextest run --manifest-path crates/Cargo.toml --workspace --exclude coglet-python --no-tests=pass"
[tasks."test:python"]
description = "Run Python SDK tests (latest supported Python)"
depends = ["build:coglet:wheel"]
run = "nox -s tests -p 3.13"
[tasks."test:python:all"]
description = "Run Python SDK tests on all supported Python versions"
depends = ["build:coglet:wheel"]
run = "nox -s tests"
[tasks."test:coglet:python"]
description = "Run coglet Python binding tests (latest Python)"
depends = ["build:coglet:wheel"]
run = "nox -s coglet -p 3.13"
[tasks."test:coglet:python:all"]
description = "Run coglet Python binding tests on all supported Python versions"
depends = ["build:coglet:wheel"]
run = "nox -s coglet"
[tasks."test:fuzz"]
description = "Run Go fuzz tests (FUZZTIME=30s per target by default)"
run = """
#!/usr/bin/env bash
set -e
FUZZTIME="${FUZZTIME:-30s}"
echo "Fuzzing schema type resolution ($FUZZTIME)..."
go test ./pkg/schema/ -run='^$' -fuzz=FuzzResolveSchemaType -fuzztime="$FUZZTIME"
echo "Fuzzing JSON schema generation ($FUZZTIME)..."
go test ./pkg/schema/ -run='^$' -fuzz=FuzzJSONSchema -fuzztime="$FUZZTIME"
echo "Fuzzing Python parser ($FUZZTIME)..."
go test ./pkg/schema/python/ -run='^$' -fuzz=FuzzParsePredictor -fuzztime="$FUZZTIME"
echo "Fuzzing type annotation parsing ($FUZZTIME)..."
go test ./pkg/schema/python/ -run='^$' -fuzz=FuzzParseTypeAnnotation -fuzztime="$FUZZTIME"
echo "All fuzz targets passed."
"""
[tasks."test:integration"]
description = "Run integration tests (skips slow tests by default, set SHORT=0 for full suite)"
depends = ["clean:integration", "build:cog", "build:sdk", "build:coglet:wheel:linux-x64"]
run = """
#!/usr/bin/env bash
set -e
SHORT_FLAG="-short"
if [ "${SHORT:-1}" = "0" ]; then
SHORT_FLAG=""
fi
# If first arg is a bare name (no dash), treat as test name filter;
# remaining args are passed through to go test.
# e.g. mise run test:integration coglet_large_output -count=4
if [ $# -gt 0 ] && [[ "$1" != -* ]]; then
gotestsum -- -tags integration -v $SHORT_FLAG -run "TestIntegration/$1" "${@:2}" -timeout 30m ./integration-tests/...
else
gotestsum -- -tags integration -v $SHORT_FLAG -parallel ${TEST_PARALLEL:-4} "$@" -timeout 30m ./integration-tests/...
fi
"""
# =============================================================================
# Format tasks
# =============================================================================
[tasks.fmt]
alias = ["format", "fmt:check", "format:check"]
description = "Check formatting for all languages (non-destructive)"
run = [
{ tasks = ["fmt:go", "fmt:rust", "fmt:python", "fmt:docs"] },
]
[tasks."fmt:fix"]
alias = "format:fix"
description = "Fix formatting for all languages"
run = [
{ tasks = ["fmt:go:fix", "fmt:rust:fix", "fmt:python:fix", "fmt:docs:fix"] },
]
# Go formatting
[tasks."fmt:go"]
alias = "fmt:go:check"
description = "Check Go formatting"
run = """
#!/usr/bin/env bash
set -e
go tool goimports -d .
test -z "$(go tool goimports -l .)"
"""
[tasks."fmt:go:fix"]
description = "Fix Go formatting"
run = "go tool goimports -w -d ."
# Rust formatting
[tasks."fmt:rust"]
alias = "fmt:rust:check"
description = "Check Rust formatting"
run = "cargo fmt --manifest-path crates/Cargo.toml --all -- --check"
[tasks."fmt:rust:fix"]
description = "Fix Rust formatting"
run = "cargo fmt --manifest-path crates/Cargo.toml --all"
# Python formatting
[tasks."fmt:python"]
alias = "fmt:python:check"
description = "Check Python formatting"
run = "ruff format --check ."
[tasks."fmt:python:fix"]
description = "Fix Python formatting"
run = "ruff format ."
# Docs formatting
[tasks."fmt:docs"]
alias = "fmt:docs:check"
description = "Check Markdown formatting"
run = "markdownlint-cli2"
[tasks."fmt:docs:fix"]
description = "Fix Markdown formatting"
run = "markdownlint-cli2 --fix"
# =============================================================================
# Lint tasks
# =============================================================================
[tasks.lint]
alias = "lint:check"
description = "Run linters for all languages (non-destructive)"
run = [
{ tasks = ["lint:go", "lint:rust", "lint:python", "lint:docs"] },
]
[tasks."lint:fix"]
description = "Fix lint issues for all languages"
run = [
{ tasks = ["lint:go:fix", "lint:rust:fix", "lint:python:fix", "lint:docs:fix"] },
]
# Markdown linting
[tasks."lint:docs"]
alias = "lint:docs:check"
description = "Lint Markdown files"
run = "markdownlint-cli2"
[tasks."lint:docs:fix"]
description = "Fix lint issues in Markdown files"
run = "markdownlint-cli2 --fix"
# Go linting
[tasks."lint:go"]
alias = "lint:go:check"
description = "Lint Go code"
run = "golangci-lint run ./..."
[tasks."lint:go:fix"]
description = "Fix Go lint issues (limited auto-fix)"
run = "golangci-lint run --fix ./..."
# Rust linting
[tasks."lint:rust"]
alias = ["lint:rust:check", "lint:rust:clippy"]
description = "Lint Rust code (clippy)"
run = "cargo clippy --manifest-path crates/Cargo.toml --workspace -- -D warnings"
[tasks."lint:rust:deny"]
description = "Check Rust licenses and advisories"
run = "cargo deny --manifest-path crates/Cargo.toml check"
[tasks."lint:rust:fix"]
description = "Fix Rust lint issues"
run = "cargo clippy --manifest-path crates/Cargo.toml --workspace --fix --allow-dirty -- -D warnings"
# Python linting
[tasks."lint:python"]
alias = "lint:python:check"
description = "Lint Python code"
run = """
#!/usr/bin/env bash
set -e
ruff check .
mise run typecheck:python
"""
[tasks."lint:python:fix"]
description = "Fix Python lint issues"
run = "ruff check --fix ."
# =============================================================================
# Typecheck tasks
# =============================================================================
[tasks.typecheck]
description = "Run type checking for all languages"
run = [
{ tasks = ["typecheck:rust", "typecheck:python"] },
]
[tasks."typecheck:rust"]
description = "Type check Rust code (cargo check)"
run = "cargo check --manifest-path crates/Cargo.toml --workspace"
[tasks."typecheck:python"]
description = "Type check Python code"
run = "nox -s typecheck"
# =============================================================================
# Generate tasks
# =============================================================================
[tasks.generate]
description = "Run all code generation"
run = [
{ tasks = ["generate:stubs"] },
]
[tasks."generate:stubs"]
alias = "stub:generate"
description = "Generate Python type stubs for coglet"
dir = "crates/coglet-python"
run = [
{ task = "_setup_venv" },
"""
#!/usr/bin/env bash
set -e
# stub_gen embeds Python via PyO3 auto-initialize. Py_InitializeEx needs
# PYTHONHOME to locate the stdlib (encodings, etc.) when the binary lives
# outside the Python installation tree (common with uv-managed Python).
PYTHON_PREFIX="$(uv run --active python -c 'import sys; print(sys.base_prefix)')"
export PYTHONHOME="$PYTHON_PREFIX"
# On Linux, also ensure the dynamic linker can find libpython.
export LD_LIBRARY_PATH="${PYTHON_PREFIX}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
uv run --active cargo run --bin stub_gen
# pyo3-stub-gen output doesn't match ruff style (trailing whitespace in
# docstrings, long lines, quote style). Format so stub:check is clean.
find coglet -name '*.pyi' -exec uv run --active ruff format {} +
""",
]
[tasks."generate:compat"]
description = "Regenerate CUDA/PyTorch/TensorFlow compatibility matrices"
sources = ["tools/compatgen/**/*.go"]
outputs = ["pkg/config/cuda_base_images.json", "pkg/config/torch_compatibility_matrix.json", "pkg/config/tf_compatibility_matrix.json"]
run = """
#!/usr/bin/env bash
set -e
target="${1:-all}"
case "$target" in
cuda)
echo "Generating CUDA base images..."
go run ./tools/compatgen/main.go cuda -o pkg/config/cuda_base_images.json
;;
torch)
echo "Generating PyTorch compatibility matrix..."
go run ./tools/compatgen/main.go torch -o pkg/config/torch_compatibility_matrix.json
;;
tensorflow|tf)
echo "Generating TensorFlow compatibility matrix..."
go run ./tools/compatgen/main.go tensorflow -o pkg/config/tf_compatibility_matrix.json
;;
all)
echo "Generating CUDA base images..."
go run ./tools/compatgen/main.go cuda -o pkg/config/cuda_base_images.json
echo "Generating PyTorch compatibility matrix..."
go run ./tools/compatgen/main.go torch -o pkg/config/torch_compatibility_matrix.json
echo "Generating TensorFlow compatibility matrix..."
go run ./tools/compatgen/main.go tensorflow -o pkg/config/tf_compatibility_matrix.json
;;
*)
echo "Unknown target: $target"
echo "Usage: mise run generate:compat [cuda|torch|tensorflow|all]"
exit 1
;;
esac
echo "Done."
"""
# =============================================================================
# Stub tasks
# =============================================================================
[tasks."stub:check"]
description = "Check that coglet Python stubs are up to date"
dir = "crates/coglet-python"
run = [
{ task = "generate:stubs" },
'''
#!/usr/bin/env bash
set -e
if ! git diff --quiet -- '**/*.pyi'; then
echo "ERROR: Stubs are out of date:"
git diff -- '**/*.pyi'
echo ""
echo "Run 'mise run generate:stubs' to update."
exit 1
fi
echo "Stubs are up to date."
''',
]
[tasks."stub:typecheck"]
description = "Type-check coglet stubs with ty"
run = "ty check crates/coglet-python/coglet/__init__.pyi"
# =============================================================================
# Clean tasks
# =============================================================================
[tasks.clean]
description = "Clean all build artifacts"
run = [
{ tasks = ["clean:go", "clean:rust", "clean:python", "clean:integration"] },
{ task = "_clean_dist" },
]
[tasks."clean:go"]
description = "Clean Go build artifacts"
run = "rm -rf cog base-image dist/go"
[tasks."clean:rust"]
description = "Clean Rust build artifacts"
run = "cd crates && cargo clean"
[tasks."clean:python"]
description = "Clean Python build artifacts"
run = "rm -rf .tox build python/cog.egg-info .venv crates/coglet-python/.venv crates/coglet-python/coglet/*.so"
[tasks."clean:integration"]
description = "Clean cached integration test binary and embedded wheels"
run = "rm -f integration-tests/.bin/cog pkg/wheels/cog-*.whl pkg/wheels/coglet-*.whl"
# =============================================================================
# Docs tasks
# =============================================================================
[tasks.docs]
description = "Build documentation"
sources = ["docs/**/*.md", "README.md", "CONTRIBUTING.md", "mkdocs.yml"]
outputs = ["site/**"]
run = """
#!/usr/bin/env bash
set -e
uv pip install mkdocs-material
sed 's/docs\\///g' README.md > ./docs/README.md
cp CONTRIBUTING.md ./docs/
mkdocs build
"""
[tasks."docs:serve"]
description = "Serve documentation locally"
run = """
#!/usr/bin/env bash
set -e
uv pip install mkdocs-material
sed 's/docs\\///g' README.md > ./docs/README.md
cp CONTRIBUTING.md ./docs/
mkdocs serve
"""
[tasks."docs:llm"]
description = "Update LLM documentation (llms.txt)"
depends = ["docs:cli"]
sources = ["README.md", "docs/*.md"]
outputs = ["docs/llms.txt"]
run = """
#!/usr/bin/env bash
set -e
# Concatenate README (minus contributors section) + all docs into llms.txt
# Use awk instead of sed for cross-platform compatibility (BSD sed vs GNU sed)
# Only include git-tracked files (docs/ may contain mkdocs-generated copies of CONTRIBUTING.md, README.md)
(awk '/^## Contributors/{exit} {print}' README.md; for file in $(git ls-files 'docs/*.md'); do printf '\n\n---\n\n' && cat "$file"; done) > docs/llms.txt
echo "Updated docs/llms.txt"
"""
[tasks."docs:llm:check"]
description = "Check that llms.txt is up to date"
run = """
#!/usr/bin/env bash
set -e
tmpfile=$(mktemp)
trap 'rm -f "$tmpfile"' EXIT
# Generate to temp file and compare
# Only include git-tracked files (docs/ may contain mkdocs-generated copies of CONTRIBUTING.md, README.md)
(awk '/^## Contributors/{exit} {print}' README.md; for file in $(git ls-files 'docs/*.md'); do printf '\n\n---\n\n' && cat "$file"; done) > "$tmpfile"
if ! diff -q "$tmpfile" docs/llms.txt > /dev/null 2>&1; then
echo "ERROR: docs/llms.txt is out of date. Run 'mise run docs:llm' to update."
exit 1
fi
echo "docs/llms.txt is up to date"
"""
[tasks."docs:cli"]
description = "Generate CLI reference documentation"
sources = ["pkg/cli/*.go", "cmd/cog/*.go"]
outputs = ["docs/cli.md"]
run = "go run ./tools/gendocs/main.go -o docs/cli.md"
[tasks."docs:cli:check"]
description = "Check that CLI docs are up to date"
run = """
#!/usr/bin/env bash
set -e
tmpfile=$(mktemp)
trap 'rm -f "$tmpfile"' EXIT
# Generate to temp file and compare
go run ./tools/gendocs/main.go -o "$tmpfile"
if ! diff -q "$tmpfile" docs/cli.md > /dev/null 2>&1; then
echo "ERROR: docs/cli.md is out of date. Run 'mise run docs:cli' to update."
exit 1
fi
echo "docs/cli.md is up to date"
"""
# =============================================================================
# CI tasks - granular for parallel execution and caching
# =============================================================================
# Build tasks (run first to produce artifacts)
[tasks."ci:build"]
description = "CI: Build all artifacts"
run = [
{ tasks = ["ci:build:sdk", "ci:build:coglet"] },
]
[tasks."ci:build:sdk"]
description = "CI: Build SDK wheel and sdist"
run = [
{ task = "_setup_dist" },
"""
#!/usr/bin/env bash
set -euo pipefail
# Version from VERSION.txt, converted to PEP 440
RAW=$(tr -d '[:space:]' < VERSION.txt)
export SETUPTOOLS_SCM_PRETEND_VERSION=$(echo "$RAW" | sed -E 's/-alpha/a/; s/-beta/b/; s/-rc/rc/; s/-dev/.dev/')
echo "Building SDK wheel: $SETUPTOOLS_SCM_PRETEND_VERSION"
uv build --out-dir=dist .
""",
]
[tasks."ci:build:coglet"]
description = "CI: Build coglet wheel"
run = [
{ task = "_setup_dist" },
{ task = "build:coglet:wheel:linux-x64" },
]
[tasks."ci:test:integration"]
description = "CI: Run integration tests with GitHub Actions output (full suite)"
# exec ensures signals (SIGTERM from CI cancellation) go directly to gotestsum
run = "exec gotestsum --format github-actions -- -tags integration -parallel ${TEST_PARALLEL:-4} -timeout 30m ./integration-tests/..."
# =============================================================================
# Publish tasks (future)
# =============================================================================
[tasks."publish:coglet"]
description = "Publish coglet to PyPI"
run = """
#!/usr/bin/env bash
set -e
echo "TODO: Implement coglet PyPI publish"
echo "Wheels in dist/: $(ls dist/coglet-*.whl 2>/dev/null || echo 'none')"
"""
[tasks."publish:sdk"]
description = "Publish cog SDK to PyPI"
run = """
#!/usr/bin/env bash
set -e
echo "TODO: Implement SDK PyPI publish"
echo "Wheels in dist/: $(ls dist/cog-*.whl 2>/dev/null || echo 'none')"
"""
# =============================================================================
# Version tasks
# =============================================================================
[tasks."version"]
description = "Show current version from VERSION.txt"
run = "go run ./tools/version show"
[tasks."version:bump"]
description = "Bump version: updates VERSION.txt, Cargo.toml, Cargo.lock, and commits"
usage = 'arg "<version>" help="New semver version (e.g. 0.17.1, 0.18.0-rc.1)"'
run = "go run ./tools/version bump ${usage_version}"
[tasks."version:check"]
description = "Verify VERSION.txt matches crates/Cargo.toml"
run = "go run ./tools/version check"