-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmise.toml
More file actions
1174 lines (990 loc) · 31.9 KB
/
mise.toml
File metadata and controls
1174 lines (990 loc) · 31.9 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
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
[env]
GOPRIVATE = "github.com/neongreen/mono"
GONOSUMDB = "github.com/neongreen/mono"
# Prevent Go from auto-upgrading to newer versions (fixes version mismatch errors)
GOTOOLCHAIN = "local"
# Add bin/ directory to PATH for dev build scripts
_.path = ["./bin"]
[tools]
go = "1.24.7"
dagger = "0.19.7"
"go:github.com/rhysd/actionlint/cmd/actionlint" = "latest"
"go:github.com/suzuki-shunsuke/pinact/v3/cmd/pinact" = "latest"
zizmor = "latest"
act = "latest"
"pipx:vermin" = "latest"
python = "3.13.5"
mdbook = "latest"
rust = "1.90"
"npm:json-server" = "latest"
pnpm = "latest"
node = "20"
"go:golang.org/x/tools/gopls" = "latest"
gotestsum = "latest"
golangci-lint = "latest"
fnox = "latest"
opentofu = "latest"
spacectl = "latest"
kubectl = "latest"
helm = "latest"
# ============================================================================
# Top-level tasks
# ============================================================================
[tasks.cloc]
description = "Count lines of Go code by file"
run = "cloc --by-file --include-lang=Go --vcs=git ."
[tasks.format]
description = "Format all Go code"
run = "goimports -w ."
[tasks.format-all]
description = "Format everything (Go and Rust)"
depends = ["format", "format-rust"]
[tasks.format-rust]
description = "Format Rust code"
dir = "mdbook-comments"
run = "cargo fmt"
[tasks.deprecations]
description = "List all scheduled deprecations across codebase"
run = '''
echo "=== Scheduled Deprecations ==="
echo ""
echo "Format: deprecated:VERSION [track:BOOL] [remove-after:CONDITION] [reason:TEXT]"
echo ""
rg --color=never --no-heading --line-number "deprecated:v\d+" -g "*.go" -g "*.rs" -g "*.ts" | \
sed 's|^\([^:]*\):\([^:]*\):\(.*\)|\1:\2: \3|' | \
sort
echo ""
echo "To scan event logs for usage: tk migrate scan-deprecated"
'''
# NOTE: Project run tasks (tk, conf, printpdf, etc.) are intentionally flat names
# without the :run suffix for convenience, since running is the most common operation.
# All other tasks remain namespaced (project:test, project:build, etc.).
[tasks."jj:track"]
description = "Track all remote bookmarks"
run = """
jj git fetch && jj b t "glob:*@origin"
"""
[tasks."lint:go:golangci"]
description = "Lint all Go code with golangci-lint"
# Use --new-from-rev to grandfather existing violations (see tk-330)
run = "golangci-lint run --new-from-rev=0c23a5a5"
[tasks."lint:go:uselesswrapper"]
description = "Detect useless function wrappers"
run = "go run ./linters/uselesswrapper/cmd/uselesswrapper ./..."
[tasks."lint:go:cobra"]
description = "Lint tk Cobra commands for conventions"
run = "go run ./linters/cobralint/cmd/cobralint ./tk/..."
[tasks."lint:go:dircheck"]
description = "Detect file writes without directory existence checks"
run = "go run ./linters/dircheck/cmd/dircheck ./..."
[tasks."lint:go"]
description = "Lint all Go code"
depends = ["lint:go:golangci", "lint:go:uselesswrapper", "lint:go:cobra", "lint:go:dircheck"]
[tasks."test:go"]
description = "Test all Go code"
run = "go test -run=^$ ./..."
[tasks."fuzz:pathlang"]
description = "Run fuzz tests on pathlang parser (30s smoke test)"
dir = "lib/pathlang"
run = """
echo "Fuzzing Parse..."
go test -fuzz=FuzzParse -fuzztime=15s
echo "Fuzzing RoundTrip..."
go test -fuzz=FuzzParseRoundTrip -fuzztime=15s
echo "Fuzz testing complete. To run longer: go test -fuzz=FuzzParse -fuzztime=1h"
"""
[tasks."fuzz:pathlang:long"]
description = "Run extended fuzz tests on pathlang parser (5 minutes)"
dir = "lib/pathlang"
run = """
echo "Running extended fuzzing (5 minutes)..."
go test -fuzz=FuzzParse -fuzztime=2m30s
go test -fuzz=FuzzParseRoundTrip -fuzztime=2m30s
"""
[tasks."lint:actions:actionlint"]
description = "Lint GitHub Actions workflows with actionlint"
run = "actionlint"
[tasks."lint:actions:pinact"]
description = "Check that GitHub Actions are pinned to specific SHAs"
run = "GITHUB_TOKEN=$(gh auth token) pinact run --check --diff --verify"
[tasks."lint:actions"]
description = "Lint GitHub Actions workflows"
depends = ["lint:actions:actionlint", "lint:actions:pinact"]
[tasks."go:tidy"]
description = "Synchronize Go dependencies"
run = "go mod tidy"
[tasks."lint:go-module"]
description = "Ensure go.mod and go.sum are tidy"
run = """
go mod tidy
git diff --exit-code go.mod go.sum
"""
[tasks."lint:go-vet"]
description = "Run go vet on all packages"
run = "go vet ./..."
# ============================================================================
# Schema management
# ============================================================================
[tasks."schemas:update"]
description = "Update configuration schemas (jj, mise, starship, claude)"
run = "./lib/configschema/scripts/update-schemas.sh"
# ============================================================================
# Dagger
# ============================================================================
# Very important that this doesn't have a "dir" set!
# I spent half a day figuring out why "mise run dagger:lint" was reporting errors.
[tasks."dagger:test"]
description = "Run tests for all Go projects using Dagger"
run = "dagger call test"
[tasks."dagger:lint"]
description = "Lint all Go projects using Dagger"
run = "dagger call lint"
[tasks."dagger:build"]
description = "Build all Go projects using Dagger"
run = "dagger call build"
# ============================================================================
# jj-run-py
# ============================================================================
[tasks."jj-run-py:test"]
description = "Run all tests for jj-run-py"
dir = "jj-run-py"
run = "for f in tests/*.py; do mise x -- python \"$f\" || exit 1; done"
[tasks."jj-run-py:vermin"]
description = "Determine minimum supported Python version for jj-run-py"
dir = "jj-run-py"
run = "vermin --backport argparse --backport dataclasses --backport typing -vv src/"
# ============================================================================
# mdbook-comments
# ============================================================================
[tasks."mdbook-comments:build"]
description = "Build the mdbook-comments preprocessor"
dir = "mdbook-comments"
run = "cargo build --release"
[tasks."mdbook-comments:test"]
description = "Run tests for mdbook-comments"
dir = "mdbook-comments"
run = "cargo test && mise run mdbook-comments:test_render ::: mdbook-comments:test:e2e"
[tasks."mdbook-comments:build:all"]
description = "Build everything: TypeScript, preprocessor, and example book"
dir = "mdbook-comments"
run = """
set -e
echo "🔨 Building mdbook-comments (full build)..."
echo ""
# 1. Build TypeScript/JS assets
echo "📦 Building TypeScript/JS assets..."
pnpm install
pnpm build
echo "✅ JS/TS assets built"
echo ""
# 2. Build Rust preprocessor
echo "🦀 Building mdbook-comments preprocessor..."
cargo build --release
echo "✅ Preprocessor built"
echo ""
# 3. Verify preprocessor binary exists
if [ ! -f "target/release/mdbook-comments" ]; then
echo "❌ ERROR: Preprocessor binary not found at target/release/mdbook-comments"
exit 1
fi
echo "✅ Preprocessor binary verified"
echo ""
# 4. Build example book with preprocessor in PATH
echo "📚 Building example book..."
cd example-book
rm -rf book
PATH="../target/release:$PATH" mdbook build
cd ..
echo "✅ Example book built"
echo ""
# 5. Verify the book has embedded assets from preprocessor
echo "🔍 Verifying embedded assets in book..."
if ! grep -q "mdbook-comments assets" example-book/book/index.html; then
echo "❌ ERROR: Embedded assets marker not found - preprocessor may not have run"
exit 1
fi
echo "✅ Embedded assets verified"
echo ""
echo "✨ Full build complete!"
"""
[tasks."mdbook-comments:test:unit"]
description = "Run unit tests with Vitest"
dir = "mdbook-comments"
run = "pnpm run test:unit"
[tasks."mdbook-comments:test:e2e"]
description = "Run end-to-end tests with Playwright"
dir = "mdbook-comments"
run = """
set -e
echo "🧹 Cleaning up test environment..."
# Kill any existing servers on the ports we use
pkill -f "json-server.*55432" || true
pkill -f "mdbook serve.*3300" || true
# Also kill any other json-server or mdbook processes that might interfere
pkill -f "json-server" || true
pkill -f "mdbook serve" || true
# Clean up test database
rm -f /tmp/test-db.json
# Wait a moment for processes to fully terminate
sleep 1
echo "✅ Cleanup complete"
echo ""
# Build everything fresh
mise run mdbook-comments:build:all
# Run tests
pnpm playwright test
"""
[tasks."mdbook-comments:test_render"]
description = "Test that the sample book renders correctly with embedded assets"
dir = "mdbook-comments"
run = """
set -e
echo "Testing sample book rendering with embedded assets..."
echo ""
# Build the preprocessor
echo "Building mdbook-comments preprocessor..."
cargo build --release
echo ""
# Clean and build the example book
echo "Building example book..."
cd example-book
rm -rf book
PATH="../target/release:$PATH" mdbook build
echo ""
# Verify embedded assets are present
echo "Verifying embedded assets..."
if ! grep -q "mdbook-comments assets" book/index.html; then
echo "❌ Embedded assets marker not found"
exit 1
fi
if ! grep -q "<style>" book/index.html; then
echo "❌ Embedded CSS not found"
exit 1
fi
if [ $(grep -c "<script>" book/index.html) -lt 2 ]; then
echo "❌ Expected multiple script tags (embedded JS) not found"
exit 1
fi
if ! grep -q "comment-link" book/index.html; then
echo "❌ Comment links not found"
exit 1
fi
echo "✅ Sample book renders correctly with embedded assets"
"""
[tasks."mdbook-comments:fmt"]
description = "Format Rust code"
dir = "mdbook-comments"
run = "cargo fmt"
[tasks."mdbook-comments:check"]
description = "Check that code compiles and passes clippy"
dir = "mdbook-comments"
run = "cargo clippy -- -D warnings"
[tasks."mdbook-comments:dev:setup"]
description = "Set up local JSON Server for development (one-time setup)"
dir = "mdbook-comments"
run = """
echo "Setting up local development environment..."
echo ""
# Check for Node.js and npm
if ! command -v node &> /dev/null; then
echo "❌ Node.js not found."
echo ""
echo "Please install Node.js from: https://nodejs.org/"
exit 1
fi
echo "✓ Node.js found"
# Check if json-server is available (should be installed via mise)
if ! command -v json-server &> /dev/null; then
echo "❌ json-server not found."
echo ""
echo "It should be installed automatically via mise. Try running 'mise install' first."
exit 1
fi
echo "✓ JSON Server found"
echo ""
echo "✅ Setup complete!"
echo ""
echo "Next steps:"
echo " 1. Run 'mise run mdbook-comments:dev' to start local development"
echo " 2. Open http://localhost:3300 in your browser"
echo " 3. Open http://localhost:55432 for JSON Server API"
"""
[tasks."mdbook-comments:dev"]
description = "Start local development environment"
dir = "mdbook-comments"
run = """
set -e
echo "Starting local development environment..."
echo ""
# Check if json-server is available
if ! command -v json-server &> /dev/null; then
echo "❌ JSON Server not found. Run 'mise run mdbook-comments:dev:setup' first."
exit 1
fi
# Build the preprocessor if needed
if [ ! -f "target/release/mdbook-comments" ]; then
echo "Building mdbook-comments preprocessor..."
cargo build --release
echo ""
fi
# Add preprocessor to PATH for this session
export PATH="$PWD/target/release:$PATH"
# Function to cleanup on exit
cleanup() {
echo ""
echo "Stopping servers..."
# Kill json-server if it's running
pkill -f "json-server.*55432" || true
# Kill mdbook serve if it's running
pkill -f "mdbook serve.*3300" || true
}
# Set up cleanup on exit and interrupts
trap cleanup EXIT INT TERM
# Start JSON Server in background
echo "Starting JSON Server..."
json-server db.json --port 55432 --middlewares json-server-middleware.js --routes routes.json &
JSON_SERVER_PID=$!
# Wait a moment for JSON Server to start
sleep 2
# Check if JSON Server started successfully
if ! kill -0 $JSON_SERVER_PID 2>/dev/null; then
echo "❌ Failed to start JSON Server"
exit 1
fi
echo "✅ JSON Server running on port 55432"
# Configure the book with JSON Server config
echo ""
echo "Configuring book for JSON Server..."
./scripts/configure-json-server.sh
# Start mdbook serve
echo ""
echo "Starting mdbook..."
echo ""
echo "📚 Book will be available at: http://localhost:3300"
echo "🔧 JSON Server API at: http://localhost:55432"
echo ""
echo "Press Ctrl+C to stop both servers"
echo ""
cd example-book && PATH="$PWD/../target/release:$PATH" mdbook serve --port 3300
# Cleanup will be called automatically via trap
"""
[tasks."mdbook-comments:dev:stop"]
description = "Stop local JSON Server"
dir = "mdbook-comments"
run = "pkill -f json-server || echo 'JSON Server not running'"
[tasks."mdbook-comments:dev:reset"]
description = "Reset local comments data (deletes all comments)"
dir = "mdbook-comments"
run = """
echo "⚠️ This will delete all local comments data."
read -p "Are you sure? (y/N) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Reset to initial state with just the sample comment
cat > db.json << 'EOF'
{
"comments": [
{
"id": "sample-comment-1",
"paragraph-id": "chapter-1-block-0-sample",
"metadata": {
"id": "chapter-1-block-0-sample",
"position": {
"file": "chapter1.md",
"block-index": 0
},
"content": "This is a sample paragraph for testing the commenting system.",
"context": {
"prev": null,
"next": "This is the next paragraph that follows.",
"heading-path": ["Chapter 1", "Getting Started"]
},
"commit": "abc123def"
},
"author": "Test User",
"text": "This is a sample comment to test the commenting functionality!",
"created": "2024-01-01T12:00:00Z",
"parent-id": null,
"replies": []
}
]
}
EOF
echo "✅ Comments data reset complete"
else
echo "Cancelled"
fi
"""
[tasks."mdbook-comments:dev:api"]
description = "Open JSON Server API in browser"
dir = "mdbook-comments"
run = "open http://localhost:55432 || xdg-open http://localhost:55432 || echo 'Open http://localhost:55432 in your browser'"
[tasks."mdbook-comments:dev:logs"]
description = "View JSON Server status (check if running)"
dir = "mdbook-comments"
run = "ps aux | grep json-server | grep -v grep || echo 'JSON Server not running'"
[tasks."mdbook-comments:dev:status"]
description = "Show JSON Server status"
dir = "mdbook-comments"
run = "curl -s http://localhost:55432/comments | head -c 200 || echo 'JSON Server not responding'"
[tasks."mdbook-comments:docker:build"]
description = "Build Docker image locally"
dir = "mdbook-comments"
run = "docker build -t mdbook-comments-demo ."
[tasks."mdbook-comments:docker:run"]
description = "Run Docker image locally (requires NEON_API_URL and NEON_API_KEY env vars)"
dir = "mdbook-comments"
run = """
if [ -z "$NEON_API_URL" ] || [ -z "$NEON_API_KEY" ]; then
echo "Error: NEON_API_URL and NEON_API_KEY environment variables are required"
echo "Set them before running this task:"
echo ' export NEON_API_URL="https://ep-xxx-xxx.us-east-2.aws.neon.tech/v2/query"'
echo ' export NEON_API_KEY="neon_api_key_xxxxxxxxxxxxxxxxxxxxx"'
exit 1
fi
docker run -p 3000:3000 \
-e NEON_API_URL="$NEON_API_URL" \
-e NEON_API_KEY="$NEON_API_KEY" \
mdbook-comments-demo
"""
# ============================================================================
# tk-vscode
# NOTE: These tasks are also used by want/vscode.go for building tk-vscode
# from PRs/branches. If you rename or change these tasks, update want/vscode.go.
# See: want/vscode.go (search for "tk-vscode")
# ============================================================================
[tasks."tk-vscode:install-deps"]
description = "Install dependencies for tk-vscode"
run = "cd tk-vscode && npm install"
[tasks."tk-vscode:build"]
description = "Compile & package the VS Code extension"
run = """
cd tk-vscode
npm run compile
npm run package
"""
[tasks."tk-vscode:install"]
description = "Install the VS Code extension"
run = """
cd tk-vscode
code --install-extension tk-0.0.1.vsix --force
"""
[tasks."tk-vscode:watch"]
description = "Recompile on source changes"
run = "cd tk-vscode && npm run watch"
# ============================================================================
# conf
# ============================================================================
[tasks.conf]
description = "Build and run conf"
dir = "conf"
run = "go run ."
[tasks."conf:test"]
description = "Run all tests for conf"
dir = "conf"
run = "go test -v ./..."
[tasks."conf:build"]
description = "Build conf binary"
dir = "conf"
run = """
set -euo pipefail
go build -trimpath -o {{cwd}}/_build/conf .
{{cwd}}/_build/conf version
echo "{{cwd}}/_build/conf"
"""
# ============================================================================
# aihook
# ============================================================================
[tasks.aihook]
description = "Build and run aihook"
dir = "aihook"
run = "go run ."
[tasks."aihook:test"]
description = "Run tests for aihook"
dir = "aihook"
run = "go test ./..."
[tasks."aihook:build"]
description = "Build aihook binary"
dir = "aihook"
run = """
set -euo pipefail
go build -trimpath -o {{cwd}}/_build/aihook .
{{cwd}}/_build/aihook version
echo "{{cwd}}/_build/aihook"
"""
[tasks."aihook:check"]
description = "Check that Go code and tests compile and type check"
dir = "aihook"
run = "go test -run=^$ ./..."
# ============================================================================
# dissect
# ============================================================================
[tasks."dissect:test"]
description = "Run tests for dissect"
dir = "dissect"
run = "gotestsum"
[tasks."dissect:build"]
description = "Build the project into _build/dissect"
dir = "dissect"
run = """
set -euo pipefail
go build -trimpath -o {{cwd}}/_build/dissect .
{{cwd}}/_build/dissect version
echo "{{cwd}}/_build/dissect"
"""
[tasks."dissect:fetch-gotools"]
description = "Fetch Go tools (including gopls) for AI to inspect"
dir = "dissect"
run = "git clone https://github.com/golang/tools.git _gotools"
# Not using "go run" because we want it to be fast
[tasks.dissect]
description = "Run the dissect project"
depends = ["dissect:build"]
dir = "dissect"
run = """
DIR="$(pwd)"
cd {{cwd}}
"$DIR/_build/dissect"
"""
[tasks."dissect:check"]
description = "Check that Go code and tests compile and type check"
dir = "dissect"
run = "go test -run=^$ ./..."
# ============================================================================
# jj-run
# ============================================================================
[tasks.jj-run]
description = "Build and run jj-run"
dir = "jj-run"
run = "go run ."
[tasks."jj-run:test"]
description = "Run all tests for jj-run"
dir = "jj-run"
run = "go test -v ./..."
[tasks."jj-run:build"]
description = "Build jj-run binary"
dir = "jj-run"
# Only use Go for this task - avoids installing gopls which requires Go 1.25+
tools = { go = "1.24.7" }
run = """
set -euo pipefail
go build -trimpath -o {{cwd}}/_build/jj-run .
{{cwd}}/_build/jj-run --version
echo "{{cwd}}/_build/jj-run"
"""
# ============================================================================
# ingest
# ============================================================================
[tasks.ingest]
description = "Build and run the ingest CLI"
dir = "ingest"
run = "go run ."
[tasks."ingest:test"]
description = "Run all ingest tests"
dir = "ingest"
run = "go test ./..."
[tasks."ingest:test:integration"]
description = "Run ingest CLI and integration suites"
dir = "ingest"
run = "go test . ./pkg/integration"
[tasks."ingest:build"]
description = "Build ingest binary"
dir = "ingest"
run = """
set -euo pipefail
go build -trimpath -o {{cwd}}/_build/ingest .
{{cwd}}/_build/ingest version
echo "{{cwd}}/_build/ingest"
"""
# ============================================================================
# lib/ghclient
# ============================================================================
[tasks."lib-ghclient:test"]
description = "Run tests for lib/ghclient"
dir = "lib/ghclient"
run = "go test ./..."
# ============================================================================
# markdown-format
# ============================================================================
[tasks.markdown-format]
description = "Build and run markdown-format"
dir = "markdown-format"
run = "go run ."
[tasks."markdown-format:test"]
description = "Run tests for markdown-format"
dir = "markdown-format"
run = "go test ./..."
[tasks."markdown-format:build"]
description = "Build markdown-format binary"
dir = "markdown-format"
run = """
go build -trimpath -o {{cwd}}/_build/markdown-format .
{{cwd}}/_build/markdown-format -help
echo "{{cwd}}/_build/markdown-format"
"""
[tasks."markdown-format:check"]
description = "Check that Go code and tests compile and type check"
dir = "markdown-format"
run = "go test -run=^$ ./..."
# ============================================================================
# printpdf
# ============================================================================
[tasks.printpdf]
description = "Build and run printpdf"
dir = "printpdf"
run = "go run ."
[tasks."printpdf:check"]
description = "Check that Go code and tests compile and type check"
dir = "printpdf"
run = "go test -run=^$ ./..."
[tasks."printpdf:test"]
description = "Run tests for printpdf"
dir = "printpdf"
run = "go test ./..."
[tasks."printpdf:test-golden"]
description = "Run golden tests (requires pdftoppm and imagemagick)"
dir = "printpdf"
run = "go test ./pkg/golden -v -timeout=10m"
[tasks."printpdf:update-goldens"]
description = "Update golden reference images (review before committing!)"
dir = "printpdf"
run = "UPDATE_GOLDENS=1 go test ./pkg/golden -v -timeout=10m"
[tasks."printpdf:build"]
description = "Build the project into _build/printpdf"
dir = "printpdf"
run = """
set -euo pipefail
go build -trimpath -o {{cwd}}/_build/printpdf .
{{cwd}}/_build/printpdf version
echo "{{cwd}}/_build/printpdf"
"""
# ============================================================================
# prrun
# ============================================================================
[tasks.prrun]
description = "Build and run prrun"
dir = "prrun"
run = "go run ."
[tasks."prrun:check"]
description = "Check that Go code and tests compile and type check"
dir = "prrun"
run = "go test -run=^$ ./..."
[tasks."prrun:test"]
description = "Run tests for prrun"
dir = "prrun"
run = "go test ./..."
[tasks."prrun:test:integration"]
description = "Run integration tests (requires access to private repo)"
dir = "prrun"
run = "PRRUN_INTEGRATION_TEST=1 go test ./..."
[tasks."prrun:build"]
description = "Build prrun binary"
dir = "prrun"
run = """
go build -trimpath -o {{cwd}}/_build/prrun .
{{cwd}}/_build/prrun --version
echo "{{cwd}}/_build/prrun"
"""
# ============================================================================
# tk
# ============================================================================
[tasks.tk]
description = "Build and run tk"
dir = "tk"
run = "go run ."
[tasks."tk:check"]
description = "Check that Go code and tests compile and type check"
dir = "tk"
run = "go test -run=^$ ./..."
[tasks."tk:test"]
description = "Run tests for tk"
dir = "tk"
run = "go test ./..."
[tasks."tk:build"]
description = "Build tk binary"
dir = "tk"
run = """
go build -trimpath -o {{cwd}}/_build/tk .
{{cwd}}/_build/tk version
echo "{{cwd}}/_build/tk"
"""
[tasks."tk:log:errors"]
description = "Show recent tk command errors from the invocation log"
tools.glow = "latest"
tools.jq = "latest"
run = '''
tail -10000 ~/.tk/log.jsonl |
jq -r 'select(.exit_code != 0) |
(.stderr | split("\n")) as $lines |
"## \($lines[0])\n\n`\(.command) \(.args | join(" "))` exited with \(.exit_code)\n\n```\n\($lines[:10] | join("\n"))\n```\n\n"' |
glow -
'''
# ============================================================================
# want
# ============================================================================
[tasks.want]
description = "Build and run want"
dir = "want"
run = "go run ."
[tasks."want:check"]
description = "Check that Go code and tests compile and type check"
dir = "want"
run = "go test -run=^$ ./..."
[tasks."want:test"]
description = "Run tests for want"
dir = "want"
run = "go test ./..."
[tasks."want:build"]
description = "Build want binary"
dir = "want"
run = """
go build -trimpath -o {{cwd}}/_build/want .
{{cwd}}/_build/want version
echo "{{cwd}}/_build/want"
"""
# ============================================================================
# cloud (OpenTofu)
# ============================================================================
[tasks."cloud:validate"]
description = "Validate all OpenTofu modules under cloud/terraform"
run = '''
set -euo pipefail
# Find unique directories containing .tf files under cloud/terraform and validate each
for dir in $(find cloud/terraform -type f -name '*.tf' -exec dirname {} \; | sort -u); do
echo "==> $dir"
(
cd "$dir"
# Init without touching any remote backend; download providers only
tofu init -backend=false -input=false >/dev/null
tofu validate
)
done
'''
[tasks."cloud:watch"]
description = "Watch/tail logs of the latest Spacelift run for 01-hcloud stack"
dir = "cloud"
quiet = true
run = '''
set -euo pipefail
fnox exec -- spacectl stack logs --id mono-cloud-01 --run-latest --tail
'''
[tasks."cloud:outputs:hcloud"]
description = "Show current outputs for 01-hcloud stack"
dir = "cloud"
quiet = true
run = '''
set -euo pipefail
fnox exec -- spacectl stack outputs --id mono-cloud-01
'''
[tasks."cloud:ip"]
description = "Print server IPv4 from 01-hcloud outputs"
tools.jq = "latest"
quiet = true
dir = "cloud"
run = '''
set -euo pipefail
fnox exec -- spacectl stack outputs --id mono-cloud-01 -o json \
| jq -r '.[] | select(.id=="server_ipv4") | .value | fromjson'
'''
[tasks."cloud:kubeconfig"]
description = "Fetch k3s kubeconfig from server and patch server IP"
dir = "cloud"
tools.jq = "latest"
quiet = true
run = '''
set -euo pipefail
# Get IP directly (avoid nested mise calls)
IP=$(fnox exec -- spacectl stack outputs --id mono-cloud-01 -o json \
| jq -r '.[] | select(.id=="server_ipv4") | .value | fromjson' | tr -d '\n\r')
# Check if k3s is ready (kubeconfig exists on server)
if ! ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 "root@${IP}" 'test -f /etc/rancher/k3s/k3s.yaml' 2>/dev/null; then
echo "Error: k3s not ready yet on server. Wait a minute for cloud-init to finish." >&2
exit 1
fi
ssh -o StrictHostKeyChecking=no "root@${IP}" 'cat /etc/rancher/k3s/k3s.yaml' > kubeconfig
# Replace default localhost server with public IP
perl -pi -e "s#https://127\\.0\\.0\\.1:6443#https://${IP}:6443#g" kubeconfig
chmod 600 kubeconfig
echo "KUBECONFIG=$(pwd)/kubeconfig"
'''
[tasks."cloud:kubectl"]
description = "Run kubectl with kubeconfig automatically set (ensures kubeconfig exists and is valid first)"
dir = "cloud"
quiet = true
run = '''
set -euo pipefail
# Ensure kubeconfig exists and is not empty
if [ ! -s kubeconfig ]; then
echo "Fetching kubeconfig..." >&2
mise run cloud:kubeconfig >/dev/null 2>&1
fi
# Verify kubeconfig is valid (has server URL)
if ! grep -q "server:" kubeconfig 2>/dev/null; then
echo "Error: kubeconfig appears invalid, re-fetching..." >&2
mise run cloud:kubeconfig >/dev/null 2>&1
fi
KUBECONFIG="$(pwd)/kubeconfig" kubectl "$@"
'''
[tasks."cloud:helm:repo:add"]
description = "Add Dagger Helm repository"
dir = "cloud"
quiet = true
run = '''