feat: v1.3.2 — automated test suite, router enforcement, docs overhaul#3
feat: v1.3.2 — automated test suite, router enforcement, docs overhaul#3villainscode merged 4 commits intomainfrom
Conversation
Explain why subagents save tokens long-term despite higher per-operation cost — main context compounds input cost every turn. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Change additionalContext message from suggestive ("Use the...") to
mandatory ("MUST delegate", "Do NOT handle directly") so Claude
always delegates to the matched subagent.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- tests/test-router.sh: 67 test cases (skip, conflict, keywords, priority, edge) - tests/test-files.sh: 78 test cases (file existence, frontmatter, consistency) - tests/lib/helpers.sh: shared assertion helpers (run_router, assert_routes_to) - install.sh --dev: registers pre-commit hook for contributors - CI: replaced manual frontmatter checks with test suite Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bash tests/run-all.sh runs both test suites with full console output. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request updates the documentation to explain the token-saving benefits of subagents, increments the version to 1.3.2, and strengthens the routing instructions in squad-router.sh. It also introduces a comprehensive test suite and a developer mode in install.sh for registering a pre-commit hook. Feedback focuses on preventing the pre-commit registration from overwriting existing hooks, ensuring the file integrity test correctly parses multi-line arrays, and removing encoding artifacts from the test scripts.
| if [ -f "$hook_file" ] && grep -q "test-router.sh" "$hook_file" 2>/dev/null; then | ||
| green " Pre-commit hook already registered." | ||
| return 0 | ||
| fi |
There was a problem hiding this comment.
The current implementation of register_precommit is destructive. If a .git/hooks/pre-commit file already exists but does not contain the string "test-router.sh", it will be completely overwritten by the cat > "$hook_file" command on line 287. This would delete any existing pre-commit hooks the user might have (e.g., for linting or formatting). It is safer to check for the file's existence and skip registration with a warning if it contains other logic.
| if [ -f "$hook_file" ] && grep -q "test-router.sh" "$hook_file" 2>/dev/null; then | |
| green " Pre-commit hook already registered." | |
| return 0 | |
| fi | |
| if [ -f "$hook_file" ]; then | |
| if grep -q "test-router.sh" "$hook_file" 2>/dev/null; then | |
| green " Pre-commit hook already registered." | |
| return 0 | |
| fi | |
| yellow " Warning: $hook_file already exists. Skipping auto-registration to avoid overwriting." | |
| yellow " Please add the test commands manually if desired." | |
| return 0 | |
| fi |
| INSTALL_AGENTS=$(grep -A1 'SQUAD_AGENTS=' "$REPO_ROOT/install.sh" | \ | ||
| grep -o 'squad-[a-z]*' | sort -u) |
There was a problem hiding this comment.
The grep -A1 command only captures the first line following the match. Since the SQUAD_AGENTS array in install.sh is defined across multiple lines, this logic only extracts the first few agents and ignores the rest (e.g., squad-debug, squad-docs, etc.). This results in incomplete validation of the agent files. Using sed to capture the entire array block is a more robust approach.
| INSTALL_AGENTS=$(grep -A1 'SQUAD_AGENTS=' "$REPO_ROOT/install.sh" | \ | |
| grep -o 'squad-[a-z]*' | sort -u) | |
| INSTALL_AGENTS=$(sed -n '/SQUAD_AGENTS=(/,/)/p' "$REPO_ROOT/install.sh" | \ | |
| grep -o 'squad-[a-z]*' | sort -u) |
| echo "Squad Router Test Suite" | ||
| echo "======================" | ||
|
|
||
| # ─── A. Skip Conditions ──────���────────────────────────── |
There was a problem hiding this comment.
This line contains several garbage/replacement characters (``), likely due to an encoding issue or a copy-paste artifact. These should be removed to maintain code cleanliness.
| # ─── A. Skip Conditions ──────���────────────────────────── | |
| # ─── A. Skip Conditions ────────────────────────────────── |
Summary
Changes
tests/test-router.shtests/test-files.shtests/run-all.shtests/lib/helpers.shhooks/squad-router.shinstall.sh--devflag for pre-commit hook registrationREADME.mdREADME.en.md.github/workflows/ci.ymlTest plan
bash tests/run-all.sh— 145 tests passbash install.sh --dev— pre-commit hook registersgit committriggers tests automatically🤖 Generated with Claude Code