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.
- package/package.json +9 -8
- package/scripts/.claude-flow/metrics/agent-metrics.json +1 -0
- package/scripts/.claude-flow/metrics/performance.json +9 -0
- package/scripts/.claude-flow/metrics/task-metrics.json +10 -0
- package/scripts/CLEANUP_OPTIMIZATION_REPORT.json +312 -0
- package/scripts/CLEANUP_PERFORMANCE_OPTIMIZATION.md +387 -0
- package/scripts/CLEANUP_QUICK_START.md +268 -0
- package/scripts/CLEANUP_TEST_RESULTS.md +205 -0
- package/scripts/README.md +339 -0
- package/scripts/ace-query.sh +384 -0
- package/scripts/agent-token-analysis.js +430 -0
- package/scripts/auto-setup.js +332 -0
- package/scripts/build/README.md +167 -0
- package/scripts/build/build-config.js +27 -0
- package/scripts/build/build-prompt-copier.sh +30 -0
- package/scripts/build/performance-monitor.js +869 -0
- package/scripts/build/prepare-publish.js +150 -0
- package/scripts/build/typescript-fixer.js +621 -0
- package/scripts/build/unified-builder.sh +428 -0
- package/scripts/build/update-bin-version.js +32 -0
- package/scripts/build/validate-agents.js +238 -0
- package/scripts/build-index.js +43 -0
- package/scripts/build-orchestrator.js +320 -0
- package/scripts/check-routing-stats.cjs +122 -0
- package/scripts/ci-validation.js +375 -0
- package/scripts/cleanup-blocking-coordination.sh +420 -0
- package/scripts/cleanup-idle-sessions.sh +59 -0
- package/scripts/collect-build-metrics.js +65 -0
- package/scripts/demo/README.md +79 -0
- package/scripts/demo/autoscaling-demo-simplified.js +963 -0
- package/scripts/demo/comprehensive-dashboard-test.js +693 -0
- package/scripts/demo/confidence-log.js +87 -0
- package/scripts/demo/confidence-report.js +82 -0
- package/scripts/demo/demo-multi-swarm-coordination.js +325 -0
- package/scripts/demo/demo-production-deployment.js +399 -0
- package/scripts/demo/demo-visualization-system.js +149 -0
- package/scripts/demo/performance-analysis.cjs +71 -0
- package/scripts/demo/performance-analysis.js +71 -0
- package/scripts/demo/test-autoscaling-demo.js +314 -0
- package/scripts/dependency-optimizer.js +349 -0
- package/scripts/dependency-security-assessment.js +331 -0
- package/scripts/deploy-sdk.sh +176 -0
- package/scripts/deployment-readiness-report.json +179 -0
- package/scripts/dev/README.md +264 -0
- package/scripts/dev/claude-flow-wrapper.sh +35 -0
- package/scripts/dev/claude-monitor.py +419 -0
- package/scripts/dev/claude-sparc.sh +562 -0
- package/scripts/dev/claude-wrapper.sh +17 -0
- package/scripts/dev/demo-phase3-compliance.js +172 -0
- package/scripts/dev/demo-task-system.ts +224 -0
- package/scripts/dev/deployment-validator.js +315 -0
- package/scripts/dev/spawn-claude-terminal.sh +32 -0
- package/scripts/dev/start-portal.sh +506 -0
- package/scripts/dev/start-web-ui.js +15 -0
- package/scripts/dev/stop-portal.sh +311 -0
- package/scripts/dev/validate-examples.ts +288 -0
- package/scripts/dev/validate-phase2.cjs +451 -0
- package/scripts/dev/validate-phase2.js +785 -0
- package/scripts/dev/validate-phase3.cjs +208 -0
- package/scripts/dev/validate-security-remediation.js +1 -0
- package/scripts/ecosystem.config.cjs +90 -0
- package/scripts/fix-js-extensions.js +167 -0
- package/scripts/generate-basic-types.js +73 -0
- package/scripts/generate-changelog.js +318 -0
- package/scripts/git-hooks/pre-commit.sh +143 -0
- package/scripts/health-checks.js +634 -0
- package/scripts/hook-wrapper.sh +54 -0
- package/scripts/install/README.md +375 -0
- package/scripts/install/REDIS_SETUP_VALIDATION.json +245 -0
- package/scripts/install/check-prerequisites.js +303 -0
- package/scripts/install/config-wizard.js +606 -0
- package/scripts/install/dependency-checker.js +385 -0
- package/scripts/install/health-check.js +765 -0
- package/scripts/install/install.js +256 -0
- package/scripts/install/installation-benchmark.js +461 -0
- package/scripts/install/quick-install.js +720 -0
- package/scripts/install/quick-start-wizard.js +295 -0
- package/scripts/install/redis-cli.js +289 -0
- package/scripts/install/redis-install-guides.md +407 -0
- package/scripts/install/redis-setup.js +559 -0
- package/scripts/install/redis-test.js +278 -0
- package/scripts/install/service-manager.js +672 -0
- package/scripts/install/setup.js +832 -0
- package/scripts/install/uninstall.js +526 -0
- package/scripts/install/update.js +461 -0
- package/scripts/install-pre-commit-hook.sh +127 -0
- package/scripts/legacy/README.md +272 -0
- package/scripts/legacy/batch-fix-ts.sh +54 -0
- package/scripts/legacy/build-migration.sh +105 -0
- package/scripts/legacy/build-monitor.js +209 -0
- package/scripts/legacy/build-with-filter.sh +84 -0
- package/scripts/legacy/build-workaround.sh +71 -0
- package/scripts/legacy/fix-ts-advanced.js +358 -0
- package/scripts/legacy/fix-ts-final.sh +50 -0
- package/scripts/legacy/fix-ts-targeted.sh +49 -0
- package/scripts/legacy/fix-typescript-errors.js +305 -0
- package/scripts/legacy/force-build.sh +63 -0
- package/scripts/legacy/optimize-performance.js +400 -0
- package/scripts/legacy/performance-monitor.js +263 -0
- package/scripts/legacy/performance-monitoring.js +532 -0
- package/scripts/legacy/performance-test-runner.js +645 -0
- package/scripts/legacy/quick-fix-ts.js +281 -0
- package/scripts/legacy/safe-build.sh +63 -0
- package/scripts/memory-monitor-coordinator.js +322 -0
- package/scripts/migrate-to-sdk.sh +520 -0
- package/scripts/migration/QUICK-START.md +189 -0
- package/scripts/migration/QUICK-START.md.backup-1760135091363 +189 -0
- package/scripts/migration/README.md +464 -0
- package/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md +500 -0
- package/scripts/migration/TASK-1.3.2-COMPLETION-REPORT.md.backup-1760135091348 +500 -0
- package/scripts/migration/UPDATE-PATHS-README.md +464 -0
- package/scripts/migration/UPDATE-PATHS-README.md.backup-1760135091337 +464 -0
- package/scripts/migration/example-patterns.json +19 -0
- package/scripts/migration/install-arm64.js +78 -0
- package/scripts/migration/install.js +83 -0
- package/scripts/migration/migrate-hooks.js +173 -0
- package/scripts/migration/migration-examples.ts +318 -0
- package/scripts/migration/reorganize-workspace.js +504 -0
- package/scripts/migration/test-update-paths.js +359 -0
- package/scripts/migration/update-paths.js +664 -0
- package/scripts/migration/validate-migration.js +647 -0
- package/scripts/monitor-loop.sh +65 -0
- package/scripts/monitor-memory.sh +47 -0
- package/scripts/monitor-migration.js +339 -0
- package/scripts/monitor.py +43 -0
- package/scripts/monitoring/README.md +178 -0
- package/scripts/monitoring/alert-monitor.sh +220 -0
- package/scripts/monitoring/analyze-resources.sh +199 -0
- package/scripts/monitoring/dashboards/rate-limiting-dashboard.json +211 -0
- package/scripts/monitoring/dynamic-monitor.sh +85 -0
- package/scripts/monitoring/launch-stability-test.sh +184 -0
- package/scripts/monitoring/monitor-test.sh +93 -0
- package/scripts/monitoring/pre-test-validation.sh +208 -0
- package/scripts/monitoring/quick-test-alerting.sh +118 -0
- package/scripts/monitoring/quick-test-rate-limiting.sh +206 -0
- package/scripts/monitoring/rate-limiting-monitor.sh +380 -0
- package/scripts/monitoring/resource-monitor.sh +126 -0
- package/scripts/monitoring/stability-monitor.js +429 -0
- package/scripts/monitoring/test-monitor-quick.sh +54 -0
- package/scripts/monitoring/view-alerts.sh +307 -0
- package/scripts/npm-metrics-collector.js +482 -0
- package/scripts/npm-package-validation.cjs +299 -0
- package/scripts/optimization/build-optimizer.js +438 -0
- package/scripts/optimization/config-validator.js +761 -0
- package/scripts/optimization/test-optimization.js +432 -0
- package/scripts/optimization/unified-activation.js +839 -0
- package/scripts/optimize-package-swarm.js +54 -0
- package/scripts/performance/ACTIVATION_COMMANDS.md +292 -0
- package/scripts/performance/sqlite-enhanced-activation.sh +583 -0
- package/scripts/performance/test-enhanced-backend.sh +504 -0
- package/scripts/performance-monitor.js +644 -0
- package/scripts/performance-test-runner.js +698 -0
- package/scripts/post-deployment-monitoring.js +350 -0
- package/scripts/post-edit-pipeline.js +2091 -0
- package/scripts/post-install-claude-md.js +78 -0
- package/scripts/postinstall.js +79 -0
- package/scripts/pre-publish-validation.cjs +212 -0
- package/scripts/pre-publish-validation.js +429 -0
- package/scripts/redis-lua/cleanup-blocking-coordination.lua +198 -0
- package/scripts/release-announcement.js +425 -0
- package/scripts/release-notification.js +248 -0
- package/scripts/release-rollback.js +376 -0
- package/scripts/release-validation.js +460 -0
- package/scripts/rollback-sdk.sh +66 -0
- package/scripts/run-production-validation.ts +590 -0
- package/scripts/run-stability-validation.sh +687 -0
- package/scripts/security/README.md +339 -0
- package/scripts/security/deployment-validation.cjs +279 -0
- package/scripts/security/envelope-encryption-confidence-report.cjs +422 -0
- package/scripts/security/install-git-hooks.sh +132 -0
- package/scripts/security/install-git-secrets.sh +295 -0
- package/scripts/security/rotate-api-keys.js +469 -0
- package/scripts/security/ruv-swarm-safe.js +74 -0
- package/scripts/security/security-audit.cjs +538 -0
- package/scripts/security/setup-redis-auth.sh +397 -0
- package/scripts/security/validate-envelope-encryption.cjs +340 -0
- package/scripts/security-scan.js +492 -0
- package/scripts/src/web/frontend/.claude-flow/metrics/agent-metrics.json +1 -0
- package/scripts/src/web/frontend/.claude-flow/metrics/performance.json +9 -0
- package/scripts/src/web/frontend/.claude-flow/metrics/task-metrics.json +10 -0
- package/scripts/switch-api.sh +158 -0
- package/scripts/sync-agents.js +290 -0
- package/scripts/test/50-agent-test.js +625 -0
- package/scripts/test/NEW_STABILITY_TEST_GUIDE.md +407 -0
- package/scripts/test/README.md +236 -0
- package/scripts/test/STABILITY_TEST_EXAMPLE.md +347 -0
- package/scripts/test/STABILITY_TEST_README.md +480 -0
- package/scripts/test/agent-worker.js +309 -0
- package/scripts/test/ai-coordination-test.js +650 -0
- package/scripts/test/ai-mesh-coordination-test.js +416 -0
- package/scripts/test/check-links.ts +274 -0
- package/scripts/test/check-performance-regression.ts +168 -0
- package/scripts/test/cli-agent-coordination-test.js +313 -0
- package/scripts/test/coordinator-multilingual-test.js +396 -0
- package/scripts/test/coordinator-transparency-demo.js +585 -0
- package/scripts/test/coverage-report.ts +692 -0
- package/scripts/test/generate-swarm-tests.js +633 -0
- package/scripts/test/integration-test-validation.cjs +253 -0
- package/scripts/test/load-test-swarm.js +576 -0
- package/scripts/test/mesh-coordination-zero-overlap-test.js +740 -0
- package/scripts/test/multilingual-hello-world-test.js +390 -0
- package/scripts/test/quick-multilingual-demo.js +464 -0
- package/scripts/test/real-agent-test.js +312 -0
- package/scripts/test/run-phase3-compliance-tests.js +427 -0
- package/scripts/test/run-stability-test-examples.sh +292 -0
- package/scripts/test/stability-results/stability-metrics.jsonl +83 -0
- package/scripts/test/stability-results/stability-test-report.json +128 -0
- package/scripts/test/stability-results/stability-test.log +1827 -0
- package/scripts/test/stability-test-50-agents.js +734 -0
- package/scripts/test/test-batch-tasks.ts +29 -0
- package/scripts/test/test-byzantine-resolution.js +246 -0
- package/scripts/test/test-claude-spawn-options.sh +63 -0
- package/scripts/test/test-cli-wizard.js +331 -0
- package/scripts/test/test-comprehensive.js +401 -0
- package/scripts/test/test-coordination-features.ts +238 -0
- package/scripts/test/test-fallback-systems.js +276 -0
- package/scripts/test/test-init-command.ts +302 -0
- package/scripts/test/test-mcp.ts +251 -0
- package/scripts/test/test-runner.ts +568 -0
- package/scripts/test/test-swarm-integration.sh +92 -0
- package/scripts/test/test-swarm.ts +142 -0
- package/scripts/test/validation-summary.ts +408 -0
- package/scripts/test-cleanup-performance.sh +416 -0
- package/scripts/test-dashboard-auth.cjs +203 -0
- package/scripts/test-docker-deployment.sh +207 -0
- package/scripts/test-npm-package.cjs +167 -0
- package/scripts/test-provider-routing.cjs +226 -0
- package/scripts/test-routing-telemetry.cjs +147 -0
- package/scripts/test-runner.cjs +154 -0
- package/scripts/test-zai-10k.cjs +81 -0
- package/scripts/test-zai-api.cjs +191 -0
- package/scripts/test-zai-diagnostic.cjs +151 -0
- package/scripts/test-zai-final.cjs +128 -0
- package/scripts/test-zai-with-env.cjs +85 -0
- package/scripts/utils/README.md +261 -0
- package/scripts/utils/clean-build-artifacts.sh +94 -0
- package/scripts/utils/cleanup-root.sh +69 -0
- package/scripts/utils/fix-cliffy-imports.js +307 -0
- package/scripts/utils/fix-duplicate-imports.js +114 -0
- package/scripts/utils/fix-error-handling.cjs +70 -0
- package/scripts/utils/fix-import-paths.js +104 -0
- package/scripts/utils/fix-imports.js +116 -0
- package/scripts/utils/fix-shebang.js +78 -0
- package/scripts/utils/fix-test-modules.js +27 -0
- package/scripts/utils/fix-timezone-issue-246.js +200 -0
- package/scripts/utils/fix-ts-comprehensive.py +182 -0
- package/scripts/utils/fix-ts-targeted-batch.js +250 -0
- package/scripts/utils/remove-benchmark-conflicts.sh +140 -0
- package/scripts/utils/simple-test-fixer.js +190 -0
- package/scripts/utils/validate-metrics-structure.cjs +144 -0
- package/scripts/validate-agent-hooks.js +506 -0
- package/scripts/validate-changelog.js +241 -0
- package/scripts/validate-coordination-cli.js +69 -0
- package/scripts/validate-coordination-toggle-integration.cjs +501 -0
- package/scripts/validate-docker-infrastructure.sh +502 -0
- package/scripts/validate-entry-points.js +300 -0
- package/scripts/validate-stage3-performance.ts +377 -0
- package/scripts/validate-template-bundling.js +180 -0
- package/scripts/validation/README.md +33 -0
- package/scripts/validation/acl-security-validation.cjs +214 -0
- package/scripts/validation/acl-security-validation.js +402 -0
- package/scripts/validation/byzantine-verification.js +407 -0
- package/scripts/validation/final-phase-2-consensus.cjs +219 -0
- package/scripts/validation/final-security-validation.js +791 -0
- package/scripts/validation/final-wasm-validation.cjs +840 -0
- package/scripts/validation/integration-test-analysis.js +105 -0
- package/scripts/validation/phase-0-comprehensive-validation.js +474 -0
- package/scripts/validation/phase-0-consensus-report.js +139 -0
- package/scripts/validation/phase-0-final-report.js +112 -0
- package/scripts/validation/phase-0-redis-consensus-report.js +129 -0
- package/scripts/validation/phase-0-validation-improved.js +490 -0
- package/scripts/validation/phase-0-validation-test.js +65 -0
- package/scripts/validation/phase-1-consensus-report.cjs +342 -0
- package/scripts/validation/phase-1-consensus-validation.cjs +551 -0
- package/scripts/validation/phase-1-consensus-validation.js +551 -0
- package/scripts/validation/phase-2-consensus-report.cjs +186 -0
- package/scripts/validation/phase-2-validation.cjs +171 -0
- package/scripts/validation/phase-2-validation.js +171 -0
- package/scripts/validation/phase-4-consensus-report.js +181 -0
- package/scripts/validation/phase-4-final-validation.js +351 -0
- package/scripts/validation/phase-5-consensus-report.cjs +113 -0
- package/scripts/validation/phase-5-consensus-report.js +113 -0
- package/scripts/validation/security-analysis.js +49 -0
- package/scripts/validation/security-validation.js +492 -0
- package/scripts/validation/simple-security-validation.js +464 -0
- package/scripts/verify-installation.js +112 -0
- package/scripts/verify-mcp-server.js +86 -0
- package/scripts/verify-sdk-phase1.cjs +293 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Automatic Setup Script for Redis & SQLite
|
|
5
|
+
*
|
|
6
|
+
* Runs automatically during npm postinstall
|
|
7
|
+
* - Non-interactive mode with smart defaults
|
|
8
|
+
* - Fails gracefully without breaking installation
|
|
9
|
+
* - Detects existing installations
|
|
10
|
+
* - Platform-specific optimizations
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { execSync } from 'child_process';
|
|
14
|
+
import { existsSync, writeFileSync, mkdirSync } from 'fs';
|
|
15
|
+
import { join, dirname } from 'path';
|
|
16
|
+
import { homedir, platform } from 'os';
|
|
17
|
+
import { fileURLToPath } from 'url';
|
|
18
|
+
import path from 'path';
|
|
19
|
+
|
|
20
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
+
const __dirname = path.dirname(__filename);
|
|
22
|
+
|
|
23
|
+
// Detect if this is CI/npm publish environment
|
|
24
|
+
const isCI = process.env.CI === 'true' || process.env.CI === '1';
|
|
25
|
+
const isNpmPublish = process.env.npm_lifecycle_event === 'publish' || process.env.npm_lifecycle_event === 'prepublishOnly';
|
|
26
|
+
const skipAutoSetup = process.env.SKIP_AUTO_SETUP === 'true' || isCI || isNpmPublish;
|
|
27
|
+
|
|
28
|
+
// Allow users to opt-out via env var
|
|
29
|
+
const userOptOut = process.env.CLAUDE_FLOW_NO_AUTO_SETUP === 'true';
|
|
30
|
+
|
|
31
|
+
class AutoSetup {
|
|
32
|
+
constructor() {
|
|
33
|
+
this.platform = platform();
|
|
34
|
+
this.homeDir = homedir();
|
|
35
|
+
this.configDir = join(this.homeDir, '.claude-flow-novice', 'config');
|
|
36
|
+
this.logFile = join(this.homeDir, '.claude-flow-novice', 'setup.log');
|
|
37
|
+
this.logs = [];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
log(message, level = 'info') {
|
|
41
|
+
const timestamp = new Date().toISOString();
|
|
42
|
+
const logEntry = `[${timestamp}] [${level.toUpperCase()}] ${message}`;
|
|
43
|
+
this.logs.push(logEntry);
|
|
44
|
+
|
|
45
|
+
if (level === 'error') {
|
|
46
|
+
console.error(`❌ ${message}`);
|
|
47
|
+
} else if (level === 'warn') {
|
|
48
|
+
console.warn(`⚠️ ${message}`);
|
|
49
|
+
} else {
|
|
50
|
+
console.log(`ℹ️ ${message}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async run() {
|
|
55
|
+
// Skip if environment indicates we shouldn't run
|
|
56
|
+
if (skipAutoSetup) {
|
|
57
|
+
this.log('Auto-setup skipped (CI/npm publish environment)', 'info');
|
|
58
|
+
return { success: true, skipped: true, reason: 'ci-environment' };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (userOptOut) {
|
|
62
|
+
this.log('Auto-setup disabled by user (CLAUDE_FLOW_NO_AUTO_SETUP=true)', 'info');
|
|
63
|
+
return { success: true, skipped: true, reason: 'user-opt-out' };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
console.log('🚀 Claude Flow Novice - Automatic Setup\n');
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
// Create config directory
|
|
70
|
+
await this.ensureConfigDirectory();
|
|
71
|
+
|
|
72
|
+
// Setup SQLite (automatic via better-sqlite3 package)
|
|
73
|
+
const sqliteResult = await this.setupSQLite();
|
|
74
|
+
|
|
75
|
+
// Setup Redis (with fallback)
|
|
76
|
+
const redisResult = await this.setupRedis();
|
|
77
|
+
|
|
78
|
+
// Sync agent profiles from package
|
|
79
|
+
const agentSyncResult = await this.syncAgentProfiles();
|
|
80
|
+
|
|
81
|
+
// Write setup status
|
|
82
|
+
await this.writeSetupStatus({ sqlite: sqliteResult, redis: redisResult, agents: agentSyncResult });
|
|
83
|
+
|
|
84
|
+
// Save logs
|
|
85
|
+
await this.saveLogs();
|
|
86
|
+
|
|
87
|
+
console.log('\n✅ Automatic setup completed!');
|
|
88
|
+
console.log(`📝 Setup log: ${this.logFile}\n`);
|
|
89
|
+
|
|
90
|
+
if (!redisResult.success) {
|
|
91
|
+
console.log('💡 To manually setup Redis later, run:');
|
|
92
|
+
console.log(' npm run redis:setup\n');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return { success: true, sqlite: sqliteResult, redis: redisResult };
|
|
96
|
+
|
|
97
|
+
} catch (error) {
|
|
98
|
+
this.log(`Setup error: ${error.message}`, 'error');
|
|
99
|
+
await this.saveLogs();
|
|
100
|
+
|
|
101
|
+
// Don't fail the npm install - just warn
|
|
102
|
+
console.warn('\n⚠️ Automatic setup encountered issues but npm install will continue.');
|
|
103
|
+
console.warn('📝 Run "npm run quick-install" to complete setup manually.\n');
|
|
104
|
+
|
|
105
|
+
return { success: false, error: error.message };
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async ensureConfigDirectory() {
|
|
110
|
+
if (!existsSync(this.configDir)) {
|
|
111
|
+
mkdirSync(this.configDir, { recursive: true });
|
|
112
|
+
this.log(`Created config directory: ${this.configDir}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async setupSQLite() {
|
|
117
|
+
this.log('Setting up SQLite...');
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
// SQLite is automatic via better-sqlite3 npm package
|
|
121
|
+
// Just verify it's installed
|
|
122
|
+
const packageJson = join(process.cwd(), 'package.json');
|
|
123
|
+
const pkg = JSON.parse(require('fs').readFileSync(packageJson, 'utf8'));
|
|
124
|
+
|
|
125
|
+
if (pkg.dependencies && pkg.dependencies['better-sqlite3']) {
|
|
126
|
+
this.log('SQLite (better-sqlite3) is installed', 'info');
|
|
127
|
+
|
|
128
|
+
// Create default database directory
|
|
129
|
+
const dbDir = join(this.homeDir, '.claude-flow-novice', 'data');
|
|
130
|
+
if (!existsSync(dbDir)) {
|
|
131
|
+
mkdirSync(dbDir, { recursive: true });
|
|
132
|
+
this.log(`Created SQLite database directory: ${dbDir}`);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
success: true,
|
|
137
|
+
version: pkg.dependencies['better-sqlite3'],
|
|
138
|
+
message: 'SQLite ready (better-sqlite3 installed)'
|
|
139
|
+
};
|
|
140
|
+
} else {
|
|
141
|
+
this.log('SQLite package not found', 'warn');
|
|
142
|
+
return { success: false, message: 'better-sqlite3 not in dependencies' };
|
|
143
|
+
}
|
|
144
|
+
} catch (error) {
|
|
145
|
+
this.log(`SQLite setup error: ${error.message}`, 'error');
|
|
146
|
+
return { success: false, error: error.message };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async setupRedis() {
|
|
151
|
+
this.log('Checking Redis installation...');
|
|
152
|
+
|
|
153
|
+
try {
|
|
154
|
+
// Check if Redis is already installed and running
|
|
155
|
+
try {
|
|
156
|
+
execSync('redis-cli ping', { stdio: 'pipe', timeout: 5000 });
|
|
157
|
+
this.log('Redis is already installed and running!', 'info');
|
|
158
|
+
|
|
159
|
+
const version = execSync('redis-server --version', { encoding: 'utf8' }).trim();
|
|
160
|
+
return {
|
|
161
|
+
success: true,
|
|
162
|
+
version,
|
|
163
|
+
status: 'already-installed',
|
|
164
|
+
message: 'Redis detected and running'
|
|
165
|
+
};
|
|
166
|
+
} catch {
|
|
167
|
+
// Redis not running or not installed
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Check if Redis is installed but not running
|
|
171
|
+
try {
|
|
172
|
+
const version = execSync('redis-server --version', { encoding: 'utf8', timeout: 5000 }).trim();
|
|
173
|
+
this.log('Redis installed but not running', 'info');
|
|
174
|
+
|
|
175
|
+
// Try to start it
|
|
176
|
+
try {
|
|
177
|
+
if (this.platform === 'darwin') {
|
|
178
|
+
execSync('brew services start redis', { stdio: 'pipe', timeout: 10000 });
|
|
179
|
+
} else if (this.platform === 'linux') {
|
|
180
|
+
execSync('sudo systemctl start redis', { stdio: 'pipe', timeout: 10000 });
|
|
181
|
+
} else if (this.platform === 'win32') {
|
|
182
|
+
execSync('net start Redis', { stdio: 'pipe', timeout: 10000 });
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
this.log('Redis started successfully!', 'info');
|
|
186
|
+
return { success: true, version, status: 'started', message: 'Redis started' };
|
|
187
|
+
} catch (startError) {
|
|
188
|
+
this.log('Could not start Redis automatically', 'warn');
|
|
189
|
+
return {
|
|
190
|
+
success: false,
|
|
191
|
+
version,
|
|
192
|
+
status: 'installed-not-running',
|
|
193
|
+
message: 'Redis installed but failed to start automatically',
|
|
194
|
+
manualStart: true
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
} catch {
|
|
198
|
+
// Redis not installed at all
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Redis not installed - provide installation instructions
|
|
202
|
+
this.log('Redis not found - installation required', 'warn');
|
|
203
|
+
|
|
204
|
+
const instructions = this.getRedisInstallInstructions();
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
success: false,
|
|
208
|
+
status: 'not-installed',
|
|
209
|
+
message: 'Redis not installed',
|
|
210
|
+
instructions
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
} catch (error) {
|
|
214
|
+
this.log(`Redis check error: ${error.message}`, 'error');
|
|
215
|
+
return { success: false, error: error.message };
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
getRedisInstallInstructions() {
|
|
220
|
+
const instructions = {
|
|
221
|
+
darwin: [
|
|
222
|
+
'Install via Homebrew:',
|
|
223
|
+
' brew install redis',
|
|
224
|
+
' brew services start redis'
|
|
225
|
+
],
|
|
226
|
+
linux: [
|
|
227
|
+
'Install via package manager:',
|
|
228
|
+
' Ubuntu/Debian: sudo apt-get install redis-server',
|
|
229
|
+
' CentOS/RHEL: sudo yum install redis',
|
|
230
|
+
' Start: sudo systemctl start redis'
|
|
231
|
+
],
|
|
232
|
+
win32: [
|
|
233
|
+
'Install via:',
|
|
234
|
+
' 1. Download Redis from: https://github.com/microsoftarchive/redis/releases',
|
|
235
|
+
' 2. Or use WSL2: wsl --install then install Redis in Ubuntu',
|
|
236
|
+
' 3. Or use Docker: docker run -d -p 6379:6379 redis'
|
|
237
|
+
]
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
return instructions[this.platform] || instructions.linux;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
async writeSetupStatus(results) {
|
|
244
|
+
const statusFile = join(this.configDir, 'setup-status.json');
|
|
245
|
+
const status = {
|
|
246
|
+
timestamp: new Date().toISOString(),
|
|
247
|
+
platform: this.platform,
|
|
248
|
+
autoSetup: true,
|
|
249
|
+
sqlite: results.sqlite,
|
|
250
|
+
redis: results.redis,
|
|
251
|
+
version: this.getPackageVersion()
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
writeFileSync(statusFile, JSON.stringify(status, null, 2));
|
|
255
|
+
this.log(`Setup status saved: ${statusFile}`);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
async saveLogs() {
|
|
259
|
+
try {
|
|
260
|
+
const logDir = dirname(this.logFile);
|
|
261
|
+
if (!existsSync(logDir)) {
|
|
262
|
+
mkdirSync(logDir, { recursive: true });
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
writeFileSync(this.logFile, this.logs.join('\n'), 'utf8');
|
|
266
|
+
} catch (error) {
|
|
267
|
+
console.error(`Failed to save logs: ${error.message}`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
async syncAgentProfiles() {
|
|
272
|
+
this.log('Syncing agent profiles from package...');
|
|
273
|
+
|
|
274
|
+
try {
|
|
275
|
+
// Import the agent sync module
|
|
276
|
+
const AgentSync = (await import('./sync-agents.js')).default;
|
|
277
|
+
|
|
278
|
+
// Run sync with automatic overwrite
|
|
279
|
+
const syncer = new AgentSync({
|
|
280
|
+
projectRoot: process.cwd(),
|
|
281
|
+
skipBackup: false, // Create backups of overwritten agents
|
|
282
|
+
verbose: false
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
const result = await syncer.sync();
|
|
286
|
+
|
|
287
|
+
if (result.success) {
|
|
288
|
+
const { created, overwritten, preserved } = result.stats;
|
|
289
|
+
this.log(`Agent profiles synced: ${created.length} new, ${overwritten.length} updated, ${preserved.length} unchanged`);
|
|
290
|
+
|
|
291
|
+
return {
|
|
292
|
+
success: true,
|
|
293
|
+
created: created.length,
|
|
294
|
+
overwritten: overwritten.length,
|
|
295
|
+
preserved: preserved.length,
|
|
296
|
+
backupDir: join(process.cwd(), '.claude', 'agents', '.backup')
|
|
297
|
+
};
|
|
298
|
+
} else {
|
|
299
|
+
this.log(`Agent sync failed: ${result.error}`, 'warn');
|
|
300
|
+
return { success: false, error: result.error };
|
|
301
|
+
}
|
|
302
|
+
} catch (error) {
|
|
303
|
+
this.log(`Agent sync error: ${error.message}`, 'error');
|
|
304
|
+
return { success: false, error: error.message };
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
getPackageVersion() {
|
|
309
|
+
try {
|
|
310
|
+
const packageJson = join(process.cwd(), 'package.json');
|
|
311
|
+
const pkg = JSON.parse(require('fs').readFileSync(packageJson, 'utf8'));
|
|
312
|
+
return pkg.version;
|
|
313
|
+
} catch {
|
|
314
|
+
return 'unknown';
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Run auto-setup if called directly
|
|
320
|
+
async function main() {
|
|
321
|
+
const setup = new AutoSetup();
|
|
322
|
+
const result = await setup.run();
|
|
323
|
+
|
|
324
|
+
// Exit with 0 even on failure to not break npm install
|
|
325
|
+
process.exit(0);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
329
|
+
main();
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export default AutoSetup;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Build Scripts
|
|
2
|
+
|
|
3
|
+
This directory contains all build-related scripts for the Claude Flow project.
|
|
4
|
+
|
|
5
|
+
## Scripts
|
|
6
|
+
|
|
7
|
+
### Core Build Scripts
|
|
8
|
+
|
|
9
|
+
#### `unified-builder.sh` - Universal Build Script
|
|
10
|
+
**Primary build script** consolidating all build operations into a single, powerful tool.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Available modes
|
|
14
|
+
scripts/build/unified-builder.sh [mode] [options]
|
|
15
|
+
|
|
16
|
+
# Modes:
|
|
17
|
+
# workaround - Build with deprecation warning workarounds
|
|
18
|
+
# filter - Build with filtered output (removes warnings)
|
|
19
|
+
# safe - Build with automatic backup and rollback (default)
|
|
20
|
+
# force - Force build ignoring errors
|
|
21
|
+
# migration - Build with migration compatibility
|
|
22
|
+
# clean - Clean build artifacts before building
|
|
23
|
+
# monitor - Build with continuous monitoring
|
|
24
|
+
|
|
25
|
+
# Examples
|
|
26
|
+
scripts/build/unified-builder.sh safe --verbose
|
|
27
|
+
scripts/build/unified-builder.sh clean filter
|
|
28
|
+
npm run build # Uses safe mode
|
|
29
|
+
npm run build:workaround # Uses workaround mode
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
#### `typescript-fixer.js` - Universal TypeScript Error Fixer
|
|
33
|
+
**Comprehensive TypeScript error resolution** with multiple fix strategies.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Available strategies
|
|
37
|
+
node scripts/build/typescript-fixer.js [strategy] [options]
|
|
38
|
+
|
|
39
|
+
# Strategies:
|
|
40
|
+
# basic - Standard TypeScript error patterns
|
|
41
|
+
# advanced - Complex TypeScript error patterns
|
|
42
|
+
# targeted - File-specific targeted fixes
|
|
43
|
+
# quick - Fast common pattern fixes
|
|
44
|
+
# batch - Bulk operation fixes
|
|
45
|
+
# all - Apply all fix strategies (default)
|
|
46
|
+
|
|
47
|
+
# Examples
|
|
48
|
+
node scripts/build/typescript-fixer.js --dry-run
|
|
49
|
+
npm run fix:typescript # Uses default strategy
|
|
50
|
+
npm run fix:typescript:quick # Quick fixes only
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### `performance-monitor.js` - Build Performance Testing
|
|
54
|
+
**Performance testing and monitoring** during build processes.
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Available commands
|
|
58
|
+
node scripts/build/performance-monitor.js [command] [options]
|
|
59
|
+
|
|
60
|
+
# Commands:
|
|
61
|
+
# test [type] - Run performance tests (basic|load|stress|endurance)
|
|
62
|
+
# monitor - Start build monitoring
|
|
63
|
+
# report [format] - Generate performance report (summary|detailed|json)
|
|
64
|
+
# metrics - Show current metrics
|
|
65
|
+
|
|
66
|
+
# Examples
|
|
67
|
+
npm run test:performance:basic # Basic performance tests
|
|
68
|
+
npm run performance:monitor # Start continuous monitoring
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Build Configuration
|
|
72
|
+
|
|
73
|
+
#### `build-config.js`
|
|
74
|
+
Build configuration settings and environment setup.
|
|
75
|
+
|
|
76
|
+
#### `build-prompt-copier.sh`
|
|
77
|
+
Copies build prompts and templates for consistent build messaging.
|
|
78
|
+
|
|
79
|
+
### Publishing & Release
|
|
80
|
+
|
|
81
|
+
#### `prepare-publish.js`
|
|
82
|
+
Prepares the package for publishing to NPM registry.
|
|
83
|
+
|
|
84
|
+
#### `update-bin-version.js`
|
|
85
|
+
Updates binary version numbers across the project.
|
|
86
|
+
|
|
87
|
+
## Package.json Integration
|
|
88
|
+
|
|
89
|
+
All build scripts are integrated into package.json for easy access:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"scripts": {
|
|
94
|
+
"build": "scripts/build/unified-builder.sh safe",
|
|
95
|
+
"build:workaround": "scripts/build/unified-builder.sh workaround",
|
|
96
|
+
"build:force": "scripts/build/unified-builder.sh force",
|
|
97
|
+
"build:monitor": "scripts/build/unified-builder.sh monitor",
|
|
98
|
+
"fix:typescript": "node scripts/build/typescript-fixer.js",
|
|
99
|
+
"fix:typescript:basic": "node scripts/build/typescript-fixer.js basic",
|
|
100
|
+
"fix:typescript:advanced": "node scripts/build/typescript-fixer.js advanced",
|
|
101
|
+
"test:performance:basic": "node scripts/build/performance-monitor.js test basic",
|
|
102
|
+
"performance:monitor": "node scripts/build/performance-monitor.js monitor"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Features
|
|
108
|
+
|
|
109
|
+
### Coordination Integration
|
|
110
|
+
All build scripts include Claude Flow coordination hooks:
|
|
111
|
+
- Pre-task initialization
|
|
112
|
+
- Post-edit reporting
|
|
113
|
+
- Task completion tracking
|
|
114
|
+
- Session state management
|
|
115
|
+
|
|
116
|
+
### Error Recovery
|
|
117
|
+
- Automatic backup and rollback capabilities
|
|
118
|
+
- Comprehensive error logging
|
|
119
|
+
- Recovery strategies for build failures
|
|
120
|
+
- Safe mode operations
|
|
121
|
+
|
|
122
|
+
### Performance Optimization
|
|
123
|
+
- Build time monitoring
|
|
124
|
+
- Resource usage tracking
|
|
125
|
+
- Performance regression detection
|
|
126
|
+
- Optimization recommendations
|
|
127
|
+
|
|
128
|
+
## Usage Guidelines
|
|
129
|
+
|
|
130
|
+
1. **Prefer npm scripts** over direct script execution
|
|
131
|
+
2. **Use safe mode** for production builds
|
|
132
|
+
3. **Run performance tests** before major releases
|
|
133
|
+
4. **Check TypeScript errors** with the fixer before commits
|
|
134
|
+
5. **Monitor builds** during CI/CD operations
|
|
135
|
+
|
|
136
|
+
## Troubleshooting
|
|
137
|
+
|
|
138
|
+
### Common Issues
|
|
139
|
+
|
|
140
|
+
**Build Failures:**
|
|
141
|
+
```bash
|
|
142
|
+
# Try safe mode with verbose output
|
|
143
|
+
npm run build -- --verbose
|
|
144
|
+
|
|
145
|
+
# Force build if necessary
|
|
146
|
+
npm run build:force
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**TypeScript Errors:**
|
|
150
|
+
```bash
|
|
151
|
+
# Quick fix common issues
|
|
152
|
+
npm run fix:typescript:quick
|
|
153
|
+
|
|
154
|
+
# Comprehensive fix
|
|
155
|
+
npm run fix:typescript
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Performance Issues:**
|
|
159
|
+
```bash
|
|
160
|
+
# Check performance metrics
|
|
161
|
+
npm run performance:monitor
|
|
162
|
+
|
|
163
|
+
# Run performance tests
|
|
164
|
+
npm run test:performance:basic
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
For legacy build scripts, see `../legacy/` directory.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build Configuration for Claude Flow
|
|
3
|
+
*
|
|
4
|
+
* This configuration handles module resolution for dual Node.js/Deno support
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const buildConfig = {
|
|
8
|
+
// Module aliases for Node.js build
|
|
9
|
+
moduleAliases: {
|
|
10
|
+
'@cliffy/ansi/colors': './src/adapters/cliffy-node.ts',
|
|
11
|
+
'@cliffy/prompt': './src/adapters/cliffy-node.ts',
|
|
12
|
+
'@cliffy/table': './src/adapters/cliffy-node.ts',
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
// Modules to exclude from Node.js build
|
|
16
|
+
excludeModules: [
|
|
17
|
+
'vscode', // VS Code extension API
|
|
18
|
+
],
|
|
19
|
+
|
|
20
|
+
// External modules that should not be bundled
|
|
21
|
+
externals: [
|
|
22
|
+
'@modelcontextprotocol/sdk',
|
|
23
|
+
'better-sqlite3',
|
|
24
|
+
'node-pty',
|
|
25
|
+
'blessed',
|
|
26
|
+
],
|
|
27
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Build script for prompt copier CLI
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
echo "Building prompt copier CLI..."
|
|
7
|
+
|
|
8
|
+
# Ensure bin directory exists
|
|
9
|
+
mkdir -p bin
|
|
10
|
+
|
|
11
|
+
# Check if Deno is available
|
|
12
|
+
if ! command -v deno &> /dev/null; then
|
|
13
|
+
echo "Error: Deno is required but not installed"
|
|
14
|
+
echo "Please install Deno: https://deno.land/manual/getting_started/installation"
|
|
15
|
+
exit 1
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# Compile the prompt CLI
|
|
19
|
+
echo "Compiling prompt-copier..."
|
|
20
|
+
PATH="/home/codespace/.deno/bin:$PATH" deno compile \
|
|
21
|
+
--allow-all \
|
|
22
|
+
--no-check \
|
|
23
|
+
--output=bin/prompt-copier \
|
|
24
|
+
src/swarm/prompt-cli.ts
|
|
25
|
+
|
|
26
|
+
# Make executable
|
|
27
|
+
chmod +x bin/prompt-copier
|
|
28
|
+
|
|
29
|
+
echo "✅ prompt-copier CLI built successfully"
|
|
30
|
+
echo "Usage: ./bin/prompt-copier --help"
|