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,32 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Spawn Claude in a new terminal window with proper TTY support
|
|
3
|
+
|
|
4
|
+
# Get the prompt file and other arguments
|
|
5
|
+
PROMPT_FILE="$1"
|
|
6
|
+
shift
|
|
7
|
+
CLAUDE_ARGS="$@"
|
|
8
|
+
|
|
9
|
+
# Detect the platform and terminal emulator
|
|
10
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
11
|
+
# macOS - use Terminal.app
|
|
12
|
+
osascript -e "tell application \"Terminal\" to do script \"claude \\\"$(cat $PROMPT_FILE)\\\" $CLAUDE_ARGS\""
|
|
13
|
+
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
14
|
+
# Linux - try various terminal emulators
|
|
15
|
+
if command -v gnome-terminal >/dev/null 2>&1; then
|
|
16
|
+
gnome-terminal -- bash -c "claude \"$(cat $PROMPT_FILE)\" $CLAUDE_ARGS; read -p 'Press enter to close...'"
|
|
17
|
+
elif command -v xterm >/dev/null 2>&1; then
|
|
18
|
+
xterm -e bash -c "claude \"$(cat $PROMPT_FILE)\" $CLAUDE_ARGS; read -p 'Press enter to close...'"
|
|
19
|
+
elif command -v konsole >/dev/null 2>&1; then
|
|
20
|
+
konsole -e bash -c "claude \"$(cat $PROMPT_FILE)\" $CLAUDE_ARGS; read -p 'Press enter to close...'"
|
|
21
|
+
else
|
|
22
|
+
echo "No supported terminal emulator found. Please run manually:"
|
|
23
|
+
echo "claude \"$(cat $PROMPT_FILE)\" $CLAUDE_ARGS"
|
|
24
|
+
fi
|
|
25
|
+
elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]]; then
|
|
26
|
+
# Windows
|
|
27
|
+
cmd.exe /c start cmd /k "claude \"$(cat $PROMPT_FILE)\" $CLAUDE_ARGS"
|
|
28
|
+
else
|
|
29
|
+
echo "Unsupported platform: $OSTYPE"
|
|
30
|
+
echo "Please run manually:"
|
|
31
|
+
echo "claude \"$(cat $PROMPT_FILE)\" $CLAUDE_ARGS"
|
|
32
|
+
fi
|
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Claude Flow Personal Web Portal Startup Script
|
|
4
|
+
# Environment setup, MCP server connections, and process management
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
# Configuration
|
|
9
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
10
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
11
|
+
PORTAL_HOST="${WEB_PORTAL_HOST:-localhost}"
|
|
12
|
+
PORTAL_PORT="${WEB_PORTAL_PORT:-3000}"
|
|
13
|
+
FRONTEND_PORT="${FRONTEND_DEV_PORT:-3001}"
|
|
14
|
+
LOG_DIR="$PROJECT_ROOT/logs"
|
|
15
|
+
PID_FILE="$PROJECT_ROOT/.portal.pid"
|
|
16
|
+
FRONTEND_BUILD_DIR="$PROJECT_ROOT/src/web/frontend/build"
|
|
17
|
+
|
|
18
|
+
# Colors for output
|
|
19
|
+
RED='\033[0;31m'
|
|
20
|
+
GREEN='\033[0;32m'
|
|
21
|
+
YELLOW='\033[1;33m'
|
|
22
|
+
BLUE='\033[0;34m'
|
|
23
|
+
PURPLE='\033[0;35m'
|
|
24
|
+
CYAN='\033[0;36m'
|
|
25
|
+
NC='\033[0m' # No Color
|
|
26
|
+
|
|
27
|
+
# Logging
|
|
28
|
+
log() {
|
|
29
|
+
echo -e "${GREEN}[$(date +'%Y-%m-%d %H:%M:%S')]${NC} $1"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
warn() {
|
|
33
|
+
echo -e "${YELLOW}[$(date +'%Y-%m-%d %H:%M:%S')] WARNING:${NC} $1"
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
error() {
|
|
37
|
+
echo -e "${RED}[$(date +'%Y-%m-%d %H:%M:%S')] ERROR:${NC} $1"
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
info() {
|
|
41
|
+
echo -e "${BLUE}[$(date +'%Y-%m-%d %H:%M:%S')] INFO:${NC} $1"
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# Function to check if a command exists
|
|
45
|
+
command_exists() {
|
|
46
|
+
command -v "$1" >/dev/null 2>&1
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
# Function to check if a port is available
|
|
50
|
+
is_port_available() {
|
|
51
|
+
local port=$1
|
|
52
|
+
! nc -z localhost "$port" >/dev/null 2>&1
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
# Function to wait for port to be ready
|
|
56
|
+
wait_for_port() {
|
|
57
|
+
local port=$1
|
|
58
|
+
local timeout=${2:-30}
|
|
59
|
+
local count=0
|
|
60
|
+
|
|
61
|
+
while ! nc -z localhost "$port" >/dev/null 2>&1; do
|
|
62
|
+
if [ $count -ge $timeout ]; then
|
|
63
|
+
error "Timeout waiting for port $port to be ready"
|
|
64
|
+
return 1
|
|
65
|
+
fi
|
|
66
|
+
sleep 1
|
|
67
|
+
((count++))
|
|
68
|
+
done
|
|
69
|
+
|
|
70
|
+
log "Port $port is ready"
|
|
71
|
+
return 0
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
# Function to setup environment
|
|
75
|
+
setup_environment() {
|
|
76
|
+
log "🔧 Setting up environment..."
|
|
77
|
+
|
|
78
|
+
# Create necessary directories
|
|
79
|
+
mkdir -p "$LOG_DIR" "$PROJECT_ROOT/.swarm" "$PROJECT_ROOT/src/web/frontend"
|
|
80
|
+
|
|
81
|
+
# Setup Node.js environment if needed
|
|
82
|
+
if [[ -f "$PROJECT_ROOT/package.json" ]] && [[ ! -d "$PROJECT_ROOT/node_modules" ]]; then
|
|
83
|
+
log "Installing project dependencies..."
|
|
84
|
+
cd "$PROJECT_ROOT"
|
|
85
|
+
npm install
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
# Check required commands
|
|
89
|
+
local required_commands=("node" "npm" "npx")
|
|
90
|
+
for cmd in "${required_commands[@]}"; do
|
|
91
|
+
if ! command_exists "$cmd"; then
|
|
92
|
+
error "Required command not found: $cmd"
|
|
93
|
+
exit 1
|
|
94
|
+
fi
|
|
95
|
+
done
|
|
96
|
+
|
|
97
|
+
# Check Node.js version
|
|
98
|
+
local node_version
|
|
99
|
+
node_version=$(node --version | cut -d'v' -f2)
|
|
100
|
+
local min_version="16.0.0"
|
|
101
|
+
|
|
102
|
+
if ! printf '%s\n%s\n' "$min_version" "$node_version" | sort -C -V; then
|
|
103
|
+
error "Node.js version $node_version is below minimum required version $min_version"
|
|
104
|
+
exit 1
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
log "✅ Environment setup complete"
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
# Function to check port availability
|
|
111
|
+
check_ports() {
|
|
112
|
+
log "🔍 Checking port availability..."
|
|
113
|
+
|
|
114
|
+
if ! is_port_available "$PORTAL_PORT"; then
|
|
115
|
+
error "Port $PORTAL_PORT is already in use"
|
|
116
|
+
error "Please stop the existing service or change WEB_PORTAL_PORT"
|
|
117
|
+
exit 1
|
|
118
|
+
fi
|
|
119
|
+
|
|
120
|
+
if ! is_port_available "$FRONTEND_PORT"; then
|
|
121
|
+
warn "Port $FRONTEND_PORT is already in use, frontend development server may not start"
|
|
122
|
+
fi
|
|
123
|
+
|
|
124
|
+
log "✅ Ports are available"
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
# Function to setup MCP server connections
|
|
128
|
+
setup_mcp_connections() {
|
|
129
|
+
log "🔗 Setting up MCP server connections..."
|
|
130
|
+
|
|
131
|
+
# Check if Claude Flow MCP is available
|
|
132
|
+
if command_exists claude; then
|
|
133
|
+
info "Configuring Claude Flow MCP server..."
|
|
134
|
+
|
|
135
|
+
# Add Claude Flow MCP server if not already configured
|
|
136
|
+
if ! claude mcp list 2>/dev/null | grep -q "claude-flow"; then
|
|
137
|
+
log "Adding Claude Flow MCP server..."
|
|
138
|
+
claude mcp add claude-flow npx claude-flow@alpha mcp start || warn "Failed to add Claude Flow MCP server"
|
|
139
|
+
else
|
|
140
|
+
info "Claude Flow MCP server already configured"
|
|
141
|
+
fi
|
|
142
|
+
|
|
143
|
+
# Add Ruv-Swarm MCP server if available
|
|
144
|
+
if command_exists npx && npx ruv-swarm --version >/dev/null 2>&1; then
|
|
145
|
+
if ! claude mcp list 2>/dev/null | grep -q "ruv-swarm"; then
|
|
146
|
+
log "Adding Ruv-Swarm MCP server..."
|
|
147
|
+
claude mcp add ruv-swarm npx ruv-swarm mcp start || warn "Failed to add Ruv-Swarm MCP server"
|
|
148
|
+
else
|
|
149
|
+
info "Ruv-Swarm MCP server already configured"
|
|
150
|
+
fi
|
|
151
|
+
else
|
|
152
|
+
info "Ruv-Swarm not available, skipping MCP configuration"
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
# Add Flow-Nexus MCP server if enabled
|
|
156
|
+
if [[ "${FLOW_NEXUS_ENABLED:-false}" == "true" ]] && command_exists npx; then
|
|
157
|
+
if ! claude mcp list 2>/dev/null | grep -q "flow-nexus"; then
|
|
158
|
+
log "Adding Flow-Nexus MCP server..."
|
|
159
|
+
claude mcp add flow-nexus npx flow-nexus@latest mcp start || warn "Failed to add Flow-Nexus MCP server"
|
|
160
|
+
else
|
|
161
|
+
info "Flow-Nexus MCP server already configured"
|
|
162
|
+
fi
|
|
163
|
+
fi
|
|
164
|
+
else
|
|
165
|
+
warn "Claude CLI not found, MCP servers cannot be automatically configured"
|
|
166
|
+
info "Please install Claude CLI: https://claude.ai/cli"
|
|
167
|
+
fi
|
|
168
|
+
|
|
169
|
+
log "✅ MCP connections setup complete"
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
# Function to build frontend if needed
|
|
173
|
+
build_frontend() {
|
|
174
|
+
log "🏗️ Building frontend..."
|
|
175
|
+
|
|
176
|
+
cd "$PROJECT_ROOT/src/web/frontend"
|
|
177
|
+
|
|
178
|
+
# Check if package.json exists
|
|
179
|
+
if [[ ! -f "package.json" ]]; then
|
|
180
|
+
log "Frontend package.json not found, skipping frontend build"
|
|
181
|
+
return 0
|
|
182
|
+
fi
|
|
183
|
+
|
|
184
|
+
# Install frontend dependencies
|
|
185
|
+
if [[ ! -d "node_modules" ]]; then
|
|
186
|
+
log "Installing frontend dependencies..."
|
|
187
|
+
npm install
|
|
188
|
+
fi
|
|
189
|
+
|
|
190
|
+
# Build for production if not in development mode
|
|
191
|
+
if [[ "${NODE_ENV:-development}" != "development" ]]; then
|
|
192
|
+
log "Building frontend for production..."
|
|
193
|
+
npm run build
|
|
194
|
+
|
|
195
|
+
if [[ ! -d "$FRONTEND_BUILD_DIR" ]]; then
|
|
196
|
+
error "Frontend build failed - build directory not found"
|
|
197
|
+
exit 1
|
|
198
|
+
fi
|
|
199
|
+
else
|
|
200
|
+
info "Development mode - skipping production build"
|
|
201
|
+
fi
|
|
202
|
+
|
|
203
|
+
cd "$PROJECT_ROOT"
|
|
204
|
+
log "✅ Frontend build complete"
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
# Function to execute coordination hooks
|
|
208
|
+
execute_pre_hooks() {
|
|
209
|
+
log "🪝 Executing pre-startup coordination hooks..."
|
|
210
|
+
|
|
211
|
+
# Pre-task hook for portal startup
|
|
212
|
+
if command_exists npx && npx claude-flow@alpha --version >/dev/null 2>&1; then
|
|
213
|
+
info "Executing Claude Flow pre-task hook..."
|
|
214
|
+
npx claude-flow@alpha hooks pre-task \
|
|
215
|
+
--description "Start Claude Flow Personal Web Portal" \
|
|
216
|
+
--task-type "web-portal-startup" \
|
|
217
|
+
--priority "high" || warn "Pre-task hook failed"
|
|
218
|
+
|
|
219
|
+
# Session restore hook
|
|
220
|
+
info "Executing session restore hook..."
|
|
221
|
+
npx claude-flow@alpha hooks session-restore \
|
|
222
|
+
--session-id "web-portal-$(date +%s)" || warn "Session restore hook failed"
|
|
223
|
+
else
|
|
224
|
+
warn "Claude Flow not available, skipping coordination hooks"
|
|
225
|
+
fi
|
|
226
|
+
|
|
227
|
+
log "✅ Pre-startup hooks complete"
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
# Function to start the portal server
|
|
231
|
+
start_portal_server() {
|
|
232
|
+
log "🚀 Starting Claude Flow Personal Web Portal..."
|
|
233
|
+
|
|
234
|
+
cd "$PROJECT_ROOT"
|
|
235
|
+
|
|
236
|
+
# Set environment variables
|
|
237
|
+
export NODE_ENV="${NODE_ENV:-development}"
|
|
238
|
+
export WEB_PORTAL_HOST="$PORTAL_HOST"
|
|
239
|
+
export WEB_PORTAL_PORT="$PORTAL_PORT"
|
|
240
|
+
export FRONTEND_DEV_PORT="$FRONTEND_PORT"
|
|
241
|
+
|
|
242
|
+
# Start the server
|
|
243
|
+
if [[ "${NODE_ENV}" == "development" ]]; then
|
|
244
|
+
# Development mode with hot reload
|
|
245
|
+
log "Starting in development mode with hot reload..."
|
|
246
|
+
|
|
247
|
+
# Start frontend development server in background if in development
|
|
248
|
+
if [[ -f "src/web/frontend/package.json" ]]; then
|
|
249
|
+
info "Starting frontend development server on port $FRONTEND_PORT..."
|
|
250
|
+
cd src/web/frontend
|
|
251
|
+
npm start &
|
|
252
|
+
FRONTEND_PID=$!
|
|
253
|
+
echo $FRONTEND_PID > "$PROJECT_ROOT/.frontend.pid"
|
|
254
|
+
cd "$PROJECT_ROOT"
|
|
255
|
+
|
|
256
|
+
# Wait for frontend server to be ready
|
|
257
|
+
sleep 3
|
|
258
|
+
fi
|
|
259
|
+
|
|
260
|
+
# Start backend server with nodemon if available
|
|
261
|
+
if command_exists nodemon; then
|
|
262
|
+
nodemon --exec "node --loader=ts-node/esm" src/web/portal-server.ts
|
|
263
|
+
elif command_exists ts-node; then
|
|
264
|
+
ts-node --esm src/web/portal-server.ts
|
|
265
|
+
else
|
|
266
|
+
# Fallback to compiled JavaScript
|
|
267
|
+
if [[ -f "dist/web/portal-server.js" ]]; then
|
|
268
|
+
node dist/web/portal-server.js
|
|
269
|
+
else
|
|
270
|
+
error "TypeScript compilation required. Run 'npm run build' first."
|
|
271
|
+
exit 1
|
|
272
|
+
fi
|
|
273
|
+
fi
|
|
274
|
+
else
|
|
275
|
+
# Production mode
|
|
276
|
+
log "Starting in production mode..."
|
|
277
|
+
|
|
278
|
+
# Ensure production build exists
|
|
279
|
+
if [[ ! -f "dist/web/portal-server.js" ]]; then
|
|
280
|
+
error "Production build not found. Run 'npm run build' first."
|
|
281
|
+
exit 1
|
|
282
|
+
fi
|
|
283
|
+
|
|
284
|
+
# Start with PM2 if available, otherwise use node
|
|
285
|
+
if command_exists pm2; then
|
|
286
|
+
pm2 start dist/web/portal-server.js \
|
|
287
|
+
--name "claude-flow-portal" \
|
|
288
|
+
--instances "${WEB_PORTAL_WORKERS:-max}" \
|
|
289
|
+
--merge-logs \
|
|
290
|
+
--log-file "$LOG_DIR/portal.log" \
|
|
291
|
+
--error-file "$LOG_DIR/portal-error.log"
|
|
292
|
+
else
|
|
293
|
+
node dist/web/portal-server.js &
|
|
294
|
+
echo $! > "$PID_FILE"
|
|
295
|
+
fi
|
|
296
|
+
fi
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
# Function to execute post-startup hooks
|
|
300
|
+
execute_post_hooks() {
|
|
301
|
+
log "🪝 Executing post-startup coordination hooks..."
|
|
302
|
+
|
|
303
|
+
# Wait for server to be ready
|
|
304
|
+
if wait_for_port "$PORTAL_PORT" 30; then
|
|
305
|
+
# Post-task hook for successful startup
|
|
306
|
+
if command_exists npx && npx claude-flow@alpha --version >/dev/null 2>&1; then
|
|
307
|
+
info "Executing Claude Flow post-task hook..."
|
|
308
|
+
npx claude-flow@alpha hooks post-task \
|
|
309
|
+
--task-id "web-portal-startup-$(date +%s)" \
|
|
310
|
+
--status "completed" \
|
|
311
|
+
--result "Portal started successfully on $PORTAL_HOST:$PORTAL_PORT" || warn "Post-task hook failed"
|
|
312
|
+
fi
|
|
313
|
+
|
|
314
|
+
log "✅ Portal startup complete!"
|
|
315
|
+
info "🌐 Web Portal: http://$PORTAL_HOST:$PORTAL_PORT"
|
|
316
|
+
info "📡 WebSocket: ws://$PORTAL_HOST:$PORTAL_PORT"
|
|
317
|
+
if [[ "${NODE_ENV:-development}" == "development" ]]; then
|
|
318
|
+
info "🔧 Frontend Dev: http://localhost:$FRONTEND_PORT"
|
|
319
|
+
fi
|
|
320
|
+
info "📋 Health Check: http://$PORTAL_HOST:$PORTAL_PORT/api/health"
|
|
321
|
+
info "🔗 MCP Status: http://$PORTAL_HOST:$PORTAL_PORT/api/mcp/status"
|
|
322
|
+
|
|
323
|
+
# Display next steps
|
|
324
|
+
echo ""
|
|
325
|
+
log "🎉 Claude Flow Personal Web Portal is now running!"
|
|
326
|
+
echo ""
|
|
327
|
+
info "Next steps:"
|
|
328
|
+
info " • Open your browser to http://$PORTAL_HOST:$PORTAL_PORT"
|
|
329
|
+
info " • Check MCP connections at http://$PORTAL_HOST:$PORTAL_PORT/api/mcp/status"
|
|
330
|
+
info " • Monitor swarm metrics at http://$PORTAL_HOST:$PORTAL_PORT/api/swarm/metrics"
|
|
331
|
+
echo ""
|
|
332
|
+
info "To stop the portal:"
|
|
333
|
+
info " • Press Ctrl+C in this terminal"
|
|
334
|
+
info " • Or run: $SCRIPT_DIR/stop-portal.sh"
|
|
335
|
+
echo ""
|
|
336
|
+
|
|
337
|
+
else
|
|
338
|
+
error "Portal failed to start - port $PORTAL_PORT is not responding"
|
|
339
|
+
exit 1
|
|
340
|
+
fi
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
# Function to handle graceful shutdown
|
|
344
|
+
cleanup() {
|
|
345
|
+
log "🛑 Shutting down gracefully..."
|
|
346
|
+
|
|
347
|
+
# Execute session-end hook
|
|
348
|
+
if command_exists npx && npx claude-flow@alpha --version >/dev/null 2>&1; then
|
|
349
|
+
info "Executing session-end hook..."
|
|
350
|
+
npx claude-flow@alpha hooks session-end \
|
|
351
|
+
--export-metrics true \
|
|
352
|
+
--save-state true || warn "Session-end hook failed"
|
|
353
|
+
fi
|
|
354
|
+
|
|
355
|
+
# Stop frontend development server if running
|
|
356
|
+
if [[ -f "$PROJECT_ROOT/.frontend.pid" ]]; then
|
|
357
|
+
local frontend_pid
|
|
358
|
+
frontend_pid=$(cat "$PROJECT_ROOT/.frontend.pid")
|
|
359
|
+
if kill -0 "$frontend_pid" 2>/dev/null; then
|
|
360
|
+
log "Stopping frontend development server..."
|
|
361
|
+
kill "$frontend_pid" 2>/dev/null || true
|
|
362
|
+
fi
|
|
363
|
+
rm -f "$PROJECT_ROOT/.frontend.pid"
|
|
364
|
+
fi
|
|
365
|
+
|
|
366
|
+
# Stop main portal server if running
|
|
367
|
+
if [[ -f "$PID_FILE" ]]; then
|
|
368
|
+
local portal_pid
|
|
369
|
+
portal_pid=$(cat "$PID_FILE")
|
|
370
|
+
if kill -0 "$portal_pid" 2>/dev/null; then
|
|
371
|
+
log "Stopping portal server..."
|
|
372
|
+
kill "$portal_pid" 2>/dev/null || true
|
|
373
|
+
fi
|
|
374
|
+
rm -f "$PID_FILE"
|
|
375
|
+
fi
|
|
376
|
+
|
|
377
|
+
# Stop PM2 processes if running
|
|
378
|
+
if command_exists pm2; then
|
|
379
|
+
pm2 stop claude-flow-portal 2>/dev/null || true
|
|
380
|
+
pm2 delete claude-flow-portal 2>/dev/null || true
|
|
381
|
+
fi
|
|
382
|
+
|
|
383
|
+
log "✅ Cleanup complete"
|
|
384
|
+
exit 0
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
# Function to show help
|
|
388
|
+
show_help() {
|
|
389
|
+
cat << EOF
|
|
390
|
+
Claude Flow Personal Web Portal Startup Script
|
|
391
|
+
|
|
392
|
+
Usage: $0 [OPTIONS]
|
|
393
|
+
|
|
394
|
+
Options:
|
|
395
|
+
-h, --help Show this help message
|
|
396
|
+
-p, --port PORT Set portal port (default: 3000)
|
|
397
|
+
-H, --host HOST Set portal host (default: localhost)
|
|
398
|
+
--dev Force development mode
|
|
399
|
+
--prod Force production mode
|
|
400
|
+
--skip-mcp Skip MCP server setup
|
|
401
|
+
--skip-frontend Skip frontend build/start
|
|
402
|
+
--verbose Enable verbose logging
|
|
403
|
+
|
|
404
|
+
Environment Variables:
|
|
405
|
+
WEB_PORTAL_HOST Portal host (default: localhost)
|
|
406
|
+
WEB_PORTAL_PORT Portal port (default: 3000)
|
|
407
|
+
FRONTEND_DEV_PORT Frontend dev server port (default: 3001)
|
|
408
|
+
NODE_ENV Environment mode (development|production|test)
|
|
409
|
+
FLOW_NEXUS_ENABLED Enable Flow-Nexus MCP server (default: false)
|
|
410
|
+
|
|
411
|
+
Examples:
|
|
412
|
+
$0 # Start with default settings
|
|
413
|
+
$0 --port 8080 # Start on port 8080
|
|
414
|
+
$0 --prod # Start in production mode
|
|
415
|
+
$0 --skip-mcp # Start without MCP setup
|
|
416
|
+
|
|
417
|
+
For more information, visit:
|
|
418
|
+
https://github.com/ruvnet/claude-flow
|
|
419
|
+
EOF
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
# Parse command line arguments
|
|
423
|
+
SKIP_MCP=false
|
|
424
|
+
SKIP_FRONTEND=false
|
|
425
|
+
VERBOSE=false
|
|
426
|
+
|
|
427
|
+
while [[ $# -gt 0 ]]; do
|
|
428
|
+
case $1 in
|
|
429
|
+
-h|--help)
|
|
430
|
+
show_help
|
|
431
|
+
exit 0
|
|
432
|
+
;;
|
|
433
|
+
-p|--port)
|
|
434
|
+
PORTAL_PORT="$2"
|
|
435
|
+
shift 2
|
|
436
|
+
;;
|
|
437
|
+
-H|--host)
|
|
438
|
+
PORTAL_HOST="$2"
|
|
439
|
+
shift 2
|
|
440
|
+
;;
|
|
441
|
+
--dev)
|
|
442
|
+
NODE_ENV="development"
|
|
443
|
+
shift
|
|
444
|
+
;;
|
|
445
|
+
--prod)
|
|
446
|
+
NODE_ENV="production"
|
|
447
|
+
shift
|
|
448
|
+
;;
|
|
449
|
+
--skip-mcp)
|
|
450
|
+
SKIP_MCP=true
|
|
451
|
+
shift
|
|
452
|
+
;;
|
|
453
|
+
--skip-frontend)
|
|
454
|
+
SKIP_FRONTEND=true
|
|
455
|
+
shift
|
|
456
|
+
;;
|
|
457
|
+
--verbose)
|
|
458
|
+
VERBOSE=true
|
|
459
|
+
set -x
|
|
460
|
+
shift
|
|
461
|
+
;;
|
|
462
|
+
*)
|
|
463
|
+
error "Unknown option: $1"
|
|
464
|
+
show_help
|
|
465
|
+
exit 1
|
|
466
|
+
;;
|
|
467
|
+
esac
|
|
468
|
+
done
|
|
469
|
+
|
|
470
|
+
# Main execution
|
|
471
|
+
main() {
|
|
472
|
+
# Setup signal handlers
|
|
473
|
+
trap cleanup SIGINT SIGTERM EXIT
|
|
474
|
+
|
|
475
|
+
log "🚀 Claude Flow Personal Web Portal Startup"
|
|
476
|
+
log " Host: $PORTAL_HOST"
|
|
477
|
+
log " Port: $PORTAL_PORT"
|
|
478
|
+
log " Environment: ${NODE_ENV:-development}"
|
|
479
|
+
echo ""
|
|
480
|
+
|
|
481
|
+
# Execute startup sequence
|
|
482
|
+
setup_environment
|
|
483
|
+
check_ports
|
|
484
|
+
|
|
485
|
+
if [[ "$SKIP_MCP" != true ]]; then
|
|
486
|
+
setup_mcp_connections
|
|
487
|
+
else
|
|
488
|
+
warn "Skipping MCP setup as requested"
|
|
489
|
+
fi
|
|
490
|
+
|
|
491
|
+
if [[ "$SKIP_FRONTEND" != true ]]; then
|
|
492
|
+
build_frontend
|
|
493
|
+
else
|
|
494
|
+
warn "Skipping frontend build as requested"
|
|
495
|
+
fi
|
|
496
|
+
|
|
497
|
+
execute_pre_hooks
|
|
498
|
+
start_portal_server
|
|
499
|
+
execute_post_hooks
|
|
500
|
+
|
|
501
|
+
# Keep script running
|
|
502
|
+
wait
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
# Run main function
|
|
506
|
+
main "$@"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Simple startup script for Claude Code Web UI
|
|
5
|
+
* Usage: node start-web-ui.js [port]
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { startWebServer } from './src/cli/simple-commands/web-server.js';
|
|
9
|
+
|
|
10
|
+
const port = process.argv[2] ? parseInt(process.argv[2]) : 3000;
|
|
11
|
+
|
|
12
|
+
console.log('🚀 Starting Claude Code Web UI...');
|
|
13
|
+
console.log();
|
|
14
|
+
|
|
15
|
+
await startWebServer(port);
|