Files
wehub-resource-sync f99010fae1
CI / lint (push) Failing after 1s
CI / frontend (push) Failing after 1s
CI / scripts (push) Failing after 1s
CI / Go Test (ubuntu-latest) (push) Failing after 0s
CI / frontend-node-25 (push) Failing after 1s
CI / docs (push) Failing after 0s
CI / coverage (push) Failing after 0s
CI / e2e (push) Failing after 0s
Docker / build-and-push (push) Failing after 1s
CI / integration (push) Failing after 4m43s
CI / Go Test (windows-latest) (push) Has been cancelled
CI / Desktop Unit Tests (Windows) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Linux (arm64)) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Linux) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Windows) (push) Has been cancelled
Desktop Artifacts (macOS) / Desktop Build (macOS (aarch64)) (push) Has been cancelled
Desktop Artifacts (macOS) / Desktop Build (macOS (x86_64)) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:30:36 +08:00

91 lines
2.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
failed=0
fail() {
printf '%s\n' "$1" >&2
failed=1
}
if [[ -e "zensical.toml" ]]; then
fail 'Zensical config must live under docs/: zensical.toml'
fi
if [[ -e "vercel.json" ]]; then
fail 'Vercel config must live under docs/: vercel.json'
fi
tracked_media="$(
git ls-files docs 2>/dev/null | grep -E '\.(png|svg|jpg|jpeg|webp|gif)$' || true
)"
if [[ -n "$tracked_media" ]]; then
printf 'docs image media must live in docs asset branches, not main:\n%s\n' "$tracked_media" >&2
failed=1
fi
tracked_hydrated_assets="$(
git ls-files docs/assets/static docs/assets/generated 2>/dev/null || true
)"
if [[ -n "$tracked_hydrated_assets" ]]; then
printf 'hydrated docs assets must be ignored, not tracked:\n%s\n' "$tracked_hydrated_assets" >&2
failed=1
fi
if [[ "$failed" -ne 0 ]]; then
exit 1
fi
python_bin="${PYTHON:-}"
if [[ -z "$python_bin" ]]; then
if command -v python3 >/dev/null 2>&1; then
python_bin="python3"
elif command -v python >/dev/null 2>&1; then
python_bin="python"
else
printf 'python not found; cannot validate docs markdown sources\n' >&2
exit 127
fi
fi
"$python_bin" docs/scripts/check_markdown_sources.py
if ! command -v rg >/dev/null 2>&1; then
printf 'rg not found; cannot validate docs media references\n' >&2
exit 127
fi
root_media_refs="$(
(rg -n '(<img[^>]+src="/|!\[[^]]*\]\(/)[^)" >]+\.(png|svg|jpg|jpeg|webp|gif)' docs README.md || true) \
| grep -v '/assets/static/' \
| grep -v '/assets/generated/' \
|| true
)"
if [[ -n "$root_media_refs" ]]; then
printf 'docs media references must use /assets/static or /assets/generated:\n%s\n' "$root_media_refs" >&2
exit 1
fi
source_media_refs="$(
(rg -n '(/screenshots/[^)" '"'"'`>]+\.(png|svg|jpg|jpeg|webp|gif)|/agents/[^)" '"'"'`>]+\.(png|svg|jpg|jpeg|webp|gif)|/architecture\.svg|https://agentsview\.io/og-image\.png|/og-image\.png)' docs README.md || true) \
| grep -v '/assets/static/' \
| grep -v '/assets/generated/' \
|| true
)"
if [[ -n "$source_media_refs" ]]; then
printf 'docs source media references must use /assets/static or /assets/generated:\n%s\n' "$source_media_refs" >&2
exit 1
fi
bash docs/assets/hydrate-assets.sh
if command -v uv >/dev/null 2>&1; then
(
cd docs
uv run --frozen bash ./zensical-docs.sh build
uv run --frozen python scripts/check_built_site.py
uv run --frozen python scripts/check_vercel_redirects.py
)
else
printf 'uv not found; skipping docs build validation\n' >&2
fi