1min_version = "2026.2.4"
2
3[env]
4GOAMD64 = "v3"
5
6[vars]
7binary = "cooked-mcp"
8main = "./cmd/cooked-mcp"
9static_tags = "netgo,osusergo,static_build"
10static_ldflags = "-d -s -w -buildid= -extldflags=-static"
11test_args = "-v -race -count=5 -p=3 -timeout=5m ./..."
12
13[tools]
14"aqua:google/yamlfmt" = "latest"
15go = "latest"
16"go:golang.org/x/vuln/cmd/govulncheck" = "latest"
17golangci-lint = "latest"
18
19[tasks.fmt]
20description = "Format Go code"
21run = "golangci-lint fmt"
22
23[tasks.tidy]
24description = "Tidy go.mod and go.sum"
25run = "go mod tidy"
26
27[tasks.modernize]
28description = "Apply Go modernization fixes"
29run = "golangci-lint run --enable-only modernize --fix ./..."
30
31[tasks.lint]
32description = "Lint Go code and apply safe fixes"
33run = "golangci-lint run --fix"
34
35[tasks.fix]
36description = "Format, modernize, and apply lint fixes"
37run = [
38 "mise run fmt",
39 "mise run modernize",
40 "mise run lint",
41]
42
43[tasks.vet]
44description = "Run go vet"
45run = "go vet ./..."
46
47[tasks."yaml:fmt"]
48description = "Format YAML files"
49run = "yamlfmt ."
50
51[tasks."yaml:lint"]
52description = "Check YAML formatting"
53run = "yamlfmt -lint ."
54
55[tasks.vuln]
56description = "Run govulncheck"
57run = "govulncheck ./..."
58
59[tasks.build]
60description = "Build a static pure-Go cooked-mcp binary"
61env = { CGO_ENABLED = "0" }
62run = '''
63go build \
64 -trimpath \
65 -tags '{{vars.static_tags}}' \
66 -ldflags '{{vars.static_ldflags}}' \
67 -o {{vars.binary}} \
68 {{vars.main}}
69'''
70
71[tasks.install]
72description = "Install a static pure-Go cooked-mcp binary"
73env = { CGO_ENABLED = "0" }
74run = '''
75go install \
76 -trimpath \
77 -tags '{{vars.static_tags}}' \
78 -ldflags '{{vars.static_ldflags}}' \
79 {{vars.main}}
80'''
81
82[tasks.test]
83description = "Run Go tests repeatedly with the race detector"
84env = { CGO_ENABLED = "1" }
85run = "go test {{vars.test_args}}"
86
87[tasks."test:quiet"]
88description = "Run Go tests with quiet success output"
89env = { CGO_ENABLED = "1" }
90run = '''
91if output=$(go test {{vars.test_args}} 2>&1); then
92 echo "✓"
93else
94 echo "$output"
95 exit 1
96fi
97'''
98
99[tasks.check]
100description = "Format, tidy, lint, scan, build, and test"
101run = [
102 "mise run fix",
103 "mise run yaml:fmt",
104 "mise run tidy",
105 "mise run yaml:lint",
106 "mise run vet",
107 "mise run vuln",
108 "mise run build",
109 "mise run test:quiet",
110]