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,84 @@
1
+ #!/bin/bash
2
+ # Build script that works around Deno compile deprecation warnings
3
+
4
+ echo "šŸ”Ø Building Claude Flow (filtering deprecation warnings)..."
5
+
6
+ # Ensure bin directory exists
7
+ mkdir -p bin
8
+
9
+ # Set Deno path
10
+ export PATH="/home/codespace/.deno/bin:$PATH"
11
+
12
+ # Remove any existing binary to avoid conflicts
13
+ rm -f bin/claude-flow
14
+
15
+ # Create a temporary script that will capture the build process
16
+ cat > /tmp/deno-build.sh << 'EOF'
17
+ #!/bin/bash
18
+ # Run deno compile and capture all output
19
+ deno compile --allow-all --no-check --output bin/claude-flow src/cli/main.ts 2>&1
20
+ EOF
21
+
22
+ chmod +x /tmp/deno-build.sh
23
+
24
+ # Run the build and capture output
25
+ BUILD_OUTPUT=$(/tmp/deno-build.sh)
26
+ BUILD_EXIT_CODE=$?
27
+
28
+ # Check if the binary was created despite the error
29
+ if [ -f "bin/claude-flow" ]; then
30
+ echo "āœ… Binary created successfully!"
31
+ chmod +x bin/claude-flow
32
+
33
+ # Test if it works
34
+ if bin/claude-flow --version &>/dev/null; then
35
+ echo "āœ… Binary is functional!"
36
+ echo "šŸ“ Location: bin/claude-flow"
37
+ exit 0
38
+ else
39
+ echo "āš ļø Binary was created but may not be functional"
40
+ fi
41
+ else
42
+ # Check for temporary files that might have been created
43
+ TEMP_FILES=$(find bin -name "claude-flow.tmp*" -type f 2>/dev/null)
44
+
45
+ if [ -n "$TEMP_FILES" ]; then
46
+ echo "šŸ“¦ Found temporary build artifacts..."
47
+
48
+ for temp_file in $TEMP_FILES; do
49
+ echo " Checking: $temp_file"
50
+
51
+ # Check if it's a valid executable
52
+ if file "$temp_file" | grep -q "executable"; then
53
+ echo " āœ… Valid executable found!"
54
+
55
+ # Move it to the final location
56
+ mv "$temp_file" bin/claude-flow
57
+ chmod +x bin/claude-flow
58
+
59
+ if bin/claude-flow --version &>/dev/null; then
60
+ echo "āœ… Build successful!"
61
+ echo "šŸ“ Location: bin/claude-flow"
62
+ exit 0
63
+ fi
64
+ fi
65
+ done
66
+ fi
67
+ fi
68
+
69
+ # If we get here, build failed
70
+ echo "āŒ Build failed"
71
+ echo ""
72
+ echo "Build output:"
73
+ echo "$BUILD_OUTPUT" | grep -v "Import assertions are deprecated"
74
+
75
+ # Restore backup if available
76
+ if [ -f "bin/claude-flow.working-backup" ]; then
77
+ echo ""
78
+ echo "šŸ”„ Restoring working backup..."
79
+ cp bin/claude-flow.working-backup bin/claude-flow
80
+ chmod +x bin/claude-flow
81
+ echo "āœ… Backup restored"
82
+ fi
83
+
84
+ exit 1
@@ -0,0 +1,71 @@
1
+ #!/bin/bash
2
+ # Workaround build script for Deno deprecation warning
3
+
4
+ echo "šŸ”Ø Building Claude Flow with workaround..."
5
+
6
+ # Ensure bin directory exists
7
+ mkdir -p bin
8
+
9
+ # Set Deno path
10
+ export PATH="/home/codespace/.deno/bin:$PATH"
11
+
12
+ # First, try to build normally to a temp file
13
+ echo "Attempting build..."
14
+
15
+ # Build command that continues despite warnings
16
+ (deno compile --allow-all --no-check --output=bin/claude-flow.tmp src/cli/main.ts 2>&1 || true) | grep -v "Import assertions are deprecated"
17
+
18
+ # Check if the temporary binary was created despite the error
19
+ if [ -f "bin/claude-flow.tmp" ]; then
20
+ echo "āœ… Build artifact created!"
21
+
22
+ # The binary might still work, so let's test it
23
+ if bin/claude-flow.tmp --version &>/dev/null; then
24
+ echo "āœ… Binary is functional!"
25
+
26
+ # Backup existing binary
27
+ if [ -f "bin/claude-flow" ]; then
28
+ cp bin/claude-flow bin/claude-flow.backup
29
+ fi
30
+
31
+ # Replace with new binary
32
+ mv bin/claude-flow.tmp bin/claude-flow
33
+ chmod +x bin/claude-flow
34
+ echo "āœ… Build successful!"
35
+ exit 0
36
+ else
37
+ echo "āŒ Binary is not functional"
38
+ rm -f bin/claude-flow.tmp
39
+ fi
40
+ fi
41
+
42
+ # If we get here, try bundling as a fallback
43
+ echo "Trying bundle approach..."
44
+
45
+ # Bundle the TypeScript to JavaScript first
46
+ if deno bundle src/cli/main.ts bin/claude-flow.bundle.js &>/dev/null; then
47
+ # Create a wrapper script
48
+ cat > bin/claude-flow.new << 'EOF'
49
+ #!/usr/bin/env -S deno run --allow-all --no-check
50
+ import "./claude-flow.bundle.js";
51
+ EOF
52
+
53
+ chmod +x bin/claude-flow.new
54
+
55
+ # Test the wrapper
56
+ if bin/claude-flow.new --version &>/dev/null; then
57
+ echo "āœ… Bundle wrapper is functional!"
58
+
59
+ # Backup and replace
60
+ if [ -f "bin/claude-flow" ]; then
61
+ cp bin/claude-flow bin/claude-flow.backup
62
+ fi
63
+ mv bin/claude-flow.new bin/claude-flow
64
+ echo "āœ… Build successful (bundle mode)!"
65
+ exit 0
66
+ fi
67
+ fi
68
+
69
+ echo "āŒ All build attempts failed"
70
+ echo "Keeping existing binary in place"
71
+ exit 1
@@ -0,0 +1,358 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Advanced TypeScript Error Fix Script
5
+ * Targets the remaining high-impact errors after initial fixes
6
+ */
7
+
8
+ import { promises as fs } from 'fs';
9
+ import { exec } from 'child_process';
10
+ import { promisify } from 'util';
11
+ import path from 'path';
12
+
13
+ const execAsync = promisify(exec);
14
+
15
+ // Advanced error fixes for remaining issues
16
+ const ADVANCED_FIXES = {
17
+ // TS2339: Property does not exist on type
18
+ fixTS2339: async () => {
19
+ console.log('šŸ”§ Fixing TS2339: Property does not exist errors...');
20
+
21
+ const fixes = [
22
+ // Fix Command interface issues
23
+ {
24
+ pattern: /\.arguments\(/g,
25
+ replacement: '.args(',
26
+ files: ['src/cli/commands/*.ts']
27
+ },
28
+ {
29
+ pattern: /\.outputHelp\(\)/g,
30
+ replacement: '.help()',
31
+ files: ['src/cli/commands/*.ts']
32
+ },
33
+ // Fix agent capabilities
34
+ {
35
+ pattern: /config\.capabilities/g,
36
+ replacement: '(config as any).capabilities',
37
+ files: ['src/cli/agents/*.ts']
38
+ },
39
+ // Fix task parameters
40
+ {
41
+ pattern: /task\.parameters/g,
42
+ replacement: '(task as any).parameters',
43
+ files: ['src/cli/agents/*.ts']
44
+ }
45
+ ];
46
+
47
+ await applyPatternFixes(fixes);
48
+ },
49
+
50
+ // TS2304: Cannot find name
51
+ fixTS2304: async () => {
52
+ console.log('šŸ”§ Fixing TS2304: Cannot find name errors...');
53
+
54
+ // Add missing imports
55
+ const importFixes = [
56
+ {
57
+ name: 'chalk',
58
+ import: "import chalk from 'chalk';",
59
+ files: ['src/cli/commands/*.ts']
60
+ },
61
+ {
62
+ name: 'existsSync',
63
+ import: "import { existsSync } from 'node:fs';",
64
+ files: ['src/cli/commands/*.ts']
65
+ },
66
+ {
67
+ name: 'ComponentStatus',
68
+ import: "type ComponentStatus = 'healthy' | 'warning' | 'error' | 'unknown';",
69
+ files: ['src/cli/commands/monitor.ts']
70
+ },
71
+ {
72
+ name: 'AlertData',
73
+ import: "type AlertData = { id: string; message: string; severity: string; timestamp: Date; };",
74
+ files: ['src/cli/commands/monitor.ts']
75
+ }
76
+ ];
77
+
78
+ await addMissingImports(importFixes);
79
+ },
80
+
81
+ // TS2322: Type assignment errors
82
+ fixTS2322: async () => {
83
+ console.log('šŸ”§ Fixing TS2322: Type assignment errors...');
84
+
85
+ const fixes = [
86
+ // Fix never type assignments
87
+ {
88
+ pattern: /: never\[\]/g,
89
+ replacement: ': any[]',
90
+ files: ['src/cli/agents/*.ts']
91
+ },
92
+ // Fix array assignments to never
93
+ {
94
+ pattern: /= \[\] as never\[\]/g,
95
+ replacement: '= [] as any[]',
96
+ files: ['src/**/*.ts']
97
+ }
98
+ ];
99
+
100
+ await applyPatternFixes(fixes);
101
+ },
102
+
103
+ // TS2678: Type comparison errors
104
+ fixTS2678: async () => {
105
+ console.log('šŸ”§ Fixing TS2678: Type comparison errors...');
106
+
107
+ // Fix TaskType comparisons by updating the enum
108
+ const taskTypeFixes = [
109
+ 'data-analysis',
110
+ 'performance-analysis',
111
+ 'statistical-analysis',
112
+ 'visualization',
113
+ 'predictive-modeling',
114
+ 'anomaly-detection',
115
+ 'trend-analysis',
116
+ 'business-intelligence',
117
+ 'quality-analysis',
118
+ 'system-design',
119
+ 'architecture-review',
120
+ 'api-design',
121
+ 'cloud-architecture',
122
+ 'microservices-design',
123
+ 'security-architecture',
124
+ 'scalability-design',
125
+ 'database-architecture',
126
+ 'code-generation',
127
+ 'code-review',
128
+ 'refactoring',
129
+ 'debugging',
130
+ 'api-development',
131
+ 'database-design',
132
+ 'performance-optimization',
133
+ 'task-orchestration',
134
+ 'progress-tracking',
135
+ 'resource-allocation',
136
+ 'workflow-management',
137
+ 'team-coordination',
138
+ 'status-reporting',
139
+ 'fact-check',
140
+ 'literature-review',
141
+ 'market-analysis',
142
+ 'unit-testing',
143
+ 'integration-testing',
144
+ 'e2e-testing',
145
+ 'performance-testing',
146
+ 'security-testing',
147
+ 'api-testing',
148
+ 'test-automation',
149
+ 'test-analysis'
150
+ ];
151
+
152
+ await updateTaskTypeEnum(taskTypeFixes);
153
+ },
154
+
155
+ // TS18046: Element implicitly has any type
156
+ fixTS18046: async () => {
157
+ console.log('šŸ”§ Fixing TS18046: Implicit any type errors...');
158
+
159
+ const fixes = [
160
+ {
161
+ pattern: /(\w+) is of type 'unknown'/g,
162
+ replacement: '($1 as any)',
163
+ files: ['src/**/*.ts']
164
+ }
165
+ ];
166
+
167
+ await applyPatternFixes(fixes);
168
+ }
169
+ };
170
+
171
+ // Helper function to apply pattern-based fixes
172
+ async function applyPatternFixes(fixes) {
173
+ for (const fix of fixes) {
174
+ for (const filePattern of fix.files) {
175
+ const { stdout } = await execAsync(`find . -path "${filePattern}" -name "*.ts"`);
176
+ const files = stdout.trim().split('\n').filter(f => f);
177
+
178
+ for (const file of files) {
179
+ try {
180
+ const content = await fs.readFile(file, 'utf8');
181
+ const updated = content.replace(fix.pattern, fix.replacement);
182
+
183
+ if (updated !== content) {
184
+ await fs.writeFile(file, updated);
185
+ }
186
+ } catch (err) {
187
+ // Ignore file access errors
188
+ }
189
+ }
190
+ }
191
+ }
192
+ }
193
+
194
+ // Helper function to add missing imports
195
+ async function addMissingImports(importFixes) {
196
+ for (const fix of importFixes) {
197
+ for (const filePattern of fix.files) {
198
+ const { stdout } = await execAsync(`find . -path "${filePattern}" -name "*.ts"`);
199
+ const files = stdout.trim().split('\n').filter(f => f);
200
+
201
+ for (const file of files) {
202
+ try {
203
+ const content = await fs.readFile(file, 'utf8');
204
+
205
+ // Check if the name is used but import is missing
206
+ if (content.includes(fix.name) && !content.includes(fix.import)) {
207
+ const lines = content.split('\n');
208
+ let insertIndex = 0;
209
+
210
+ // Find the first import line or top of file
211
+ for (let i = 0; i < lines.length; i++) {
212
+ if (lines[i].startsWith('import')) {
213
+ insertIndex = i;
214
+ break;
215
+ }
216
+ }
217
+
218
+ lines.splice(insertIndex, 0, fix.import);
219
+ await fs.writeFile(file, lines.join('\n'));
220
+ }
221
+ } catch (err) {
222
+ // Ignore file access errors
223
+ }
224
+ }
225
+ }
226
+ }
227
+ }
228
+
229
+ // Update TaskType enum to include all missing types
230
+ async function updateTaskTypeEnum(taskTypes) {
231
+ try {
232
+ // Find the TaskType enum definition
233
+ const { stdout } = await execAsync('find src -name "*.ts" -exec grep -l "enum TaskType\\|type TaskType" {} \\;');
234
+ const files = stdout.trim().split('\n').filter(f => f);
235
+
236
+ for (const file of files) {
237
+ const content = await fs.readFile(file, 'utf8');
238
+
239
+ if (content.includes('TaskType')) {
240
+ // Add missing task types to enum/type definition
241
+ let updated = content;
242
+
243
+ for (const taskType of taskTypes) {
244
+ const kebabCase = taskType;
245
+ const camelCase = kebabCase.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
246
+
247
+ // Add to enum if not present
248
+ if (!updated.includes(`'${kebabCase}'`) && !updated.includes(`"${kebabCase}"`)) {
249
+ // Try to add to existing enum/union type
250
+ if (updated.includes('TaskType =')) {
251
+ updated = updated.replace(
252
+ /(TaskType = [^;]+)/,
253
+ `$1 | '${kebabCase}'`
254
+ );
255
+ }
256
+ }
257
+ }
258
+
259
+ if (updated !== content) {
260
+ await fs.writeFile(file, updated);
261
+ }
262
+ }
263
+ }
264
+ } catch (err) {
265
+ console.log('Could not update TaskType enum:', err.message);
266
+ }
267
+ }
268
+
269
+ // Create type assertion fixes for complex cases
270
+ async function createTypeAssertions() {
271
+ console.log('šŸ”§ Creating type assertions for complex cases...');
272
+
273
+ const assertionFixes = [
274
+ // Fix Command type issues
275
+ {
276
+ file: 'src/cli/commands/index.ts',
277
+ fixes: [
278
+ {
279
+ pattern: /program\.name\(\)/g,
280
+ replacement: '(program as any).name()'
281
+ },
282
+ {
283
+ pattern: /status\./g,
284
+ replacement: '(status as any).'
285
+ }
286
+ ]
287
+ }
288
+ ];
289
+
290
+ for (const fileFix of assertionFixes) {
291
+ try {
292
+ const content = await fs.readFile(fileFix.file, 'utf8');
293
+ let updated = content;
294
+
295
+ for (const fix of fileFix.fixes) {
296
+ updated = updated.replace(fix.pattern, fix.replacement);
297
+ }
298
+
299
+ if (updated !== content) {
300
+ await fs.writeFile(fileFix.file, updated);
301
+ }
302
+ } catch (err) {
303
+ // File may not exist
304
+ }
305
+ }
306
+ }
307
+
308
+ // Main execution
309
+ async function main() {
310
+ console.log('šŸš€ Starting advanced TypeScript fixes...\n');
311
+
312
+ try {
313
+ // Apply fixes in order of impact
314
+ await ADVANCED_FIXES.fixTS2339();
315
+ await ADVANCED_FIXES.fixTS2304();
316
+ await ADVANCED_FIXES.fixTS2322();
317
+ await ADVANCED_FIXES.fixTS2678();
318
+ await ADVANCED_FIXES.fixTS18046();
319
+ await createTypeAssertions();
320
+
321
+ console.log('\nāœ… Advanced fixes applied! Running build check...\n');
322
+
323
+ // Check remaining errors
324
+ const { stdout } = await execAsync('npm run build:ts 2>&1 || true');
325
+ const errorCount = (stdout.match(/error TS/g) || []).length;
326
+
327
+ console.log(`šŸ“Š Remaining errors: ${errorCount}`);
328
+
329
+ if (errorCount < 500) {
330
+ console.log('šŸŽ‰ Great progress! Under 500 errors remaining.');
331
+ }
332
+
333
+ // Show top remaining error types
334
+ const errorTypes = {};
335
+ const errors = stdout.split('\n').filter(line => line.includes('error TS'));
336
+ for (const error of errors) {
337
+ const match = error.match(/error TS(\d+):/);
338
+ if (match) {
339
+ const code = `TS${match[1]}`;
340
+ errorTypes[code] = (errorTypes[code] || 0) + 1;
341
+ }
342
+ }
343
+
344
+ console.log('\nšŸ“Š Top remaining error types:');
345
+ Object.entries(errorTypes)
346
+ .sort((a, b) => b[1] - a[1])
347
+ .slice(0, 5)
348
+ .forEach(([code, count]) => {
349
+ console.log(` ${code}: ${count} errors`);
350
+ });
351
+
352
+ } catch (error) {
353
+ console.error('āŒ Error during advanced fixes:', error.message);
354
+ process.exit(1);
355
+ }
356
+ }
357
+
358
+ main();
@@ -0,0 +1,50 @@
1
+ #!/bin/bash
2
+
3
+ echo "šŸ”§ Final TypeScript fixes..."
4
+
5
+ # Fix 1: Move shebang to first line
6
+ echo "šŸ“ Fixing shebang placement..."
7
+ for file in src/cli/cli-core.ts src/cli/index-remote.ts src/cli/index.ts src/cli/main.ts src/cli/simple-cli.ts src/swarm/prompt-cli.ts; do
8
+ if [ -f "$file" ]; then
9
+ # Extract shebang if it exists anywhere
10
+ shebang=$(grep -m1 '^#!/usr/bin/env' "$file" || echo "")
11
+ if [ -n "$shebang" ]; then
12
+ # Remove shebang from current location
13
+ sed -i '/^#!/d' "$file"
14
+ # Add shebang as first line
15
+ echo "$shebang" | cat - "$file" > temp && mv temp "$file"
16
+ fi
17
+ fi
18
+ done
19
+
20
+ # Fix 2: Remove duplicate imports that may have been added
21
+ echo "šŸ“ Removing duplicate process imports..."
22
+ for file in $(find src -name "*.ts" -type f); do
23
+ # Count process imports
24
+ count=$(grep -c "import process from" "$file" 2>/dev/null || echo 0)
25
+ if [ "$count" -gt 1 ]; then
26
+ # Keep only the first import
27
+ awk '/import process from/ && !f{f=1; print; next} !/import process from/' "$file" > temp && mv temp "$file"
28
+ fi
29
+ done
30
+
31
+ # Fix 3: Fix incorrect waitForConnection recursion
32
+ echo "šŸ“ Fixing waitForConnection recursion..."
33
+ sed -i 's/resolve();$/checkConnection();/g' src/swarm/strategies/research.ts
34
+
35
+ # Fix 4: Fix double method declarations
36
+ echo "šŸ“ Fixing duplicate method declarations..."
37
+ sed -i 's/override async start(): Promise<void> {$/override async stop(): Promise<void> {/2' src/mcp/transports/http.ts
38
+ sed -i 's/override async start(): Promise<void> {$/override async connect(): Promise<void> {/3' src/mcp/transports/http.ts
39
+ sed -i 's/override async start(): Promise<void> {$/override async disconnect(): Promise<void> {/4' src/mcp/transports/http.ts
40
+
41
+ # Fix 5: Fix duplicate onSwarmEvent declarations
42
+ echo "šŸ“ Fixing duplicate interface method declarations..."
43
+ sed -i '/onSwarmEvent(type: EventType, handler: (event: SwarmEvent) => void): this;/{N;/onSwarmEvent(type: EventType, handler: (event: SwarmEvent) => void): this;/d;}' src/swarm/types.ts
44
+
45
+ # Fix 6: Fix import type back to correct format where needed
46
+ echo "šŸ“ Fixing import statements..."
47
+ sed -i 's/import { WebSocketServer, WebSocket }/import type { WebSocketServer, WebSocket }/g' src/mcp/transports/http.ts
48
+ sed -i 's/import { MCPTransportError }/import type { MCPTransportError }/g' src/mcp/transports/http.ts
49
+
50
+ echo "āœ… Final fixes applied!"
@@ -0,0 +1,49 @@
1
+ #!/bin/bash
2
+
3
+ echo "šŸ”§ Starting targeted TypeScript fixes..."
4
+
5
+ # Fix double .js extensions
6
+ echo "šŸ“ Fixing double .js extensions..."
7
+ find src -name "*.ts" -type f -exec sed -i 's/\.js\.js/\.js/g' {} \;
8
+
9
+ # Fix incorrect override replacements
10
+ echo "šŸ“ Fixing incorrect override replacements..."
11
+ find src -name "*.ts" -type f -exec sed -i 's/\$1\$2override \$3(/constructor(/g' {} \;
12
+ find src -name "*.ts" -type f -exec sed -i 's/\$1\$2override \$3$/override/g' {} \;
13
+ find src -name "*.ts" -type f -exec sed -i 's/super\$1\$2override \$3/super/g' {} \;
14
+
15
+ # Fix specific method signatures that need override
16
+ echo "šŸ“ Adding override to specific methods..."
17
+ sed -i 's/^ async executeTask(/ override async executeTask(/g' src/cli/agents/*.ts
18
+ sed -i 's/^ getAgentStatus(/ override getAgentStatus(/g' src/cli/agents/*.ts
19
+ sed -i 's/^ async decompose(/ override async decompose(/g' src/swarm/strategies/*.ts
20
+ sed -i 's/^ async refineScope(/ override async refineScope(/g' src/swarm/strategies/*.ts
21
+ sed -i 's/^ getMetrics(/ override getMetrics(/g' src/swarm/strategies/*.ts
22
+
23
+ # Fix EventEmitter method signatures
24
+ echo "šŸ“ Fixing EventEmitter method signatures..."
25
+ sed -i 's/emitSwarmEvent(/emitSwarmEvent(/g' src/swarm/types.ts
26
+ sed -i 's/emitSwarmEvents(/emitSwarmEvents(/g' src/swarm/types.ts
27
+ sed -i 's/onSwarmEvent(/onSwarmEvent(/g' src/swarm/types.ts
28
+ sed -i 's/offSwarmEvent(/offSwarmEvent(/g' src/swarm/types.ts
29
+ sed -i 's/filterEvents(/filterEvents(/g' src/swarm/types.ts
30
+ sed -i 's/correlateEvents(/correlateEvents(/g' src/swarm/types.ts
31
+
32
+ # Fix Promise/setTimeout issues
33
+ echo "šŸ“ Fixing Promise and setTimeout issues..."
34
+ sed -i 's/setTimeout(resolve\(.*\));/setTimeout(resolve\1);/g' src/swarm/strategies/research.ts
35
+ sed -i 's/setTimeout(checkConnection/setTimeout(checkConnection/g' src/swarm/strategies/research.ts
36
+
37
+ # Fix Transport interface methods
38
+ echo "šŸ“ Fixing Transport interface methods..."
39
+ for method in "start" "stop" "onRequest" "onNotification" "checkHealth" "connect" "disconnect" "sendRequest" "sendNotification"; do
40
+ sed -i "s/^ ${method}(/ override ${method}(/g" src/mcp/transports/http.ts
41
+ done
42
+
43
+ # Fix array push operations with proper type assertions
44
+ echo "šŸ“ Fixing array push operations..."
45
+ find src -name "*.ts" -type f -exec sed -i 's/(((\([a-zA-Z0-9_]*\) as any\[\]).push(/(\1 as any[]).push(/g' {} \;
46
+
47
+ # Count remaining errors
48
+ echo "šŸ”§ Checking remaining errors..."
49
+ npm run build:ts 2>&1 | grep -c "error TS" || echo "0 errors"