mirror of
https://github.com/getsentry/sentry-for-ai.git
synced 2026-09-14 14:28:22 +08:00
97734162b9
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.
34 lines
1.2 KiB
Bash
Executable File
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 "$@"
|