Skip to content

feat: v1.3.2 — automated test suite, router enforcement, docs overhaul#3

Merged
villainscode merged 4 commits intomainfrom
develop
Apr 11, 2026
Merged

feat: v1.3.2 — automated test suite, router enforcement, docs overhaul#3
villainscode merged 4 commits intomainfrom
develop

Conversation

@villainscode
Copy link
Copy Markdown
Contributor

Summary

  • Automated test suite: 145 test cases (67 router + 78 file integrity) with pre-commit hook
  • Router enforcement: strengthened context injection message to enforce subagent delegation
  • README overhaul: KO/EN split, Agent tool reference, hook mechanism docs, version table
  • CI fix: shellcheck SC2221/SC1071 resolved

Changes

Area Details
tests/test-router.sh 67 cases: skip conditions, conflict resolution, keywords, priority, edge cases
tests/test-files.sh 78 cases: file existence, frontmatter validation, install.sh consistency
tests/run-all.sh Unified test runner
tests/lib/helpers.sh Shared assertion helpers
hooks/squad-router.sh Enforced "MUST delegate" message + glob pattern fix
install.sh --dev flag for pre-commit hook registration
README.md Korean (default), hook mechanism diagram, version table
README.en.md English version
.github/workflows/ci.yml Replaced manual checks with test suite

Test plan

  • bash tests/run-all.sh — 145 tests pass
  • bash install.sh --dev — pre-commit hook registers
  • git commit triggers tests automatically
  • shellcheck passes on squad-router.sh
  • CI pipeline passes on GitHub Actions

🤖 Generated with Claude Code

villainscode and others added 4 commits April 11, 2026 16:14
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>
@villainscode villainscode merged commit 57ec03d into main Apr 11, 2026
1 check passed
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread install.sh
Comment on lines +281 to +284
if [ -f "$hook_file" ] && grep -q "test-router.sh" "$hook_file" 2>/dev/null; then
green " Pre-commit hook already registered."
return 0
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
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

Comment thread tests/test-files.sh
Comment on lines +124 to +125
INSTALL_AGENTS=$(grep -A1 'SQUAD_AGENTS=' "$REPO_ROOT/install.sh" | \
grep -o 'squad-[a-z]*' | sort -u)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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)

Comment thread tests/test-router.sh
echo "Squad Router Test Suite"
echo "======================"

# ─── A. Skip Conditions ──────���──────────────────────────
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
# ─── A. Skip Conditions ──────���──────────────────────────
# ─── A. Skip Conditions ──────────────────────────────────

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant