claude-flow-novice 2.14.35 → 2.14.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/.claude/commands/CFN_LOOP_TASK_MODE.md +1 -1
  2. package/.claude/commands/switch-api.md +1 -1
  3. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +2 -1
  4. package/.claude/skills/cfn-loop-validation/config.json +2 -2
  5. package/claude-assets/agents/README-AGENT_LIFECYCLE.md +37 -10
  6. package/claude-assets/agents/README-VALIDATION.md +0 -8
  7. package/claude-assets/agents/cfn-dev-team/README.md +0 -8
  8. package/claude-assets/agents/cfn-dev-team/coordinators/README.md +1 -9
  9. package/claude-assets/agents/cfn-dev-team/developers/README.md +1 -9
  10. package/claude-assets/agents/cfn-dev-team/documentation/README-VALIDATION.md +0 -8
  11. package/claude-assets/agents/cfn-dev-team/documentation/agent-type-guidelines.md +0 -10
  12. package/claude-assets/agents/cfn-dev-team/reviewers/README.md +1 -9
  13. package/claude-assets/agents/cfn-dev-team/reviewers/quality/quality-metrics.md +0 -10
  14. package/claude-assets/agents/cfn-dev-team/test-agent.md +0 -10
  15. package/claude-assets/agents/cfn-dev-team/testers/README.md +1 -9
  16. package/claude-assets/agents/csuite/cto-agent.md +0 -10
  17. package/claude-assets/agents/custom/cfn-system-expert.md +1 -128
  18. package/claude-assets/agents/docker-coordinators/cfn-docker-v3-coordinator.md +1 -5
  19. package/claude-assets/agents/docker-team/csuite/c-suite-template.md +1 -5
  20. package/claude-assets/agents/docker-team/infrastructure/team-coordinator-template.md +1 -5
  21. package/claude-assets/agents/marketing_hybrid/cost_tracker.md +0 -10
  22. package/claude-assets/agents/marketing_hybrid/docker_deployer.md +0 -10
  23. package/claude-assets/agents/marketing_hybrid/zai_worker_spawner.md +0 -10
  24. package/claude-assets/commands/CFN_LOOP_TASK_MODE.md +1 -1
  25. package/claude-assets/commands/switch-api.md +1 -1
  26. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +2 -1
  27. package/claude-assets/skills/cfn-loop-validation/config.json +2 -2
  28. package/claude-assets/skills/cfn-process-instrumentation/instrument-process.sh +324 -322
  29. package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +2 -2
  30. package/claude-assets/skills/cfn-task-mode-sanitize/task-mode-env-sanitizer.sh +213 -182
  31. package/claude-assets/skills/cfn-validation-runner-instrumentation/wrapped-executor.sh +233 -271
  32. package/dist/agents/agent-loader.js +467 -133
  33. package/dist/agents/agent-loader.js.map +1 -1
  34. package/dist/cli/config-manager.js +109 -91
  35. package/dist/cli/config-manager.js.map +1 -1
  36. package/package.json +1 -1
  37. package/scripts/docker-build-mcp.sh +155 -0
  38. package/scripts/docker-test-mcp.sh +260 -0
  39. package/scripts/mcp-health-check.sh +123 -0
@@ -0,0 +1,260 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ # Docker MCP Test Script
5
+ # Tests MCP server containers and agent connectivity
6
+
7
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
9
+
10
+ # Colors for output
11
+ RED='\033[0;31m'
12
+ GREEN='\033[0;32m'
13
+ YELLOW='\033[1;33m'
14
+ BLUE='\033[0;34m'
15
+ NC='\033[0m' # No Color
16
+
17
+ # Test results tracking
18
+ TESTS_PASSED=0
19
+ TESTS_FAILED=0
20
+ TEST_RESULTS=()
21
+
22
+ echo "========================================="
23
+ echo " Docker MCP Test Suite"
24
+ echo "========================================="
25
+ echo ""
26
+
27
+ # Function to print colored output
28
+ print_status() {
29
+ local status=$1
30
+ local message=$2
31
+ case $status in
32
+ "success")
33
+ echo -e "${GREEN}✓${NC} $message"
34
+ ;;
35
+ "error")
36
+ echo -e "${RED}✗${NC} $message"
37
+ ;;
38
+ "info")
39
+ echo -e "${BLUE}→${NC} $message"
40
+ ;;
41
+ "warning")
42
+ echo -e "${YELLOW}⚠${NC} $message"
43
+ ;;
44
+ esac
45
+ }
46
+
47
+ # Function to record test result
48
+ record_test() {
49
+ local test_name=$1
50
+ local passed=$2
51
+ local message=$3
52
+
53
+ if [ "$passed" = "true" ]; then
54
+ ((TESTS_PASSED++))
55
+ TEST_RESULTS+=("PASS: $test_name - $message")
56
+ print_status "success" "$test_name"
57
+ else
58
+ ((TESTS_FAILED++))
59
+ TEST_RESULTS+=("FAIL: $test_name - $message")
60
+ print_status "error" "$test_name - $message"
61
+ fi
62
+ }
63
+
64
+ # Cleanup function
65
+ cleanup() {
66
+ print_status "info" "Cleaning up test containers..."
67
+ docker-compose -f "$PROJECT_ROOT/docker-compose.production.yml" down \
68
+ mcp-playwright mcp-redis-tools mcp-n8n mcp-security-scanner 2>/dev/null || true
69
+ }
70
+
71
+ # Trap cleanup on exit
72
+ trap cleanup EXIT
73
+
74
+ # Navigate to project root
75
+ cd "$PROJECT_ROOT"
76
+
77
+ # Test 1: MCP Configuration Validation
78
+ print_status "info" "Test 1: Validating MCP configuration..."
79
+ if [ -f "config/mcp-servers.json" ]; then
80
+ if command -v jq &> /dev/null; then
81
+ if jq empty config/mcp-servers.json 2>/dev/null; then
82
+ record_test "MCP Config Validation" "true" "Valid JSON configuration"
83
+ else
84
+ record_test "MCP Config Validation" "false" "Invalid JSON"
85
+ fi
86
+ else
87
+ record_test "MCP Config Validation" "true" "File exists (jq not available for validation)"
88
+ fi
89
+ else
90
+ record_test "MCP Config Validation" "false" "config/mcp-servers.json not found"
91
+ fi
92
+
93
+ # Test 2: Docker Compose Syntax Validation
94
+ print_status "info" "Test 2: Validating Docker Compose syntax..."
95
+ if docker-compose -f docker-compose.production.yml config > /dev/null 2>&1; then
96
+ record_test "Docker Compose Syntax" "true" "Valid syntax"
97
+ else
98
+ record_test "Docker Compose Syntax" "false" "Syntax errors detected"
99
+ fi
100
+
101
+ # Test 3: Start MCP containers
102
+ print_status "info" "Test 3: Starting MCP containers..."
103
+ if docker-compose -f docker-compose.production.yml up -d \
104
+ redis-coordinator \
105
+ mcp-playwright \
106
+ mcp-redis-tools \
107
+ mcp-n8n \
108
+ mcp-security-scanner 2>&1 | tee /tmp/docker-test-mcp-start.log; then
109
+ record_test "MCP Container Startup" "true" "All containers started"
110
+ else
111
+ record_test "MCP Container Startup" "false" "Failed to start containers"
112
+ exit 1
113
+ fi
114
+
115
+ # Wait for containers to initialize
116
+ print_status "info" "Waiting for containers to initialize (30s)..."
117
+ sleep 30
118
+
119
+ # Test 4: Health Check - Playwright
120
+ print_status "info" "Test 4: Testing Playwright MCP server health..."
121
+ if timeout 10 docker exec cfn-mcp-playwright curl -f http://localhost:8081/health 2>/dev/null; then
122
+ record_test "Playwright Health Check" "true" "Responding"
123
+ else
124
+ record_test "Playwright Health Check" "false" "Not responding or health endpoint unavailable"
125
+ fi
126
+
127
+ # Test 5: Health Check - Redis Tools
128
+ print_status "info" "Test 5: Testing Redis Tools MCP server health..."
129
+ if timeout 10 docker exec cfn-mcp-redis-tools wget --quiet --tries=1 --spider http://localhost:8082/health 2>/dev/null; then
130
+ record_test "Redis Tools Health Check" "true" "Responding"
131
+ else
132
+ record_test "Redis Tools Health Check" "false" "Not responding or health endpoint unavailable"
133
+ fi
134
+
135
+ # Test 6: Health Check - N8N
136
+ print_status "info" "Test 6: Testing N8N MCP server health..."
137
+ if timeout 15 docker exec cfn-mcp-n8n wget --quiet --tries=1 --spider http://localhost:5678/healthz 2>/dev/null; then
138
+ record_test "N8N Health Check" "true" "Responding"
139
+ else
140
+ record_test "N8N Health Check" "false" "Not responding or health endpoint unavailable"
141
+ fi
142
+
143
+ # Test 7: Health Check - Security Scanner
144
+ print_status "info" "Test 7: Testing Security Scanner MCP server health..."
145
+ if timeout 10 docker exec cfn-mcp-security-scanner wget --quiet --tries=1 --spider http://localhost:8084/health 2>/dev/null; then
146
+ record_test "Security Scanner Health Check" "true" "Responding"
147
+ else
148
+ record_test "Security Scanner Health Check" "false" "Not responding or health endpoint unavailable"
149
+ fi
150
+
151
+ # Test 8: Network Connectivity - MCP Network
152
+ print_status "info" "Test 8: Testing MCP network isolation..."
153
+ if docker network inspect mcp-isolated > /dev/null 2>&1; then
154
+ record_test "MCP Network Creation" "true" "Network exists"
155
+ else
156
+ record_test "MCP Network Creation" "false" "Network not found"
157
+ fi
158
+
159
+ # Test 9: Volume Mounts
160
+ print_status "info" "Test 9: Testing MCP configuration volume mounts..."
161
+ MOUNT_ERRORS=0
162
+ for container in cfn-mcp-playwright cfn-mcp-redis-tools cfn-mcp-n8n cfn-mcp-security-scanner; do
163
+ if docker exec "$container" test -f /app/config/mcp-servers.json 2>/dev/null; then
164
+ : # Success
165
+ else
166
+ ((MOUNT_ERRORS++))
167
+ fi
168
+ done
169
+
170
+ if [ $MOUNT_ERRORS -eq 0 ]; then
171
+ record_test "MCP Config Volume Mounts" "true" "All containers have config mounted"
172
+ else
173
+ record_test "MCP Config Volume Mounts" "false" "$MOUNT_ERRORS containers missing config"
174
+ fi
175
+
176
+ # Test 10: Redis Coordinator Connectivity
177
+ print_status "info" "Test 10: Testing Redis coordinator connectivity..."
178
+ if docker exec cfn-redis-coordinator redis-cli ping 2>/dev/null | grep -q "PONG"; then
179
+ record_test "Redis Coordinator" "true" "Responding to pings"
180
+ else
181
+ record_test "Redis Coordinator" "false" "Not responding"
182
+ fi
183
+
184
+ # Test 11: Container Resource Limits
185
+ print_status "info" "Test 11: Verifying container resource limits..."
186
+ LIMIT_ERRORS=0
187
+ for container in cfn-mcp-playwright cfn-mcp-redis-tools cfn-mcp-n8n cfn-mcp-security-scanner; do
188
+ if docker inspect "$container" --format '{{.HostConfig.Memory}}' 2>/dev/null | grep -q -v "^0$"; then
189
+ : # Memory limit set
190
+ else
191
+ ((LIMIT_ERRORS++))
192
+ fi
193
+ done
194
+
195
+ if [ $LIMIT_ERRORS -eq 0 ]; then
196
+ record_test "Container Resource Limits" "true" "All containers have memory limits"
197
+ else
198
+ record_test "Container Resource Limits" "false" "$LIMIT_ERRORS containers missing resource limits"
199
+ fi
200
+
201
+ # Test 12: MCP Server Environment Variables
202
+ print_status "info" "Test 12: Verifying MCP server environment variables..."
203
+ ENV_ERRORS=0
204
+ for container in cfn-mcp-playwright cfn-mcp-redis-tools cfn-mcp-n8n cfn-mcp-security-scanner; do
205
+ if docker exec "$container" env 2>/dev/null | grep -q "MCP_SERVER_TYPE"; then
206
+ : # Environment variable set
207
+ else
208
+ ((ENV_ERRORS++))
209
+ fi
210
+ done
211
+
212
+ if [ $ENV_ERRORS -eq 0 ]; then
213
+ record_test "MCP Environment Variables" "true" "All containers have MCP env vars"
214
+ else
215
+ record_test "MCP Environment Variables" "false" "$ENV_ERRORS containers missing MCP env vars"
216
+ fi
217
+
218
+ # Print container status
219
+ echo ""
220
+ print_status "info" "Container Status:"
221
+ docker-compose -f docker-compose.production.yml ps \
222
+ redis-coordinator mcp-playwright mcp-redis-tools mcp-n8n mcp-security-scanner
223
+
224
+ # Print container logs for debugging
225
+ echo ""
226
+ print_status "info" "Recent container logs:"
227
+ for container in cfn-mcp-playwright cfn-mcp-redis-tools cfn-mcp-n8n cfn-mcp-security-scanner; do
228
+ echo ""
229
+ echo "--- $container ---"
230
+ docker logs "$container" --tail 10 2>&1 || true
231
+ done
232
+
233
+ # Summary
234
+ echo ""
235
+ echo "========================================="
236
+ echo " Test Results Summary"
237
+ echo "========================================="
238
+ echo ""
239
+
240
+ for result in "${TEST_RESULTS[@]}"; do
241
+ if [[ $result == PASS:* ]]; then
242
+ echo -e "${GREEN}$result${NC}"
243
+ else
244
+ echo -e "${RED}$result${NC}"
245
+ fi
246
+ done
247
+
248
+ echo ""
249
+ echo "Tests Passed: $TESTS_PASSED"
250
+ echo "Tests Failed: $TESTS_FAILED"
251
+ echo "Total Tests: $((TESTS_PASSED + TESTS_FAILED))"
252
+ echo ""
253
+
254
+ if [ $TESTS_FAILED -eq 0 ]; then
255
+ print_status "success" "All tests passed!"
256
+ exit 0
257
+ else
258
+ print_status "error" "$TESTS_FAILED test(s) failed"
259
+ exit 1
260
+ fi
@@ -0,0 +1,123 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ # MCP Health Check Script
5
+ # Verifies MCP server connectivity from agent containers
6
+
7
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ CONFIG_FILE="${CONFIG_FILE:-/app/config/mcp-servers.json}"
9
+ MCP_TOKEN="${MCP_TOKEN:-}"
10
+
11
+ # Exit codes
12
+ EXIT_SUCCESS=0
13
+ EXIT_CONFIG_ERROR=1
14
+ EXIT_CONNECTION_ERROR=2
15
+ EXIT_AUTH_ERROR=3
16
+
17
+ # Check if config file exists
18
+ if [ ! -f "$CONFIG_FILE" ]; then
19
+ echo "ERROR: MCP configuration not found: $CONFIG_FILE"
20
+ exit $EXIT_CONFIG_ERROR
21
+ fi
22
+
23
+ # Parse config and test connectivity
24
+ if command -v jq &> /dev/null; then
25
+ # Extract server endpoints
26
+ SERVERS=$(jq -r '.servers | to_entries | .[] | "\(.key)=\(.value.endpoint)"' "$CONFIG_FILE" 2>/dev/null || echo "")
27
+
28
+ if [ -z "$SERVERS" ]; then
29
+ echo "ERROR: Failed to parse MCP server configuration"
30
+ exit $EXIT_CONFIG_ERROR
31
+ fi
32
+
33
+ TOTAL_SERVERS=0
34
+ HEALTHY_SERVERS=0
35
+ FAILED_SERVERS=()
36
+
37
+ while IFS= read -r server_line; do
38
+ [ -z "$server_line" ] && continue
39
+
40
+ SERVER_NAME="${server_line%%=*}"
41
+ SERVER_ENDPOINT="${server_line#*=}"
42
+ HEALTH_PATH=$(jq -r ".servers.\"$SERVER_NAME\".health_check" "$CONFIG_FILE" 2>/dev/null || echo "/health")
43
+ TIMEOUT=$(jq -r ".servers.\"$SERVER_NAME\".timeout_ms" "$CONFIG_FILE" 2>/dev/null || echo "30000")
44
+ TIMEOUT_SEC=$((TIMEOUT / 1000))
45
+
46
+ ((TOTAL_SERVERS++))
47
+
48
+ echo "Checking $SERVER_NAME ($SERVER_ENDPOINT$HEALTH_PATH)..."
49
+
50
+ # Construct health check URL
51
+ HEALTH_URL="${SERVER_ENDPOINT}${HEALTH_PATH}"
52
+
53
+ # Perform health check with timeout
54
+ if timeout "$TIMEOUT_SEC" curl -f -s \
55
+ ${MCP_TOKEN:+-H "X-MCP-Token: $MCP_TOKEN"} \
56
+ "$HEALTH_URL" > /dev/null 2>&1; then
57
+ echo " ✓ $SERVER_NAME is healthy"
58
+ ((HEALTHY_SERVERS++))
59
+ else
60
+ echo " ✗ $SERVER_NAME is unhealthy or unreachable"
61
+ FAILED_SERVERS+=("$SERVER_NAME")
62
+ fi
63
+ done <<< "$SERVERS"
64
+
65
+ # Summary
66
+ echo ""
67
+ echo "Health Check Summary:"
68
+ echo " Total Servers: $TOTAL_SERVERS"
69
+ echo " Healthy: $HEALTHY_SERVERS"
70
+ echo " Unhealthy: $((TOTAL_SERVERS - HEALTHY_SERVERS))"
71
+
72
+ if [ ${#FAILED_SERVERS[@]} -gt 0 ]; then
73
+ echo ""
74
+ echo "Failed Servers:"
75
+ for server in "${FAILED_SERVERS[@]}"; do
76
+ echo " - $server"
77
+ done
78
+ fi
79
+
80
+ # Exit based on health status
81
+ if [ "$HEALTHY_SERVERS" -eq "$TOTAL_SERVERS" ]; then
82
+ echo ""
83
+ echo "All MCP servers are healthy"
84
+ exit $EXIT_SUCCESS
85
+ elif [ "$HEALTHY_SERVERS" -gt 0 ]; then
86
+ echo ""
87
+ echo "WARNING: Some MCP servers are unhealthy"
88
+ exit $EXIT_CONNECTION_ERROR
89
+ else
90
+ echo ""
91
+ echo "ERROR: All MCP servers are unhealthy"
92
+ exit $EXIT_CONNECTION_ERROR
93
+ fi
94
+ else
95
+ # Fallback if jq is not available - basic curl test
96
+ echo "WARNING: jq not available - performing basic connectivity test"
97
+
98
+ # Test common MCP endpoints
99
+ MCP_ENDPOINTS=(
100
+ "http://mcp-playwright:8081/health"
101
+ "http://mcp-redis-tools:8082/health"
102
+ "http://mcp-n8n:5678/healthz"
103
+ "http://mcp-security-scanner:8084/health"
104
+ )
105
+
106
+ HEALTHY=0
107
+ for endpoint in "${MCP_ENDPOINTS[@]}"; do
108
+ if timeout 10 curl -f -s ${MCP_TOKEN:+-H "X-MCP-Token: $MCP_TOKEN"} "$endpoint" > /dev/null 2>&1; then
109
+ echo "✓ $endpoint"
110
+ ((HEALTHY++))
111
+ else
112
+ echo "✗ $endpoint"
113
+ fi
114
+ done
115
+
116
+ if [ "$HEALTHY" -gt 0 ]; then
117
+ echo "Some MCP servers are reachable ($HEALTHY/${#MCP_ENDPOINTS[@]})"
118
+ exit $EXIT_SUCCESS
119
+ else
120
+ echo "ERROR: No MCP servers are reachable"
121
+ exit $EXIT_CONNECTION_ERROR
122
+ fi
123
+ fi