beads/mint.sh
Chris Sells 3198395a32 docs(ci): add Mintlify preview, docsync guard, and broken-links workflow
- mint.sh + make docs-dev: local preview of the docs/ Mintlify site
  (Node 22 handling modeled on the Gas City wrapper).
- test/docsync: Go guard keeping docs/ and docs.json in exact
  correspondence — every nav entry has a file, every page is in the nav
  (tiny stub allowlist for paths released bd binaries print), published
  pages use root-relative extensionless links that resolve, and engdocs/
  plus curated root markdown keep exact GitHub-style paths. Wired into
  make check-docs.
- .github/workflows/docs-mintlify.yml: docsync + baseline-aware
  mint broken-links check on PRs touching docs/**.
- Retire scripts/sync-website-docs.sh and its mirror-drift gate: the six
  mirrored files now live once in the Mintlify site; the committed
  Docusaurus mirrors stay frozen so the parallel-run site keeps building.
- Repoint inbound links to moved docs across README, guides, examples,
  npm-package, plugin resources, and Go comments; add docs/SYNC_CONCEPTS.md
  pointer stub (bd's agent templates print that path). Runtime strings in
  cmd/bd (prime.go, store_factory_nocgo.go, init_git_hooks.go) still print
  old paths — covered by stubs, flagged in the PR.
2026-07-12 10:37:07 -07:00

62 lines
1.4 KiB
Bash
Executable file

#!/usr/bin/env bash
# Local preview for the Mintlify docs site under docs/.
# Usage: ./mint.sh [dev|broken-links|...] (defaults to dev)
set -euo pipefail
repo_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
docs_dir="$repo_dir/docs"
args=("$@")
if [[ ${#args[@]} -eq 0 ]]; then
args=(dev)
fi
node_major() {
node -p 'process.versions.node.split(".")[0]' 2>/dev/null || true
}
find_node22_bin() {
local prefix
for prefix in /opt/homebrew/opt/node@22 /usr/local/opt/node@22; do
if [[ -x "$prefix/bin/node" ]]; then
printf '%s/bin\n' "$prefix"
return 0
fi
done
if command -v brew >/dev/null 2>&1; then
prefix=$(brew --prefix node@22 2>/dev/null || true)
if [[ -n "$prefix" && -x "$prefix/bin/node" ]]; then
printf '%s/bin\n' "$prefix"
return 0
fi
fi
return 1
}
major=$(node_major)
if [[ "$major" =~ ^[0-9]+$ ]] && (( major < 25 )); then
cd "$docs_dir"
exec npx --yes mint@latest "${args[@]}"
fi
if node22_bin=$(find_node22_bin); then
export PATH="$node22_bin:$PATH"
cd "$docs_dir"
exec npx --yes mint@latest "${args[@]}"
fi
cat >&2 <<EOF
Mintlify does not support Node 25+.
Use Node 22 LTS to preview the docs. For example:
nvm use 22
fnm use 22
volta install node@22
On macOS with Homebrew:
brew install node@22
cd "$repo_dir"
PATH="/opt/homebrew/opt/node@22/bin:\$PATH" ./mint.sh dev
EOF
exit 1