|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +set -euo pipefail |
| 4 | + |
| 5 | +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" |
| 6 | +cd "${repo_root}" |
| 7 | + |
| 8 | +pass_count=0 |
| 9 | +fail_count=0 |
| 10 | + |
| 11 | +check() { |
| 12 | + local name="$1" |
| 13 | + local cmd="$2" |
| 14 | + if eval "${cmd}" >/dev/null 2>&1; then |
| 15 | + echo "PASS | ${name}" |
| 16 | + pass_count=$((pass_count + 1)) |
| 17 | + else |
| 18 | + echo "FAIL | ${name}" |
| 19 | + fail_count=$((fail_count + 1)) |
| 20 | + fi |
| 21 | +} |
| 22 | + |
| 23 | +canonical_commands=( |
| 24 | + "commands/implement-flutter-feature.md" |
| 25 | + "commands/implement-figma-screen.md" |
| 26 | + "commands/generate-flutter-tests.md" |
| 27 | + "commands/review-flutter-code.md" |
| 28 | + "commands/security-review.md" |
| 29 | + "commands/update-flutter-dependencies.md" |
| 30 | + "commands/resolve-flutter-build-error.md" |
| 31 | + "commands/prepare-mobile-release.md" |
| 32 | + "commands/integrate-firebase.md" |
| 33 | + "commands/migrate-flutter-code.md" |
| 34 | + "commands/scaffold-flutter-feature.md" |
| 35 | + "commands/setup-mobile-github-pipeline.md" |
| 36 | + "commands/sync-official-flutter-ai-rules.md" |
| 37 | + "commands/write-widget-test.md" |
| 38 | + "commands/write-bloc-test.md" |
| 39 | + "commands/write-e2e-test.md" |
| 40 | +) |
| 41 | + |
| 42 | +for cmd_file in "${canonical_commands[@]}"; do |
| 43 | + base="$(basename "${cmd_file}")" |
| 44 | + check "C-${base} has guardrails section" "rg -q '^Preconditions and guardrails:' '${cmd_file}'" |
| 45 | + check "C-${base} references prompt guardrails doc" "rg -q 'prompt-execution-guardrails\\.md' '${cmd_file}'" |
| 46 | + check "C-${base} references validation matrix" "rg -q 'validation-matrix\\.md' '${cmd_file}'" |
| 47 | +done |
| 48 | + |
| 49 | +for skill in skills/*/SKILL.md; do |
| 50 | + base="$(basename "$(dirname "${skill}")")" |
| 51 | + check "S-${base} has workflow" "rg -q '^## Workflow' '${skill}'" |
| 52 | + check "S-${base} has output contract" "rg -q '^## (Required output|Output format)' '${skill}'" |
| 53 | + check "S-${base} has guardrails or scope limits" "rg -q '^## (Guardrails|Scope guardrails|Quality defaults)' '${skill}'" |
| 54 | +done |
| 55 | + |
| 56 | +for agent in agents/*.md; do |
| 57 | + base="$(basename "${agent}")" |
| 58 | + check "A-${base} has output expectations" "rg -q '^## Output expectations' '${agent}'" |
| 59 | + check "A-${base} expects validation evidence" "rg -qi '(validation|commands and results|evidence)' '${agent}'" |
| 60 | +done |
| 61 | + |
| 62 | +check "Active Flutter rules are project-first for state management" "rg -q '\\* \\*\\*Project First:\\*\\* Follow the existing project architecture and state-management choice\\.' rules/flutter-official-ai-rules.mdc" |
| 63 | +check "Active Flutter rules do not prohibit Riverpod/Bloc/GetX outright" "! rg -q 'Prohibited:\\*\\* NO Riverpod, Bloc, GetX unless explicitly requested\\.' rules/flutter-official-ai-rules.mdc" |
| 64 | +check "Scaffold architecture skill enforces project-first state-management selection" "rg -q 'existing project state-management convention' skills/scaffold-flutter-architecture/SKILL.md" |
| 65 | + |
| 66 | +total=$((pass_count + fail_count)) |
| 67 | +echo |
| 68 | +echo "SUMMARY | total=${total} passed=${pass_count} failed=${fail_count}" |
| 69 | + |
| 70 | +if [ "${fail_count}" -gt 0 ]; then |
| 71 | + exit 1 |
| 72 | +fi |
0 commit comments