claude-flow-novice 2.16.0 → 2.16.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.
Files changed (154) hide show
  1. package/.claude/cfn-extras/skills/GOOGLE_SHEETS_SKILLS_README.md +1 -1
  2. package/.claude/cfn-extras/skills/google-sheets-api-coordinator/SKILL.md +1 -1
  3. package/.claude/cfn-extras/skills/google-sheets-formula-builder/SKILL.md +1 -1
  4. package/.claude/cfn-extras/skills/google-sheets-progress/SKILL.md +1 -1
  5. package/.claude/commands/CFN_LOOP_FRONTEND.md +1 -1
  6. package/.claude/commands/cfn-loop-cli.md +124 -46
  7. package/.claude/commands/cfn-loop-frontend.md +1 -1
  8. package/.claude/commands/cfn-loop-task.md +2 -2
  9. package/.claude/commands/deprecated/cfn-loop.md +2 -2
  10. package/.claude/hooks/cfn-invoke-post-edit.sh +31 -5
  11. package/.claude/hooks/cfn-post-edit.config.json +9 -2
  12. package/.claude/root-claude-distribute/CFN-CLAUDE.md +1 -1
  13. package/.claude/skills/cfn-backlog-management/SKILL.md +1 -1
  14. package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_INDEX.md +1 -1
  15. package/claude-assets/agents/cfn-dev-team/analysts/root-cause-analyst.md +2 -2
  16. package/claude-assets/agents/cfn-dev-team/architecture/base-template-generator.md +1 -1
  17. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +2 -2
  18. package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +1 -1
  19. package/claude-assets/agents/cfn-dev-team/dev-ops/devops-engineer.md +1 -1
  20. package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +2 -2
  21. package/claude-assets/agents/cfn-dev-team/dev-ops/github-commit-agent.md +2 -2
  22. package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +1 -1
  23. package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +1 -1
  24. package/claude-assets/agents/cfn-dev-team/developers/data/data-engineer.md +1 -1
  25. package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +1 -1
  26. package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +1 -1
  27. package/claude-assets/agents/cfn-dev-team/developers/frontend/ui-designer.md +1 -1
  28. package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +1 -1
  29. package/claude-assets/agents/cfn-dev-team/documentation/pseudocode.md +1 -1
  30. package/claude-assets/agents/cfn-dev-team/product-owners/accessibility-advocate-persona.md +1 -1
  31. package/claude-assets/agents/cfn-dev-team/product-owners/cto-agent.md +1 -1
  32. package/claude-assets/agents/cfn-dev-team/product-owners/power-user-persona.md +1 -1
  33. package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +1 -1
  34. package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +1 -1
  35. package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +1 -1
  36. package/claude-assets/agents/cfn-dev-team/testers/contract-tester.md +1 -1
  37. package/claude-assets/agents/cfn-dev-team/testers/e2e/playwright-tester.md +1 -1
  38. package/claude-assets/agents/cfn-dev-team/testers/integration-tester.md +1 -1
  39. package/claude-assets/agents/cfn-dev-team/testers/load-testing-specialist.md +1 -1
  40. package/claude-assets/agents/cfn-dev-team/testers/mutation-testing-specialist.md +1 -1
  41. package/claude-assets/agents/cfn-dev-team/testers/unit/tdd-london-unit-swarm.md +1 -1
  42. package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +11 -0
  43. package/claude-assets/agents/cfn-dev-team/utility/analyst.md +1 -1
  44. package/claude-assets/agents/cfn-dev-team/utility/claude-code-expert.md +1 -1
  45. package/claude-assets/agents/cfn-dev-team/utility/epic-creator.md +1 -1
  46. package/claude-assets/agents/cfn-dev-team/utility/memory-leak-specialist.md +1 -1
  47. package/claude-assets/agents/cfn-dev-team/utility/researcher.md +1 -1
  48. package/claude-assets/agents/cfn-dev-team/utility/z-ai-specialist.md +1 -1
  49. package/claude-assets/agents/custom/cfn-docker-expert.md +1 -0
  50. package/claude-assets/agents/custom/cfn-loops-cli-expert.md +326 -17
  51. package/claude-assets/agents/custom/cfn-redis-operations.md +529 -529
  52. package/claude-assets/agents/custom/cfn-system-expert.md +1 -1
  53. package/claude-assets/agents/custom/trigger-dev-expert.md +369 -0
  54. package/claude-assets/agents/docker-team/micro-sprint-planner.md +747 -747
  55. package/claude-assets/agents/project-only-agents/npm-package-specialist.md +1 -1
  56. package/claude-assets/cfn-extras/skills/GOOGLE_SHEETS_SKILLS_README.md +1 -1
  57. package/claude-assets/cfn-extras/skills/google-sheets-api-coordinator/SKILL.md +1 -1
  58. package/claude-assets/cfn-extras/skills/google-sheets-formula-builder/SKILL.md +1 -1
  59. package/claude-assets/cfn-extras/skills/google-sheets-progress/SKILL.md +1 -1
  60. package/claude-assets/commands/CFN_LOOP_FRONTEND.md +1 -1
  61. package/claude-assets/commands/cfn-loop-cli.md +124 -46
  62. package/claude-assets/commands/cfn-loop-frontend.md +1 -1
  63. package/claude-assets/commands/cfn-loop-task.md +2 -2
  64. package/claude-assets/commands/deprecated/cfn-loop.md +2 -2
  65. package/claude-assets/hooks/GIT-HOOKS-USAGE-EXAMPLES.md +116 -0
  66. package/claude-assets/hooks/README-GIT-HOOKS.md +443 -0
  67. package/claude-assets/hooks/cfn-invoke-post-edit.sh +31 -5
  68. package/claude-assets/hooks/cfn-post-edit.config.json +9 -2
  69. package/claude-assets/hooks/install-git-hooks.sh +243 -0
  70. package/claude-assets/hooks/subagent-start.sh +98 -0
  71. package/claude-assets/hooks/subagent-stop.sh +93 -0
  72. package/claude-assets/hooks/validators/credential-scanner.sh +172 -0
  73. package/claude-assets/root-claude-distribute/CFN-CLAUDE.md +1 -1
  74. package/claude-assets/skills/cfn-backlog-management/SKILL.md +1 -1
  75. package/claude-assets/skills/cfn-dependency-ingestion/SKILL.md +41 -13
  76. package/claude-assets/skills/cfn-dependency-ingestion/ingest.sh +237 -0
  77. package/claude-assets/skills/cfn-dependency-ingestion/manifests/cli-mode-dependencies.txt +73 -0
  78. package/claude-assets/skills/cfn-dependency-ingestion/manifests/shared-dependencies.txt +57 -0
  79. package/claude-assets/skills/cfn-dependency-ingestion/manifests/trigger-dev-dependencies.txt +82 -0
  80. package/claude-assets/skills/cfn-dependency-ingestion/manifests/trigger-mode-dependencies.txt +80 -0
  81. package/claude-assets/skills/cfn-environment-sanitization/sanitize-environment.sh +14 -4
  82. package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_INDEX.md +1 -1
  83. package/claude-assets/skills/cfn-provider-routing/SKILL.md +23 -0
  84. package/claude-assets/skills/docker-build/build.sh +1 -1
  85. package/dist/agent/skill-mcp-selector.js +2 -1
  86. package/dist/agent/skill-mcp-selector.js.map +1 -1
  87. package/dist/agents/agent-loader.js +165 -146
  88. package/dist/agents/agent-loader.js.map +1 -1
  89. package/dist/cli/agent-executor.js +470 -26
  90. package/dist/cli/agent-executor.js.map +1 -1
  91. package/dist/cli/agent-prompt-builder.js +2 -2
  92. package/dist/cli/agent-prompt-builder.js.map +1 -1
  93. package/dist/cli/agent-spawn.js +7 -4
  94. package/dist/cli/agent-spawn.js.map +1 -1
  95. package/dist/cli/agent-spawner.js +51 -4
  96. package/dist/cli/agent-spawner.js.map +1 -1
  97. package/dist/cli/agent-token-manager.js +2 -1
  98. package/dist/cli/agent-token-manager.js.map +1 -1
  99. package/dist/cli/anthropic-client.js +117 -11
  100. package/dist/cli/anthropic-client.js.map +1 -1
  101. package/dist/cli/cfn-context.js +2 -1
  102. package/dist/cli/cfn-context.js.map +1 -1
  103. package/dist/cli/cfn-metrics.js +2 -1
  104. package/dist/cli/cfn-metrics.js.map +1 -1
  105. package/dist/cli/cfn-redis.js +2 -1
  106. package/dist/cli/cfn-redis.js.map +1 -1
  107. package/dist/cli/cli-agent-context.js +2 -0
  108. package/dist/cli/cli-agent-context.js.map +1 -1
  109. package/dist/cli/config-manager.js +4 -252
  110. package/dist/cli/config-manager.js.map +1 -1
  111. package/dist/cli/conversation-fork-cleanup.js +2 -1
  112. package/dist/cli/conversation-fork-cleanup.js.map +1 -1
  113. package/dist/cli/conversation-fork.js +2 -1
  114. package/dist/cli/conversation-fork.js.map +1 -1
  115. package/dist/cli/coordination/agent-messaging.js +415 -0
  116. package/dist/cli/coordination/agent-messaging.js.map +1 -0
  117. package/dist/cli/coordination/wait-for-threshold.js +232 -0
  118. package/dist/cli/coordination/wait-for-threshold.js.map +1 -0
  119. package/dist/cli/iteration-history.js +2 -1
  120. package/dist/cli/iteration-history.js.map +1 -1
  121. package/dist/cli/process-lifecycle.js +5 -1
  122. package/dist/cli/process-lifecycle.js.map +1 -1
  123. package/dist/cli/spawn-agent-cli.js +41 -6
  124. package/dist/cli/spawn-agent-cli.js.map +1 -1
  125. package/dist/coordination/redis-waiting-mode.js +4 -0
  126. package/dist/coordination/redis-waiting-mode.js.map +1 -1
  127. package/dist/lib/artifact-registry.js +4 -0
  128. package/dist/lib/artifact-registry.js.map +1 -1
  129. package/dist/lib/connection-pool.js +390 -0
  130. package/dist/lib/connection-pool.js.map +1 -0
  131. package/dist/lib/environment-contract.js +258 -0
  132. package/dist/lib/environment-contract.js.map +1 -0
  133. package/dist/lib/query-optimizer.js +388 -0
  134. package/dist/lib/query-optimizer.js.map +1 -0
  135. package/dist/lib/result-cache.js +285 -0
  136. package/dist/lib/result-cache.js.map +1 -0
  137. package/dist/mcp/auth-middleware.js +2 -1
  138. package/dist/mcp/auth-middleware.js.map +1 -1
  139. package/dist/mcp/playwright-mcp-server-auth.js +2 -1
  140. package/dist/mcp/playwright-mcp-server-auth.js.map +1 -1
  141. package/package.json +3 -1
  142. package/scripts/build-agent-image.sh +1 -1
  143. package/scripts/cost-allocation-tracker.sh +632 -0
  144. package/scripts/docker-rebuild-all-agents.sh +2 -2
  145. package/scripts/reorganize-tests.sh +280 -0
  146. package/scripts/trigger-dev-setup.sh +12 -0
  147. package/tests/README.md +45 -0
  148. package/.claude/commands/cost-savings-status.md +0 -34
  149. package/.claude/commands/metrics-summary.md +0 -58
  150. package/claude-assets/agents/cfn-dev-team/dev-ops/monitoring-specialist.md +0 -768
  151. package/claude-assets/agents/custom/test-mcp-access.md +0 -24
  152. package/claude-assets/commands/cost-savings-status.md +0 -34
  153. package/claude-assets/commands/metrics-summary.md +0 -58
  154. package/tests/test-memory-leak-task-mode.sh +0 -435
@@ -0,0 +1,280 @@
1
+ #!/bin/bash
2
+ # scripts/reorganize-tests.sh
3
+ # Reorganize tests/ directory structure - Option 3 Full Reorganization
4
+ # Safe, reversible migration with verification
5
+
6
+ set -euo pipefail
7
+
8
+ PROJECT_ROOT=$(git rev-parse --show-toplevel)
9
+ cd "$PROJECT_ROOT"
10
+
11
+ echo "=========================================="
12
+ echo "Test Suite Reorganization Script"
13
+ echo "=========================================="
14
+ echo ""
15
+ echo "This will organize 99 loose files in tests/"
16
+ echo "- 52 TypeScript tests → tests/unit/"
17
+ echo "- 25 shell scripts → archive or organized dirs"
18
+ echo "- 18 markdown docs → archive or organized dirs"
19
+ echo ""
20
+
21
+ # Phase 1: Create directories
22
+ echo "Phase 1: Creating new organizational directories..."
23
+ mkdir -p tests/archive/historical/{integration,hello-world-analysis,workflows,timeout-fixes}
24
+ mkdir -p tests/archive/experimental/{api-gateway,hello-world,cfn-loop,ace,tdd-compliance,playbooks,workflows}
25
+ mkdir -p tests/unit/{agent-spawner,backup,coordination,auth,config,database,lock,cache,registry,workspace,checkpoint,orchestration,edge-case,injection,metrics,post-edit,skill,timing,security,cli,orchestrator,gate-checker,cfn-loop/product-owner,typescript}
26
+ mkdir -p tests/redis
27
+ echo "✓ Directories created"
28
+ echo ""
29
+
30
+ # Phase 2: Move TypeScript test files to unit/ directory
31
+ echo "Phase 2: Organizing TypeScript test files (52 files)..."
32
+
33
+ # Agent-related tests
34
+ [[ -f tests/agent-spawner.test.ts ]] && mv tests/agent-spawner.test.ts tests/unit/agent-spawner/ 2>/dev/null || true
35
+ [[ -f tests/agent-output-validator.test.ts ]] && mv tests/agent-output-validator.test.ts tests/unit/agent-spawner/ 2>/dev/null || true
36
+ [[ -f tests/agent-workspace.test.ts ]] && mv tests/agent-workspace.test.ts tests/unit/workspace/ 2>/dev/null || true
37
+
38
+ # Backup and security
39
+ [[ -f tests/backup-manager.test.ts ]] && mv tests/backup-manager.test.ts tests/unit/backup/ 2>/dev/null || true
40
+
41
+ # Coordination
42
+ [[ -f tests/coordination-wrapper.test.ts ]] && mv tests/coordination-wrapper.test.ts tests/unit/coordination/ 2>/dev/null || true
43
+
44
+ # Auth
45
+ [[ -f tests/auth-system.test.ts ]] && mv tests/auth-system.test.ts tests/unit/auth/ 2>/dev/null || true
46
+
47
+ # Config
48
+ [[ -f tests/config-manager.test.ts ]] && mv tests/config-manager.test.ts tests/unit/config/ 2>/dev/null || true
49
+ [[ -f tests/config-validator.test.ts ]] && mv tests/config-validator.test.ts tests/unit/config/ 2>/dev/null || true
50
+
51
+ # Database
52
+ [[ -f tests/database-service.test.ts ]] && mv tests/database-service.test.ts tests/unit/database/ 2>/dev/null || true
53
+
54
+ # Lock management
55
+ [[ -f tests/distributed-lock-enhanced.test.ts ]] && mv tests/distributed-lock-enhanced.test.ts tests/unit/lock/ 2>/dev/null || true
56
+ [[ -f tests/file-lock-manager.test.ts ]] && mv tests/file-lock-manager.test.ts tests/unit/lock/ 2>/dev/null || true
57
+
58
+ # Cache
59
+ [[ -f tests/correlation-cache-cleanup.test.ts ]] && mv tests/correlation-cache-cleanup.test.ts tests/unit/cache/ 2>/dev/null || true
60
+
61
+ # Registry
62
+ [[ -f tests/artifact-registry.test.ts ]] && mv tests/artifact-registry.test.ts tests/unit/registry/ 2>/dev/null || true
63
+
64
+ # Checkpoint
65
+ [[ -f tests/checkpoint-manager.test.ts ]] && mv tests/checkpoint-manager.test.ts tests/unit/checkpoint/ 2>/dev/null || true
66
+
67
+ # Orchestration
68
+ [[ -f tests/cfn-loop-orchestration.test.ts ]] && mv tests/cfn-loop-orchestration.test.ts tests/unit/orchestration/ 2>/dev/null || true
69
+
70
+ # Edge cases
71
+ [[ -f tests/edge-case-analyzer.test.ts ]] && mv tests/edge-case-analyzer.test.ts tests/unit/edge-case/ 2>/dev/null || true
72
+ [[ -f tests/edge-case-detector.test.ts ]] && mv tests/edge-case-detector.test.ts tests/unit/edge-case/ 2>/dev/null || true
73
+ [[ -f tests/edge-case-tracker.test.ts ]] && mv tests/edge-case-tracker.test.ts tests/unit/edge-case/ 2>/dev/null || true
74
+
75
+ # Command injection
76
+ [[ -f tests/command-injection-unit.test.ts ]] && mv tests/command-injection-unit.test.ts tests/unit/security/ 2>/dev/null || true
77
+
78
+ # Formatting
79
+ [[ -f tests/formatTable-ansi.test.ts ]] && mv tests/formatTable-ansi.test.ts tests/unit/cli/ 2>/dev/null || true
80
+
81
+ # Metrics
82
+ [[ -f tests/metrics-logger.test.ts ]] && mv tests/metrics-logger.test.ts tests/unit/metrics/ 2>/dev/null || true
83
+
84
+ # Post-edit
85
+ [[ -f tests/post-edit-validator.test.ts ]] && mv tests/post-edit-validator.test.ts tests/unit/post-edit/ 2>/dev/null || true
86
+
87
+ # Skills
88
+ [[ -f tests/skill-deployment-transactions.test.ts ]] && mv tests/skill-deployment-transactions.test.ts tests/unit/skill/ 2>/dev/null || true
89
+
90
+ # Timing attacks
91
+ [[ -f tests/timing-attack-*.test.ts ]] && find tests -maxdepth 1 -name "timing-attack-*.test.ts" -exec mv {} tests/unit/timing/ \; 2>/dev/null || true
92
+
93
+ # Move all remaining *.test.ts files
94
+ find tests -maxdepth 1 -name "*.test.ts" -type f 2>/dev/null | while read file; do
95
+ basename_file=$(basename "$file" .test.ts)
96
+ # Try to categorize based on filename
97
+ if [[ "$basename_file" =~ redis ]]; then
98
+ mv "$file" tests/unit/database/ 2>/dev/null || true
99
+ elif [[ "$basename_file" =~ queue ]]; then
100
+ mv "$file" tests/unit/coordination/ 2>/dev/null || true
101
+ elif [[ "$basename_file" =~ setup|cleanup|teardown ]]; then
102
+ # Keep at root - these are test utilities
103
+ true
104
+ else
105
+ # Default to unit/misc if can't categorize
106
+ mkdir -p tests/unit/misc
107
+ mv "$file" tests/unit/misc/ 2>/dev/null || true
108
+ fi
109
+ done
110
+
111
+ echo "✓ TypeScript tests organized (52 files → tests/unit/)"
112
+ echo ""
113
+
114
+ # Phase 3: Move obsolete shell scripts to archive/historical
115
+ echo "Phase 3: Moving obsolete shell scripts to archive/historical..."
116
+ files_to_archive=(
117
+ "test-hello-world-creation.sh"
118
+ "typescript-redis-e2e-5-iterations.sh"
119
+ "test-memory-leak-task-mode.sh"
120
+ "test-newline-exploit-validation.sh"
121
+ "test-sanitize-input-fix.sh"
122
+ "test-all-critical-fixes.sh"
123
+ "cli-mode-quick-validation.sh"
124
+ "cli-mode-comprehensive-test.sh"
125
+ )
126
+
127
+ for file in "${files_to_archive[@]}"; do
128
+ if [[ -f "tests/$file" ]]; then
129
+ mv "tests/$file" tests/archive/historical/
130
+ echo " → Archived $file"
131
+ fi
132
+ done
133
+ echo "✓ Obsolete shell scripts archived (8 files)"
134
+ echo ""
135
+
136
+ # Phase 4: Delete exact duplicates
137
+ echo "Phase 4: Removing duplicate files..."
138
+ if [[ -f tests/test-redis-auth-detection.sh ]] && [[ -f tests/redis/test-auth-detection.sh ]]; then
139
+ if diff -q tests/test-redis-auth-detection.sh tests/redis/test-auth-detection.sh &>/dev/null; then
140
+ rm tests/test-redis-auth-detection.sh
141
+ echo " → Deleted duplicate: test-redis-auth-detection.sh"
142
+ fi
143
+ fi
144
+
145
+ if [[ -f tests/test-orchestrator-param-validation.sh ]] && [[ -f tests/orchestrator/test-parameter-validation.sh ]]; then
146
+ if diff -q tests/test-orchestrator-param-validation.sh tests/orchestrator/test-parameter-validation.sh &>/dev/null; then
147
+ rm tests/test-orchestrator-param-validation.sh
148
+ echo " → Deleted duplicate: test-orchestrator-param-validation.sh"
149
+ fi
150
+ fi
151
+ echo "✓ Duplicates removed"
152
+ echo ""
153
+
154
+ # Phase 5: Move experimental/POC files
155
+ echo "Phase 5: Moving experimental and POC tests to archive/experimental..."
156
+
157
+ # API Gateway (if exists)
158
+ [[ -d tests/api-gateway ]] && mv tests/api-gateway tests/archive/experimental/ 2>/dev/null && echo " ✓ API Gateway tests moved" || true
159
+
160
+ # Hello World (if exists)
161
+ [[ -d tests/hello-world ]] && mv tests/hello-world tests/archive/experimental/ 2>/dev/null && echo " ✓ Hello World experiments moved" || true
162
+
163
+ # TDD Compliance (if exists)
164
+ [[ -d tests/tdd-compliance ]] && mv tests/tdd-compliance tests/archive/experimental/ 2>/dev/null && echo " ✓ TDD Compliance tests moved" || true
165
+
166
+ # ACE (if exists)
167
+ [[ -d tests/ace ]] && mv tests/ace tests/archive/experimental/ 2>/dev/null && echo " ✓ ACE experiments moved" || true
168
+
169
+ # CFN Loop modes (if exists)
170
+ if [[ -d tests/cfn-loop/modes ]]; then
171
+ mkdir -p tests/archive/experimental/cfn-loop/modes
172
+ mv tests/cfn-loop/modes/* tests/archive/experimental/cfn-loop/modes/ 2>/dev/null || true
173
+ rmdir tests/cfn-loop/modes 2>/dev/null || true
174
+ echo " ✓ CFN Loop modes moved"
175
+ fi
176
+
177
+ # Playbook/workflow experiments
178
+ [[ -f tests/integration/test-playbook-integration.sh ]] && \
179
+ mv tests/integration/test-playbook-integration.sh tests/archive/experimental/playbooks/ 2>/dev/null || true
180
+ [[ -f tests/integration/test-playbook-workflow-integration.sh ]] && \
181
+ mv tests/integration/test-playbook-workflow-integration.sh tests/archive/experimental/playbooks/ 2>/dev/null || true
182
+ [[ -f tests/integration/test-workflow-codification.sh ]] && \
183
+ mv tests/integration/test-workflow-codification.sh tests/archive/experimental/workflows/ 2>/dev/null || true
184
+
185
+ echo "✓ Experimental tests archived"
186
+ echo ""
187
+
188
+ # Phase 6: Move timeout documentation
189
+ echo "Phase 6: Moving timeout documentation to archive/historical..."
190
+ [[ -f tests/integration/TIMEOUT_FIX_SUMMARY.md ]] && \
191
+ mv tests/integration/TIMEOUT_FIX_SUMMARY.md tests/archive/historical/integration/timeout-fixes/ 2>/dev/null || true
192
+ [[ -f tests/integration/README_TIMEOUT_FIX.md ]] && \
193
+ mv tests/integration/README_TIMEOUT_FIX.md tests/archive/historical/integration/timeout-fixes/ 2>/dev/null || true
194
+ [[ -f tests/integration/EXAMPLE_TIMEOUT_FIXES.md ]] && \
195
+ mv tests/integration/EXAMPLE_TIMEOUT_FIXES.md tests/archive/historical/integration/timeout-fixes/ 2>/dev/null || true
196
+ [[ -f tests/integration/TIMEOUT_OPTIMIZATION.md ]] && \
197
+ mv tests/integration/TIMEOUT_OPTIMIZATION.md tests/archive/historical/integration/timeout-fixes/ 2>/dev/null || true
198
+ [[ -f tests/TEST_RESULTS_ASYNC_CLEANUP.md ]] && \
199
+ mv tests/TEST_RESULTS_ASYNC_CLEANUP.md tests/archive/historical/ 2>/dev/null || true
200
+ [[ -f tests/ASYNC_CLEANUP_FIX_SUMMARY.md ]] && \
201
+ mv tests/ASYNC_CLEANUP_FIX_SUMMARY.md tests/archive/historical/ 2>/dev/null || true
202
+ echo "✓ Documentation archived"
203
+ echo ""
204
+
205
+ # Phase 7: Move TypeScript documentation
206
+ echo "Phase 7: Organizing TypeScript documentation..."
207
+ [[ -f tests/TYPESCRIPT_E2E_INDEX.md ]] && mv tests/TYPESCRIPT_E2E_INDEX.md tests/unit/typescript/ 2>/dev/null || true
208
+ [[ -f tests/TYPESCRIPT_E2E_ARCHITECTURE.md ]] && mv tests/TYPESCRIPT_E2E_ARCHITECTURE.md tests/unit/typescript/ 2>/dev/null || true
209
+ [[ -f tests/TYPESCRIPT_E2E_TEST_SUMMARY.md ]] && mv tests/TYPESCRIPT_E2E_TEST_SUMMARY.md tests/unit/typescript/ 2>/dev/null || true
210
+ [[ -f tests/QUICK_START_TYPESCRIPT_E2E.md ]] && mv tests/QUICK_START_TYPESCRIPT_E2E.md tests/unit/typescript/ 2>/dev/null || true
211
+ [[ -f tests/RUN_TYPESCRIPT_E2E_CHECKLIST.md ]] && mv tests/RUN_TYPESCRIPT_E2E_CHECKLIST.md tests/unit/typescript/ 2>/dev/null || true
212
+ [[ -f tests/TYPESCRIPT_REDIS_E2E_TEST.md ]] && mv tests/TYPESCRIPT_REDIS_E2E_TEST.md tests/unit/typescript/ 2>/dev/null || true
213
+ echo "✓ TypeScript documentation organized"
214
+ echo ""
215
+
216
+ # Phase 8: Move Redis tests
217
+ echo "Phase 8: Consolidating Redis tests..."
218
+ [[ -f tests/integration/test-redis-success-criteria.sh ]] && \
219
+ mv tests/integration/test-redis-success-criteria.sh tests/redis/ 2>/dev/null || true
220
+ [[ -f tests/integration/validate-redis-success-criteria.sh ]] && \
221
+ mv tests/integration/validate-redis-success-criteria.sh tests/redis/ 2>/dev/null || true
222
+ echo "✓ Redis tests consolidated"
223
+ echo ""
224
+
225
+ # Cleanup: Remove empty directories
226
+ echo "Cleanup: Removing empty directories..."
227
+ find tests -type d -empty -delete 2>/dev/null || true
228
+ echo "✓ Empty directories removed"
229
+ echo ""
230
+
231
+ # Verification
232
+ echo "=========================================="
233
+ echo "Verification Results"
234
+ echo "=========================================="
235
+ echo ""
236
+
237
+ # Check that main test runners still exist
238
+ runners_ok=true
239
+ essential_files=(
240
+ "tests/cli-mode/run-all-tests.sh"
241
+ "tests/docker-mode/run-all-implementations.sh"
242
+ "tests/docker/run-all-tests.sh"
243
+ "tests/test-utils.sh"
244
+ "tests/CLAUDE.md"
245
+ "tests/README.md"
246
+ )
247
+
248
+ for file in "${essential_files[@]}"; do
249
+ if [[ -f "$file" ]]; then
250
+ echo "✓ $file exists"
251
+ else
252
+ echo "✗ MISSING: $file"
253
+ runners_ok=false
254
+ fi
255
+ done
256
+
257
+ if [[ "$runners_ok" == "false" ]]; then
258
+ echo ""
259
+ echo "ERROR: Some essential files are missing!"
260
+ exit 1
261
+ fi
262
+
263
+ echo ""
264
+ echo "Final structure:"
265
+ echo " Loose files at root: $(find tests -maxdepth 1 -type f | wc -l)"
266
+ echo " Unit tests: $(find tests/unit -type f -name "*.test.ts" 2>/dev/null | wc -l) TypeScript files"
267
+ echo " Historical archive: $(find tests/archive/historical -type f 2>/dev/null | wc -l) files"
268
+ echo " Experimental archive: $(find tests/archive/experimental -type f 2>/dev/null | wc -l) files"
269
+ echo ""
270
+
271
+ echo "=========================================="
272
+ echo "Reorganization Complete!"
273
+ echo "=========================================="
274
+ echo ""
275
+ echo "Next steps:"
276
+ echo " 1. Verify: find tests -maxdepth 1 -type f"
277
+ echo " 2. Test: bash tests/cli-mode/run-all-tests.sh --quick"
278
+ echo " 3. Test: npm test"
279
+ echo " 4. Commit: git add tests/ && git commit -m 'refactor(tests): reorganize structure - 99 files organized'"
280
+ echo ""
@@ -5,6 +5,18 @@
5
5
  set -euo pipefail
6
6
 
7
7
  PROJECT_ROOT=$(git rev-parse --show-toplevel)
8
+
9
+ # Load credentials from root .env (centralized credential management)
10
+ # Note: This script primarily generates local secrets, but loads root .env for consistency
11
+ if [ -f "$PROJECT_ROOT/.env" ]; then
12
+ set -a # Auto-export variables
13
+ source "$PROJECT_ROOT/.env"
14
+ set +a
15
+ else
16
+ echo "WARNING: Root .env not found at $PROJECT_ROOT/.env"
17
+ echo "HINT: This is optional for setup script but required for production scripts"
18
+ fi
19
+
8
20
  TRIGGER_DEV_DIR="$PROJECT_ROOT/docker/trigger-dev"
9
21
  ENV_FILE="$TRIGGER_DEV_DIR/.env"
10
22
  ENV_TEMPLATE="$TRIGGER_DEV_DIR/.env.template"
package/tests/README.md CHANGED
@@ -69,10 +69,55 @@ tests/docker/run-all-tests.sh --integration # All integration tests (~10 min)
69
69
  tests/docker/run-all-tests.sh --full # Full suite with E2E (~30 min)
70
70
  ```
71
71
 
72
+ ### Unit Tests (TypeScript/JavaScript)
73
+ ```
74
+ tests/unit/
75
+ ├── agent-spawner/ Agent spawning and output validation
76
+ ├── auth/ Authentication system tests
77
+ ├── backup/ Backup manager tests
78
+ ├── cache/ Cache and correlation tests
79
+ ├── cfn-loop/ CFN Loop orchestration
80
+ ├── cli/ CLI formatting and tools
81
+ ├── config/ Configuration management
82
+ ├── coordination/ Coordination wrapper
83
+ ├── database/ Database services
84
+ ├── lock/ Distributed and file locking
85
+ ├── metrics/ Metrics logging
86
+ ├── security/ Command injection and security
87
+ ├── typescript/ TypeScript E2E documentation
88
+ └── [15+ other domains] Organized by domain
89
+ ```
90
+
91
+ **Run Commands:**
92
+ ```bash
93
+ npm test # All unit tests
94
+ npm test -- agent-spawner # Specific domain
95
+ npm test -- --coverage # With coverage
96
+ ```
97
+
98
+ ### Archive Structure
99
+ ```
100
+ tests/archive/
101
+ ├── historical/ Deprecated tests (8 shell scripts + docs)
102
+ │ ├── cli-mode-comprehensive-test.sh → Use cli-mode/run-all-tests.sh --full
103
+ │ ├── cli-mode-quick-validation.sh → Use cli-mode/run-all-tests.sh --quick
104
+ │ └── [Other deprecated tests]
105
+ └── experimental/ POC and research (59 files across 7 features)
106
+ ├── api-gateway/ API Gateway integration (on hold)
107
+ ├── hello-world/ Multi-layer coordination experiments
108
+ ├── cfn-loop/ CFN Loop variant implementations
109
+ ├── ace/ Agent Capability Expression experiments
110
+ ├── tdd-compliance/ TDD enforcement experiments
111
+ ├── playbooks/ Workflow codification research
112
+ └── workflows/ Event-driven workflow experiments
113
+ ```
114
+
72
115
  **Legacy Tests:**
73
116
  - Not included in test runners by default
74
117
  - Preserved for historical reference and regression debugging
75
118
  - See `tests/cli-mode/core/legacy/README.md` and `tests/docker/core/legacy/README.md`
119
+ - See `tests/archive/historical/README.md` for deprecated test reference
120
+ - See `tests/archive/experimental/README.md` for POC status
76
121
 
77
122
  ## Test Categories
78
123
 
@@ -1,34 +0,0 @@
1
- ---
2
- description: Show current cost-savings mode status and configuration
3
- tags: [config, status, coordination]
4
- ---
5
-
6
- Display current cost-savings mode status and coordinator configuration.
7
-
8
- **Usage:**
9
- - `/cost-savings-status` - Show mode status and details
10
-
11
- **What this shows:**
12
- - Current mode: CLI (cost-savings ON) or Task-tool (cost-savings OFF)
13
- - Active coordinator type sections in CLAUDE.md
14
- - Spawning method (spawn-workers.js vs Task tool)
15
- - Provider configuration for workers
16
- - Estimated cost savings percentage
17
-
18
- **Mode Indicators:**
19
- - **CLI Mode Active**: spawn-workers.js coordination, ~97% savings
20
- - **Task-tool Mode Active**: Task() coordination, full Claude quality
21
-
22
- **Execute status check:**
23
-
24
- ```bash
25
- npx claude-flow-cost-savings status
26
- ```
27
-
28
- **Output includes:**
29
- - Mode: CLI | Task-tool
30
- - CLAUDE.md sections: Active coordinator profiles
31
- - Spawning pattern: spawn-workers.js | Task()
32
- - Provider: z.ai | Claude Max
33
- - Cost savings: 0% | ~97%
34
- - Last toggled: timestamp
@@ -1,58 +0,0 @@
1
- # Metrics Summary
2
-
3
- Display aggregated metrics statistics with configurable time frame and manage metrics tracking.
4
-
5
- ## Usage
6
-
7
- ```bash
8
- # Display metrics summary
9
- /metrics-summary [--minutes=60] [--provider=all] [--model=all]
10
-
11
- # Manage tracking
12
- /metrics-summary --enable # Enable metrics tracking
13
- /metrics-summary --disable # Disable metrics tracking
14
- /metrics-summary --status # Check tracking status
15
- ```
16
-
17
- ## Parameters
18
-
19
- ### Display Metrics
20
- - `--minutes` - Time frame in minutes (default: 60 = last hour)
21
- - Examples: 60 (1 hour), 1440 (24 hours), 10080 (7 days)
22
- - `--provider` - Filter by provider: `all`, `anthropic`, `z.ai` (default: all)
23
- - `--model` - Filter by model name (default: all)
24
-
25
- ### Manage Tracking
26
- - `--enable` - Enable metrics tracking
27
- - `--disable` - Disable metrics tracking
28
- - `--status` - Check current tracking status
29
-
30
- ## Examples
31
-
32
- ```bash
33
- # Last hour stats (all providers)
34
- /metrics-summary
35
-
36
- # Last 24 hours
37
- /metrics-summary --minutes=1440
38
-
39
- # Last hour Z.ai only
40
- /metrics-summary --minutes=60 --provider=z.ai
41
-
42
- # Last 7 days GLM-4.6 only
43
- /metrics-summary --minutes=10080 --model=glm-4.6
44
-
45
- # Enable/disable tracking
46
- /metrics-summary --enable
47
- /metrics-summary --disable
48
- /metrics-summary --status
49
- ```
50
-
51
- ## Output
52
-
53
- - **API Requests**: Total count by provider
54
- - **Token Usage**: Input/Output/Total by provider and model
55
- - **Error Rate**: Success vs error percentage
56
- - **Cost Breakdown**: Estimated costs by provider (if pricing available)
57
- - **Top Models**: Most used models in time frame
58
- - **Performance**: Average API duration by provider