Consolidates three codebases into a single agent orchestration repo: - agentci (from go-scm): Clotho dual-run verification, agent config, SSH security (sanitisation, secure commands, token masking) - jobrunner (from go-scm): Poll-dispatch-report pipeline with 7 handlers (dispatch, completion, auto-merge, publish draft, dismiss reviews, send fix command, tick parent epic) - plugins marketplace (from agentic/plugins): 27 Claude/Codex/Gemini plugins with shared MCP server All 150+ tests passing across 6 packages. Co-Authored-By: Virgil <virgil@lethean.io>
331 lines
8.7 KiB
Bash
Executable file
331 lines
8.7 KiB
Bash
Executable file
#!/bin/bash
|
|
# End-to-end test for agentic-flows plugin
|
|
# Tests: hook triggers -> agent invocation -> skill execution -> MCP tool calls
|
|
|
|
set -e
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PLUGIN_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
CORE_ROOT="/home/claude/core-pr320"
|
|
|
|
# Track test results
|
|
TESTS_PASSED=0
|
|
TESTS_FAILED=0
|
|
|
|
log_pass() {
|
|
echo -e "${GREEN}[PASS]${NC} $1"
|
|
((TESTS_PASSED++))
|
|
}
|
|
|
|
log_fail() {
|
|
echo -e "${RED}[FAIL]${NC} $1"
|
|
((TESTS_FAILED++))
|
|
}
|
|
|
|
log_info() {
|
|
echo -e "${YELLOW}[INFO]${NC} $1"
|
|
}
|
|
|
|
# Test 1: Verify plugin structure
|
|
test_plugin_structure() {
|
|
log_info "Testing plugin structure..."
|
|
|
|
# Check plugin.json exists and has correct version
|
|
if [[ -f "$PLUGIN_ROOT/.claude-plugin/plugin.json" ]]; then
|
|
VERSION=$(jq -r '.version' "$PLUGIN_ROOT/.claude-plugin/plugin.json")
|
|
if [[ "$VERSION" == "0.4.0" ]]; then
|
|
log_pass "plugin.json exists with version 0.4.0"
|
|
else
|
|
log_fail "plugin.json has wrong version: $VERSION (expected 0.4.0)"
|
|
fi
|
|
else
|
|
log_fail "plugin.json not found"
|
|
fi
|
|
|
|
# Check hooks directory
|
|
if [[ -d "$PLUGIN_ROOT/.claude-plugin/hooks" ]]; then
|
|
log_pass "hooks directory exists"
|
|
else
|
|
log_fail "hooks directory not found"
|
|
fi
|
|
|
|
# Check agents directory
|
|
if [[ -d "$PLUGIN_ROOT/agents" ]]; then
|
|
AGENT_COUNT=$(ls -1 "$PLUGIN_ROOT/agents" 2>/dev/null | wc -l)
|
|
if [[ $AGENT_COUNT -ge 10 ]]; then
|
|
log_pass "agents directory has $AGENT_COUNT agents"
|
|
else
|
|
log_fail "agents directory has only $AGENT_COUNT agents (expected >= 10)"
|
|
fi
|
|
else
|
|
log_fail "agents directory not found"
|
|
fi
|
|
|
|
# Check skills directory
|
|
if [[ -d "$PLUGIN_ROOT/skills" ]]; then
|
|
SKILL_COUNT=$(ls -1 "$PLUGIN_ROOT/skills" 2>/dev/null | wc -l)
|
|
if [[ $SKILL_COUNT -ge 8 ]]; then
|
|
log_pass "skills directory has $SKILL_COUNT skills"
|
|
else
|
|
log_fail "skills directory has only $SKILL_COUNT skills (expected >= 8)"
|
|
fi
|
|
else
|
|
log_fail "skills directory not found"
|
|
fi
|
|
|
|
# Check patterns directory
|
|
if [[ -d "$PLUGIN_ROOT/patterns" ]]; then
|
|
log_pass "patterns directory exists"
|
|
else
|
|
log_fail "patterns directory not found"
|
|
fi
|
|
}
|
|
|
|
# Test 2: Verify hook files
|
|
test_hooks() {
|
|
log_info "Testing hook configuration..."
|
|
|
|
local hooks_dir="$PLUGIN_ROOT/.claude-plugin/hooks"
|
|
|
|
# Check SessionStart hook
|
|
if [[ -f "$hooks_dir/session-start.json" ]]; then
|
|
log_pass "session-start.json exists"
|
|
else
|
|
log_fail "session-start.json not found"
|
|
fi
|
|
|
|
# Check PreToolUse hooks
|
|
if [[ -f "$hooks_dir/pre-bash.json" ]]; then
|
|
log_pass "pre-bash.json exists"
|
|
else
|
|
log_fail "pre-bash.json not found"
|
|
fi
|
|
|
|
# Check PostToolUse hooks
|
|
if [[ -f "$hooks_dir/post-edit.json" ]]; then
|
|
log_pass "post-edit.json exists"
|
|
else
|
|
log_fail "post-edit.json not found"
|
|
fi
|
|
|
|
if [[ -f "$hooks_dir/post-write.json" ]]; then
|
|
log_pass "post-write.json exists"
|
|
else
|
|
log_fail "post-write.json not found"
|
|
fi
|
|
|
|
# Check Stop hook
|
|
if [[ -f "$hooks_dir/stop.json" ]]; then
|
|
log_pass "stop.json exists"
|
|
else
|
|
log_fail "stop.json not found"
|
|
fi
|
|
}
|
|
|
|
# Test 3: Verify agent files have required sections
|
|
test_agents() {
|
|
log_info "Testing agent configurations..."
|
|
|
|
local agents_dir="$PLUGIN_ROOT/agents"
|
|
|
|
for tier in junior-software-engineer software-engineer senior-software-engineer; do
|
|
local agent_file="$agents_dir/$tier/AGENT.md"
|
|
if [[ -f "$agent_file" ]]; then
|
|
# Check for Memory section
|
|
if grep -q "## Memory" "$agent_file"; then
|
|
log_pass "$tier has Memory section"
|
|
else
|
|
log_fail "$tier missing Memory section"
|
|
fi
|
|
|
|
# Check for Handoff section
|
|
if grep -q "## Handoff" "$agent_file" || grep -q "handoff" "$agent_file"; then
|
|
log_pass "$tier has handoff configuration"
|
|
else
|
|
log_fail "$tier missing handoff configuration"
|
|
fi
|
|
else
|
|
log_fail "$tier AGENT.md not found"
|
|
fi
|
|
done
|
|
}
|
|
|
|
# Test 4: Verify skill files
|
|
test_skills() {
|
|
log_info "Testing skill configurations..."
|
|
|
|
local skills_dir="$PLUGIN_ROOT/skills"
|
|
|
|
# Check seed-agent-developer skill
|
|
if [[ -d "$skills_dir/seed-agent-developer" ]]; then
|
|
if [[ -f "$skills_dir/seed-agent-developer/SKILL.md" ]]; then
|
|
log_pass "seed-agent-developer skill exists"
|
|
else
|
|
log_fail "seed-agent-developer/SKILL.md not found"
|
|
fi
|
|
|
|
# Check for required scripts
|
|
for script in fetch-issue.sh analyze-issue.sh match-patterns.sh assemble-context.sh; do
|
|
if [[ -f "$skills_dir/seed-agent-developer/$script" ]]; then
|
|
log_pass "seed-agent-developer/$script exists"
|
|
else
|
|
log_fail "seed-agent-developer/$script not found"
|
|
fi
|
|
done
|
|
else
|
|
log_fail "seed-agent-developer skill directory not found"
|
|
fi
|
|
}
|
|
|
|
# Test 5: Verify pattern files
|
|
test_patterns() {
|
|
log_info "Testing pattern files..."
|
|
|
|
local patterns_dir="$PLUGIN_ROOT/patterns"
|
|
|
|
for pattern in agent-memory handoff-protocol capability-tiers; do
|
|
if [[ -f "$patterns_dir/$pattern.md" ]]; then
|
|
log_pass "$pattern.md exists"
|
|
else
|
|
log_fail "$pattern.md not found"
|
|
fi
|
|
done
|
|
}
|
|
|
|
# Test 6: Verify Core packages exist
|
|
test_core_packages() {
|
|
log_info "Testing core packages..."
|
|
|
|
# Check ws package
|
|
if [[ -f "$CORE_ROOT/pkg/ws/ws.go" ]]; then
|
|
log_pass "pkg/ws package exists"
|
|
else
|
|
log_fail "pkg/ws package not found"
|
|
fi
|
|
|
|
# Check webview package
|
|
if [[ -f "$CORE_ROOT/pkg/webview/webview.go" ]]; then
|
|
log_pass "pkg/webview package exists"
|
|
else
|
|
log_fail "pkg/webview package not found"
|
|
fi
|
|
|
|
# Check MCP tools
|
|
for tool in tools_process.go tools_ws.go tools_webview.go; do
|
|
if [[ -f "$CORE_ROOT/pkg/mcp/$tool" ]]; then
|
|
log_pass "pkg/mcp/$tool exists"
|
|
else
|
|
log_fail "pkg/mcp/$tool not found"
|
|
fi
|
|
done
|
|
|
|
# Check BugSETI
|
|
if [[ -f "$CORE_ROOT/cmd/bugseti/main.go" ]]; then
|
|
log_pass "cmd/bugseti exists"
|
|
else
|
|
log_fail "cmd/bugseti not found"
|
|
fi
|
|
}
|
|
|
|
# Test 7: Test hook script execution (dry run)
|
|
test_hook_scripts() {
|
|
log_info "Testing hook script syntax..."
|
|
|
|
local hooks_dir="$PLUGIN_ROOT/.claude-plugin/hooks"
|
|
|
|
# Check each shell script for syntax errors
|
|
for script in "$hooks_dir"/*.sh; do
|
|
if [[ -f "$script" ]]; then
|
|
if bash -n "$script" 2>/dev/null; then
|
|
log_pass "$(basename "$script") has valid syntax"
|
|
else
|
|
log_fail "$(basename "$script") has syntax errors"
|
|
fi
|
|
fi
|
|
done
|
|
|
|
# Check skill scripts
|
|
local skill_dir="$PLUGIN_ROOT/skills/seed-agent-developer"
|
|
if [[ -d "$skill_dir" ]]; then
|
|
for script in "$skill_dir"/*.sh; do
|
|
if [[ -f "$script" ]]; then
|
|
if bash -n "$script" 2>/dev/null; then
|
|
log_pass "$(basename "$script") has valid syntax"
|
|
else
|
|
log_fail "$(basename "$script") has syntax errors"
|
|
fi
|
|
fi
|
|
done
|
|
fi
|
|
}
|
|
|
|
# Test 8: Verify MCP server can be built
|
|
test_mcp_build() {
|
|
log_info "Testing MCP server build..."
|
|
|
|
if command -v go &> /dev/null; then
|
|
cd "$CORE_ROOT"
|
|
if go build -o /dev/null ./pkg/mcp 2>/dev/null; then
|
|
log_pass "MCP package builds successfully"
|
|
else
|
|
log_fail "MCP package build failed"
|
|
fi
|
|
else
|
|
log_info "Go not available, skipping build test"
|
|
fi
|
|
}
|
|
|
|
# Main execution
|
|
main() {
|
|
echo "=========================================="
|
|
echo "agentic-flows Plugin E2E Tests"
|
|
echo "=========================================="
|
|
echo ""
|
|
|
|
test_plugin_structure
|
|
echo ""
|
|
|
|
test_hooks
|
|
echo ""
|
|
|
|
test_agents
|
|
echo ""
|
|
|
|
test_skills
|
|
echo ""
|
|
|
|
test_patterns
|
|
echo ""
|
|
|
|
test_core_packages
|
|
echo ""
|
|
|
|
test_hook_scripts
|
|
echo ""
|
|
|
|
test_mcp_build
|
|
echo ""
|
|
|
|
echo "=========================================="
|
|
echo "Test Summary"
|
|
echo "=========================================="
|
|
echo -e "${GREEN}Passed:${NC} $TESTS_PASSED"
|
|
echo -e "${RED}Failed:${NC} $TESTS_FAILED"
|
|
echo ""
|
|
|
|
if [[ $TESTS_FAILED -gt 0 ]]; then
|
|
echo -e "${RED}Some tests failed!${NC}"
|
|
exit 1
|
|
else
|
|
echo -e "${GREEN}All tests passed!${NC}"
|
|
exit 0
|
|
fi
|
|
}
|
|
|
|
main "$@"
|