fix: align agent lint with convert.sh and CI (#333)

Expands CI lint workflow to trigger on academic/ changes. Hardens lint-agents.sh with file existence checks and portable word-count handling (macOS/BSD compatibility).
This commit is contained in:
everforge
2026-04-10 18:46:45 -05:00
committed by GitHub
parent 37e5c521c9
commit 618582cdcc
2 changed files with 26 additions and 15 deletions

View File

@@ -3,18 +3,19 @@ name: Lint Agent Files
on: on:
pull_request: pull_request:
paths: paths:
- 'design/**' - "academic/**"
- 'engineering/**' - "design/**"
- 'game-development/**' - "engineering/**"
- 'marketing/**' - "game-development/**"
- 'paid-media/**' - "marketing/**"
- 'sales/**' - "paid-media/**"
- 'product/**' - "sales/**"
- 'project-management/**' - "product/**"
- 'testing/**' - "project-management/**"
- 'support/**' - "testing/**"
- 'spatial-computing/**' - "support/**"
- 'specialized/**' - "spatial-computing/**"
- "specialized/**"
jobs: jobs:
lint: lint:
@@ -29,7 +30,7 @@ jobs:
id: changed id: changed
run: | run: |
FILES=$(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }}...HEAD -- \ FILES=$(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }}...HEAD -- \
'design/**/*.md' 'engineering/**/*.md' 'game-development/**/*.md' 'marketing/**/*.md' 'paid-media/**/*.md' 'sales/**/*.md' 'product/**/*.md' \ 'academic/**/*.md' 'design/**/*.md' 'engineering/**/*.md' 'game-development/**/*.md' 'marketing/**/*.md' 'paid-media/**/*.md' 'sales/**/*.md' 'product/**/*.md' \
'project-management/**/*.md' 'testing/**/*.md' 'support/**/*.md' \ 'project-management/**/*.md' 'testing/**/*.md' 'support/**/*.md' \
'spatial-computing/**/*.md' 'specialized/**/*.md') 'spatial-computing/**/*.md' 'specialized/**/*.md')
{ {

View File

@@ -10,6 +10,7 @@
set -euo pipefail set -euo pipefail
# Keep in sync with AGENT_DIRS in scripts/convert.sh
AGENT_DIRS=( AGENT_DIRS=(
academic academic
design design
@@ -17,6 +18,7 @@ AGENT_DIRS=(
game-development game-development
marketing marketing
paid-media paid-media
sales
product product
project-management project-management
sales sales
@@ -36,6 +38,12 @@ warnings=0
lint_file() { lint_file() {
local file="$1" local file="$1"
if [[ ! -f "$file" ]]; then
echo "ERROR $file: not a file or does not exist"
errors=$((errors + 1))
return
fi
# 1. Check frontmatter delimiters # 1. Check frontmatter delimiters
local first_line local first_line
first_line=$(head -1 "$file") first_line=$(head -1 "$file")
@@ -74,8 +82,10 @@ lint_file() {
fi fi
done done
# 4. Check file has meaningful content # 4. Check file has meaningful content (awk strips wc's leading whitespace on macOS/BSD)
if [[ $(echo "$body" | wc -w) -lt 50 ]]; then local word_count
word_count=$(echo "$body" | wc -w | awk '{print $1}')
if [[ "${word_count:-0}" -lt 50 ]]; then
echo "WARN $file: body seems very short (< 50 words)" echo "WARN $file: body seems very short (< 50 words)"
warnings=$((warnings + 1)) warnings=$((warnings + 1))
fi fi