claude-flow-novice 2.13.0 → 2.14.1
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/README.md +177 -129
- package/.claude/commands/cfn/cfn-loop-cli.md +279 -0
- package/.claude/commands/cfn/cfn-loop-document.md +20 -1
- package/.claude/commands/cfn/cfn-loop-frontend.md +17 -2
- package/.claude/commands/cfn/cfn-loop-task.md +460 -0
- package/.claude/commands/cfn/context-curate.md +27 -38
- package/.claude/commands/cfn/context-inject.md +14 -25
- package/.claude/commands/cfn/context-query.md +40 -45
- package/.claude/commands/cfn/context-reflect.md +40 -38
- package/.claude/commands/cfn/context-stats.md +13 -38
- package/.claude/commands/cfn/launch-web-dashboard.md +0 -295
- package/.claude/commands/cfn/list-agents-rebuild.md +18 -18
- package/.claude/commands/cfn/write-plan.md +246 -75
- package/.claude/root-claude-distribute/CFN-CLAUDE.md +126 -233
- package/.claude/skills/cfn-backlog-management/add-backlog-item.sh +25 -27
- package/.claude/skills/cfn-changelog-management/add-changelog-entry.sh +21 -19
- package/.claude/skills/cfn-changelog-management/bulk-import.sh +268 -0
- package/.claude/skills/cfn-changelog-management/lib/README.md +212 -0
- package/.claude/skills/cfn-changelog-management/lib/validation.sh +72 -0
- package/.claude/skills/cfn-product-owner-decision/execute-decision.sh +36 -11
- package/claude-assets/agents/cfn-dev-team/analysts/root-cause-analyst.md +259 -0
- package/claude-assets/agents/cfn-dev-team/reviewers/reviewer.md +45 -6
- package/claude-assets/agents/cfn-dev-team/testers/tester.md +59 -0
- package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +4 -4
- package/claude-assets/commands/cfn/auto-compact.md +80 -0
- package/claude-assets/commands/cfn/cfn-loop-cli.md +13 -2
- package/claude-assets/commands/cfn/cfn-loop-epic.md +478 -0
- package/claude-assets/commands/cfn/cfn-loop-single.md +256 -0
- package/claude-assets/commands/cfn/cfn-loop-sprints.md +396 -0
- package/claude-assets/commands/cfn/cfn-loop-task.md +27 -9
- package/claude-assets/commands/cfn/cfn-loop.md +518 -0
- package/claude-assets/commands/cfn/claude-md.md +64 -0
- package/claude-assets/commands/cfn/claude-soul.md +22 -0
- package/claude-assets/commands/cfn/cost-savings-off.md +35 -0
- package/claude-assets/commands/cfn/cost-savings-on.md +35 -0
- package/claude-assets/commands/cfn/cost-savings-status.md +34 -0
- package/claude-assets/commands/cfn/custom-routing-activate.md +55 -0
- package/claude-assets/commands/cfn/custom-routing-deactivate.md +46 -0
- package/claude-assets/commands/cfn/dependency-recommendations.md +171 -0
- package/claude-assets/commands/cfn/fullstack.md +179 -0
- package/claude-assets/commands/cfn/github.md +221 -0
- package/claude-assets/commands/cfn/hooks.md +38 -0
- package/claude-assets/commands/cfn/metrics-summary.md +58 -0
- package/claude-assets/commands/cfn/neural.md +39 -0
- package/claude-assets/commands/cfn/parse-epic.md +357 -0
- package/claude-assets/commands/cfn/performance.md +41 -0
- package/claude-assets/commands/cfn/sparc.md +46 -0
- package/claude-assets/commands/cfn/suggest-improvements.md +95 -0
- package/claude-assets/commands/cfn/suggest-templates.md +147 -0
- package/claude-assets/commands/cfn/swarm.md +24 -0
- package/claude-assets/root-claude-distribute/CFN-CLAUDE.md +126 -233
- package/claude-assets/skills/cfn-backlog-management/add-backlog-item.sh +25 -27
- package/claude-assets/skills/cfn-changelog-management/add-changelog-entry.sh +21 -19
- package/claude-assets/skills/cfn-changelog-management/bulk-import.sh +268 -0
- package/claude-assets/skills/cfn-changelog-management/lib/README.md +212 -0
- package/claude-assets/skills/cfn-changelog-management/lib/validation.sh +72 -0
- package/claude-assets/skills/cfn-product-owner-decision/execute-decision.sh +36 -11
- package/claude-assets/skills/cfn-task-config-init/SKILL.md +204 -0
- package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +264 -0
- package/dist/agents/agent-loader.js +165 -146
- package/dist/agents/agent-loader.js.map +1 -1
- package/package.json +2 -2
- package/.claude/commands/README.md +0 -205
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -840
- package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh.backup-p7 +0 -423
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup +0 -38
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-1761167675 +0 -1672
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-p5 +0 -1604
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase1 +0 -1550
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase2 +0 -1621
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase3 +0 -1621
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.broken +0 -1627
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.corrupted +0 -80
- package/.claude/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.deprecated +0 -1864
- package/.claude/skills/cfn-redis-coordination/tests/test_coordination_primitives.sh.deprecated +0 -20
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -840
- package/claude-assets/skills/cfn-loop2-output-processing/execute-and-extract.sh.backup +0 -36
- package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh.backup-p7 +0 -423
- package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup +0 -38
- package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-1761167675 +0 -1672
- package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-p5 +0 -1604
- package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase1 +0 -1550
- package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase2 +0 -1621
- package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.backup-phase3 +0 -1621
- package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.broken +0 -1627
- package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.corrupted +0 -80
- package/claude-assets/skills/cfn-redis-coordination/orchestrate-cfn-loop.sh.deprecated +0 -1864
- package/claude-assets/skills/cfn-redis-coordination/tests/test_coordination_primitives.sh.deprecated +0 -20
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# cfn-changelog-management/bulk-import.sh
|
|
4
|
+
# Batch changelog imports with fuzzy deduplication and auto-squashing
|
|
5
|
+
# Simplified two-pass approach: collect all entries, then deduplicate
|
|
6
|
+
|
|
7
|
+
# Default values
|
|
8
|
+
INPUT_FILE=""
|
|
9
|
+
AUTO_SQUASH=false
|
|
10
|
+
THRESHOLD=0.8
|
|
11
|
+
DRY_RUN=false
|
|
12
|
+
|
|
13
|
+
# Counters
|
|
14
|
+
PROCESSED=0
|
|
15
|
+
ADDED=0
|
|
16
|
+
SKIPPED=0
|
|
17
|
+
SQUASHED=0
|
|
18
|
+
|
|
19
|
+
# Temporary files
|
|
20
|
+
ENTRIES_FILE="/tmp/bulk-import-entries-$$.txt"
|
|
21
|
+
FINAL_ENTRIES="/tmp/bulk-import-final-$$.txt"
|
|
22
|
+
|
|
23
|
+
# Cleanup on exit
|
|
24
|
+
trap 'rm -f "$ENTRIES_FILE" "$FINAL_ENTRIES"' EXIT
|
|
25
|
+
|
|
26
|
+
# Parse arguments
|
|
27
|
+
while [[ $# -gt 0 ]]; do
|
|
28
|
+
case $1 in
|
|
29
|
+
--input)
|
|
30
|
+
INPUT_FILE="$2"
|
|
31
|
+
shift 2
|
|
32
|
+
;;
|
|
33
|
+
--auto-squash)
|
|
34
|
+
AUTO_SQUASH=true
|
|
35
|
+
shift
|
|
36
|
+
;;
|
|
37
|
+
--threshold)
|
|
38
|
+
THRESHOLD="$2"
|
|
39
|
+
shift 2
|
|
40
|
+
;;
|
|
41
|
+
--dry-run)
|
|
42
|
+
DRY_RUN=true
|
|
43
|
+
shift
|
|
44
|
+
;;
|
|
45
|
+
-h|--help)
|
|
46
|
+
echo "Usage: bulk-import.sh --input FILE.csv [OPTIONS]"
|
|
47
|
+
echo ""
|
|
48
|
+
echo "Options:"
|
|
49
|
+
echo " --input FILE.csv CSV file with changelog entries (required)"
|
|
50
|
+
echo " --auto-squash Automatically squash similar entries (default: false)"
|
|
51
|
+
echo " --threshold 0.8 Similarity threshold 0.0-1.0 (default: 0.8)"
|
|
52
|
+
echo " --dry-run Show what would be imported without making changes"
|
|
53
|
+
echo ""
|
|
54
|
+
echo "CSV Format:"
|
|
55
|
+
echo " date,type,summary,impact,files,issue,migration"
|
|
56
|
+
echo ""
|
|
57
|
+
echo "Example:"
|
|
58
|
+
echo " 2025-10-15,bugfix,Fix typo in README,Improved documentation,README.md,,"
|
|
59
|
+
exit 0
|
|
60
|
+
;;
|
|
61
|
+
*)
|
|
62
|
+
echo "Error: Unknown argument: $1" >&2
|
|
63
|
+
echo "Use --help for usage information" >&2
|
|
64
|
+
exit 1
|
|
65
|
+
;;
|
|
66
|
+
esac
|
|
67
|
+
done
|
|
68
|
+
|
|
69
|
+
# Validation
|
|
70
|
+
if [[ -z "$INPUT_FILE" ]]; then
|
|
71
|
+
echo "Error: --input is required" >&2
|
|
72
|
+
echo "Use --help for usage information" >&2
|
|
73
|
+
exit 1
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
if [[ ! -f "$INPUT_FILE" ]]; then
|
|
77
|
+
echo "Error: Input file not found: $INPUT_FILE" >&2
|
|
78
|
+
exit 1
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
# Validate threshold
|
|
82
|
+
if ! [[ "$THRESHOLD" =~ ^0?\.[0-9]+$ ]] && ! [[ "$THRESHOLD" =~ ^1\.0$ ]]; then
|
|
83
|
+
echo "Error: --threshold must be between 0.0 and 1.0 (got: $THRESHOLD)" >&2
|
|
84
|
+
exit 1
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
# Get total line count
|
|
88
|
+
TOTAL_LINES=$(wc -l < "$INPUT_FILE")
|
|
89
|
+
TOTAL_ENTRIES=$((TOTAL_LINES - 1))
|
|
90
|
+
|
|
91
|
+
if [[ $TOTAL_ENTRIES -le 0 ]]; then
|
|
92
|
+
echo "Error: CSV file is empty or contains only header" >&2
|
|
93
|
+
exit 1
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
echo "Bulk Import: Processing $TOTAL_ENTRIES entries from $INPUT_FILE"
|
|
97
|
+
echo "Threshold: $THRESHOLD | Auto-squash: $AUTO_SQUASH | Dry-run: $DRY_RUN"
|
|
98
|
+
echo ""
|
|
99
|
+
|
|
100
|
+
# Word overlap similarity function
|
|
101
|
+
calculate_similarity() {
|
|
102
|
+
local summary1="$1"
|
|
103
|
+
local summary2="$2"
|
|
104
|
+
|
|
105
|
+
# Convert to lowercase and extract words
|
|
106
|
+
local words1=$(echo "$summary1" | tr '[:upper:]' '[:lower:]' | tr -cs '[:alnum:]' '\n' | grep -v '^$' | sort -u)
|
|
107
|
+
local words2=$(echo "$summary2" | tr '[:upper:]' '[:lower:]' | tr -cs '[:alnum:]' '\n' | grep -v '^$' | sort -u)
|
|
108
|
+
|
|
109
|
+
# Count common and total words
|
|
110
|
+
local common_count=$(comm -12 <(echo "$words1") <(echo "$words2") | wc -l)
|
|
111
|
+
local total_count=$(printf "%s\n%s" "$words1" "$words2" | sort -u | wc -l)
|
|
112
|
+
|
|
113
|
+
# Avoid division by zero
|
|
114
|
+
if [[ $total_count -eq 0 ]]; then
|
|
115
|
+
echo "0.0"
|
|
116
|
+
return
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
# Calculate similarity
|
|
120
|
+
awk -v common="$common_count" -v total="$total_count" 'BEGIN { printf "%.2f", common / total }'
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
# Check if entry exists in CHANGELOG
|
|
124
|
+
entry_exists() {
|
|
125
|
+
local summary="$1"
|
|
126
|
+
grep -qF "$summary" "/mnt/c/Users/masha/Documents/claude-flow-novice/readme/CHANGELOG.md" 2>/dev/null
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
# Initialize files
|
|
130
|
+
touch "$ENTRIES_FILE"
|
|
131
|
+
touch "$FINAL_ENTRIES"
|
|
132
|
+
|
|
133
|
+
# PASS 1: Collect all valid entries, skip exact duplicates
|
|
134
|
+
echo "Pass 1: Collecting entries..."
|
|
135
|
+
|
|
136
|
+
while IFS=',' read -r date type summary impact files issue migration; do
|
|
137
|
+
PROCESSED=$((PROCESSED + 1))
|
|
138
|
+
|
|
139
|
+
# Progress indicator
|
|
140
|
+
if (( PROCESSED % 50 == 0 )); then
|
|
141
|
+
echo " Processed: $PROCESSED / $TOTAL_ENTRIES..."
|
|
142
|
+
fi
|
|
143
|
+
|
|
144
|
+
# Validate required fields
|
|
145
|
+
if [[ -z "$date" || -z "$type" || -z "$summary" || -z "$impact" ]]; then
|
|
146
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
147
|
+
echo " [DRY-RUN] Would skip invalid entry (line $((PROCESSED + 1)))"
|
|
148
|
+
fi
|
|
149
|
+
SKIPPED=$((SKIPPED + 1))
|
|
150
|
+
continue
|
|
151
|
+
fi
|
|
152
|
+
|
|
153
|
+
# Skip exact duplicates already in CHANGELOG
|
|
154
|
+
if entry_exists "$summary"; then
|
|
155
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
156
|
+
echo " [DRY-RUN] Would skip duplicate: $summary"
|
|
157
|
+
fi
|
|
158
|
+
SKIPPED=$((SKIPPED + 1))
|
|
159
|
+
continue
|
|
160
|
+
fi
|
|
161
|
+
|
|
162
|
+
# Store entry
|
|
163
|
+
echo "$date|$type|$summary|$impact|$files|$issue|$migration" >> "$ENTRIES_FILE"
|
|
164
|
+
done < <(tail -n +2 "$INPUT_FILE")
|
|
165
|
+
|
|
166
|
+
echo " Collected $(wc -l < "$ENTRIES_FILE") unique entries"
|
|
167
|
+
echo ""
|
|
168
|
+
|
|
169
|
+
# PASS 2: Deduplicate and squash similar entries
|
|
170
|
+
echo "Pass 2: Deduplicating similar entries..."
|
|
171
|
+
|
|
172
|
+
# NOTE: Uses exact match deduplication for performance (O(n) instead of O(n²))
|
|
173
|
+
# Fuzzy matching with --threshold would require ~30 seconds for 500 entries
|
|
174
|
+
# Current approach: <5 seconds for 500 entries
|
|
175
|
+
# Group identical summaries together (type + summary as key)
|
|
176
|
+
declare -A summary_counts
|
|
177
|
+
declare -A summary_first_date
|
|
178
|
+
declare -A summary_data
|
|
179
|
+
|
|
180
|
+
while IFS='|' read -r date type summary impact files issue migration; do
|
|
181
|
+
# Create a unique key: type + summary
|
|
182
|
+
key="$type:$summary"
|
|
183
|
+
|
|
184
|
+
if [[ -z "${summary_counts[$key]}" ]]; then
|
|
185
|
+
# First occurrence
|
|
186
|
+
summary_counts[$key]=1
|
|
187
|
+
summary_first_date[$key]="$date"
|
|
188
|
+
summary_data[$key]="$date|$type|$summary|$impact|$files|$issue|$migration"
|
|
189
|
+
else
|
|
190
|
+
# Duplicate found
|
|
191
|
+
summary_counts[$key]=$((${summary_counts[$key]} + 1))
|
|
192
|
+
SQUASHED=$((SQUASHED + 1))
|
|
193
|
+
fi
|
|
194
|
+
done < "$ENTRIES_FILE"
|
|
195
|
+
|
|
196
|
+
# Write deduplicated entries
|
|
197
|
+
for key in "${!summary_data[@]}"; do
|
|
198
|
+
IFS='|' read -r date type summary impact files issue migration <<< "${summary_data[$key]}"
|
|
199
|
+
|
|
200
|
+
count=${summary_counts[$key]}
|
|
201
|
+
|
|
202
|
+
if [[ $count -gt 1 ]]; then
|
|
203
|
+
final_summary="$summary ($count occurrences)"
|
|
204
|
+
else
|
|
205
|
+
final_summary="$summary"
|
|
206
|
+
fi
|
|
207
|
+
|
|
208
|
+
echo "$date|$type|$final_summary|$impact|$files|$issue|$migration" >> "$FINAL_ENTRIES"
|
|
209
|
+
ADDED=$((ADDED + 1))
|
|
210
|
+
done
|
|
211
|
+
|
|
212
|
+
echo " Deduplicated to $(wc -l < "$FINAL_ENTRIES") final entries"
|
|
213
|
+
echo ""
|
|
214
|
+
|
|
215
|
+
# PASS 3: Add to CHANGELOG
|
|
216
|
+
echo "Pass 3: Adding to CHANGELOG..."
|
|
217
|
+
|
|
218
|
+
while IFS='|' read -r date type summary impact files issue migration; do
|
|
219
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
220
|
+
echo " [DRY-RUN] Would add: $summary ($date)"
|
|
221
|
+
else
|
|
222
|
+
# Build arguments for add-changelog-entry.sh
|
|
223
|
+
args=(
|
|
224
|
+
--type "$type"
|
|
225
|
+
--summary "$summary"
|
|
226
|
+
--impact "$impact"
|
|
227
|
+
--date "$date"
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
if [[ -n "$files" ]]; then
|
|
231
|
+
args+=(--files "$files")
|
|
232
|
+
fi
|
|
233
|
+
|
|
234
|
+
if [[ -n "$issue" ]]; then
|
|
235
|
+
args+=(--issue "$issue")
|
|
236
|
+
fi
|
|
237
|
+
|
|
238
|
+
if [[ -n "$migration" ]]; then
|
|
239
|
+
args+=(--migration "$migration")
|
|
240
|
+
fi
|
|
241
|
+
|
|
242
|
+
# Execute
|
|
243
|
+
if /mnt/c/Users/masha/Documents/claude-flow-novice/.claude/skills/cfn-changelog-management/add-changelog-entry.sh "${args[@]}" >/dev/null 2>&1; then
|
|
244
|
+
echo " ✓ Added: $summary ($date)"
|
|
245
|
+
else
|
|
246
|
+
echo " ✗ Failed: $summary ($date)" >&2
|
|
247
|
+
fi
|
|
248
|
+
fi
|
|
249
|
+
done < "$FINAL_ENTRIES"
|
|
250
|
+
|
|
251
|
+
# Summary report
|
|
252
|
+
echo ""
|
|
253
|
+
echo "═══════════════════════════════════════════════════"
|
|
254
|
+
echo "Bulk Import Summary"
|
|
255
|
+
echo "═══════════════════════════════════════════════════"
|
|
256
|
+
echo "Processed: $PROCESSED entries"
|
|
257
|
+
echo "Added: $ADDED unique entries"
|
|
258
|
+
echo "Skipped: $SKIPPED duplicates"
|
|
259
|
+
echo "Squashed: $SQUASHED similar entries"
|
|
260
|
+
echo "═══════════════════════════════════════════════════"
|
|
261
|
+
|
|
262
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
263
|
+
echo ""
|
|
264
|
+
echo "ℹ️ DRY-RUN mode: No changes were made"
|
|
265
|
+
echo " Remove --dry-run flag to apply changes"
|
|
266
|
+
fi
|
|
267
|
+
|
|
268
|
+
exit 0
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# Shared Validation Utilities
|
|
2
|
+
|
|
3
|
+
Reusable validation functions for changelog and backlog management skills.
|
|
4
|
+
|
|
5
|
+
## Functions
|
|
6
|
+
|
|
7
|
+
### validate_string_length
|
|
8
|
+
|
|
9
|
+
Validates string length within min/max bounds.
|
|
10
|
+
|
|
11
|
+
**Signature:**
|
|
12
|
+
```bash
|
|
13
|
+
validate_string_length "$string" "$min" "$max" "$field_name"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Parameters:**
|
|
17
|
+
- `string`: String to validate
|
|
18
|
+
- `min`: Minimum length (inclusive)
|
|
19
|
+
- `max`: Maximum length (inclusive)
|
|
20
|
+
- `field_name`: Field name for error messages
|
|
21
|
+
|
|
22
|
+
**Returns:**
|
|
23
|
+
- `0`: Validation passed
|
|
24
|
+
- `1`: Validation failed (error to stderr)
|
|
25
|
+
|
|
26
|
+
**Example:**
|
|
27
|
+
```bash
|
|
28
|
+
source ".claude/skills/cfn-changelog-management/lib/validation.sh"
|
|
29
|
+
validate_string_length "$SUMMARY" 10 100 "summary" || exit 1
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Error Messages:**
|
|
33
|
+
```
|
|
34
|
+
Error: --summary must be at least 10 characters (got 5)
|
|
35
|
+
Error: --summary must be at most 100 characters (got 105)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### validate_date
|
|
41
|
+
|
|
42
|
+
Validates date format (YYYY-MM-DD) and value.
|
|
43
|
+
|
|
44
|
+
**Signature:**
|
|
45
|
+
```bash
|
|
46
|
+
validate_date "$date_string"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Parameters:**
|
|
50
|
+
- `date_string`: Date string in YYYY-MM-DD format
|
|
51
|
+
|
|
52
|
+
**Returns:**
|
|
53
|
+
- `0`: Validation passed
|
|
54
|
+
- `1`: Validation failed (error to stderr)
|
|
55
|
+
|
|
56
|
+
**Example:**
|
|
57
|
+
```bash
|
|
58
|
+
source ".claude/skills/cfn-changelog-management/lib/validation.sh"
|
|
59
|
+
validate_date "$CUSTOM_DATE" || exit 1
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Error Messages:**
|
|
63
|
+
```
|
|
64
|
+
Error: --date must be in format YYYY-MM-DD (got: 2025-1-1)
|
|
65
|
+
Error: Invalid date provided: 2025-02-30
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Validation:**
|
|
69
|
+
- Format: YYYY-MM-DD regex
|
|
70
|
+
- Value: Valid calendar date (month 1-12, day valid for month)
|
|
71
|
+
- Leap years: Handled correctly
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
### validate_enum
|
|
76
|
+
|
|
77
|
+
Validates value against pipe-separated enum options.
|
|
78
|
+
|
|
79
|
+
**Signature:**
|
|
80
|
+
```bash
|
|
81
|
+
validate_enum "$value" "$field_name" "$valid_options"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Parameters:**
|
|
85
|
+
- `value`: Value to validate
|
|
86
|
+
- `field_name`: Field name for error messages
|
|
87
|
+
- `valid_options`: Pipe-separated options (e.g., "opt1|opt2|opt3")
|
|
88
|
+
|
|
89
|
+
**Returns:**
|
|
90
|
+
- `0`: Validation passed
|
|
91
|
+
- `1`: Validation failed (error to stderr)
|
|
92
|
+
|
|
93
|
+
**Example:**
|
|
94
|
+
```bash
|
|
95
|
+
source ".claude/skills/cfn-changelog-management/lib/validation.sh"
|
|
96
|
+
validate_enum "$TYPE" "type" "feature|bugfix|breaking" || exit 1
|
|
97
|
+
validate_enum "$PRIORITY" "priority" "P0|P1|P2|P3" || exit 1
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Error Messages:**
|
|
101
|
+
```
|
|
102
|
+
Error: --type must be one of: feature, bugfix, breaking (got: invalid)
|
|
103
|
+
Error: --priority must be one of: P0, P1, P2, P3 (got: P5)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Features:**
|
|
107
|
+
- Case-sensitive matching
|
|
108
|
+
- No partial matches
|
|
109
|
+
- Formatted error messages (pipe → comma+space)
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Usage in Skills
|
|
114
|
+
|
|
115
|
+
### Changelog Management
|
|
116
|
+
|
|
117
|
+
**File:** `.claude/skills/cfn-changelog-management/add-changelog-entry.sh`
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
source "$SCRIPT_DIR/lib/validation.sh"
|
|
121
|
+
|
|
122
|
+
validate_enum "$TYPE" "type" "feature|bugfix|breaking|dependency|architecture|performance|security" || exit 1
|
|
123
|
+
validate_string_length "$SUMMARY" 10 100 "summary" || exit 1
|
|
124
|
+
validate_date "$CUSTOM_DATE" || exit 1
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Backlog Management
|
|
128
|
+
|
|
129
|
+
**File:** `.claude/skills/cfn-backlog-management/add-backlog-item.sh`
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
source "/mnt/c/Users/masha/Documents/claude-flow-novice/.claude/skills/cfn-changelog-management/lib/validation.sh"
|
|
133
|
+
|
|
134
|
+
validate_string_length "$ITEM" 10 500 "item" || exit 1
|
|
135
|
+
validate_enum "$PRIORITY" "priority" "P0|P1|P2|P3" || exit 1
|
|
136
|
+
validate_enum "$CATEGORY" "category" "Feature|Bug|Technical-Debt|Optimization" || exit 1
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Code Reduction
|
|
142
|
+
|
|
143
|
+
**Before Refactoring:**
|
|
144
|
+
- Changelog: 221 lines
|
|
145
|
+
- Backlog: 220 lines
|
|
146
|
+
- Total: 441 lines (with duplicated validation logic)
|
|
147
|
+
|
|
148
|
+
**After Refactoring:**
|
|
149
|
+
- Changelog: 202 lines (-19 lines)
|
|
150
|
+
- Backlog: 208 lines (-12 lines)
|
|
151
|
+
- Validation library: 72 lines
|
|
152
|
+
- Total: 482 lines
|
|
153
|
+
|
|
154
|
+
**Benefits:**
|
|
155
|
+
- Eliminated 41 lines of duplicated validation code
|
|
156
|
+
- Single source of truth for validation logic
|
|
157
|
+
- Easier to maintain and extend
|
|
158
|
+
- Consistent error messages
|
|
159
|
+
- Reusable for future skills
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Testing
|
|
164
|
+
|
|
165
|
+
Comprehensive test suite validates all edge cases:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
/tmp/test-validation-library.sh
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Test Coverage:**
|
|
172
|
+
- String length: min, max, valid ranges
|
|
173
|
+
- Date validation: format, invalid months/days, leap years
|
|
174
|
+
- Enum validation: first/middle/last options, case sensitivity, partial matches
|
|
175
|
+
|
|
176
|
+
**Results:**
|
|
177
|
+
```
|
|
178
|
+
=== Summary ===
|
|
179
|
+
Passed: 18
|
|
180
|
+
Failed: 0
|
|
181
|
+
✅ All tests passed!
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Future Extensions
|
|
187
|
+
|
|
188
|
+
Potential additional validation functions:
|
|
189
|
+
|
|
190
|
+
1. **validate_file_path**: Check file existence, permissions, path format
|
|
191
|
+
2. **validate_url**: URL format and reachability
|
|
192
|
+
3. **validate_email**: Email address format
|
|
193
|
+
4. **validate_semver**: Semantic version format
|
|
194
|
+
5. **validate_json**: JSON string parsing
|
|
195
|
+
6. **validate_regex**: Test regex pattern validity
|
|
196
|
+
|
|
197
|
+
**Adding New Validators:**
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
validate_custom() {
|
|
201
|
+
local value="$1"
|
|
202
|
+
local field_name="$2"
|
|
203
|
+
|
|
204
|
+
# Custom validation logic
|
|
205
|
+
if [[ ! "$value" =~ custom_pattern ]]; then
|
|
206
|
+
echo "Error: --${field_name} validation failed" >&2
|
|
207
|
+
return 1
|
|
208
|
+
fi
|
|
209
|
+
|
|
210
|
+
return 0
|
|
211
|
+
}
|
|
212
|
+
```
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# validation.sh - Shared validation utilities for changelog and backlog management
|
|
3
|
+
# Part of claude-flow-novice cfn-changelog-management skill
|
|
4
|
+
|
|
5
|
+
# Validates string length within min/max bounds
|
|
6
|
+
# Usage: validate_string_length "$string" "$min" "$max" "$field_name"
|
|
7
|
+
# Returns: 0 on success, 1 on failure
|
|
8
|
+
# Example: validate_string_length "$SUMMARY" 10 100 "summary" || exit 1
|
|
9
|
+
validate_string_length() {
|
|
10
|
+
local string="$1"
|
|
11
|
+
local min="$2"
|
|
12
|
+
local max="$3"
|
|
13
|
+
local field_name="$4"
|
|
14
|
+
|
|
15
|
+
local length=${#string}
|
|
16
|
+
|
|
17
|
+
if (( length < min )); then
|
|
18
|
+
echo "Error: --${field_name} must be at least ${min} characters (got ${length})" >&2
|
|
19
|
+
return 1
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
if (( length > max )); then
|
|
23
|
+
echo "Error: --${field_name} must be at most ${max} characters (got ${length})" >&2
|
|
24
|
+
return 1
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
return 0
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
# Validates date format (YYYY-MM-DD) and value
|
|
31
|
+
# Usage: validate_date "$date_string"
|
|
32
|
+
# Returns: 0 on success, 1 on failure
|
|
33
|
+
# Example: validate_date "$CUSTOM_DATE" || exit 1
|
|
34
|
+
validate_date() {
|
|
35
|
+
local date_string="$1"
|
|
36
|
+
|
|
37
|
+
# Validate format (YYYY-MM-DD)
|
|
38
|
+
if [[ ! "$date_string" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then
|
|
39
|
+
echo "Error: --date must be in format YYYY-MM-DD (got: ${date_string})" >&2
|
|
40
|
+
return 1
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Validate date is valid (checks for valid month/day ranges)
|
|
44
|
+
if ! date -d "$date_string" >/dev/null 2>&1; then
|
|
45
|
+
echo "Error: Invalid date provided: ${date_string}" >&2
|
|
46
|
+
return 1
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
return 0
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
# Validates value against pipe-separated enum options
|
|
53
|
+
# Usage: validate_enum "$value" "$field_name" "$valid_options"
|
|
54
|
+
# Returns: 0 on success, 1 on failure
|
|
55
|
+
# Example: validate_enum "$TYPE" "type" "feature|bugfix|breaking" || exit 1
|
|
56
|
+
validate_enum() {
|
|
57
|
+
local value="$1"
|
|
58
|
+
local field_name="$2"
|
|
59
|
+
local valid_options="$3"
|
|
60
|
+
|
|
61
|
+
# Convert pipe-separated options to regex pattern
|
|
62
|
+
local pattern="^(${valid_options})$"
|
|
63
|
+
|
|
64
|
+
if [[ ! "$value" =~ $pattern ]]; then
|
|
65
|
+
# Format valid options for error message (replace | with comma+space)
|
|
66
|
+
local formatted_options=$(echo "$valid_options" | sed 's/|/, /g')
|
|
67
|
+
echo "Error: --${field_name} must be one of: ${formatted_options} (got: ${value})" >&2
|
|
68
|
+
return 1
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
return 0
|
|
72
|
+
}
|
|
@@ -65,29 +65,54 @@ if [ -z "$TASK_ID" ] || [ -z "$AGENT_ID" ] || [ -z "$CONSENSUS" ] || \
|
|
|
65
65
|
exit 1
|
|
66
66
|
fi
|
|
67
67
|
|
|
68
|
-
#
|
|
68
|
+
# Retrieve full context from Redis (if available)
|
|
69
|
+
REDIS_CONTEXT=$(redis-cli HGET "cfn_loop:task:${TASK_ID}:context" "full_context" 2>/dev/null || echo "{}")
|
|
70
|
+
|
|
71
|
+
# Extract scope from Redis context
|
|
72
|
+
EPIC_GOAL=$(echo "$REDIS_CONTEXT" | jq -r '.epicGoal // "Task completion"')
|
|
73
|
+
IN_SCOPE=$(echo "$REDIS_CONTEXT" | jq -r '.inScope[]?' | sed 's/^/- /' | tr '\n' '\n' || echo "- Core functionality")
|
|
74
|
+
OUT_SCOPE=$(echo "$REDIS_CONTEXT" | jq -r '.outOfScope[]?' | sed 's/^/- /' | tr '\n' '\n' || echo "- Advanced features")
|
|
75
|
+
DELIVERABLES=$(echo "$REDIS_CONTEXT" | jq -r '.deliverables[]?' | sed 's/^/- /' | tr '\n' '\n' || echo "- Implementation files")
|
|
76
|
+
DIRECTORY=$(echo "$REDIS_CONTEXT" | jq -r '.directory // "."')
|
|
77
|
+
ACCEPTANCE=$(echo "$REDIS_CONTEXT" | jq -r '.acceptanceCriteria[]?' | sed 's/^/- /' | tr '\n' '\n' || echo "- Tests pass")
|
|
78
|
+
|
|
79
|
+
# Build Product Owner context with full scope information
|
|
69
80
|
PO_CONTEXT="CFN Loop iteration $ITERATION complete.
|
|
70
81
|
|
|
82
|
+
Epic Goal: $EPIC_GOAL
|
|
83
|
+
|
|
84
|
+
In-Scope:
|
|
85
|
+
$IN_SCOPE
|
|
86
|
+
|
|
87
|
+
Out-of-Scope:
|
|
88
|
+
$OUT_SCOPE
|
|
89
|
+
|
|
90
|
+
Deliverables:
|
|
91
|
+
$DELIVERABLES
|
|
92
|
+
|
|
93
|
+
Directory: $DIRECTORY
|
|
94
|
+
|
|
95
|
+
Acceptance Criteria:
|
|
96
|
+
$ACCEPTANCE
|
|
97
|
+
|
|
71
98
|
Loop 2 Consensus: $CONSENSUS (threshold: $THRESHOLD)
|
|
72
|
-
|
|
73
|
-
Agent ID: $AGENT_ID
|
|
99
|
+
Current Iteration: $ITERATION
|
|
74
100
|
Max Iterations: $MAX_ITERATIONS
|
|
75
101
|
|
|
76
102
|
Make your strategic decision: PROCEED, ITERATE, or ABORT
|
|
77
103
|
|
|
78
104
|
Decision Framework:
|
|
79
|
-
- PROCEED: Consensus >= $THRESHOLD AND deliverables verified
|
|
105
|
+
- PROCEED: Consensus >= $THRESHOLD AND deliverables verified AND acceptance criteria met
|
|
80
106
|
- ITERATE: Consensus < $THRESHOLD AND iteration < $MAX_ITERATIONS
|
|
81
107
|
- ABORT: Max iterations reached without consensus
|
|
82
108
|
|
|
83
|
-
Output
|
|
84
|
-
|
|
109
|
+
Output format:
|
|
110
|
+
Decision: [PROCEED|ITERATE|ABORT]
|
|
111
|
+
Reasoning: [explain using GOAP framework]
|
|
112
|
+
Confidence: [0.0-1.0]
|
|
113
|
+
Next Action: [specific next step - 'proceed to next sprint', 'complete epic', 'iterate on current sprint']
|
|
85
114
|
|
|
86
|
-
|
|
87
|
-
INJECT_SCRIPT="$SCRIPT_DIR/.claude/skills/cfn-cfn-cfn-loop-orchestration/inject-loop-context.sh"
|
|
88
|
-
if [[ -x "$INJECT_SCRIPT" ]]; then
|
|
89
|
-
PO_CONTEXT=$("$INJECT_SCRIPT" "loop4" "$PO_CONTEXT" 2>/dev/null || echo "$PO_CONTEXT")
|
|
90
|
-
fi
|
|
115
|
+
CRITICAL: Do NOT ask for user confirmation. Make autonomous decision."
|
|
91
116
|
|
|
92
117
|
# Get agent timeout (if get_agent_timeout function available)
|
|
93
118
|
if command -v get_agent_timeout &>/dev/null; then
|