claude-flow-novice 2.14.0 → 2.14.2
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/CFN_LOOP_TASK_MODE.md → CFN_LOOP_TASK_MODE.md} +50 -3
- 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/CFN_LOOP_TASK_MODE.md → CFN_LOOP_TASK_MODE.md} +50 -3
- package/claude-assets/commands/auto-compact.md +80 -0
- package/claude-assets/commands/cfn-loop-cli.md +279 -0
- package/{.claude/commands/cfn → claude-assets/commands}/cfn-loop-document.md +20 -1
- package/claude-assets/commands/cfn-loop-epic.md +478 -0
- package/{.claude/commands/cfn → claude-assets/commands}/cfn-loop-frontend.md +17 -2
- package/claude-assets/commands/cfn-loop-single.md +256 -0
- package/claude-assets/commands/cfn-loop-sprints.md +396 -0
- package/claude-assets/commands/cfn-loop-task.md +460 -0
- package/claude-assets/commands/cfn-loop.md +518 -0
- package/claude-assets/commands/claude-md.md +64 -0
- package/claude-assets/commands/claude-soul.md +22 -0
- package/{.claude/commands/cfn → claude-assets/commands}/context-curate.md +27 -38
- package/{.claude/commands/cfn → claude-assets/commands}/context-inject.md +14 -25
- package/{.claude/commands/cfn → claude-assets/commands}/context-query.md +40 -45
- package/{.claude/commands/cfn → claude-assets/commands}/context-reflect.md +40 -38
- package/{.claude/commands/cfn → claude-assets/commands}/context-stats.md +13 -38
- package/claude-assets/commands/cost-savings-off.md +35 -0
- package/claude-assets/commands/cost-savings-on.md +35 -0
- package/claude-assets/commands/cost-savings-status.md +34 -0
- package/claude-assets/commands/custom-routing-activate.md +55 -0
- package/claude-assets/commands/custom-routing-deactivate.md +46 -0
- package/claude-assets/commands/dependency-recommendations.md +171 -0
- package/claude-assets/commands/fullstack.md +179 -0
- package/claude-assets/commands/github.md +221 -0
- package/claude-assets/commands/hooks.md +38 -0
- package/claude-assets/commands/launch-web-dashboard.md +0 -0
- package/{.claude/commands/cfn → claude-assets/commands}/list-agents-rebuild.md +18 -18
- package/claude-assets/commands/metrics-summary.md +58 -0
- package/claude-assets/commands/neural.md +39 -0
- package/claude-assets/commands/parse-epic.md +357 -0
- package/claude-assets/commands/performance.md +41 -0
- package/claude-assets/commands/sparc.md +46 -0
- package/claude-assets/commands/suggest-improvements.md +95 -0
- package/claude-assets/commands/suggest-templates.md +147 -0
- package/claude-assets/commands/swarm.md +24 -0
- package/claude-assets/commands/write-plan.md +275 -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/cli/config-manager.js +109 -91
- package/dist/cli/config-manager.js.map +1 -1
- package/package.json +3 -3
- package/.claude/commands/cfn/README.md +0 -157
- package/.claude/commands/cfn/launch-web-dashboard.md +0 -295
- package/.claude/commands/cfn/write-plan.md +0 -104
- 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
- /package/.claude/commands/{cfn/CFN_COORDINATOR_PARAMETERS.md → CFN_COORDINATOR_PARAMETERS.md} +0 -0
- /package/.claude/commands/{cfn/CFN_LOOP_FRONTEND.md → CFN_LOOP_FRONTEND.md} +0 -0
- /package/.claude/commands/{cfn/auto-compact.md → auto-compact.md} +0 -0
- /package/.claude/commands/{cfn/cfn-claude-sync.md → cfn-claude-sync.md} +0 -0
- /package/{claude-assets/commands/cfn → .claude/commands}/cfn-loop-cli.md +0 -0
- /package/{claude-assets/commands/cfn → .claude/commands}/cfn-loop-document.md +0 -0
- /package/.claude/commands/{cfn/cfn-loop-epic.md → cfn-loop-epic.md} +0 -0
- /package/{claude-assets/commands/cfn → .claude/commands}/cfn-loop-frontend.md +0 -0
- /package/.claude/commands/{cfn/cfn-loop-single.md → cfn-loop-single.md} +0 -0
- /package/.claude/commands/{cfn/cfn-loop-sprints.md → cfn-loop-sprints.md} +0 -0
- /package/{claude-assets/commands/cfn → .claude/commands}/cfn-loop-task.md +0 -0
- /package/.claude/commands/{cfn/cfn-loop.md → cfn-loop.md} +0 -0
- /package/.claude/commands/{cfn/cfn-mode.md → cfn-mode.md} +0 -0
- /package/.claude/commands/{cfn/cfn-optimize-agents.md → cfn-optimize-agents.md} +0 -0
- /package/.claude/commands/{cfn/claude-md.md → claude-md.md} +0 -0
- /package/.claude/commands/{cfn/claude-soul.md → claude-soul.md} +0 -0
- /package/{claude-assets/commands/cfn → .claude/commands}/context-curate.md +0 -0
- /package/{claude-assets/commands/cfn → .claude/commands}/context-inject.md +0 -0
- /package/{claude-assets/commands/cfn → .claude/commands}/context-query.md +0 -0
- /package/{claude-assets/commands/cfn → .claude/commands}/context-reflect.md +0 -0
- /package/{claude-assets/commands/cfn → .claude/commands}/context-stats.md +0 -0
- /package/.claude/commands/{cfn/cost-savings-off.md → cost-savings-off.md} +0 -0
- /package/.claude/commands/{cfn/cost-savings-on.md → cost-savings-on.md} +0 -0
- /package/.claude/commands/{cfn/cost-savings-status.md → cost-savings-status.md} +0 -0
- /package/.claude/commands/{cfn/custom-routing-activate.md → custom-routing-activate.md} +0 -0
- /package/.claude/commands/{cfn/custom-routing-deactivate.md → custom-routing-deactivate.md} +0 -0
- /package/.claude/commands/{cfn/dependency-recommendations.md → dependency-recommendations.md} +0 -0
- /package/.claude/commands/{cfn/fullstack.md → fullstack.md} +0 -0
- /package/.claude/commands/{cfn/github-commit.md → github-commit.md} +0 -0
- /package/.claude/commands/{cfn/github.md → github.md} +0 -0
- /package/.claude/commands/{cfn/hello-world-tests.md → hello-world-tests.md} +0 -0
- /package/.claude/commands/{cfn/hooks.md → hooks.md} +0 -0
- /package/{claude-assets/commands/cfn → .claude/commands}/launch-web-dashboard.md +0 -0
- /package/{claude-assets/commands/cfn → .claude/commands}/list-agents-rebuild.md +0 -0
- /package/.claude/commands/{cfn/metrics-summary.md → metrics-summary.md} +0 -0
- /package/.claude/commands/{cfn/neural.md → neural.md} +0 -0
- /package/.claude/commands/{cfn/parse-epic.md → parse-epic.md} +0 -0
- /package/.claude/commands/{cfn/performance.md → performance.md} +0 -0
- /package/.claude/commands/{cfn/sparc.md → sparc.md} +0 -0
- /package/.claude/commands/{cfn/suggest-improvements.md → suggest-improvements.md} +0 -0
- /package/.claude/commands/{cfn/suggest-templates.md → suggest-templates.md} +0 -0
- /package/.claude/commands/{cfn/swarm.md → swarm.md} +0 -0
- /package/.claude/commands/{cfn/switch-api.md → switch-api.md} +0 -0
- /package/.claude/commands/{cfn/workflow.md → workflow.md} +0 -0
- /package/{claude-assets/commands/cfn → .claude/commands}/write-plan.md +0 -0
- /package/claude-assets/commands/{cfn/CFN_COORDINATOR_PARAMETERS.md → CFN_COORDINATOR_PARAMETERS.md} +0 -0
- /package/claude-assets/commands/{cfn/CFN_LOOP_FRONTEND.md → CFN_LOOP_FRONTEND.md} +0 -0
- /package/claude-assets/commands/{cfn/README.md → README.md} +0 -0
- /package/claude-assets/commands/{cfn/cfn-claude-sync.md → cfn-claude-sync.md} +0 -0
- /package/claude-assets/commands/{cfn/cfn-mode.md → cfn-mode.md} +0 -0
- /package/claude-assets/commands/{cfn/cfn-optimize-agents.md → cfn-optimize-agents.md} +0 -0
- /package/claude-assets/commands/{cfn/github-commit.md → github-commit.md} +0 -0
- /package/claude-assets/commands/{cfn/hello-world-tests.md → hello-world-tests.md} +0 -0
- /package/claude-assets/commands/{cfn/switch-api.md → switch-api.md} +0 -0
- /package/claude-assets/commands/{cfn/workflow.md → workflow.md} +0 -0
|
@@ -161,7 +161,54 @@ Iterations: Loop 3: ${L3}, Loop 2: ${L2} | Decision: PROCEED
|
|
|
161
161
|
EOF
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
-
### 5.
|
|
164
|
+
### 5. Execute Product Owner Suggested Next Steps
|
|
165
|
+
|
|
166
|
+
**After PROCEED Decision:**
|
|
167
|
+
Product Owner may suggest follow-up tasks (documentation, testing, refactoring). Coordinator (main chat) spawns specialized agents to execute these tasks:
|
|
168
|
+
|
|
169
|
+
```javascript
|
|
170
|
+
// Parse PO feedback for suggested next steps
|
|
171
|
+
const nextSteps = parseFeedback(poOutput, ["documentation", "integration test", "performance optimization"]);
|
|
172
|
+
|
|
173
|
+
// Spawn agents for each next step
|
|
174
|
+
for (const step of nextSteps) {
|
|
175
|
+
if (step.complexity === "simple" && !step.requiresValidation) {
|
|
176
|
+
// Use backlog background worker for simple tasks
|
|
177
|
+
Bash(`
|
|
178
|
+
./.claude/skills/epic-management/add-backlog-item.sh \
|
|
179
|
+
--epic-id "${EPIC_ID}" \
|
|
180
|
+
--title "${step.title}" \
|
|
181
|
+
--priority "P3" \
|
|
182
|
+
--reason "Post-sprint cleanup - low validation needs"
|
|
183
|
+
`, "Defer to background worker");
|
|
184
|
+
} else {
|
|
185
|
+
// Spawn specialist agents for complex tasks
|
|
186
|
+
Task(step.agent, `
|
|
187
|
+
Execute post-sprint task: ${step.description}
|
|
188
|
+
|
|
189
|
+
Context: Sprint ${SPRINT_NUM} completed. ${step.context}
|
|
190
|
+
|
|
191
|
+
Deliverables: ${step.deliverables.join(", ")}
|
|
192
|
+
|
|
193
|
+
Acceptance: ${step.acceptance}
|
|
194
|
+
`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Strategic Backlog Worker Usage:**
|
|
200
|
+
- **Use background worker when:**
|
|
201
|
+
- No overlap with main sprint work (independent tasks)
|
|
202
|
+
- Simple tasks requiring little validation (linting, formatting, simple docs)
|
|
203
|
+
- Tasks validatable via compilation/linting (type fixes, import cleanup)
|
|
204
|
+
- Avoids holding up main CFN Loop (P3 priority items)
|
|
205
|
+
|
|
206
|
+
- **Use Task() agents when:**
|
|
207
|
+
- Complex tasks requiring validation (API changes, security updates)
|
|
208
|
+
- Tasks with dependencies on sprint deliverables
|
|
209
|
+
- Tasks needing consensus (architectural decisions, breaking changes)
|
|
210
|
+
|
|
211
|
+
### 6. ACE Reflection (Optional - If `--ace-reflect` flag enabled)
|
|
165
212
|
```bash
|
|
166
213
|
# Only run if --ace-reflect flag was passed to /cfn-loop command
|
|
167
214
|
if [[ "$ACE_REFLECT_ENABLED" == "true" ]]; then
|
|
@@ -183,8 +230,8 @@ fi
|
|
|
183
230
|
|
|
184
231
|
**Checklist:**
|
|
185
232
|
- [ ] Consensus ≥ threshold | [ ] Product Owner approved | [ ] Deliverables verified
|
|
186
|
-
- [ ] Tests passing | [ ]
|
|
187
|
-
- [ ] ACE reflection captured (if `--ace-reflect` enabled)
|
|
233
|
+
- [ ] Tests passing | [ ] Next steps executed or deferred | [ ] Git committed | [ ] Git pushed
|
|
234
|
+
- [ ] Summary generated | [ ] ACE reflection captured (if `--ace-reflect` enabled)
|
|
188
235
|
|
|
189
236
|
---
|
|
190
237
|
|
|
@@ -22,12 +22,15 @@
|
|
|
22
22
|
* **ALL agent communication MUST use Redis pub/sub** - no direct file coordination
|
|
23
23
|
* **NEVER HARDCODE API KEYS**
|
|
24
24
|
* **sleep on repeat** when monitoring a background process. sleep x minutes, check progress, sleep, repeat
|
|
25
|
+
* **USE GREP INSTEAD OF FIND** - it's less resource intensive in our WSL2 instances
|
|
25
26
|
|
|
26
27
|
**Agent Output Standards:**
|
|
27
28
|
* **Bug documentation**: `docs/BUG_#_*.md` (investigation, fix summary, validation)
|
|
28
29
|
* **Test scripts**: `tests/test-*.sh` (persistent, version controlled)
|
|
29
30
|
* **Feature documentation**: `docs/FEATURE_NAME.md` (architecture, process docs)
|
|
30
31
|
* **Temporary files ONLY**: `/tmp/` (ephemeral test fixtures, scratch data)
|
|
32
|
+
* **Backlog items**: Use `.claude/skills/cfn-backlog-management/add-backlog-item.sh` when deferring work (requires: item, why, solution)
|
|
33
|
+
* **Changelog entries**: Use `.claude/skills/cfn-changelog-management/add-changelog-entry.sh` after feature/bugfix/breaking change (10-100 char summary, sparse impact)
|
|
31
34
|
* **Full guidelines**: `docs/AGENT_OUTPUT_STANDARDS.md`
|
|
32
35
|
|
|
33
36
|
**Consensus thresholds:**
|
|
@@ -85,55 +88,55 @@ npx cfn-init # Copy namespace-isolated files
|
|
|
85
88
|
* Delegate ALL coordination to skills
|
|
86
89
|
* Use skill-specific configuration for complex workflows
|
|
87
90
|
|
|
88
|
-
###
|
|
91
|
+
### CFN Loop Execution Modes
|
|
89
92
|
|
|
90
|
-
**
|
|
93
|
+
**User selects mode. Main Chat executes the specified slash command.**
|
|
91
94
|
|
|
92
|
-
**
|
|
93
|
-
```bash
|
|
94
|
-
# Use slash commands (automatically cost-optimized)
|
|
95
|
-
/cfn-loop "Implement feature" --mode=standard
|
|
96
|
-
/cfn-loop-single "Fix bug"
|
|
97
|
-
/cfn-loop-epic "Build system"
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
**Core Coordinators:**
|
|
101
|
-
|
|
102
|
-
| Coordinator | Spawning Method | Cost Savings | Use Case |
|
|
103
|
-
|-------------|----------------|--------------|----------|
|
|
104
|
-
| `cfn-v3-coordinator` | CLI | 95-98% | CFN Loops |
|
|
105
|
-
| `cost-savings-coordinator` | CLI | 95-98% | General tasks |
|
|
95
|
+
**Default: Task Mode** (if user doesn't specify mode)
|
|
106
96
|
|
|
107
|
-
**
|
|
108
|
-
Main Chat → Single coordinator agent → Coordinator spawns workers via CLI → 95-98% cost savings
|
|
97
|
+
**Available modes:**
|
|
109
98
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
**Two spawning modes:**
|
|
113
|
-
1. **CLI Mode** (default): Cost-optimized, Redis context, Z.ai routing
|
|
114
|
-
2. **Task Mode**: Simplified, direct injection, Anthropic routing
|
|
115
|
-
|
|
116
|
-
**Mode Selection:**
|
|
99
|
+
**1. Task Mode (Default):**
|
|
117
100
|
```bash
|
|
118
|
-
|
|
119
|
-
|
|
101
|
+
/cfn-loop-task "Task description" --mode=standard
|
|
102
|
+
```
|
|
103
|
+
- Main Chat spawns ALL agents via Task()
|
|
104
|
+
- NO coordinator agent
|
|
105
|
+
- Cost: $0.150/iteration
|
|
106
|
+
- Full visibility in Main Chat
|
|
107
|
+
- Use: Debugging, learning, short tasks (<5 min)
|
|
120
108
|
|
|
121
|
-
|
|
122
|
-
|
|
109
|
+
**2. CLI Mode (Production):**
|
|
110
|
+
```bash
|
|
111
|
+
/cfn-loop-cli "Task description" --mode=standard
|
|
123
112
|
```
|
|
113
|
+
- Main Chat spawns ONLY cfn-v3-coordinator
|
|
114
|
+
- Coordinator spawns workers via CLI (background)
|
|
115
|
+
- Cost: $0.054/iteration (64% savings vs Task)
|
|
116
|
+
- Use: Production, long tasks, cost-sensitive
|
|
117
|
+
|
|
118
|
+
**Mode selection guidance for users:**
|
|
119
|
+
- "execute cfn loop on X" → `/cfn-loop-task` (default)
|
|
120
|
+
- "use task mode on X" → `/cfn-loop-task`
|
|
121
|
+
- "use cli mode on X" → `/cfn-loop-cli`
|
|
122
|
+
- "production cfn loop on X" → `/cfn-loop-cli`
|
|
123
|
+
|
|
124
|
+
**Architecture patterns:**
|
|
125
|
+
- CLI: Main Chat → cfn-v3-coordinator → orchestrate.sh → CLI workers (background)
|
|
126
|
+
- Task: Main Chat → Task() agents (no coordinator, full visibility)
|
|
124
127
|
|
|
125
|
-
**
|
|
126
|
-
- CLI mode:
|
|
127
|
-
- Task mode:
|
|
128
|
-
- CLI agents use Z.ai routing automatically
|
|
129
|
-
- Redis context enables swarm recovery (CLI mode)
|
|
128
|
+
**Cost breakdown:**
|
|
129
|
+
- CLI mode: $0.054/iteration (Z.ai routing for workers)
|
|
130
|
+
- Task mode: $0.150/iteration (Anthropic for all agents)
|
|
130
131
|
|
|
131
132
|
**Context Storage:**
|
|
132
|
-
-
|
|
133
|
+
- CLI mode: Coordinator stores context in Redis for agents to retrieve
|
|
134
|
+
- Task mode: Main Chat passes context directly to each Task() spawn (no Redis needed)
|
|
133
135
|
- CLI agents read from Redis: `redis-cli HGETALL "cfn_loop:task:$TASK_ID:context"`
|
|
134
|
-
- Task mode: Main Chat injects directly but also stores in Redis
|
|
135
136
|
|
|
136
|
-
**Reference:**
|
|
137
|
+
**Reference:**
|
|
138
|
+
- Implementation details: `planning/cfn-v3/DUAL_MODE_IMPLEMENTATION.md`
|
|
139
|
+
- **Task Mode guide**: `.claude/commands/cfn/CFN_LOOP_TASK_MODE.md` (agent specialization, sprint workflow, backlog management)
|
|
137
140
|
|
|
138
141
|
### Custom Routing (Z.ai Provider Integration)
|
|
139
142
|
|
|
@@ -192,13 +195,32 @@ Task("cfn-v3-coordinator", `
|
|
|
192
195
|
```
|
|
193
196
|
|
|
194
197
|
**Why This Pattern:**
|
|
195
|
-
- Coordinator controls spawn timing via
|
|
198
|
+
- Coordinator controls spawn timing via orchestrate.sh (no timeout issues)
|
|
196
199
|
- 95-98% cost savings vs Task() spawning
|
|
197
|
-
-
|
|
200
|
+
- Fresh agents spawned for each iteration (adaptive specialization)
|
|
198
201
|
- Sequential CLI spawning is safe (coordinator manages order)
|
|
199
202
|
- Clean separation: Main Chat → Coordinator → Workers
|
|
200
203
|
|
|
201
|
-
###
|
|
204
|
+
### Pre-Edit Backup (REQUIRED before all Edit/Write operations)
|
|
205
|
+
**Before ANY Edit/Write/MultiEdit operation, agents MUST create backup:**
|
|
206
|
+
```bash
|
|
207
|
+
BACKUP_PATH=$(./.claude/hooks/cfn-invoke-pre-edit.sh "$FILE_TO_EDIT" --agent-id "$AGENT_ID")
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Why:** Enables safe file revert without git operations during parallel sessions.
|
|
211
|
+
**Location:** `.backups/[agent-id]/[timestamp]_[hash]/`
|
|
212
|
+
**Retention:** 24h TTL (configurable)
|
|
213
|
+
|
|
214
|
+
**Revert Instead of Git:**
|
|
215
|
+
```bash
|
|
216
|
+
# ❌ FORBIDDEN - git operations cause parallel session issues
|
|
217
|
+
git checkout -- file.ts
|
|
218
|
+
|
|
219
|
+
# ✅ REQUIRED - use backup system
|
|
220
|
+
./.claude/skills/pre-edit-backup/revert-file.sh "$FILE_PATH" --agent-id "$AGENT_ID"
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Post-Edit Validation (REQUIRED after all Edit/Write operations on any file type)
|
|
202
224
|
**After ANY Edit/Write/MultiEdit operation on all file types, agents MUST run:**
|
|
203
225
|
```bash
|
|
204
226
|
./.claude/hooks/cfn-invoke-post-edit.sh "$EDITED_FILE" --agent-id "$AGENT_ID"
|
|
@@ -208,6 +230,23 @@ Task("cfn-v3-coordinator", `
|
|
|
208
230
|
**Config:** `.claude/hooks/post-edit.config.json`
|
|
209
231
|
**Skill:** `.claude/skills/hook-pipeline/SKILL.md`
|
|
210
232
|
|
|
233
|
+
### Complete Edit Workflow (Pre-Edit + Edit + Post-Edit)
|
|
234
|
+
```bash
|
|
235
|
+
# 1. Pre-Edit: Create backup
|
|
236
|
+
BACKUP_PATH=$(./.claude/hooks/cfn-invoke-pre-edit.sh "src/file.ts" --agent-id "$AGENT_ID")
|
|
237
|
+
|
|
238
|
+
# 2. Edit: Perform file modification
|
|
239
|
+
Edit: file_path="src/file.ts" old_string="..." new_string="..."
|
|
240
|
+
|
|
241
|
+
# 3. Post-Edit: Validate changes
|
|
242
|
+
./.claude/hooks/cfn-invoke-post-edit.sh "src/file.ts" --agent-id "$AGENT_ID"
|
|
243
|
+
|
|
244
|
+
# 4. (Optional) Revert if validation fails
|
|
245
|
+
if [ $? -ne 0 ]; then
|
|
246
|
+
./.claude/skills/pre-edit-backup/revert-file.sh "src/file.ts" --agent-id "$AGENT_ID"
|
|
247
|
+
fi
|
|
248
|
+
```
|
|
249
|
+
|
|
211
250
|
## 2) When Agents Are Mandatory (Triggers)
|
|
212
251
|
|
|
213
252
|
If **any** apply, spawn agents:
|
|
@@ -252,133 +291,8 @@ Refer to `.claude/skills/cfn-redis-coordination/SKILL.md` for:
|
|
|
252
291
|
- Simple Chain Coordination
|
|
253
292
|
- Hierarchical Broadcast
|
|
254
293
|
- Mesh Hybrid Patterns
|
|
255
|
-
-
|
|
256
|
-
|
|
257
|
-
### Redis Waiting Mode (Zero-Token Agent Coordination)
|
|
258
|
-
|
|
259
|
-
**Use Case:** CFN Loop iterations, long-running tasks, multi-agent consensus
|
|
260
|
-
|
|
261
|
-
**Agent enters waiting mode:**
|
|
262
|
-
```bash
|
|
263
|
-
./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh enter \
|
|
264
|
-
--task-id "$TASK_ID" \
|
|
265
|
-
--agent-id "$AGENT_ID" \
|
|
266
|
-
--context "iteration-1"
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
**Coordinator wakes agent:**
|
|
270
|
-
```bash
|
|
271
|
-
./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh wake \
|
|
272
|
-
--task-id "$TASK_ID" \
|
|
273
|
-
--agent-id "$AGENT_ID" \
|
|
274
|
-
--reason cfn_loop_iteration \
|
|
275
|
-
--iteration 2 \
|
|
276
|
-
--feedback "Add error handling,Improve test coverage"
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
**Agent reports result:**
|
|
280
|
-
```bash
|
|
281
|
-
./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
|
|
282
|
-
--task-id "$TASK_ID" \
|
|
283
|
-
--agent-id "$AGENT_ID" \
|
|
284
|
-
--confidence 0.92 \
|
|
285
|
-
--iteration 2
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
**Coordinator collects results:**
|
|
289
|
-
```bash
|
|
290
|
-
CONSENSUS=$(./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh collect \
|
|
291
|
-
--task-id "$TASK_ID" \
|
|
292
|
-
--agent-ids "coder-1,reviewer-1,tester-1,security-1")
|
|
293
|
-
|
|
294
|
-
if (( $(echo "$CONSENSUS >= 0.90" | bc -l) )); then
|
|
295
|
-
echo "✅ Consensus reached: $CONSENSUS"
|
|
296
|
-
fi
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
**Benefits:**
|
|
300
|
-
- 🚀 Zero token cost while waiting (BLPOP blocks, no API calls)
|
|
301
|
-
- 🔄 Context preserved across iterations
|
|
302
|
-
- ⚡ Instant wake-up (<100ms latency)
|
|
303
|
-
- 📈 Scalable (10+ agents, indefinite cycles)
|
|
304
|
-
|
|
305
|
-
**Key Pattern (STRAT-002):**
|
|
306
|
-
Use zero-token blocking mechanisms (like Redis BLPOP) to create efficient, low-overhead synchronization between agents without incurring API call costs. Validated by 8/8 passing tests in orchestrator test suite.
|
|
307
|
-
|
|
308
|
-
### ⚠️ Waiting Mode Without Coordinator (CRITICAL)
|
|
309
|
-
|
|
310
|
-
**Problem:** Agents entering waiting mode without a coordinator will block indefinitely.
|
|
311
|
-
|
|
312
|
-
**Why This Happens:**
|
|
313
|
-
- `invoke-waiting-mode.sh enter` uses `BLPOP` with timeout=0 (infinite)
|
|
314
|
-
- Agent blocks waiting for wake signal that never arrives
|
|
315
|
-
- No coordinator = no wake signal = agent stuck forever
|
|
316
|
-
- Shell/terminal timeout (typically 2min) may terminate the session
|
|
317
|
-
|
|
318
|
-
**When This Occurs:**
|
|
319
|
-
1. **Manual agent spawning** without orchestrator (testing, debugging)
|
|
320
|
-
2. **Epic execution** where Main Chat spawns agents directly
|
|
321
|
-
3. **Incomplete orchestration** where coordinator crashes mid-execution
|
|
322
|
-
|
|
323
|
-
**Solutions:**
|
|
324
|
-
|
|
325
|
-
**Option 1: Always Use Full Orchestration (RECOMMENDED)**
|
|
326
|
-
```bash
|
|
327
|
-
# CORRECT: Use orchestrator for all multi-agent workflows
|
|
328
|
-
./.claude/skills/cfn-loop-orchestration/cfn-orchestrate.sh \
|
|
329
|
-
--task-id "$TASK_ID" \
|
|
330
|
-
--mode standard \
|
|
331
|
-
--loop3-agents "coder-1,researcher-1" \
|
|
332
|
-
--loop2-agents "reviewer-1,tester-1" \
|
|
333
|
-
--product-owner "product-owner-1"
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
**Option 2: Manual Coordination (For Testing Only)**
|
|
337
|
-
```bash
|
|
338
|
-
# 1. Spawn agents (they enter waiting mode)
|
|
339
|
-
# 2. Collect confidence scores
|
|
340
|
-
CONSENSUS=$(./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh collect \
|
|
341
|
-
--task-id "$TASK_ID" --agent-ids "coder-1,researcher-1")
|
|
342
|
-
|
|
343
|
-
# 3. Check consensus
|
|
344
|
-
if (( $(echo "$CONSENSUS >= 0.90" | bc -l) )); then
|
|
345
|
-
echo "✅ Complete - no iteration needed"
|
|
346
|
-
# Agents stay in waiting mode (expected, will timeout)
|
|
347
|
-
else
|
|
348
|
-
# 4. Wake agents for iteration 2
|
|
349
|
-
./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh wake \
|
|
350
|
-
--task-id "$TASK_ID" \
|
|
351
|
-
--agent-id "coder-1" \
|
|
352
|
-
--reason "improve_quality" \
|
|
353
|
-
--iteration 2
|
|
354
|
-
fi
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
**Option 3: Skip Waiting Mode (Quick Testing)**
|
|
358
|
-
```bash
|
|
359
|
-
# Agent completion without waiting mode
|
|
360
|
-
redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
|
|
361
|
-
./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
|
|
362
|
-
--task-id "$TASK_ID" \
|
|
363
|
-
--agent-id "$AGENT_ID" \
|
|
364
|
-
--confidence 0.85
|
|
365
|
-
|
|
366
|
-
# Skip step 4 (enter waiting mode) - agent exits immediately
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
**Best Practice (STRAT-006):**
|
|
370
|
-
**Always spawn coordinator + agents together.** Never spawn agents in waiting mode without a coordinator unless you explicitly plan to wake them manually or accept timeout behavior.
|
|
371
|
-
|
|
372
|
-
```bash
|
|
373
|
-
# FORBIDDEN PATTERN:
|
|
374
|
-
Task("backend-dev", "Task with waiting mode...") # No coordinator!
|
|
375
|
-
|
|
376
|
-
# REQUIRED PATTERN:
|
|
377
|
-
Task("cfn-loop-coordinator", "Execute CFN Loop with orchestrator...")
|
|
378
|
-
# Coordinator spawns and manages all agents automatically
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
**Validation:** Agent timeouts during epic execution (Phases 1-3) were expected behavior - agents correctly entered waiting mode but no coordinator was present to wake them. This is acceptable for single-iteration phases where iteration is not needed.
|
|
294
|
+
- Agent completion signaling (Redis LPUSH)
|
|
295
|
+
- Consensus collection (invoke-waiting-mode.sh collect)
|
|
382
296
|
|
|
383
297
|
## 4) CFN Loop Overview
|
|
384
298
|
|
|
@@ -396,79 +310,50 @@ Task("cfn-loop-coordinator", "Execute CFN Loop with orchestrator...")
|
|
|
396
310
|
| Standard | ≥0.75 | ≥0.90 | 10 | 3-4 |
|
|
397
311
|
| Enterprise | ≥0.85 | ≥0.95 | 15 | 5 |
|
|
398
312
|
|
|
399
|
-
### CFN Loop
|
|
313
|
+
### CFN Loop Orchestration Pattern
|
|
400
314
|
|
|
401
|
-
**
|
|
315
|
+
**CLI Mode (Production):**
|
|
316
|
+
Main Chat spawns cfn-v3-coordinator → Coordinator spawns workers via CLI → Workers exit after reporting confidence
|
|
402
317
|
|
|
403
|
-
**
|
|
404
|
-
|
|
405
|
-
Task("cfn-v3-coordinator", `
|
|
406
|
-
Execute CFN Loop for: Implement authentication system
|
|
318
|
+
**Task Mode (Debugging):**
|
|
319
|
+
Main Chat spawns all agents directly via Task() → No coordinator → Full visibility
|
|
407
320
|
|
|
408
|
-
|
|
409
|
-
Report structured result when complete.
|
|
410
|
-
`)
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
**2. Coordinator invokes orchestrator internally:**
|
|
414
|
-
```bash
|
|
415
|
-
# Coordinator runs this script (NOT Main Chat)
|
|
416
|
-
./.claude/skills/cfn-loop-orchestration/cfn-orchestrate.sh \
|
|
417
|
-
--task-id "unique-task-id" \
|
|
418
|
-
--mode standard \
|
|
419
|
-
--loop3-agents "researcher,backend-dev,devops" \
|
|
420
|
-
--loop2-agents "reviewer,architect,tester" \
|
|
421
|
-
--product-owner "product-owner" \
|
|
422
|
-
--max-iterations 10 \
|
|
423
|
-
--phase-id "phase-2" \
|
|
424
|
-
--epic-context '{"epicGoal":"Build feature X","inScope":["A","B"]}' \
|
|
425
|
-
--phase-context '{"currentPhase":"Phase 2","deliverables":["Component 1","Component 2"]}' \
|
|
426
|
-
--success-criteria '{"acceptanceCriteria":["Tests pass","Coverage >80%"],"gateThreshold":0.75}'
|
|
427
|
-
|
|
428
|
-
# CFN v3 UPDATE: Modular orchestrator (78% code reduction)
|
|
429
|
-
# - Helper scripts for context injection, agent spawning, validation
|
|
430
|
-
# - Stateless context retrieval from Redis
|
|
431
|
-
# - Better agent ID tracking (no BLPOP hangs)
|
|
432
|
-
```
|
|
433
|
-
|
|
434
|
-
**3. Orchestrator spawns all agents via CLI:**
|
|
321
|
+
**Orchestrator:**
|
|
435
322
|
```bash
|
|
436
|
-
|
|
437
|
-
npx cfn-spawn agent researcher --task-id "$TASK_ID"
|
|
438
|
-
npx cfn-spawn agent backend-dev --task-id "$TASK_ID"
|
|
439
|
-
# ... etc
|
|
323
|
+
./.claude/skills/cfn-loop-orchestration/orchestrate.sh
|
|
440
324
|
```
|
|
325
|
+
- Spawns Loop 3 agents (implementers)
|
|
326
|
+
- Collects confidence scores
|
|
327
|
+
- Gate check: spawn Loop 2 if ≥threshold
|
|
328
|
+
- Spawns Loop 2 agents (validators)
|
|
329
|
+
- Collects consensus
|
|
330
|
+
- Spawns Product Owner for decision
|
|
331
|
+
- Manages iterations based on PROCEED/ITERATE/ABORT
|
|
441
332
|
|
|
442
|
-
**
|
|
443
|
-
|
|
444
|
-
**Why Orchestration is Mandatory:**
|
|
445
|
-
- ✅ Loop 2 validators BLOCKED until Loop 3 complete (BLPOP)
|
|
446
|
-
- ✅ Product Owner BLOCKED until Loop 2 complete (BLPOP)
|
|
447
|
-
- ✅ Prevents premature consensus collection
|
|
448
|
-
- ✅ Automatic iteration management
|
|
449
|
-
- ✅ Zero-token waiting between loops
|
|
450
|
-
- ✅ Coordinator controls entire flow from single agent
|
|
451
|
-
|
|
452
|
-
**Agent Completion Protocol:**
|
|
453
|
-
Each agent MUST signal completion before entering waiting mode:
|
|
333
|
+
**Agent Completion Protocol (Mode-Specific):**
|
|
454
334
|
|
|
335
|
+
**CLI Mode** (spawned via `npx claude-flow-novice agent-spawn`):
|
|
455
336
|
```bash
|
|
456
337
|
# 1. Complete work
|
|
457
338
|
# 2. Signal done
|
|
458
339
|
redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
|
|
459
340
|
|
|
460
|
-
# 3. Report confidence
|
|
341
|
+
# 3. Report confidence and exit
|
|
461
342
|
./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
|
|
462
343
|
--task-id "$TASK_ID" \
|
|
463
344
|
--agent-id "$AGENT_ID" \
|
|
464
345
|
--confidence 0.85 \
|
|
465
346
|
--iteration 1
|
|
466
347
|
|
|
467
|
-
#
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
348
|
+
# Agent exits cleanly (no waiting mode)
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
**Task Mode** (spawned via Task() tool in Main Chat):
|
|
352
|
+
```bash
|
|
353
|
+
# Simply complete work and return output
|
|
354
|
+
# Main Chat receives output automatically
|
|
355
|
+
# NO Redis signals required
|
|
356
|
+
# NO explicit completion protocol needed
|
|
472
357
|
```
|
|
473
358
|
|
|
474
359
|
**Orchestration Flow (CORRECTED - Self-Validation Pattern):**
|
|
@@ -492,17 +377,13 @@ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
|
|
|
492
377
|
|
|
493
378
|
**Recommended: Use slash commands for CFN Loop execution**
|
|
494
379
|
|
|
495
|
-
Main Chat should use these commands instead of manually spawning coordinators
|
|
380
|
+
Main Chat should use these commands instead of manually spawning coordinators.
|
|
381
|
+
**IMPORTANT** Subagents must NOT use these these slash commands
|
|
496
382
|
|
|
497
383
|
**Single Task:**
|
|
498
384
|
```bash
|
|
499
|
-
/cfn-loop "Implement JWT authentication" --mode=standard
|
|
500
|
-
/cfn-loop-
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
**Multi-Phase Epic:**
|
|
504
|
-
```bash
|
|
505
|
-
/cfn-loop-epic "Build complete authentication system"
|
|
385
|
+
/cfn-loop-cli "Implement JWT authentication" --mode=standard
|
|
386
|
+
/cfn-loop-task "Fix security bug in auth module" --mode=standard
|
|
506
387
|
```
|
|
507
388
|
|
|
508
389
|
**What These Commands Do:**
|
|
@@ -540,6 +421,10 @@ Implement comprehensive test suites that validate both functional requirements a
|
|
|
540
421
|
- Agent Spawning: `.claude/skills/cfn-agent-spawning/SKILL.md`
|
|
541
422
|
- CFN Loop Validation: `.claude/skills/cfn-loop-validation/SKILL.md`
|
|
542
423
|
|
|
424
|
+
**CFN Loop Documentation:**
|
|
425
|
+
- **Task Mode Guide**: `.claude/commands/cfn/CFN_LOOP_TASK_MODE.md` (agent specialization, sprint workflow, backlog management, adaptive validator scaling)
|
|
426
|
+
- Coordinator Parameters: `.claude/commands/cfn/CFN_COORDINATOR_PARAMETERS.md`
|
|
427
|
+
|
|
543
428
|
**Maintenance Plans:**
|
|
544
429
|
- Rollback Strategy: `planning/skills/ROLLBACK_PLAN.md`
|
|
545
430
|
- Maintenance Schedule: `planning/skills/MAINTENANCE_SCHEDULE.md`
|
|
@@ -640,10 +525,10 @@ See `.artifacts/analytics/context-reduction-report.json`
|
|
|
640
525
|
- **Confidence**: 0.87
|
|
641
526
|
- **Priority**: 8/10
|
|
642
527
|
|
|
643
|
-
#### PATTERN-022: Agent Lifecycle - Exit
|
|
528
|
+
#### PATTERN-022: Agent Lifecycle - Clean Exit Protocol
|
|
644
529
|
- **Context**: CFN Loop Agent Management
|
|
645
|
-
- **Insight**:
|
|
646
|
-
- **Tags**:
|
|
530
|
+
- **Insight**: Agents must exit cleanly after reporting confidence. Pattern: (1) Signal done via Redis LPUSH, (2) Report confidence score, (3) Exit immediately. Enables adaptive agent specialization - orchestrator spawns different specialist (security-specialist for security issues) for next iteration based on feedback type. Prevents orchestrator blocking.
|
|
531
|
+
- **Tags**: agent-lifecycle, clean-exit, adaptive-specialization, orchestrator
|
|
647
532
|
- **Confidence**: 0.89
|
|
648
533
|
- **Priority**: 8/10
|
|
649
534
|
|
|
@@ -663,6 +548,14 @@ See `.artifacts/analytics/context-reduction-report.json`
|
|
|
663
548
|
- **Confidence**: 0.91
|
|
664
549
|
- **Priority**: 9/10
|
|
665
550
|
|
|
551
|
+
#### ANTI-023: Task-Spawned Validators Without Completion Protocol
|
|
552
|
+
- **Context**: Loop 2 Validation (Task Mode)
|
|
553
|
+
- **Insight**: Main Chat spawns validators via Task() without clear scope boundaries or mode-aware completion protocols. Anti-pattern: Validators see CLI-mode completion instructions (Redis signals, `invoke-waiting-mode.sh report`) and attempt to comply using wrong tools (slash commands via Bash, nested CFN Loop spawning). Result: Agents hang indefinitely trying to execute `/cfn-loop-cli` as bash command, memory leak from blocked processes. Task-spawned validators should simply return structured output - Main Chat receives it automatically, no Redis signals needed.
|
|
554
|
+
- **Tags**: task-spawning, validation, completion-protocol, scope-boundaries, memory-leak
|
|
555
|
+
- **Confidence**: 0.95
|
|
556
|
+
- **Priority**: 10/10
|
|
557
|
+
- **Fix**: Mode-specific completion protocols in CLAUDE.md:333-357 and validator agents (reviewer.md:200-258, tester.md:160-217). Explicit scope boundaries prevent nested CFN Loop spawning.
|
|
558
|
+
|
|
666
559
|
### Edge Cases & Testing
|
|
667
560
|
|
|
668
561
|
#### EDGE-020: Comparative Agent Spawn Testing
|
|
@@ -4,6 +4,10 @@ set -e
|
|
|
4
4
|
# cfn-backlog-management/add-backlog-item.sh
|
|
5
5
|
# Adds structured backlog items to readme/BACKLOG.md
|
|
6
6
|
|
|
7
|
+
# Source shared validation utilities
|
|
8
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
+
source "/mnt/c/Users/masha/Documents/claude-flow-novice/.claude/skills/cfn-changelog-management/lib/validation.sh"
|
|
10
|
+
|
|
7
11
|
# Default values
|
|
8
12
|
PRIORITY="P2"
|
|
9
13
|
CATEGORY="Technical-Debt"
|
|
@@ -12,6 +16,7 @@ TAGS=""
|
|
|
12
16
|
ITEM=""
|
|
13
17
|
WHY=""
|
|
14
18
|
SOLUTION=""
|
|
19
|
+
FORCE=false
|
|
15
20
|
|
|
16
21
|
# Parse arguments
|
|
17
22
|
while [[ $# -gt 0 ]]; do
|
|
@@ -44,6 +49,10 @@ while [[ $# -gt 0 ]]; do
|
|
|
44
49
|
CATEGORY="$2"
|
|
45
50
|
shift 2
|
|
46
51
|
;;
|
|
52
|
+
--force)
|
|
53
|
+
FORCE=true
|
|
54
|
+
shift
|
|
55
|
+
;;
|
|
47
56
|
*)
|
|
48
57
|
echo "Unknown argument: $1" >&2
|
|
49
58
|
exit 1
|
|
@@ -67,30 +76,14 @@ if [[ -z "$SOLUTION" ]]; then
|
|
|
67
76
|
exit 1
|
|
68
77
|
fi
|
|
69
78
|
|
|
70
|
-
# Validate item length
|
|
71
|
-
|
|
72
|
-
if (( ITEM_LENGTH < 10 )); then
|
|
73
|
-
echo "Error: --item must be at least 10 characters (got $ITEM_LENGTH)" >&2
|
|
74
|
-
exit 1
|
|
75
|
-
fi
|
|
79
|
+
# Validate item length using shared validation
|
|
80
|
+
validate_string_length "$ITEM" 10 500 "item" || exit 1
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
exit 1
|
|
80
|
-
fi
|
|
82
|
+
# Validate priority using shared enum validation
|
|
83
|
+
validate_enum "$PRIORITY" "priority" "P0|P1|P2|P3" || exit 1
|
|
81
84
|
|
|
82
|
-
# Validate
|
|
83
|
-
|
|
84
|
-
echo "Error: --priority must be P0, P1, P2, or P3 (got: $PRIORITY)" >&2
|
|
85
|
-
exit 1
|
|
86
|
-
fi
|
|
87
|
-
|
|
88
|
-
# Validate category
|
|
89
|
-
VALID_CATEGORIES="Feature|Bug|Technical-Debt|Optimization"
|
|
90
|
-
if [[ ! "$CATEGORY" =~ ^($VALID_CATEGORIES)$ ]]; then
|
|
91
|
-
echo "Error: --category must be one of: Feature, Bug, Technical-Debt, Optimization (got: $CATEGORY)" >&2
|
|
92
|
-
exit 1
|
|
93
|
-
fi
|
|
85
|
+
# Validate category using shared enum validation
|
|
86
|
+
validate_enum "$CATEGORY" "category" "Feature|Bug|Technical-Debt|Optimization" || exit 1
|
|
94
87
|
|
|
95
88
|
# Path to backlog file
|
|
96
89
|
BACKLOG_FILE="readme/BACKLOG.md"
|
|
@@ -139,11 +132,16 @@ if grep -qi "$ITEM" "$BACKLOG_PATH" 2>/dev/null; then
|
|
|
139
132
|
echo "Warning: Similar item may already exist in backlog" >&2
|
|
140
133
|
echo "Existing matches:" >&2
|
|
141
134
|
grep -i "$ITEM" "$BACKLOG_PATH" | head -3 >&2
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
echo
|
|
146
|
-
|
|
135
|
+
|
|
136
|
+
if [[ "$FORCE" != "true" ]]; then
|
|
137
|
+
read -p "Continue anyway? (y/n) " -n 1 -r
|
|
138
|
+
echo
|
|
139
|
+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
140
|
+
echo "Aborted" >&2
|
|
141
|
+
exit 1
|
|
142
|
+
fi
|
|
143
|
+
else
|
|
144
|
+
echo "Force mode enabled, proceeding with duplicate item" >&2
|
|
147
145
|
fi
|
|
148
146
|
fi
|
|
149
147
|
|