diff --git a/.github/workflows/check-divisions.yml b/.github/workflows/check-divisions.yml new file mode 100644 index 0000000..b50fc90 --- /dev/null +++ b/.github/workflows/check-divisions.yml @@ -0,0 +1,20 @@ +name: Check Divisions Consistency + +# Runs on every PR (no path filter on purpose): a new division directory must +# trip this check even when nobody touched divisions.json or the lint config. +on: + pull_request: + push: + branches: [main] + +jobs: + check-divisions: + name: divisions.json is the single source of truth + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Validate division set + run: | + chmod +x scripts/check-divisions.sh + ./scripts/check-divisions.sh diff --git a/.github/workflows/lint-agents.yml b/.github/workflows/lint-agents.yml index 8616e44..ea7359c 100644 --- a/.github/workflows/lint-agents.yml +++ b/.github/workflows/lint-agents.yml @@ -9,6 +9,7 @@ on: - "finance/**" - "game-development/**" - "gis/**" + - "integrations/**" - "marketing/**" - "paid-media/**" - "sales/**" @@ -19,6 +20,7 @@ on: - "support/**" - "spatial-computing/**" - "specialized/**" + - "strategy/**" jobs: lint: @@ -33,9 +35,9 @@ jobs: id: changed run: | FILES=$(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }}...HEAD -- \ - 'academic/**/*.md' 'design/**/*.md' 'engineering/**/*.md' 'finance/**/*.md' 'game-development/**/*.md' 'gis/**/*.md' 'marketing/**/*.md' 'paid-media/**/*.md' 'sales/**/*.md' 'security/**/*.md' 'product/**/*.md' \ + 'academic/**/*.md' 'design/**/*.md' 'engineering/**/*.md' 'finance/**/*.md' 'game-development/**/*.md' 'gis/**/*.md' 'integrations/**/*.md' 'marketing/**/*.md' 'paid-media/**/*.md' 'sales/**/*.md' 'security/**/*.md' 'product/**/*.md' \ 'project-management/**/*.md' 'testing/**/*.md' 'support/**/*.md' \ - 'spatial-computing/**/*.md' 'specialized/**/*.md') + 'spatial-computing/**/*.md' 'specialized/**/*.md' 'strategy/**/*.md') { echo "files</` in +# the lint workflow, or new divisions silently skip CI. +WF=".github/workflows/lint-agents.yml" +if [[ -f "$WF" ]]; then + while IFS= read -r div; do + grep -qE "\b${div}/" "$WF" || fail "$WF has no path filter for division '$div'" + done < <(canonical) +else + fail "$WF not found" +fi + +# Every entry must have label, icon, and color. +while IFS= read -r div; do + block="$(awk -v d="\"$div\"" '$0 ~ d"[[:space:]]*:[[:space:]]*\\{" {print; found=1; next} found && /\}/ {print; exit} found {print}' "$JSON")" + for field in label icon color; do + echo "$block" | grep -qE "\"$field\"[[:space:]]*:" \ + || fail "division '$div' in $JSON is missing \"$field\"" + done +done < <(canonical) + +# --- result ---------------------------------------------------------------- + +count="$(canonical | wc -l | tr -d ' ')" +if [[ $errors -gt 0 ]]; then + echo "" + echo "FAILED: $errors divisions consistency error(s). $JSON is the source of truth." + exit 1 +fi +echo "PASSED: $count divisions consistent across $JSON, directories, scripts, and CI." diff --git a/scripts/convert.sh b/scripts/convert.sh index 1521015..84feb58 100755 --- a/scripts/convert.sh +++ b/scripts/convert.sh @@ -67,7 +67,7 @@ TODAY="$(date +%Y-%m-%d)" . "$SCRIPT_DIR/lib.sh" AGENT_DIRS=( - academic design engineering finance game-development gis marketing paid-media product project-management + academic design engineering finance game-development gis integrations marketing paid-media product project-management sales security spatial-computing specialized strategy support testing ) diff --git a/scripts/lint-agents.sh b/scripts/lint-agents.sh index 574ca6f..f086dfd 100755 --- a/scripts/lint-agents.sh +++ b/scripts/lint-agents.sh @@ -18,6 +18,7 @@ AGENT_DIRS=( finance game-development gis + integrations marketing paid-media product @@ -26,6 +27,7 @@ AGENT_DIRS=( security spatial-computing specialized + strategy support testing )