Skip to content

A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy injectors to reality checkers. Each agent is a specialized expert with personality, processes, and proven deliverables.

Shell

fix(lint): stop SIGPIPE from faking missing sections (#710)

Jaak Vaher134b4d08e698
diff --git a/scripts/lint-agents.sh b/scripts/lint-agents.sh
index 0ab43fdd..226bff71 100755
--- a/scripts/lint-agents.sh
+++ b/scripts/lint-agents.sh
@@ -91,7 +91,7 @@ lint_file() {
# 2. Check required frontmatter fields
for field in "${REQUIRED_FRONTMATTER[@]}"; do
- if ! echo "$frontmatter" | grep -qE "^${field}:"; then
+ if ! grep -qE -- "^${field}:" <<<"$frontmatter"; then
echo "ERROR $file: missing frontmatter field '${field}'"
errors=$((errors + 1))
fi
@@ -101,8 +101,12 @@ lint_file() {
local body
body=$(awk 'BEGIN{n=0} /^---$/{n++; next} n>=2{print}' "$file")
+ # Feed grep from a herestring, not a pipe: `grep -q` exits at the first match
+ # without draining its input, which kills a piping `echo` with SIGPIPE. Under
+ # `set -o pipefail` that 141 becomes the pipeline's status and is indistinguishable
+ # from "no match", so a large body raced its way to a spurious WARN.
for section in "${RECOMMENDED_SECTIONS[@]}"; do
- if ! echo "$body" | grep -qi "$section"; then
+ if ! grep -qi -- "$section" <<<"$body"; then
echo "WARN $file: missing recommended section '${section}'"
warnings=$((warnings + 1))
fi