Shared lint passes¶
common/tasks.toml defines the passes every archetype's lint carries. They need no per-repo config, and the
runtime-detected ones no-op silently in a repo that has none of the files they check, so every archetype includes them
unconditionally.
| Pass | Checks | Runs when | Fails at |
|---|---|---|---|
| license | SPDX headers on source files | always (not terraform) | any missing header |
| prose | every *.md |
always | any finding |
| workflows | .github/workflows |
the directory exists | zizmor low and up |
| docker | root Dockerfile, Dockerfile.* |
a Dockerfile exists | grype high and up |
| helm | helm/*/, charts/*/ Chart.yaml |
a chart exists | kubescape high and up |
| kustomize | kustomization.yaml directories |
a kustomization exists | kubescape high and up |
| shell | *.sh under scripts/ and hack/ |
either directory exists | any shellcheck finding |
License headers¶
license and license-check run addlicense with the MIT license and the license_holder knob, writing SPDX-only
headers (-s=only):
The house ignores always apply: node_modules/**, .mise/**, .claude/**, .venv/**, .build/**, .swiftpm/**,
coverage/**, **/pnpm-lock.yaml and commit.sh. A repo's .licenseignore adds to them, one pattern per non-empty
line:
make fmt injects missing headers; make lint fails on them. The terraform archetype doesn't run these passes, because
addlicense would stamp .tf files.
Prose¶
fmt-prose and lint-prose run bun fmt (bun's built-in, Prettier-compatible formatter) and the pinned
markdownlint-cli2 over every *.md, from the repo root:
| Mode | Steps |
|---|---|
fmt |
bun fmt, then markdownlint-cli2 --fix. |
check |
markdownlint-cli2, then bun fmt --check. |
bun fmt reads Prettier's config and ignore files, and honours .gitignore as well as the prettier ignore file. It
always runs with --no-script, so a repo's own package.json fmt script can't take its place.
House defaults¶
The library's own config files are the house defaults. A consumer reads them from .mise/ unless it commits its own
copy of a file, which then overrides that file wholesale:
| File | House setting |
|---|---|
.prettierrc.yaml |
proseWrap: always, printWidth: 120. |
.prettierignore |
CHANGELOG.md, node_modules/, .mise/, .venv/, .build/, .swiftpm/, .claude/. |
.markdownlint-cli2.yaml |
All default rules; 120-column lines (tables exempt); sibling-only duplicate headings; fenced code blocks. Ignores node_modules/, .mise/, .venv/, .build/, .swiftpm/, .claude/, CHANGELOG.md. |
Patterns in the house ignore files are deliberately unanchored, because bun fmt and markdownlint resolve them against
the invoking repo, not against .mise/.
.markdownlint-cli2.yaml
# Copyright 2026 BitWise Media Group Ltd
# SPDX-License-Identifier: MIT
# House default for the whole fleet (read as .mise/.markdownlint-cli2.yaml in a
# consumer unless the repo carries its own .markdownlint-cli2.yaml). Globs and
# ignores resolve against the invoking repo, not against .mise/.
# yaml-language-server: $schema=https://raw.githubusercontent.com/DavidAnson/markdownlint-cli2/refs/heads/main/schema/markdownlint-cli2-config-schema.json
config:
default: true
# keep prose readable in terminals and diffs; tables are exempt.
line-length:
line_length: 120
tables: false
no-duplicate-heading:
siblings_only: true
code-block-style:
style: fenced
globs:
- "**/*.md"
ignores:
# node cruft
- "node_modules/**"
# the toolchain library submodule (its prose is linted in its own repo)
- ".mise/**"
# uv-managed virtualenvs (site-packages ship their own markdown)
- ".venv/**"
# SwiftPM build tree and dependency checkouts (packages ship their own markdown)
- ".build/**"
- ".swiftpm/**"
# agent cruft
- ".claude/**"
# machine-written by release-please, not house prose
- "CHANGELOG.md"
GitHub Actions workflows¶
lint-workflows lints .github/workflows with two tools, and no-ops when the directory doesn't exist:
- actionlint: syntax, expressions, and shellcheck over embedded
run:scripts. - zizmor: security audits for script injection, unpinned actions, excessive permissions and dangerous triggers.
zizmor fails the gate at low severity and up (zizmor_min_severity). Silence an accepted finding inline, or in a
repo zizmor.yml (auto-loaded from the repo root or .github/):
zizmor's online-only audits run only when GH_TOKEN is exported; otherwise it prints a notice and skips them. To run
either tool alone, use make actionlint or make zizmor.
Containers and deploy manifests¶
Dockerfiles¶
lint-docker finds every root Dockerfile and Dockerfile.* and:
- runs hadolint on each one. It fails on any warning by default.
- runs grype against every external base image named in a
FROMline, pulled straight from its registry (registry:scheme, so no Docker daemon and no build).
Base-image resolution is careful about multi-stage builds:
FROMtargets that name an earlier build stage (AS alias) orscratchare skipped, silently.- Simple
ARGdefaults are resolved first:ARG RUNTIME=staticthenFROM runtime-${RUNTIME}resolves to theruntime-staticalias. - A ref that still contains an unresolved variable is reported and skipped, never guessed at.
grype runs with --platform linux/amd64 (fleet images deploy to linux, and one platform keeps macOS and CI results
identical) and --only-fixed. Base images always carry won't-fix distro CVEs, so only a finding with an available fix,
meaning a newer base would fix it, is actionable enough to gate on.
Helm charts¶
lint-helm finds every chart at helm/*/Chart.yaml or charts/*/Chart.yaml and runs helm lint, then a kubescape
misconfiguration scan. kubescape renders the chart natively with its default values. A chart whose defaults render
nothing kubescape can scan (only custom resources, or nothing until values opt in) still gets helm lint, and its scan
is reported as skipped instead of failing.
Kustomizations¶
lint-kustomize finds every directory with a kustomization.yaml or kustomization.yml (pruning .git, .mise,
.claude, node_modules, .venv and coverage) and runs a kubescape scan, which builds the kustomization natively.
kind: Component directories are skipped with a note: they only build through an overlay, and the overlays that include
them still exercise their content.
Silencing findings¶
| Scanner | Repo-level config |
|---|---|
| hadolint | .hadolint.yaml, or inline # hadolint ignore=… comments |
| grype | .grype.yaml (auto-loaded from the repo root) |
| kubescape | .kubescape/exceptions.json (passed as --exceptions) |
First run and isolation¶
The first scan on a machine downloads grype's vulnerability database (about 200 MB, cached in ~/.cache/grype) and
kubescape's controls artifacts (cached in ~/.kubescape), so it needs network.
The scans never contact a Kubernetes cluster. The tasks set KUBECONFIG=/nonexistent, because kubescape otherwise talks
to whatever cluster your kubeconfig names, and a lint of local files must never touch a live cluster.
Shell scripts¶
lint-shell runs shellcheck over every *.sh under the repo's scripts/ and hack/ directories, recursively.
Starting from those two root directories keeps the library's own scripts in .mise/ out of consumer runs.
Tip
A comment that starts with the word "shellcheck" is parsed as a directive. Reword comments like
# shellcheck is happy here so they don't begin with it.
Source¶
common/scripts/prose.sh
#!/bin/sh
# Copyright 2026 BitWise Media Group Ltd
# SPDX-License-Identifier: MIT
#
# Prose format/check over every *.md under the current directory (the repo
# root — the tasks run from config_root): `bun fmt` (bun's built-in,
# Prettier-compatible formatter) for layout, markdownlint-cli2 for the rules.
# The house defaults are the library's own .prettierrc.yaml / .prettierignore
# / .markdownlint-cli2.yaml, read from .mise/ unless the repo carries its own
# copy of a file, which then overrides that file wholesale. Patterns in the
# house ignore files are deliberately unanchored — bun fmt and markdownlint
# resolve them against the invoking repo, not against .mise/.
#
# bun fmt runs a package.json "fmt" script instead of formatting when one
# exists, so it always gets --no-script. markdownlint-cli2 is an npm package
# whose aube shim `exec`s node; it runs on the pinned bun instead because the
# script's sibling bin/ (whose `node` execs bun) goes first on PATH, resolved
# from the script's own path rather than the cwd.
#
# prose.sh fmt bun fmt, then markdownlint-cli2 --fix
# prose.sh check markdownlint-cli2, then bun fmt --check
set -eu
bindir=$(CDPATH='' cd -- "$(dirname -- "$0")/../bin" && pwd)
PATH="$bindir:$PATH"
export PATH
mode="${1-}"
pcfg=".prettierrc.yaml"; [ -f "$pcfg" ] || pcfg=".mise/.prettierrc.yaml"
pign=".prettierignore"; [ -f "$pign" ] || pign=".mise/.prettierignore"
mcfg=".markdownlint-cli2.yaml"; [ -f "$mcfg" ] || mcfg=".mise/.markdownlint-cli2.yaml"
fmt() {
bun fmt --no-script --config "$pcfg" --ignore-path .gitignore --ignore-path "$pign" \
--no-error-on-unmatched-pattern "$@" "**/*.md"
}
case "$mode" in
fmt)
fmt
markdownlint-cli2 --config "$mcfg" --fix
;;
check)
markdownlint-cli2 --config "$mcfg"
fmt --check
;;
*)
echo "usage: prose.sh fmt|check" >&2
exit 2
;;
esac
common/scripts/license.sh
#!/bin/sh
# Copyright 2026 BitWise Media Group Ltd
# SPDX-License-Identifier: MIT
#
# addlicense over the current directory with the house default ignores
# (generated/vendored trees, incl. the .mise/ submodule and SwiftPM's .build/
# dependency checkouts, pnpm's generated
# lockfile — the only package-manager lockfile addlicense would otherwise
# stamp — and the agent-prepared commit.sh handoff every repo may transiently
# carry) plus one -ignore per
# non-empty line of the repo's .licenseignore. Patterns never contain
# whitespace and must reach addlicense unexpanded (set -f stops the shell
# globbing them). A repo with no .licenseignore simply gets the defaults.
#
# license.sh inject headers
# license.sh --check check mode (non-zero on a missing header)
#
# LICENSE_HOLDER: the copyright holder (the library's license_holder var).
set -euf
: "${LICENSE_HOLDER:=BitWise Media Group Ltd}"
mode="${1-}"
set -- -ignore 'node_modules/**' -ignore '.mise/**' -ignore '.claude/**' \
-ignore '.venv/**' -ignore '.build/**' -ignore '.swiftpm/**' \
-ignore 'coverage/**' -ignore '**/pnpm-lock.yaml' -ignore 'commit.sh'
if [ -f .licenseignore ]; then
while IFS= read -r pattern || [ -n "$pattern" ]; do
[ -n "$pattern" ] || continue
set -- "$@" -ignore "$pattern"
done <.licenseignore
fi
if [ "$mode" = "--check" ]; then set -- "$@" -check; fi
addlicense -l mit -c "$LICENSE_HOLDER" -s=only "$@" .
common/scripts/lint-workflows.sh
#!/bin/sh
# Copyright 2026 BitWise Media Group Ltd
# SPDX-License-Identifier: MIT
#
# Lint the repo's GitHub Actions workflows: actionlint for syntax/expression/
# shell errors, then zizmor for security findings (script injection, unpinned
# actions, excessive permissions, ...). No .github/workflows → silent no-op,
# so every archetype's `lint` carries this unconditionally. Repos silence
# accepted zizmor findings with a zizmor.yml (auto-loaded from the repo root
# or .github/); zizmor's online-only audits are skipped, with a notice, unless
# GH_TOKEN is exported.
#
# ZIZMOR_MIN_SEVERITY: lowest finding severity that fails the gate (the
# library's zizmor_min_severity var).
set -eu
: "${ZIZMOR_MIN_SEVERITY:=low}"
[ -d .github/workflows ] || exit 0
echo "lint-workflows: actionlint"
actionlint
echo "lint-workflows: zizmor --min-severity $ZIZMOR_MIN_SEVERITY .github/workflows"
zizmor --min-severity "$ZIZMOR_MIN_SEVERITY" .github/workflows
common/scripts/lint-docker.sh
#!/bin/sh
# Copyright 2026 BitWise Media Group Ltd
# SPDX-License-Identifier: MIT
#
# hadolint every root Dockerfile / Dockerfile.*, then grype the external base
# images named in FROM lines — pulled straight from their registries
# (registry: scheme, no docker daemon, no build). FROM targets naming an
# earlier build stage (AS alias) or scratch are skipped silently (normal
# multi-stage structure); simple ARG defaults are resolved first
# (ARG RUNTIME=static; FROM runtime-${RUNTIME} → the runtime-static alias),
# and refs still containing an unresolved variable are reported and skipped
# rather than guessed at. --platform linux/amd64: fleet images deploy to
# linux, and one platform keeps mac/CI results identical. --only-fixed: base
# images always carry will-not-fix distro CVEs; only a finding with an
# available fix (a newer base) is actionable enough to gate on.
set -eu
: "${GRYPE_FAIL_ON:=high}"
set --
for df in Dockerfile Dockerfile.*; do
if [ -f "$df" ]; then set -- "$@" "$df"; fi
done
[ "$#" -gt 0 ] || exit 0
for df in "$@"; do
echo "lint-docker: hadolint $df"
hadolint "$df"
done
# Print the external base images of one Dockerfile (skips go to stderr).
# Aliases are recorded before variable resolution so `FROM ${BASE} AS build`
# still registers `build` even when ${BASE} has no default.
base_images() {
awk -v df="$1" '
toupper($1) == "ARG" {
eq = index($2, "=")
if (eq > 0) {
val = substr($2, eq + 1); gsub(/^"|"$/, "", val)
arg[substr($2, 1, eq - 1)] = val
}
next
}
toupper($1) == "FROM" {
i = 2
while (i <= NF && substr($i, 1, 2) == "--") i++ # --platform=... flags
ref = $i
if (toupper($(i + 1)) == "AS") alias[$(i + 2)] = 1
while (match(ref, /\$\{[A-Za-z_][A-Za-z0-9_]*\}/)) {
v = substr(ref, RSTART + 2, RLENGTH - 3)
if (!(v in arg)) {
printf "lint-docker: %s: skipping FROM %s (no default for ARG %s)\n", df, $i, v > "/dev/stderr"
next
}
ref = substr(ref, 1, RSTART - 1) arg[v] substr(ref, RSTART + RLENGTH)
}
while (match(ref, /\$[A-Za-z_][A-Za-z0-9_]*/)) {
v = substr(ref, RSTART + 1, RLENGTH - 1)
if (!(v in arg)) {
printf "lint-docker: %s: skipping FROM %s (no default for ARG %s)\n", df, $i, v > "/dev/stderr"
next
}
ref = substr(ref, 1, RSTART - 1) arg[v] substr(ref, RSTART + RLENGTH)
}
if (tolower(ref) == "scratch") next
if (ref in alias) next
print ref
}
' "$1"
}
# A grype failure propagates: set -eu is inherited by the while subshell, so
# the pipeline — and the script — exit non-zero.
for df in "$@"; do base_images "$df"; done | sort -u | while IFS= read -r img; do
echo "lint-docker: grype registry:$img"
grype --platform linux/amd64 --only-fixed --fail-on "$GRYPE_FAIL_ON" "registry:$img"
done
common/scripts/lint-helm.sh
#!/bin/sh
# Copyright 2026 BitWise Media Group Ltd
# SPDX-License-Identifier: MIT
#
# helm lint + kubescape misconfiguration scan for every chart under helm/ or
# charts/ (one chart per directory: helm/*/Chart.yaml, charts/*/Chart.yaml).
# kubescape renders helm charts natively with their default values. A chart
# whose defaults render nothing kubescape can scan (for example, only custom
# resources, or nothing at all until values opt in) still gets helm lint; its
# kubescape scan is reported as skipped rather than failed. No charts →
# silent no-op. Repos silence
# accepted findings with a .kubescape/exceptions.json (auto-loaded here, the
# .grype.yaml spirit). KUBECONFIG points at nothing: kubescape otherwise
# contacts whatever cluster the developer's kubeconfig names, and a lint of
# local files must never touch a live cluster. --logger warning: at info level
# kubescape points its UI printer at /dev/null, appends .txt, and warns on
# every run when /dev/null.txt cannot be created; warning level swaps in the
# silent printer and avoids it (results still print via the results printer).
set -eu
: "${KUBESCAPE_SEVERITY:=high}"
export KUBECONFIG=/nonexistent
kubescape_scan() {
if [ -f .kubescape/exceptions.json ]; then
kubescape scan "$1" --logger warning --severity-threshold "$KUBESCAPE_SEVERITY" --exceptions .kubescape/exceptions.json
else
kubescape scan "$1" --logger warning --severity-threshold "$KUBESCAPE_SEVERITY"
fi
}
# kubescape exits non-zero with "no scannable Kubernetes resources found" when
# a chart's defaults render nothing it understands. That is not a finding, so
# report it and move on; every other failure still fails the lint. Output is
# captured to tell the two apart, then printed as kubescape wrote it.
scan_chart() {
log="$(mktemp "${TMPDIR:-/tmp}/lint-helm.XXXXXX")"
status=0
kubescape_scan "$1" >"$log" 2>&1 || status=$?
cat "$log"
if [ "$status" -ne 0 ] && grep -q 'no scannable Kubernetes resources found' "$log"; then
echo "lint-helm: $1 renders no scannable resources with its default values; kubescape skipped"
status=0
fi
rm -f "$log"
return "$status"
}
for chart in helm/*/Chart.yaml charts/*/Chart.yaml; do
[ -f "$chart" ] || continue
d="${chart%/Chart.yaml}"
echo "lint-helm: helm lint $d"
helm lint "$d"
echo "lint-helm: kubescape scan $d"
scan_chart "$d"
done
common/scripts/lint-kustomize.sh
#!/bin/sh
# Copyright 2026 BitWise Media Group Ltd
# SPDX-License-Identifier: MIT
#
# kubescape scan of every kustomization directory in the repo (kubescape
# builds the kustomization natively). kind: Component directories are only
# buildable through an overlay that includes them, so they are skipped with a
# note — the overlays that consume them still exercise their content. Repos
# silence accepted findings with a .kubescape/exceptions.json (auto-loaded
# here, the .grype.yaml spirit). KUBECONFIG points at nothing: kubescape
# otherwise contacts whatever cluster the developer's kubeconfig names, and a
# lint of local files must never touch a live cluster. --logger warning: at
# info level kubescape points its UI printer at /dev/null, appends .txt, and
# warns on every run when /dev/null.txt cannot be created; warning level swaps
# in the silent printer and avoids it (results still print via the results
# printer).
set -eu
: "${KUBESCAPE_SEVERITY:=high}"
export KUBECONFIG=/nonexistent
kubescape_scan() {
if [ -f .kubescape/exceptions.json ]; then
kubescape scan "$1" --logger warning --severity-threshold "$KUBESCAPE_SEVERITY" --exceptions .kubescape/exceptions.json
else
kubescape scan "$1" --logger warning --severity-threshold "$KUBESCAPE_SEVERITY"
fi
}
find . \( -name .git -o -name .mise -o -name .claude -o -name node_modules -o -name .venv -o -name coverage \) -prune \
-o \( -name kustomization.yaml -o -name kustomization.yml \) -print | sort | while IFS= read -r f; do
d="${f%/*}"
d="${d#./}"
if grep -qE '^kind:[[:space:]]*Component([[:space:]]|$)' "$f"; then
echo "lint-kustomize: skipping $d (kind: Component, only buildable via an overlay)"
continue
fi
echo "lint-kustomize: kubescape scan $d"
kubescape_scan "$d"
done
common/scripts/lint-shell.sh
#!/bin/sh
# Copyright 2026 BitWise Media Group Ltd
# SPDX-License-Identifier: MIT
#
# Run shellcheck over every *.sh under the repo's scripts/ and hack/
# directories (recursively; a comment must not start with the word
# "shellcheck" — that's directive syntax). Neither directory present →
# silent no-op. Starting the
# sweep at the repo-root directories keeps the library's own copies inside
# .mise/ out of consumer runs.
set -eu
set --
for d in scripts hack; do
if [ -d "$d" ]; then set -- "$@" "$d"; fi
done
[ "$#" -gt 0 ] || exit 0
echo "lint-shell: shellcheck $*"
find "$@" -type f -name '*.sh' -exec shellcheck {} +