claude-flow-novice 2.14.13 → 2.14.15
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.
- package/.claude/commands/CFN_LOOP_TASK_MODE.md +7 -51
- package/.claude/commands/cfn-loop-cli.md +50 -125
- package/.claude/skills/cfn-agent-selector/SKILL.md +2 -2
- package/.claude/skills/cfn-agent-selector/select-agents.sh +0 -45
- package/.claude/skills/cfn-loop-orchestration/helpers/context-injection.sh +6 -69
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +0 -17
- package/README.md +2 -2
- package/claude-assets/agents/cfn-dev-team/CLAUDE.md +3 -3
- package/claude-assets/agents/cfn-dev-team/README.md +1 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +2 -2
- package/claude-assets/agents/cfn-dev-team/developers/README.md +3 -3
- package/claude-assets/agents/cfn-dev-team/documentation/agent-type-guidelines.md +1 -1
- package/claude-assets/agents/cfn-dev-team/test-agent.md +2 -2
- package/claude-assets/commands/CFN_LOOP_TASK_MODE.md +7 -51
- package/claude-assets/commands/cfn-loop-cli.md +50 -125
- package/claude-assets/skills/cfn-agent-selector/SKILL.md +2 -2
- package/claude-assets/skills/cfn-agent-selector/select-agents.sh +0 -45
- package/claude-assets/skills/cfn-loop-orchestration/helpers/context-injection.sh +6 -69
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +0 -17
- package/claude-assets/skills/cfn-multi-coordinator-planning/README.md +256 -0
- package/claude-assets/skills/cfn-multi-coordinator-planning/SKILL.md +62 -0
- package/claude-assets/skills/cfn-multi-coordinator-planning/map-dependencies-conflicts.sh +376 -0
- package/claude-assets/skills/cfn-multi-coordinator-planning/plan-coordinator-resources.sh +258 -0
- package/claude-assets/skills/cfn-multi-coordinator-planning/plan-multi-coordinator-work.sh +267 -0
- package/claude-assets/skills/cfn-multi-coordinator-planning/plan-risk-rollout.sh +350 -0
- package/claude-assets/skills/cfn-multi-coordinator-planning/test-multi-coordinator-planning.sh +338 -0
- package/claude-assets/skills/cfn-multi-coordinator-planning/validate-task-planning.sh +189 -0
- package/dist/agents/agent-loader.js +165 -146
- package/dist/agents/agent-loader.js.map +1 -1
- package/package.json +1 -1
- package/.claude/skills/cfn-agent-selector/SKILL.md.backup_before_replace +0 -91
- package/.claude/skills/cfn-loop-orchestration/helpers/validate-task-context.sh +0 -241
- package/.claude/skills/pre-edit-backup/backup.sh +0 -130
- package/.claude/skills/pre-edit-backup/cleanup.sh +0 -155
- package/.claude/skills/pre-edit-backup/restore.sh +0 -128
- package/.claude/skills/pre-edit-backup/revert-file.sh +0 -168
- package/claude-assets/agents/cfn-dev-team/CLAUDE.md.backup_before_replace +0 -1086
- package/claude-assets/agents/cfn-dev-team/README.md.backup_before_replace +0 -116
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md.backup_before_replace +0 -451
- package/claude-assets/agents/cfn-dev-team/developers/README.md.backup_before_replace +0 -69
- package/claude-assets/agents/cfn-dev-team/documentation/agent-type-guidelines.md.backup_before_replace +0 -465
- package/claude-assets/agents/cfn-dev-team/test-agent.md.backup_before_replace +0 -141
- package/claude-assets/skills/CFN-LOOP-VALIDATION.md +0 -202
- package/claude-assets/skills/REDIS-COORDINATION.md +0 -187
- package/claude-assets/skills/SKILL.md +0 -229
- package/claude-assets/skills/agent-discovery/agents-registry.json +0 -484
- package/claude-assets/skills/agent-name-validation/README.md +0 -28
- package/claude-assets/skills/agent-name-validation/SKILL.md +0 -168
- package/claude-assets/skills/agent-name-validation/validate-agent-names.sh +0 -47
- package/claude-assets/skills/cfn-agent-selector/SKILL.md.backup_before_replace +0 -91
- package/claude-assets/skills/cfn-loop-orchestration/helpers/validate-task-context.sh +0 -241
- package/claude-assets/skills/consensus-calculator.js +0 -45
- package/claude-assets/skills/evidence-chain.sql +0 -66
- package/claude-assets/skills/hook-pipeline/bash-dependency-checker.sh +0 -89
- package/claude-assets/skills/hook-pipeline/bash-pipe-safety.sh +0 -69
- package/claude-assets/skills/hook-pipeline/enforce-lf.sh +0 -36
- package/claude-assets/skills/hook-pipeline/js-promise-safety.sh +0 -110
- package/claude-assets/skills/hook-pipeline/python-async-safety.py +0 -124
- package/claude-assets/skills/hook-pipeline/python-import-checker.py +0 -114
- package/claude-assets/skills/hook-pipeline/python-subprocess-safety.py +0 -77
- package/claude-assets/skills/hook-pipeline/rust-command-safety.sh +0 -38
- package/claude-assets/skills/hook-pipeline/rust-dependency-checker.sh +0 -50
- package/claude-assets/skills/hook-pipeline/rust-future-safety.sh +0 -50
- package/claude-assets/skills/pre-edit-backup/backup.sh +0 -130
- package/claude-assets/skills/pre-edit-backup/cleanup.sh +0 -155
- package/claude-assets/skills/pre-edit-backup/restore.sh +0 -128
- package/claude-assets/skills/pre-edit-backup/revert-file.sh +0 -168
- package/claude-assets/skills/run-all-skill-tests.sh +0 -124
- package/claude-assets/skills/seo-orchestration/SKILL.md +0 -292
- package/claude-assets/skills/seo-orchestration/orchestrate-seo.sh +0 -566
- package/claude-assets/skills/seo-orchestration/orchestrate-seo.sh.backup +0 -755
- package/claude-assets/skills/seo-orchestration/validate-consensus.sh +0 -270
- package/claude-assets/skills/team-provider-routing/execute-agent.sh +0 -76
- package/claude-assets/skills/test-execution-coordinator-pattern.md +0 -228
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
##############################################################################
|
|
4
|
-
# SEO Consensus Validation Script
|
|
5
|
-
# Version: 1.0.0
|
|
6
|
-
#
|
|
7
|
-
# Validates SEO consensus scores against thresholds and quorum requirements.
|
|
8
|
-
# Used to determine if SEO optimizations meet quality standards.
|
|
9
|
-
##############################################################################
|
|
10
|
-
|
|
11
|
-
set -euo pipefail
|
|
12
|
-
|
|
13
|
-
# Configuration
|
|
14
|
-
TASK_ID=""
|
|
15
|
-
AGENTS=""
|
|
16
|
-
THRESHOLD="0.80"
|
|
17
|
-
MIN_QUORUM="0.66"
|
|
18
|
-
|
|
19
|
-
# Script directory
|
|
20
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
21
|
-
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../../" && pwd)"
|
|
22
|
-
|
|
23
|
-
# Logging
|
|
24
|
-
log() {
|
|
25
|
-
echo "[$(date '+%Y-%m-%d %H:%M:%S')] SEO-VALIDATE-CONSENSUS: $*" >&2
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
error() {
|
|
29
|
-
echo "[$(date '+%Y-%m-%d %H:%M:%S')] SEO-VALIDATE-CONSENSUS ERROR: $*" >&2
|
|
30
|
-
exit 1
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
# Display usage
|
|
34
|
-
usage() {
|
|
35
|
-
cat << EOF
|
|
36
|
-
SEO Consensus Validation
|
|
37
|
-
|
|
38
|
-
Usage: $0 [OPTIONS]
|
|
39
|
-
|
|
40
|
-
Required Options:
|
|
41
|
-
--task-id <id> Unique identifier for SEO task
|
|
42
|
-
--agents <agents> Comma-separated list of SEO agent IDs
|
|
43
|
-
--threshold <value> Minimum confidence threshold (0.0-1.0)
|
|
44
|
-
--min-quorum <value> Minimum quorum (n, n%, or 0.n format)
|
|
45
|
-
|
|
46
|
-
Optional Options:
|
|
47
|
-
--help Show this help message
|
|
48
|
-
|
|
49
|
-
Examples:
|
|
50
|
-
$0 --task-id seo-001 --agents seo-analyst,content-writer --threshold 0.75 --min-quorum 0.66
|
|
51
|
-
|
|
52
|
-
EOF
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
# Parse command line arguments
|
|
56
|
-
parse_args() {
|
|
57
|
-
while [[ $# -gt 0 ]]; do
|
|
58
|
-
case $1 in
|
|
59
|
-
--task-id)
|
|
60
|
-
TASK_ID="$2"
|
|
61
|
-
shift 2
|
|
62
|
-
;;
|
|
63
|
-
--agents)
|
|
64
|
-
AGENTS="$2"
|
|
65
|
-
shift 2
|
|
66
|
-
;;
|
|
67
|
-
--threshold)
|
|
68
|
-
THRESHOLD="$2"
|
|
69
|
-
shift 2
|
|
70
|
-
;;
|
|
71
|
-
--min-quorum)
|
|
72
|
-
MIN_QUORUM="$2"
|
|
73
|
-
shift 2
|
|
74
|
-
;;
|
|
75
|
-
--help)
|
|
76
|
-
usage
|
|
77
|
-
exit 0
|
|
78
|
-
;;
|
|
79
|
-
*)
|
|
80
|
-
error "Unknown option: $1. Use --help for usage information."
|
|
81
|
-
;;
|
|
82
|
-
esac
|
|
83
|
-
done
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
# Validate inputs
|
|
87
|
-
validate_inputs() {
|
|
88
|
-
[[ -z "$TASK_ID" ]] && error "Task ID is required"
|
|
89
|
-
[[ -z "$AGENTS" ]] && error "Agents list is required"
|
|
90
|
-
[[ -z "$THRESHOLD" ]] && error "Threshold is required"
|
|
91
|
-
[[ -z "$MIN_QUORUM" ]] && error "Min quorum is required"
|
|
92
|
-
|
|
93
|
-
# Validate threshold
|
|
94
|
-
if ! [[ "$THRESHOLD" =~ ^[0-9]*\.?[0-9]+$ ]]; then
|
|
95
|
-
error "Threshold must be a numeric value between 0.0 and 1.0"
|
|
96
|
-
fi
|
|
97
|
-
|
|
98
|
-
local threshold_float
|
|
99
|
-
threshold_float=$(echo "$THRESHOLD" | bc -l 2>/dev/null || echo "0")
|
|
100
|
-
if [[ $(echo "$threshold_float < 0 || $threshold_float > 1" | bc -l) -eq 1 ]]; then
|
|
101
|
-
error "Threshold must be between 0.0 and 1.0"
|
|
102
|
-
fi
|
|
103
|
-
|
|
104
|
-
# Check Redis connectivity
|
|
105
|
-
if ! command -v redis-cli &> /dev/null; then
|
|
106
|
-
error "redis-cli is required but not installed"
|
|
107
|
-
fi
|
|
108
|
-
|
|
109
|
-
if ! redis-cli ping &> /dev/null; then
|
|
110
|
-
error "Cannot connect to Redis server"
|
|
111
|
-
fi
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
# Calculate quorum requirement
|
|
115
|
-
calculate_quorum_requirement() {
|
|
116
|
-
local total_agents=$1
|
|
117
|
-
local min_quorum_spec="$2"
|
|
118
|
-
|
|
119
|
-
# Parse quorum specification
|
|
120
|
-
if [[ "$min_quorum_spec" =~ ^[0-9]+$ ]]; then
|
|
121
|
-
# Absolute number
|
|
122
|
-
echo "$min_quorum_spec"
|
|
123
|
-
elif [[ "$min_quorum_spec" =~ ^([0-9]+)%$ ]]; then
|
|
124
|
-
# Percentage
|
|
125
|
-
local percentage="${BASH_REMATCH[1]}"
|
|
126
|
-
local required
|
|
127
|
-
required=$(echo "scale=0; ($total_agents * $percentage) / 100" | bc -l)
|
|
128
|
-
echo "$required"
|
|
129
|
-
elif [[ "$min_quorum_spec" =~ ^0\.[0-9]+$ ]]; then
|
|
130
|
-
# Fraction
|
|
131
|
-
local required
|
|
132
|
-
required=$(echo "scale=0; $total_agents * $min_quorum_spec" | bc -l)
|
|
133
|
-
echo "$required"
|
|
134
|
-
else
|
|
135
|
-
error "Invalid quorum specification: $min_quorum_spec"
|
|
136
|
-
fi
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
# Collect agent confidence scores
|
|
140
|
-
collect_agent_scores() {
|
|
141
|
-
local agents_array
|
|
142
|
-
IFS=',' read -ra agents_array <<< "$AGENTS"
|
|
143
|
-
|
|
144
|
-
local scores=()
|
|
145
|
-
local completed_agents=()
|
|
146
|
-
|
|
147
|
-
log "Collecting confidence scores from agents"
|
|
148
|
-
|
|
149
|
-
for agent_id in "${agents_array[@]}"; do
|
|
150
|
-
agent_id=$(echo "$agent_id" | xargs) # trim whitespace
|
|
151
|
-
|
|
152
|
-
# Get confidence score from Redis
|
|
153
|
-
local confidence_key="swarm:${TASK_ID}:${agent_id}:confidence"
|
|
154
|
-
local confidence_score
|
|
155
|
-
confidence_score=$(redis-cli get "$confidence_key" 2>/dev/null || echo "")
|
|
156
|
-
|
|
157
|
-
if [[ -n "$confidence_score" ]] && [[ "$confidence_score" =~ ^[0-9]*\.?[0-9]+$ ]]; then
|
|
158
|
-
scores+=("$confidence_score")
|
|
159
|
-
completed_agents+=("$agent_id")
|
|
160
|
-
log "Agent $agent_id confidence: $confidence_score"
|
|
161
|
-
else
|
|
162
|
-
log "Warning: No confidence score found for agent $agent_id"
|
|
163
|
-
fi
|
|
164
|
-
done
|
|
165
|
-
|
|
166
|
-
# Store results in Redis for debugging
|
|
167
|
-
printf '%s\n' "${completed_agents[@]}" | redis-cli -x set "swarm:${TASK_ID}:validated-agents" > /dev/null 2>&1 || true
|
|
168
|
-
printf '%s\n' "${scores[@]}" | redis-cli -x set "swarm:${TASK_ID}:confidence-scores" > /dev/null 2>&1 || true
|
|
169
|
-
|
|
170
|
-
# Return scores array
|
|
171
|
-
printf '%s\n' "${scores[@]}"
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
# Validate consensus
|
|
175
|
-
validate_consensus() {
|
|
176
|
-
local scores=("$@")
|
|
177
|
-
|
|
178
|
-
if [[ ${#scores[@]} -eq 0 ]]; then
|
|
179
|
-
error "No confidence scores available for validation"
|
|
180
|
-
fi
|
|
181
|
-
|
|
182
|
-
# Calculate required quorum
|
|
183
|
-
local total_agents
|
|
184
|
-
total_agents=$(echo "$AGENTS" | tr ',' '\n' | wc -l)
|
|
185
|
-
local required_quorum
|
|
186
|
-
required_quorum=$(calculate_quorum_requirement "$total_agents" "$MIN_QUORUM")
|
|
187
|
-
|
|
188
|
-
log "Total agents: $total_agents, Required quorum: $required_quorum"
|
|
189
|
-
log "Available scores: ${#scores[@]}"
|
|
190
|
-
|
|
191
|
-
# Check quorum requirement
|
|
192
|
-
if [[ ${#scores[@]} -lt $required_quorum ]]; then
|
|
193
|
-
log "Consensus validation failed: Insufficient agent responses (${#scores[@]} < $required_quorum)"
|
|
194
|
-
return 1
|
|
195
|
-
fi
|
|
196
|
-
|
|
197
|
-
# Calculate average confidence
|
|
198
|
-
local sum=0.0
|
|
199
|
-
local count=0
|
|
200
|
-
|
|
201
|
-
for score in "${scores[@]}"; do
|
|
202
|
-
sum=$(echo "$sum + $score" | bc -l)
|
|
203
|
-
((count++))
|
|
204
|
-
done
|
|
205
|
-
|
|
206
|
-
local average_confidence
|
|
207
|
-
average_confidence=$(echo "scale=3; $sum / $count" | bc -l)
|
|
208
|
-
|
|
209
|
-
log "Average confidence: $average_confidence, Threshold: $THRESHOLD"
|
|
210
|
-
|
|
211
|
-
# Compare against threshold
|
|
212
|
-
local comparison
|
|
213
|
-
comparison=$(echo "$average_confidence >= $THRESHOLD" | bc -l 2>/dev/null || echo "0")
|
|
214
|
-
|
|
215
|
-
# Store validation results
|
|
216
|
-
local validation_result
|
|
217
|
-
validation_result=$(cat << EOF
|
|
218
|
-
{
|
|
219
|
-
"task_id": "$TASK_ID",
|
|
220
|
-
"timestamp": "$(date -Iseconds)",
|
|
221
|
-
"total_agents": $total_agents,
|
|
222
|
-
"completed_agents": $count,
|
|
223
|
-
"required_quorum": $required_quorum,
|
|
224
|
-
"quorum_met": $([[ $count -ge $required_quorum ]] && echo "true" || echo "false"),
|
|
225
|
-
"confidence_scores": [$(IFS=','; echo "${scores[*]}")],
|
|
226
|
-
"average_confidence": $average_confidence,
|
|
227
|
-
"threshold": $THRESHOLD,
|
|
228
|
-
"threshold_met": $([[ $comparison -eq 1 ]] && echo "true" || echo "false"),
|
|
229
|
-
"consensus_validated": $([[ $comparison -eq 1 ]] && echo "true" || echo "false")
|
|
230
|
-
}
|
|
231
|
-
EOF
|
|
232
|
-
)
|
|
233
|
-
|
|
234
|
-
echo "$validation_result" | redis-cli -x set "swarm:${TASK_ID}:consensus-validation" > /dev/null
|
|
235
|
-
log "Validation result stored: $validation_result"
|
|
236
|
-
|
|
237
|
-
if [[ $comparison -eq 1 ]]; then
|
|
238
|
-
log "SEO consensus validation PASSED (average: $average_confidence >= threshold: $THRESHOLD)"
|
|
239
|
-
return 0
|
|
240
|
-
else
|
|
241
|
-
log "SEO consensus validation FAILED (average: $average_confidence < threshold: $THRESHOLD)"
|
|
242
|
-
return 1
|
|
243
|
-
fi
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
# Main function
|
|
247
|
-
main() {
|
|
248
|
-
parse_args "$@"
|
|
249
|
-
validate_inputs
|
|
250
|
-
|
|
251
|
-
log "Starting SEO consensus validation for task: $TASK_ID"
|
|
252
|
-
|
|
253
|
-
# Collect agent scores
|
|
254
|
-
local scores_array
|
|
255
|
-
readarray -t scores_array < <(collect_agent_scores)
|
|
256
|
-
|
|
257
|
-
# Validate consensus
|
|
258
|
-
if validate_consensus "${scores_array[@]}"; then
|
|
259
|
-
log "SEO consensus validation completed successfully"
|
|
260
|
-
exit 0
|
|
261
|
-
else
|
|
262
|
-
log "SEO consensus validation failed"
|
|
263
|
-
exit 1
|
|
264
|
-
fi
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
# Script entry point
|
|
268
|
-
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
|
269
|
-
main "$@"
|
|
270
|
-
fi
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
# Load team providers configuration
|
|
5
|
-
PROVIDERS_CONFIG="/mnt/c/Users/masha/Documents/claude-flow-novice/planning/team-providers.json"
|
|
6
|
-
|
|
7
|
-
# Function to validate provider configurations
|
|
8
|
-
validate_provider_config() {
|
|
9
|
-
local team="$1"
|
|
10
|
-
local role="$2" # coordinator or workers
|
|
11
|
-
|
|
12
|
-
# Validate JSON configuration
|
|
13
|
-
if ! jq -e ".teams.${team}.${role}" "$PROVIDERS_CONFIG" &>/dev/null; then
|
|
14
|
-
echo "Error: Invalid configuration for team=${team}, role=${role}"
|
|
15
|
-
return 1
|
|
16
|
-
fi
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
# Function to determine agent routing
|
|
20
|
-
route_agent() {
|
|
21
|
-
local team="$1"
|
|
22
|
-
local agent_type="$2" # coordinator or worker
|
|
23
|
-
local complexity="${3:-simple}"
|
|
24
|
-
|
|
25
|
-
# Validate configuration
|
|
26
|
-
if ! validate_provider_config "$team" "$agent_type"; then
|
|
27
|
-
echo "Provider configuration validation failed"
|
|
28
|
-
return 1
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
# Select provider based on configuration
|
|
32
|
-
local provider=$(jq -r ".teams.${team}.${agent_type}.provider" "$PROVIDERS_CONFIG")
|
|
33
|
-
local model=$(jq -r ".teams.${team}.${agent_type}.model" "$PROVIDERS_CONFIG")
|
|
34
|
-
|
|
35
|
-
# Routing logic
|
|
36
|
-
case "$provider" in
|
|
37
|
-
anthropic)
|
|
38
|
-
echo "Routing ${agent_type} for ${team} to Claude (${model})"
|
|
39
|
-
# Claude routing logic: Use ${model} for agent routing
|
|
40
|
-
;;
|
|
41
|
-
zai)
|
|
42
|
-
echo "Routing ${agent_type} for ${team} to Z.ai (${model})"
|
|
43
|
-
# Z.ai routing logic
|
|
44
|
-
;;
|
|
45
|
-
*)
|
|
46
|
-
echo "Unsupported provider: ${provider}"
|
|
47
|
-
return 1
|
|
48
|
-
;;
|
|
49
|
-
esac
|
|
50
|
-
|
|
51
|
-
# Enhanced logging and context injection
|
|
52
|
-
echo "Agent Routing Details:"
|
|
53
|
-
echo " Team: ${team}"
|
|
54
|
-
echo " Type: ${agent_type}"
|
|
55
|
-
echo " Provider: ${provider}"
|
|
56
|
-
echo " Model: ${model}"
|
|
57
|
-
echo " Complexity: ${complexity}"
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
# Main execution
|
|
61
|
-
main() {
|
|
62
|
-
if [[ $# -lt 2 ]]; then
|
|
63
|
-
echo "Usage: $0 <team> <agent_type> [complexity]"
|
|
64
|
-
exit 1
|
|
65
|
-
fi
|
|
66
|
-
|
|
67
|
-
local team="$1"
|
|
68
|
-
local agent_type="$2"
|
|
69
|
-
local complexity="${3:-simple}"
|
|
70
|
-
|
|
71
|
-
# Call routing function
|
|
72
|
-
route_agent "$team" "$agent_type" "$complexity"
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
# Execute main function
|
|
76
|
-
main "$@"
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
skill: test-execution-coordinator-pattern
|
|
3
|
-
name: Test Execution Coordination
|
|
4
|
-
description: Centralized test execution pattern for distributed agent workflows
|
|
5
|
-
version: 1.0.0
|
|
6
|
-
category: coordination
|
|
7
|
-
allowed-tools:
|
|
8
|
-
- Bash
|
|
9
|
-
- Read
|
|
10
|
-
- Grep
|
|
11
|
-
complexity: moderate
|
|
12
|
-
dependencies:
|
|
13
|
-
- redis-cli
|
|
14
|
-
- npm
|
|
15
|
-
- bash
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
# Test Execution Coordinator Pattern
|
|
19
|
-
|
|
20
|
-
## Overview
|
|
21
|
-
|
|
22
|
-
The Test Execution Coordinator Pattern provides a robust, centralized mechanism for managing test execution in distributed agent workflows. By implementing a single-source test run approach, this pattern ensures:
|
|
23
|
-
|
|
24
|
-
- Consistent test execution
|
|
25
|
-
- Prevention of concurrent test runs
|
|
26
|
-
- Efficient result caching and distribution
|
|
27
|
-
- Minimal resource consumption
|
|
28
|
-
|
|
29
|
-
## Coordinator Pattern
|
|
30
|
-
|
|
31
|
-
### Core Principles
|
|
32
|
-
|
|
33
|
-
1. **Single Source of Truth**: Coordinator runs tests ONCE
|
|
34
|
-
2. **Cache-Based Distribution**: Workers read cached test results
|
|
35
|
-
3. **Minimal Overhead**: Prevent redundant test executions
|
|
36
|
-
4. **Atomic Test Management**: Terminate previous runs before new execution
|
|
37
|
-
|
|
38
|
-
### Execution Architecture
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
Coordinator (Test Runner)
|
|
42
|
-
│
|
|
43
|
-
├─ Terminate Existing Tests
|
|
44
|
-
├─ Execute Test Suite
|
|
45
|
-
├─ Cache Test Results
|
|
46
|
-
│
|
|
47
|
-
└─> Workers (Result Consumers)
|
|
48
|
-
├─ Read Cached Results
|
|
49
|
-
├─ Proceed/Halt Based on Results
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Execution Steps
|
|
53
|
-
|
|
54
|
-
### 1. Terminate Existing Test Processes
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
# Forcefully terminate any running test processes
|
|
58
|
-
pkill -f vitest
|
|
59
|
-
pkill -f "npm test"
|
|
60
|
-
pkill -f jest
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### 2. Run Tests (Coordinator-Only)
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
# Execute test suite with comprehensive reporting
|
|
67
|
-
npm test -- \
|
|
68
|
-
--run \
|
|
69
|
-
--reporter=json \
|
|
70
|
-
--coverage \
|
|
71
|
-
> test-results.json 2>&1
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### 3. Workers Read Test Results
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
# Worker-side test result parsing
|
|
78
|
-
test_status=$(jq '.success' test-results.json)
|
|
79
|
-
test_coverage=$(jq '.coverage.lines.pct' test-results.json)
|
|
80
|
-
|
|
81
|
-
if [[ "$test_status" == "true" && "$test_coverage" -ge 80 ]]; then
|
|
82
|
-
# Proceed with next workflow stage
|
|
83
|
-
echo "Tests passed. Continuing workflow."
|
|
84
|
-
else
|
|
85
|
-
# Signal test failure
|
|
86
|
-
redis-cli lpush "swarm:test:failures" "$test_status"
|
|
87
|
-
exit 1
|
|
88
|
-
fi
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### 4. Post-Test Cleanup
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
# Clean up test artifacts and reset environment
|
|
95
|
-
rm test-results.json
|
|
96
|
-
pkill -f vitest
|
|
97
|
-
pkill -f "npm test"
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Redis Coordination
|
|
101
|
-
|
|
102
|
-
### Test Completion Signaling
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
# Coordinator signals test completion
|
|
106
|
-
redis-cli publish "swarm:test:status" '{"status":"complete","timestamp":1697644800}'
|
|
107
|
-
|
|
108
|
-
# Workers subscribe to test status
|
|
109
|
-
redis-cli subscribe "swarm:test:status"
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## Anti-Patterns to Avoid
|
|
113
|
-
|
|
114
|
-
1. **Multiple Concurrent Test Runs**
|
|
115
|
-
- Never allow workers to independently run tests
|
|
116
|
-
- Do NOT use parallel test execution
|
|
117
|
-
|
|
118
|
-
2. **Stateless Test Execution**
|
|
119
|
-
- Always cache test results
|
|
120
|
-
- Ensure deterministic test environment
|
|
121
|
-
|
|
122
|
-
3. **Unconstrained Test Processes**
|
|
123
|
-
- Always terminate previous test runs
|
|
124
|
-
- Use strict process management
|
|
125
|
-
|
|
126
|
-
## Script Templates
|
|
127
|
-
|
|
128
|
-
### test-coordinator-pattern.sh
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
#!/bin/bash
|
|
132
|
-
# Centralized Test Coordination Script
|
|
133
|
-
|
|
134
|
-
COORDINATOR_ID=$(uuidgen)
|
|
135
|
-
TEST_RESULTS_FILE="test-results.json"
|
|
136
|
-
|
|
137
|
-
function terminate_tests() {
|
|
138
|
-
pkill -f vitest
|
|
139
|
-
pkill -f "npm test"
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function run_tests() {
|
|
143
|
-
npm test -- \
|
|
144
|
-
--run \
|
|
145
|
-
--reporter=json \
|
|
146
|
-
--coverage > "$TEST_RESULTS_FILE" 2>&1
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function signal_completion() {
|
|
150
|
-
redis-cli publish "swarm:test:status" "{
|
|
151
|
-
\"coordinator_id\": \"$COORDINATOR_ID\",
|
|
152
|
-
\"status\": \"complete\",
|
|
153
|
-
\"timestamp\": $(date +%s)
|
|
154
|
-
}"
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
main() {
|
|
158
|
-
terminate_tests
|
|
159
|
-
run_tests
|
|
160
|
-
signal_completion
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
main
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### test-cache-reader.sh
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
#!/bin/bash
|
|
170
|
-
# Worker-Side Test Result Consumer
|
|
171
|
-
|
|
172
|
-
function parse_test_results() {
|
|
173
|
-
local test_status=$(jq -r '.success' test-results.json)
|
|
174
|
-
local test_coverage=$(jq -r '.coverage.lines.pct' test-results.json)
|
|
175
|
-
|
|
176
|
-
if [[ "$test_status" == "true" && "$test_coverage" -ge 80 ]]; then
|
|
177
|
-
echo "Proceeding with workflow"
|
|
178
|
-
exit 0
|
|
179
|
-
else
|
|
180
|
-
echo "Test requirements not met"
|
|
181
|
-
exit 1
|
|
182
|
-
fi
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
parse_test_results
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
## Confidence Scoring
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
# Confidence calculation pseudo-code
|
|
192
|
-
confidence_score=$(
|
|
193
|
-
awk 'BEGIN {
|
|
194
|
-
test_isolation = 0.4 # Prevent concurrent tests
|
|
195
|
-
result_caching = 0.3 # Efficient result distribution
|
|
196
|
-
cleanup_rigor = 0.2 # Process management
|
|
197
|
-
signaling_mechanism = 0.1 # Redis coordination
|
|
198
|
-
|
|
199
|
-
print test_isolation + result_caching + cleanup_rigor + signaling_mechanism
|
|
200
|
-
}'
|
|
201
|
-
)
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
## Performance Metrics
|
|
205
|
-
|
|
206
|
-
- **Execution Time**: <500ms
|
|
207
|
-
- **Memory Footprint**: <50MB
|
|
208
|
-
- **Test Reliability**: >95%
|
|
209
|
-
|
|
210
|
-
## Logging & Monitoring
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
# Log test coordination events
|
|
214
|
-
logger -t test-coordinator "Test execution started: $COORDINATOR_ID"
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
## Security Considerations
|
|
218
|
-
|
|
219
|
-
- Restrict test execution to authorized coordinators
|
|
220
|
-
- Implement read-only access for workers
|
|
221
|
-
- Use ephemeral test result files
|
|
222
|
-
|
|
223
|
-
## Integration Hooks
|
|
224
|
-
|
|
225
|
-
```bash
|
|
226
|
-
# Post-test validation hook
|
|
227
|
-
node config/hooks/post-test-validation.js "$TEST_RESULTS_FILE"
|
|
228
|
-
```
|