burhan-mop 0.1.0
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/.agents/AGENTS.md +54 -0
- package/.agents/skills/auto-deploy/SKILL.md +48 -0
- package/.agents/skills/autosycn/SKILL.md +75 -0
- package/.agents/skills/mop-help/SKILL.md +35 -0
- package/.agents/skills/ruflo-core/SKILL.md +35 -0
- package/.claude/agents/analysis/analyze-code-quality.md +179 -0
- package/.claude/agents/analysis/code-analyzer.md +210 -0
- package/.claude/agents/analysis/code-review/analyze-code-quality.md +179 -0
- package/.claude/agents/architecture/arch-system-design.md +157 -0
- package/.claude/agents/architecture/system-design/arch-system-design.md +155 -0
- package/.claude/agents/browser/browser-agent.yaml +182 -0
- package/.claude/agents/consensus/byzantine-coordinator.md +63 -0
- package/.claude/agents/consensus/crdt-synchronizer.md +997 -0
- package/.claude/agents/consensus/gossip-coordinator.md +63 -0
- package/.claude/agents/consensus/performance-benchmarker.md +851 -0
- package/.claude/agents/consensus/quorum-manager.md +823 -0
- package/.claude/agents/consensus/raft-manager.md +63 -0
- package/.claude/agents/consensus/security-manager.md +622 -0
- package/.claude/agents/core/planner.md +375 -0
- package/.claude/agents/custom/test-long-runner.md +44 -0
- package/.claude/agents/data/data-ml-model.md +445 -0
- package/.claude/agents/data/ml/data-ml-model.md +193 -0
- package/.claude/agents/development/backend/dev-backend-api.md +142 -0
- package/.claude/agents/development/dev-backend-api.md +345 -0
- package/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
- package/.claude/agents/devops/ops-cicd-github.md +165 -0
- package/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
- package/.claude/agents/documentation/docs-api-openapi.md +355 -0
- package/.claude/agents/flow-nexus/app-store.md +88 -0
- package/.claude/agents/flow-nexus/authentication.md +69 -0
- package/.claude/agents/flow-nexus/challenges.md +81 -0
- package/.claude/agents/flow-nexus/neural-network.md +88 -0
- package/.claude/agents/flow-nexus/payments.md +83 -0
- package/.claude/agents/flow-nexus/sandbox.md +76 -0
- package/.claude/agents/flow-nexus/swarm.md +76 -0
- package/.claude/agents/flow-nexus/user-tools.md +96 -0
- package/.claude/agents/flow-nexus/workflow.md +84 -0
- package/.claude/agents/github/code-review-swarm.md +377 -0
- package/.claude/agents/github/github-modes.md +173 -0
- package/.claude/agents/github/issue-tracker.md +576 -0
- package/.claude/agents/github/multi-repo-swarm.md +553 -0
- package/.claude/agents/github/pr-manager.md +438 -0
- package/.claude/agents/github/project-board-sync.md +509 -0
- package/.claude/agents/github/release-manager.md +605 -0
- package/.claude/agents/github/release-swarm.md +583 -0
- package/.claude/agents/github/repo-architect.md +398 -0
- package/.claude/agents/github/swarm-issue.md +573 -0
- package/.claude/agents/github/swarm-pr.md +428 -0
- package/.claude/agents/github/sync-coordinator.md +452 -0
- package/.claude/agents/github/workflow-automation.md +903 -0
- package/.claude/agents/goal/agent.md +816 -0
- package/.claude/agents/optimization/benchmark-suite.md +665 -0
- package/.claude/agents/optimization/load-balancer.md +431 -0
- package/.claude/agents/optimization/performance-monitor.md +672 -0
- package/.claude/agents/optimization/resource-allocator.md +674 -0
- package/.claude/agents/optimization/topology-optimizer.md +808 -0
- package/.claude/agents/payments/agentic-payments.md +126 -0
- package/.claude/agents/sona/sona-learning-optimizer.md +74 -0
- package/.claude/agents/sparc/architecture.md +699 -0
- package/.claude/agents/sparc/pseudocode.md +520 -0
- package/.claude/agents/sparc/refinement.md +802 -0
- package/.claude/agents/sparc/specification.md +478 -0
- package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +225 -0
- package/.claude/agents/specialized/spec-mobile-react-native.md +227 -0
- package/.claude/agents/sublinear/consensus-coordinator.md +338 -0
- package/.claude/agents/sublinear/matrix-optimizer.md +185 -0
- package/.claude/agents/sublinear/pagerank-analyzer.md +299 -0
- package/.claude/agents/sublinear/performance-optimizer.md +368 -0
- package/.claude/agents/sublinear/trading-predictor.md +246 -0
- package/.claude/agents/swarm/adaptive-coordinator.md +1127 -0
- package/.claude/agents/swarm/hierarchical-coordinator.md +710 -0
- package/.claude/agents/swarm/mesh-coordinator.md +963 -0
- package/.claude/agents/templates/automation-smart-agent.md +205 -0
- package/.claude/agents/templates/base-template-generator.md +289 -0
- package/.claude/agents/templates/coordinator-swarm-init.md +90 -0
- package/.claude/agents/templates/github-pr-manager.md +177 -0
- package/.claude/agents/templates/implementer-sparc-coder.md +259 -0
- package/.claude/agents/templates/memory-coordinator.md +187 -0
- package/.claude/agents/templates/orchestrator-task.md +139 -0
- package/.claude/agents/templates/performance-analyzer.md +199 -0
- package/.claude/agents/templates/sparc-coordinator.md +514 -0
- package/.claude/agents/testing/production-validator.md +395 -0
- package/.claude/agents/testing/tdd-london-swarm.md +244 -0
- package/.claude/agents/v3/aidefence-guardian.md +282 -0
- package/.claude/agents/v3/claims-authorizer.md +208 -0
- package/.claude/agents/v3/collective-intelligence-coordinator.md +993 -0
- package/.claude/agents/v3/ddd-domain-expert.md +220 -0
- package/.claude/agents/v3/injection-analyst.md +236 -0
- package/.claude/agents/v3/performance-engineer.md +1233 -0
- package/.claude/agents/v3/pii-detector.md +151 -0
- package/.claude/agents/v3/reasoningbank-learner.md +213 -0
- package/.claude/agents/v3/security-architect-aidefence.md +410 -0
- package/.claude/agents/v3/security-architect.md +867 -0
- package/.claude/agents/v3/swarm-memory-manager.md +157 -0
- package/.claude/agents/v3/v3-integration-architect.md +205 -0
- package/.claude/commands/agents/README.md +50 -0
- package/.claude/commands/agents/agent-capabilities.md +140 -0
- package/.claude/commands/agents/agent-coordination.md +28 -0
- package/.claude/commands/agents/agent-spawning.md +28 -0
- package/.claude/commands/agents/agent-types.md +216 -0
- package/.claude/commands/agents/health.md +139 -0
- package/.claude/commands/agents/list.md +100 -0
- package/.claude/commands/agents/logs.md +130 -0
- package/.claude/commands/agents/metrics.md +122 -0
- package/.claude/commands/agents/pool.md +127 -0
- package/.claude/commands/agents/spawn.md +140 -0
- package/.claude/commands/agents/status.md +115 -0
- package/.claude/commands/agents/stop.md +102 -0
- package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +54 -0
- package/.claude/commands/analysis/README.md +9 -0
- package/.claude/commands/analysis/bottleneck-detect.md +162 -0
- package/.claude/commands/analysis/performance-bottlenecks.md +59 -0
- package/.claude/commands/analysis/performance-report.md +25 -0
- package/.claude/commands/analysis/token-efficiency.md +45 -0
- package/.claude/commands/analysis/token-usage.md +25 -0
- package/.claude/commands/automation/README.md +9 -0
- package/.claude/commands/automation/auto-agent.md +122 -0
- package/.claude/commands/automation/self-healing.md +106 -0
- package/.claude/commands/automation/session-memory.md +90 -0
- package/.claude/commands/automation/smart-agents.md +73 -0
- package/.claude/commands/automation/smart-spawn.md +25 -0
- package/.claude/commands/automation/workflow-select.md +25 -0
- package/.claude/commands/claude-flow-help.md +103 -0
- package/.claude/commands/claude-flow-memory.md +107 -0
- package/.claude/commands/claude-flow-swarm.md +205 -0
- package/.claude/commands/coordination/README.md +9 -0
- package/.claude/commands/coordination/agent-spawn.md +25 -0
- package/.claude/commands/coordination/init.md +44 -0
- package/.claude/commands/coordination/orchestrate.md +43 -0
- package/.claude/commands/coordination/spawn.md +45 -0
- package/.claude/commands/coordination/swarm-init.md +85 -0
- package/.claude/commands/coordination/task-orchestrate.md +25 -0
- package/.claude/commands/github/README.md +11 -0
- package/.claude/commands/github/code-review-swarm.md +514 -0
- package/.claude/commands/github/code-review.md +25 -0
- package/.claude/commands/github/github-modes.md +147 -0
- package/.claude/commands/github/github-swarm.md +121 -0
- package/.claude/commands/github/issue-tracker.md +292 -0
- package/.claude/commands/github/issue-triage.md +25 -0
- package/.claude/commands/github/multi-repo-swarm.md +519 -0
- package/.claude/commands/github/pr-enhance.md +26 -0
- package/.claude/commands/github/pr-manager.md +170 -0
- package/.claude/commands/github/project-board-sync.md +471 -0
- package/.claude/commands/github/release-manager.md +340 -0
- package/.claude/commands/github/release-swarm.md +544 -0
- package/.claude/commands/github/repo-analyze.md +25 -0
- package/.claude/commands/github/repo-architect.md +367 -0
- package/.claude/commands/github/swarm-issue.md +485 -0
- package/.claude/commands/github/swarm-pr.md +288 -0
- package/.claude/commands/github/sync-coordinator.md +303 -0
- package/.claude/commands/github/workflow-automation.md +442 -0
- package/.claude/commands/hive-mind/README.md +17 -0
- package/.claude/commands/hive-mind/hive-mind-consensus.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-init.md +18 -0
- package/.claude/commands/hive-mind/hive-mind-memory.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-metrics.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-resume.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-sessions.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-spawn.md +21 -0
- package/.claude/commands/hive-mind/hive-mind-status.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-stop.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-wizard.md +8 -0
- package/.claude/commands/hive-mind/hive-mind.md +27 -0
- package/.claude/commands/hooks/README.md +11 -0
- package/.claude/commands/hooks/overview.md +58 -0
- package/.claude/commands/hooks/post-edit.md +117 -0
- package/.claude/commands/hooks/post-task.md +112 -0
- package/.claude/commands/hooks/pre-edit.md +113 -0
- package/.claude/commands/hooks/pre-task.md +111 -0
- package/.claude/commands/hooks/session-end.md +118 -0
- package/.claude/commands/hooks/setup.md +103 -0
- package/.claude/commands/memory/README.md +9 -0
- package/.claude/commands/memory/memory-persist.md +25 -0
- package/.claude/commands/memory/memory-search.md +25 -0
- package/.claude/commands/memory/memory-usage.md +25 -0
- package/.claude/commands/memory/neural.md +47 -0
- package/.claude/commands/monitoring/README.md +9 -0
- package/.claude/commands/monitoring/agent-metrics.md +25 -0
- package/.claude/commands/monitoring/agents.md +44 -0
- package/.claude/commands/monitoring/real-time-view.md +25 -0
- package/.claude/commands/monitoring/status.md +46 -0
- package/.claude/commands/monitoring/swarm-monitor.md +25 -0
- package/.claude/commands/optimization/README.md +9 -0
- package/.claude/commands/optimization/auto-topology.md +62 -0
- package/.claude/commands/optimization/cache-manage.md +25 -0
- package/.claude/commands/optimization/parallel-execute.md +25 -0
- package/.claude/commands/optimization/parallel-execution.md +50 -0
- package/.claude/commands/optimization/topology-optimize.md +25 -0
- package/.claude/commands/pair/README.md +261 -0
- package/.claude/commands/pair/commands.md +546 -0
- package/.claude/commands/pair/config.md +510 -0
- package/.claude/commands/pair/examples.md +512 -0
- package/.claude/commands/pair/modes.md +348 -0
- package/.claude/commands/pair/session.md +407 -0
- package/.claude/commands/pair/start.md +209 -0
- package/.claude/commands/sparc/analyzer.md +52 -0
- package/.claude/commands/sparc/architect.md +53 -0
- package/.claude/commands/sparc/ask.md +97 -0
- package/.claude/commands/sparc/batch-executor.md +54 -0
- package/.claude/commands/sparc/code.md +89 -0
- package/.claude/commands/sparc/coder.md +54 -0
- package/.claude/commands/sparc/debug.md +83 -0
- package/.claude/commands/sparc/debugger.md +54 -0
- package/.claude/commands/sparc/designer.md +53 -0
- package/.claude/commands/sparc/devops.md +109 -0
- package/.claude/commands/sparc/docs-writer.md +80 -0
- package/.claude/commands/sparc/documenter.md +54 -0
- package/.claude/commands/sparc/innovator.md +54 -0
- package/.claude/commands/sparc/integration.md +83 -0
- package/.claude/commands/sparc/mcp.md +117 -0
- package/.claude/commands/sparc/memory-manager.md +54 -0
- package/.claude/commands/sparc/optimizer.md +54 -0
- package/.claude/commands/sparc/orchestrator.md +132 -0
- package/.claude/commands/sparc/post-deployment-monitoring-mode.md +83 -0
- package/.claude/commands/sparc/refinement-optimization-mode.md +83 -0
- package/.claude/commands/sparc/researcher.md +54 -0
- package/.claude/commands/sparc/reviewer.md +54 -0
- package/.claude/commands/sparc/security-review.md +80 -0
- package/.claude/commands/sparc/sparc-modes.md +174 -0
- package/.claude/commands/sparc/sparc.md +111 -0
- package/.claude/commands/sparc/spec-pseudocode.md +80 -0
- package/.claude/commands/sparc/supabase-admin.md +348 -0
- package/.claude/commands/sparc/swarm-coordinator.md +54 -0
- package/.claude/commands/sparc/tdd.md +54 -0
- package/.claude/commands/sparc/tester.md +54 -0
- package/.claude/commands/sparc/tutorial.md +79 -0
- package/.claude/commands/sparc/workflow-manager.md +54 -0
- package/.claude/commands/stream-chain/pipeline.md +121 -0
- package/.claude/commands/stream-chain/run.md +70 -0
- package/.claude/commands/swarm/README.md +15 -0
- package/.claude/commands/swarm/analysis.md +95 -0
- package/.claude/commands/swarm/development.md +96 -0
- package/.claude/commands/swarm/examples.md +168 -0
- package/.claude/commands/swarm/maintenance.md +102 -0
- package/.claude/commands/swarm/optimization.md +117 -0
- package/.claude/commands/swarm/research.md +136 -0
- package/.claude/commands/swarm/swarm-analysis.md +8 -0
- package/.claude/commands/swarm/swarm-background.md +8 -0
- package/.claude/commands/swarm/swarm-init.md +19 -0
- package/.claude/commands/swarm/swarm-modes.md +8 -0
- package/.claude/commands/swarm/swarm-monitor.md +8 -0
- package/.claude/commands/swarm/swarm-spawn.md +19 -0
- package/.claude/commands/swarm/swarm-status.md +8 -0
- package/.claude/commands/swarm/swarm-strategies.md +8 -0
- package/.claude/commands/swarm/swarm.md +87 -0
- package/.claude/commands/swarm/testing.md +131 -0
- package/.claude/commands/training/README.md +9 -0
- package/.claude/commands/training/model-update.md +25 -0
- package/.claude/commands/training/neural-patterns.md +108 -0
- package/.claude/commands/training/neural-train.md +75 -0
- package/.claude/commands/training/pattern-learn.md +25 -0
- package/.claude/commands/training/specialization.md +63 -0
- package/.claude/commands/truth/start.md +143 -0
- package/.claude/commands/verify/check.md +50 -0
- package/.claude/commands/verify/start.md +128 -0
- package/.claude/commands/workflows/README.md +9 -0
- package/.claude/commands/workflows/development.md +78 -0
- package/.claude/commands/workflows/research.md +63 -0
- package/.claude/commands/workflows/workflow-create.md +25 -0
- package/.claude/commands/workflows/workflow-execute.md +25 -0
- package/.claude/commands/workflows/workflow-export.md +25 -0
- package/.claude/helpers/README.md +97 -0
- package/.claude/helpers/adr-compliance.sh +186 -0
- package/.claude/helpers/auto-commit.sh +178 -0
- package/.claude/helpers/auto-memory-hook.mjs +368 -0
- package/.claude/helpers/checkpoint-manager.sh +251 -0
- package/.claude/helpers/daemon-manager.sh +252 -0
- package/.claude/helpers/ddd-tracker.sh +144 -0
- package/.claude/helpers/github-safe.js +156 -0
- package/.claude/helpers/github-setup.sh +45 -0
- package/.claude/helpers/guidance-hook.sh +13 -0
- package/.claude/helpers/guidance-hooks.sh +102 -0
- package/.claude/helpers/health-monitor.sh +108 -0
- package/.claude/helpers/hook-handler.cjs +286 -0
- package/.claude/helpers/intelligence.cjs +1031 -0
- package/.claude/helpers/learning-hooks.sh +329 -0
- package/.claude/helpers/learning-optimizer.sh +127 -0
- package/.claude/helpers/learning-service.mjs +1144 -0
- package/.claude/helpers/memory.js +83 -0
- package/.claude/helpers/metrics-db.mjs +488 -0
- package/.claude/helpers/pattern-consolidator.sh +86 -0
- package/.claude/helpers/perf-worker.sh +160 -0
- package/.claude/helpers/post-commit +16 -0
- package/.claude/helpers/pre-commit +26 -0
- package/.claude/helpers/quick-start.sh +19 -0
- package/.claude/helpers/router.js +105 -0
- package/.claude/helpers/ruflo-hook.cjs +59 -0
- package/.claude/helpers/security-scanner.sh +127 -0
- package/.claude/helpers/session.js +157 -0
- package/.claude/helpers/setup-mcp.sh +18 -0
- package/.claude/helpers/standard-checkpoint-hooks.sh +189 -0
- package/.claude/helpers/statusline-hook.sh +21 -0
- package/.claude/helpers/statusline.cjs +693 -0
- package/.claude/helpers/statusline.js +352 -0
- package/.claude/helpers/swarm-comms.sh +353 -0
- package/.claude/helpers/swarm-hooks.sh +761 -0
- package/.claude/helpers/swarm-monitor.sh +211 -0
- package/.claude/helpers/sync-v3-metrics.sh +245 -0
- package/.claude/helpers/update-v3-progress.sh +166 -0
- package/.claude/helpers/v3-quick-status.sh +58 -0
- package/.claude/helpers/v3.sh +111 -0
- package/.claude/helpers/validate-v3-config.sh +216 -0
- package/.claude/helpers/worker-manager.sh +170 -0
- package/.claude/settings.json +285 -0
- package/.claude/skills/agentdb-advanced/SKILL.md +550 -0
- package/.claude/skills/agentdb-learning/SKILL.md +545 -0
- package/.claude/skills/agentdb-memory-patterns/SKILL.md +339 -0
- package/.claude/skills/agentdb-optimization/SKILL.md +509 -0
- package/.claude/skills/agentdb-vector-search/SKILL.md +339 -0
- package/.claude/skills/auto-deploy/SKILL.md +31 -0
- package/.claude/skills/autosycn/SKILL.md +30 -0
- package/.claude/skills/browser/SKILL.md +204 -0
- package/.claude/skills/dual-mode/README.md +71 -0
- package/.claude/skills/dual-mode/dual-collect.md +103 -0
- package/.claude/skills/dual-mode/dual-coordinate.md +85 -0
- package/.claude/skills/dual-mode/dual-spawn.md +81 -0
- package/.claude/skills/flow-nexus-neural/SKILL.md +727 -0
- package/.claude/skills/flow-nexus-platform/SKILL.md +1154 -0
- package/.claude/skills/flow-nexus-swarm/SKILL.md +604 -0
- package/.claude/skills/github-code-review/SKILL.md +1125 -0
- package/.claude/skills/github-multi-repo/SKILL.md +862 -0
- package/.claude/skills/github-project-management/SKILL.md +1262 -0
- package/.claude/skills/github-release-management/SKILL.md +1064 -0
- package/.claude/skills/github-workflow-automation/SKILL.md +1047 -0
- package/.claude/skills/hooks-automation/SKILL.md +1201 -0
- package/.claude/skills/mop-help/SKILL.md +35 -0
- package/.claude/skills/pair-programming/SKILL.md +1202 -0
- package/.claude/skills/reasoningbank-agentdb/SKILL.md +446 -0
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +201 -0
- package/.claude/skills/skill-builder/SKILL.md +910 -0
- package/.claude/skills/sparc-methodology/SKILL.md +1106 -0
- package/.claude/skills/stream-chain/SKILL.md +560 -0
- package/.claude/skills/swarm-advanced/SKILL.md +970 -0
- package/.claude/skills/swarm-orchestration/SKILL.md +179 -0
- package/.claude/skills/v3-cli-modernization/SKILL.md +872 -0
- package/.claude/skills/v3-core-implementation/SKILL.md +797 -0
- package/.claude/skills/v3-ddd-architecture/SKILL.md +442 -0
- package/.claude/skills/v3-integration-deep/SKILL.md +241 -0
- package/.claude/skills/v3-mcp-optimization/SKILL.md +777 -0
- package/.claude/skills/v3-memory-unification/SKILL.md +174 -0
- package/.claude/skills/v3-performance-optimization/SKILL.md +390 -0
- package/.claude/skills/v3-security-overhaul/SKILL.md +82 -0
- package/.claude/skills/v3-swarm-coordination/SKILL.md +340 -0
- package/.claude/skills/verification-quality/SKILL.md +691 -0
- package/.claude-flow/CAPABILITIES.md +403 -0
- package/.claude-flow/config.yaml +43 -0
- package/.claude-flow/metrics/learning.json +17 -0
- package/.claude-flow/metrics/swarm-activity.json +18 -0
- package/.claude-flow/metrics/v3-progress.json +26 -0
- package/.claude-flow/security/audit-status.json +8 -0
- package/.codex/config.toml +39 -0
- package/.gemini/settings.json +49 -0
- package/.mcp.json +55 -0
- package/.memoryofplanet/PROTOCOL.md +436 -0
- package/.memoryofplanet/STATE.json +561 -0
- package/.memoryofplanet/config/defaults.json +46 -0
- package/.memoryofplanet/config/team.json +7 -0
- package/.memoryofplanet/scripts/burhan-mop.mjs +124 -0
- package/.memoryofplanet/scripts/mop-auto-deploy.mjs +153 -0
- package/.memoryofplanet/scripts/mop-autosycn.mjs +617 -0
- package/.memoryofplanet/scripts/mop-core.mjs +774 -0
- package/.memoryofplanet/scripts/mop-workflow.mjs +348 -0
- package/.memoryofplanet/templates/artifacts/adversarial-review.md +33 -0
- package/.memoryofplanet/templates/artifacts/architecture.md +28 -0
- package/.memoryofplanet/templates/artifacts/decision-log.md +21 -0
- package/.memoryofplanet/templates/artifacts/handoff.md +21 -0
- package/.memoryofplanet/templates/artifacts/implementation-notes.md +21 -0
- package/.memoryofplanet/templates/artifacts/prd.md +29 -0
- package/.memoryofplanet/templates/artifacts/product-brief.md +30 -0
- package/.memoryofplanet/templates/artifacts/readiness-report.md +25 -0
- package/.memoryofplanet/templates/artifacts/release-notes.md +21 -0
- package/.memoryofplanet/templates/artifacts/review.md +21 -0
- package/.memoryofplanet/templates/artifacts/story.md +25 -0
- package/.memoryofplanet/templates/artifacts/ux-spec.md +32 -0
- package/AGENTS.md +126 -0
- package/CLAUDE.md +235 -0
- package/GEMINI.md +19 -0
- package/README.md +1096 -0
- package/bin/burhan-mop.mjs +2 -0
- package/bin/mop-core.mjs +2 -0
- package/bin/mop-workflow.mjs +2 -0
- package/package.json +66 -0
|
@@ -0,0 +1,693 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* RuFlo V3 Statusline — delegation build (#2195)
|
|
4
|
+
*
|
|
5
|
+
* Fix for ruvnet/ruflo#2195: the previous version re-implemented all data
|
|
6
|
+
* readers locally using fragile file probes that missed AgentDB patterns,
|
|
7
|
+
* the v3/docs/adr/ ADR directory, and the real vector count.
|
|
8
|
+
*
|
|
9
|
+
* This version delegates to 'npx @claude-flow/cli hooks statusline --json'
|
|
10
|
+
* as the single source of truth. That command queries AgentDB directly,
|
|
11
|
+
* counts ADRs in both directories, and reports the real intelligence pct.
|
|
12
|
+
*
|
|
13
|
+
* ADR counting falls back to local file reads so the display still works
|
|
14
|
+
* without network access (counts both v3/docs/adr/ and v3/implementation/adrs/).
|
|
15
|
+
*
|
|
16
|
+
* Cache: JSON result is cached in /tmp for 10s so rapid prompt triggers
|
|
17
|
+
* (every keystroke in some shells) don't hammer the CLI on every call.
|
|
18
|
+
*
|
|
19
|
+
* Usage: node statusline.cjs [--json] [--compact] [--dashboard]
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
23
|
+
const fs = require('fs');
|
|
24
|
+
const path = require('path');
|
|
25
|
+
const { execSync } = require('child_process');
|
|
26
|
+
const os = require('os');
|
|
27
|
+
|
|
28
|
+
// Configuration
|
|
29
|
+
const CONFIG = {
|
|
30
|
+
maxAgents: 50,
|
|
31
|
+
// Session-cost display. Claude Code's cost.total_cost_usd is a client-side
|
|
32
|
+
// estimate that "may differ from your actual bill" and reads as misleading on
|
|
33
|
+
// subscription plans, where token usage is not billed per dollar. These let
|
|
34
|
+
// each user pick what the segment means to them without changing the default.
|
|
35
|
+
// RUFLO_STATUSLINE_COST_SYMBOL override the leading '$' (e.g. ⚡, €, 🌱);
|
|
36
|
+
// set to an empty string for the number alone.
|
|
37
|
+
// RUFLO_STATUSLINE_HIDE_COST 1/true/yes/on removes the segment entirely.
|
|
38
|
+
costSymbol: process.env.RUFLO_STATUSLINE_COST_SYMBOL ?? '$',
|
|
39
|
+
hideCost: /^(1|true|yes|on)$/i.test(process.env.RUFLO_STATUSLINE_HIDE_COST || ''),
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const CWD = process.cwd();
|
|
43
|
+
|
|
44
|
+
// ─── Delegation cache ───────────────────────────────────────────
|
|
45
|
+
// Cache the CLI JSON result for 60s so rapid prompt re-renders
|
|
46
|
+
// (Claude Code refreshes the statusline several times a second while
|
|
47
|
+
// streaming) don't re-invoke the CLI each time. #2337: bumped 10s→60s
|
|
48
|
+
// because 10s was far too short for how often Claude Code re-renders.
|
|
49
|
+
const CACHE_FILE = path.join(os.tmpdir(), 'ruflo-statusline-cache-' + require('crypto').createHash('md5').update(CWD).digest('hex').slice(0, 8) + '.json');
|
|
50
|
+
const CACHE_TTL_MS = 60000;
|
|
51
|
+
|
|
52
|
+
// #2337: resolve an already-installed @claude-flow/cli (or ruflo) bin so we
|
|
53
|
+
// can invoke it directly via `node`. The previous version called
|
|
54
|
+
// `npx --yes @claude-flow/cli@latest` on every uncached render, which forces
|
|
55
|
+
// a registry resolution + cold-start of the entire CLI per render. With
|
|
56
|
+
// multiple concurrent Claude Code sessions this storms the host (reporter
|
|
57
|
+
// saw load average 40-65 on a 12-core box).
|
|
58
|
+
//
|
|
59
|
+
// Returns the absolute path to bin/cli.js or null. Mirrors getPkgVersion()'s
|
|
60
|
+
// path probing (project, monorepo, plugin marketplace, global node_modules
|
|
61
|
+
// including custom-prefix layouts like ~/.npm-global).
|
|
62
|
+
function resolveCliBin() {
|
|
63
|
+
try {
|
|
64
|
+
const home = os.homedir();
|
|
65
|
+
const candidates = [
|
|
66
|
+
path.join(home, '.claude', 'plugins', 'marketplaces', 'ruflo', 'bin', 'cli.js'),
|
|
67
|
+
path.join(CWD, 'node_modules', '@claude-flow', 'cli', 'bin', 'cli.js'),
|
|
68
|
+
path.join(CWD, 'node_modules', 'ruflo', 'bin', 'cli.js'),
|
|
69
|
+
path.join(CWD, 'v3', '@claude-flow', 'cli', 'bin', 'cli.js'),
|
|
70
|
+
];
|
|
71
|
+
try {
|
|
72
|
+
const binDir = path.dirname(process.execPath);
|
|
73
|
+
const globalModuleDirs = [path.join(binDir, '..', 'lib', 'node_modules'), path.join(binDir, 'node_modules')];
|
|
74
|
+
for (const prefix of [process.env.npm_config_prefix, process.env.PREFIX, path.join(home, '.npm-global')]) {
|
|
75
|
+
if (prefix) globalModuleDirs.push(path.join(prefix, 'lib', 'node_modules'));
|
|
76
|
+
}
|
|
77
|
+
for (const gm of globalModuleDirs) {
|
|
78
|
+
candidates.push(
|
|
79
|
+
path.join(gm, 'ruflo', 'bin', 'cli.js'),
|
|
80
|
+
path.join(gm, '@claude-flow', 'cli', 'bin', 'cli.js'),
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
} catch { /* ignore */ }
|
|
84
|
+
for (const p of candidates) {
|
|
85
|
+
if (fs.existsSync(p)) return p;
|
|
86
|
+
}
|
|
87
|
+
} catch { /* ignore */ }
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function readCache() {
|
|
92
|
+
try {
|
|
93
|
+
if (fs.existsSync(CACHE_FILE)) {
|
|
94
|
+
const raw = JSON.parse(fs.readFileSync(CACHE_FILE, 'utf-8'));
|
|
95
|
+
if (raw && raw._ts && (Date.now() - raw._ts) < CACHE_TTL_MS) {
|
|
96
|
+
return raw.data;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
} catch { /* ignore */ }
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function writeCache(data) {
|
|
104
|
+
try { fs.writeFileSync(CACHE_FILE, JSON.stringify({ _ts: Date.now(), data }), 'utf-8'); } catch { /* ignore */ }
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Single source of truth: delegate to the CLI hooks statusline --json command.
|
|
109
|
+
* Falls back to a minimal static object on failure so the statusline still renders.
|
|
110
|
+
*
|
|
111
|
+
* Fix for ruflo#2195: the previous local readers returned 0 for AgentDB patterns
|
|
112
|
+
* (missed the .swarm/memory.db → AgentDB path), computed dddProgress wrong,
|
|
113
|
+
* and only counted ADRs in v3/implementation/adrs/ (missed v3/docs/adr/).
|
|
114
|
+
*/
|
|
115
|
+
function getStatuslineData() {
|
|
116
|
+
const cached = readCache();
|
|
117
|
+
if (cached) return cached;
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
// #2337: prefer an already-installed CLI bin via direct `node` invocation
|
|
121
|
+
// — no npx, no registry round-trip, no @latest re-resolve per render.
|
|
122
|
+
// Fall back to `npx --prefer-offline @claude-flow/cli` (no @latest) only
|
|
123
|
+
// when nothing is installed locally, so a cold environment still works.
|
|
124
|
+
const cliBin = resolveCliBin();
|
|
125
|
+
const cmd = cliBin
|
|
126
|
+
? '"' + process.execPath + '" "' + cliBin + '" hooks statusline --json 2>/dev/null'
|
|
127
|
+
: 'npx --prefer-offline @claude-flow/cli hooks statusline --json 2>/dev/null';
|
|
128
|
+
const raw = execSync(
|
|
129
|
+
cmd,
|
|
130
|
+
{ encoding: 'utf-8', timeout: 8000, stdio: ['pipe', 'pipe', 'pipe'], cwd: CWD }
|
|
131
|
+
).trim();
|
|
132
|
+
// The CLI may emit preamble lines before the JSON — find the first '{'.
|
|
133
|
+
const jsonStart = raw.indexOf('{');
|
|
134
|
+
if (jsonStart === -1) throw new Error('no JSON in CLI output');
|
|
135
|
+
const data = JSON.parse(raw.slice(jsonStart));
|
|
136
|
+
// Overlay every block the CLI JSON omits (adrs/agentdb/tests/hooks/integration)
|
|
137
|
+
// with real local reads, so those segments reflect actual state instead of 0.
|
|
138
|
+
applyLocalOverlays(data);
|
|
139
|
+
writeCache(data);
|
|
140
|
+
return data;
|
|
141
|
+
} catch { /* CLI unavailable or timed out */ }
|
|
142
|
+
|
|
143
|
+
// Fallback: use local file probes only (will be less accurate, but non-zero
|
|
144
|
+
// when CLI is available and accurate when it's not).
|
|
145
|
+
return buildLocalFallback();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Count ADRs from BOTH known directories (fix for ruflo#2195: old code missed
|
|
149
|
+
// v3/docs/adr/ which holds ADR-088..ADR-137, i.e. 41 of the 128 total ADRs).
|
|
150
|
+
function getLocalADRCount() {
|
|
151
|
+
const adrDirs = [
|
|
152
|
+
path.join(CWD, 'v3', 'implementation', 'adrs'),
|
|
153
|
+
path.join(CWD, 'v3', 'docs', 'adr'),
|
|
154
|
+
path.join(CWD, 'docs', 'adrs'),
|
|
155
|
+
path.join(CWD, '.claude-flow', 'adrs'),
|
|
156
|
+
];
|
|
157
|
+
let total = 0;
|
|
158
|
+
for (const dir of adrDirs) {
|
|
159
|
+
try {
|
|
160
|
+
if (fs.existsSync(dir)) {
|
|
161
|
+
const files = fs.readdirSync(dir).filter(function(f) {
|
|
162
|
+
return f.endsWith('.md') && (f.startsWith('ADR-') || f.startsWith('adr-') || /^\d{4}-/.test(f));
|
|
163
|
+
});
|
|
164
|
+
total += files.length;
|
|
165
|
+
}
|
|
166
|
+
} catch { /* ignore */ }
|
|
167
|
+
}
|
|
168
|
+
return { count: total, implemented: total, compliance: 0 };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// ─── Local overlays for segments the CLI JSON omits ──────────────
|
|
172
|
+
// 'hooks statusline --json' only returns user/v3Progress/security/swarm/system.
|
|
173
|
+
// agentdb/tests/hooks/integration are never populated, so without these overlays
|
|
174
|
+
// they render as a permanent 0. Each reader is cheap and degrades to zeros.
|
|
175
|
+
|
|
176
|
+
// Real AgentDB stats from the local memory DB. Vectors live in .swarm/memory.db
|
|
177
|
+
// (sql.js + HNSW); ruvector.db is an opaque redb store counted only toward size.
|
|
178
|
+
// One read-only sqlite3 query (mode=ro never takes a write lock the daemon owns).
|
|
179
|
+
function getLocalAgentDB() {
|
|
180
|
+
const result = { vectorCount: 0, dbSizeKB: 0, hasHnsw: false };
|
|
181
|
+
try {
|
|
182
|
+
let bytes = 0;
|
|
183
|
+
for (const f of ['.swarm/memory.db', 'ruvector.db']) {
|
|
184
|
+
try { bytes += fs.statSync(path.join(CWD, f)).size; } catch { /* missing */ }
|
|
185
|
+
}
|
|
186
|
+
result.dbSizeKB = Math.round(bytes / 1024);
|
|
187
|
+
|
|
188
|
+
const memDb = path.join(CWD, '.swarm', 'memory.db');
|
|
189
|
+
if (fs.existsSync(memDb)) {
|
|
190
|
+
const Q = String.fromCharCode(34);
|
|
191
|
+
const sql = Q + 'SELECT (SELECT COUNT(*) FROM memory_entries WHERE embedding IS NOT NULL)||' + "'|'" + '||(SELECT COUNT(*) FROM vector_indexes);' + Q;
|
|
192
|
+
const out = safeExec("sqlite3 'file:" + memDb + "?mode=ro' " + sql, 1500);
|
|
193
|
+
if (out && out.indexOf('|') !== -1) {
|
|
194
|
+
const parts = out.split('|');
|
|
195
|
+
result.vectorCount = parseInt(parts[0], 10) || 0;
|
|
196
|
+
result.hasHnsw = (parseInt(parts[1], 10) || 0) > 0;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
} catch { /* ignore */ }
|
|
200
|
+
return result;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Count test files via a bounded directory walk (no file reads).
|
|
204
|
+
function getLocalTests() {
|
|
205
|
+
let testFiles = 0;
|
|
206
|
+
function countTests(dir, depth) {
|
|
207
|
+
if ((depth || 0) > 4) return;
|
|
208
|
+
try {
|
|
209
|
+
if (!fs.existsSync(dir)) return;
|
|
210
|
+
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
211
|
+
if (e.isDirectory() && !e.name.startsWith('.') && e.name !== 'node_modules') {
|
|
212
|
+
countTests(path.join(dir, e.name), (depth || 0) + 1);
|
|
213
|
+
} else if (e.isFile() && (e.name.includes('.test.') || e.name.includes('.spec.') || e.name.startsWith('test_') || e.name.startsWith('spec_'))) {
|
|
214
|
+
testFiles++;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
} catch { /* ignore */ }
|
|
218
|
+
}
|
|
219
|
+
for (const d of ['tests', 'test', '__tests__', 'src', 'v3']) countTests(path.join(CWD, d));
|
|
220
|
+
return { testFiles, testCases: testFiles * 4 };
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Count configured hooks from project .claude/settings.json. Claude Code hooks
|
|
224
|
+
// have no enabled/disabled flag, so every configured hook counts as enabled.
|
|
225
|
+
function getLocalHooks() {
|
|
226
|
+
const result = { enabled: 0, total: 0 };
|
|
227
|
+
try {
|
|
228
|
+
const settings = readJSON(path.join(CWD, '.claude', 'settings.json'));
|
|
229
|
+
const hooks = settings && settings.hooks;
|
|
230
|
+
if (hooks && typeof hooks === 'object') {
|
|
231
|
+
let n = 0;
|
|
232
|
+
for (const ev of Object.keys(hooks)) {
|
|
233
|
+
const groups = hooks[ev];
|
|
234
|
+
if (Array.isArray(groups)) {
|
|
235
|
+
for (const g of groups) {
|
|
236
|
+
if (g && Array.isArray(g.hooks)) n += g.hooks.length;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
result.total = n;
|
|
241
|
+
result.enabled = n;
|
|
242
|
+
}
|
|
243
|
+
} catch { /* ignore */ }
|
|
244
|
+
return result;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Best-effort integration block: DB presence + locally-configured stdio MCP
|
|
248
|
+
// servers (project .mcp.json + global ~/.claude.json). Remote connectors are
|
|
249
|
+
// account-managed and not present in local config, so they are not counted.
|
|
250
|
+
function getLocalIntegration() {
|
|
251
|
+
const integration = { mcpServers: { enabled: 0, total: 0 }, hasDatabase: false };
|
|
252
|
+
try {
|
|
253
|
+
for (const f of ['.swarm/memory.db', 'ruvector.db']) {
|
|
254
|
+
if (fs.existsSync(path.join(CWD, f))) { integration.hasDatabase = true; break; }
|
|
255
|
+
}
|
|
256
|
+
const names = new Set();
|
|
257
|
+
const projMcp = readJSON(path.join(CWD, '.mcp.json'));
|
|
258
|
+
if (projMcp && projMcp.mcpServers) for (const k of Object.keys(projMcp.mcpServers)) names.add(k);
|
|
259
|
+
const claudeJson = readJSON(path.join(os.homedir(), '.claude.json'));
|
|
260
|
+
if (claudeJson) {
|
|
261
|
+
if (claudeJson.mcpServers) for (const k of Object.keys(claudeJson.mcpServers)) names.add(k);
|
|
262
|
+
const proj = claudeJson.projects && claudeJson.projects[CWD];
|
|
263
|
+
if (proj && proj.mcpServers && !Array.isArray(proj.mcpServers)) {
|
|
264
|
+
for (const k of Object.keys(proj.mcpServers)) names.add(k);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
integration.mcpServers.total = names.size;
|
|
268
|
+
integration.mcpServers.enabled = names.size;
|
|
269
|
+
} catch { /* ignore */ }
|
|
270
|
+
return integration;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Overlay every locally-derived block onto the CLI data (mutates in place).
|
|
274
|
+
function applyLocalOverlays(data) {
|
|
275
|
+
data.adrs = getLocalADRCount();
|
|
276
|
+
data.agentdb = getLocalAgentDB();
|
|
277
|
+
data.tests = getLocalTests();
|
|
278
|
+
data.hooks = getLocalHooks();
|
|
279
|
+
data.integration = getLocalIntegration();
|
|
280
|
+
return data;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// Minimal local fallback when the CLI is not installed or times out.
|
|
284
|
+
// Returns a structure that matches the CLI JSON schema so the renderer works.
|
|
285
|
+
function buildLocalFallback() {
|
|
286
|
+
const memMB = Math.floor(process.memoryUsage().heapUsed / 1024 / 1024);
|
|
287
|
+
|
|
288
|
+
return applyLocalOverlays({
|
|
289
|
+
user: { name: 'user', gitBranch: '', modelName: 'Claude Code' },
|
|
290
|
+
v3Progress: { domainsCompleted: 0, totalDomains: 5, dddProgress: 0, patternsLearned: 0, sessionsCompleted: 0 },
|
|
291
|
+
security: { status: 'NONE', cvesFixed: 0, totalCves: 0 },
|
|
292
|
+
swarm: { activeAgents: 0, maxAgents: CONFIG.maxAgents, coordinationActive: false },
|
|
293
|
+
system: { memoryMB: memMB, contextPct: 0, intelligencePct: 0, subAgents: 0 },
|
|
294
|
+
lastUpdated: new Date().toISOString(),
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// ANSI colors
|
|
299
|
+
const c = {
|
|
300
|
+
reset: '\x1b[0m',
|
|
301
|
+
bold: '\x1b[1m',
|
|
302
|
+
dim: '\x1b[2m',
|
|
303
|
+
red: '\x1b[0;31m',
|
|
304
|
+
green: '\x1b[0;32m',
|
|
305
|
+
yellow: '\x1b[0;33m',
|
|
306
|
+
blue: '\x1b[0;34m',
|
|
307
|
+
purple: '\x1b[0;35m',
|
|
308
|
+
cyan: '\x1b[0;36m',
|
|
309
|
+
brightRed: '\x1b[1;31m',
|
|
310
|
+
brightGreen: '\x1b[1;32m',
|
|
311
|
+
brightYellow: '\x1b[1;33m',
|
|
312
|
+
brightBlue: '\x1b[1;34m',
|
|
313
|
+
brightPurple: '\x1b[1;35m',
|
|
314
|
+
brightCyan: '\x1b[1;36m',
|
|
315
|
+
brightWhite: '\x1b[1;37m',
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
// Safe execSync with strict timeout (returns empty string on failure)
|
|
319
|
+
function safeExec(cmd, timeoutMs) {
|
|
320
|
+
try {
|
|
321
|
+
return execSync(cmd, {
|
|
322
|
+
encoding: 'utf-8',
|
|
323
|
+
timeout: timeoutMs || 2000,
|
|
324
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
325
|
+
}).trim();
|
|
326
|
+
} catch {
|
|
327
|
+
return '';
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Safe JSON file reader (returns null on failure)
|
|
332
|
+
function readJSON(filePath) {
|
|
333
|
+
try {
|
|
334
|
+
if (fs.existsSync(filePath)) {
|
|
335
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
|
336
|
+
}
|
|
337
|
+
} catch { /* ignore */ }
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// ─── Git info (pure-Node / single exec — needed for branch display) ──────────
|
|
342
|
+
|
|
343
|
+
function getGitInfo() {
|
|
344
|
+
const result = {
|
|
345
|
+
name: 'user', gitBranch: '', modified: 0, untracked: 0,
|
|
346
|
+
staged: 0, ahead: 0, behind: 0,
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
const script = [
|
|
350
|
+
'git config user.name 2>/dev/null || echo user',
|
|
351
|
+
'echo "---SEP---"',
|
|
352
|
+
'git branch --show-current 2>/dev/null',
|
|
353
|
+
'echo "---SEP---"',
|
|
354
|
+
'git status --porcelain 2>/dev/null',
|
|
355
|
+
'echo "---SEP---"',
|
|
356
|
+
'git rev-list --left-right --count HEAD...@{upstream} 2>/dev/null || echo "0 0"',
|
|
357
|
+
].join('; ');
|
|
358
|
+
|
|
359
|
+
const raw = safeExec("sh -c '" + script + "'", 3000);
|
|
360
|
+
if (!raw) return result;
|
|
361
|
+
|
|
362
|
+
const parts = raw.split('---SEP---').map(function(s) { return s.trim(); });
|
|
363
|
+
if (parts.length >= 4) {
|
|
364
|
+
result.name = parts[0] || 'user';
|
|
365
|
+
result.gitBranch = parts[1] || '';
|
|
366
|
+
|
|
367
|
+
if (parts[2]) {
|
|
368
|
+
for (const line of parts[2].split('\n')) {
|
|
369
|
+
if (!line || line.length < 2) continue;
|
|
370
|
+
const x = line[0], y = line[1];
|
|
371
|
+
if (x === '?' && y === '?') { result.untracked++; continue; }
|
|
372
|
+
if (x !== ' ' && x !== '?') result.staged++;
|
|
373
|
+
if (y !== ' ' && y !== '?') result.modified++;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
const ab = (parts[3] || '0 0').split(/\s+/);
|
|
378
|
+
result.ahead = parseInt(ab[0]) || 0;
|
|
379
|
+
result.behind = parseInt(ab[1]) || 0;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
return result;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// Detect model name from Claude config (pure file reads, no exec)
|
|
386
|
+
function getModelName() {
|
|
387
|
+
try {
|
|
388
|
+
const claudeConfig = readJSON(path.join(os.homedir(), '.claude.json'));
|
|
389
|
+
if (claudeConfig && claudeConfig.projects) {
|
|
390
|
+
for (const [projectPath, projectConfig] of Object.entries(claudeConfig.projects)) {
|
|
391
|
+
if (CWD === projectPath || CWD.startsWith(projectPath + '/')) {
|
|
392
|
+
const usage = projectConfig.lastModelUsage;
|
|
393
|
+
if (usage) {
|
|
394
|
+
const ids = Object.keys(usage);
|
|
395
|
+
if (ids.length > 0) {
|
|
396
|
+
let modelId = ids[ids.length - 1];
|
|
397
|
+
let latest = 0;
|
|
398
|
+
for (const id of ids) {
|
|
399
|
+
const ts = usage[id] && usage[id].lastUsedAt ? new Date(usage[id].lastUsedAt).getTime() : 0;
|
|
400
|
+
if (ts > latest) { latest = ts; modelId = id; }
|
|
401
|
+
}
|
|
402
|
+
if (modelId.includes('opus')) return 'Opus 4.8';
|
|
403
|
+
if (modelId.includes('sonnet')) return 'Sonnet 4.6';
|
|
404
|
+
if (modelId.includes('haiku')) return 'Haiku 4.5';
|
|
405
|
+
return modelId.split('-').slice(1, 3).join(' ');
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
} catch { /* ignore */ }
|
|
413
|
+
|
|
414
|
+
// Fallback: settings.json model field
|
|
415
|
+
const settings = getSettings();
|
|
416
|
+
if (settings && settings.model) {
|
|
417
|
+
const m = settings.model;
|
|
418
|
+
if (m.includes('opus')) return 'Opus 4.8';
|
|
419
|
+
if (m.includes('sonnet')) return 'Sonnet 4.6';
|
|
420
|
+
if (m.includes('haiku')) return 'Haiku 4.5';
|
|
421
|
+
}
|
|
422
|
+
return 'Claude Code';
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// ─── Stdin reader (Claude Code pipes session JSON) ──────────────
|
|
426
|
+
// Claude Code sends session JSON via stdin. Read synchronously so the
|
|
427
|
+
// script works both when invoked by Claude Code (stdin has JSON) and
|
|
428
|
+
// when run manually from terminal (stdin is empty/tty).
|
|
429
|
+
let _stdinData = null;
|
|
430
|
+
function getStdinData() {
|
|
431
|
+
if (_stdinData !== undefined && _stdinData !== null) return _stdinData;
|
|
432
|
+
try {
|
|
433
|
+
if (process.stdin.isTTY) { _stdinData = null; return null; }
|
|
434
|
+
const chunks = [];
|
|
435
|
+
const buf = Buffer.alloc(4096);
|
|
436
|
+
let bytesRead;
|
|
437
|
+
try {
|
|
438
|
+
while ((bytesRead = fs.readSync(0, buf, 0, buf.length, null)) > 0) {
|
|
439
|
+
chunks.push(buf.slice(0, bytesRead));
|
|
440
|
+
}
|
|
441
|
+
} catch { /* EOF or read error */ }
|
|
442
|
+
const raw = Buffer.concat(chunks).toString('utf-8').trim();
|
|
443
|
+
_stdinData = (raw && raw.startsWith('{')) ? JSON.parse(raw) : null;
|
|
444
|
+
} catch {
|
|
445
|
+
_stdinData = null;
|
|
446
|
+
}
|
|
447
|
+
return _stdinData;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function getModelFromStdin() {
|
|
451
|
+
const data = getStdinData();
|
|
452
|
+
return (data && data.model && data.model.display_name) ? data.model.display_name : null;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
function getContextFromStdin() {
|
|
456
|
+
const data = getStdinData();
|
|
457
|
+
if (data && data.context_window) {
|
|
458
|
+
return { usedPct: Math.floor(data.context_window.used_percentage || 0) };
|
|
459
|
+
}
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function getCostFromStdin() {
|
|
464
|
+
const data = getStdinData();
|
|
465
|
+
if (data && data.cost) {
|
|
466
|
+
const durationMs = data.cost.total_duration_ms || 0;
|
|
467
|
+
const mins = Math.floor(durationMs / 60000);
|
|
468
|
+
const secs = Math.floor((durationMs % 60000) / 1000);
|
|
469
|
+
return {
|
|
470
|
+
costUsd: data.cost.total_cost_usd || 0,
|
|
471
|
+
duration: mins > 0 ? mins + 'm' + secs + 's' : secs + 's',
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
return null;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// Read package version from the first package.json we find.
|
|
478
|
+
function getPkgVersion() {
|
|
479
|
+
let ver = '3.6';
|
|
480
|
+
try {
|
|
481
|
+
const home = os.homedir();
|
|
482
|
+
const pkgPaths = [
|
|
483
|
+
path.join(home, '.claude', 'plugins', 'marketplaces', 'ruflo', 'package.json'),
|
|
484
|
+
path.join(CWD, 'node_modules', '@claude-flow', 'cli', 'package.json'),
|
|
485
|
+
path.join(CWD, 'node_modules', 'ruflo', 'package.json'),
|
|
486
|
+
path.join(CWD, 'v3', '@claude-flow', 'cli', 'package.json'),
|
|
487
|
+
];
|
|
488
|
+
// #2221: global installs (npm i -g ruflo) live outside CWD/node_modules, so the
|
|
489
|
+
// probes above all miss and the version falls back to the hard-coded default.
|
|
490
|
+
// Derive the global node_modules dir from the running node binary (no npm spawn —
|
|
491
|
+
// statusline renders often). Covers nvm/mise (bin/../lib/node_modules) and Windows
|
|
492
|
+
// (bin/node_modules) layouts.
|
|
493
|
+
try {
|
|
494
|
+
const binDir = path.dirname(process.execPath);
|
|
495
|
+
const globalModuleDirs = [path.join(binDir, '..', 'lib', 'node_modules'), path.join(binDir, 'node_modules')];
|
|
496
|
+
// #2221 follow-up: a custom npm prefix (e.g. ~/.npm-global) is decoupled from
|
|
497
|
+
// the node binary location, so the binDir-derived probes above all miss. Also
|
|
498
|
+
// probe the npm prefix from the environment and the common ~/.npm-global default.
|
|
499
|
+
for (const prefix of [process.env.npm_config_prefix, process.env.PREFIX, path.join(home, '.npm-global')]) {
|
|
500
|
+
if (prefix) globalModuleDirs.push(path.join(prefix, 'lib', 'node_modules'));
|
|
501
|
+
}
|
|
502
|
+
for (const gm of globalModuleDirs) {
|
|
503
|
+
pkgPaths.push(
|
|
504
|
+
path.join(gm, 'ruflo', 'package.json'),
|
|
505
|
+
path.join(gm, '@claude-flow', 'cli', 'package.json'),
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
} catch { /* ignore */ }
|
|
509
|
+
for (const p of pkgPaths) {
|
|
510
|
+
if (!fs.existsSync(p)) continue;
|
|
511
|
+
try {
|
|
512
|
+
const pkg = JSON.parse(fs.readFileSync(p, 'utf-8'));
|
|
513
|
+
if (pkg && typeof pkg.version === 'string' && pkg.version.length > 0) { ver = pkg.version; break; }
|
|
514
|
+
} catch { /* ignore */ }
|
|
515
|
+
}
|
|
516
|
+
} catch { /* ignore */ }
|
|
517
|
+
return ver;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
// ─── Rendering ──────────────────────────────────────────────────
|
|
521
|
+
|
|
522
|
+
function progressBar(current, total) {
|
|
523
|
+
const width = 5;
|
|
524
|
+
const filled = Math.round((current / total) * width);
|
|
525
|
+
return '[' + '●'.repeat(filled) + '○'.repeat(width - filled) + ']';
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
function generateStatusline() {
|
|
529
|
+
const d = getStatuslineData();
|
|
530
|
+
const git = getGitInfo();
|
|
531
|
+
const modelName = getModelFromStdin() || (d.user && d.user.modelName) || 'Claude Code';
|
|
532
|
+
const ctxInfo = getContextFromStdin();
|
|
533
|
+
const costInfo = getCostFromStdin();
|
|
534
|
+
const pkgVersion = getPkgVersion();
|
|
535
|
+
|
|
536
|
+
const progress = d.v3Progress || {};
|
|
537
|
+
const security = d.security || {};
|
|
538
|
+
const swarm = d.swarm || {};
|
|
539
|
+
const system = d.system || {};
|
|
540
|
+
const adrs = d.adrs || {};
|
|
541
|
+
const hooks = d.hooks || {};
|
|
542
|
+
const agentdb = d.agentdb || {};
|
|
543
|
+
const tests = d.tests || {};
|
|
544
|
+
|
|
545
|
+
const domainsCompleted = progress.domainsCompleted || 0;
|
|
546
|
+
const totalDomains = progress.totalDomains || 5;
|
|
547
|
+
const dddProgress = progress.dddProgress || 0;
|
|
548
|
+
const patternsLearned = progress.patternsLearned || 0;
|
|
549
|
+
const activeAgents = swarm.activeAgents || 0;
|
|
550
|
+
const maxAgents = swarm.maxAgents || CONFIG.maxAgents;
|
|
551
|
+
const coordinationActive = swarm.coordinationActive || false;
|
|
552
|
+
const intelligencePct = system.intelligencePct || 0;
|
|
553
|
+
const memoryMB = system.memoryMB || 0;
|
|
554
|
+
const subAgents = system.subAgents || 0;
|
|
555
|
+
const cvesFixed = security.cvesFixed || 0;
|
|
556
|
+
const totalCves = security.totalCves || 0;
|
|
557
|
+
const secStatus = security.status || 'NONE';
|
|
558
|
+
const adrCount = adrs.count || 0;
|
|
559
|
+
const adrImpl = adrs.implemented || 0;
|
|
560
|
+
const hooksEnabled = hooks.enabled || 0;
|
|
561
|
+
const hooksTotal = hooks.total || 0;
|
|
562
|
+
const vectorCount = agentdb.vectorCount || 0;
|
|
563
|
+
const hasHnsw = agentdb.hasHnsw || false;
|
|
564
|
+
const dbSizeKB = agentdb.dbSizeKB || 0;
|
|
565
|
+
const testFiles = tests.testFiles || 0;
|
|
566
|
+
const testCases = tests.testCases || testFiles * 4;
|
|
567
|
+
|
|
568
|
+
const lines = [];
|
|
569
|
+
|
|
570
|
+
// Header
|
|
571
|
+
let header = c.bold + c.brightPurple + '▊ RuFlo V' + pkgVersion + ' ' + c.reset;
|
|
572
|
+
header += (coordinationActive ? c.brightCyan : c.dim) + '● ' + c.brightCyan + git.name + c.reset;
|
|
573
|
+
if (git.gitBranch) {
|
|
574
|
+
header += ' ' + c.dim + '│' + c.reset + ' ' + c.brightBlue + '⏇ ' + git.gitBranch + c.reset;
|
|
575
|
+
const changes = git.modified + git.staged + git.untracked;
|
|
576
|
+
if (changes > 0) {
|
|
577
|
+
let ind = '';
|
|
578
|
+
if (git.staged > 0) ind += c.brightGreen + '+' + git.staged + c.reset;
|
|
579
|
+
if (git.modified > 0) ind += c.brightYellow + '~' + git.modified + c.reset;
|
|
580
|
+
if (git.untracked > 0) ind += c.dim + '?' + git.untracked + c.reset;
|
|
581
|
+
header += ' ' + ind;
|
|
582
|
+
}
|
|
583
|
+
if (git.ahead > 0) header += ' ' + c.brightGreen + '↑' + git.ahead + c.reset;
|
|
584
|
+
if (git.behind > 0) header += ' ' + c.brightRed + '↓' + git.behind + c.reset;
|
|
585
|
+
}
|
|
586
|
+
header += ' ' + c.dim + '│' + c.reset + ' ' + c.purple + modelName + c.reset;
|
|
587
|
+
const duration = costInfo ? costInfo.duration : '';
|
|
588
|
+
if (duration) header += ' ' + c.dim + '│' + c.reset + ' ' + c.cyan + '⏱ ' + duration + c.reset;
|
|
589
|
+
if (ctxInfo && ctxInfo.usedPct > 0) {
|
|
590
|
+
const ctxColor = ctxInfo.usedPct >= 90 ? c.brightRed : ctxInfo.usedPct >= 70 ? c.brightYellow : c.brightGreen;
|
|
591
|
+
header += ' ' + c.dim + '│' + c.reset + ' ' + ctxColor + '● ' + ctxInfo.usedPct + '% ctx' + c.reset;
|
|
592
|
+
}
|
|
593
|
+
if (!CONFIG.hideCost && costInfo && costInfo.costUsd > 0) {
|
|
594
|
+
header += ' ' + c.dim + '│' + c.reset + ' ' + c.brightYellow + CONFIG.costSymbol + costInfo.costUsd.toFixed(2) + c.reset;
|
|
595
|
+
}
|
|
596
|
+
lines.push(header);
|
|
597
|
+
|
|
598
|
+
// Separator
|
|
599
|
+
lines.push(c.dim + '─'.repeat(53) + c.reset);
|
|
600
|
+
|
|
601
|
+
// Line 1: DDD Domains
|
|
602
|
+
const domainsColor = domainsCompleted >= 3 ? c.brightGreen : domainsCompleted > 0 ? c.yellow : c.red;
|
|
603
|
+
let perfIndicator;
|
|
604
|
+
if (hasHnsw && vectorCount > 0) {
|
|
605
|
+
const speedup = vectorCount > 10000 ? '12500x' : vectorCount > 1000 ? '150x' : '10x';
|
|
606
|
+
perfIndicator = c.brightGreen + '⚡ HNSW ' + speedup + c.reset;
|
|
607
|
+
} else if (patternsLearned > 0) {
|
|
608
|
+
const pk = patternsLearned >= 1000 ? (patternsLearned / 1000).toFixed(1) + 'k' : String(patternsLearned);
|
|
609
|
+
perfIndicator = c.brightYellow + '📚 ' + pk + ' patterns' + c.reset;
|
|
610
|
+
} else {
|
|
611
|
+
perfIndicator = c.dim + '⚡ target: 150x-12500x' + c.reset;
|
|
612
|
+
}
|
|
613
|
+
lines.push(
|
|
614
|
+
c.brightCyan + '🏗️ DDD Domains' + c.reset + ' ' + progressBar(domainsCompleted, totalDomains) + ' ' +
|
|
615
|
+
domainsColor + domainsCompleted + c.reset + '/' + c.brightWhite + totalDomains + c.reset + ' ' + perfIndicator
|
|
616
|
+
);
|
|
617
|
+
|
|
618
|
+
// Line 2: Swarm + Hooks + CVE + Memory + Intelligence
|
|
619
|
+
const swarmInd = coordinationActive ? c.brightGreen + '◉' + c.reset : c.dim + '○' + c.reset;
|
|
620
|
+
const agentsColor = activeAgents > 0 ? c.brightGreen : c.red;
|
|
621
|
+
const secIcon = secStatus === 'CLEAN' ? '🟢' : (secStatus === 'IN_PROGRESS' || secStatus === 'STALE') ? '🟡' : (secStatus === 'NONE' ? '⚪' : '🔴');
|
|
622
|
+
const secColor = secStatus === 'CLEAN' ? c.brightGreen : (secStatus === 'IN_PROGRESS' || secStatus === 'STALE') ? c.brightYellow : (secStatus === 'NONE' ? c.dim : c.brightRed);
|
|
623
|
+
const hooksColor = hooksEnabled > 0 ? c.brightGreen : c.dim;
|
|
624
|
+
const intellColor = intelligencePct >= 80 ? c.brightGreen : intelligencePct >= 40 ? c.brightYellow : c.dim;
|
|
625
|
+
|
|
626
|
+
lines.push(
|
|
627
|
+
c.brightYellow + '🤖 Swarm' + c.reset + ' ' + swarmInd + ' [' + agentsColor + String(activeAgents).padStart(2) + c.reset + '/' + c.brightWhite + maxAgents + c.reset + '] ' +
|
|
628
|
+
c.brightPurple + '👥 ' + subAgents + c.reset + ' ' +
|
|
629
|
+
c.brightBlue + '🪝 ' + hooksColor + hooksEnabled + c.reset + '/' + c.brightWhite + hooksTotal + c.reset + ' ' +
|
|
630
|
+
secIcon + ' ' + secColor + 'CVE ' + cvesFixed + c.reset + '/' + c.brightWhite + totalCves + c.reset + ' ' +
|
|
631
|
+
c.brightCyan + '💾 ' + memoryMB + 'MB' + c.reset + ' ' +
|
|
632
|
+
intellColor + '🧠 ' + String(intelligencePct).padStart(3) + '%' + c.reset
|
|
633
|
+
);
|
|
634
|
+
|
|
635
|
+
// Line 3: Architecture
|
|
636
|
+
const dddColor = dddProgress >= 50 ? c.brightGreen : dddProgress > 0 ? c.yellow : c.red;
|
|
637
|
+
const adrColor = adrCount > 0 ? (adrImpl === adrCount ? c.brightGreen : c.yellow) : c.dim;
|
|
638
|
+
const adrDisplay = adrColor + '●' + adrImpl + '/' + adrCount + c.reset;
|
|
639
|
+
|
|
640
|
+
lines.push(
|
|
641
|
+
c.brightPurple + '🔧 Architecture' + c.reset + ' ' +
|
|
642
|
+
c.cyan + 'ADRs' + c.reset + ' ' + adrDisplay + ' ' + c.dim + '│' + c.reset + ' ' +
|
|
643
|
+
c.cyan + 'DDD' + c.reset + ' ' + dddColor + '●' + String(dddProgress).padStart(3) + '%' + c.reset + ' ' + c.dim + '│' + c.reset + ' ' +
|
|
644
|
+
c.cyan + 'Security' + c.reset + ' ' + secColor + '●' + secStatus + c.reset
|
|
645
|
+
);
|
|
646
|
+
|
|
647
|
+
// Line 4: AgentDB, Tests, Integration
|
|
648
|
+
const hnswInd = hasHnsw ? c.brightGreen + '⚡' + c.reset : '';
|
|
649
|
+
const sizeDisp = dbSizeKB >= 1024 ? (dbSizeKB / 1024).toFixed(1) + 'MB' : dbSizeKB + 'KB';
|
|
650
|
+
const vectorColor = vectorCount > 0 ? c.brightGreen : c.dim;
|
|
651
|
+
const testColor = testFiles > 0 ? c.brightGreen : c.dim;
|
|
652
|
+
|
|
653
|
+
// MCP / DB integration from data
|
|
654
|
+
const integration = d.integration || {};
|
|
655
|
+
const mcpServers = (integration.mcpServers) || {};
|
|
656
|
+
let integStr = '';
|
|
657
|
+
if (mcpServers.total > 0) {
|
|
658
|
+
const mcpCol = mcpServers.enabled === mcpServers.total ? c.brightGreen : mcpServers.enabled > 0 ? c.brightYellow : c.red;
|
|
659
|
+
integStr += c.cyan + 'MCP' + c.reset + ' ' + mcpCol + '●' + mcpServers.enabled + '/' + mcpServers.total + c.reset;
|
|
660
|
+
}
|
|
661
|
+
if (integration.hasDatabase) integStr += (integStr ? ' ' : '') + c.brightGreen + '◆' + c.reset + 'DB';
|
|
662
|
+
if (!integStr) integStr = c.dim + '● none' + c.reset;
|
|
663
|
+
|
|
664
|
+
lines.push(
|
|
665
|
+
c.brightCyan + '📊 AgentDB' + c.reset + ' ' +
|
|
666
|
+
c.cyan + 'Vectors' + c.reset + ' ' + vectorColor + '●' + vectorCount + hnswInd + c.reset + ' ' + c.dim + '│' + c.reset + ' ' +
|
|
667
|
+
c.cyan + 'Size' + c.reset + ' ' + c.brightWhite + sizeDisp + c.reset + ' ' + c.dim + '│' + c.reset + ' ' +
|
|
668
|
+
c.cyan + 'Tests' + c.reset + ' ' + testColor + '●' + testFiles + c.reset + ' ' + c.dim + '(~' + testCases + ' cases)' + c.reset + ' ' + c.dim + '│' + c.reset + ' ' +
|
|
669
|
+
integStr
|
|
670
|
+
);
|
|
671
|
+
|
|
672
|
+
return lines.join('\n');
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
// JSON output — delegates to CLI for accuracy; caller can use --json flag
|
|
676
|
+
function generateJSON() {
|
|
677
|
+
const d = getStatuslineData();
|
|
678
|
+
const git = getGitInfo();
|
|
679
|
+
return Object.assign({}, d, {
|
|
680
|
+
user: Object.assign({ name: git.name, gitBranch: git.gitBranch }, d.user || {}),
|
|
681
|
+
git: { modified: git.modified, untracked: git.untracked, staged: git.staged, ahead: git.ahead, behind: git.behind },
|
|
682
|
+
lastUpdated: new Date().toISOString(),
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
// ─── Main ───────────────────────────────────────────────────────
|
|
687
|
+
if (process.argv.includes('--json')) {
|
|
688
|
+
console.log(JSON.stringify(generateJSON(), null, 2));
|
|
689
|
+
} else if (process.argv.includes('--compact')) {
|
|
690
|
+
console.log(JSON.stringify(generateJSON()));
|
|
691
|
+
} else {
|
|
692
|
+
console.log(generateStatusline());
|
|
693
|
+
}
|