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,720 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Claude Flow Novice - Quick Installation Script
5
+ *
6
+ * Target: Complete installation in under 5 minutes
7
+ *
8
+ * Features:
9
+ * - Parallel dependency checking
10
+ * - Automated Redis installation with Docker fallback
11
+ * - Quick-start wizard with smart defaults
12
+ * - Optimized template deployment
13
+ * - Real-time progress tracking
14
+ */
15
+
16
+ import { execSync, spawn } from 'child_process';
17
+ import { existsSync, mkdirSync, writeFileSync } from 'fs';
18
+ import { join, dirname } from 'path';
19
+ import { homedir, platform } from 'os';
20
+ import chalk from 'chalk';
21
+ import ora from 'ora';
22
+
23
+ class QuickInstaller {
24
+ constructor(options = {}) {
25
+ this.startTime = Date.now();
26
+ this.platform = platform();
27
+ this.quickStart = options.quickStart || false;
28
+ this.skipRedis = options.skipRedis || false;
29
+ this.verbose = options.verbose || false;
30
+ this.targetTimeMs = 5 * 60 * 1000; // 5 minutes
31
+ this.benchmarks = {};
32
+ }
33
+
34
+ async install() {
35
+ console.log(chalk.blue.bold('⚔ Claude Flow Novice - Quick Installation\n'));
36
+ console.log(chalk.gray(`Target: Complete setup in under 5 minutes\n`));
37
+
38
+ const mainSpinner = ora('Starting installation...').start();
39
+
40
+ try {
41
+ // Phase 1: Parallel dependency checks (10 seconds)
42
+ const phase1Start = Date.now();
43
+ mainSpinner.text = 'Phase 1/5: Checking dependencies...';
44
+ const dependencies = await this.checkDependenciesParallel();
45
+ this.benchmarks.dependencies = Date.now() - phase1Start;
46
+ mainSpinner.succeed(`Phase 1 completed in ${this.benchmarks.dependencies}ms`);
47
+
48
+ // Phase 2: Automated Redis installation (30-60 seconds)
49
+ const phase2Start = Date.now();
50
+ mainSpinner.text = 'Phase 2/5: Setting up Redis...';
51
+ const redis = await this.setupRedisAutomated(dependencies.redis);
52
+ this.benchmarks.redis = Date.now() - phase2Start;
53
+ mainSpinner.succeed(`Phase 2 completed in ${this.benchmarks.redis}ms`);
54
+
55
+ // Phase 3: Quick-start configuration (5 seconds)
56
+ const phase3Start = Date.now();
57
+ mainSpinner.text = 'Phase 3/5: Generating configuration...';
58
+ const config = await this.quickStartConfig();
59
+ this.benchmarks.config = Date.now() - phase3Start;
60
+ mainSpinner.succeed(`Phase 3 completed in ${this.benchmarks.config}ms`);
61
+
62
+ // Phase 4: Template deployment (10 seconds)
63
+ const phase4Start = Date.now();
64
+ mainSpinner.text = 'Phase 4/5: Deploying templates...';
65
+ await this.deployTemplatesOptimized();
66
+ this.benchmarks.templates = Date.now() - phase4Start;
67
+ mainSpinner.succeed(`Phase 4 completed in ${this.benchmarks.templates}ms`);
68
+
69
+ // Phase 5: Validation and finalization (5 seconds)
70
+ const phase5Start = Date.now();
71
+ mainSpinner.text = 'Phase 5/5: Validating installation...';
72
+ await this.validateInstallation();
73
+ this.benchmarks.validation = Date.now() - phase5Start;
74
+ mainSpinner.succeed(`Phase 5 completed in ${this.benchmarks.validation}ms`);
75
+
76
+ // Summary
77
+ const totalTime = Date.now() - this.startTime;
78
+ this.displaySummary(totalTime, dependencies, redis, config);
79
+
80
+ return true;
81
+ } catch (error) {
82
+ mainSpinner.fail('Installation failed');
83
+ console.error(chalk.red(`\nāŒ Error: ${error.message}`));
84
+
85
+ if (this.verbose) {
86
+ console.error(chalk.gray(`\nStack trace:\n${error.stack}`));
87
+ }
88
+
89
+ this.displayTroubleshooting(error);
90
+ return false;
91
+ }
92
+ }
93
+
94
+ async checkDependenciesParallel() {
95
+ const checks = [
96
+ this.checkNodeVersion(),
97
+ this.checkNpm(),
98
+ this.checkRedis(),
99
+ this.checkDocker(),
100
+ this.checkGit()
101
+ ];
102
+
103
+ const results = await Promise.allSettled(checks);
104
+
105
+ return {
106
+ node: results[0].status === 'fulfilled' ? results[0].value : null,
107
+ npm: results[1].status === 'fulfilled' ? results[1].value : null,
108
+ redis: results[2].status === 'fulfilled' ? results[2].value : null,
109
+ docker: results[3].status === 'fulfilled' ? results[3].value : null,
110
+ git: results[4].status === 'fulfilled' ? results[4].value : null
111
+ };
112
+ }
113
+
114
+ async checkNodeVersion() {
115
+ try {
116
+ const version = execSync('node --version', { encoding: 'utf8' }).trim();
117
+ const majorVersion = parseInt(version.slice(1).split('.')[0]);
118
+
119
+ if (majorVersion < 20) {
120
+ throw new Error(`Node.js ${version} found. Minimum required: v20.0.0`);
121
+ }
122
+
123
+ return { installed: true, version, compatible: true };
124
+ } catch (error) {
125
+ return { installed: false, error: error.message };
126
+ }
127
+ }
128
+
129
+ async checkNpm() {
130
+ try {
131
+ const version = execSync('npm --version', { encoding: 'utf8' }).trim();
132
+ return { installed: true, version };
133
+ } catch (error) {
134
+ return { installed: false, error: error.message };
135
+ }
136
+ }
137
+
138
+ async checkRedis() {
139
+ try {
140
+ const version = execSync('redis-cli --version', { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
141
+
142
+ // Check if Redis server is running
143
+ try {
144
+ const ping = execSync('redis-cli ping', { encoding: 'utf8', timeout: 2000 }).trim();
145
+ return {
146
+ installed: true,
147
+ version,
148
+ running: ping === 'PONG'
149
+ };
150
+ } catch (pingError) {
151
+ return {
152
+ installed: true,
153
+ version,
154
+ running: false
155
+ };
156
+ }
157
+ } catch (error) {
158
+ return { installed: false, running: false };
159
+ }
160
+ }
161
+
162
+ async checkDocker() {
163
+ try {
164
+ const version = execSync('docker --version', { encoding: 'utf8', timeout: 2000 }).trim();
165
+
166
+ // Check if Docker daemon is running
167
+ try {
168
+ execSync('docker ps', { stdio: 'ignore', timeout: 2000 });
169
+ return { installed: true, version, running: true };
170
+ } catch (psError) {
171
+ return { installed: true, version, running: false };
172
+ }
173
+ } catch (error) {
174
+ return { installed: false, running: false };
175
+ }
176
+ }
177
+
178
+ async checkGit() {
179
+ try {
180
+ const version = execSync('git --version', { encoding: 'utf8' }).trim();
181
+ return { installed: true, version };
182
+ } catch (error) {
183
+ return { installed: false };
184
+ }
185
+ }
186
+
187
+ async setupRedisAutomated(redisStatus) {
188
+ if (this.skipRedis) {
189
+ return { method: 'skipped', message: 'Redis setup skipped by user' };
190
+ }
191
+
192
+ // If Redis is already running, skip installation
193
+ if (redisStatus.installed && redisStatus.running) {
194
+ return {
195
+ method: 'existing',
196
+ version: redisStatus.version,
197
+ message: 'Using existing Redis installation'
198
+ };
199
+ }
200
+
201
+ // If Redis is installed but not running, start it
202
+ if (redisStatus.installed && !redisStatus.running) {
203
+ const started = await this.startExistingRedis();
204
+ if (started) {
205
+ return {
206
+ method: 'started',
207
+ version: redisStatus.version,
208
+ message: 'Started existing Redis server'
209
+ };
210
+ }
211
+ }
212
+
213
+ // Try Docker fallback first (fastest method - 30 seconds)
214
+ const docker = await this.checkDocker();
215
+ if (docker.installed && docker.running) {
216
+ const dockerRedis = await this.setupRedisDocker();
217
+ if (dockerRedis) {
218
+ return {
219
+ method: 'docker',
220
+ message: 'Redis running in Docker container',
221
+ container: dockerRedis.container
222
+ };
223
+ }
224
+ }
225
+
226
+ // Platform-specific installation
227
+ return await this.installRedisPlatformSpecific();
228
+ }
229
+
230
+ async startExistingRedis() {
231
+ try {
232
+ if (this.platform === 'win32') {
233
+ // Windows: Try service first, then direct
234
+ try {
235
+ execSync('net start redis', { stdio: 'ignore', timeout: 10000 });
236
+ return true;
237
+ } catch (serviceError) {
238
+ spawn('redis-server', [], {
239
+ detached: true,
240
+ stdio: 'ignore'
241
+ }).unref();
242
+ await this.waitForRedis(10);
243
+ return true;
244
+ }
245
+ } else if (this.platform === 'darwin') {
246
+ // macOS: Homebrew services
247
+ try {
248
+ execSync('brew services start redis', { stdio: 'ignore', timeout: 10000 });
249
+ await this.waitForRedis(10);
250
+ return true;
251
+ } catch (brewError) {
252
+ spawn('redis-server', [], {
253
+ detached: true,
254
+ stdio: 'ignore'
255
+ }).unref();
256
+ await this.waitForRedis(10);
257
+ return true;
258
+ }
259
+ } else {
260
+ // Linux: systemd
261
+ try {
262
+ execSync('sudo systemctl start redis-server', { stdio: 'ignore', timeout: 10000 });
263
+ await this.waitForRedis(10);
264
+ return true;
265
+ } catch (systemdError) {
266
+ spawn('redis-server', [], {
267
+ detached: true,
268
+ stdio: 'ignore'
269
+ }).unref();
270
+ await this.waitForRedis(10);
271
+ return true;
272
+ }
273
+ }
274
+ } catch (error) {
275
+ return false;
276
+ }
277
+ }
278
+
279
+ async setupRedisDocker() {
280
+ try {
281
+ // Check if Redis container already exists
282
+ try {
283
+ const existing = execSync('docker ps -a --filter name=claude-flow-redis --format "{{.Names}}"', {
284
+ encoding: 'utf8'
285
+ }).trim();
286
+
287
+ if (existing === 'claude-flow-redis') {
288
+ // Container exists, start it
289
+ execSync('docker start claude-flow-redis', { stdio: 'ignore' });
290
+ await this.waitForRedis(15);
291
+ return { container: 'claude-flow-redis', status: 'started' };
292
+ }
293
+ } catch (checkError) {
294
+ // Container doesn't exist, create it
295
+ }
296
+
297
+ // Pull Redis image (if not cached)
298
+ execSync('docker pull redis:alpine', { stdio: 'ignore', timeout: 60000 });
299
+
300
+ // Run Redis container
301
+ const containerId = execSync(
302
+ 'docker run -d --name claude-flow-redis -p 6379:6379 redis:alpine redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru',
303
+ { encoding: 'utf8', timeout: 10000 }
304
+ ).trim();
305
+
306
+ // Wait for Redis to be ready
307
+ await this.waitForRedis(15);
308
+
309
+ return {
310
+ container: 'claude-flow-redis',
311
+ containerId,
312
+ status: 'created'
313
+ };
314
+ } catch (error) {
315
+ return null;
316
+ }
317
+ }
318
+
319
+ async installRedisPlatformSpecific() {
320
+ const spinner = ora('Installing Redis...').start();
321
+
322
+ try {
323
+ if (this.platform === 'win32') {
324
+ return await this.installRedisWindows(spinner);
325
+ } else if (this.platform === 'darwin') {
326
+ return await this.installRedisMacOS(spinner);
327
+ } else {
328
+ return await this.installRedisLinux(spinner);
329
+ }
330
+ } catch (error) {
331
+ spinner.fail('Redis installation failed');
332
+ throw new Error(`Redis installation failed: ${error.message}`);
333
+ }
334
+ }
335
+
336
+ async installRedisWindows(spinner) {
337
+ // Check for Chocolatey
338
+ try {
339
+ execSync('choco --version', { stdio: 'ignore' });
340
+ spinner.text = 'Installing Redis via Chocolatey...';
341
+ execSync('choco install redis-64 -y', { stdio: 'ignore', timeout: 120000 });
342
+ await this.waitForRedis(20);
343
+ return { method: 'chocolatey', message: 'Redis installed via Chocolatey' };
344
+ } catch (chocoError) {
345
+ // Check for Scoop
346
+ try {
347
+ execSync('scoop --version', { stdio: 'ignore' });
348
+ spinner.text = 'Installing Redis via Scoop...';
349
+ execSync('scoop install redis', { stdio: 'ignore', timeout: 120000 });
350
+ await this.waitForRedis(20);
351
+ return { method: 'scoop', message: 'Redis installed via Scoop' };
352
+ } catch (scoopError) {
353
+ throw new Error('No package manager found. Please install Chocolatey or Scoop.');
354
+ }
355
+ }
356
+ }
357
+
358
+ async installRedisMacOS(spinner) {
359
+ try {
360
+ execSync('brew --version', { stdio: 'ignore' });
361
+ spinner.text = 'Installing Redis via Homebrew...';
362
+ execSync('brew install redis', { stdio: 'ignore', timeout: 180000 });
363
+ execSync('brew services start redis', { stdio: 'ignore' });
364
+ await this.waitForRedis(20);
365
+ return { method: 'homebrew', message: 'Redis installed via Homebrew' };
366
+ } catch (error) {
367
+ throw new Error('Homebrew not found. Please install Homebrew first.');
368
+ }
369
+ }
370
+
371
+ async installRedisLinux(spinner) {
372
+ // Detect distribution
373
+ let installCmd = '';
374
+
375
+ try {
376
+ const releaseInfo = execSync('cat /etc/os-release', { encoding: 'utf8' });
377
+
378
+ if (releaseInfo.includes('ubuntu') || releaseInfo.includes('debian')) {
379
+ installCmd = 'sudo apt-get update && sudo apt-get install redis-server -y';
380
+ } else if (releaseInfo.includes('centos') || releaseInfo.includes('rhel') || releaseInfo.includes('fedora')) {
381
+ installCmd = 'sudo yum install redis -y';
382
+ } else if (releaseInfo.includes('arch')) {
383
+ installCmd = 'sudo pacman -S redis --noconfirm';
384
+ } else {
385
+ throw new Error('Unsupported Linux distribution');
386
+ }
387
+
388
+ spinner.text = 'Installing Redis...';
389
+ execSync(installCmd, { stdio: 'ignore', timeout: 180000 });
390
+
391
+ // Start Redis
392
+ try {
393
+ execSync('sudo systemctl start redis-server', { stdio: 'ignore' });
394
+ execSync('sudo systemctl enable redis-server', { stdio: 'ignore' });
395
+ } catch (systemdError) {
396
+ spawn('redis-server', [], { detached: true, stdio: 'ignore' }).unref();
397
+ }
398
+
399
+ await this.waitForRedis(20);
400
+ return { method: 'native', message: 'Redis installed via native package manager' };
401
+ } catch (error) {
402
+ throw new Error(`Linux installation failed: ${error.message}`);
403
+ }
404
+ }
405
+
406
+ async waitForRedis(maxAttempts = 30) {
407
+ for (let i = 0; i < maxAttempts; i++) {
408
+ try {
409
+ const response = execSync('redis-cli ping', {
410
+ encoding: 'utf8',
411
+ timeout: 2000,
412
+ stdio: ['pipe', 'pipe', 'pipe']
413
+ }).trim();
414
+
415
+ if (response === 'PONG') {
416
+ return true;
417
+ }
418
+ } catch (error) {
419
+ await new Promise(resolve => setTimeout(resolve, 1000));
420
+ }
421
+ }
422
+
423
+ throw new Error('Redis failed to start within expected time');
424
+ }
425
+
426
+ async quickStartConfig() {
427
+ const workingDir = process.cwd();
428
+ const configDir = join(workingDir, '.claude');
429
+
430
+ // Create directory structure
431
+ const dirs = [
432
+ '.claude',
433
+ '.claude/commands',
434
+ '.claude/agents',
435
+ 'memory',
436
+ 'coordination'
437
+ ];
438
+
439
+ for (const dir of dirs) {
440
+ const fullPath = join(workingDir, dir);
441
+ if (!existsSync(fullPath)) {
442
+ mkdirSync(fullPath, { recursive: true });
443
+ }
444
+ }
445
+
446
+ // Generate minimal configuration with sensible defaults
447
+ const config = {
448
+ version: '1.6.6',
449
+ quickStart: true,
450
+ installedAt: new Date().toISOString(),
451
+ platform: this.platform,
452
+ features: {
453
+ swarmOrchestration: true,
454
+ redisCoordination: true,
455
+ autoSpawn: true,
456
+ memoryPersistence: true
457
+ },
458
+ redis: {
459
+ host: 'localhost',
460
+ port: 6379,
461
+ connectionString: 'redis://localhost:6379'
462
+ }
463
+ };
464
+
465
+ // Write configuration
466
+ writeFileSync(
467
+ join(configDir, 'quick-start.json'),
468
+ JSON.stringify(config, null, 2)
469
+ );
470
+
471
+ return config;
472
+ }
473
+
474
+ async deployTemplatesOptimized() {
475
+ const workingDir = process.cwd();
476
+
477
+ // Use bundled templates for instant deployment
478
+ const templates = {
479
+ 'CLAUDE.md': this.getMinimalClaudeMd(),
480
+ '.claude/settings.json': this.getMinimalSettings(),
481
+ 'memory/README.md': this.getMemoryReadme(),
482
+ 'coordination/README.md': this.getCoordinationReadme()
483
+ };
484
+
485
+ // Write all templates in parallel
486
+ const writePromises = Object.entries(templates).map(([path, content]) => {
487
+ const fullPath = join(workingDir, path);
488
+ const dir = dirname(fullPath);
489
+
490
+ if (!existsSync(dir)) {
491
+ mkdirSync(dir, { recursive: true });
492
+ }
493
+
494
+ return new Promise((resolve) => {
495
+ writeFileSync(fullPath, content);
496
+ resolve();
497
+ });
498
+ });
499
+
500
+ await Promise.all(writePromises);
501
+ }
502
+
503
+ getMinimalClaudeMd() {
504
+ return `# Claude Flow Novice - Quick Start Configuration
505
+
506
+ ## Overview
507
+ AI agent orchestration framework with Redis-based coordination.
508
+
509
+ ## Quick Commands
510
+ - Start swarm: \`npx claude-flow-novice swarm "your objective"\`
511
+ - Check status: \`npx claude-flow-novice status\`
512
+ - View agents: \`npx claude-flow-novice agents list\`
513
+
514
+ ## Redis Connection
515
+ - Host: localhost
516
+ - Port: 6379
517
+
518
+ ## Features Enabled
519
+ - Swarm orchestration
520
+ - Redis coordination
521
+ - Auto-spawn agents
522
+ - Memory persistence
523
+
524
+ ---
525
+ *Generated by Quick Install - ${new Date().toISOString()}*
526
+ `;
527
+ }
528
+
529
+ getMinimalSettings() {
530
+ return JSON.stringify({
531
+ version: '1.6.6',
532
+ hooks: {
533
+ enabled: true,
534
+ 'post-edit': {
535
+ command: 'npx claude-flow-novice hooks post-edit --file "{{file}}"'
536
+ }
537
+ },
538
+ redis: {
539
+ host: 'localhost',
540
+ port: 6379
541
+ },
542
+ swarm: {
543
+ autoSpawn: true,
544
+ maxAgents: 10
545
+ }
546
+ }, null, 2);
547
+ }
548
+
549
+ getMemoryReadme() {
550
+ return `# Memory System
551
+
552
+ Agent memory and coordination data stored here.
553
+
554
+ ## Structure
555
+ - \`agents/\` - Agent-specific memory
556
+ - \`sessions/\` - Session data
557
+ - \`claude-flow-data.json\` - Persistence database
558
+ `;
559
+ }
560
+
561
+ getCoordinationReadme() {
562
+ return `# Coordination System
563
+
564
+ Agent coordination and orchestration data.
565
+
566
+ ## Structure
567
+ - \`memory_bank/\` - Shared memory
568
+ - \`subtasks/\` - Task breakdown
569
+ - \`orchestration/\` - Swarm orchestration
570
+ `;
571
+ }
572
+
573
+ async validateInstallation() {
574
+ const checks = [
575
+ this.validateRedis(),
576
+ this.validateFiles(),
577
+ this.validateConfiguration()
578
+ ];
579
+
580
+ const results = await Promise.allSettled(checks);
581
+
582
+ const failed = results.filter(r => r.status === 'rejected');
583
+ if (failed.length > 0) {
584
+ throw new Error(`Validation failed: ${failed.map(f => f.reason).join(', ')}`);
585
+ }
586
+
587
+ return true;
588
+ }
589
+
590
+ async validateRedis() {
591
+ try {
592
+ const response = execSync('redis-cli ping', {
593
+ encoding: 'utf8',
594
+ timeout: 2000
595
+ }).trim();
596
+
597
+ if (response !== 'PONG') {
598
+ throw new Error('Redis not responding');
599
+ }
600
+
601
+ return true;
602
+ } catch (error) {
603
+ throw new Error(`Redis validation failed: ${error.message}`);
604
+ }
605
+ }
606
+
607
+ async validateFiles() {
608
+ const workingDir = process.cwd();
609
+ const requiredFiles = [
610
+ 'CLAUDE.md',
611
+ '.claude/settings.json',
612
+ '.claude/quick-start.json'
613
+ ];
614
+
615
+ for (const file of requiredFiles) {
616
+ if (!existsSync(join(workingDir, file))) {
617
+ throw new Error(`Missing required file: ${file}`);
618
+ }
619
+ }
620
+
621
+ return true;
622
+ }
623
+
624
+ async validateConfiguration() {
625
+ const workingDir = process.cwd();
626
+ const configPath = join(workingDir, '.claude', 'quick-start.json');
627
+
628
+ if (!existsSync(configPath)) {
629
+ throw new Error('Configuration file not found');
630
+ }
631
+
632
+ return true;
633
+ }
634
+
635
+ displaySummary(totalTime, dependencies, redis, config) {
636
+ const totalSeconds = (totalTime / 1000).toFixed(1);
637
+ const targetSeconds = (this.targetTimeMs / 1000).toFixed(0);
638
+ const targetMet = totalTime < this.targetTimeMs;
639
+
640
+ console.log('\n' + chalk.blue.bold('šŸ“Š Installation Summary\n'));
641
+
642
+ // Time metrics
643
+ console.log(chalk.cyan('ā±ļø Time Metrics:'));
644
+ console.log(` Total time: ${chalk.bold(totalSeconds + 's')} ${targetMet ? chalk.green('āœ“') : chalk.yellow('⚠')}`);
645
+ console.log(` Target: ${targetSeconds}s ${targetMet ? chalk.gray('(met)') : chalk.yellow('(exceeded)')}`);
646
+ console.log(` Dependencies: ${(this.benchmarks.dependencies / 1000).toFixed(1)}s`);
647
+ console.log(` Redis: ${(this.benchmarks.redis / 1000).toFixed(1)}s`);
648
+ console.log(` Configuration: ${(this.benchmarks.config / 1000).toFixed(1)}s`);
649
+ console.log(` Templates: ${(this.benchmarks.templates / 1000).toFixed(1)}s`);
650
+ console.log(` Validation: ${(this.benchmarks.validation / 1000).toFixed(1)}s\n`);
651
+
652
+ // Dependencies status
653
+ console.log(chalk.cyan('šŸ“¦ Dependencies:'));
654
+ console.log(` Node.js: ${dependencies.node.version} ${chalk.green('āœ“')}`);
655
+ console.log(` npm: ${dependencies.npm.version} ${chalk.green('āœ“')}`);
656
+ console.log(` Redis: ${redis.method} ${chalk.green('āœ“')}`);
657
+ if (dependencies.docker.installed) {
658
+ console.log(` Docker: ${dependencies.docker.version} ${chalk.gray('(optional)')}`);
659
+ }
660
+ if (dependencies.git.installed) {
661
+ console.log(` Git: ${dependencies.git.version} ${chalk.gray('(optional)')}`);
662
+ }
663
+ console.log();
664
+
665
+ // Next steps
666
+ console.log(chalk.green.bold('āœ… Installation Complete!\n'));
667
+ console.log(chalk.cyan('šŸš€ Quick Start Commands:'));
668
+ console.log(` ${chalk.bold('npx claude-flow-novice status')} - Check system health`);
669
+ console.log(` ${chalk.bold('npx claude-flow-novice swarm "task"')} - Start a swarm`);
670
+ console.log(` ${chalk.bold('npx claude-flow-novice agents list')} - View agents\n`);
671
+
672
+ // Performance feedback
673
+ if (!targetMet) {
674
+ console.log(chalk.yellow('šŸ’” Installation took longer than target:'));
675
+ console.log(` Consider using Docker for Redis (faster startup)`);
676
+ console.log(` Run with --verbose to see detailed logs\n`);
677
+ }
678
+ }
679
+
680
+ displayTroubleshooting(error) {
681
+ console.log('\n' + chalk.yellow.bold('šŸ”§ Troubleshooting\n'));
682
+
683
+ if (error.message.includes('Redis')) {
684
+ console.log(chalk.cyan('Redis Issues:'));
685
+ console.log(' 1. Install Docker: https://docs.docker.com/get-docker/');
686
+ console.log(' 2. Run: docker run -d -p 6379:6379 redis:alpine');
687
+ console.log(' 3. Or install Redis manually for your platform\n');
688
+ }
689
+
690
+ if (error.message.includes('Node')) {
691
+ console.log(chalk.cyan('Node.js Issues:'));
692
+ console.log(' 1. Install Node.js v20+: https://nodejs.org/');
693
+ console.log(' 2. Verify: node --version\n');
694
+ }
695
+
696
+ console.log(chalk.cyan('Need Help?'));
697
+ console.log(' GitHub Issues: https://github.com/masharratt/claude-flow-novice/issues');
698
+ console.log(' Documentation: https://github.com/masharratt/claude-flow-novice#readme\n');
699
+ }
700
+ }
701
+
702
+ // CLI execution
703
+ if (import.meta.url === `file://${process.argv[1]}`) {
704
+ const args = process.argv.slice(2);
705
+ const options = {
706
+ quickStart: args.includes('--quick-start'),
707
+ skipRedis: args.includes('--skip-redis'),
708
+ verbose: args.includes('--verbose') || args.includes('-v')
709
+ };
710
+
711
+ const installer = new QuickInstaller(options);
712
+ installer.install().then(success => {
713
+ process.exit(success ? 0 : 1);
714
+ }).catch(error => {
715
+ console.error(chalk.red(`\nāŒ Fatal error: ${error.message}`));
716
+ process.exit(1);
717
+ });
718
+ }
719
+
720
+ export default QuickInstaller;