claude-flow-novice 2.2.4 → 2.2.5

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 (288) hide show
  1. package/package.json +9 -8
  2. package/scripts/.claude-flow/metrics/agent-metrics.json +1 -0
  3. package/scripts/.claude-flow/metrics/performance.json +9 -0
  4. package/scripts/.claude-flow/metrics/task-metrics.json +10 -0
  5. package/scripts/CLEANUP_OPTIMIZATION_REPORT.json +312 -0
  6. package/scripts/CLEANUP_PERFORMANCE_OPTIMIZATION.md +387 -0
  7. package/scripts/CLEANUP_QUICK_START.md +268 -0
  8. package/scripts/CLEANUP_TEST_RESULTS.md +205 -0
  9. package/scripts/README.md +339 -0
  10. package/scripts/ace-query.sh +384 -0
  11. package/scripts/agent-token-analysis.js +430 -0
  12. package/scripts/auto-setup.js +332 -0
  13. package/scripts/build/README.md +167 -0
  14. package/scripts/build/build-config.js +27 -0
  15. package/scripts/build/build-prompt-copier.sh +30 -0
  16. package/scripts/build/performance-monitor.js +869 -0
  17. package/scripts/build/prepare-publish.js +150 -0
  18. package/scripts/build/typescript-fixer.js +621 -0
  19. package/scripts/build/unified-builder.sh +428 -0
  20. package/scripts/build/update-bin-version.js +32 -0
  21. package/scripts/build/validate-agents.js +238 -0
  22. package/scripts/build-index.js +43 -0
  23. package/scripts/build-orchestrator.js +320 -0
  24. package/scripts/check-routing-stats.cjs +122 -0
  25. package/scripts/ci-validation.js +375 -0
  26. package/scripts/cleanup-blocking-coordination.sh +420 -0
  27. package/scripts/cleanup-idle-sessions.sh +59 -0
  28. package/scripts/collect-build-metrics.js +65 -0
  29. package/scripts/demo/README.md +79 -0
  30. package/scripts/demo/autoscaling-demo-simplified.js +963 -0
  31. package/scripts/demo/comprehensive-dashboard-test.js +693 -0
  32. package/scripts/demo/confidence-log.js +87 -0
  33. package/scripts/demo/confidence-report.js +82 -0
  34. package/scripts/demo/demo-multi-swarm-coordination.js +325 -0
  35. package/scripts/demo/demo-production-deployment.js +399 -0
  36. package/scripts/demo/demo-visualization-system.js +149 -0
  37. package/scripts/demo/performance-analysis.cjs +71 -0
  38. package/scripts/demo/performance-analysis.js +71 -0
  39. package/scripts/demo/test-autoscaling-demo.js +314 -0
  40. package/scripts/dependency-optimizer.js +349 -0
  41. package/scripts/dependency-security-assessment.js +331 -0
  42. package/scripts/deploy-sdk.sh +176 -0
  43. package/scripts/deployment-readiness-report.json +179 -0
  44. package/scripts/dev/README.md +264 -0
  45. package/scripts/dev/claude-flow-wrapper.sh +35 -0
  46. package/scripts/dev/claude-monitor.py +419 -0
  47. package/scripts/dev/claude-sparc.sh +562 -0
  48. package/scripts/dev/claude-wrapper.sh +17 -0
  49. package/scripts/dev/demo-phase3-compliance.js +172 -0
  50. package/scripts/dev/demo-task-system.ts +224 -0
  51. package/scripts/dev/deployment-validator.js +315 -0
  52. package/scripts/dev/spawn-claude-terminal.sh +32 -0
  53. package/scripts/dev/start-portal.sh +506 -0
  54. package/scripts/dev/start-web-ui.js +15 -0
  55. package/scripts/dev/stop-portal.sh +311 -0
  56. package/scripts/dev/validate-examples.ts +288 -0
  57. package/scripts/dev/validate-phase2.cjs +451 -0
  58. package/scripts/dev/validate-phase2.js +785 -0
  59. package/scripts/dev/validate-phase3.cjs +208 -0
  60. package/scripts/dev/validate-security-remediation.js +1 -0
  61. package/scripts/ecosystem.config.cjs +90 -0
  62. package/scripts/fix-js-extensions.js +167 -0
  63. package/scripts/generate-basic-types.js +73 -0
  64. package/scripts/generate-changelog.js +318 -0
  65. package/scripts/git-hooks/pre-commit.sh +143 -0
  66. package/scripts/health-checks.js +634 -0
  67. package/scripts/hook-wrapper.sh +54 -0
  68. package/scripts/install/README.md +375 -0
  69. package/scripts/install/REDIS_SETUP_VALIDATION.json +245 -0
  70. package/scripts/install/check-prerequisites.js +303 -0
  71. package/scripts/install/config-wizard.js +606 -0
  72. package/scripts/install/dependency-checker.js +385 -0
  73. package/scripts/install/health-check.js +765 -0
  74. package/scripts/install/install.js +256 -0
  75. package/scripts/install/installation-benchmark.js +461 -0
  76. package/scripts/install/quick-install.js +720 -0
  77. package/scripts/install/quick-start-wizard.js +295 -0
  78. package/scripts/install/redis-cli.js +289 -0
  79. package/scripts/install/redis-install-guides.md +407 -0
  80. package/scripts/install/redis-setup.js +559 -0
  81. package/scripts/install/redis-test.js +278 -0
  82. package/scripts/install/service-manager.js +672 -0
  83. package/scripts/install/setup.js +832 -0
  84. package/scripts/install/uninstall.js +526 -0
  85. package/scripts/install/update.js +461 -0
  86. package/scripts/install-pre-commit-hook.sh +127 -0
  87. package/scripts/legacy/README.md +272 -0
  88. package/scripts/legacy/batch-fix-ts.sh +54 -0
  89. package/scripts/legacy/build-migration.sh +105 -0
  90. package/scripts/legacy/build-monitor.js +209 -0
  91. package/scripts/legacy/build-with-filter.sh +84 -0
  92. package/scripts/legacy/build-workaround.sh +71 -0
  93. package/scripts/legacy/fix-ts-advanced.js +358 -0
  94. package/scripts/legacy/fix-ts-final.sh +50 -0
  95. package/scripts/legacy/fix-ts-targeted.sh +49 -0
  96. package/scripts/legacy/fix-typescript-errors.js +305 -0
  97. package/scripts/legacy/force-build.sh +63 -0
  98. package/scripts/legacy/optimize-performance.js +400 -0
  99. package/scripts/legacy/performance-monitor.js +263 -0
  100. package/scripts/legacy/performance-monitoring.js +532 -0
  101. package/scripts/legacy/performance-test-runner.js +645 -0
  102. package/scripts/legacy/quick-fix-ts.js +281 -0
  103. package/scripts/legacy/safe-build.sh +63 -0
  104. package/scripts/memory-monitor-coordinator.js +322 -0
  105. package/scripts/migrate-to-sdk.sh +520 -0
  106. package/scripts/migration/QUICK-START.md +189 -0
  107. package/scripts/migration/QUICK-START.md.backup-1760135091363 +189 -0
  108. package/scripts/migration/README.md +464 -0
  109. package/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md +500 -0
  110. package/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md.backup-1760135091348 +500 -0
  111. package/scripts/migration/UPDATE-PATHS-README.md +464 -0
  112. package/scripts/migration/UPDATE-PATHS-README.md.backup-1760135091337 +464 -0
  113. package/scripts/migration/example-patterns.json +19 -0
  114. package/scripts/migration/install-arm64.js +78 -0
  115. package/scripts/migration/install.js +83 -0
  116. package/scripts/migration/migrate-hooks.js +173 -0
  117. package/scripts/migration/migration-examples.ts +318 -0
  118. package/scripts/migration/reorganize-workspace.js +504 -0
  119. package/scripts/migration/test-update-paths.js +359 -0
  120. package/scripts/migration/update-paths.js +664 -0
  121. package/scripts/migration/validate-migration.js +647 -0
  122. package/scripts/monitor-loop.sh +65 -0
  123. package/scripts/monitor-memory.sh +47 -0
  124. package/scripts/monitor-migration.js +339 -0
  125. package/scripts/monitor.py +43 -0
  126. package/scripts/monitoring/README.md +178 -0
  127. package/scripts/monitoring/alert-monitor.sh +220 -0
  128. package/scripts/monitoring/analyze-resources.sh +199 -0
  129. package/scripts/monitoring/dashboards/rate-limiting-dashboard.json +211 -0
  130. package/scripts/monitoring/dynamic-monitor.sh +85 -0
  131. package/scripts/monitoring/launch-stability-test.sh +184 -0
  132. package/scripts/monitoring/monitor-test.sh +93 -0
  133. package/scripts/monitoring/pre-test-validation.sh +208 -0
  134. package/scripts/monitoring/quick-test-alerting.sh +118 -0
  135. package/scripts/monitoring/quick-test-rate-limiting.sh +206 -0
  136. package/scripts/monitoring/rate-limiting-monitor.sh +380 -0
  137. package/scripts/monitoring/resource-monitor.sh +126 -0
  138. package/scripts/monitoring/stability-monitor.js +429 -0
  139. package/scripts/monitoring/test-monitor-quick.sh +54 -0
  140. package/scripts/monitoring/view-alerts.sh +307 -0
  141. package/scripts/npm-metrics-collector.js +482 -0
  142. package/scripts/npm-package-validation.cjs +299 -0
  143. package/scripts/optimization/build-optimizer.js +438 -0
  144. package/scripts/optimization/config-validator.js +761 -0
  145. package/scripts/optimization/test-optimization.js +432 -0
  146. package/scripts/optimization/unified-activation.js +839 -0
  147. package/scripts/optimize-package-swarm.js +54 -0
  148. package/scripts/performance/ACTIVATION_COMMANDS.md +292 -0
  149. package/scripts/performance/sqlite-enhanced-activation.sh +583 -0
  150. package/scripts/performance/test-enhanced-backend.sh +504 -0
  151. package/scripts/performance-monitor.js +644 -0
  152. package/scripts/performance-test-runner.js +698 -0
  153. package/scripts/post-deployment-monitoring.js +350 -0
  154. package/scripts/post-edit-pipeline.js +2091 -0
  155. package/scripts/post-install-claude-md.js +78 -0
  156. package/scripts/postinstall.js +79 -0
  157. package/scripts/pre-publish-validation.cjs +212 -0
  158. package/scripts/pre-publish-validation.js +429 -0
  159. package/scripts/redis-lua/cleanup-blocking-coordination.lua +198 -0
  160. package/scripts/release-announcement.js +425 -0
  161. package/scripts/release-notification.js +248 -0
  162. package/scripts/release-rollback.js +376 -0
  163. package/scripts/release-validation.js +460 -0
  164. package/scripts/rollback-sdk.sh +66 -0
  165. package/scripts/run-production-validation.ts +590 -0
  166. package/scripts/run-stability-validation.sh +687 -0
  167. package/scripts/security/README.md +339 -0
  168. package/scripts/security/deployment-validation.cjs +279 -0
  169. package/scripts/security/envelope-encryption-confidence-report.cjs +422 -0
  170. package/scripts/security/install-git-hooks.sh +132 -0
  171. package/scripts/security/install-git-secrets.sh +295 -0
  172. package/scripts/security/rotate-api-keys.js +469 -0
  173. package/scripts/security/ruv-swarm-safe.js +74 -0
  174. package/scripts/security/security-audit.cjs +538 -0
  175. package/scripts/security/setup-redis-auth.sh +397 -0
  176. package/scripts/security/validate-envelope-encryption.cjs +340 -0
  177. package/scripts/security-scan.js +492 -0
  178. package/scripts/src/web/frontend/.claude-flow/metrics/agent-metrics.json +1 -0
  179. package/scripts/src/web/frontend/.claude-flow/metrics/performance.json +9 -0
  180. package/scripts/src/web/frontend/.claude-flow/metrics/task-metrics.json +10 -0
  181. package/scripts/switch-api.sh +158 -0
  182. package/scripts/sync-agents.js +290 -0
  183. package/scripts/test/50-agent-test.js +625 -0
  184. package/scripts/test/NEW_STABILITY_TEST_GUIDE.md +407 -0
  185. package/scripts/test/README.md +236 -0
  186. package/scripts/test/STABILITY_TEST_EXAMPLE.md +347 -0
  187. package/scripts/test/STABILITY_TEST_README.md +480 -0
  188. package/scripts/test/agent-worker.js +309 -0
  189. package/scripts/test/ai-coordination-test.js +650 -0
  190. package/scripts/test/ai-mesh-coordination-test.js +416 -0
  191. package/scripts/test/check-links.ts +274 -0
  192. package/scripts/test/check-performance-regression.ts +168 -0
  193. package/scripts/test/cli-agent-coordination-test.js +313 -0
  194. package/scripts/test/coordinator-multilingual-test.js +396 -0
  195. package/scripts/test/coordinator-transparency-demo.js +585 -0
  196. package/scripts/test/coverage-report.ts +692 -0
  197. package/scripts/test/generate-swarm-tests.js +633 -0
  198. package/scripts/test/integration-test-validation.cjs +253 -0
  199. package/scripts/test/load-test-swarm.js +576 -0
  200. package/scripts/test/mesh-coordination-zero-overlap-test.js +740 -0
  201. package/scripts/test/multilingual-hello-world-test.js +390 -0
  202. package/scripts/test/quick-multilingual-demo.js +464 -0
  203. package/scripts/test/real-agent-test.js +312 -0
  204. package/scripts/test/run-phase3-compliance-tests.js +427 -0
  205. package/scripts/test/run-stability-test-examples.sh +292 -0
  206. package/scripts/test/stability-results/stability-metrics.jsonl +83 -0
  207. package/scripts/test/stability-results/stability-test-report.json +128 -0
  208. package/scripts/test/stability-results/stability-test.log +1827 -0
  209. package/scripts/test/stability-test-50-agents.js +734 -0
  210. package/scripts/test/test-batch-tasks.ts +29 -0
  211. package/scripts/test/test-byzantine-resolution.js +246 -0
  212. package/scripts/test/test-claude-spawn-options.sh +63 -0
  213. package/scripts/test/test-cli-wizard.js +331 -0
  214. package/scripts/test/test-comprehensive.js +401 -0
  215. package/scripts/test/test-coordination-features.ts +238 -0
  216. package/scripts/test/test-fallback-systems.js +276 -0
  217. package/scripts/test/test-init-command.ts +302 -0
  218. package/scripts/test/test-mcp.ts +251 -0
  219. package/scripts/test/test-runner.ts +568 -0
  220. package/scripts/test/test-swarm-integration.sh +92 -0
  221. package/scripts/test/test-swarm.ts +142 -0
  222. package/scripts/test/validation-summary.ts +408 -0
  223. package/scripts/test-cleanup-performance.sh +416 -0
  224. package/scripts/test-dashboard-auth.cjs +203 -0
  225. package/scripts/test-docker-deployment.sh +207 -0
  226. package/scripts/test-npm-package.cjs +167 -0
  227. package/scripts/test-provider-routing.cjs +226 -0
  228. package/scripts/test-routing-telemetry.cjs +147 -0
  229. package/scripts/test-runner.cjs +154 -0
  230. package/scripts/test-zai-10k.cjs +81 -0
  231. package/scripts/test-zai-api.cjs +191 -0
  232. package/scripts/test-zai-diagnostic.cjs +151 -0
  233. package/scripts/test-zai-final.cjs +128 -0
  234. package/scripts/test-zai-with-env.cjs +85 -0
  235. package/scripts/utils/README.md +261 -0
  236. package/scripts/utils/clean-build-artifacts.sh +94 -0
  237. package/scripts/utils/cleanup-root.sh +69 -0
  238. package/scripts/utils/fix-cliffy-imports.js +307 -0
  239. package/scripts/utils/fix-duplicate-imports.js +114 -0
  240. package/scripts/utils/fix-error-handling.cjs +70 -0
  241. package/scripts/utils/fix-import-paths.js +104 -0
  242. package/scripts/utils/fix-imports.js +116 -0
  243. package/scripts/utils/fix-shebang.js +78 -0
  244. package/scripts/utils/fix-test-modules.js +27 -0
  245. package/scripts/utils/fix-timezone-issue-246.js +200 -0
  246. package/scripts/utils/fix-ts-comprehensive.py +182 -0
  247. package/scripts/utils/fix-ts-targeted-batch.js +250 -0
  248. package/scripts/utils/remove-benchmark-conflicts.sh +140 -0
  249. package/scripts/utils/simple-test-fixer.js +190 -0
  250. package/scripts/utils/validate-metrics-structure.cjs +144 -0
  251. package/scripts/validate-agent-hooks.js +506 -0
  252. package/scripts/validate-changelog.js +241 -0
  253. package/scripts/validate-coordination-cli.js +69 -0
  254. package/scripts/validate-coordination-toggle-integration.cjs +501 -0
  255. package/scripts/validate-docker-infrastructure.sh +502 -0
  256. package/scripts/validate-entry-points.js +300 -0
  257. package/scripts/validate-stage3-performance.ts +377 -0
  258. package/scripts/validate-template-bundling.js +180 -0
  259. package/scripts/validation/README.md +33 -0
  260. package/scripts/validation/acl-security-validation.cjs +214 -0
  261. package/scripts/validation/acl-security-validation.js +402 -0
  262. package/scripts/validation/byzantine-verification.js +407 -0
  263. package/scripts/validation/final-phase-2-consensus.cjs +219 -0
  264. package/scripts/validation/final-security-validation.js +791 -0
  265. package/scripts/validation/final-wasm-validation.cjs +840 -0
  266. package/scripts/validation/integration-test-analysis.js +105 -0
  267. package/scripts/validation/phase-0-comprehensive-validation.js +474 -0
  268. package/scripts/validation/phase-0-consensus-report.js +139 -0
  269. package/scripts/validation/phase-0-final-report.js +112 -0
  270. package/scripts/validation/phase-0-redis-consensus-report.js +129 -0
  271. package/scripts/validation/phase-0-validation-improved.js +490 -0
  272. package/scripts/validation/phase-0-validation-test.js +65 -0
  273. package/scripts/validation/phase-1-consensus-report.cjs +342 -0
  274. package/scripts/validation/phase-1-consensus-validation.cjs +551 -0
  275. package/scripts/validation/phase-1-consensus-validation.js +551 -0
  276. package/scripts/validation/phase-2-consensus-report.cjs +186 -0
  277. package/scripts/validation/phase-2-validation.cjs +171 -0
  278. package/scripts/validation/phase-2-validation.js +171 -0
  279. package/scripts/validation/phase-4-consensus-report.js +181 -0
  280. package/scripts/validation/phase-4-final-validation.js +351 -0
  281. package/scripts/validation/phase-5-consensus-report.cjs +113 -0
  282. package/scripts/validation/phase-5-consensus-report.js +113 -0
  283. package/scripts/validation/security-analysis.js +49 -0
  284. package/scripts/validation/security-validation.js +492 -0
  285. package/scripts/validation/simple-security-validation.js +464 -0
  286. package/scripts/verify-installation.js +112 -0
  287. package/scripts/verify-mcp-server.js +86 -0
  288. package/scripts/verify-sdk-phase1.cjs +293 -0
@@ -0,0 +1,94 @@
1
+ #!/bin/bash
2
+
3
+ # Build Artifacts Cleanup Script
4
+ # Safe removal of regenerable build artifacts
5
+ # Author: CI/CD Pipeline Engineer
6
+ # Generated: 2025-09-26
7
+
8
+ set -e
9
+
10
+ echo "🧹 Claude Flow Build Artifacts Cleanup"
11
+ echo "======================================"
12
+
13
+ # Verify we're in the right directory
14
+ if [ ! -f "package.json" ]; then
15
+ echo "❌ Error: Not in project root directory"
16
+ exit 1
17
+ fi
18
+
19
+ # Function to safely remove if exists
20
+ safe_remove() {
21
+ local path="$1"
22
+ local description="$2"
23
+
24
+ if [ -e "$path" ]; then
25
+ echo "🗑️ Removing $description: $path"
26
+ rm -rf "$path"
27
+ echo "✅ Removed successfully"
28
+ else
29
+ echo "ℹ️ Not found: $path"
30
+ fi
31
+ }
32
+
33
+ # Function to calculate size before removal
34
+ calculate_size() {
35
+ local path="$1"
36
+ if [ -e "$path" ]; then
37
+ du -sh "$path" 2>/dev/null | cut -f1
38
+ else
39
+ echo "0"
40
+ fi
41
+ }
42
+
43
+ echo ""
44
+ echo "📊 Calculating space to be recovered..."
45
+
46
+ # Calculate sizes
47
+ DIST_SIZE=$(calculate_size "dist")
48
+ BUILD_CONSOLIDATED_SIZE=$(calculate_size "build-consolidated.js")
49
+ STALE_PNPM_SIZE=$(calculate_size "pnpm-lock.yaml")
50
+
51
+ echo "📁 dist/ directory: $DIST_SIZE"
52
+ echo "📄 build-consolidated.js: $BUILD_CONSOLIDATED_SIZE"
53
+ echo "📄 pnpm-lock.yaml (stale): $STALE_PNPM_SIZE"
54
+
55
+ echo ""
56
+ echo "🚀 Starting cleanup..."
57
+
58
+ # 1. Remove main build output directory
59
+ safe_remove "dist" "TypeScript compiled output directory"
60
+
61
+ # 2. Remove temporary build script
62
+ safe_remove "build-consolidated.js" "temporary build script"
63
+
64
+ # 3. Remove stale PNPM lockfile (npm is being used)
65
+ if [ -f "pnpm-lock.yaml" ] && [ -f "package-lock.json" ]; then
66
+ echo "🔍 Found both pnpm-lock.yaml and package-lock.json"
67
+ echo "📅 pnpm-lock.yaml is older (Sep 24) vs package-lock.json (Sep 26)"
68
+ safe_remove "pnpm-lock.yaml" "stale PNPM lockfile"
69
+ fi
70
+
71
+ # 4. Remove any temporary directories created during build
72
+ safe_remove ".crdt-data" "temporary CRDT data"
73
+ safe_remove ".demo-crdt-data" "temporary demo CRDT data"
74
+
75
+ # 5. Remove TypeScript incremental build info (if any)
76
+ find . -name "*.tsbuildinfo" -not -path "./node_modules/*" -delete 2>/dev/null || true
77
+
78
+ # 6. Remove any Jest cache (if present)
79
+ safe_remove ".jest" "Jest cache directory"
80
+
81
+ # 7. Remove any coverage reports (if present)
82
+ safe_remove "coverage" "test coverage reports"
83
+ safe_remove ".nyc_output" "NYC coverage output"
84
+
85
+ echo ""
86
+ echo "✅ Build artifacts cleanup completed!"
87
+ echo ""
88
+ echo "🔧 To regenerate build artifacts:"
89
+ echo " npm run build # Rebuilds dist/ directory"
90
+ echo " npm test # Regenerates test artifacts"
91
+ echo ""
92
+ echo "📈 Space recovered: ~$DIST_SIZE + additional temp files"
93
+ echo ""
94
+ echo "⚠️ Note: All removed files can be regenerated via npm scripts"
@@ -0,0 +1,69 @@
1
+ #!/bin/bash
2
+
3
+ # Claude-Flow Root Directory Cleanup Script
4
+ # This script organizes test files and documentation into appropriate directories
5
+
6
+ echo "🧹 Starting Claude-Flow root directory cleanup..."
7
+
8
+ # Create archive directories if they don't exist
9
+ mkdir -p archive/reports
10
+ mkdir -p archive/test-files
11
+ mkdir -p archive/debug-docs
12
+
13
+ # Move test reports and debugging documentation to archive
14
+ echo "📁 Moving test reports and debug documentation..."
15
+ mv -v CONFIGURATION_SUMMARY.md archive/reports/ 2>/dev/null || true
16
+ mv -v DEPENDENCY_RESOLUTION_GUIDE.md archive/reports/ 2>/dev/null || true
17
+ mv -v DOCKER_TEST_REPORT.md archive/reports/ 2>/dev/null || true
18
+ mv -v ERROR_HANDLING_IMPLEMENTATION_REPORT.md archive/reports/ 2>/dev/null || true
19
+ mv -v QA_TEST_REPORT.md archive/reports/ 2>/dev/null || true
20
+ mv -v ROLLBACK_PLAN.md archive/reports/ 2>/dev/null || true
21
+ mv -v WEB_UI_IMPLEMENTATION.md archive/reports/ 2>/dev/null || true
22
+ mv -v debug-findings.md archive/debug-docs/ 2>/dev/null || true
23
+ mv -v debug-hooks-system-SOLUTION.md archive/debug-docs/ 2>/dev/null || true
24
+ mv -v mcp-validation-report.md archive/reports/ 2>/dev/null || true
25
+ mv -v ruv-swarm-performance-analysis.md archive/reports/ 2>/dev/null || true
26
+
27
+ # Move test JavaScript files to test archive
28
+ echo "📁 Moving test JavaScript files..."
29
+ mv -v test*.js archive/test-files/ 2>/dev/null || true
30
+ mv -v test*.cjs archive/test-files/ 2>/dev/null || true
31
+ mv -v terminal-test.cjs archive/test-files/ 2>/dev/null || true
32
+
33
+ # Move deployment audit log
34
+ echo "📁 Moving audit logs..."
35
+ mv -v deployment-audit.log archive/reports/ 2>/dev/null || true
36
+
37
+ # Keep only essential files in root:
38
+ # - README.md (main documentation)
39
+ # - CHANGELOG.md (version history)
40
+ # - CLAUDE.md (Claude Code integration guide)
41
+ # - LICENSE
42
+ # - package.json, package-lock.json
43
+ # - configuration files
44
+ # - main entry points
45
+
46
+ echo ""
47
+ echo "✅ Essential files kept in root:"
48
+ echo "- README.md (main documentation)"
49
+ echo "- CHANGELOG.md (version history)"
50
+ echo "- CLAUDE.md (Claude Code integration)"
51
+ echo "- LICENSE"
52
+ echo "- package.json & package-lock.json"
53
+ echo "- Configuration files (.gitignore, .npmignore, etc.)"
54
+ echo "- Main entry points (cli.js, claude-flow)"
55
+
56
+ echo ""
57
+ echo "📊 Cleanup Summary:"
58
+ echo "- Test reports moved to: archive/reports/"
59
+ echo "- Test files moved to: archive/test-files/"
60
+ echo "- Debug docs moved to: archive/debug-docs/"
61
+
62
+ # Show current root directory status
63
+ echo ""
64
+ echo "📂 Current root directory (*.md files):"
65
+ ls -la *.md 2>/dev/null | grep -v "^d" || echo "No .md files remaining"
66
+
67
+ echo ""
68
+ echo "🧹 Cleanup complete! Root directory is now organized."
69
+ echo "💡 To restore files, check the archive/ directory"
@@ -0,0 +1,307 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Script to fix Cliffy imports by creating a compatibility layer
5
+ * This allows using Deno's Cliffy modules in Node.js
6
+ */
7
+
8
+ import { promises as fs } from 'fs';
9
+ import path from 'path';
10
+ import { fileURLToPath } from 'url';
11
+
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = path.dirname(__filename);
14
+
15
+ // Create Cliffy compatibility modules
16
+ const cliffyModules = {
17
+ '@cliffy/command': `
18
+ export class Command {
19
+ constructor() {
20
+ this._name = '';
21
+ this._version = '';
22
+ this._description = '';
23
+ this._options = [];
24
+ this._commands = new Map();
25
+ this._action = null;
26
+ }
27
+
28
+ name(name) {
29
+ this._name = name;
30
+ return this;
31
+ }
32
+
33
+ version(version) {
34
+ this._version = version;
35
+ return this;
36
+ }
37
+
38
+ description(description) {
39
+ this._description = description;
40
+ return this;
41
+ }
42
+
43
+ arguments(args) {
44
+ this._arguments = args;
45
+ return this;
46
+ }
47
+
48
+ option(flags, description, options) {
49
+ this._options.push({ flags, description, options });
50
+ return this;
51
+ }
52
+
53
+ action(fn) {
54
+ this._action = fn;
55
+ return this;
56
+ }
57
+
58
+ command(name, command) {
59
+ if (command) {
60
+ this._commands.set(name, command);
61
+ }
62
+ return command || new Command();
63
+ }
64
+
65
+ async parse(args) {
66
+ // Simple parse implementation
67
+ const parsed = { options: {}, args: [] };
68
+ return parsed;
69
+ }
70
+
71
+ help() {
72
+ console.log(\`Command: \${this._name}\`);
73
+ console.log(\`Version: \${this._version}\`);
74
+ console.log(\`Description: \${this._description}\`);
75
+ }
76
+
77
+ showHelp() {
78
+ this.help();
79
+ }
80
+ }
81
+ `,
82
+ '@cliffy/table': `
83
+ export class Table {
84
+ constructor() {
85
+ this._headers = [];
86
+ this._rows = [];
87
+ this._options = {};
88
+ }
89
+
90
+ static from(data) {
91
+ const table = new Table();
92
+ if (Array.isArray(data) && data.length > 0) {
93
+ if (typeof data[0] === 'object') {
94
+ table._headers = Object.keys(data[0]);
95
+ table._rows = data.map(row => Object.values(row));
96
+ } else {
97
+ table._rows = data;
98
+ }
99
+ }
100
+ return table;
101
+ }
102
+
103
+ header(headers) {
104
+ this._headers = headers;
105
+ return this;
106
+ }
107
+
108
+ body(rows) {
109
+ this._rows = rows;
110
+ return this;
111
+ }
112
+
113
+ push(...rows) {
114
+ this._rows.push(...rows);
115
+ return this;
116
+ }
117
+
118
+ padding(padding) {
119
+ this._options.padding = padding;
120
+ return this;
121
+ }
122
+
123
+ indent(indent) {
124
+ this._options.indent = indent;
125
+ return this;
126
+ }
127
+
128
+ border(border) {
129
+ this._options.border = border;
130
+ return this;
131
+ }
132
+
133
+ toString() {
134
+ // Simple table rendering
135
+ let result = '';
136
+ if (this._headers.length) {
137
+ result += this._headers.join(' | ') + '\\n';
138
+ result += '-'.repeat(this._headers.join(' | ').length) + '\\n';
139
+ }
140
+ for (const row of this._rows) {
141
+ result += row.join(' | ') + '\\n';
142
+ }
143
+ return result;
144
+ }
145
+
146
+ render() {
147
+ console.log(this.toString());
148
+ }
149
+ }
150
+ `,
151
+ '@cliffy/ansi/colors': `
152
+ const colorize = (code) => (text) => \`\\x1b[\${code}m\${text}\\x1b[0m\`;
153
+
154
+ export const red = colorize('31');
155
+ export const green = colorize('32');
156
+ export const yellow = colorize('33');
157
+ export const blue = colorize('34');
158
+ export const magenta = colorize('35');
159
+ export const cyan = colorize('36');
160
+ export const white = colorize('37');
161
+ export const gray = colorize('90');
162
+ export const bold = colorize('1');
163
+ export const dim = colorize('2');
164
+ export const italic = colorize('3');
165
+ export const underline = colorize('4');
166
+ export const inverse = colorize('7');
167
+ export const hidden = colorize('8');
168
+ export const strikethrough = colorize('9');
169
+ export const bgRed = colorize('41');
170
+ export const bgGreen = colorize('42');
171
+ export const bgYellow = colorize('43');
172
+ export const bgBlue = colorize('44');
173
+ export const bgMagenta = colorize('45');
174
+ export const bgCyan = colorize('46');
175
+ export const bgWhite = colorize('47');
176
+
177
+ export const colors = {
178
+ red, green, yellow, blue, magenta, cyan, white, gray,
179
+ bold, dim, italic, underline, inverse, hidden, strikethrough,
180
+ bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite
181
+ };
182
+ `,
183
+ '@cliffy/prompt': `
184
+ export const prompt = async (questions) => {
185
+ const answers = {};
186
+ for (const q of questions) {
187
+ console.log(q.message);
188
+ // Simplified implementation
189
+ answers[q.name] = q.default || '';
190
+ }
191
+ return answers;
192
+ };
193
+
194
+ export const confirm = async (options) => {
195
+ console.log(options.message);
196
+ return options.default !== false;
197
+ };
198
+
199
+ export const input = async (options) => {
200
+ console.log(options.message);
201
+ return options.default || '';
202
+ };
203
+
204
+ export const number = async (options) => {
205
+ console.log(options.message);
206
+ return options.default || 0;
207
+ };
208
+
209
+ export const secret = async (options) => {
210
+ console.log(options.message);
211
+ return options.default || '';
212
+ };
213
+
214
+ export const select = async (options) => {
215
+ console.log(options.message);
216
+ return options.options?.[0] || options.default || '';
217
+ };
218
+
219
+ export const checkbox = async (options) => {
220
+ console.log(options.message);
221
+ return options.default || [];
222
+ };
223
+
224
+ // Add class exports
225
+ export class Select {
226
+ constructor(options) {
227
+ this.options = options;
228
+ }
229
+ async prompt() {
230
+ return select(this.options);
231
+ }
232
+ }
233
+
234
+ export class Input {
235
+ constructor(options) {
236
+ this.options = options;
237
+ }
238
+ async prompt() {
239
+ return input(this.options);
240
+ }
241
+ }
242
+
243
+ export class Confirm {
244
+ constructor(options) {
245
+ this.options = options;
246
+ }
247
+ async prompt() {
248
+ return confirm(this.options);
249
+ }
250
+ }
251
+
252
+ export class Number {
253
+ constructor(options) {
254
+ this.options = options;
255
+ }
256
+ async prompt() {
257
+ return number(this.options);
258
+ }
259
+ }
260
+ `
261
+ };
262
+
263
+ async function createCliffyModules() {
264
+ const nodeModulesDir = path.join(__dirname, '..', 'node_modules');
265
+ const cliffyDir = path.join(nodeModulesDir, '@cliffy');
266
+
267
+ // Create @cliffy directory
268
+ await fs.mkdir(cliffyDir, { recursive: true });
269
+
270
+ // Create each module
271
+ for (const [modulePath, content] of Object.entries(cliffyModules)) {
272
+ const parts = modulePath.split('/');
273
+ const moduleName = parts[1];
274
+ const subPath = parts[2];
275
+
276
+ const moduleDir = path.join(cliffyDir, moduleName);
277
+ await fs.mkdir(moduleDir, { recursive: true });
278
+
279
+ if (subPath) {
280
+ // Create subdirectory for nested modules
281
+ const fullPath = path.join(moduleDir, subPath + '.js');
282
+ const dirPath = path.dirname(fullPath);
283
+ await fs.mkdir(dirPath, { recursive: true });
284
+ await fs.writeFile(fullPath, content.trim());
285
+ } else {
286
+ // Create main module file
287
+ await fs.writeFile(path.join(moduleDir, 'index.js'), content.trim());
288
+ }
289
+
290
+ // Create package.json for the module
291
+ const packageJson = {
292
+ name: modulePath,
293
+ version: '0.22.2',
294
+ main: subPath ? `${subPath}.js` : 'index.js',
295
+ type: 'module'
296
+ };
297
+ await fs.writeFile(
298
+ path.join(moduleDir, 'package.json'),
299
+ JSON.stringify(packageJson, null, 2)
300
+ );
301
+ }
302
+
303
+ console.log('✅ Created Cliffy compatibility modules');
304
+ }
305
+
306
+ // Run the script
307
+ createCliffyModules().catch(console.error);
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Script to fix duplicate imports in the codebase
5
+ */
6
+
7
+ import { promises as fs } from 'node:fs';
8
+ import { join } from 'node:path';
9
+ import { fileURLToPath } from 'node:url';
10
+ import { dirname } from 'node:path';
11
+
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = dirname(__filename);
14
+
15
+ async function removeDuplicateImports(filePath) {
16
+ try {
17
+ let content = await fs.readFile(filePath, 'utf-8');
18
+ let modified = false;
19
+
20
+ // Remove duplicate error handler imports
21
+ const errorHandlerRegex = /import\s+{\s*getErrorMessage\s*}\s+from\s+['"].*?error-handler\.js['"];\s*\n/g;
22
+ const matches = content.match(errorHandlerRegex);
23
+
24
+ if (matches && matches.length > 1) {
25
+ // Keep only the first import
26
+ let firstFound = false;
27
+ content = content.replace(errorHandlerRegex, (match) => {
28
+ if (!firstFound) {
29
+ firstFound = true;
30
+ return match;
31
+ }
32
+ modified = true;
33
+ return '';
34
+ });
35
+ }
36
+
37
+ // Remove duplicate fs imports
38
+ const fsImportRegex = /import\s+{\s*promises\s+as\s+fs\s*}\s+from\s+['"]node:fs['"];\s*\n/g;
39
+ const fsMatches = content.match(fsImportRegex);
40
+
41
+ if (fsMatches && fsMatches.length > 1) {
42
+ // Keep only the first import
43
+ let firstFound = false;
44
+ content = content.replace(fsImportRegex, (match) => {
45
+ if (!firstFound) {
46
+ firstFound = true;
47
+ return match;
48
+ }
49
+ modified = true;
50
+ return '';
51
+ });
52
+ }
53
+
54
+ // Fix duplicate type imports
55
+ const typeImportRegex = /import\s+type\s+{\s*([^}]+)\s*}\s+from\s+['"]([^'"]+)['"];\s*\n/g;
56
+ const typeImports = new Map();
57
+
58
+ content = content.replace(typeImportRegex, (match, types, from) => {
59
+ const key = from;
60
+ if (typeImports.has(key)) {
61
+ // Merge with existing import
62
+ const existing = typeImports.get(key);
63
+ const newTypes = types.split(',').map(t => t.trim());
64
+ const existingTypes = existing.split(',').map(t => t.trim());
65
+ const allTypes = [...new Set([...existingTypes, ...newTypes])];
66
+ typeImports.set(key, allTypes.join(', '));
67
+ modified = true;
68
+ return '';
69
+ } else {
70
+ typeImports.set(key, types);
71
+ return match;
72
+ }
73
+ });
74
+
75
+ if (modified) {
76
+ await fs.writeFile(filePath, content);
77
+ console.log(`✅ Fixed duplicate imports in: ${filePath}`);
78
+ }
79
+ } catch (error) {
80
+ console.error(`❌ Error processing ${filePath}:`, error.message);
81
+ }
82
+ }
83
+
84
+ async function findTypeScriptFiles(dir) {
85
+ const files = [];
86
+ const entries = await fs.readdir(dir, { withFileTypes: true });
87
+
88
+ for (const entry of entries) {
89
+ const fullPath = join(dir, entry.name);
90
+
91
+ if (entry.isDirectory() && !entry.name.includes('node_modules') && !entry.name.includes('dist')) {
92
+ files.push(...await findTypeScriptFiles(fullPath));
93
+ } else if (entry.isFile() && entry.name.endsWith('.ts')) {
94
+ files.push(fullPath);
95
+ }
96
+ }
97
+
98
+ return files;
99
+ }
100
+
101
+ async function main() {
102
+ const srcDir = join(dirname(__dirname), 'src');
103
+ const files = await findTypeScriptFiles(srcDir);
104
+
105
+ console.log(`Found ${files.length} TypeScript files to check...`);
106
+
107
+ for (const file of files) {
108
+ await removeDuplicateImports(file);
109
+ }
110
+
111
+ console.log('✅ Duplicate import fixes complete!');
112
+ }
113
+
114
+ main().catch(console.error);
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const glob = require('glob');
6
+
7
+ // Find all TypeScript files
8
+ const files = glob.sync('src/**/*.ts', {
9
+ ignore: ['src/**/*.test.ts', 'src/**/*.spec.ts']
10
+ });
11
+
12
+ let totalFixed = 0;
13
+
14
+ files.forEach(file => {
15
+ let content = fs.readFileSync(file, 'utf8');
16
+ let modified = false;
17
+
18
+ // Fix error handling patterns
19
+ const patterns = [
20
+ // Fix unknown error types in catch blocks
21
+ {
22
+ regex: /catch\s*\(\s*error\s*\)\s*{([^}]+error\.message)/g,
23
+ replacement: 'catch (error) {$1'
24
+ },
25
+ // Fix error.message access
26
+ {
27
+ regex: /(\$\{|`)error\.message/g,
28
+ replacement: '$1(error instanceof Error ? error.message : String(error))'
29
+ },
30
+ // Fix standalone error.message
31
+ {
32
+ regex: /([^`$])error\.message/g,
33
+ replacement: '$1(error instanceof Error ? error.message : String(error))'
34
+ },
35
+ // Fix error type annotations
36
+ {
37
+ regex: /catch\s*\(\s*error:\s*any\s*\)/g,
38
+ replacement: 'catch (error)'
39
+ },
40
+ // Fix error type in functions
41
+ {
42
+ regex: /\(error:\s*unknown\)/g,
43
+ replacement: '(error)'
44
+ }
45
+ ];
46
+
47
+ patterns.forEach(pattern => {
48
+ const before = content;
49
+ content = content.replace(pattern.regex, pattern.replacement);
50
+ if (before !== content) {
51
+ modified = true;
52
+ }
53
+ });
54
+
55
+ if (modified) {
56
+ // Add error handler import if needed
57
+ if (!content.includes("from '../utils/error-handler'") &&
58
+ !content.includes("from '../../utils/error-handler'") &&
59
+ content.includes('error instanceof Error')) {
60
+ const importPath = file.includes('cli/commands') ? '../../utils/error-handler' : '../utils/error-handler';
61
+ content = `import { getErrorMessage } from '${importPath}';\n` + content;
62
+ }
63
+
64
+ fs.writeFileSync(file, content);
65
+ totalFixed++;
66
+ console.log(`Fixed: ${file}`);
67
+ }
68
+ });
69
+
70
+ console.log(`\nTotal files fixed: ${totalFixed}`);