claude-flow-novice 2.14.18 → 2.14.20

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 (48) hide show
  1. package/.claude/commands/CFN_EXPERT_UPDATE.md +142 -0
  2. package/.claude/commands/CFN_LOOP_TASK_MODE.md +6 -6
  3. package/.claude/commands/cfn-docker/CFN_DOCKER_CLI.md +527 -0
  4. package/.claude/commands/cfn-docker/CFN_DOCKER_LOOP.md +377 -0
  5. package/.claude/commands/cfn-docker/CFN_DOCKER_TASK.md +490 -0
  6. package/.claude/commands/cfn-loop-cli.md +279 -69
  7. package/.claude/commands/deprecated/README.md +55 -0
  8. package/.claude/root-claude-distribute/CFN-CLAUDE.md +115 -42
  9. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +66 -11
  10. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.backup +884 -0
  11. package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +326 -0
  12. package/claude-assets/agents/cfn-seo-team/technical-seo-specialist.md +9 -6
  13. package/claude-assets/agents/docker-coordinators/cfn-docker-v3-coordinator.md +199 -0
  14. package/claude-assets/commands/CFN_EXPERT_UPDATE.md +142 -0
  15. package/claude-assets/commands/CFN_LOOP_TASK_MODE.md +6 -6
  16. package/claude-assets/commands/cfn-docker/CFN_DOCKER_CLI.md +527 -0
  17. package/claude-assets/commands/cfn-docker/CFN_DOCKER_LOOP.md +377 -0
  18. package/claude-assets/commands/cfn-docker/CFN_DOCKER_TASK.md +490 -0
  19. package/claude-assets/commands/cfn-loop-cli.md +279 -69
  20. package/claude-assets/commands/deprecated/README.md +55 -0
  21. package/claude-assets/root-claude-distribute/CFN-CLAUDE.md +115 -42
  22. package/claude-assets/skills/cfn-docker-agent-spawning/SKILL.md +394 -0
  23. package/claude-assets/skills/cfn-docker-agent-spawning/spawn-agent.sh +461 -0
  24. package/claude-assets/skills/cfn-docker-loop-orchestration/SKILL.md +449 -0
  25. package/claude-assets/skills/cfn-docker-loop-orchestration/orchestrate.sh +787 -0
  26. package/claude-assets/skills/cfn-docker-redis-coordination/SKILL.md +435 -0
  27. package/claude-assets/skills/cfn-docker-redis-coordination/coordinate.sh +635 -0
  28. package/claude-assets/skills/cfn-docker-skill-mcp-selection/SKILL.md +289 -0
  29. package/claude-assets/skills/cfn-docker-skill-mcp-selection/skill-mcp-selector.js +472 -0
  30. package/claude-assets/skills/cfn-expert-update/update-expert.sh +346 -0
  31. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +66 -11
  32. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.backup +884 -0
  33. package/dist/cli/config-manager.js +91 -109
  34. package/dist/cli/config-manager.js.map +1 -1
  35. package/package.json +1 -1
  36. package/scripts/build-agent-image.sh +53 -0
  37. package/.claude/commands/CFN_LOOP_TASK_MODE copy.md +0 -495
  38. package/claude-assets/commands/CFN_LOOP_TASK_MODE copy.md +0 -495
  39. /package/.claude/commands/{cfn-loop-epic.md → deprecated/cfn-loop-epic.md} +0 -0
  40. /package/.claude/commands/{cfn-loop-single.md → deprecated/cfn-loop-single.md} +0 -0
  41. /package/.claude/commands/{cfn-loop-sprints.md → deprecated/cfn-loop-sprints.md} +0 -0
  42. /package/.claude/commands/{cfn-loop.md → deprecated/cfn-loop.md} +0 -0
  43. /package/.claude/commands/{cfn/run-tests.md → run-tests.md} +0 -0
  44. /package/claude-assets/commands/{cfn-loop-epic.md → deprecated/cfn-loop-epic.md} +0 -0
  45. /package/claude-assets/commands/{cfn-loop-single.md → deprecated/cfn-loop-single.md} +0 -0
  46. /package/claude-assets/commands/{cfn-loop-sprints.md → deprecated/cfn-loop-sprints.md} +0 -0
  47. /package/claude-assets/commands/{cfn-loop.md → deprecated/cfn-loop.md} +0 -0
  48. /package/claude-assets/commands/{cfn/run-tests.md → run-tests.md} +0 -0
@@ -0,0 +1,346 @@
1
+ #!/bin/bash
2
+
3
+ # CFN Expert Update Skill
4
+ # Updates CFN system expert agent with relevant git commits
5
+
6
+ set -euo pipefail
7
+
8
+ # Configuration
9
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
11
+ AGENT_FILE="$PROJECT_ROOT/.claude/agents/custom/cfn-system-expert.md"
12
+ STATE_FILE="$PROJECT_ROOT/.claude/state/cfn-expert-last-commit"
13
+ BACKUP_DIR="$PROJECT_ROOT/.claude/backups/cfn-expert"
14
+
15
+ # Ensure directories exist
16
+ mkdir -p "$(dirname "$STATE_FILE")"
17
+ mkdir -p "$BACKUP_DIR"
18
+
19
+ # Parse arguments
20
+ DRY_RUN=false
21
+ FORCE=false
22
+ SINCE_COMMIT=""
23
+
24
+ while [[ $# -gt 0 ]]; do
25
+ case $1 in
26
+ --dry-run)
27
+ DRY_RUN=true
28
+ shift
29
+ ;;
30
+ --force)
31
+ FORCE=true
32
+ shift
33
+ ;;
34
+ --since=*)
35
+ SINCE_COMMIT="${1#*=}"
36
+ shift
37
+ ;;
38
+ *)
39
+ echo "❌ Unknown parameter: $1"
40
+ echo "Usage: $0 [--dry-run] [--force] [--since=commit_hash]"
41
+ exit 1
42
+ ;;
43
+ esac
44
+ done
45
+
46
+ # Colors for output
47
+ RED='\033[0;31m'
48
+ GREEN='\033[0;32m'
49
+ YELLOW='\033[1;33m'
50
+ BLUE='\033[0;34m'
51
+ NC='\033[0m' # No Color
52
+
53
+ # Logging functions
54
+ log_info() { echo -e "${BLUE}ℹ️ $1${NC}"; }
55
+ log_success() { echo -e "${GREEN}✅ $1${NC}"; }
56
+ log_warning() { echo -e "${YELLOW}⚠️ $1${NC}"; }
57
+ log_error() { echo -e "${RED}❌ $1${NC}"; }
58
+
59
+ # Get last scanned commit
60
+ get_last_commit() {
61
+ if [[ -n "$SINCE_COMMIT" ]]; then
62
+ echo "$SINCE_COMMIT"
63
+ elif [[ -f "$STATE_FILE" ]] && ! $FORCE; then
64
+ head -n1 "$STATE_FILE"
65
+ else
66
+ # Default to 10 commits back if no tracking
67
+ git log --format="%H" -n 10 | tail -n1
68
+ fi
69
+ }
70
+
71
+ # Update last commit tracking
72
+ update_last_commit() {
73
+ local commit_hash="$1"
74
+ local timestamp="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
75
+ echo "$commit_hash" > "$STATE_FILE"
76
+ echo "$timestamp" >> "$STATE_FILE"
77
+ log_success "📝 Last commit updated: $commit_hash"
78
+ }
79
+
80
+ # Create backup of agent file
81
+ create_backup() {
82
+ if [[ -f "$AGENT_FILE" ]]; then
83
+ local timestamp=$(date +%Y%m%d_%H%M%S)
84
+ local backup_file="$BACKUP_DIR/${timestamp}_cfn-system-expert.md"
85
+ cp "$AGENT_FILE" "$backup_file"
86
+ log_success "📁 Backup created: $backup_file"
87
+ echo "$backup_file"
88
+ fi
89
+ }
90
+
91
+ # Check if commit is relevant to CFN system
92
+ is_relevant_commit() {
93
+ local commit_hash="$1"
94
+ local commit_files
95
+ local commit_msg
96
+
97
+ # Get commit message and files
98
+ commit_msg=$(git log --format="%s" -n 1 "$commit_hash")
99
+ commit_files=$(git show --name-only --format="" "$commit_hash" | tr '\n' ' ')
100
+
101
+ # High relevance patterns
102
+ local high_patterns=(
103
+ "CLAUDE\.md"
104
+ "\.claude/commands/cfn/"
105
+ "cfn-loop"
106
+ "CFN Loop"
107
+ "claude-flow-novice"
108
+ )
109
+
110
+ # Medium relevance patterns
111
+ local medium_patterns=(
112
+ "\.claude/skills/cfn-"
113
+ "agent.*coordination"
114
+ "redis.*coordination"
115
+ "cost.*optimization"
116
+ "adaptive.*context"
117
+ "consensus"
118
+ "swarm"
119
+ )
120
+
121
+ # Low relevance patterns
122
+ local low_patterns=(
123
+ "\.claude/agents/cfn-"
124
+ "performance"
125
+ "optimization"
126
+ "debugging"
127
+ "troubleshooting"
128
+ )
129
+
130
+ # Check relevance
131
+ local relevance=0
132
+ local combined_check="$commit_msg $commit_files"
133
+
134
+ # High priority (always relevant)
135
+ for pattern in "${high_patterns[@]}"; do
136
+ if echo "$combined_check" | grep -qE "$pattern"; then
137
+ echo "high"
138
+ return
139
+ fi
140
+ done
141
+
142
+ # Medium priority
143
+ for pattern in "${medium_patterns[@]}"; do
144
+ if echo "$combined_check" | grep -qE "$pattern"; then
145
+ echo "medium"
146
+ return
147
+ fi
148
+ done
149
+
150
+ # Low priority
151
+ for pattern in "${low_patterns[@]}"; do
152
+ if echo "$combined_check" | grep -qE "$pattern"; then
153
+ echo "low"
154
+ return
155
+ fi
156
+ done
157
+
158
+ echo "none"
159
+ }
160
+
161
+ # Extract knowledge from commit
162
+ extract_commit_knowledge() {
163
+ local commit_hash="$1"
164
+ local relevance="$2"
165
+ local commit_msg
166
+ local commit_diff
167
+ local knowledge=""
168
+
169
+ commit_msg=$(git log --format="%s%n%b" -n 1 "$commit_hash")
170
+ commit_diff=$(git show "$commit_hash" -- . | head -200)
171
+
172
+ case "$relevance" in
173
+ "high")
174
+ knowledge="# HIGH PRIORITY UPDATE
175
+ Commit: $commit_hash
176
+ Message: $commit_msg
177
+
178
+ ## System Changes
179
+ $commit_diff
180
+
181
+ ## Impact
182
+ This commit contains critical system updates that affect CFN Loop methodology, commands, or core rules.
183
+ "
184
+ ;;
185
+ "medium")
186
+ knowledge="# MEDIUM PRIORITY UPDATE
187
+ Commit: $commit_hash
188
+ Message: $commit_msg
189
+
190
+ ## Process Changes
191
+ $commit_diff
192
+
193
+ ## Impact
194
+ This commit updates coordination patterns, skills, or cost optimization strategies.
195
+ "
196
+ ;;
197
+ "low")
198
+ knowledge="# LOW PRIORITY UPDATE
199
+ Commit: $commit_hash
200
+ Message: $commit_msg
201
+
202
+ ## Informational Changes
203
+ $commit_diff
204
+
205
+ ## Impact
206
+ This commit contains improvements or additions that may be useful for reference.
207
+ "
208
+ ;;
209
+ esac
210
+
211
+ echo "$knowledge"
212
+ }
213
+
214
+ # Update agent with new knowledge
215
+ update_agent() {
216
+ local new_knowledge="$1"
217
+ local backup_file="$2"
218
+
219
+ if [[ "$DRY_RUN" == "true" ]]; then
220
+ log_info "🔍 DRY RUN: Would update agent with new knowledge"
221
+ echo "$new_knowledge" | head -20
222
+ log_info "🔍 ... (truncated in dry run)"
223
+ return
224
+ fi
225
+
226
+ # Create backup if not already created
227
+ if [[ -z "$backup_file" ]]; then
228
+ backup_file=$(create_backup)
229
+ fi
230
+
231
+ # Find insertion point (before "---" at end of file)
232
+ local temp_file=$(mktemp)
233
+ local inserted=false
234
+
235
+ while IFS= read -r line; do
236
+ echo "$line" >> "$temp_file"
237
+
238
+ # Insert new knowledge before the closing ---
239
+ if [[ "$line" == "---" ]] && [[ "$inserted" == "false" ]]; then
240
+ echo "" >> "$temp_file"
241
+ echo "$new_knowledge" >> "$temp_file"
242
+ echo "" >> "$temp_file"
243
+ inserted=true
244
+ fi
245
+ done < "$AGENT_FILE"
246
+
247
+ # Move temp file to agent location
248
+ mv "$temp_file" "$AGENT_FILE"
249
+ log_success "🔄 Expert agent updated successfully"
250
+ }
251
+
252
+ # Main execution
253
+ main() {
254
+ log_info "🚀 Starting CFN expert update..."
255
+
256
+ # Validate we're in a git repo
257
+ if ! git rev-parse --git-dir >/dev/null 2>&1; then
258
+ log_error "Not in a git repository"
259
+ exit 1
260
+ fi
261
+
262
+ # Check if agent file exists
263
+ if [[ ! -f "$AGENT_FILE" ]]; then
264
+ log_error "CFN system expert agent not found: $AGENT_FILE"
265
+ exit 1
266
+ fi
267
+
268
+ # Get commit range
269
+ local last_commit=$(get_last_commit)
270
+ local current_head=$(git rev-parse HEAD)
271
+
272
+ if [[ "$last_commit" == "$current_head" ]] && [[ "$FORCE" != "true" ]]; then
273
+ log_info "ℹ️ No new commits to scan"
274
+ return
275
+ fi
276
+
277
+ log_info "🔍 Scanning commits since ${last_commit:0:8}..."
278
+
279
+ # Get commits since last scan
280
+ local commits
281
+ if [[ "$FORCE" == "true" ]]; then
282
+ commits=$(git log --format="%H" --since="2 weeks ago" | tac)
283
+ else
284
+ commits=$(git log --format="%H" "$last_commit..HEAD" | tac)
285
+ fi
286
+
287
+ if [[ -z "$commits" ]]; then
288
+ log_info "ℹ️ No new commits found"
289
+ return
290
+ fi
291
+
292
+ local commit_count=$(echo "$commits" | wc -l)
293
+ log_info "📋 Found $commit_count commits to analyze"
294
+
295
+ # Process commits
296
+ local relevant_commits=0
297
+ local total_knowledge=""
298
+ local backup_file=""
299
+
300
+ while read -r commit_hash; do
301
+ [[ -z "$commit_hash" ]] && continue
302
+
303
+ local relevance=$(is_relevant_commit "$commit_hash")
304
+
305
+ if [[ "$relevance" != "none" ]]; then
306
+ ((relevant_commits++))
307
+ log_info "🎯 Relevant commit found (${relevance}): ${commit_hash:0:8}"
308
+
309
+ local knowledge=$(extract_commit_knowledge "$commit_hash" "$relevance")
310
+ total_knowledge="${total_knowledge}${knowledge}"$'\n'
311
+ fi
312
+ done <<< "$commits"
313
+
314
+ # Report results
315
+ if [[ "$relevant_commits" == "0" ]]; then
316
+ log_info "ℹ️ No CFN-relevant changes found"
317
+ return
318
+ fi
319
+
320
+ log_info "📊 Found $relevant_commits/$commit_count relevant commits"
321
+
322
+ if [[ "$DRY_RUN" == "true" ]]; then
323
+ log_info "🔍 DRY RUN MODE - No changes will be applied"
324
+ log_info "💡 Run without --dry-run to apply updates"
325
+ echo ""
326
+ echo "Sample of updates that would be applied:"
327
+ echo "$total_knowledge" | head -50
328
+ return
329
+ fi
330
+
331
+ # Create backup before updating
332
+ backup_file=$(create_backup)
333
+
334
+ # Update agent with new knowledge
335
+ update_agent "$total_knowledge" "$backup_file"
336
+
337
+ # Update tracking
338
+ update_last_commit "$current_head"
339
+
340
+ log_success "🎉 Update complete!"
341
+ log_info "📊 Processed $relevant_commits relevant commits"
342
+ log_info "📁 Backup available: $backup_file"
343
+ }
344
+
345
+ # Execute main function
346
+ main "$@"
@@ -317,23 +317,78 @@ function store_context() {
317
317
  }
318
318
 
319
319
  build_agent_context() {
320
- local iteration="$1"
321
- local agent_type="$2"
322
- local feedback="$3"
323
- local loop_type="${4:-}" # NEW: loop3, loop2, or loop4 (optional)
320
+ local task_id="$1"
321
+ local iteration="$2"
322
+ local agent_type="$3"
323
+ local feedback="$4"
324
+ local loop_type="${5:-}" # NEW: loop3, loop2, or loop4 (optional)
324
325
 
325
- # Extract from SUCCESS_CRITERIA JSON
326
+ # Initialize context variables
326
327
  local task_desc="CFN Loop implementation"
327
- local deliverables=$(echo "$SUCCESS_CRITERIA" | jq -r '.deliverables // [] | join(", ")' 2>/dev/null || echo "")
328
- local acceptance=$(echo "$SUCCESS_CRITERIA" | jq -r '.acceptanceCriteria // [] | join(", ")' 2>/dev/null || echo "")
328
+ local deliverables=""
329
+ local acceptance=""
330
+ local epic_context=""
331
+ local phase_context=""
332
+ local target_files=""
333
+
334
+ # Try to retrieve complete context from Redis
335
+ if command -v "$REDIS_COORD_SKILL/get-context.sh" >/dev/null 2>&1; then
336
+ if redis_context=$("$REDIS_COORD_SKILL/get-context.sh" --task-id "$task_id" --namespace "swarm" 2>/dev/null); then
337
+ echo "📥 Retrieved Redis context for task: $task_id" >&2
338
+
339
+ # Extract fields from Redis context
340
+ task_desc=$(echo "$redis_context" | jq -r '.["epic-context"] // .epic_context // "CFN Loop implementation"' 2>/dev/null || echo "CFN Loop implementation")
341
+ deliverables=$(echo "$redis_context" | jq -r '.deliverables // [] | if type == "array" then join(", ") else . end' 2>/dev/null || echo "")
342
+ acceptance=$(echo "$redis_context" | jq -r '.acceptanceCriteria // .["acceptance-criteria"] // [] | if type == "array" then join(", ") else . end' 2>/dev/null || echo "")
343
+ epic_context=$(echo "$redis_context" | jq -r '.["epic-context"] // ""' 2>/dev/null || echo "")
344
+ phase_context=$(echo "$redis_context" | jq -r '.["phase-context"] // ""' 2>/dev/null || echo "")
345
+ target_files=$(echo "$redis_context" | jq -r '.["target-files"] // ""' 2>/dev/null || echo "")
346
+
347
+ echo "📋 Redis context extracted - Task: $task_desc" >&2
348
+ else
349
+ echo "⚠️ Failed to retrieve Redis context, using local SUCCESS_CRITERIA" >&2
350
+ fi
351
+ else
352
+ echo "⚠️ get-context.sh not found, using local SUCCESS_CRITERIA" >&2
353
+ fi
354
+
355
+ # Fallback to local SUCCESS_CRITERIA if Redis retrieval failed or incomplete
356
+ if [ -z "$deliverables" ] && [ -n "$SUCCESS_CRITERIA" ]; then
357
+ deliverables=$(echo "$SUCCESS_CRITERIA" | jq -r '.deliverables // [] | join(", ")' 2>/dev/null || echo "")
358
+ acceptance=$(echo "$SUCCESS_CRITERIA" | jq -r '.acceptanceCriteria // [] | join(", ")' 2>/dev/null || echo "")
359
+ echo "🔄 Using local SUCCESS_CRITERIA as fallback" >&2
360
+ fi
329
361
 
330
- # Build base context
331
- local context="Task: $task_desc | Deliverables: $deliverables | Acceptance: $acceptance | Iteration: $iteration"
362
+ # Build comprehensive context string
363
+ local context="Task: $task_desc"
364
+
365
+ if [ -n "$deliverables" ]; then
366
+ context="$context | Deliverables: $deliverables"
367
+ fi
368
+
369
+ if [ -n "$acceptance" ]; then
370
+ context="$context | Acceptance Criteria: $acceptance"
371
+ fi
372
+
373
+ if [ -n "$target_files" ]; then
374
+ context="$context | Target Files: $target_files"
375
+ fi
376
+
377
+ context="$context | Iteration: $iteration"
332
378
 
333
379
  if [[ -n "$feedback" ]]; then
334
380
  context="$context | Feedback: $feedback"
335
381
  fi
336
382
 
383
+ # Add epic/phase context if available
384
+ if [ -n "$epic_context" ]; then
385
+ context="$context | Epic: $epic_context"
386
+ fi
387
+
388
+ if [ -n "$phase_context" ]; then
389
+ context="$context | Phase: $phase_context"
390
+ fi
391
+
337
392
  # Inject CFN Loop context if injection script exists and loop_type provided
338
393
  if [[ -n "$loop_type" ]] && [[ -x "$SCRIPT_DIR/inject-loop-context.sh" ]]; then
339
394
  context=$("$SCRIPT_DIR/inject-loop-context.sh" "$loop_type" "$context" 2>/dev/null || echo "$context")
@@ -375,7 +430,7 @@ function spawn_loop3_agents() {
375
430
  --task-id "$safe_task_id" \
376
431
  --agent-id "$safe_agent_id" \
377
432
  --iteration "$iteration" \
378
- --context "$(build_agent_context "$iteration" "$safe_agent_type" "" "loop3")" &
433
+ --context "$(build_agent_context "$safe_task_id" "$iteration" "$safe_agent_type" "" "loop3")" &
379
434
 
380
435
  # Store PID for monitoring using unique agent ID
381
436
  AGENT_PID=$!
@@ -608,7 +663,7 @@ function spawn_loop2_agents() {
608
663
  --task-id "$task_id" \
609
664
  --agent-id "$UNIQUE_VALIDATOR_ID" \
610
665
  --iteration "$iteration" \
611
- --context "$(build_agent_context "$iteration" "$agent_type" "" "loop2")" &
666
+ --context "$(build_agent_context "$task_id" "$iteration" "$agent_type" "" "loop2")" &
612
667
 
613
668
  # Store PID for monitoring using unique agent ID
614
669
  AGENT_PID=$!