Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"test": "bash tests/sync-agent-rules.test.sh",
"lint": "eslint",
"typecheck": "tsc --noEmit",
"check": "npm run lint && npm run typecheck && npm run build"
"check": "npm run test && npm run lint && npm run typecheck && npm run build"
},
"dependencies": {
"@base-ui/react": "^1.3.0",
Expand Down
3 changes: 2 additions & 1 deletion scripts/sync-agent-rules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ resolve_imports() {
cat "$resolved"
echo ""
else
echo "<!-- Import not found: $import_path -->"
echo "Error: AGENTS.md import not found: $import_path" >&2
return 1
fi
else
echo "$line"
Expand Down
28 changes: 28 additions & 0 deletions tests/sync-agent-rules.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
Comment thread
CBOSSX marked this conversation as resolved.

set -euo pipefail

REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
FIXTURE_ROOT="$(mktemp -d)"
trap 'rm -rf "$FIXTURE_ROOT"' EXIT

mkdir -p "$FIXTURE_ROOT/scripts"
cp "$REPO_ROOT/scripts/sync-agent-rules.sh" "$FIXTURE_ROOT/scripts/"
printf '# Fixture instructions\n\n@docs/missing-guide.md\n' > "$FIXTURE_ROOT/AGENTS.md"

set +e
OUTPUT="$(bash "$FIXTURE_ROOT/scripts/sync-agent-rules.sh" 2>&1)"
STATUS=$?
set -e

if [[ $STATUS -eq 0 ]]; then
echo "Expected sync-agent-rules.sh to reject a missing @file import" >&2
exit 1
fi

if [[ "$OUTPUT" != *"docs/missing-guide.md"* ]]; then
echo "Expected the failure to name the missing import" >&2
exit 1
fi

echo "Missing @file imports fail closed"