[settings] lockfile = true [env] CGO_ENABLED = "0" [tools] go = "1.27.4" golangci-lint = "2.15.0" gotestsum = "1.13.0" "go:golang.org/x/vuln/cmd/govulncheck" = "1.10.0" # nilaway has no releases: a pseudo-version, its newest commit's. "go:go.uber.org/nilaway/cmd/nilaway" = "0.0.0-20261124161746-91ad9bf5d8e6" goreleaser = "2.20.3" hugo = "0.170.1" vale = "3.28.1" lychee = "0.24.2" node = "24.22.3" markdownlint-cli2 = "0.24.2" shellcheck = "0.11.0" actionlint = "1.7.12" zizmor = "1.33.1" # Only for signing releases; it has no linux/arm64 build. minisign = { version = "0.12", os = ["macos/arm64", "linux/x64", "windows"] } [tasks.fmt] description = "Format Go code" run = "golangci-lint fmt" [tasks.lint] description = "Run every linter" depends = ["lint:code", "lint:docs"] [tasks."lint:code"] description = "Lint the Go code, shell scripts and GitHub workflows" run = [ "golangci-lint run", # Each forbidigo rule fires: testdata/lint breaks each once, on the lines # ending in "// want forbidigo", and forbidigo reports those lines alone. ''' want=$(grep -Hn '// want forbidigo$' testdata/lint/*.go | cut -d: -f1,2 | sort) got=$(golangci-lint run --enable-only forbidigo --max-same-issues=0 --max-issues-per-linter=0 \ --output.text.print-issued-lines=false --show-stats=false ./testdata/lint/ | grep '(forbidigo)$' | cut -d: -f1,2 | sort) [ "$want" = "$got" ] || { printf 'forbidigo reported:\n%s\ntestdata/lint wants:\n%s\n' "$got" "$want" >&2; exit 1; } ''', # The workflows: actionlint (with shellcheck on run steps), then zizmor's # security audits, offline so a run never depends on GitHub's API. "actionlint", "zizmor --offline .", # Shell scripts, found by a shebang on their first line (not the # testscript archives, which hold small scripts among other files, nor the # vendored security-audit skill). ''' git ls-files --cached --others --exclude-standard -z -- . ':!:.agents/skills/security-audit' ':!:testdata/script' | LC_ALL=C xargs -0 awk 'FNR == 1 { if ($0 ~ /^#!.*[\/ ](ba|da)?sh( |$)/) print FILENAME; nextfile }' | xargs -r shellcheck --external-sources ''', ] [tasks."lint:docs"] description = "Lint the docs" # The site's build needs its diagrams drawn. depends = ["docs:diagrams"] run = [ # Every Markdown file but the vendored security-audit skill's. "markdownlint-cli2 'docs/content/**/*.md' '*.md' 'assets/**/*.md' 'internal/**/*.md' '.agents/skills/docs-voice/*.md' '.agents/skills/cli/*.md' '.agents/skills/codebase-standards/*.md'", # .vale.ini says which rules each file gets, and which files get none. "vale docs/content *.md assets/oci/README.md internal/proxy/README.md .agents/skills/docs-voice .agents/skills/cli .agents/skills/codebase-standards", "lychee --offline --no-progress --include-fragments 'docs/content/**/*.md'", # Message links: every doc link in internal/msg/docs.go is a message and # a page and heading in docs/content/docs. "go test ./internal/msg -run '^TestDocLinks$'", # Command lines: every devvm command line in the repo is one of devvm's. "go test ./internal/cli -run '^TestCommandLines$'", # Social cards: every page has an explainer, and it and the title fit the card. "go test ./internal/cli/docgen -run '^TestExplainers$'", # Prose: no user page has a run of long paragraphs or a wall of one. "go test ./internal/cli/docgen -run '^TestUserPageProse$'", # The changelog: each entry from 0.2.0-rc.1 on, and Unreleased, sorted # by audience in its groups, one short line each with its links. "go test ./internal/cli/docgen -run '^TestChangelog(Shape|Problems)$'", # The site builds with no warning, a deprecation's included, into a folder # the run removes, and its pages and stylesheets load nothing from another # host. ''' d=$(mktemp -d) && trap 'rm -rf "$d"' EXIT hugo -s docs --quiet --panicOnWarning -d "$d" && DOCS_SITE="$d" go test -count=1 ./internal/cli/docgen -run '^TestNoThirdPartyLoads$' ''', ] [tasks.test] description = "Run the unit and CLI tests, and hold each package to its coverage baseline" env = { CGO_ENABLED = "1" } # scripts/test.sh: a throwaway HOME, the race detector, 30 minutes a package, # then each package's coverage against this system's baseline in testdata/coverage/. run = "scripts/test.sh" [tasks.coverage] description = "Run the tests and raise each package's coverage baseline" env = { CGO_ENABLED = "1" } run = "scripts/test.sh --raise" [tasks.vuln] description = "Check dependencies for known vulnerabilities" # Each OS devvm ships for, as the code built for one differs from the other's. run = ["GOOS=linux govulncheck ./...", "GOOS=darwin govulncheck ./..."] [tasks.nilaway] description = "Report where a nil value may be dereferenced, and which findings testdata/nilaway-baseline.txt hasn't triaged" # scripts/nilaway.sh: devvm's own packages, not the tests or their helpers; # it exits 3 on a finding the baseline hasn't. Advisory, so not part of lint. run = "scripts/nilaway.sh" [tasks."nilaway:linux"] description = "Run nilaway on the code as built for Linux, as CI's job does, from any system; it must pass before a push to main" # go list reads GOOS, so a Mac checks the Linux-only files too. Exits 3 on # a new finding and 1 on a stale baseline line, as nilaway does. run = "GOOS=linux scripts/nilaway.sh" [tasks.deadcode] description = "List functions nothing calls" run = "go run golang.org/x/tools/cmd/deadcode@v0.53.0 ./..." [tasks.cli-docs] description = "Generate the CLI reference (docs/content/docs/cli) and the pages' generated blocks" run = "go run ./internal/cli/docgen ." [tasks."docs:diagrams"] description = "Draw the docs site's diagrams (docs/render-diagrams.mjs), which every build of the site needs first" # Skipped when the drawings' folder is newer than every source; the script then draws only the # diagrams it has no drawing of. sources = ["docs/content/**/*.md", "docs/render-diagrams.mjs", "docs/package.json", "docs/package-lock.json"] outputs = ["docs/.build/diagrams"] run = [ # pele, at the version and integrity docs/package-lock.json pins, and no package's install scripts: # installed again only when the lock's SHA-256 differs from the one node_modules records. ''' lock=$({ sha256sum docs/package-lock.json 2>/dev/null || shasum -a 256 docs/package-lock.json; } | cut -c1-64) stamp=docs/node_modules/.devvm-lock-sha256 if [ -z "$lock" ] || [ "$(cat "$stamp" 2>/dev/null)" != "$lock" ]; then npm ci --prefix docs --ignore-scripts --no-audit --no-fund && printf '%s\n' "$lock" > "$stamp" fi ''', "node docs/render-diagrams.mjs", ] [tasks.docs] description = "Serve the docs site" depends = ["cli-docs", "docs:diagrams"] run = "hugo server -s docs" [tasks.e2e] description = "Run the end-to-end tests against real VMs (tests/e2e), its flags after --" dir = "{{config_root}}/tests/e2e" env = { CGO_ENABLED = "0" } run = "go test -tags e2e -count=1 -timeout 0 -run '^TestE2E$' -args"