claude-flow-novice 2.15.1 → 2.15.3
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/cfn-extras/agents/google-sheets-specialist.md +614 -0
- package/.claude/commands/cfn/create-handoff.md +224 -0
- package/.claude/hooks/cfn-BACKUP_USAGE.md +243 -243
- package/.claude/hooks/cfn-invoke-security-validation.sh +69 -69
- package/.claude/hooks/cfn-post-edit-cfn-retrospective.sh +78 -78
- package/.claude/hooks/cfn-post-edit.config.json +44 -44
- package/.claude/skills/agent-lifecycle/SKILL.md +60 -0
- package/.claude/skills/agent-lifecycle/execute-lifecycle-hook.sh +573 -0
- package/.claude/skills/agent-lifecycle/simple-audit.sh +31 -0
- package/.claude/skills/cfn-hybrid-routing/check-dependencies.sh +51 -51
- package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +252 -252
- package/.claude/skills/cfn-redis-coordination/agent-recovery.sh +74 -74
- package/.claude/skills/cfn-redis-coordination/get-context.sh +112 -112
- package/.claude/skills/cfn-transparency-middleware/middleware-config.sh +28 -28
- package/.claude/skills/cfn-transparency-middleware/performance-benchmark.sh +78 -78
- package/.claude/skills/cfn-transparency-middleware/test-integration.sh +161 -161
- package/.claude/skills/cfn-transparency-middleware/test-transparency-skill.sh +367 -367
- package/.claude/skills/cfn-transparency-middleware/tests/input-validation.sh +92 -92
- package/.claude/skills/cfn-transparency-middleware/wrap-agent.sh +131 -131
- package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +662 -0
- package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +29 -0
- package/claude-assets/cfn-extras/agents/google-sheets-specialist.md +614 -0
- package/claude-assets/commands/cfn/create-handoff.md +224 -0
- package/claude-assets/hooks/cfn-BACKUP_USAGE.md +243 -243
- package/claude-assets/hooks/cfn-invoke-security-validation.sh +69 -69
- package/claude-assets/hooks/cfn-post-edit-cfn-retrospective.sh +78 -78
- package/claude-assets/hooks/cfn-post-edit.config.json +44 -44
- package/claude-assets/hooks/cfn-post-execution/memory-cleanup.sh +19 -19
- package/claude-assets/hooks/cfn-pre-execution/memory-check.sh +19 -19
- package/claude-assets/skills/agent-lifecycle/execute-lifecycle-hook.sh +572 -572
- package/claude-assets/skills/agent-lifecycle/simple-audit.sh +30 -30
- package/claude-assets/skills/cfn-automatic-memory-persistence/persist-agent-output.sh +48 -48
- package/claude-assets/skills/cfn-automatic-memory-persistence/query-agent-history.sh +34 -34
- package/claude-assets/skills/cfn-deliverable-validation/confidence-calculator.sh +261 -261
- package/claude-assets/skills/cfn-expert-update/update-expert.sh +345 -345
- package/claude-assets/skills/cfn-hybrid-routing/check-dependencies.sh +51 -51
- package/claude-assets/skills/cfn-intervention-detector/detect-intervention.sh +110 -110
- package/claude-assets/skills/cfn-intervention-orchestrator/execute-intervention.sh +58 -58
- package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +252 -252
- package/claude-assets/skills/cfn-loop2-output-processing/process-validator-output.sh +275 -275
- package/claude-assets/skills/cfn-memory-management/check-memory.sh +159 -159
- package/claude-assets/skills/cfn-memory-management/cleanup-memory.sh +196 -196
- package/claude-assets/skills/cfn-node-heap-sizer/task-mode-heap-limiter.sh +325 -325
- package/claude-assets/skills/cfn-playbook-auto-update/auto-update-playbook.sh +85 -85
- package/claude-assets/skills/cfn-redis-coordination/agent-recovery.sh +74 -74
- package/claude-assets/skills/cfn-redis-coordination/get-context.sh +112 -112
- package/claude-assets/skills/cfn-scope-simplifier/simplify-scope.sh +67 -67
- package/claude-assets/skills/cfn-specialist-injection/recommend-specialist.sh +56 -56
- package/claude-assets/skills/cfn-standardized-error-handling/capture-agent-error.sh +86 -86
- package/claude-assets/skills/cfn-standardized-error-handling/test-error-handling.sh +165 -165
- package/claude-assets/skills/cfn-task-config-init/initialize-config.sh +264 -264
- package/claude-assets/skills/cfn-task-decomposition/task-decomposer.sh +278 -278
- package/claude-assets/skills/cfn-transparency-middleware/middleware-config.sh +28 -28
- package/claude-assets/skills/cfn-transparency-middleware/performance-benchmark.sh +78 -78
- package/claude-assets/skills/cfn-transparency-middleware/test-integration.sh +161 -161
- package/claude-assets/skills/cfn-transparency-middleware/test-transparency-skill.sh +367 -367
- package/claude-assets/skills/cfn-transparency-middleware/tests/input-validation.sh +92 -92
- package/claude-assets/skills/cfn-transparency-middleware/wrap-agent.sh +131 -131
- package/claude-assets/skills/docker-build/SKILL.md +96 -203
- package/claude-assets/skills/docker-build/build.sh +73 -73
- package/claude-assets/skills/integration/agent-handoff.sh +494 -0
- package/claude-assets/skills/integration/file-operations.sh +414 -0
- package/claude-assets/skills/workflow-codification/APPROVAL_WORKFLOW.md +806 -0
- package/claude-assets/skills/workflow-codification/COST_TRACKING.md +637 -0
- package/claude-assets/skills/workflow-codification/EDGE_CASE_TRACKING.md +404 -0
- package/claude-assets/skills/workflow-codification/README_PHASE4.md +457 -0
- package/claude-assets/skills/workflow-codification/SKILL.md +110 -0
- package/claude-assets/skills/workflow-codification/analyze-patterns.sh +899 -0
- package/claude-assets/skills/workflow-codification/approval-workflow.sh +514 -0
- package/claude-assets/skills/workflow-codification/generate-skill-update.sh +525 -0
- package/claude-assets/skills/workflow-codification/review-skill.sh +643 -0
- package/claude-assets/skills/workflow-codification/templates/email-notification.txt +114 -0
- package/claude-assets/skills/workflow-codification/templates/slack-notification.md +85 -0
- package/claude-assets/skills/workflow-codification/test-integration.sh +281 -0
- package/claude-assets/skills/workflow-codification/track-cost-savings.sh +445 -0
- package/claude-assets/skills/workflow-codification/track-edge-case.sh +323 -0
- package/dist/agents/agent-loader.js +165 -146
- package/dist/agents/agent-loader.js.map +1 -1
- package/dist/cli/config-manager.js +91 -109
- package/dist/cli/config-manager.js.map +1 -1
- package/dist/integration/DatabaseHandoff.js +507 -0
- package/dist/integration/DatabaseHandoff.js.map +1 -0
- package/dist/integration/StandardAdapter.js +291 -0
- package/dist/integration/StandardAdapter.js.map +1 -0
- package/dist/lib/agent-output-parser.js +518 -0
- package/dist/lib/agent-output-parser.js.map +1 -0
- package/dist/lib/agent-output-validator.js +950 -0
- package/dist/lib/agent-output-validator.js.map +1 -0
- package/dist/lib/artifact-registry.js +443 -0
- package/dist/lib/artifact-registry.js.map +1 -0
- package/dist/lib/config-validator.js +687 -0
- package/dist/lib/config-validator.js.map +1 -0
- package/dist/types/agent-output.js +44 -0
- package/dist/types/agent-output.js.map +1 -0
- package/dist/types/config.js +28 -0
- package/dist/types/config.js.map +1 -0
- package/package.json +2 -1
- package/scripts/artifact-cleanup.sh +392 -0
- package/scripts/build-linux.sh +78 -0
- package/scripts/deploy-production.sh +355 -355
- package/scripts/docker-playwright-fix.sh +311 -311
- package/scripts/docker-rebuild-all-agents.sh +127 -127
- package/scripts/memory-leak-prevention.sh +305 -305
- package/scripts/migrate-artifacts.sh +563 -0
- package/scripts/migrate-yaml-to-json.sh +465 -0
- package/scripts/run-marketing-tests.sh +42 -42
- package/scripts/update_paths.sh +46 -46
|
@@ -1,264 +1,264 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# CFN Task Config Initialization Script
|
|
3
|
-
# Generates structured task configuration for Task Mode
|
|
4
|
-
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
|
|
7
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
8
|
-
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
|
9
|
-
|
|
10
|
-
# Parse arguments
|
|
11
|
-
TASK_DESCRIPTION=""
|
|
12
|
-
MODE="standard"
|
|
13
|
-
TASK_ID=""
|
|
14
|
-
|
|
15
|
-
while [[ $# -gt 0 ]]; do
|
|
16
|
-
case $1 in
|
|
17
|
-
--task-description)
|
|
18
|
-
TASK_DESCRIPTION="$2"
|
|
19
|
-
shift 2
|
|
20
|
-
;;
|
|
21
|
-
--mode)
|
|
22
|
-
MODE="$2"
|
|
23
|
-
shift 2
|
|
24
|
-
;;
|
|
25
|
-
--task-id)
|
|
26
|
-
TASK_ID="$2"
|
|
27
|
-
shift 2
|
|
28
|
-
;;
|
|
29
|
-
*)
|
|
30
|
-
echo "Unknown option: $1" >&2
|
|
31
|
-
exit 1
|
|
32
|
-
;;
|
|
33
|
-
esac
|
|
34
|
-
done
|
|
35
|
-
|
|
36
|
-
# Validate required parameters
|
|
37
|
-
if [ -z "$TASK_DESCRIPTION" ] || [ -z "$TASK_ID" ]; then
|
|
38
|
-
echo "ERROR: Missing required parameters" >&2
|
|
39
|
-
echo "Usage: $0 --task-description <desc> --task-id <id> [--mode <mode>]" >&2
|
|
40
|
-
exit 1
|
|
41
|
-
fi
|
|
42
|
-
|
|
43
|
-
# Validate mode
|
|
44
|
-
case "$MODE" in
|
|
45
|
-
mvp|standard|enterprise) ;;
|
|
46
|
-
*)
|
|
47
|
-
echo "WARNING: Invalid mode '$MODE', defaulting to 'standard'" >&2
|
|
48
|
-
MODE="standard"
|
|
49
|
-
;;
|
|
50
|
-
esac
|
|
51
|
-
|
|
52
|
-
# Create config directory
|
|
53
|
-
CONFIG_DIR="$PROJECT_ROOT/.cfn/task-configs"
|
|
54
|
-
mkdir -p "$CONFIG_DIR"
|
|
55
|
-
|
|
56
|
-
CONFIG_FILE="$CONFIG_DIR/task-${TASK_ID}.json"
|
|
57
|
-
|
|
58
|
-
# Extract epic goal (first sentence or summary)
|
|
59
|
-
EPIC_GOAL=$(echo "$TASK_DESCRIPTION" | head -1 | sed 's/[[:space:]]*$//')
|
|
60
|
-
|
|
61
|
-
# Infer scope from task description
|
|
62
|
-
extract_scope() {
|
|
63
|
-
local description="$1"
|
|
64
|
-
local in_scope=()
|
|
65
|
-
local out_scope=()
|
|
66
|
-
local deliverables=()
|
|
67
|
-
local directory="."
|
|
68
|
-
local acceptance=()
|
|
69
|
-
|
|
70
|
-
# Technology detection
|
|
71
|
-
if echo "$description" | grep -iq "jwt\|auth\|oauth"; then
|
|
72
|
-
in_scope+=("JWT token generation and validation")
|
|
73
|
-
in_scope+=("Authentication middleware")
|
|
74
|
-
deliverables+=("src/auth/jwt.ts" "src/auth/middleware.ts" "tests/auth.test.ts")
|
|
75
|
-
directory="src/auth"
|
|
76
|
-
acceptance+=("JWT tokens expire correctly")
|
|
77
|
-
acceptance+=("Authentication tests pass with >80% coverage")
|
|
78
|
-
out_scope+=("Multi-factor authentication")
|
|
79
|
-
out_scope+=("Biometric login")
|
|
80
|
-
fi
|
|
81
|
-
|
|
82
|
-
if echo "$description" | grep -iq "api\|backend\|server"; then
|
|
83
|
-
in_scope+=("REST API implementation")
|
|
84
|
-
in_scope+=("Request validation")
|
|
85
|
-
deliverables+=("src/api/routes.ts" "src/api/controllers.ts")
|
|
86
|
-
acceptance+=("API endpoints return correct status codes")
|
|
87
|
-
acceptance+=("Request validation handles edge cases")
|
|
88
|
-
out_scope+=("GraphQL support")
|
|
89
|
-
out_scope+=("WebSocket real-time features")
|
|
90
|
-
fi
|
|
91
|
-
|
|
92
|
-
if echo "$description" | grep -iq "database\|schema\|migration"; then
|
|
93
|
-
in_scope+=("Database schema design")
|
|
94
|
-
in_scope+=("Migration scripts")
|
|
95
|
-
deliverables+=("src/db/schema.sql" "src/db/migrations/")
|
|
96
|
-
acceptance+=("Migrations run without errors")
|
|
97
|
-
acceptance+=("Database constraints enforced")
|
|
98
|
-
out_scope+=("Database sharding")
|
|
99
|
-
out_scope+=("Multi-region replication")
|
|
100
|
-
fi
|
|
101
|
-
|
|
102
|
-
if echo "$description" | grep -iq "test\|testing"; then
|
|
103
|
-
in_scope+=("Unit tests")
|
|
104
|
-
in_scope+=("Integration tests")
|
|
105
|
-
deliverables+=("tests/unit/" "tests/integration/")
|
|
106
|
-
acceptance+=("Test coverage >80%")
|
|
107
|
-
acceptance+=("All tests pass")
|
|
108
|
-
out_scope+=("End-to-end tests")
|
|
109
|
-
out_scope+=("Performance benchmarks")
|
|
110
|
-
fi
|
|
111
|
-
|
|
112
|
-
# Default scope if nothing matched
|
|
113
|
-
if [ ${#in_scope[@]} -eq 0 ]; then
|
|
114
|
-
in_scope+=("Core functionality implementation")
|
|
115
|
-
in_scope+=("Basic error handling")
|
|
116
|
-
deliverables+=("src/main.ts" "tests/main.test.ts")
|
|
117
|
-
acceptance+=("Core features work as specified")
|
|
118
|
-
acceptance+=("Basic tests pass")
|
|
119
|
-
out_scope+=("Advanced features")
|
|
120
|
-
out_scope+=("Performance optimization")
|
|
121
|
-
fi
|
|
122
|
-
|
|
123
|
-
# Always add common out-of-scope items
|
|
124
|
-
out_scope+=("User analytics and tracking")
|
|
125
|
-
out_scope+=("Admin dashboard UI")
|
|
126
|
-
out_scope+=("Monitoring and alerting")
|
|
127
|
-
|
|
128
|
-
# Build JSON arrays
|
|
129
|
-
local in_scope_json=$(printf '%s\n' "${in_scope[@]}" | jq -R . | jq -s .)
|
|
130
|
-
local out_scope_json=$(printf '%s\n' "${out_scope[@]}" | jq -R . | jq -s .)
|
|
131
|
-
local deliverables_json=$(printf '%s\n' "${deliverables[@]}" | jq -R . | jq -s .)
|
|
132
|
-
local acceptance_json=$(printf '%s\n' "${acceptance[@]}" | jq -R . | jq -s .)
|
|
133
|
-
|
|
134
|
-
# Return as JSON object
|
|
135
|
-
jq -n \
|
|
136
|
-
--arg goal "$EPIC_GOAL" \
|
|
137
|
-
--argjson in_scope "$in_scope_json" \
|
|
138
|
-
--argjson out_scope "$out_scope_json" \
|
|
139
|
-
--argjson deliverables "$deliverables_json" \
|
|
140
|
-
--arg directory "$directory" \
|
|
141
|
-
--argjson acceptance "$acceptance_json" \
|
|
142
|
-
'{
|
|
143
|
-
epicGoal: $goal,
|
|
144
|
-
inScope: $in_scope,
|
|
145
|
-
outOfScope: $out_scope,
|
|
146
|
-
deliverables: $deliverables,
|
|
147
|
-
directory: $directory,
|
|
148
|
-
acceptanceCriteria: $acceptance
|
|
149
|
-
}'
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
# Select agents based on task description
|
|
153
|
-
select_agents() {
|
|
154
|
-
local description="$1"
|
|
155
|
-
local loop3=()
|
|
156
|
-
local loop2=("reviewer" "tester")
|
|
157
|
-
|
|
158
|
-
# Loop 3 implementers
|
|
159
|
-
if echo "$description" | grep -iq "api\|backend\|server"; then
|
|
160
|
-
loop3+=("backend-dev")
|
|
161
|
-
fi
|
|
162
|
-
|
|
163
|
-
if echo "$description" | grep -iq "frontend\|react\|vue\|ui"; then
|
|
164
|
-
loop3+=("react-frontend-engineer")
|
|
165
|
-
fi
|
|
166
|
-
|
|
167
|
-
if echo "$description" | grep -iq "mobile\|ios\|android"; then
|
|
168
|
-
loop3+=("mobile-dev")
|
|
169
|
-
fi
|
|
170
|
-
|
|
171
|
-
if echo "$description" | grep -iq "infrastructure\|deploy\|devops\|docker\|k8s"; then
|
|
172
|
-
loop3+=("devops-engineer")
|
|
173
|
-
fi
|
|
174
|
-
|
|
175
|
-
if echo "$description" | grep -iq "npm\|package\|library"; then
|
|
176
|
-
loop3+=("npm-package-specialist")
|
|
177
|
-
fi
|
|
178
|
-
|
|
179
|
-
if echo "$description" | grep -iq "research\|analyze\|investigate"; then
|
|
180
|
-
loop3+=("researcher")
|
|
181
|
-
fi
|
|
182
|
-
|
|
183
|
-
# Default implementer
|
|
184
|
-
if [ ${#loop3[@]} -eq 0 ]; then
|
|
185
|
-
loop3+=("backend-dev" "researcher")
|
|
186
|
-
fi
|
|
187
|
-
|
|
188
|
-
# Loop 2 validators (adaptive scaling)
|
|
189
|
-
# Standard: 3-5 files → add architect, security
|
|
190
|
-
loop2+=("architect" "security-specialist")
|
|
191
|
-
|
|
192
|
-
# Complex/Enterprise: >5 files → add code-analyzer
|
|
193
|
-
if echo "$description" | grep -iq "large\|complex\|enterprise"; then
|
|
194
|
-
loop2+=("code-analyzer")
|
|
195
|
-
fi
|
|
196
|
-
|
|
197
|
-
# Build JSON arrays
|
|
198
|
-
local loop3_json=$(printf '%s\n' "${loop3[@]}" | jq -R . | jq -s .)
|
|
199
|
-
local loop2_json=$(printf '%s\n' "${loop2[@]}" | jq -R . | jq -s .)
|
|
200
|
-
|
|
201
|
-
jq -n \
|
|
202
|
-
--argjson loop3 "$loop3_json" \
|
|
203
|
-
--argjson loop2 "$loop2_json" \
|
|
204
|
-
'{
|
|
205
|
-
loop3: $loop3,
|
|
206
|
-
loop2: $loop2
|
|
207
|
-
}'
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
# Get thresholds based on mode
|
|
211
|
-
get_thresholds() {
|
|
212
|
-
local mode="$1"
|
|
213
|
-
|
|
214
|
-
case "$mode" in
|
|
215
|
-
mvp)
|
|
216
|
-
echo '{"gate": 0.70, "consensus": 0.80, "maxIterations": 5}'
|
|
217
|
-
;;
|
|
218
|
-
enterprise)
|
|
219
|
-
echo '{"gate": 0.85, "consensus": 0.95, "maxIterations": 15}'
|
|
220
|
-
;;
|
|
221
|
-
*)
|
|
222
|
-
echo '{"gate": 0.75, "consensus": 0.90, "maxIterations": 10}'
|
|
223
|
-
;;
|
|
224
|
-
esac
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
# Generate config
|
|
228
|
-
SCOPE_JSON=$(extract_scope "$TASK_DESCRIPTION")
|
|
229
|
-
AGENTS_JSON=$(select_agents "$TASK_DESCRIPTION")
|
|
230
|
-
THRESHOLDS_JSON=$(get_thresholds "$MODE")
|
|
231
|
-
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
232
|
-
|
|
233
|
-
CONFIG_JSON=$(jq -n \
|
|
234
|
-
--arg task_id "$TASK_ID" \
|
|
235
|
-
--arg description "$TASK_DESCRIPTION" \
|
|
236
|
-
--arg mode "$MODE" \
|
|
237
|
-
--argjson scope "$SCOPE_JSON" \
|
|
238
|
-
--argjson agents "$AGENTS_JSON" \
|
|
239
|
-
--argjson thresholds "$THRESHOLDS_JSON" \
|
|
240
|
-
--arg created "$TIMESTAMP" \
|
|
241
|
-
'{
|
|
242
|
-
taskId: $task_id,
|
|
243
|
-
taskDescription: $description,
|
|
244
|
-
mode: $mode,
|
|
245
|
-
spawnMode: "task",
|
|
246
|
-
scope: $scope,
|
|
247
|
-
agents: $agents,
|
|
248
|
-
thresholds: $thresholds,
|
|
249
|
-
createdAt: $created
|
|
250
|
-
}')
|
|
251
|
-
|
|
252
|
-
# Write config file
|
|
253
|
-
echo "$CONFIG_JSON" | jq . > "$CONFIG_FILE"
|
|
254
|
-
|
|
255
|
-
# Validate JSON
|
|
256
|
-
if ! jq empty "$CONFIG_FILE" 2>/dev/null; then
|
|
257
|
-
echo "❌ Failed to create valid JSON config" >&2
|
|
258
|
-
rm -f "$CONFIG_FILE"
|
|
259
|
-
exit 1
|
|
260
|
-
fi
|
|
261
|
-
|
|
262
|
-
# Success
|
|
263
|
-
echo "✅ Config initialized: $CONFIG_FILE" >&2
|
|
264
|
-
echo "$CONFIG_FILE"
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# CFN Task Config Initialization Script
|
|
3
|
+
# Generates structured task configuration for Task Mode
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
8
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
|
9
|
+
|
|
10
|
+
# Parse arguments
|
|
11
|
+
TASK_DESCRIPTION=""
|
|
12
|
+
MODE="standard"
|
|
13
|
+
TASK_ID=""
|
|
14
|
+
|
|
15
|
+
while [[ $# -gt 0 ]]; do
|
|
16
|
+
case $1 in
|
|
17
|
+
--task-description)
|
|
18
|
+
TASK_DESCRIPTION="$2"
|
|
19
|
+
shift 2
|
|
20
|
+
;;
|
|
21
|
+
--mode)
|
|
22
|
+
MODE="$2"
|
|
23
|
+
shift 2
|
|
24
|
+
;;
|
|
25
|
+
--task-id)
|
|
26
|
+
TASK_ID="$2"
|
|
27
|
+
shift 2
|
|
28
|
+
;;
|
|
29
|
+
*)
|
|
30
|
+
echo "Unknown option: $1" >&2
|
|
31
|
+
exit 1
|
|
32
|
+
;;
|
|
33
|
+
esac
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
# Validate required parameters
|
|
37
|
+
if [ -z "$TASK_DESCRIPTION" ] || [ -z "$TASK_ID" ]; then
|
|
38
|
+
echo "ERROR: Missing required parameters" >&2
|
|
39
|
+
echo "Usage: $0 --task-description <desc> --task-id <id> [--mode <mode>]" >&2
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Validate mode
|
|
44
|
+
case "$MODE" in
|
|
45
|
+
mvp|standard|enterprise) ;;
|
|
46
|
+
*)
|
|
47
|
+
echo "WARNING: Invalid mode '$MODE', defaulting to 'standard'" >&2
|
|
48
|
+
MODE="standard"
|
|
49
|
+
;;
|
|
50
|
+
esac
|
|
51
|
+
|
|
52
|
+
# Create config directory
|
|
53
|
+
CONFIG_DIR="$PROJECT_ROOT/.cfn/task-configs"
|
|
54
|
+
mkdir -p "$CONFIG_DIR"
|
|
55
|
+
|
|
56
|
+
CONFIG_FILE="$CONFIG_DIR/task-${TASK_ID}.json"
|
|
57
|
+
|
|
58
|
+
# Extract epic goal (first sentence or summary)
|
|
59
|
+
EPIC_GOAL=$(echo "$TASK_DESCRIPTION" | head -1 | sed 's/[[:space:]]*$//')
|
|
60
|
+
|
|
61
|
+
# Infer scope from task description
|
|
62
|
+
extract_scope() {
|
|
63
|
+
local description="$1"
|
|
64
|
+
local in_scope=()
|
|
65
|
+
local out_scope=()
|
|
66
|
+
local deliverables=()
|
|
67
|
+
local directory="."
|
|
68
|
+
local acceptance=()
|
|
69
|
+
|
|
70
|
+
# Technology detection
|
|
71
|
+
if echo "$description" | grep -iq "jwt\|auth\|oauth"; then
|
|
72
|
+
in_scope+=("JWT token generation and validation")
|
|
73
|
+
in_scope+=("Authentication middleware")
|
|
74
|
+
deliverables+=("src/auth/jwt.ts" "src/auth/middleware.ts" "tests/auth.test.ts")
|
|
75
|
+
directory="src/auth"
|
|
76
|
+
acceptance+=("JWT tokens expire correctly")
|
|
77
|
+
acceptance+=("Authentication tests pass with >80% coverage")
|
|
78
|
+
out_scope+=("Multi-factor authentication")
|
|
79
|
+
out_scope+=("Biometric login")
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
if echo "$description" | grep -iq "api\|backend\|server"; then
|
|
83
|
+
in_scope+=("REST API implementation")
|
|
84
|
+
in_scope+=("Request validation")
|
|
85
|
+
deliverables+=("src/api/routes.ts" "src/api/controllers.ts")
|
|
86
|
+
acceptance+=("API endpoints return correct status codes")
|
|
87
|
+
acceptance+=("Request validation handles edge cases")
|
|
88
|
+
out_scope+=("GraphQL support")
|
|
89
|
+
out_scope+=("WebSocket real-time features")
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
if echo "$description" | grep -iq "database\|schema\|migration"; then
|
|
93
|
+
in_scope+=("Database schema design")
|
|
94
|
+
in_scope+=("Migration scripts")
|
|
95
|
+
deliverables+=("src/db/schema.sql" "src/db/migrations/")
|
|
96
|
+
acceptance+=("Migrations run without errors")
|
|
97
|
+
acceptance+=("Database constraints enforced")
|
|
98
|
+
out_scope+=("Database sharding")
|
|
99
|
+
out_scope+=("Multi-region replication")
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
if echo "$description" | grep -iq "test\|testing"; then
|
|
103
|
+
in_scope+=("Unit tests")
|
|
104
|
+
in_scope+=("Integration tests")
|
|
105
|
+
deliverables+=("tests/unit/" "tests/integration/")
|
|
106
|
+
acceptance+=("Test coverage >80%")
|
|
107
|
+
acceptance+=("All tests pass")
|
|
108
|
+
out_scope+=("End-to-end tests")
|
|
109
|
+
out_scope+=("Performance benchmarks")
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
# Default scope if nothing matched
|
|
113
|
+
if [ ${#in_scope[@]} -eq 0 ]; then
|
|
114
|
+
in_scope+=("Core functionality implementation")
|
|
115
|
+
in_scope+=("Basic error handling")
|
|
116
|
+
deliverables+=("src/main.ts" "tests/main.test.ts")
|
|
117
|
+
acceptance+=("Core features work as specified")
|
|
118
|
+
acceptance+=("Basic tests pass")
|
|
119
|
+
out_scope+=("Advanced features")
|
|
120
|
+
out_scope+=("Performance optimization")
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
# Always add common out-of-scope items
|
|
124
|
+
out_scope+=("User analytics and tracking")
|
|
125
|
+
out_scope+=("Admin dashboard UI")
|
|
126
|
+
out_scope+=("Monitoring and alerting")
|
|
127
|
+
|
|
128
|
+
# Build JSON arrays
|
|
129
|
+
local in_scope_json=$(printf '%s\n' "${in_scope[@]}" | jq -R . | jq -s .)
|
|
130
|
+
local out_scope_json=$(printf '%s\n' "${out_scope[@]}" | jq -R . | jq -s .)
|
|
131
|
+
local deliverables_json=$(printf '%s\n' "${deliverables[@]}" | jq -R . | jq -s .)
|
|
132
|
+
local acceptance_json=$(printf '%s\n' "${acceptance[@]}" | jq -R . | jq -s .)
|
|
133
|
+
|
|
134
|
+
# Return as JSON object
|
|
135
|
+
jq -n \
|
|
136
|
+
--arg goal "$EPIC_GOAL" \
|
|
137
|
+
--argjson in_scope "$in_scope_json" \
|
|
138
|
+
--argjson out_scope "$out_scope_json" \
|
|
139
|
+
--argjson deliverables "$deliverables_json" \
|
|
140
|
+
--arg directory "$directory" \
|
|
141
|
+
--argjson acceptance "$acceptance_json" \
|
|
142
|
+
'{
|
|
143
|
+
epicGoal: $goal,
|
|
144
|
+
inScope: $in_scope,
|
|
145
|
+
outOfScope: $out_scope,
|
|
146
|
+
deliverables: $deliverables,
|
|
147
|
+
directory: $directory,
|
|
148
|
+
acceptanceCriteria: $acceptance
|
|
149
|
+
}'
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
# Select agents based on task description
|
|
153
|
+
select_agents() {
|
|
154
|
+
local description="$1"
|
|
155
|
+
local loop3=()
|
|
156
|
+
local loop2=("reviewer" "tester")
|
|
157
|
+
|
|
158
|
+
# Loop 3 implementers
|
|
159
|
+
if echo "$description" | grep -iq "api\|backend\|server"; then
|
|
160
|
+
loop3+=("backend-dev")
|
|
161
|
+
fi
|
|
162
|
+
|
|
163
|
+
if echo "$description" | grep -iq "frontend\|react\|vue\|ui"; then
|
|
164
|
+
loop3+=("react-frontend-engineer")
|
|
165
|
+
fi
|
|
166
|
+
|
|
167
|
+
if echo "$description" | grep -iq "mobile\|ios\|android"; then
|
|
168
|
+
loop3+=("mobile-dev")
|
|
169
|
+
fi
|
|
170
|
+
|
|
171
|
+
if echo "$description" | grep -iq "infrastructure\|deploy\|devops\|docker\|k8s"; then
|
|
172
|
+
loop3+=("devops-engineer")
|
|
173
|
+
fi
|
|
174
|
+
|
|
175
|
+
if echo "$description" | grep -iq "npm\|package\|library"; then
|
|
176
|
+
loop3+=("npm-package-specialist")
|
|
177
|
+
fi
|
|
178
|
+
|
|
179
|
+
if echo "$description" | grep -iq "research\|analyze\|investigate"; then
|
|
180
|
+
loop3+=("researcher")
|
|
181
|
+
fi
|
|
182
|
+
|
|
183
|
+
# Default implementer
|
|
184
|
+
if [ ${#loop3[@]} -eq 0 ]; then
|
|
185
|
+
loop3+=("backend-dev" "researcher")
|
|
186
|
+
fi
|
|
187
|
+
|
|
188
|
+
# Loop 2 validators (adaptive scaling)
|
|
189
|
+
# Standard: 3-5 files → add architect, security
|
|
190
|
+
loop2+=("architect" "security-specialist")
|
|
191
|
+
|
|
192
|
+
# Complex/Enterprise: >5 files → add code-analyzer
|
|
193
|
+
if echo "$description" | grep -iq "large\|complex\|enterprise"; then
|
|
194
|
+
loop2+=("code-analyzer")
|
|
195
|
+
fi
|
|
196
|
+
|
|
197
|
+
# Build JSON arrays
|
|
198
|
+
local loop3_json=$(printf '%s\n' "${loop3[@]}" | jq -R . | jq -s .)
|
|
199
|
+
local loop2_json=$(printf '%s\n' "${loop2[@]}" | jq -R . | jq -s .)
|
|
200
|
+
|
|
201
|
+
jq -n \
|
|
202
|
+
--argjson loop3 "$loop3_json" \
|
|
203
|
+
--argjson loop2 "$loop2_json" \
|
|
204
|
+
'{
|
|
205
|
+
loop3: $loop3,
|
|
206
|
+
loop2: $loop2
|
|
207
|
+
}'
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
# Get thresholds based on mode
|
|
211
|
+
get_thresholds() {
|
|
212
|
+
local mode="$1"
|
|
213
|
+
|
|
214
|
+
case "$mode" in
|
|
215
|
+
mvp)
|
|
216
|
+
echo '{"gate": 0.70, "consensus": 0.80, "maxIterations": 5}'
|
|
217
|
+
;;
|
|
218
|
+
enterprise)
|
|
219
|
+
echo '{"gate": 0.85, "consensus": 0.95, "maxIterations": 15}'
|
|
220
|
+
;;
|
|
221
|
+
*)
|
|
222
|
+
echo '{"gate": 0.75, "consensus": 0.90, "maxIterations": 10}'
|
|
223
|
+
;;
|
|
224
|
+
esac
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
# Generate config
|
|
228
|
+
SCOPE_JSON=$(extract_scope "$TASK_DESCRIPTION")
|
|
229
|
+
AGENTS_JSON=$(select_agents "$TASK_DESCRIPTION")
|
|
230
|
+
THRESHOLDS_JSON=$(get_thresholds "$MODE")
|
|
231
|
+
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
232
|
+
|
|
233
|
+
CONFIG_JSON=$(jq -n \
|
|
234
|
+
--arg task_id "$TASK_ID" \
|
|
235
|
+
--arg description "$TASK_DESCRIPTION" \
|
|
236
|
+
--arg mode "$MODE" \
|
|
237
|
+
--argjson scope "$SCOPE_JSON" \
|
|
238
|
+
--argjson agents "$AGENTS_JSON" \
|
|
239
|
+
--argjson thresholds "$THRESHOLDS_JSON" \
|
|
240
|
+
--arg created "$TIMESTAMP" \
|
|
241
|
+
'{
|
|
242
|
+
taskId: $task_id,
|
|
243
|
+
taskDescription: $description,
|
|
244
|
+
mode: $mode,
|
|
245
|
+
spawnMode: "task",
|
|
246
|
+
scope: $scope,
|
|
247
|
+
agents: $agents,
|
|
248
|
+
thresholds: $thresholds,
|
|
249
|
+
createdAt: $created
|
|
250
|
+
}')
|
|
251
|
+
|
|
252
|
+
# Write config file
|
|
253
|
+
echo "$CONFIG_JSON" | jq . > "$CONFIG_FILE"
|
|
254
|
+
|
|
255
|
+
# Validate JSON
|
|
256
|
+
if ! jq empty "$CONFIG_FILE" 2>/dev/null; then
|
|
257
|
+
echo "❌ Failed to create valid JSON config" >&2
|
|
258
|
+
rm -f "$CONFIG_FILE"
|
|
259
|
+
exit 1
|
|
260
|
+
fi
|
|
261
|
+
|
|
262
|
+
# Success
|
|
263
|
+
echo "✅ Config initialized: $CONFIG_FILE" >&2
|
|
264
|
+
echo "$CONFIG_FILE"
|