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): reject unsupported folded YAML frontmatter

Rudy Celekli266c0864fe31
diff --git a/.github/workflows/lint-agents.yml b/.github/workflows/lint-agents.yml
index c253839d..7eea6dfc 100644
--- a/.github/workflows/lint-agents.yml
+++ b/.github/workflows/lint-agents.yml
@@ -104,3 +104,7 @@ jobs:
run: |
chmod +x scripts/lint-agents.sh
./scripts/lint-agents.sh
+
+ - name: Reject folded frontmatter fixtures
+ if: steps.rules.outputs.changed == 'true'
+ run: bash scripts/test-folded-frontmatter.sh
diff --git a/scripts/lint-agents.sh b/scripts/lint-agents.sh
index 442e6e31..15358839 100755
--- a/scripts/lint-agents.sh
+++ b/scripts/lint-agents.sh
@@ -112,6 +112,15 @@ lint_file() {
return
fi
+ # The lightweight converters read plain or quoted scalar fields. A folded
+ # block otherwise passes presence checks but leaks its YAML indicator into
+ # the generated value.
+ if grep -qE '^[[:space:]]*[[:alnum:]_-]+:[[:space:]]*>([-+][1-9]?|[1-9][-+]?)?([[:space:]]+#.*)?[[:space:]]*$' <<<"$frontmatter"; then
+ echo "ERROR $file: folded YAML frontmatter is unsupported — use a single-line scalar"
+ errors=$((errors + 1))
+ return
+ fi
+
# 2. Check required frontmatter fields
for field in "${REQUIRED_FRONTMATTER[@]}"; do
if ! grep -qE -- "^${field}:" <<<"$frontmatter"; then
diff --git a/scripts/test-folded-frontmatter.sh b/scripts/test-folded-frontmatter.sh
new file mode 100755
index 00000000..04cdb176
--- /dev/null
+++ b/scripts/test-folded-frontmatter.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+set -euo pipefail
+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
+scratch="$(mktemp -d)"
+trap 'rm -rf "$scratch"' EXIT
+for indicator in '>' '>-' '>+' '>2' '>2-' '>-2' '>+2' '>2+ # comment'; do
+ printf '%s\n' '---' 'name: Example Agent' "description: $indicator" ' First line' ' Second line' 'color: blue' '---' '## Identity' '## Core Mission' '## Critical Rules' > "$scratch/agent.md"
+ if bash "$SCRIPT_DIR/lint-agents.sh" "$scratch/agent.md" > "$scratch/result.log" 2>&1; then
+ echo "FAIL: linter accepted folded frontmatter $indicator" >&2; exit 1
+ fi
+ grep -q 'folded YAML frontmatter is unsupported' "$scratch/result.log"
+done
+for description in '"A > B"' "'A > B'" 'Ordinary description'; do
+ printf '%s\n' '---' 'name: Example Agent' "description: $description" 'color: blue' '---' '## Identity' '## Core Mission' '## Critical Rules' '> Body quotation' > "$scratch/agent.md"
+ bash "$SCRIPT_DIR/lint-agents.sh" "$scratch/agent.md" > "$scratch/result.log" 2>&1
+done
+echo 'PASS: folded frontmatter is rejected while quoted scalars and body quotations pass'