Files
Evan Purkhiser 97734162b9 feat(ci): lint with prek, formatting markdown with flowmark (#316)
Now that the tree is formatted, this keeps it that way. prek runs the hooks the
way sentry runs its own, so one command covers Markdown formatting, file
hygiene, workflow schemas, and the two validators this repo already had.
scripts/lint.sh is the entrypoint and pins prek through uvx, so there is nothing
to install first. It replaces the Validate Skill Tree workflow, whose two steps
are hooks now.

Most hooks fix rather than report, and the workflow leans on that: on a pull
request from this repository it pushes whatever they rewrote back to the branch
instead of failing a check, then runs them again to report the state after the
fix -- a GITHUB_TOKEN push starts no workflow run of its own, so the fix commit
would otherwise carry no signal. Fork pull requests have no branch to push to
and fail with the command to run. Sentry pushes these fixes under a GitHub App
token so the follow-up commit gets checked normally; that app's private key is
not available to this repo.

Markdown belongs to flowmark alone. It writes a trailing space on the blank
lines inside a blockquote, so trailing-whitespace and end-of-file-fixer skip
Markdown rather than strip what flowmark rewrites on the next run, forever.

src/SKILL_TREE.md stays out of flowmark's reach through .flowmarkignore because
build-skill-tree.sh generates it, and skills-legacy/ is excluded repo-wide as
frozen content nothing ships.
2026-08-04 17:54:10 -04:00

34 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# ============================================================
# lint.sh — the lint entrypoint, wrapping prek
# ============================================================
# prek (https://github.com/j178/prek) runs the hooks in
# .pre-commit-config.yaml: Markdown formatting via flowmark, file hygiene,
# workflow schema checks, and this repo's own skill-tree and built-link
# validators. Most of them fix rather than report, so a non-zero exit usually
# means files were rewritten and are waiting to be reviewed and staged.
#
# Usage:
# scripts/lint.sh # every hook over every file
# scripts/lint.sh run --files a.md b.md # scope to some files
# scripts/lint.sh run flowmark # one hook by id
# scripts/lint.sh install # install the git pre-commit hook
#
# With no arguments this runs `prek run --all-files`; anything else is passed
# to prek verbatim.
#
# Requirements: uv (for uvx)
set -euo pipefail
PREK_VERSION="0.4.12"
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$REPO_ROOT"
if [[ $# -eq 0 ]]; then
set -- run --all-files
fi
exec uvx --quiet --from "prek==${PREK_VERSION}" prek "$@"