@claude-flow/cli 3.7.0-alpha.1 → 3.7.0-alpha.11
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/.claude/agents/analysis/analyze-code-quality.md +178 -178
- package/.claude/agents/analysis/code-analyzer.md +209 -209
- package/.claude/agents/analysis/code-review/analyze-code-quality.md +178 -178
- package/.claude/agents/architecture/arch-system-design.md +156 -156
- package/.claude/agents/architecture/system-design/arch-system-design.md +154 -154
- package/.claude/agents/browser/browser-agent.yaml +182 -182
- package/.claude/agents/consensus/byzantine-coordinator.md +62 -62
- package/.claude/agents/consensus/crdt-synchronizer.md +996 -996
- package/.claude/agents/consensus/gossip-coordinator.md +62 -62
- package/.claude/agents/consensus/performance-benchmarker.md +850 -850
- package/.claude/agents/consensus/quorum-manager.md +822 -822
- package/.claude/agents/consensus/raft-manager.md +62 -62
- package/.claude/agents/consensus/security-manager.md +621 -621
- package/.claude/agents/core/coder.md +452 -452
- package/.claude/agents/core/planner.md +374 -374
- package/.claude/agents/core/researcher.md +368 -368
- package/.claude/agents/core/reviewer.md +519 -519
- package/.claude/agents/core/tester.md +511 -511
- package/.claude/agents/custom/test-long-runner.md +44 -44
- package/.claude/agents/data/data-ml-model.md +444 -444
- package/.claude/agents/data/ml/data-ml-model.md +192 -192
- package/.claude/agents/development/backend/dev-backend-api.md +141 -141
- package/.claude/agents/development/dev-backend-api.md +344 -344
- package/.claude/agents/devops/ci-cd/ops-cicd-github.md +163 -163
- package/.claude/agents/devops/ops-cicd-github.md +164 -164
- package/.claude/agents/documentation/api-docs/docs-api-openapi.md +173 -173
- package/.claude/agents/documentation/docs-api-openapi.md +354 -354
- package/.claude/agents/flow-nexus/app-store.md +87 -87
- package/.claude/agents/flow-nexus/authentication.md +68 -68
- package/.claude/agents/flow-nexus/challenges.md +80 -80
- package/.claude/agents/flow-nexus/neural-network.md +87 -87
- package/.claude/agents/flow-nexus/payments.md +82 -82
- package/.claude/agents/flow-nexus/sandbox.md +75 -75
- package/.claude/agents/flow-nexus/swarm.md +75 -75
- package/.claude/agents/flow-nexus/user-tools.md +95 -95
- package/.claude/agents/flow-nexus/workflow.md +83 -83
- package/.claude/agents/github/code-review-swarm.md +377 -377
- package/.claude/agents/github/github-modes.md +172 -172
- package/.claude/agents/github/issue-tracker.md +575 -575
- package/.claude/agents/github/multi-repo-swarm.md +552 -552
- package/.claude/agents/github/pr-manager.md +437 -437
- package/.claude/agents/github/project-board-sync.md +508 -508
- package/.claude/agents/github/release-manager.md +604 -604
- package/.claude/agents/github/release-swarm.md +582 -582
- package/.claude/agents/github/repo-architect.md +397 -397
- package/.claude/agents/github/swarm-issue.md +572 -572
- package/.claude/agents/github/swarm-pr.md +427 -427
- package/.claude/agents/github/sync-coordinator.md +451 -451
- package/.claude/agents/github/workflow-automation.md +902 -902
- package/.claude/agents/goal/agent.md +815 -815
- package/.claude/agents/goal/goal-planner.md +72 -72
- package/.claude/agents/optimization/benchmark-suite.md +664 -664
- package/.claude/agents/optimization/load-balancer.md +430 -430
- package/.claude/agents/optimization/performance-monitor.md +671 -671
- package/.claude/agents/optimization/resource-allocator.md +673 -673
- package/.claude/agents/optimization/topology-optimizer.md +807 -807
- package/.claude/agents/payments/agentic-payments.md +126 -126
- package/.claude/agents/sona/sona-learning-optimizer.md +74 -74
- package/.claude/agents/sparc/architecture.md +698 -698
- package/.claude/agents/sparc/pseudocode.md +519 -519
- package/.claude/agents/sparc/refinement.md +801 -801
- package/.claude/agents/sparc/specification.md +477 -477
- package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +224 -224
- package/.claude/agents/specialized/spec-mobile-react-native.md +226 -226
- package/.claude/agents/sublinear/consensus-coordinator.md +337 -337
- package/.claude/agents/sublinear/matrix-optimizer.md +184 -184
- package/.claude/agents/sublinear/pagerank-analyzer.md +298 -298
- package/.claude/agents/sublinear/performance-optimizer.md +367 -367
- package/.claude/agents/sublinear/trading-predictor.md +245 -245
- package/.claude/agents/swarm/adaptive-coordinator.md +1126 -1126
- package/.claude/agents/swarm/hierarchical-coordinator.md +709 -709
- package/.claude/agents/swarm/mesh-coordinator.md +962 -962
- package/.claude/agents/templates/automation-smart-agent.md +204 -204
- package/.claude/agents/templates/base-template-generator.md +289 -289
- package/.claude/agents/templates/coordinator-swarm-init.md +89 -89
- package/.claude/agents/templates/github-pr-manager.md +176 -176
- package/.claude/agents/templates/implementer-sparc-coder.md +258 -258
- package/.claude/agents/templates/memory-coordinator.md +186 -186
- package/.claude/agents/templates/orchestrator-task.md +138 -138
- package/.claude/agents/templates/performance-analyzer.md +198 -198
- package/.claude/agents/templates/sparc-coordinator.md +513 -513
- package/.claude/agents/testing/production-validator.md +394 -394
- package/.claude/agents/testing/tdd-london-swarm.md +243 -243
- package/.claude/agents/v3/adr-architect.md +184 -184
- package/.claude/agents/v3/aidefence-guardian.md +282 -282
- package/.claude/agents/v3/claims-authorizer.md +208 -208
- package/.claude/agents/v3/collective-intelligence-coordinator.md +993 -993
- package/.claude/agents/v3/ddd-domain-expert.md +220 -220
- package/.claude/agents/v3/injection-analyst.md +236 -236
- package/.claude/agents/v3/memory-specialist.md +995 -995
- package/.claude/agents/v3/performance-engineer.md +1233 -1233
- package/.claude/agents/v3/pii-detector.md +151 -151
- package/.claude/agents/v3/reasoningbank-learner.md +213 -213
- package/.claude/agents/v3/security-architect-aidefence.md +410 -410
- package/.claude/agents/v3/security-architect.md +867 -867
- package/.claude/agents/v3/security-auditor.md +771 -771
- package/.claude/agents/v3/sparc-orchestrator.md +182 -182
- package/.claude/agents/v3/swarm-memory-manager.md +157 -157
- package/.claude/agents/v3/v3-integration-architect.md +205 -205
- package/.claude/commands/agents/README.md +50 -50
- package/.claude/commands/agents/agent-capabilities.md +140 -140
- package/.claude/commands/agents/agent-coordination.md +28 -28
- package/.claude/commands/agents/agent-spawning.md +28 -28
- package/.claude/commands/agents/agent-types.md +216 -216
- package/.claude/commands/agents/health.md +139 -139
- package/.claude/commands/agents/list.md +100 -100
- package/.claude/commands/agents/logs.md +130 -130
- package/.claude/commands/agents/metrics.md +122 -122
- package/.claude/commands/agents/pool.md +127 -127
- package/.claude/commands/agents/spawn.md +140 -140
- package/.claude/commands/agents/status.md +115 -115
- package/.claude/commands/agents/stop.md +102 -102
- package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +53 -53
- package/.claude/commands/analysis/README.md +9 -9
- package/.claude/commands/analysis/bottleneck-detect.md +162 -162
- package/.claude/commands/analysis/performance-bottlenecks.md +58 -58
- package/.claude/commands/analysis/performance-report.md +25 -25
- package/.claude/commands/analysis/token-efficiency.md +44 -44
- package/.claude/commands/analysis/token-usage.md +25 -25
- package/.claude/commands/automation/README.md +9 -9
- package/.claude/commands/automation/auto-agent.md +122 -122
- package/.claude/commands/automation/self-healing.md +105 -105
- package/.claude/commands/automation/session-memory.md +89 -89
- package/.claude/commands/automation/smart-agents.md +72 -72
- package/.claude/commands/automation/smart-spawn.md +25 -25
- package/.claude/commands/automation/workflow-select.md +25 -25
- package/.claude/commands/claude-flow-help.md +103 -103
- package/.claude/commands/claude-flow-memory.md +107 -107
- package/.claude/commands/claude-flow-swarm.md +205 -205
- package/.claude/commands/coordination/README.md +9 -9
- package/.claude/commands/coordination/agent-spawn.md +25 -25
- package/.claude/commands/coordination/init.md +44 -44
- package/.claude/commands/coordination/orchestrate.md +43 -43
- package/.claude/commands/coordination/spawn.md +45 -45
- package/.claude/commands/coordination/swarm-init.md +85 -85
- package/.claude/commands/coordination/task-orchestrate.md +25 -25
- package/.claude/commands/flow-nexus/app-store.md +123 -123
- package/.claude/commands/flow-nexus/challenges.md +119 -119
- package/.claude/commands/flow-nexus/login-registration.md +64 -64
- package/.claude/commands/flow-nexus/neural-network.md +133 -133
- package/.claude/commands/flow-nexus/payments.md +115 -115
- package/.claude/commands/flow-nexus/sandbox.md +82 -82
- package/.claude/commands/flow-nexus/swarm.md +86 -86
- package/.claude/commands/flow-nexus/user-tools.md +151 -151
- package/.claude/commands/flow-nexus/workflow.md +114 -114
- package/.claude/commands/github/README.md +11 -11
- package/.claude/commands/github/code-review-swarm.md +513 -513
- package/.claude/commands/github/code-review.md +25 -25
- package/.claude/commands/github/github-modes.md +146 -146
- package/.claude/commands/github/github-swarm.md +121 -121
- package/.claude/commands/github/issue-tracker.md +291 -291
- package/.claude/commands/github/issue-triage.md +25 -25
- package/.claude/commands/github/multi-repo-swarm.md +518 -518
- package/.claude/commands/github/pr-enhance.md +26 -26
- package/.claude/commands/github/pr-manager.md +169 -169
- package/.claude/commands/github/project-board-sync.md +470 -470
- package/.claude/commands/github/release-manager.md +337 -337
- package/.claude/commands/github/release-swarm.md +543 -543
- package/.claude/commands/github/repo-analyze.md +25 -25
- package/.claude/commands/github/repo-architect.md +366 -366
- package/.claude/commands/github/swarm-issue.md +481 -481
- package/.claude/commands/github/swarm-pr.md +284 -284
- package/.claude/commands/github/sync-coordinator.md +300 -300
- package/.claude/commands/github/workflow-automation.md +441 -441
- package/.claude/commands/hive-mind/README.md +17 -17
- package/.claude/commands/hive-mind/hive-mind-consensus.md +8 -8
- package/.claude/commands/hive-mind/hive-mind-init.md +18 -18
- package/.claude/commands/hive-mind/hive-mind-memory.md +8 -8
- package/.claude/commands/hive-mind/hive-mind-metrics.md +8 -8
- package/.claude/commands/hive-mind/hive-mind-resume.md +8 -8
- package/.claude/commands/hive-mind/hive-mind-sessions.md +8 -8
- package/.claude/commands/hive-mind/hive-mind-spawn.md +21 -21
- package/.claude/commands/hive-mind/hive-mind-status.md +8 -8
- package/.claude/commands/hive-mind/hive-mind-stop.md +8 -8
- package/.claude/commands/hive-mind/hive-mind-wizard.md +8 -8
- package/.claude/commands/hive-mind/hive-mind.md +27 -27
- package/.claude/commands/hooks/README.md +11 -11
- package/.claude/commands/hooks/overview.md +57 -57
- package/.claude/commands/hooks/post-edit.md +117 -117
- package/.claude/commands/hooks/post-task.md +112 -112
- package/.claude/commands/hooks/pre-edit.md +113 -113
- package/.claude/commands/hooks/pre-task.md +111 -111
- package/.claude/commands/hooks/session-end.md +118 -118
- package/.claude/commands/hooks/setup.md +102 -102
- package/.claude/commands/memory/README.md +9 -9
- package/.claude/commands/memory/memory-persist.md +25 -25
- package/.claude/commands/memory/memory-search.md +25 -25
- package/.claude/commands/memory/memory-usage.md +25 -25
- package/.claude/commands/memory/neural.md +47 -47
- package/.claude/commands/monitoring/README.md +9 -9
- package/.claude/commands/monitoring/agent-metrics.md +25 -25
- package/.claude/commands/monitoring/agents.md +44 -44
- package/.claude/commands/monitoring/real-time-view.md +25 -25
- package/.claude/commands/monitoring/status.md +46 -46
- package/.claude/commands/monitoring/swarm-monitor.md +25 -25
- package/.claude/commands/optimization/README.md +9 -9
- package/.claude/commands/optimization/auto-topology.md +61 -61
- package/.claude/commands/optimization/cache-manage.md +25 -25
- package/.claude/commands/optimization/parallel-execute.md +25 -25
- package/.claude/commands/optimization/parallel-execution.md +49 -49
- package/.claude/commands/optimization/topology-optimize.md +25 -25
- package/.claude/commands/pair/README.md +260 -260
- package/.claude/commands/pair/commands.md +545 -545
- package/.claude/commands/pair/config.md +509 -509
- package/.claude/commands/pair/examples.md +511 -511
- package/.claude/commands/pair/modes.md +347 -347
- package/.claude/commands/pair/session.md +406 -406
- package/.claude/commands/pair/start.md +208 -208
- package/.claude/commands/sparc/analyzer.md +51 -51
- package/.claude/commands/sparc/architect.md +53 -53
- package/.claude/commands/sparc/ask.md +97 -97
- package/.claude/commands/sparc/batch-executor.md +54 -54
- package/.claude/commands/sparc/code.md +89 -89
- package/.claude/commands/sparc/coder.md +54 -54
- package/.claude/commands/sparc/debug.md +83 -83
- package/.claude/commands/sparc/debugger.md +54 -54
- package/.claude/commands/sparc/designer.md +53 -53
- package/.claude/commands/sparc/devops.md +109 -109
- package/.claude/commands/sparc/docs-writer.md +80 -80
- package/.claude/commands/sparc/documenter.md +54 -54
- package/.claude/commands/sparc/innovator.md +54 -54
- package/.claude/commands/sparc/integration.md +83 -83
- package/.claude/commands/sparc/mcp.md +117 -117
- package/.claude/commands/sparc/memory-manager.md +54 -54
- package/.claude/commands/sparc/optimizer.md +54 -54
- package/.claude/commands/sparc/orchestrator.md +131 -131
- package/.claude/commands/sparc/post-deployment-monitoring-mode.md +83 -83
- package/.claude/commands/sparc/refinement-optimization-mode.md +83 -83
- package/.claude/commands/sparc/researcher.md +54 -54
- package/.claude/commands/sparc/reviewer.md +54 -54
- package/.claude/commands/sparc/security-review.md +80 -80
- package/.claude/commands/sparc/sparc-modes.md +174 -174
- package/.claude/commands/sparc/sparc.md +111 -111
- package/.claude/commands/sparc/spec-pseudocode.md +80 -80
- package/.claude/commands/sparc/supabase-admin.md +348 -348
- package/.claude/commands/sparc/swarm-coordinator.md +54 -54
- package/.claude/commands/sparc/tdd.md +54 -54
- package/.claude/commands/sparc/tester.md +54 -54
- package/.claude/commands/sparc/tutorial.md +79 -79
- package/.claude/commands/sparc/workflow-manager.md +54 -54
- package/.claude/commands/sparc.md +166 -166
- package/.claude/commands/stream-chain/pipeline.md +120 -120
- package/.claude/commands/stream-chain/run.md +69 -69
- package/.claude/commands/swarm/README.md +15 -15
- package/.claude/commands/swarm/analysis.md +95 -95
- package/.claude/commands/swarm/development.md +96 -96
- package/.claude/commands/swarm/examples.md +168 -168
- package/.claude/commands/swarm/maintenance.md +102 -102
- package/.claude/commands/swarm/optimization.md +117 -117
- package/.claude/commands/swarm/research.md +136 -136
- package/.claude/commands/swarm/swarm-analysis.md +8 -8
- package/.claude/commands/swarm/swarm-background.md +8 -8
- package/.claude/commands/swarm/swarm-init.md +19 -19
- package/.claude/commands/swarm/swarm-modes.md +8 -8
- package/.claude/commands/swarm/swarm-monitor.md +8 -8
- package/.claude/commands/swarm/swarm-spawn.md +19 -19
- package/.claude/commands/swarm/swarm-status.md +8 -8
- package/.claude/commands/swarm/swarm-strategies.md +8 -8
- package/.claude/commands/swarm/swarm.md +87 -87
- package/.claude/commands/swarm/testing.md +131 -131
- package/.claude/commands/training/README.md +9 -9
- package/.claude/commands/training/model-update.md +25 -25
- package/.claude/commands/training/neural-patterns.md +107 -107
- package/.claude/commands/training/neural-train.md +75 -75
- package/.claude/commands/training/pattern-learn.md +25 -25
- package/.claude/commands/training/specialization.md +62 -62
- package/.claude/commands/truth/start.md +142 -142
- package/.claude/commands/verify/check.md +49 -49
- package/.claude/commands/verify/start.md +127 -127
- package/.claude/commands/workflows/README.md +9 -9
- package/.claude/commands/workflows/development.md +77 -77
- package/.claude/commands/workflows/research.md +62 -62
- package/.claude/commands/workflows/workflow-create.md +25 -25
- package/.claude/commands/workflows/workflow-execute.md +25 -25
- package/.claude/commands/workflows/workflow-export.md +25 -25
- package/.claude/helpers/README.md +96 -96
- package/.claude/helpers/adr-compliance.sh +186 -186
- package/.claude/helpers/auto-commit.sh +178 -178
- package/.claude/helpers/auto-memory-hook.mjs +368 -368
- package/.claude/helpers/checkpoint-manager.sh +251 -251
- package/.claude/helpers/daemon-manager.sh +252 -252
- package/.claude/helpers/ddd-tracker.sh +144 -144
- package/.claude/helpers/github-safe.js +121 -121
- package/.claude/helpers/github-setup.sh +28 -28
- package/.claude/helpers/guidance-hook.sh +13 -13
- package/.claude/helpers/guidance-hooks.sh +102 -102
- package/.claude/helpers/health-monitor.sh +108 -108
- package/.claude/helpers/hook-handler.cjs +278 -278
- package/.claude/helpers/intelligence.cjs +1031 -1031
- package/.claude/helpers/learning-hooks.sh +329 -329
- package/.claude/helpers/learning-optimizer.sh +127 -127
- package/.claude/helpers/learning-service.mjs +1144 -1144
- package/.claude/helpers/memory.js +83 -83
- package/.claude/helpers/metrics-db.mjs +488 -488
- package/.claude/helpers/pattern-consolidator.sh +86 -86
- package/.claude/helpers/perf-worker.sh +160 -160
- package/.claude/helpers/post-commit +16 -16
- package/.claude/helpers/pre-commit +26 -26
- package/.claude/helpers/quick-start.sh +19 -19
- package/.claude/helpers/router.js +66 -66
- package/.claude/helpers/security-scanner.sh +127 -127
- package/.claude/helpers/session.js +135 -135
- package/.claude/helpers/setup-mcp.sh +18 -18
- package/.claude/helpers/standard-checkpoint-hooks.sh +189 -189
- package/.claude/helpers/statusline-hook.sh +21 -21
- package/.claude/helpers/statusline.cjs +575 -575
- package/.claude/helpers/statusline.js +321 -321
- package/.claude/helpers/swarm-comms.sh +353 -353
- package/.claude/helpers/swarm-hooks.sh +761 -761
- package/.claude/helpers/swarm-monitor.sh +210 -210
- package/.claude/helpers/sync-v3-metrics.sh +245 -245
- package/.claude/helpers/update-v3-progress.sh +165 -165
- package/.claude/helpers/v3-quick-status.sh +57 -57
- package/.claude/helpers/v3.sh +110 -110
- package/.claude/helpers/validate-v3-config.sh +215 -215
- package/.claude/helpers/worker-manager.sh +170 -170
- package/.claude/settings.json +182 -182
- package/.claude/skills/agentdb-advanced/SKILL.md +550 -550
- package/.claude/skills/agentdb-learning/SKILL.md +545 -545
- package/.claude/skills/agentdb-memory-patterns/SKILL.md +339 -339
- package/.claude/skills/agentdb-optimization/SKILL.md +509 -509
- package/.claude/skills/agentdb-vector-search/SKILL.md +339 -339
- package/.claude/skills/agentic-jujutsu/SKILL.md +645 -645
- package/.claude/skills/aidefence-scan.md +151 -151
- package/.claude/skills/aidefence.yaml +297 -297
- package/.claude/skills/browser/SKILL.md +204 -204
- package/.claude/skills/flow-nexus-neural/SKILL.md +738 -738
- package/.claude/skills/flow-nexus-platform/SKILL.md +1157 -1157
- package/.claude/skills/flow-nexus-swarm/SKILL.md +610 -610
- package/.claude/skills/github-code-review/SKILL.md +1140 -1140
- package/.claude/skills/github-multi-repo/SKILL.md +874 -874
- package/.claude/skills/github-project-management/SKILL.md +1290 -1277
- package/.claude/skills/github-release-management/SKILL.md +1081 -1081
- package/.claude/skills/github-workflow-automation/SKILL.md +1065 -1065
- package/.claude/skills/hive-mind-advanced/SKILL.md +712 -712
- package/.claude/skills/hooks-automation/SKILL.md +1201 -1201
- package/.claude/skills/pair-programming/SKILL.md +1202 -1202
- package/.claude/skills/performance-analysis/SKILL.md +563 -563
- package/.claude/skills/reasoningbank-agentdb/SKILL.md +446 -446
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +201 -201
- package/.claude/skills/secure-review.md +181 -181
- package/.claude/skills/skill-builder/SKILL.md +910 -910
- package/.claude/skills/sparc-methodology/SKILL.md +1115 -1115
- package/.claude/skills/stream-chain/SKILL.md +563 -563
- package/.claude/skills/swarm-advanced/SKILL.md +973 -973
- package/.claude/skills/swarm-orchestration/SKILL.md +179 -179
- package/.claude/skills/v3-cli-modernization/SKILL.md +871 -871
- package/.claude/skills/v3-core-implementation/SKILL.md +796 -796
- package/.claude/skills/v3-ddd-architecture/SKILL.md +441 -441
- package/.claude/skills/v3-integration-deep/SKILL.md +240 -240
- package/.claude/skills/v3-mcp-optimization/SKILL.md +776 -776
- package/.claude/skills/v3-memory-unification/SKILL.md +173 -173
- package/.claude/skills/v3-performance-optimization/SKILL.md +389 -389
- package/.claude/skills/v3-security-overhaul/SKILL.md +81 -81
- package/.claude/skills/v3-swarm-coordination/SKILL.md +339 -339
- package/.claude/skills/verification-quality/SKILL.md +649 -649
- package/.claude/skills/worker-benchmarks/skill.md +135 -135
- package/.claude/skills/worker-integration/skill.md +154 -154
- package/README.md +393 -391
- package/bin/cli.js +220 -220
- package/bin/mcp-server.js +224 -224
- package/bin/preinstall.cjs +2 -2
- package/dist/src/commands/agent-wasm.js +2 -2
- package/dist/src/commands/agent-wasm.js.map +1 -1
- package/dist/src/commands/completions.js +409 -409
- package/dist/src/commands/daemon.d.ts.map +1 -1
- package/dist/src/commands/daemon.js +19 -3
- package/dist/src/commands/daemon.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +105 -23
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/embeddings.js +26 -26
- package/dist/src/commands/hive-mind.d.ts.map +1 -1
- package/dist/src/commands/hive-mind.js +122 -104
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +34 -21
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/memory.d.ts.map +1 -1
- package/dist/src/commands/memory.js +68 -0
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/ruvector/backup.js +23 -23
- package/dist/src/commands/ruvector/benchmark.js +31 -31
- package/dist/src/commands/ruvector/import.js +14 -14
- package/dist/src/commands/ruvector/init.js +115 -115
- package/dist/src/commands/ruvector/migrate.js +99 -99
- package/dist/src/commands/ruvector/optimize.js +51 -51
- package/dist/src/commands/ruvector/setup.js +624 -624
- package/dist/src/commands/ruvector/status.js +38 -38
- package/dist/src/index.d.ts +5 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +59 -18
- package/dist/src/index.js.map +1 -1
- package/dist/src/init/claudemd-generator.js +226 -226
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +511 -453
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.js +645 -645
- package/dist/src/init/settings-generator.d.ts.map +1 -1
- package/dist/src/init/settings-generator.js +11 -5
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.js +858 -858
- package/dist/src/init/types.d.ts +7 -0
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/mcp-tools/agentdb-tools.d.ts +3 -0
- package/dist/src/mcp-tools/agentdb-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/agentdb-tools.js +108 -0
- package/dist/src/mcp-tools/agentdb-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +4 -2
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +19 -0
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/neural-tools.js +14 -1
- package/dist/src/mcp-tools/neural-tools.js.map +1 -1
- package/dist/src/mcp-tools/security-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/security-tools.js +28 -3
- package/dist/src/mcp-tools/security-tools.js.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +72 -3
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
- package/dist/src/mcp-tools/wasm-agent-tools.js +1 -1
- package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -1
- package/dist/src/memory/intelligence.d.ts.map +1 -1
- package/dist/src/memory/intelligence.js +28 -3
- package/dist/src/memory/intelligence.js.map +1 -1
- package/dist/src/memory/memory-bridge.d.ts +69 -0
- package/dist/src/memory/memory-bridge.d.ts.map +1 -1
- package/dist/src/memory/memory-bridge.js +319 -66
- package/dist/src/memory/memory-bridge.js.map +1 -1
- package/dist/src/memory/memory-initializer.d.ts +5 -0
- package/dist/src/memory/memory-initializer.d.ts.map +1 -1
- package/dist/src/memory/memory-initializer.js +369 -363
- package/dist/src/memory/memory-initializer.js.map +1 -1
- package/dist/src/memory/neural-package-bridge.d.ts +48 -0
- package/dist/src/memory/neural-package-bridge.d.ts.map +1 -0
- package/dist/src/memory/neural-package-bridge.js +87 -0
- package/dist/src/memory/neural-package-bridge.js.map +1 -0
- package/dist/src/memory/rabitq-index.js +5 -5
- package/dist/src/memory/sona-optimizer.d.ts.map +1 -1
- package/dist/src/memory/sona-optimizer.js +1 -0
- package/dist/src/memory/sona-optimizer.js.map +1 -1
- package/dist/src/parser.d.ts +9 -0
- package/dist/src/parser.d.ts.map +1 -1
- package/dist/src/parser.js +11 -0
- package/dist/src/parser.js.map +1 -1
- package/dist/src/runtime/headless.js +28 -28
- package/dist/src/ruvector/agent-wasm.d.ts.map +1 -1
- package/dist/src/ruvector/agent-wasm.js +4 -1
- package/dist/src/ruvector/agent-wasm.js.map +1 -1
- package/dist/src/ruvector/index.d.ts +0 -2
- package/dist/src/ruvector/index.d.ts.map +1 -1
- package/dist/src/ruvector/index.js +8 -2
- package/dist/src/ruvector/index.js.map +1 -1
- package/dist/src/ruvector/model-router.d.ts +22 -1
- package/dist/src/ruvector/model-router.d.ts.map +1 -1
- package/dist/src/ruvector/model-router.js +125 -5
- package/dist/src/ruvector/model-router.js.map +1 -1
- package/dist/src/services/headless-worker-executor.js +84 -84
- package/dist/src/transfer/deploy-seraphine.js +23 -23
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/scripts/deploy-ipfs-node.sh +153 -153
- package/scripts/postinstall.cjs +153 -153
- package/scripts/publish-registry.ts +345 -345
- package/scripts/publish.sh +57 -57
- package/scripts/setup-ipfs-registry.md +366 -366
- package/dist/src/services/event-stream.d.ts.map +0 -1
- package/dist/src/services/event-stream.js.map +0 -1
- package/dist/src/services/loop-worker-runner.d.ts.map +0 -1
- package/dist/src/services/loop-worker-runner.js.map +0 -1
- package/dist/src/services/runtime-capabilities.d.ts.map +0 -1
- package/dist/src/services/runtime-capabilities.js.map +0 -1
|
@@ -1,575 +1,575 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* RuFlo V3.5 Statusline Generator
|
|
4
|
-
* Displays real-time V3 implementation progress and system status
|
|
5
|
-
*
|
|
6
|
-
* Usage: node statusline.cjs [options]
|
|
7
|
-
*
|
|
8
|
-
* Options:
|
|
9
|
-
* (default) Safe multi-line output with collision zone avoidance
|
|
10
|
-
* --single Single-line output (completely avoids collision)
|
|
11
|
-
* --unsafe Legacy multi-line without collision avoidance
|
|
12
|
-
* --legacy Alias for --unsafe
|
|
13
|
-
* --json JSON output with pretty printing
|
|
14
|
-
* --compact JSON output without formatting
|
|
15
|
-
*
|
|
16
|
-
* Collision Zone Fix (Issue #985):
|
|
17
|
-
* Claude Code writes its internal status (e.g., "7s • 1p") at absolute
|
|
18
|
-
* terminal coordinates (columns 15-25 on second-to-last line). The safe
|
|
19
|
-
* mode pads the collision line with spaces to push content past column 25.
|
|
20
|
-
*
|
|
21
|
-
* IMPORTANT: This file uses .cjs extension to work in ES module projects.
|
|
22
|
-
* The require() syntax is intentional for CommonJS compatibility.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
26
|
-
const fs = require('fs');
|
|
27
|
-
const path = require('path');
|
|
28
|
-
const { execSync, execFileSync } = require('child_process');
|
|
29
|
-
|
|
30
|
-
// Configuration
|
|
31
|
-
const CONFIG = {
|
|
32
|
-
enabled: true,
|
|
33
|
-
showProgress: true,
|
|
34
|
-
showSecurity: true,
|
|
35
|
-
showSwarm: true,
|
|
36
|
-
showHooks: true,
|
|
37
|
-
showPerformance: true,
|
|
38
|
-
refreshInterval: 5000,
|
|
39
|
-
maxAgents: 15,
|
|
40
|
-
topology: 'hierarchical-mesh',
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Cross-platform helpers
|
|
44
|
-
const isWindows = process.platform === 'win32';
|
|
45
|
-
const nullDevice = isWindows ? 'NUL' : '/dev/null';
|
|
46
|
-
|
|
47
|
-
// ANSI colors
|
|
48
|
-
const c = {
|
|
49
|
-
reset: '\x1b[0m',
|
|
50
|
-
bold: '\x1b[1m',
|
|
51
|
-
dim: '\x1b[2m',
|
|
52
|
-
red: '\x1b[0;31m',
|
|
53
|
-
green: '\x1b[0;32m',
|
|
54
|
-
yellow: '\x1b[0;33m',
|
|
55
|
-
blue: '\x1b[0;34m',
|
|
56
|
-
purple: '\x1b[0;35m',
|
|
57
|
-
cyan: '\x1b[0;36m',
|
|
58
|
-
brightRed: '\x1b[1;31m',
|
|
59
|
-
brightGreen: '\x1b[1;32m',
|
|
60
|
-
brightYellow: '\x1b[1;33m',
|
|
61
|
-
brightBlue: '\x1b[1;34m',
|
|
62
|
-
brightPurple: '\x1b[1;35m',
|
|
63
|
-
brightCyan: '\x1b[1;36m',
|
|
64
|
-
brightWhite: '\x1b[1;37m',
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// Get user info
|
|
68
|
-
function getUserInfo() {
|
|
69
|
-
let name = 'user';
|
|
70
|
-
let gitBranch = '';
|
|
71
|
-
let modelName = 'Unknown';
|
|
72
|
-
|
|
73
|
-
// audit_1776853149979: previously used execSync with a shell string. Switched
|
|
74
|
-
// to execFileSync('git', argv) on both platforms so there is no shell
|
|
75
|
-
// interpretation. Cross-platform behavior is preserved by relying on git's
|
|
76
|
-
// own exit code instead of `|| echo` fallbacks: missing repo / no user.name
|
|
77
|
-
// throws, caught below, defaults retained.
|
|
78
|
-
try {
|
|
79
|
-
name = execFileSync('git', ['config', 'user.name'], { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || 'user';
|
|
80
|
-
} catch { /* keep default */ }
|
|
81
|
-
try {
|
|
82
|
-
gitBranch = execFileSync('git', ['branch', '--show-current'], { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
83
|
-
} catch { /* keep empty */ }
|
|
84
|
-
|
|
85
|
-
// Auto-detect model from Claude Code's config
|
|
86
|
-
try {
|
|
87
|
-
const homedir = require('os').homedir();
|
|
88
|
-
const claudeConfigPath = path.join(homedir, '.claude.json');
|
|
89
|
-
if (fs.existsSync(claudeConfigPath)) {
|
|
90
|
-
const claudeConfig = JSON.parse(fs.readFileSync(claudeConfigPath, 'utf-8'));
|
|
91
|
-
// Try to find lastModelUsage - check current dir and parent dirs
|
|
92
|
-
let lastModelUsage = null;
|
|
93
|
-
const cwd = process.cwd();
|
|
94
|
-
if (claudeConfig.projects) {
|
|
95
|
-
// Try exact match first, then check if cwd starts with any project path
|
|
96
|
-
for (const [projectPath, projectConfig] of Object.entries(claudeConfig.projects)) {
|
|
97
|
-
if (cwd === projectPath || cwd.startsWith(projectPath + '/')) {
|
|
98
|
-
lastModelUsage = projectConfig.lastModelUsage;
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (lastModelUsage) {
|
|
104
|
-
const modelIds = Object.keys(lastModelUsage);
|
|
105
|
-
if (modelIds.length > 0) {
|
|
106
|
-
// Take the last model (most recently added to the object)
|
|
107
|
-
// Or find the one with most tokens (most actively used this session)
|
|
108
|
-
let modelId = modelIds[modelIds.length - 1];
|
|
109
|
-
if (modelIds.length > 1) {
|
|
110
|
-
// If multiple models, pick the one with most total tokens
|
|
111
|
-
let maxTokens = 0;
|
|
112
|
-
for (const id of modelIds) {
|
|
113
|
-
const usage = lastModelUsage[id];
|
|
114
|
-
const total = (usage.inputTokens || 0) + (usage.outputTokens || 0);
|
|
115
|
-
if (total > maxTokens) {
|
|
116
|
-
maxTokens = total;
|
|
117
|
-
modelId = id;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
// Parse model ID to human-readable name
|
|
122
|
-
if (modelId.includes('opus')) modelName = 'Opus 4.6 (1M context)';
|
|
123
|
-
else if (modelId.includes('sonnet')) modelName = 'Sonnet 4.6';
|
|
124
|
-
else if (modelId.includes('haiku')) modelName = 'Haiku 4.5';
|
|
125
|
-
else modelName = modelId.split('-').slice(1, 3).join(' ');
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
} catch (e) {
|
|
130
|
-
// Fallback to Unknown if can't read config
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return { name, gitBranch, modelName };
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Get learning stats from intelligence loop data (ADR-050)
|
|
137
|
-
function getLearningStats() {
|
|
138
|
-
let patterns = 0;
|
|
139
|
-
let sessions = 0;
|
|
140
|
-
let trajectories = 0;
|
|
141
|
-
let edges = 0;
|
|
142
|
-
let confidenceMean = 0;
|
|
143
|
-
let accessedCount = 0;
|
|
144
|
-
let trend = 'STABLE';
|
|
145
|
-
|
|
146
|
-
// PRIMARY: Read from intelligence loop data files
|
|
147
|
-
const dataDir = path.join(process.cwd(), '.claude-flow', 'data');
|
|
148
|
-
|
|
149
|
-
// 1. graph-state.json — authoritative node/edge counts
|
|
150
|
-
const graphPath = path.join(dataDir, 'graph-state.json');
|
|
151
|
-
if (fs.existsSync(graphPath)) {
|
|
152
|
-
try {
|
|
153
|
-
const graph = JSON.parse(fs.readFileSync(graphPath, 'utf-8'));
|
|
154
|
-
patterns = graph.nodes ? Object.keys(graph.nodes).length : 0;
|
|
155
|
-
edges = Array.isArray(graph.edges) ? graph.edges.length : 0;
|
|
156
|
-
} catch (e) { /* ignore */ }
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// 2. ranked-context.json — confidence and access data
|
|
160
|
-
const rankedPath = path.join(dataDir, 'ranked-context.json');
|
|
161
|
-
if (fs.existsSync(rankedPath)) {
|
|
162
|
-
try {
|
|
163
|
-
const ranked = JSON.parse(fs.readFileSync(rankedPath, 'utf-8'));
|
|
164
|
-
if (ranked.entries && ranked.entries.length > 0) {
|
|
165
|
-
patterns = Math.max(patterns, ranked.entries.length);
|
|
166
|
-
let confSum = 0;
|
|
167
|
-
let accCount = 0;
|
|
168
|
-
for (let i = 0; i < ranked.entries.length; i++) {
|
|
169
|
-
confSum += (ranked.entries[i].confidence || 0);
|
|
170
|
-
if ((ranked.entries[i].accessCount || 0) > 0) accCount++;
|
|
171
|
-
}
|
|
172
|
-
confidenceMean = confSum / ranked.entries.length;
|
|
173
|
-
accessedCount = accCount;
|
|
174
|
-
}
|
|
175
|
-
} catch (e) { /* ignore */ }
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// 3. intelligence-snapshot.json — trend history
|
|
179
|
-
const snapshotPath = path.join(dataDir, 'intelligence-snapshot.json');
|
|
180
|
-
if (fs.existsSync(snapshotPath)) {
|
|
181
|
-
try {
|
|
182
|
-
const snapshot = JSON.parse(fs.readFileSync(snapshotPath, 'utf-8'));
|
|
183
|
-
if (snapshot.history && snapshot.history.length >= 2) {
|
|
184
|
-
const first = snapshot.history[0];
|
|
185
|
-
const last = snapshot.history[snapshot.history.length - 1];
|
|
186
|
-
const confDrift = (last.confidenceMean || 0) - (first.confidenceMean || 0);
|
|
187
|
-
trend = confDrift > 0.01 ? 'IMPROVING' : confDrift < -0.01 ? 'DECLINING' : 'STABLE';
|
|
188
|
-
sessions = Math.max(sessions, snapshot.history.length);
|
|
189
|
-
}
|
|
190
|
-
} catch (e) { /* ignore */ }
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// 4. auto-memory-store.json — fallback entry count
|
|
194
|
-
if (patterns === 0) {
|
|
195
|
-
const autoMemPath = path.join(dataDir, 'auto-memory-store.json');
|
|
196
|
-
if (fs.existsSync(autoMemPath)) {
|
|
197
|
-
try {
|
|
198
|
-
const data = JSON.parse(fs.readFileSync(autoMemPath, 'utf-8'));
|
|
199
|
-
patterns = Array.isArray(data) ? data.length : (data.entries ? data.entries.length : 0);
|
|
200
|
-
} catch (e) { /* ignore */ }
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// FALLBACK: Legacy memory.db file-size estimation
|
|
205
|
-
if (patterns === 0) {
|
|
206
|
-
const memoryPaths = [
|
|
207
|
-
path.join(process.cwd(), '.swarm', 'memory.db'),
|
|
208
|
-
path.join(process.cwd(), '.claude', 'memory.db'),
|
|
209
|
-
path.join(process.cwd(), 'data', 'memory.db'),
|
|
210
|
-
];
|
|
211
|
-
for (let j = 0; j < memoryPaths.length; j++) {
|
|
212
|
-
if (fs.existsSync(memoryPaths[j])) {
|
|
213
|
-
try {
|
|
214
|
-
const dbStats = fs.statSync(memoryPaths[j]);
|
|
215
|
-
patterns = Math.floor(dbStats.size / 1024 / 2);
|
|
216
|
-
break;
|
|
217
|
-
} catch (e) { /* ignore */ }
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// Session count from session files
|
|
223
|
-
const sessionsPath = path.join(process.cwd(), '.claude', 'sessions');
|
|
224
|
-
if (fs.existsSync(sessionsPath)) {
|
|
225
|
-
try {
|
|
226
|
-
const sessionFiles = fs.readdirSync(sessionsPath).filter(f => f.endsWith('.json'));
|
|
227
|
-
sessions = Math.max(sessions, sessionFiles.length);
|
|
228
|
-
} catch (e) { /* ignore */ }
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
trajectories = Math.floor(patterns / 5);
|
|
232
|
-
|
|
233
|
-
return { patterns, sessions, trajectories, edges, confidenceMean, accessedCount, trend };
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// Get V3 progress from learning state (grows as system learns)
|
|
237
|
-
function getV3Progress() {
|
|
238
|
-
const learning = getLearningStats();
|
|
239
|
-
|
|
240
|
-
// DDD progress based on actual learned patterns
|
|
241
|
-
// New install: 0 patterns = 0/5 domains, 0% DDD
|
|
242
|
-
// As patterns grow: 10+ patterns = 1 domain, 50+ = 2, 100+ = 3, 200+ = 4, 500+ = 5
|
|
243
|
-
let domainsCompleted = 0;
|
|
244
|
-
if (learning.patterns >= 500) domainsCompleted = 5;
|
|
245
|
-
else if (learning.patterns >= 200) domainsCompleted = 4;
|
|
246
|
-
else if (learning.patterns >= 100) domainsCompleted = 3;
|
|
247
|
-
else if (learning.patterns >= 50) domainsCompleted = 2;
|
|
248
|
-
else if (learning.patterns >= 10) domainsCompleted = 1;
|
|
249
|
-
|
|
250
|
-
const totalDomains = 5;
|
|
251
|
-
const dddProgress = Math.min(100, Math.floor((domainsCompleted / totalDomains) * 100));
|
|
252
|
-
|
|
253
|
-
return {
|
|
254
|
-
domainsCompleted,
|
|
255
|
-
totalDomains,
|
|
256
|
-
dddProgress,
|
|
257
|
-
patternsLearned: learning.patterns,
|
|
258
|
-
sessionsCompleted: learning.sessions
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// Get security status based on actual scans
|
|
263
|
-
function getSecurityStatus() {
|
|
264
|
-
// Check for security scan results in memory
|
|
265
|
-
const scanResultsPath = path.join(process.cwd(), '.claude', 'security-scans');
|
|
266
|
-
let cvesFixed = 0;
|
|
267
|
-
const totalCves = 3;
|
|
268
|
-
|
|
269
|
-
if (fs.existsSync(scanResultsPath)) {
|
|
270
|
-
try {
|
|
271
|
-
const scans = fs.readdirSync(scanResultsPath).filter(f => f.endsWith('.json'));
|
|
272
|
-
// Each successful scan file = 1 CVE addressed
|
|
273
|
-
cvesFixed = Math.min(totalCves, scans.length);
|
|
274
|
-
} catch (e) {
|
|
275
|
-
// Ignore
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// Also check .swarm/security for audit results
|
|
280
|
-
const auditPath = path.join(process.cwd(), '.swarm', 'security');
|
|
281
|
-
if (fs.existsSync(auditPath)) {
|
|
282
|
-
try {
|
|
283
|
-
const audits = fs.readdirSync(auditPath).filter(f => f.includes('audit'));
|
|
284
|
-
cvesFixed = Math.min(totalCves, Math.max(cvesFixed, audits.length));
|
|
285
|
-
} catch (e) {
|
|
286
|
-
// Ignore
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
const status = cvesFixed >= totalCves ? 'CLEAN' : cvesFixed > 0 ? 'IN_PROGRESS' : 'PENDING';
|
|
291
|
-
|
|
292
|
-
return {
|
|
293
|
-
status,
|
|
294
|
-
cvesFixed,
|
|
295
|
-
totalCves,
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// Get swarm status
|
|
300
|
-
function getSwarmStatus() {
|
|
301
|
-
let activeAgents = 0;
|
|
302
|
-
let coordinationActive = false;
|
|
303
|
-
|
|
304
|
-
try {
|
|
305
|
-
if (isWindows) {
|
|
306
|
-
// Windows: use tasklist and findstr
|
|
307
|
-
const ps = execSync('tasklist 2>NUL | findstr /I "agentic-flow" 2>NUL | find /C /V "" 2>NUL || echo 0', { encoding: 'utf-8' });
|
|
308
|
-
activeAgents = Math.max(0, parseInt(ps.trim()) || 0);
|
|
309
|
-
} else {
|
|
310
|
-
const ps = execSync('ps aux 2>/dev/null | grep -c agentic-flow || echo "0"', { encoding: 'utf-8' });
|
|
311
|
-
activeAgents = Math.max(0, parseInt(ps.trim()) - 1);
|
|
312
|
-
}
|
|
313
|
-
coordinationActive = activeAgents > 0;
|
|
314
|
-
} catch (e) {
|
|
315
|
-
// Ignore errors - default to 0 agents
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
return {
|
|
319
|
-
activeAgents,
|
|
320
|
-
maxAgents: CONFIG.maxAgents,
|
|
321
|
-
coordinationActive,
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
// Get system metrics (dynamic based on actual state)
|
|
326
|
-
function getSystemMetrics() {
|
|
327
|
-
let memoryMB = 0;
|
|
328
|
-
let subAgents = 0;
|
|
329
|
-
|
|
330
|
-
try {
|
|
331
|
-
if (isWindows) {
|
|
332
|
-
// Windows: use tasklist for memory info, fallback to process.memoryUsage
|
|
333
|
-
// tasklist memory column is complex to parse, use Node.js API instead
|
|
334
|
-
memoryMB = Math.floor(process.memoryUsage().heapUsed / 1024 / 1024);
|
|
335
|
-
} else {
|
|
336
|
-
const mem = execSync('ps aux | grep -E "(node|agentic|claude)" | grep -v grep | awk \'{sum += $6} END {print int(sum/1024)}\'', { encoding: 'utf-8' });
|
|
337
|
-
memoryMB = parseInt(mem.trim()) || 0;
|
|
338
|
-
}
|
|
339
|
-
} catch (e) {
|
|
340
|
-
// Fallback
|
|
341
|
-
memoryMB = Math.floor(process.memoryUsage().heapUsed / 1024 / 1024);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// Get learning stats for intelligence %
|
|
345
|
-
const learning = getLearningStats();
|
|
346
|
-
|
|
347
|
-
// Intelligence % from REAL intelligence loop data (ADR-050)
|
|
348
|
-
// Composite: 40% confidence mean + 30% access ratio + 30% pattern density
|
|
349
|
-
let intelligencePct = 0;
|
|
350
|
-
if (learning.confidenceMean > 0 || (learning.patterns > 0 && learning.accessedCount > 0)) {
|
|
351
|
-
const confScore = Math.min(100, Math.floor(learning.confidenceMean * 100));
|
|
352
|
-
const accessRatio = learning.patterns > 0 ? (learning.accessedCount / learning.patterns) : 0;
|
|
353
|
-
const accessScore = Math.min(100, Math.floor(accessRatio * 100));
|
|
354
|
-
const densityScore = Math.min(100, Math.floor(learning.patterns / 5));
|
|
355
|
-
intelligencePct = Math.floor(confScore * 0.4 + accessScore * 0.3 + densityScore * 0.3);
|
|
356
|
-
}
|
|
357
|
-
// Fallback: legacy pattern count
|
|
358
|
-
if (intelligencePct === 0 && learning.patterns > 0) {
|
|
359
|
-
intelligencePct = Math.min(100, Math.floor(learning.patterns / 10));
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// Context % based on session history
|
|
363
|
-
const contextPct = Math.min(100, Math.floor(learning.sessions * 5));
|
|
364
|
-
|
|
365
|
-
// Count active sub-agents from process list
|
|
366
|
-
try {
|
|
367
|
-
if (isWindows) {
|
|
368
|
-
// Windows: use tasklist and findstr for agent counting
|
|
369
|
-
const agents = execSync('tasklist 2>NUL | findstr /I "claude-flow" 2>NUL | find /C /V "" 2>NUL || echo 0', { encoding: 'utf-8' });
|
|
370
|
-
subAgents = Math.max(0, parseInt(agents.trim()) || 0);
|
|
371
|
-
} else {
|
|
372
|
-
const agents = execSync('ps aux 2>/dev/null | grep -c "claude-flow.*agent" || echo "0"', { encoding: 'utf-8' });
|
|
373
|
-
subAgents = Math.max(0, parseInt(agents.trim()) - 1);
|
|
374
|
-
}
|
|
375
|
-
} catch (e) {
|
|
376
|
-
// Ignore - default to 0
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
return {
|
|
380
|
-
memoryMB,
|
|
381
|
-
contextPct,
|
|
382
|
-
intelligencePct,
|
|
383
|
-
subAgents,
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
// Generate progress bar
|
|
388
|
-
function progressBar(current, total) {
|
|
389
|
-
const width = 5;
|
|
390
|
-
const filled = Math.round((current / total) * width);
|
|
391
|
-
const empty = width - filled;
|
|
392
|
-
return '[' + '\u25CF'.repeat(filled) + '\u25CB'.repeat(empty) + ']';
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
// Generate full statusline
|
|
396
|
-
function generateStatusline() {
|
|
397
|
-
const user = getUserInfo();
|
|
398
|
-
const progress = getV3Progress();
|
|
399
|
-
const security = getSecurityStatus();
|
|
400
|
-
const swarm = getSwarmStatus();
|
|
401
|
-
const system = getSystemMetrics();
|
|
402
|
-
const lines = [];
|
|
403
|
-
|
|
404
|
-
// Header Line
|
|
405
|
-
let header = `${c.bold}${c.brightPurple}▊ RuFlo V3.5 ${c.reset}`;
|
|
406
|
-
header += `${swarm.coordinationActive ? c.brightCyan : c.dim}● ${c.brightCyan}${user.name}${c.reset}`;
|
|
407
|
-
if (user.gitBranch) {
|
|
408
|
-
header += ` ${c.dim}│${c.reset} ${c.brightBlue}⎇ ${user.gitBranch}${c.reset}`;
|
|
409
|
-
}
|
|
410
|
-
header += ` ${c.dim}│${c.reset} ${c.purple}${user.modelName}${c.reset}`;
|
|
411
|
-
lines.push(header);
|
|
412
|
-
|
|
413
|
-
// Separator
|
|
414
|
-
lines.push(`${c.dim}─────────────────────────────────────────────────────${c.reset}`);
|
|
415
|
-
|
|
416
|
-
// Line 1: DDD Domain Progress
|
|
417
|
-
const domainsColor = progress.domainsCompleted >= 3 ? c.brightGreen : progress.domainsCompleted > 0 ? c.yellow : c.red;
|
|
418
|
-
lines.push(
|
|
419
|
-
`${c.brightCyan}🏗️ DDD Domains${c.reset} ${progressBar(progress.domainsCompleted, progress.totalDomains)} ` +
|
|
420
|
-
`${domainsColor}${progress.domainsCompleted}${c.reset}/${c.brightWhite}${progress.totalDomains}${c.reset} ` +
|
|
421
|
-
`${c.brightYellow}⚡ 1.0x${c.reset} ${c.dim}→${c.reset} ${c.brightYellow}2.49x-7.47x${c.reset}`
|
|
422
|
-
);
|
|
423
|
-
|
|
424
|
-
// Line 2: Swarm + CVE + Memory + Context + Intelligence
|
|
425
|
-
const swarmIndicator = swarm.coordinationActive ? `${c.brightGreen}◉${c.reset}` : `${c.dim}○${c.reset}`;
|
|
426
|
-
const agentsColor = swarm.activeAgents > 0 ? c.brightGreen : c.red;
|
|
427
|
-
let securityIcon = security.status === 'CLEAN' ? '🟢' : security.status === 'IN_PROGRESS' ? '🟡' : '🔴';
|
|
428
|
-
let securityColor = security.status === 'CLEAN' ? c.brightGreen : security.status === 'IN_PROGRESS' ? c.brightYellow : c.brightRed;
|
|
429
|
-
|
|
430
|
-
lines.push(
|
|
431
|
-
`${c.brightYellow}🤖 Swarm${c.reset} ${swarmIndicator} [${agentsColor}${String(swarm.activeAgents).padStart(2)}${c.reset}/${c.brightWhite}${swarm.maxAgents}${c.reset}] ` +
|
|
432
|
-
`${c.brightPurple}👥 ${system.subAgents}${c.reset} ` +
|
|
433
|
-
`${securityIcon} ${securityColor}CVE ${security.cvesFixed}${c.reset}/${c.brightWhite}${security.totalCves}${c.reset} ` +
|
|
434
|
-
`${c.brightCyan}💾 ${system.memoryMB}MB${c.reset} ` +
|
|
435
|
-
`${c.brightGreen}📂 ${String(system.contextPct).padStart(3)}%${c.reset} ` +
|
|
436
|
-
`${c.dim}🧠 ${String(system.intelligencePct).padStart(3)}%${c.reset}`
|
|
437
|
-
);
|
|
438
|
-
|
|
439
|
-
// Line 3: Architecture status
|
|
440
|
-
const dddColor = progress.dddProgress >= 50 ? c.brightGreen : progress.dddProgress > 0 ? c.yellow : c.red;
|
|
441
|
-
lines.push(
|
|
442
|
-
`${c.brightPurple}🔧 Architecture${c.reset} ` +
|
|
443
|
-
`${c.cyan}DDD${c.reset} ${dddColor}●${String(progress.dddProgress).padStart(3)}%${c.reset} ${c.dim}│${c.reset} ` +
|
|
444
|
-
`${c.cyan}Security${c.reset} ${securityColor}●${security.status}${c.reset} ${c.dim}│${c.reset} ` +
|
|
445
|
-
`${c.cyan}Memory${c.reset} ${c.brightGreen}●AgentDB${c.reset} ${c.dim}│${c.reset} ` +
|
|
446
|
-
`${c.cyan}Integration${c.reset} ${swarm.coordinationActive ? c.brightCyan : c.dim}●${c.reset}`
|
|
447
|
-
);
|
|
448
|
-
|
|
449
|
-
return lines.join('\n');
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
// Generate JSON data
|
|
453
|
-
function generateJSON() {
|
|
454
|
-
return {
|
|
455
|
-
user: getUserInfo(),
|
|
456
|
-
v3Progress: getV3Progress(),
|
|
457
|
-
security: getSecurityStatus(),
|
|
458
|
-
swarm: getSwarmStatus(),
|
|
459
|
-
system: getSystemMetrics(),
|
|
460
|
-
performance: {
|
|
461
|
-
flashAttentionTarget: '2.49x-7.47x',
|
|
462
|
-
searchImprovement: '150x-12,500x',
|
|
463
|
-
memoryReduction: '50-75%',
|
|
464
|
-
},
|
|
465
|
-
lastUpdated: new Date().toISOString(),
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* Generate single-line output for Claude Code compatibility
|
|
471
|
-
* This avoids the collision zone issue entirely by using one line
|
|
472
|
-
* @see https://github.com/ruvnet/claude-flow/issues/985
|
|
473
|
-
*/
|
|
474
|
-
function generateSingleLine() {
|
|
475
|
-
if (!CONFIG.enabled) return '';
|
|
476
|
-
|
|
477
|
-
const user = getUserInfo();
|
|
478
|
-
const progress = getV3Progress();
|
|
479
|
-
const security = getSecurityStatus();
|
|
480
|
-
const swarm = getSwarmStatus();
|
|
481
|
-
const system = getSystemMetrics();
|
|
482
|
-
|
|
483
|
-
const swarmIndicator = swarm.coordinationActive ? '●' : '○';
|
|
484
|
-
const securityStatus = security.status === 'CLEAN' ? '✓' :
|
|
485
|
-
security.cvesFixed > 0 ? '~' : '✗';
|
|
486
|
-
|
|
487
|
-
return `${c.brightPurple}RuFlo${c.reset} ${c.dim}|${c.reset} ` +
|
|
488
|
-
`${c.cyan}D:${progress.domainsCompleted}/${progress.totalDomains}${c.reset} ${c.dim}|${c.reset} ` +
|
|
489
|
-
`${c.yellow}S:${swarmIndicator}${swarm.activeAgents}/${swarm.maxAgents}${c.reset} ${c.dim}|${c.reset} ` +
|
|
490
|
-
`${security.status === 'CLEAN' ? c.green : c.red}CVE:${securityStatus}${security.cvesFixed}/${security.totalCves}${c.reset} ${c.dim}|${c.reset} ` +
|
|
491
|
-
`${c.dim}🧠${system.intelligencePct}%${c.reset}`;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
/**
|
|
495
|
-
* Generate safe multi-line statusline that avoids Claude Code collision zone
|
|
496
|
-
* The collision zone is columns 15-25 on the second-to-last line.
|
|
497
|
-
* We pad that line with spaces to push content past column 25.
|
|
498
|
-
* @see https://github.com/ruvnet/claude-flow/issues/985
|
|
499
|
-
*/
|
|
500
|
-
function generateSafeStatusline() {
|
|
501
|
-
if (!CONFIG.enabled) return '';
|
|
502
|
-
|
|
503
|
-
const user = getUserInfo();
|
|
504
|
-
const progress = getV3Progress();
|
|
505
|
-
const security = getSecurityStatus();
|
|
506
|
-
const swarm = getSwarmStatus();
|
|
507
|
-
const system = getSystemMetrics();
|
|
508
|
-
const lines = [];
|
|
509
|
-
|
|
510
|
-
// Header Line
|
|
511
|
-
let header = `${c.bold}${c.brightPurple}▊ RuFlo V3.5 ${c.reset}`;
|
|
512
|
-
header += `${swarm.coordinationActive ? c.brightCyan : c.dim}● ${c.brightCyan}${user.name}${c.reset}`;
|
|
513
|
-
if (user.gitBranch) {
|
|
514
|
-
header += ` ${c.dim}│${c.reset} ${c.brightBlue}⎇ ${user.gitBranch}${c.reset}`;
|
|
515
|
-
}
|
|
516
|
-
header += ` ${c.dim}│${c.reset} ${c.purple}${user.modelName}${c.reset}`;
|
|
517
|
-
lines.push(header);
|
|
518
|
-
|
|
519
|
-
// Separator
|
|
520
|
-
lines.push(`${c.dim}─────────────────────────────────────────────────────${c.reset}`);
|
|
521
|
-
|
|
522
|
-
// Line 1: DDD Domain Progress
|
|
523
|
-
const domainsColor = progress.domainsCompleted >= 3 ? c.brightGreen : progress.domainsCompleted > 0 ? c.yellow : c.red;
|
|
524
|
-
lines.push(
|
|
525
|
-
`${c.brightCyan}🏗️ DDD Domains${c.reset} ${progressBar(progress.domainsCompleted, progress.totalDomains)} ` +
|
|
526
|
-
`${domainsColor}${progress.domainsCompleted}${c.reset}/${c.brightWhite}${progress.totalDomains}${c.reset} ` +
|
|
527
|
-
`${c.brightYellow}⚡ 1.0x${c.reset} ${c.dim}→${c.reset} ${c.brightYellow}2.49x-7.47x${c.reset}`
|
|
528
|
-
);
|
|
529
|
-
|
|
530
|
-
// Line 2 (COLLISION LINE): Swarm status with padding after label
|
|
531
|
-
// The emoji+label is ~10 columns. Padding pushes content past collision zone (cols 15-25)
|
|
532
|
-
const swarmIndicator = swarm.coordinationActive ? `${c.brightGreen}◉${c.reset}` : `${c.dim}○${c.reset}`;
|
|
533
|
-
const agentsColor = swarm.activeAgents > 0 ? c.brightGreen : c.red;
|
|
534
|
-
let securityIcon = security.status === 'CLEAN' ? '🟢' : security.status === 'IN_PROGRESS' ? '🟡' : '🔴';
|
|
535
|
-
let securityColor = security.status === 'CLEAN' ? c.brightGreen : security.status === 'IN_PROGRESS' ? c.brightYellow : c.brightRed;
|
|
536
|
-
|
|
537
|
-
// Padding after "🤖 Swarm" (emoji 2 cols + " Swarm" 6 cols = 8, pad 18 to reach col 26)
|
|
538
|
-
lines.push(
|
|
539
|
-
`${c.brightYellow}🤖 Swarm${c.reset} ` + // 18 spaces padding
|
|
540
|
-
`${swarmIndicator} [${agentsColor}${String(swarm.activeAgents).padStart(2)}${c.reset}/${c.brightWhite}${swarm.maxAgents}${c.reset}] ` +
|
|
541
|
-
`${c.brightPurple}👥 ${system.subAgents}${c.reset} ` +
|
|
542
|
-
`${securityIcon} ${securityColor}CVE ${security.cvesFixed}${c.reset}/${c.brightWhite}${security.totalCves}${c.reset} ` +
|
|
543
|
-
`${c.brightCyan}💾 ${system.memoryMB}MB${c.reset} ` +
|
|
544
|
-
`${c.dim}🧠 ${system.intelligencePct}%${c.reset}`
|
|
545
|
-
);
|
|
546
|
-
|
|
547
|
-
// Line 3: Architecture status (this is the last line, not in collision zone)
|
|
548
|
-
const dddColor = progress.dddProgress >= 50 ? c.brightGreen : progress.dddProgress > 0 ? c.yellow : c.red;
|
|
549
|
-
lines.push(
|
|
550
|
-
`${c.brightPurple}🔧 Architecture${c.reset} ` +
|
|
551
|
-
`${c.cyan}DDD${c.reset} ${dddColor}●${String(progress.dddProgress).padStart(3)}%${c.reset} ${c.dim}│${c.reset} ` +
|
|
552
|
-
`${c.cyan}Security${c.reset} ${securityColor}●${security.status}${c.reset} ${c.dim}│${c.reset} ` +
|
|
553
|
-
`${c.cyan}Memory${c.reset} ${c.brightGreen}●AgentDB${c.reset} ${c.dim}│${c.reset} ` +
|
|
554
|
-
`${c.cyan}Integration${c.reset} ${swarm.coordinationActive ? c.brightCyan : c.dim}●${c.reset}`
|
|
555
|
-
);
|
|
556
|
-
|
|
557
|
-
return lines.join('\n');
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
// Main
|
|
561
|
-
if (process.argv.includes('--json')) {
|
|
562
|
-
console.log(JSON.stringify(generateJSON(), null, 2));
|
|
563
|
-
} else if (process.argv.includes('--compact')) {
|
|
564
|
-
console.log(JSON.stringify(generateJSON()));
|
|
565
|
-
} else if (process.argv.includes('--single')) {
|
|
566
|
-
// Single-line mode - completely avoids collision zone
|
|
567
|
-
console.log(generateSingleLine());
|
|
568
|
-
} else if (process.argv.includes('--unsafe') || process.argv.includes('--legacy')) {
|
|
569
|
-
// Legacy mode - original multi-line without collision avoidance
|
|
570
|
-
console.log(generateStatusline());
|
|
571
|
-
} else {
|
|
572
|
-
// Default: Safe multi-line mode with collision zone avoidance
|
|
573
|
-
// Use --unsafe or --legacy to get the original behavior
|
|
574
|
-
console.log(generateSafeStatusline());
|
|
575
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* RuFlo V3.5 Statusline Generator
|
|
4
|
+
* Displays real-time V3 implementation progress and system status
|
|
5
|
+
*
|
|
6
|
+
* Usage: node statusline.cjs [options]
|
|
7
|
+
*
|
|
8
|
+
* Options:
|
|
9
|
+
* (default) Safe multi-line output with collision zone avoidance
|
|
10
|
+
* --single Single-line output (completely avoids collision)
|
|
11
|
+
* --unsafe Legacy multi-line without collision avoidance
|
|
12
|
+
* --legacy Alias for --unsafe
|
|
13
|
+
* --json JSON output with pretty printing
|
|
14
|
+
* --compact JSON output without formatting
|
|
15
|
+
*
|
|
16
|
+
* Collision Zone Fix (Issue #985):
|
|
17
|
+
* Claude Code writes its internal status (e.g., "7s • 1p") at absolute
|
|
18
|
+
* terminal coordinates (columns 15-25 on second-to-last line). The safe
|
|
19
|
+
* mode pads the collision line with spaces to push content past column 25.
|
|
20
|
+
*
|
|
21
|
+
* IMPORTANT: This file uses .cjs extension to work in ES module projects.
|
|
22
|
+
* The require() syntax is intentional for CommonJS compatibility.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
26
|
+
const fs = require('fs');
|
|
27
|
+
const path = require('path');
|
|
28
|
+
const { execSync, execFileSync } = require('child_process');
|
|
29
|
+
|
|
30
|
+
// Configuration
|
|
31
|
+
const CONFIG = {
|
|
32
|
+
enabled: true,
|
|
33
|
+
showProgress: true,
|
|
34
|
+
showSecurity: true,
|
|
35
|
+
showSwarm: true,
|
|
36
|
+
showHooks: true,
|
|
37
|
+
showPerformance: true,
|
|
38
|
+
refreshInterval: 5000,
|
|
39
|
+
maxAgents: 15,
|
|
40
|
+
topology: 'hierarchical-mesh',
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Cross-platform helpers
|
|
44
|
+
const isWindows = process.platform === 'win32';
|
|
45
|
+
const nullDevice = isWindows ? 'NUL' : '/dev/null';
|
|
46
|
+
|
|
47
|
+
// ANSI colors
|
|
48
|
+
const c = {
|
|
49
|
+
reset: '\x1b[0m',
|
|
50
|
+
bold: '\x1b[1m',
|
|
51
|
+
dim: '\x1b[2m',
|
|
52
|
+
red: '\x1b[0;31m',
|
|
53
|
+
green: '\x1b[0;32m',
|
|
54
|
+
yellow: '\x1b[0;33m',
|
|
55
|
+
blue: '\x1b[0;34m',
|
|
56
|
+
purple: '\x1b[0;35m',
|
|
57
|
+
cyan: '\x1b[0;36m',
|
|
58
|
+
brightRed: '\x1b[1;31m',
|
|
59
|
+
brightGreen: '\x1b[1;32m',
|
|
60
|
+
brightYellow: '\x1b[1;33m',
|
|
61
|
+
brightBlue: '\x1b[1;34m',
|
|
62
|
+
brightPurple: '\x1b[1;35m',
|
|
63
|
+
brightCyan: '\x1b[1;36m',
|
|
64
|
+
brightWhite: '\x1b[1;37m',
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// Get user info
|
|
68
|
+
function getUserInfo() {
|
|
69
|
+
let name = 'user';
|
|
70
|
+
let gitBranch = '';
|
|
71
|
+
let modelName = 'Unknown';
|
|
72
|
+
|
|
73
|
+
// audit_1776853149979: previously used execSync with a shell string. Switched
|
|
74
|
+
// to execFileSync('git', argv) on both platforms so there is no shell
|
|
75
|
+
// interpretation. Cross-platform behavior is preserved by relying on git's
|
|
76
|
+
// own exit code instead of `|| echo` fallbacks: missing repo / no user.name
|
|
77
|
+
// throws, caught below, defaults retained.
|
|
78
|
+
try {
|
|
79
|
+
name = execFileSync('git', ['config', 'user.name'], { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || 'user';
|
|
80
|
+
} catch { /* keep default */ }
|
|
81
|
+
try {
|
|
82
|
+
gitBranch = execFileSync('git', ['branch', '--show-current'], { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
83
|
+
} catch { /* keep empty */ }
|
|
84
|
+
|
|
85
|
+
// Auto-detect model from Claude Code's config
|
|
86
|
+
try {
|
|
87
|
+
const homedir = require('os').homedir();
|
|
88
|
+
const claudeConfigPath = path.join(homedir, '.claude.json');
|
|
89
|
+
if (fs.existsSync(claudeConfigPath)) {
|
|
90
|
+
const claudeConfig = JSON.parse(fs.readFileSync(claudeConfigPath, 'utf-8'));
|
|
91
|
+
// Try to find lastModelUsage - check current dir and parent dirs
|
|
92
|
+
let lastModelUsage = null;
|
|
93
|
+
const cwd = process.cwd();
|
|
94
|
+
if (claudeConfig.projects) {
|
|
95
|
+
// Try exact match first, then check if cwd starts with any project path
|
|
96
|
+
for (const [projectPath, projectConfig] of Object.entries(claudeConfig.projects)) {
|
|
97
|
+
if (cwd === projectPath || cwd.startsWith(projectPath + '/')) {
|
|
98
|
+
lastModelUsage = projectConfig.lastModelUsage;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (lastModelUsage) {
|
|
104
|
+
const modelIds = Object.keys(lastModelUsage);
|
|
105
|
+
if (modelIds.length > 0) {
|
|
106
|
+
// Take the last model (most recently added to the object)
|
|
107
|
+
// Or find the one with most tokens (most actively used this session)
|
|
108
|
+
let modelId = modelIds[modelIds.length - 1];
|
|
109
|
+
if (modelIds.length > 1) {
|
|
110
|
+
// If multiple models, pick the one with most total tokens
|
|
111
|
+
let maxTokens = 0;
|
|
112
|
+
for (const id of modelIds) {
|
|
113
|
+
const usage = lastModelUsage[id];
|
|
114
|
+
const total = (usage.inputTokens || 0) + (usage.outputTokens || 0);
|
|
115
|
+
if (total > maxTokens) {
|
|
116
|
+
maxTokens = total;
|
|
117
|
+
modelId = id;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// Parse model ID to human-readable name
|
|
122
|
+
if (modelId.includes('opus')) modelName = 'Opus 4.6 (1M context)';
|
|
123
|
+
else if (modelId.includes('sonnet')) modelName = 'Sonnet 4.6';
|
|
124
|
+
else if (modelId.includes('haiku')) modelName = 'Haiku 4.5';
|
|
125
|
+
else modelName = modelId.split('-').slice(1, 3).join(' ');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
} catch (e) {
|
|
130
|
+
// Fallback to Unknown if can't read config
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return { name, gitBranch, modelName };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Get learning stats from intelligence loop data (ADR-050)
|
|
137
|
+
function getLearningStats() {
|
|
138
|
+
let patterns = 0;
|
|
139
|
+
let sessions = 0;
|
|
140
|
+
let trajectories = 0;
|
|
141
|
+
let edges = 0;
|
|
142
|
+
let confidenceMean = 0;
|
|
143
|
+
let accessedCount = 0;
|
|
144
|
+
let trend = 'STABLE';
|
|
145
|
+
|
|
146
|
+
// PRIMARY: Read from intelligence loop data files
|
|
147
|
+
const dataDir = path.join(process.cwd(), '.claude-flow', 'data');
|
|
148
|
+
|
|
149
|
+
// 1. graph-state.json — authoritative node/edge counts
|
|
150
|
+
const graphPath = path.join(dataDir, 'graph-state.json');
|
|
151
|
+
if (fs.existsSync(graphPath)) {
|
|
152
|
+
try {
|
|
153
|
+
const graph = JSON.parse(fs.readFileSync(graphPath, 'utf-8'));
|
|
154
|
+
patterns = graph.nodes ? Object.keys(graph.nodes).length : 0;
|
|
155
|
+
edges = Array.isArray(graph.edges) ? graph.edges.length : 0;
|
|
156
|
+
} catch (e) { /* ignore */ }
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// 2. ranked-context.json — confidence and access data
|
|
160
|
+
const rankedPath = path.join(dataDir, 'ranked-context.json');
|
|
161
|
+
if (fs.existsSync(rankedPath)) {
|
|
162
|
+
try {
|
|
163
|
+
const ranked = JSON.parse(fs.readFileSync(rankedPath, 'utf-8'));
|
|
164
|
+
if (ranked.entries && ranked.entries.length > 0) {
|
|
165
|
+
patterns = Math.max(patterns, ranked.entries.length);
|
|
166
|
+
let confSum = 0;
|
|
167
|
+
let accCount = 0;
|
|
168
|
+
for (let i = 0; i < ranked.entries.length; i++) {
|
|
169
|
+
confSum += (ranked.entries[i].confidence || 0);
|
|
170
|
+
if ((ranked.entries[i].accessCount || 0) > 0) accCount++;
|
|
171
|
+
}
|
|
172
|
+
confidenceMean = confSum / ranked.entries.length;
|
|
173
|
+
accessedCount = accCount;
|
|
174
|
+
}
|
|
175
|
+
} catch (e) { /* ignore */ }
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// 3. intelligence-snapshot.json — trend history
|
|
179
|
+
const snapshotPath = path.join(dataDir, 'intelligence-snapshot.json');
|
|
180
|
+
if (fs.existsSync(snapshotPath)) {
|
|
181
|
+
try {
|
|
182
|
+
const snapshot = JSON.parse(fs.readFileSync(snapshotPath, 'utf-8'));
|
|
183
|
+
if (snapshot.history && snapshot.history.length >= 2) {
|
|
184
|
+
const first = snapshot.history[0];
|
|
185
|
+
const last = snapshot.history[snapshot.history.length - 1];
|
|
186
|
+
const confDrift = (last.confidenceMean || 0) - (first.confidenceMean || 0);
|
|
187
|
+
trend = confDrift > 0.01 ? 'IMPROVING' : confDrift < -0.01 ? 'DECLINING' : 'STABLE';
|
|
188
|
+
sessions = Math.max(sessions, snapshot.history.length);
|
|
189
|
+
}
|
|
190
|
+
} catch (e) { /* ignore */ }
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// 4. auto-memory-store.json — fallback entry count
|
|
194
|
+
if (patterns === 0) {
|
|
195
|
+
const autoMemPath = path.join(dataDir, 'auto-memory-store.json');
|
|
196
|
+
if (fs.existsSync(autoMemPath)) {
|
|
197
|
+
try {
|
|
198
|
+
const data = JSON.parse(fs.readFileSync(autoMemPath, 'utf-8'));
|
|
199
|
+
patterns = Array.isArray(data) ? data.length : (data.entries ? data.entries.length : 0);
|
|
200
|
+
} catch (e) { /* ignore */ }
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// FALLBACK: Legacy memory.db file-size estimation
|
|
205
|
+
if (patterns === 0) {
|
|
206
|
+
const memoryPaths = [
|
|
207
|
+
path.join(process.cwd(), '.swarm', 'memory.db'),
|
|
208
|
+
path.join(process.cwd(), '.claude', 'memory.db'),
|
|
209
|
+
path.join(process.cwd(), 'data', 'memory.db'),
|
|
210
|
+
];
|
|
211
|
+
for (let j = 0; j < memoryPaths.length; j++) {
|
|
212
|
+
if (fs.existsSync(memoryPaths[j])) {
|
|
213
|
+
try {
|
|
214
|
+
const dbStats = fs.statSync(memoryPaths[j]);
|
|
215
|
+
patterns = Math.floor(dbStats.size / 1024 / 2);
|
|
216
|
+
break;
|
|
217
|
+
} catch (e) { /* ignore */ }
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Session count from session files
|
|
223
|
+
const sessionsPath = path.join(process.cwd(), '.claude', 'sessions');
|
|
224
|
+
if (fs.existsSync(sessionsPath)) {
|
|
225
|
+
try {
|
|
226
|
+
const sessionFiles = fs.readdirSync(sessionsPath).filter(f => f.endsWith('.json'));
|
|
227
|
+
sessions = Math.max(sessions, sessionFiles.length);
|
|
228
|
+
} catch (e) { /* ignore */ }
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
trajectories = Math.floor(patterns / 5);
|
|
232
|
+
|
|
233
|
+
return { patterns, sessions, trajectories, edges, confidenceMean, accessedCount, trend };
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Get V3 progress from learning state (grows as system learns)
|
|
237
|
+
function getV3Progress() {
|
|
238
|
+
const learning = getLearningStats();
|
|
239
|
+
|
|
240
|
+
// DDD progress based on actual learned patterns
|
|
241
|
+
// New install: 0 patterns = 0/5 domains, 0% DDD
|
|
242
|
+
// As patterns grow: 10+ patterns = 1 domain, 50+ = 2, 100+ = 3, 200+ = 4, 500+ = 5
|
|
243
|
+
let domainsCompleted = 0;
|
|
244
|
+
if (learning.patterns >= 500) domainsCompleted = 5;
|
|
245
|
+
else if (learning.patterns >= 200) domainsCompleted = 4;
|
|
246
|
+
else if (learning.patterns >= 100) domainsCompleted = 3;
|
|
247
|
+
else if (learning.patterns >= 50) domainsCompleted = 2;
|
|
248
|
+
else if (learning.patterns >= 10) domainsCompleted = 1;
|
|
249
|
+
|
|
250
|
+
const totalDomains = 5;
|
|
251
|
+
const dddProgress = Math.min(100, Math.floor((domainsCompleted / totalDomains) * 100));
|
|
252
|
+
|
|
253
|
+
return {
|
|
254
|
+
domainsCompleted,
|
|
255
|
+
totalDomains,
|
|
256
|
+
dddProgress,
|
|
257
|
+
patternsLearned: learning.patterns,
|
|
258
|
+
sessionsCompleted: learning.sessions
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// Get security status based on actual scans
|
|
263
|
+
function getSecurityStatus() {
|
|
264
|
+
// Check for security scan results in memory
|
|
265
|
+
const scanResultsPath = path.join(process.cwd(), '.claude', 'security-scans');
|
|
266
|
+
let cvesFixed = 0;
|
|
267
|
+
const totalCves = 3;
|
|
268
|
+
|
|
269
|
+
if (fs.existsSync(scanResultsPath)) {
|
|
270
|
+
try {
|
|
271
|
+
const scans = fs.readdirSync(scanResultsPath).filter(f => f.endsWith('.json'));
|
|
272
|
+
// Each successful scan file = 1 CVE addressed
|
|
273
|
+
cvesFixed = Math.min(totalCves, scans.length);
|
|
274
|
+
} catch (e) {
|
|
275
|
+
// Ignore
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Also check .swarm/security for audit results
|
|
280
|
+
const auditPath = path.join(process.cwd(), '.swarm', 'security');
|
|
281
|
+
if (fs.existsSync(auditPath)) {
|
|
282
|
+
try {
|
|
283
|
+
const audits = fs.readdirSync(auditPath).filter(f => f.includes('audit'));
|
|
284
|
+
cvesFixed = Math.min(totalCves, Math.max(cvesFixed, audits.length));
|
|
285
|
+
} catch (e) {
|
|
286
|
+
// Ignore
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const status = cvesFixed >= totalCves ? 'CLEAN' : cvesFixed > 0 ? 'IN_PROGRESS' : 'PENDING';
|
|
291
|
+
|
|
292
|
+
return {
|
|
293
|
+
status,
|
|
294
|
+
cvesFixed,
|
|
295
|
+
totalCves,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Get swarm status
|
|
300
|
+
function getSwarmStatus() {
|
|
301
|
+
let activeAgents = 0;
|
|
302
|
+
let coordinationActive = false;
|
|
303
|
+
|
|
304
|
+
try {
|
|
305
|
+
if (isWindows) {
|
|
306
|
+
// Windows: use tasklist and findstr
|
|
307
|
+
const ps = execSync('tasklist 2>NUL | findstr /I "agentic-flow" 2>NUL | find /C /V "" 2>NUL || echo 0', { encoding: 'utf-8' });
|
|
308
|
+
activeAgents = Math.max(0, parseInt(ps.trim()) || 0);
|
|
309
|
+
} else {
|
|
310
|
+
const ps = execSync('ps aux 2>/dev/null | grep -c agentic-flow || echo "0"', { encoding: 'utf-8' });
|
|
311
|
+
activeAgents = Math.max(0, parseInt(ps.trim()) - 1);
|
|
312
|
+
}
|
|
313
|
+
coordinationActive = activeAgents > 0;
|
|
314
|
+
} catch (e) {
|
|
315
|
+
// Ignore errors - default to 0 agents
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return {
|
|
319
|
+
activeAgents,
|
|
320
|
+
maxAgents: CONFIG.maxAgents,
|
|
321
|
+
coordinationActive,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// Get system metrics (dynamic based on actual state)
|
|
326
|
+
function getSystemMetrics() {
|
|
327
|
+
let memoryMB = 0;
|
|
328
|
+
let subAgents = 0;
|
|
329
|
+
|
|
330
|
+
try {
|
|
331
|
+
if (isWindows) {
|
|
332
|
+
// Windows: use tasklist for memory info, fallback to process.memoryUsage
|
|
333
|
+
// tasklist memory column is complex to parse, use Node.js API instead
|
|
334
|
+
memoryMB = Math.floor(process.memoryUsage().heapUsed / 1024 / 1024);
|
|
335
|
+
} else {
|
|
336
|
+
const mem = execSync('ps aux | grep -E "(node|agentic|claude)" | grep -v grep | awk \'{sum += $6} END {print int(sum/1024)}\'', { encoding: 'utf-8' });
|
|
337
|
+
memoryMB = parseInt(mem.trim()) || 0;
|
|
338
|
+
}
|
|
339
|
+
} catch (e) {
|
|
340
|
+
// Fallback
|
|
341
|
+
memoryMB = Math.floor(process.memoryUsage().heapUsed / 1024 / 1024);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// Get learning stats for intelligence %
|
|
345
|
+
const learning = getLearningStats();
|
|
346
|
+
|
|
347
|
+
// Intelligence % from REAL intelligence loop data (ADR-050)
|
|
348
|
+
// Composite: 40% confidence mean + 30% access ratio + 30% pattern density
|
|
349
|
+
let intelligencePct = 0;
|
|
350
|
+
if (learning.confidenceMean > 0 || (learning.patterns > 0 && learning.accessedCount > 0)) {
|
|
351
|
+
const confScore = Math.min(100, Math.floor(learning.confidenceMean * 100));
|
|
352
|
+
const accessRatio = learning.patterns > 0 ? (learning.accessedCount / learning.patterns) : 0;
|
|
353
|
+
const accessScore = Math.min(100, Math.floor(accessRatio * 100));
|
|
354
|
+
const densityScore = Math.min(100, Math.floor(learning.patterns / 5));
|
|
355
|
+
intelligencePct = Math.floor(confScore * 0.4 + accessScore * 0.3 + densityScore * 0.3);
|
|
356
|
+
}
|
|
357
|
+
// Fallback: legacy pattern count
|
|
358
|
+
if (intelligencePct === 0 && learning.patterns > 0) {
|
|
359
|
+
intelligencePct = Math.min(100, Math.floor(learning.patterns / 10));
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// Context % based on session history
|
|
363
|
+
const contextPct = Math.min(100, Math.floor(learning.sessions * 5));
|
|
364
|
+
|
|
365
|
+
// Count active sub-agents from process list
|
|
366
|
+
try {
|
|
367
|
+
if (isWindows) {
|
|
368
|
+
// Windows: use tasklist and findstr for agent counting
|
|
369
|
+
const agents = execSync('tasklist 2>NUL | findstr /I "claude-flow" 2>NUL | find /C /V "" 2>NUL || echo 0', { encoding: 'utf-8' });
|
|
370
|
+
subAgents = Math.max(0, parseInt(agents.trim()) || 0);
|
|
371
|
+
} else {
|
|
372
|
+
const agents = execSync('ps aux 2>/dev/null | grep -c "claude-flow.*agent" || echo "0"', { encoding: 'utf-8' });
|
|
373
|
+
subAgents = Math.max(0, parseInt(agents.trim()) - 1);
|
|
374
|
+
}
|
|
375
|
+
} catch (e) {
|
|
376
|
+
// Ignore - default to 0
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return {
|
|
380
|
+
memoryMB,
|
|
381
|
+
contextPct,
|
|
382
|
+
intelligencePct,
|
|
383
|
+
subAgents,
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// Generate progress bar
|
|
388
|
+
function progressBar(current, total) {
|
|
389
|
+
const width = 5;
|
|
390
|
+
const filled = Math.round((current / total) * width);
|
|
391
|
+
const empty = width - filled;
|
|
392
|
+
return '[' + '\u25CF'.repeat(filled) + '\u25CB'.repeat(empty) + ']';
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// Generate full statusline
|
|
396
|
+
function generateStatusline() {
|
|
397
|
+
const user = getUserInfo();
|
|
398
|
+
const progress = getV3Progress();
|
|
399
|
+
const security = getSecurityStatus();
|
|
400
|
+
const swarm = getSwarmStatus();
|
|
401
|
+
const system = getSystemMetrics();
|
|
402
|
+
const lines = [];
|
|
403
|
+
|
|
404
|
+
// Header Line
|
|
405
|
+
let header = `${c.bold}${c.brightPurple}▊ RuFlo V3.5 ${c.reset}`;
|
|
406
|
+
header += `${swarm.coordinationActive ? c.brightCyan : c.dim}● ${c.brightCyan}${user.name}${c.reset}`;
|
|
407
|
+
if (user.gitBranch) {
|
|
408
|
+
header += ` ${c.dim}│${c.reset} ${c.brightBlue}⎇ ${user.gitBranch}${c.reset}`;
|
|
409
|
+
}
|
|
410
|
+
header += ` ${c.dim}│${c.reset} ${c.purple}${user.modelName}${c.reset}`;
|
|
411
|
+
lines.push(header);
|
|
412
|
+
|
|
413
|
+
// Separator
|
|
414
|
+
lines.push(`${c.dim}─────────────────────────────────────────────────────${c.reset}`);
|
|
415
|
+
|
|
416
|
+
// Line 1: DDD Domain Progress
|
|
417
|
+
const domainsColor = progress.domainsCompleted >= 3 ? c.brightGreen : progress.domainsCompleted > 0 ? c.yellow : c.red;
|
|
418
|
+
lines.push(
|
|
419
|
+
`${c.brightCyan}🏗️ DDD Domains${c.reset} ${progressBar(progress.domainsCompleted, progress.totalDomains)} ` +
|
|
420
|
+
`${domainsColor}${progress.domainsCompleted}${c.reset}/${c.brightWhite}${progress.totalDomains}${c.reset} ` +
|
|
421
|
+
`${c.brightYellow}⚡ 1.0x${c.reset} ${c.dim}→${c.reset} ${c.brightYellow}2.49x-7.47x${c.reset}`
|
|
422
|
+
);
|
|
423
|
+
|
|
424
|
+
// Line 2: Swarm + CVE + Memory + Context + Intelligence
|
|
425
|
+
const swarmIndicator = swarm.coordinationActive ? `${c.brightGreen}◉${c.reset}` : `${c.dim}○${c.reset}`;
|
|
426
|
+
const agentsColor = swarm.activeAgents > 0 ? c.brightGreen : c.red;
|
|
427
|
+
let securityIcon = security.status === 'CLEAN' ? '🟢' : security.status === 'IN_PROGRESS' ? '🟡' : '🔴';
|
|
428
|
+
let securityColor = security.status === 'CLEAN' ? c.brightGreen : security.status === 'IN_PROGRESS' ? c.brightYellow : c.brightRed;
|
|
429
|
+
|
|
430
|
+
lines.push(
|
|
431
|
+
`${c.brightYellow}🤖 Swarm${c.reset} ${swarmIndicator} [${agentsColor}${String(swarm.activeAgents).padStart(2)}${c.reset}/${c.brightWhite}${swarm.maxAgents}${c.reset}] ` +
|
|
432
|
+
`${c.brightPurple}👥 ${system.subAgents}${c.reset} ` +
|
|
433
|
+
`${securityIcon} ${securityColor}CVE ${security.cvesFixed}${c.reset}/${c.brightWhite}${security.totalCves}${c.reset} ` +
|
|
434
|
+
`${c.brightCyan}💾 ${system.memoryMB}MB${c.reset} ` +
|
|
435
|
+
`${c.brightGreen}📂 ${String(system.contextPct).padStart(3)}%${c.reset} ` +
|
|
436
|
+
`${c.dim}🧠 ${String(system.intelligencePct).padStart(3)}%${c.reset}`
|
|
437
|
+
);
|
|
438
|
+
|
|
439
|
+
// Line 3: Architecture status
|
|
440
|
+
const dddColor = progress.dddProgress >= 50 ? c.brightGreen : progress.dddProgress > 0 ? c.yellow : c.red;
|
|
441
|
+
lines.push(
|
|
442
|
+
`${c.brightPurple}🔧 Architecture${c.reset} ` +
|
|
443
|
+
`${c.cyan}DDD${c.reset} ${dddColor}●${String(progress.dddProgress).padStart(3)}%${c.reset} ${c.dim}│${c.reset} ` +
|
|
444
|
+
`${c.cyan}Security${c.reset} ${securityColor}●${security.status}${c.reset} ${c.dim}│${c.reset} ` +
|
|
445
|
+
`${c.cyan}Memory${c.reset} ${c.brightGreen}●AgentDB${c.reset} ${c.dim}│${c.reset} ` +
|
|
446
|
+
`${c.cyan}Integration${c.reset} ${swarm.coordinationActive ? c.brightCyan : c.dim}●${c.reset}`
|
|
447
|
+
);
|
|
448
|
+
|
|
449
|
+
return lines.join('\n');
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// Generate JSON data
|
|
453
|
+
function generateJSON() {
|
|
454
|
+
return {
|
|
455
|
+
user: getUserInfo(),
|
|
456
|
+
v3Progress: getV3Progress(),
|
|
457
|
+
security: getSecurityStatus(),
|
|
458
|
+
swarm: getSwarmStatus(),
|
|
459
|
+
system: getSystemMetrics(),
|
|
460
|
+
performance: {
|
|
461
|
+
flashAttentionTarget: '2.49x-7.47x',
|
|
462
|
+
searchImprovement: '150x-12,500x',
|
|
463
|
+
memoryReduction: '50-75%',
|
|
464
|
+
},
|
|
465
|
+
lastUpdated: new Date().toISOString(),
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Generate single-line output for Claude Code compatibility
|
|
471
|
+
* This avoids the collision zone issue entirely by using one line
|
|
472
|
+
* @see https://github.com/ruvnet/claude-flow/issues/985
|
|
473
|
+
*/
|
|
474
|
+
function generateSingleLine() {
|
|
475
|
+
if (!CONFIG.enabled) return '';
|
|
476
|
+
|
|
477
|
+
const user = getUserInfo();
|
|
478
|
+
const progress = getV3Progress();
|
|
479
|
+
const security = getSecurityStatus();
|
|
480
|
+
const swarm = getSwarmStatus();
|
|
481
|
+
const system = getSystemMetrics();
|
|
482
|
+
|
|
483
|
+
const swarmIndicator = swarm.coordinationActive ? '●' : '○';
|
|
484
|
+
const securityStatus = security.status === 'CLEAN' ? '✓' :
|
|
485
|
+
security.cvesFixed > 0 ? '~' : '✗';
|
|
486
|
+
|
|
487
|
+
return `${c.brightPurple}RuFlo${c.reset} ${c.dim}|${c.reset} ` +
|
|
488
|
+
`${c.cyan}D:${progress.domainsCompleted}/${progress.totalDomains}${c.reset} ${c.dim}|${c.reset} ` +
|
|
489
|
+
`${c.yellow}S:${swarmIndicator}${swarm.activeAgents}/${swarm.maxAgents}${c.reset} ${c.dim}|${c.reset} ` +
|
|
490
|
+
`${security.status === 'CLEAN' ? c.green : c.red}CVE:${securityStatus}${security.cvesFixed}/${security.totalCves}${c.reset} ${c.dim}|${c.reset} ` +
|
|
491
|
+
`${c.dim}🧠${system.intelligencePct}%${c.reset}`;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Generate safe multi-line statusline that avoids Claude Code collision zone
|
|
496
|
+
* The collision zone is columns 15-25 on the second-to-last line.
|
|
497
|
+
* We pad that line with spaces to push content past column 25.
|
|
498
|
+
* @see https://github.com/ruvnet/claude-flow/issues/985
|
|
499
|
+
*/
|
|
500
|
+
function generateSafeStatusline() {
|
|
501
|
+
if (!CONFIG.enabled) return '';
|
|
502
|
+
|
|
503
|
+
const user = getUserInfo();
|
|
504
|
+
const progress = getV3Progress();
|
|
505
|
+
const security = getSecurityStatus();
|
|
506
|
+
const swarm = getSwarmStatus();
|
|
507
|
+
const system = getSystemMetrics();
|
|
508
|
+
const lines = [];
|
|
509
|
+
|
|
510
|
+
// Header Line
|
|
511
|
+
let header = `${c.bold}${c.brightPurple}▊ RuFlo V3.5 ${c.reset}`;
|
|
512
|
+
header += `${swarm.coordinationActive ? c.brightCyan : c.dim}● ${c.brightCyan}${user.name}${c.reset}`;
|
|
513
|
+
if (user.gitBranch) {
|
|
514
|
+
header += ` ${c.dim}│${c.reset} ${c.brightBlue}⎇ ${user.gitBranch}${c.reset}`;
|
|
515
|
+
}
|
|
516
|
+
header += ` ${c.dim}│${c.reset} ${c.purple}${user.modelName}${c.reset}`;
|
|
517
|
+
lines.push(header);
|
|
518
|
+
|
|
519
|
+
// Separator
|
|
520
|
+
lines.push(`${c.dim}─────────────────────────────────────────────────────${c.reset}`);
|
|
521
|
+
|
|
522
|
+
// Line 1: DDD Domain Progress
|
|
523
|
+
const domainsColor = progress.domainsCompleted >= 3 ? c.brightGreen : progress.domainsCompleted > 0 ? c.yellow : c.red;
|
|
524
|
+
lines.push(
|
|
525
|
+
`${c.brightCyan}🏗️ DDD Domains${c.reset} ${progressBar(progress.domainsCompleted, progress.totalDomains)} ` +
|
|
526
|
+
`${domainsColor}${progress.domainsCompleted}${c.reset}/${c.brightWhite}${progress.totalDomains}${c.reset} ` +
|
|
527
|
+
`${c.brightYellow}⚡ 1.0x${c.reset} ${c.dim}→${c.reset} ${c.brightYellow}2.49x-7.47x${c.reset}`
|
|
528
|
+
);
|
|
529
|
+
|
|
530
|
+
// Line 2 (COLLISION LINE): Swarm status with padding after label
|
|
531
|
+
// The emoji+label is ~10 columns. Padding pushes content past collision zone (cols 15-25)
|
|
532
|
+
const swarmIndicator = swarm.coordinationActive ? `${c.brightGreen}◉${c.reset}` : `${c.dim}○${c.reset}`;
|
|
533
|
+
const agentsColor = swarm.activeAgents > 0 ? c.brightGreen : c.red;
|
|
534
|
+
let securityIcon = security.status === 'CLEAN' ? '🟢' : security.status === 'IN_PROGRESS' ? '🟡' : '🔴';
|
|
535
|
+
let securityColor = security.status === 'CLEAN' ? c.brightGreen : security.status === 'IN_PROGRESS' ? c.brightYellow : c.brightRed;
|
|
536
|
+
|
|
537
|
+
// Padding after "🤖 Swarm" (emoji 2 cols + " Swarm" 6 cols = 8, pad 18 to reach col 26)
|
|
538
|
+
lines.push(
|
|
539
|
+
`${c.brightYellow}🤖 Swarm${c.reset} ` + // 18 spaces padding
|
|
540
|
+
`${swarmIndicator} [${agentsColor}${String(swarm.activeAgents).padStart(2)}${c.reset}/${c.brightWhite}${swarm.maxAgents}${c.reset}] ` +
|
|
541
|
+
`${c.brightPurple}👥 ${system.subAgents}${c.reset} ` +
|
|
542
|
+
`${securityIcon} ${securityColor}CVE ${security.cvesFixed}${c.reset}/${c.brightWhite}${security.totalCves}${c.reset} ` +
|
|
543
|
+
`${c.brightCyan}💾 ${system.memoryMB}MB${c.reset} ` +
|
|
544
|
+
`${c.dim}🧠 ${system.intelligencePct}%${c.reset}`
|
|
545
|
+
);
|
|
546
|
+
|
|
547
|
+
// Line 3: Architecture status (this is the last line, not in collision zone)
|
|
548
|
+
const dddColor = progress.dddProgress >= 50 ? c.brightGreen : progress.dddProgress > 0 ? c.yellow : c.red;
|
|
549
|
+
lines.push(
|
|
550
|
+
`${c.brightPurple}🔧 Architecture${c.reset} ` +
|
|
551
|
+
`${c.cyan}DDD${c.reset} ${dddColor}●${String(progress.dddProgress).padStart(3)}%${c.reset} ${c.dim}│${c.reset} ` +
|
|
552
|
+
`${c.cyan}Security${c.reset} ${securityColor}●${security.status}${c.reset} ${c.dim}│${c.reset} ` +
|
|
553
|
+
`${c.cyan}Memory${c.reset} ${c.brightGreen}●AgentDB${c.reset} ${c.dim}│${c.reset} ` +
|
|
554
|
+
`${c.cyan}Integration${c.reset} ${swarm.coordinationActive ? c.brightCyan : c.dim}●${c.reset}`
|
|
555
|
+
);
|
|
556
|
+
|
|
557
|
+
return lines.join('\n');
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// Main
|
|
561
|
+
if (process.argv.includes('--json')) {
|
|
562
|
+
console.log(JSON.stringify(generateJSON(), null, 2));
|
|
563
|
+
} else if (process.argv.includes('--compact')) {
|
|
564
|
+
console.log(JSON.stringify(generateJSON()));
|
|
565
|
+
} else if (process.argv.includes('--single')) {
|
|
566
|
+
// Single-line mode - completely avoids collision zone
|
|
567
|
+
console.log(generateSingleLine());
|
|
568
|
+
} else if (process.argv.includes('--unsafe') || process.argv.includes('--legacy')) {
|
|
569
|
+
// Legacy mode - original multi-line without collision avoidance
|
|
570
|
+
console.log(generateStatusline());
|
|
571
|
+
} else {
|
|
572
|
+
// Default: Safe multi-line mode with collision zone avoidance
|
|
573
|
+
// Use --unsafe or --legacy to get the original behavior
|
|
574
|
+
console.log(generateSafeStatusline());
|
|
575
|
+
}
|