@monoes/monomindcli 1.6.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/.claude/agents/academic/academic-anthropologist.md +126 -0
- package/.claude/agents/academic/academic-geographer.md +128 -0
- package/.claude/agents/academic/academic-historian.md +124 -0
- package/.claude/agents/academic/academic-narratologist.md +119 -0
- package/.claude/agents/academic/academic-psychologist.md +119 -0
- package/.claude/agents/analysis/analyze-code-quality.md +58 -0
- package/.claude/agents/analysis/code-analyzer.md +189 -0
- package/.claude/agents/analysis/code-review/analyze-code-quality.md +58 -0
- package/.claude/agents/architecture/system-design/arch-system-design.md +54 -0
- package/.claude/agents/consensus/crdt-synchronizer.md +977 -0
- package/.claude/agents/consensus/performance-benchmarker.md +831 -0
- package/.claude/agents/consensus/quorum-manager.md +803 -0
- package/.claude/agents/consensus/security-manager.md +602 -0
- package/.claude/agents/core/coder.md +262 -0
- package/.claude/agents/core/planner.md +170 -0
- package/.claude/agents/core/researcher.md +192 -0
- package/.claude/agents/core/reviewer.md +327 -0
- package/.claude/agents/core/tester.md +318 -0
- package/.claude/agents/data/ml/data-ml-model.md +76 -0
- package/.claude/agents/design/design-brand-guardian.md +323 -0
- package/.claude/agents/design/design-image-prompt-engineer.md +237 -0
- package/.claude/agents/design/design-inclusive-visuals-specialist.md +72 -0
- package/.claude/agents/design/design-ui-designer.md +384 -0
- package/.claude/agents/design/design-ux-architect.md +470 -0
- package/.claude/agents/design/design-ux-researcher.md +330 -0
- package/.claude/agents/design/design-visual-storyteller.md +150 -0
- package/.claude/agents/design/design-whimsy-injector.md +439 -0
- package/.claude/agents/development/dev-backend-api.md +178 -0
- package/.claude/agents/devops/ci-cd/ops-cicd-github.md +52 -0
- package/.claude/agents/documentation/api-docs/docs-api-openapi.md +63 -0
- package/.claude/agents/engineering/engineering-ai-data-remediation-engineer.md +212 -0
- package/.claude/agents/engineering/engineering-ai-engineer.md +165 -0
- package/.claude/agents/engineering/engineering-autonomous-optimization-architect.md +108 -0
- package/.claude/agents/engineering/engineering-backend-architect.md +254 -0
- package/.claude/agents/engineering/engineering-code-reviewer.md +95 -0
- package/.claude/agents/engineering/engineering-data-engineer.md +307 -0
- package/.claude/agents/engineering/engineering-database-optimizer.md +200 -0
- package/.claude/agents/engineering/engineering-devops-automator.md +430 -0
- package/.claude/agents/engineering/engineering-embedded-firmware-engineer.md +174 -0
- package/.claude/agents/engineering/engineering-feishu-integration-developer.md +607 -0
- package/.claude/agents/engineering/engineering-frontend-developer.md +249 -0
- package/.claude/agents/engineering/engineering-git-workflow-master.md +108 -0
- package/.claude/agents/engineering/engineering-incident-response-commander.md +482 -0
- package/.claude/agents/engineering/engineering-mobile-app-builder.md +499 -0
- package/.claude/agents/engineering/engineering-rapid-prototyper.md +463 -0
- package/.claude/agents/engineering/engineering-security-engineer.md +303 -0
- package/.claude/agents/engineering/engineering-senior-developer.md +195 -0
- package/.claude/agents/engineering/engineering-software-architect.md +100 -0
- package/.claude/agents/engineering/engineering-solidity-smart-contract-engineer.md +528 -0
- package/.claude/agents/engineering/engineering-sre.md +114 -0
- package/.claude/agents/engineering/engineering-technical-writer.md +412 -0
- package/.claude/agents/engineering/engineering-threat-detection-engineer.md +540 -0
- package/.claude/agents/engineering/engineering-wechat-mini-program-developer.md +351 -0
- package/.claude/agents/game-development/blender/blender-addon-engineer.md +235 -0
- package/.claude/agents/game-development/game-audio-engineer.md +265 -0
- package/.claude/agents/game-development/game-designer.md +168 -0
- package/.claude/agents/game-development/godot/godot-gameplay-scripter.md +335 -0
- package/.claude/agents/game-development/godot/godot-multiplayer-engineer.md +298 -0
- package/.claude/agents/game-development/godot/godot-shader-developer.md +267 -0
- package/.claude/agents/game-development/level-designer.md +209 -0
- package/.claude/agents/game-development/narrative-designer.md +244 -0
- package/.claude/agents/game-development/roblox-studio/roblox-avatar-creator.md +298 -0
- package/.claude/agents/game-development/roblox-studio/roblox-experience-designer.md +306 -0
- package/.claude/agents/game-development/roblox-studio/roblox-systems-scripter.md +326 -0
- package/.claude/agents/game-development/technical-artist.md +230 -0
- package/.claude/agents/game-development/unity/unity-architect.md +272 -0
- package/.claude/agents/game-development/unity/unity-editor-tool-developer.md +311 -0
- package/.claude/agents/game-development/unity/unity-multiplayer-engineer.md +322 -0
- package/.claude/agents/game-development/unity/unity-shader-graph-artist.md +270 -0
- package/.claude/agents/game-development/unreal-engine/unreal-multiplayer-architect.md +314 -0
- package/.claude/agents/game-development/unreal-engine/unreal-systems-engineer.md +311 -0
- package/.claude/agents/game-development/unreal-engine/unreal-technical-artist.md +257 -0
- package/.claude/agents/game-development/unreal-engine/unreal-world-builder.md +274 -0
- package/.claude/agents/github/code-review-swarm.md +557 -0
- package/.claude/agents/github/github-modes.md +154 -0
- package/.claude/agents/github/issue-tracker.md +299 -0
- package/.claude/agents/github/multi-repo-swarm.md +525 -0
- package/.claude/agents/github/pr-manager.md +163 -0
- package/.claude/agents/github/project-board-sync.md +478 -0
- package/.claude/agents/github/release-manager.md +352 -0
- package/.claude/agents/github/release-swarm.md +597 -0
- package/.claude/agents/github/repo-architect.md +378 -0
- package/.claude/agents/github/swarm-issue.md +548 -0
- package/.claude/agents/github/swarm-pr.md +427 -0
- package/.claude/agents/github/sync-coordinator.md +423 -0
- package/.claude/agents/github/workflow-automation.md +640 -0
- package/.claude/agents/goal/agent.md +804 -0
- package/.claude/agents/goal/code-goal-planner.md +445 -0
- package/.claude/agents/goal/goal-planner.md +168 -0
- package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +129 -0
- package/.claude/agents/hive-mind/queen-coordinator.md +202 -0
- package/.claude/agents/hive-mind/scout-explorer.md +241 -0
- package/.claude/agents/hive-mind/swarm-memory-manager.md +192 -0
- package/.claude/agents/hive-mind/worker-specialist.md +216 -0
- package/.claude/agents/marketing/marketing-ai-citation-strategist.md +171 -0
- package/.claude/agents/marketing/marketing-app-store-optimizer.md +322 -0
- package/.claude/agents/marketing/marketing-baidu-seo-specialist.md +227 -0
- package/.claude/agents/marketing/marketing-bilibili-content-strategist.md +200 -0
- package/.claude/agents/marketing/marketing-book-co-author.md +111 -0
- package/.claude/agents/marketing/marketing-carousel-growth-engine.md +200 -0
- package/.claude/agents/marketing/marketing-china-ecommerce-operator.md +284 -0
- package/.claude/agents/marketing/marketing-content-creator.md +54 -0
- package/.claude/agents/marketing/marketing-cross-border-ecommerce.md +260 -0
- package/.claude/agents/marketing/marketing-douyin-strategist.md +150 -0
- package/.claude/agents/marketing/marketing-growth-hacker.md +54 -0
- package/.claude/agents/marketing/marketing-instagram-curator.md +114 -0
- package/.claude/agents/marketing/marketing-kuaishou-strategist.md +224 -0
- package/.claude/agents/marketing/marketing-linkedin-content-creator.md +215 -0
- package/.claude/agents/marketing/marketing-livestream-commerce-coach.md +306 -0
- package/.claude/agents/marketing/marketing-podcast-strategist.md +278 -0
- package/.claude/agents/marketing/marketing-private-domain-operator.md +309 -0
- package/.claude/agents/marketing/marketing-reddit-community-builder.md +124 -0
- package/.claude/agents/marketing/marketing-seo-specialist.md +279 -0
- package/.claude/agents/marketing/marketing-short-video-editing-coach.md +413 -0
- package/.claude/agents/marketing/marketing-social-media-strategist.md +125 -0
- package/.claude/agents/marketing/marketing-tiktok-strategist.md +126 -0
- package/.claude/agents/marketing/marketing-twitter-engager.md +127 -0
- package/.claude/agents/marketing/marketing-wechat-official-account.md +146 -0
- package/.claude/agents/marketing/marketing-weibo-strategist.md +241 -0
- package/.claude/agents/marketing/marketing-xiaohongshu-specialist.md +139 -0
- package/.claude/agents/marketing/marketing-zhihu-strategist.md +163 -0
- package/.claude/agents/neural/safla-neural.md +74 -0
- package/.claude/agents/optimization/benchmark-suite.md +663 -0
- package/.claude/agents/optimization/load-balancer.md +429 -0
- package/.claude/agents/optimization/performance-monitor.md +670 -0
- package/.claude/agents/optimization/resource-allocator.md +672 -0
- package/.claude/agents/optimization/topology-optimizer.md +806 -0
- package/.claude/agents/paid-media/paid-media-auditor.md +71 -0
- package/.claude/agents/paid-media/paid-media-creative-strategist.md +71 -0
- package/.claude/agents/paid-media/paid-media-paid-social-strategist.md +71 -0
- package/.claude/agents/paid-media/paid-media-ppc-strategist.md +71 -0
- package/.claude/agents/paid-media/paid-media-programmatic-buyer.md +71 -0
- package/.claude/agents/paid-media/paid-media-search-query-analyst.md +71 -0
- package/.claude/agents/paid-media/paid-media-tracking-specialist.md +71 -0
- package/.claude/agents/payments/agentic-payments.md +126 -0
- package/.claude/agents/product/product-behavioral-nudge-engine.md +81 -0
- package/.claude/agents/product/product-feedback-synthesizer.md +119 -0
- package/.claude/agents/product/product-manager.md +469 -0
- package/.claude/agents/product/product-sprint-prioritizer.md +154 -0
- package/.claude/agents/product/product-trend-researcher.md +159 -0
- package/.claude/agents/project-management/project-management-experiment-tracker.md +199 -0
- package/.claude/agents/project-management/project-management-jira-workflow-steward.md +231 -0
- package/.claude/agents/project-management/project-management-project-shepherd.md +195 -0
- package/.claude/agents/project-management/project-management-studio-operations.md +201 -0
- package/.claude/agents/project-management/project-management-studio-producer.md +204 -0
- package/.claude/agents/project-management/project-manager-senior.md +136 -0
- package/.claude/agents/reasoning/agent.md +804 -0
- package/.claude/agents/reasoning/goal-planner.md +73 -0
- package/.claude/agents/sales/sales-account-strategist.md +228 -0
- package/.claude/agents/sales/sales-coach.md +272 -0
- package/.claude/agents/sales/sales-deal-strategist.md +181 -0
- package/.claude/agents/sales/sales-discovery-coach.md +226 -0
- package/.claude/agents/sales/sales-engineer.md +183 -0
- package/.claude/agents/sales/sales-outbound-strategist.md +202 -0
- package/.claude/agents/sales/sales-pipeline-analyst.md +268 -0
- package/.claude/agents/sales/sales-proposal-strategist.md +218 -0
- package/.claude/agents/schemas/architecture-output.json +43 -0
- package/.claude/agents/schemas/code-review-output.json +28 -0
- package/.claude/agents/schemas/generic-task-input.json +12 -0
- package/.claude/agents/schemas/implementation-output.json +18 -0
- package/.claude/agents/schemas/research-output.json +31 -0
- package/.claude/agents/schemas/security-audit-output.json +29 -0
- package/.claude/agents/schemas/test-report-output.json +29 -0
- package/.claude/agents/sona/sona-learning-optimizer.md +65 -0
- package/.claude/agents/sparc/architecture.md +453 -0
- package/.claude/agents/sparc/pseudocode.md +299 -0
- package/.claude/agents/sparc/refinement.md +504 -0
- package/.claude/agents/sparc/specification.md +258 -0
- package/.claude/agents/spatial-computing/macos-spatial-metal-engineer.md +338 -0
- package/.claude/agents/spatial-computing/terminal-integration-specialist.md +71 -0
- package/.claude/agents/spatial-computing/visionos-spatial-engineer.md +55 -0
- package/.claude/agents/specialized/accounts-payable-agent.md +186 -0
- package/.claude/agents/specialized/agentic-identity-trust.md +388 -0
- package/.claude/agents/specialized/agents-orchestrator.md +368 -0
- package/.claude/agents/specialized/automation-governance-architect.md +217 -0
- package/.claude/agents/specialized/blockchain-security-auditor.md +497 -0
- package/.claude/agents/specialized/compliance-auditor.md +159 -0
- package/.claude/agents/specialized/corporate-training-designer.md +193 -0
- package/.claude/agents/specialized/data-consolidation-agent.md +61 -0
- package/.claude/agents/specialized/government-digital-presales-consultant.md +364 -0
- package/.claude/agents/specialized/healthcare-marketing-compliance.md +396 -0
- package/.claude/agents/specialized/identity-graph-operator.md +261 -0
- package/.claude/agents/specialized/lsp-index-engineer.md +315 -0
- package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +89 -0
- package/.claude/agents/specialized/recruitment-specialist.md +510 -0
- package/.claude/agents/specialized/report-distribution-agent.md +66 -0
- package/.claude/agents/specialized/sales-data-extraction-agent.md +68 -0
- package/.claude/agents/specialized/specialized-cultural-intelligence-strategist.md +89 -0
- package/.claude/agents/specialized/specialized-developer-advocate.md +318 -0
- package/.claude/agents/specialized/specialized-document-generator.md +56 -0
- package/.claude/agents/specialized/specialized-french-consulting-market.md +193 -0
- package/.claude/agents/specialized/specialized-korean-business-navigator.md +217 -0
- package/.claude/agents/specialized/specialized-mcp-builder.md +64 -0
- package/.claude/agents/specialized/specialized-model-qa.md +489 -0
- package/.claude/agents/specialized/specialized-salesforce-architect.md +181 -0
- package/.claude/agents/specialized/specialized-workflow-architect.md +598 -0
- package/.claude/agents/specialized/study-abroad-advisor.md +283 -0
- package/.claude/agents/specialized/supply-chain-strategist.md +583 -0
- package/.claude/agents/specialized/zk-steward.md +212 -0
- package/.claude/agents/sublinear/consensus-coordinator.md +333 -0
- package/.claude/agents/sublinear/matrix-optimizer.md +180 -0
- package/.claude/agents/sublinear/pagerank-analyzer.md +295 -0
- package/.claude/agents/sublinear/performance-optimizer.md +363 -0
- package/.claude/agents/sublinear/trading-predictor.md +242 -0
- package/.claude/agents/support/support-analytics-reporter.md +366 -0
- package/.claude/agents/support/support-executive-summary-generator.md +213 -0
- package/.claude/agents/support/support-finance-tracker.md +443 -0
- package/.claude/agents/support/support-infrastructure-maintainer.md +619 -0
- package/.claude/agents/support/support-legal-compliance-checker.md +589 -0
- package/.claude/agents/support/support-support-responder.md +586 -0
- package/.claude/agents/swarm/adaptive-coordinator.md +364 -0
- package/.claude/agents/swarm/hierarchical-coordinator.md +318 -0
- package/.claude/agents/swarm/mesh-coordinator.md +363 -0
- package/.claude/agents/templates/automation-smart-agent.md +185 -0
- package/.claude/agents/templates/coordinator-swarm-init.md +83 -0
- package/.claude/agents/templates/github-pr-manager.md +155 -0
- package/.claude/agents/templates/implementer-sparc-coder.md +231 -0
- package/.claude/agents/templates/memory-coordinator.md +163 -0
- package/.claude/agents/templates/migration-plan.md +724 -0
- package/.claude/agents/templates/orchestrator-task.md +120 -0
- package/.claude/agents/templates/performance-analyzer.md +179 -0
- package/.claude/agents/templates/sparc-coordinator.md +163 -0
- package/.claude/agents/testing/production-validator.md +374 -0
- package/.claude/agents/testing/tdd-london-swarm.md +241 -0
- package/.claude/agents/testing/testing-accessibility-auditor.md +322 -0
- package/.claude/agents/testing/testing-api-tester.md +307 -0
- package/.claude/agents/testing/testing-evidence-collector.md +211 -0
- package/.claude/agents/testing/testing-performance-benchmarker.md +269 -0
- package/.claude/agents/testing/testing-reality-checker.md +237 -0
- package/.claude/agents/testing/testing-test-results-analyzer.md +306 -0
- package/.claude/agents/testing/testing-tool-evaluator.md +395 -0
- package/.claude/agents/testing/testing-workflow-optimizer.md +451 -0
- package/.claude/agents/v3/integration-architect.md +338 -0
- package/.claude/agents/v3/memory-specialist.md +298 -0
- package/.claude/agents/v3/performance-engineer.md +387 -0
- package/.claude/agents/v3/queen-coordinator.md +67 -0
- package/.claude/agents/v3/security-architect.md +154 -0
- package/.claude/commands/agents/README.md +10 -0
- package/.claude/commands/agents/agent-capabilities.md +21 -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 +26 -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/browse.md +27 -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 +550 -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 +355 -0
- package/.claude/commands/github/release-swarm.md +590 -0
- package/.claude/commands/github/repo-analyze.md +25 -0
- package/.claude/commands/github/repo-architect.md +381 -0
- package/.claude/commands/github/swarm-issue.md +482 -0
- package/.claude/commands/github/swarm-pr.md +310 -0
- package/.claude/commands/github/sync-coordinator.md +301 -0
- package/.claude/commands/github/workflow-automation.md +468 -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/list-agents.md +17 -0
- package/.claude/commands/mastermind.md +121 -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/metrics.md +11 -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/monobrain-help.md +103 -0
- package/.claude/commands/monobrain-memory.md +107 -0
- package/.claude/commands/monobrain-swarm.md +205 -0
- package/.claude/commands/monomind-do.md +276 -0
- package/.claude/commands/monomind-idea.md +269 -0
- package/.claude/commands/monomind-repeat.md +95 -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-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/sparc.md +166 -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-modes.md +8 -0
- package/.claude/commands/swarm/swarm-monitor.md +8 -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 +27 -0
- package/.claude/commands/swarm/testing.md +131 -0
- package/.claude/commands/tokens.md +13 -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 +74 -0
- package/.claude/commands/training/neural-train.md +25 -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/ts.md +9 -0
- package/.claude/commands/use-agent.md +67 -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 +105 -0
- package/.claude/helpers/auto-memory-hook.mjs +369 -0
- package/.claude/helpers/context-persistence-hook.mjs +1988 -0
- package/.claude/helpers/extras-registry.json +3028 -0
- package/.claude/helpers/graphify-freshen.cjs +109 -0
- package/.claude/helpers/hook-handler.cjs +1446 -0
- package/.claude/helpers/intelligence.cjs +227 -0
- package/.claude/helpers/learning-service.mjs +1144 -0
- package/.claude/helpers/memory-palace.cjs +401 -0
- package/.claude/helpers/memory.cjs +84 -0
- package/.claude/helpers/metrics-db.mjs +488 -0
- package/.claude/helpers/router.cjs +306 -0
- package/.claude/helpers/session.cjs +125 -0
- package/.claude/helpers/skill-registry.json +961 -0
- package/.claude/helpers/statusline.cjs +1276 -0
- package/.claude/helpers/swarm-hooks.sh +761 -0
- package/.claude/helpers/toggle-statusline.cjs +58 -0
- package/.claude/helpers/token-tracker.cjs +934 -0
- package/.claude/skills/agent-browser-testing/SKILL.md +312 -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/agentic-jujutsu/SKILL.md +645 -0
- package/.claude/skills/github-code-review/SKILL.md +1148 -0
- package/.claude/skills/github-multi-repo/SKILL.md +916 -0
- package/.claude/skills/github-project-management/SKILL.md +1250 -0
- package/.claude/skills/github-release-management/SKILL.md +1124 -0
- package/.claude/skills/github-workflow-automation/SKILL.md +1111 -0
- package/.claude/skills/hive-mind-advanced/SKILL.md +709 -0
- package/.claude/skills/hooks-automation/SKILL.md +1200 -0
- package/.claude/skills/pair-programming/SKILL.md +1202 -0
- package/.claude/skills/performance-analysis/SKILL.md +560 -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/specialagent/SKILL.md +208 -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 +941 -0
- package/.claude/skills/v3-core-implementation/SKILL.md +867 -0
- package/.claude/skills/v3-ddd-architecture/SKILL.md +451 -0
- package/.claude/skills/v3-integration-deep/SKILL.md +258 -0
- package/.claude/skills/v3-mcp-optimization/SKILL.md +816 -0
- package/.claude/skills/v3-memory-unification/SKILL.md +180 -0
- package/.claude/skills/v3-performance-optimization/SKILL.md +408 -0
- package/.claude/skills/v3-security-overhaul/SKILL.md +91 -0
- package/.claude/skills/v3-swarm-coordination/SKILL.md +433 -0
- package/.claude/skills/verification-quality/SKILL.md +674 -0
- package/README.md +687 -0
- package/bin/cli.js +156 -0
- package/bin/mcp-server.js +189 -0
- package/bin/preinstall.cjs +2 -0
- package/dist/src/agents/halt-signal.d.ts +25 -0
- package/dist/src/agents/halt-signal.d.ts.map +1 -0
- package/dist/src/agents/halt-signal.js +50 -0
- package/dist/src/agents/halt-signal.js.map +1 -0
- package/dist/src/agents/index.d.ts +18 -0
- package/dist/src/agents/index.d.ts.map +1 -0
- package/dist/src/agents/index.js +13 -0
- package/dist/src/agents/index.js.map +1 -0
- package/dist/src/agents/managed-agent.d.ts +41 -0
- package/dist/src/agents/managed-agent.d.ts.map +1 -0
- package/dist/src/agents/managed-agent.js +66 -0
- package/dist/src/agents/managed-agent.js.map +1 -0
- package/dist/src/agents/prompt-experiment.d.ts +22 -0
- package/dist/src/agents/prompt-experiment.d.ts.map +1 -0
- package/dist/src/agents/prompt-experiment.js +49 -0
- package/dist/src/agents/prompt-experiment.js.map +1 -0
- package/dist/src/agents/prompt-version-manager.d.ts +19 -0
- package/dist/src/agents/prompt-version-manager.d.ts.map +1 -0
- package/dist/src/agents/prompt-version-manager.js +58 -0
- package/dist/src/agents/prompt-version-manager.js.map +1 -0
- package/dist/src/agents/registry-builder.d.ts +36 -0
- package/dist/src/agents/registry-builder.d.ts.map +1 -0
- package/dist/src/agents/registry-builder.js +200 -0
- package/dist/src/agents/registry-builder.js.map +1 -0
- package/dist/src/agents/registry-query.d.ts +71 -0
- package/dist/src/agents/registry-query.d.ts.map +1 -0
- package/dist/src/agents/registry-query.js +125 -0
- package/dist/src/agents/registry-query.js.map +1 -0
- package/dist/src/agents/score-decay.d.ts +19 -0
- package/dist/src/agents/score-decay.d.ts.map +1 -0
- package/dist/src/agents/score-decay.js +22 -0
- package/dist/src/agents/score-decay.js.map +1 -0
- package/dist/src/agents/shared-instructions-loader.d.ts +13 -0
- package/dist/src/agents/shared-instructions-loader.d.ts.map +1 -0
- package/dist/src/agents/shared-instructions-loader.js +40 -0
- package/dist/src/agents/shared-instructions-loader.js.map +1 -0
- package/dist/src/agents/specialization-scorer.d.ts +54 -0
- package/dist/src/agents/specialization-scorer.d.ts.map +1 -0
- package/dist/src/agents/specialization-scorer.js +204 -0
- package/dist/src/agents/specialization-scorer.js.map +1 -0
- package/dist/src/agents/termination-watcher.d.ts +30 -0
- package/dist/src/agents/termination-watcher.d.ts.map +1 -0
- package/dist/src/agents/termination-watcher.js +84 -0
- package/dist/src/agents/termination-watcher.js.map +1 -0
- package/dist/src/agents/trigger-index.d.ts +20 -0
- package/dist/src/agents/trigger-index.d.ts.map +1 -0
- package/dist/src/agents/trigger-index.js +38 -0
- package/dist/src/agents/trigger-index.js.map +1 -0
- package/dist/src/agents/trigger-scanner.d.ts +62 -0
- package/dist/src/agents/trigger-scanner.d.ts.map +1 -0
- package/dist/src/agents/trigger-scanner.js +260 -0
- package/dist/src/agents/trigger-scanner.js.map +1 -0
- package/dist/src/agents/version-diff.d.ts +18 -0
- package/dist/src/agents/version-diff.d.ts.map +1 -0
- package/dist/src/agents/version-diff.js +64 -0
- package/dist/src/agents/version-diff.js.map +1 -0
- package/dist/src/agents/version-store.d.ts +61 -0
- package/dist/src/agents/version-store.d.ts.map +1 -0
- package/dist/src/agents/version-store.js +212 -0
- package/dist/src/agents/version-store.js.map +1 -0
- package/dist/src/autopilot-state.d.ts +77 -0
- package/dist/src/autopilot-state.d.ts.map +1 -0
- package/dist/src/autopilot-state.js +279 -0
- package/dist/src/autopilot-state.js.map +1 -0
- package/dist/src/benchmarks/benchmark-runner.d.ts +82 -0
- package/dist/src/benchmarks/benchmark-runner.d.ts.map +1 -0
- package/dist/src/benchmarks/benchmark-runner.js +261 -0
- package/dist/src/benchmarks/benchmark-runner.js.map +1 -0
- package/dist/src/benchmarks/metric-evaluators.d.ts +35 -0
- package/dist/src/benchmarks/metric-evaluators.d.ts.map +1 -0
- package/dist/src/benchmarks/metric-evaluators.js +91 -0
- package/dist/src/benchmarks/metric-evaluators.js.map +1 -0
- package/dist/src/benchmarks/pretrain/index.d.ts +58 -0
- package/dist/src/benchmarks/pretrain/index.d.ts.map +1 -0
- package/dist/src/benchmarks/pretrain/index.js +404 -0
- package/dist/src/benchmarks/pretrain/index.js.map +1 -0
- package/dist/src/commands/agent-wasm.d.ts +14 -0
- package/dist/src/commands/agent-wasm.d.ts.map +1 -0
- package/dist/src/commands/agent-wasm.js +333 -0
- package/dist/src/commands/agent-wasm.js.map +1 -0
- package/dist/src/commands/agent.d.ts +8 -0
- package/dist/src/commands/agent.d.ts.map +1 -0
- package/dist/src/commands/agent.js +941 -0
- package/dist/src/commands/agent.js.map +1 -0
- package/dist/src/commands/analyze.d.ts +19 -0
- package/dist/src/commands/analyze.d.ts.map +1 -0
- package/dist/src/commands/analyze.js +2048 -0
- package/dist/src/commands/analyze.js.map +1 -0
- package/dist/src/commands/appliance-advanced.d.ts +9 -0
- package/dist/src/commands/appliance-advanced.d.ts.map +1 -0
- package/dist/src/commands/appliance-advanced.js +215 -0
- package/dist/src/commands/appliance-advanced.js.map +1 -0
- package/dist/src/commands/appliance.d.ts +8 -0
- package/dist/src/commands/appliance.d.ts.map +1 -0
- package/dist/src/commands/appliance.js +406 -0
- package/dist/src/commands/appliance.js.map +1 -0
- package/dist/src/commands/autopilot.d.ts +15 -0
- package/dist/src/commands/autopilot.d.ts.map +1 -0
- package/dist/src/commands/autopilot.js +362 -0
- package/dist/src/commands/autopilot.js.map +1 -0
- package/dist/src/commands/benchmark.d.ts +10 -0
- package/dist/src/commands/benchmark.d.ts.map +1 -0
- package/dist/src/commands/benchmark.js +460 -0
- package/dist/src/commands/benchmark.js.map +1 -0
- package/dist/src/commands/claims.d.ts +10 -0
- package/dist/src/commands/claims.d.ts.map +1 -0
- package/dist/src/commands/claims.js +624 -0
- package/dist/src/commands/claims.js.map +1 -0
- package/dist/src/commands/cleanup.d.ts +13 -0
- package/dist/src/commands/cleanup.d.ts.map +1 -0
- package/dist/src/commands/cleanup.js +218 -0
- package/dist/src/commands/cleanup.js.map +1 -0
- package/dist/src/commands/completions.d.ts +10 -0
- package/dist/src/commands/completions.d.ts.map +1 -0
- package/dist/src/commands/completions.js +539 -0
- package/dist/src/commands/completions.js.map +1 -0
- package/dist/src/commands/config.d.ts +8 -0
- package/dist/src/commands/config.d.ts.map +1 -0
- package/dist/src/commands/config.js +428 -0
- package/dist/src/commands/config.js.map +1 -0
- package/dist/src/commands/daemon.d.ts +8 -0
- package/dist/src/commands/daemon.d.ts.map +1 -0
- package/dist/src/commands/daemon.js +669 -0
- package/dist/src/commands/daemon.js.map +1 -0
- package/dist/src/commands/deployment.d.ts +10 -0
- package/dist/src/commands/deployment.d.ts.map +1 -0
- package/dist/src/commands/deployment.js +672 -0
- package/dist/src/commands/deployment.js.map +1 -0
- package/dist/src/commands/doctor.d.ts +10 -0
- package/dist/src/commands/doctor.d.ts.map +1 -0
- package/dist/src/commands/doctor.js +619 -0
- package/dist/src/commands/doctor.js.map +1 -0
- package/dist/src/commands/embeddings.d.ts +18 -0
- package/dist/src/commands/embeddings.d.ts.map +1 -0
- package/dist/src/commands/embeddings.js +1576 -0
- package/dist/src/commands/embeddings.js.map +1 -0
- package/dist/src/commands/guidance.d.ts +8 -0
- package/dist/src/commands/guidance.d.ts.map +1 -0
- package/dist/src/commands/guidance.js +560 -0
- package/dist/src/commands/guidance.js.map +1 -0
- package/dist/src/commands/hive-mind.d.ts +11 -0
- package/dist/src/commands/hive-mind.d.ts.map +1 -0
- package/dist/src/commands/hive-mind.js +1237 -0
- package/dist/src/commands/hive-mind.js.map +1 -0
- package/dist/src/commands/hooks.d.ts +8 -0
- package/dist/src/commands/hooks.d.ts.map +1 -0
- package/dist/src/commands/hooks.js +4442 -0
- package/dist/src/commands/hooks.js.map +1 -0
- package/dist/src/commands/index.d.ts +117 -0
- package/dist/src/commands/index.d.ts.map +1 -0
- package/dist/src/commands/index.js +391 -0
- package/dist/src/commands/index.js.map +1 -0
- package/dist/src/commands/init.d.ts +8 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +817 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/issues.d.ts +21 -0
- package/dist/src/commands/issues.d.ts.map +1 -0
- package/dist/src/commands/issues.js +567 -0
- package/dist/src/commands/issues.js.map +1 -0
- package/dist/src/commands/mcp.d.ts +11 -0
- package/dist/src/commands/mcp.d.ts.map +1 -0
- package/dist/src/commands/mcp.js +718 -0
- package/dist/src/commands/mcp.js.map +1 -0
- package/dist/src/commands/memory.d.ts +8 -0
- package/dist/src/commands/memory.d.ts.map +1 -0
- package/dist/src/commands/memory.js +1565 -0
- package/dist/src/commands/memory.js.map +1 -0
- package/dist/src/commands/migrate.d.ts +8 -0
- package/dist/src/commands/migrate.d.ts.map +1 -0
- package/dist/src/commands/migrate.js +742 -0
- package/dist/src/commands/migrate.js.map +1 -0
- package/dist/src/commands/neural.d.ts +10 -0
- package/dist/src/commands/neural.d.ts.map +1 -0
- package/dist/src/commands/neural.js +1454 -0
- package/dist/src/commands/neural.js.map +1 -0
- package/dist/src/commands/performance.d.ts +10 -0
- package/dist/src/commands/performance.d.ts.map +1 -0
- package/dist/src/commands/performance.js +579 -0
- package/dist/src/commands/performance.js.map +1 -0
- package/dist/src/commands/plugins.d.ts +11 -0
- package/dist/src/commands/plugins.d.ts.map +1 -0
- package/dist/src/commands/plugins.js +820 -0
- package/dist/src/commands/plugins.js.map +1 -0
- package/dist/src/commands/process.d.ts +10 -0
- package/dist/src/commands/process.d.ts.map +1 -0
- package/dist/src/commands/process.js +695 -0
- package/dist/src/commands/process.js.map +1 -0
- package/dist/src/commands/progress.d.ts +11 -0
- package/dist/src/commands/progress.d.ts.map +1 -0
- package/dist/src/commands/progress.js +259 -0
- package/dist/src/commands/progress.js.map +1 -0
- package/dist/src/commands/providers.d.ts +10 -0
- package/dist/src/commands/providers.d.ts.map +1 -0
- package/dist/src/commands/providers.js +359 -0
- package/dist/src/commands/providers.js.map +1 -0
- package/dist/src/commands/replay.d.ts +8 -0
- package/dist/src/commands/replay.d.ts.map +1 -0
- package/dist/src/commands/replay.js +60 -0
- package/dist/src/commands/replay.js.map +1 -0
- package/dist/src/commands/route.d.ts +16 -0
- package/dist/src/commands/route.d.ts.map +1 -0
- package/dist/src/commands/route.js +907 -0
- package/dist/src/commands/route.js.map +1 -0
- package/dist/src/commands/ruvector/backup.d.ts +11 -0
- package/dist/src/commands/ruvector/backup.d.ts.map +1 -0
- package/dist/src/commands/ruvector/backup.js +746 -0
- package/dist/src/commands/ruvector/backup.js.map +1 -0
- package/dist/src/commands/ruvector/benchmark.d.ts +11 -0
- package/dist/src/commands/ruvector/benchmark.d.ts.map +1 -0
- package/dist/src/commands/ruvector/benchmark.js +489 -0
- package/dist/src/commands/ruvector/benchmark.js.map +1 -0
- package/dist/src/commands/ruvector/import.d.ts +18 -0
- package/dist/src/commands/ruvector/import.d.ts.map +1 -0
- package/dist/src/commands/ruvector/import.js +349 -0
- package/dist/src/commands/ruvector/import.js.map +1 -0
- package/dist/src/commands/ruvector/index.d.ts +29 -0
- package/dist/src/commands/ruvector/index.d.ts.map +1 -0
- package/dist/src/commands/ruvector/index.js +129 -0
- package/dist/src/commands/ruvector/index.js.map +1 -0
- package/dist/src/commands/ruvector/init.d.ts +11 -0
- package/dist/src/commands/ruvector/init.d.ts.map +1 -0
- package/dist/src/commands/ruvector/init.js +466 -0
- package/dist/src/commands/ruvector/init.js.map +1 -0
- package/dist/src/commands/ruvector/migrate.d.ts +11 -0
- package/dist/src/commands/ruvector/migrate.d.ts.map +1 -0
- package/dist/src/commands/ruvector/migrate.js +497 -0
- package/dist/src/commands/ruvector/migrate.js.map +1 -0
- package/dist/src/commands/ruvector/optimize.d.ts +11 -0
- package/dist/src/commands/ruvector/optimize.d.ts.map +1 -0
- package/dist/src/commands/ruvector/optimize.js +504 -0
- package/dist/src/commands/ruvector/optimize.js.map +1 -0
- package/dist/src/commands/ruvector/setup.d.ts +18 -0
- package/dist/src/commands/ruvector/setup.d.ts.map +1 -0
- package/dist/src/commands/ruvector/setup.js +765 -0
- package/dist/src/commands/ruvector/setup.js.map +1 -0
- package/dist/src/commands/ruvector/status.d.ts +11 -0
- package/dist/src/commands/ruvector/status.d.ts.map +1 -0
- package/dist/src/commands/ruvector/status.js +478 -0
- package/dist/src/commands/ruvector/status.js.map +1 -0
- package/dist/src/commands/security.d.ts +10 -0
- package/dist/src/commands/security.d.ts.map +1 -0
- package/dist/src/commands/security.js +794 -0
- package/dist/src/commands/security.js.map +1 -0
- package/dist/src/commands/session.d.ts +8 -0
- package/dist/src/commands/session.d.ts.map +1 -0
- package/dist/src/commands/session.js +750 -0
- package/dist/src/commands/session.js.map +1 -0
- package/dist/src/commands/start.d.ts +8 -0
- package/dist/src/commands/start.d.ts.map +1 -0
- package/dist/src/commands/start.js +418 -0
- package/dist/src/commands/start.js.map +1 -0
- package/dist/src/commands/status.d.ts +8 -0
- package/dist/src/commands/status.d.ts.map +1 -0
- package/dist/src/commands/status.js +591 -0
- package/dist/src/commands/status.js.map +1 -0
- package/dist/src/commands/swarm.d.ts +8 -0
- package/dist/src/commands/swarm.d.ts.map +1 -0
- package/dist/src/commands/swarm.js +801 -0
- package/dist/src/commands/swarm.js.map +1 -0
- package/dist/src/commands/task.d.ts +8 -0
- package/dist/src/commands/task.d.ts.map +1 -0
- package/dist/src/commands/task.js +671 -0
- package/dist/src/commands/task.js.map +1 -0
- package/dist/src/commands/tokens.d.ts +8 -0
- package/dist/src/commands/tokens.d.ts.map +1 -0
- package/dist/src/commands/tokens.js +107 -0
- package/dist/src/commands/tokens.js.map +1 -0
- package/dist/src/commands/transfer-store.d.ts +13 -0
- package/dist/src/commands/transfer-store.d.ts.map +1 -0
- package/dist/src/commands/transfer-store.js +428 -0
- package/dist/src/commands/transfer-store.js.map +1 -0
- package/dist/src/commands/ui.js +68 -0
- package/dist/src/commands/update.d.ts +8 -0
- package/dist/src/commands/update.d.ts.map +1 -0
- package/dist/src/commands/update.js +276 -0
- package/dist/src/commands/update.js.map +1 -0
- package/dist/src/commands/workflow.d.ts +8 -0
- package/dist/src/commands/workflow.d.ts.map +1 -0
- package/dist/src/commands/workflow.js +617 -0
- package/dist/src/commands/workflow.js.map +1 -0
- package/dist/src/config-adapter.d.ts +15 -0
- package/dist/src/config-adapter.d.ts.map +1 -0
- package/dist/src/config-adapter.js +186 -0
- package/dist/src/config-adapter.js.map +1 -0
- package/dist/src/consensus/audit-writer.d.ts +50 -0
- package/dist/src/consensus/audit-writer.d.ts.map +1 -0
- package/dist/src/consensus/audit-writer.js +109 -0
- package/dist/src/consensus/audit-writer.js.map +1 -0
- package/dist/src/consensus/index.d.ts +7 -0
- package/dist/src/consensus/index.d.ts.map +1 -0
- package/dist/src/consensus/index.js +6 -0
- package/dist/src/consensus/index.js.map +1 -0
- package/dist/src/consensus/vote-signer.d.ts +39 -0
- package/dist/src/consensus/vote-signer.d.ts.map +1 -0
- package/dist/src/consensus/vote-signer.js +63 -0
- package/dist/src/consensus/vote-signer.js.map +1 -0
- package/dist/src/context/context-provider.d.ts +44 -0
- package/dist/src/context/context-provider.d.ts.map +1 -0
- package/dist/src/context/context-provider.js +25 -0
- package/dist/src/context/context-provider.js.map +1 -0
- package/dist/src/context/git-state-provider.d.ts +12 -0
- package/dist/src/context/git-state-provider.d.ts.map +1 -0
- package/dist/src/context/git-state-provider.js +34 -0
- package/dist/src/context/git-state-provider.js.map +1 -0
- package/dist/src/context/index.d.ts +12 -0
- package/dist/src/context/index.d.ts.map +1 -0
- package/dist/src/context/index.js +12 -0
- package/dist/src/context/index.js.map +1 -0
- package/dist/src/context/project-conventions-provider.d.ts +15 -0
- package/dist/src/context/project-conventions-provider.d.ts.map +1 -0
- package/dist/src/context/project-conventions-provider.js +19 -0
- package/dist/src/context/project-conventions-provider.js.map +1 -0
- package/dist/src/context/prompt-assembler.d.ts +26 -0
- package/dist/src/context/prompt-assembler.d.ts.map +1 -0
- package/dist/src/context/prompt-assembler.js +93 -0
- package/dist/src/context/prompt-assembler.js.map +1 -0
- package/dist/src/context/task-history-provider.d.ts +24 -0
- package/dist/src/context/task-history-provider.d.ts.map +1 -0
- package/dist/src/context/task-history-provider.js +32 -0
- package/dist/src/context/task-history-provider.js.map +1 -0
- package/dist/src/context/user-preferences-provider.d.ts +14 -0
- package/dist/src/context/user-preferences-provider.d.ts.map +1 -0
- package/dist/src/context/user-preferences-provider.js +27 -0
- package/dist/src/context/user-preferences-provider.js.map +1 -0
- package/dist/src/dlq/dlq-reader.d.ts +29 -0
- package/dist/src/dlq/dlq-reader.d.ts.map +1 -0
- package/dist/src/dlq/dlq-reader.js +64 -0
- package/dist/src/dlq/dlq-reader.js.map +1 -0
- package/dist/src/dlq/dlq-replayer.d.ts +20 -0
- package/dist/src/dlq/dlq-replayer.d.ts.map +1 -0
- package/dist/src/dlq/dlq-replayer.js +56 -0
- package/dist/src/dlq/dlq-replayer.js.map +1 -0
- package/dist/src/dlq/dlq-writer.d.ts +24 -0
- package/dist/src/dlq/dlq-writer.d.ts.map +1 -0
- package/dist/src/dlq/dlq-writer.js +43 -0
- package/dist/src/dlq/dlq-writer.js.map +1 -0
- package/dist/src/dlq/index.d.ts +10 -0
- package/dist/src/dlq/index.d.ts.map +1 -0
- package/dist/src/dlq/index.js +7 -0
- package/dist/src/dlq/index.js.map +1 -0
- package/dist/src/eval/dataset-manager.d.ts +33 -0
- package/dist/src/eval/dataset-manager.d.ts.map +1 -0
- package/dist/src/eval/dataset-manager.js +97 -0
- package/dist/src/eval/dataset-manager.js.map +1 -0
- package/dist/src/eval/dataset-runner.d.ts +23 -0
- package/dist/src/eval/dataset-runner.d.ts.map +1 -0
- package/dist/src/eval/dataset-runner.js +59 -0
- package/dist/src/eval/dataset-runner.js.map +1 -0
- package/dist/src/eval/index.d.ts +10 -0
- package/dist/src/eval/index.d.ts.map +1 -0
- package/dist/src/eval/index.js +7 -0
- package/dist/src/eval/index.js.map +1 -0
- package/dist/src/eval/trace-collector.d.ts +40 -0
- package/dist/src/eval/trace-collector.d.ts.map +1 -0
- package/dist/src/eval/trace-collector.js +82 -0
- package/dist/src/eval/trace-collector.js.map +1 -0
- package/dist/src/graph/enrich.mjs +362 -0
- package/dist/src/index.d.ts +82 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +578 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
- package/dist/src/infrastructure/in-memory-repositories.d.ts.map +1 -0
- package/dist/src/infrastructure/in-memory-repositories.js +264 -0
- package/dist/src/infrastructure/in-memory-repositories.js.map +1 -0
- package/dist/src/init/claudemd-generator.d.ts +25 -0
- package/dist/src/init/claudemd-generator.d.ts.map +1 -0
- package/dist/src/init/claudemd-generator.js +522 -0
- package/dist/src/init/claudemd-generator.js.map +1 -0
- package/dist/src/init/executor.d.ts +38 -0
- package/dist/src/init/executor.d.ts.map +1 -0
- package/dist/src/init/executor.js +1919 -0
- package/dist/src/init/executor.js.map +1 -0
- package/dist/src/init/helpers-generator.d.ts +60 -0
- package/dist/src/init/helpers-generator.d.ts.map +1 -0
- package/dist/src/init/helpers-generator.js +1222 -0
- package/dist/src/init/helpers-generator.js.map +1 -0
- package/dist/src/init/index.d.ts +13 -0
- package/dist/src/init/index.d.ts.map +1 -0
- package/dist/src/init/index.js +15 -0
- package/dist/src/init/index.js.map +1 -0
- package/dist/src/init/mcp-generator.d.ts +26 -0
- package/dist/src/init/mcp-generator.d.ts.map +1 -0
- package/dist/src/init/mcp-generator.js +99 -0
- package/dist/src/init/mcp-generator.js.map +1 -0
- package/dist/src/init/settings-generator.d.ts +14 -0
- package/dist/src/init/settings-generator.d.ts.map +1 -0
- package/dist/src/init/settings-generator.js +392 -0
- package/dist/src/init/settings-generator.js.map +1 -0
- package/dist/src/init/statusline-generator.d.ts +25 -0
- package/dist/src/init/statusline-generator.d.ts.map +1 -0
- package/dist/src/init/statusline-generator.js +1157 -0
- package/dist/src/init/statusline-generator.js.map +1 -0
- package/dist/src/init/types.d.ts +291 -0
- package/dist/src/init/types.d.ts.map +1 -0
- package/dist/src/init/types.js +258 -0
- package/dist/src/init/types.js.map +1 -0
- package/dist/src/interactive/interrupt.d.ts +22 -0
- package/dist/src/interactive/interrupt.d.ts.map +1 -0
- package/dist/src/interactive/interrupt.js +66 -0
- package/dist/src/interactive/interrupt.js.map +1 -0
- package/dist/src/mcp/deprecation-injector.d.ts +25 -0
- package/dist/src/mcp/deprecation-injector.d.ts.map +1 -0
- package/dist/src/mcp/deprecation-injector.js +48 -0
- package/dist/src/mcp/deprecation-injector.js.map +1 -0
- package/dist/src/mcp/tool-registry.d.ts +61 -0
- package/dist/src/mcp/tool-registry.d.ts.map +1 -0
- package/dist/src/mcp/tool-registry.js +212 -0
- package/dist/src/mcp/tool-registry.js.map +1 -0
- package/dist/src/mcp-client.d.ts +92 -0
- package/dist/src/mcp-client.d.ts.map +1 -0
- package/dist/src/mcp-client.js +261 -0
- package/dist/src/mcp-client.js.map +1 -0
- package/dist/src/mcp-server.d.ts +163 -0
- package/dist/src/mcp-server.d.ts.map +1 -0
- package/dist/src/mcp-server.js +682 -0
- package/dist/src/mcp-server.js.map +1 -0
- package/dist/src/mcp-tools/a2a-tools.d.ts +14 -0
- package/dist/src/mcp-tools/a2a-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/a2a-tools.js +244 -0
- package/dist/src/mcp-tools/a2a-tools.js.map +1 -0
- package/dist/src/mcp-tools/agent-tools.d.ts +9 -0
- package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/agent-tools.js +564 -0
- package/dist/src/mcp-tools/agent-tools.js.map +1 -0
- package/dist/src/mcp-tools/agentdb-tools.d.ts +30 -0
- package/dist/src/mcp-tools/agentdb-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/agentdb-tools.js +569 -0
- package/dist/src/mcp-tools/agentdb-tools.js.map +1 -0
- package/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
- package/dist/src/mcp-tools/analyze-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/analyze-tools.js +317 -0
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -0
- package/dist/src/mcp-tools/auto-install.d.ts +83 -0
- package/dist/src/mcp-tools/auto-install.d.ts.map +1 -0
- package/dist/src/mcp-tools/auto-install.js +131 -0
- package/dist/src/mcp-tools/auto-install.js.map +1 -0
- package/dist/src/mcp-tools/autopilot-tools.d.ts +12 -0
- package/dist/src/mcp-tools/autopilot-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/autopilot-tools.js +227 -0
- package/dist/src/mcp-tools/autopilot-tools.js.map +1 -0
- package/dist/src/mcp-tools/browser-tools.d.ts +13 -0
- package/dist/src/mcp-tools/browser-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/browser-tools.js +550 -0
- package/dist/src/mcp-tools/browser-tools.js.map +1 -0
- package/dist/src/mcp-tools/claims-tools.d.ts +12 -0
- package/dist/src/mcp-tools/claims-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/claims-tools.js +747 -0
- package/dist/src/mcp-tools/claims-tools.js.map +1 -0
- package/dist/src/mcp-tools/config-tools.d.ts +8 -0
- package/dist/src/mcp-tools/config-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/config-tools.js +353 -0
- package/dist/src/mcp-tools/config-tools.js.map +1 -0
- package/dist/src/mcp-tools/coordination-tools.d.ts +13 -0
- package/dist/src/mcp-tools/coordination-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/coordination-tools.js +673 -0
- package/dist/src/mcp-tools/coordination-tools.js.map +1 -0
- package/dist/src/mcp-tools/daa-tools.d.ts +13 -0
- package/dist/src/mcp-tools/daa-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/daa-tools.js +473 -0
- package/dist/src/mcp-tools/daa-tools.js.map +1 -0
- package/dist/src/mcp-tools/embeddings-tools.d.ts +9 -0
- package/dist/src/mcp-tools/embeddings-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/embeddings-tools.js +782 -0
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -0
- package/dist/src/mcp-tools/github-tools.d.ts +9 -0
- package/dist/src/mcp-tools/github-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/github-tools.js +472 -0
- package/dist/src/mcp-tools/github-tools.js.map +1 -0
- package/dist/src/mcp-tools/graphify-tools.d.ts +73 -0
- package/dist/src/mcp-tools/graphify-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/graphify-tools.js +1235 -0
- package/dist/src/mcp-tools/graphify-tools.js.map +1 -0
- package/dist/src/mcp-tools/guidance-tools.d.ts +15 -0
- package/dist/src/mcp-tools/guidance-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/guidance-tools.js +618 -0
- package/dist/src/mcp-tools/guidance-tools.js.map +1 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/hive-mind-tools.js +877 -0
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts +44 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/hooks-tools.js +3397 -0
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -0
- package/dist/src/mcp-tools/index.d.ts +38 -0
- package/dist/src/mcp-tools/index.d.ts.map +1 -0
- package/dist/src/mcp-tools/index.js +40 -0
- package/dist/src/mcp-tools/index.js.map +1 -0
- package/dist/src/mcp-tools/memory-tools.d.ts +14 -0
- package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/memory-tools.js +514 -0
- package/dist/src/mcp-tools/memory-tools.js.map +1 -0
- package/dist/src/mcp-tools/neural-tools.d.ts +16 -0
- package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/neural-tools.js +634 -0
- package/dist/src/mcp-tools/neural-tools.js.map +1 -0
- package/dist/src/mcp-tools/performance-tools.d.ts +16 -0
- package/dist/src/mcp-tools/performance-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/performance-tools.js +643 -0
- package/dist/src/mcp-tools/performance-tools.js.map +1 -0
- package/dist/src/mcp-tools/progress-tools.d.ts +14 -0
- package/dist/src/mcp-tools/progress-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/progress-tools.js +348 -0
- package/dist/src/mcp-tools/progress-tools.js.map +1 -0
- package/dist/src/mcp-tools/request-tracker.d.ts +17 -0
- package/dist/src/mcp-tools/request-tracker.d.ts.map +1 -0
- package/dist/src/mcp-tools/request-tracker.js +27 -0
- package/dist/src/mcp-tools/request-tracker.js.map +1 -0
- package/dist/src/mcp-tools/ruvllm-tools.d.ts +9 -0
- package/dist/src/mcp-tools/ruvllm-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/ruvllm-tools.js +284 -0
- package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -0
- package/dist/src/mcp-tools/security-tools.d.ts +18 -0
- package/dist/src/mcp-tools/security-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/security-tools.js +434 -0
- package/dist/src/mcp-tools/security-tools.js.map +1 -0
- package/dist/src/mcp-tools/session-tools.d.ts +8 -0
- package/dist/src/mcp-tools/session-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/session-tools.js +338 -0
- package/dist/src/mcp-tools/session-tools.js.map +1 -0
- package/dist/src/mcp-tools/swarm-tools.d.ts +9 -0
- package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/swarm-tools.js +289 -0
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -0
- package/dist/src/mcp-tools/system-tools.d.ts +13 -0
- package/dist/src/mcp-tools/system-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/system-tools.js +551 -0
- package/dist/src/mcp-tools/system-tools.js.map +1 -0
- package/dist/src/mcp-tools/task-tools.d.ts +8 -0
- package/dist/src/mcp-tools/task-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/task-tools.js +406 -0
- package/dist/src/mcp-tools/task-tools.js.map +1 -0
- package/dist/src/mcp-tools/terminal-tools.d.ts +8 -0
- package/dist/src/mcp-tools/terminal-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/terminal-tools.js +260 -0
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -0
- package/dist/src/mcp-tools/transfer-tools.d.ts +14 -0
- package/dist/src/mcp-tools/transfer-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/transfer-tools.js +396 -0
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -0
- package/dist/src/mcp-tools/types.d.ts +37 -0
- package/dist/src/mcp-tools/types.d.ts.map +1 -0
- package/dist/src/mcp-tools/types.js +14 -0
- package/dist/src/mcp-tools/types.js.map +1 -0
- package/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
- package/dist/src/mcp-tools/wasm-agent-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js +230 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.js +562 -0
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -0
- package/dist/src/memory/ewc-consolidation.d.ts +295 -0
- package/dist/src/memory/ewc-consolidation.d.ts.map +1 -0
- package/dist/src/memory/ewc-consolidation.js +601 -0
- package/dist/src/memory/ewc-consolidation.js.map +1 -0
- package/dist/src/memory/intelligence.d.ts +338 -0
- package/dist/src/memory/intelligence.d.ts.map +1 -0
- package/dist/src/memory/intelligence.js +1023 -0
- package/dist/src/memory/intelligence.js.map +1 -0
- package/dist/src/memory/memory-bridge.d.ts +409 -0
- package/dist/src/memory/memory-bridge.d.ts.map +1 -0
- package/dist/src/memory/memory-bridge.js +1561 -0
- package/dist/src/memory/memory-bridge.js.map +1 -0
- package/dist/src/memory/memory-initializer.d.ts +414 -0
- package/dist/src/memory/memory-initializer.d.ts.map +1 -0
- package/dist/src/memory/memory-initializer.js +2222 -0
- package/dist/src/memory/memory-initializer.js.map +1 -0
- package/dist/src/memory/sona-optimizer.d.ts +227 -0
- package/dist/src/memory/sona-optimizer.d.ts.map +1 -0
- package/dist/src/memory/sona-optimizer.js +633 -0
- package/dist/src/memory/sona-optimizer.js.map +1 -0
- package/dist/src/model/complexity-scorer.d.ts +21 -0
- package/dist/src/model/complexity-scorer.d.ts.map +1 -0
- package/dist/src/model/complexity-scorer.js +106 -0
- package/dist/src/model/complexity-scorer.js.map +1 -0
- package/dist/src/model/index.d.ts +4 -0
- package/dist/src/model/index.d.ts.map +1 -0
- package/dist/src/model/index.js +4 -0
- package/dist/src/model/index.js.map +1 -0
- package/dist/src/model/model-settings.d.ts +22 -0
- package/dist/src/model/model-settings.d.ts.map +1 -0
- package/dist/src/model/model-settings.js +33 -0
- package/dist/src/model/model-settings.js.map +1 -0
- package/dist/src/model/model-tier-resolver.d.ts +24 -0
- package/dist/src/model/model-tier-resolver.d.ts.map +1 -0
- package/dist/src/model/model-tier-resolver.js +65 -0
- package/dist/src/model/model-tier-resolver.js.map +1 -0
- package/dist/src/orchestration/index.d.ts +7 -0
- package/dist/src/orchestration/index.d.ts.map +1 -0
- package/dist/src/orchestration/index.js +6 -0
- package/dist/src/orchestration/index.js.map +1 -0
- package/dist/src/orchestration/mode-dispatcher.d.ts +11 -0
- package/dist/src/orchestration/mode-dispatcher.d.ts.map +1 -0
- package/dist/src/orchestration/mode-dispatcher.js +31 -0
- package/dist/src/orchestration/mode-dispatcher.js.map +1 -0
- package/dist/src/orchestration/routing-modes.d.ts +68 -0
- package/dist/src/orchestration/routing-modes.d.ts.map +1 -0
- package/dist/src/orchestration/routing-modes.js +150 -0
- package/dist/src/orchestration/routing-modes.js.map +1 -0
- package/dist/src/output.d.ts +133 -0
- package/dist/src/output.d.ts.map +1 -0
- package/dist/src/output.js +514 -0
- package/dist/src/output.js.map +1 -0
- package/dist/src/parser.d.ts +51 -0
- package/dist/src/parser.d.ts.map +1 -0
- package/dist/src/parser.js +425 -0
- package/dist/src/parser.js.map +1 -0
- package/dist/src/plugins/manager.d.ts +133 -0
- package/dist/src/plugins/manager.d.ts.map +1 -0
- package/dist/src/plugins/manager.js +400 -0
- package/dist/src/plugins/manager.js.map +1 -0
- package/dist/src/plugins/store/discovery.d.ts +88 -0
- package/dist/src/plugins/store/discovery.d.ts.map +1 -0
- package/dist/src/plugins/store/discovery.js +841 -0
- package/dist/src/plugins/store/discovery.js.map +1 -0
- package/dist/src/plugins/store/index.d.ts +76 -0
- package/dist/src/plugins/store/index.d.ts.map +1 -0
- package/dist/src/plugins/store/index.js +141 -0
- package/dist/src/plugins/store/index.js.map +1 -0
- package/dist/src/plugins/store/search.d.ts +46 -0
- package/dist/src/plugins/store/search.d.ts.map +1 -0
- package/dist/src/plugins/store/search.js +230 -0
- package/dist/src/plugins/store/search.js.map +1 -0
- package/dist/src/plugins/store/types.d.ts +274 -0
- package/dist/src/plugins/store/types.d.ts.map +1 -0
- package/dist/src/plugins/store/types.js +7 -0
- package/dist/src/plugins/store/types.js.map +1 -0
- package/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
- package/dist/src/plugins/tests/demo-plugin-store.d.ts.map +1 -0
- package/dist/src/plugins/tests/demo-plugin-store.js +126 -0
- package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -0
- package/dist/src/plugins/tests/standalone-test.d.ts +12 -0
- package/dist/src/plugins/tests/standalone-test.d.ts.map +1 -0
- package/dist/src/plugins/tests/standalone-test.js +188 -0
- package/dist/src/plugins/tests/standalone-test.js.map +1 -0
- package/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
- package/dist/src/plugins/tests/test-plugin-store.d.ts.map +1 -0
- package/dist/src/plugins/tests/test-plugin-store.js +206 -0
- package/dist/src/plugins/tests/test-plugin-store.js.map +1 -0
- package/dist/src/production/circuit-breaker.d.ts +101 -0
- package/dist/src/production/circuit-breaker.d.ts.map +1 -0
- package/dist/src/production/circuit-breaker.js +241 -0
- package/dist/src/production/circuit-breaker.js.map +1 -0
- package/dist/src/production/error-handler.d.ts +92 -0
- package/dist/src/production/error-handler.d.ts.map +1 -0
- package/dist/src/production/error-handler.js +299 -0
- package/dist/src/production/error-handler.js.map +1 -0
- package/dist/src/production/index.d.ts +23 -0
- package/dist/src/production/index.d.ts.map +1 -0
- package/dist/src/production/index.js +18 -0
- package/dist/src/production/index.js.map +1 -0
- package/dist/src/production/monitoring.d.ts +161 -0
- package/dist/src/production/monitoring.d.ts.map +1 -0
- package/dist/src/production/monitoring.js +356 -0
- package/dist/src/production/monitoring.js.map +1 -0
- package/dist/src/production/rate-limiter.d.ts +80 -0
- package/dist/src/production/rate-limiter.d.ts.map +1 -0
- package/dist/src/production/rate-limiter.js +201 -0
- package/dist/src/production/rate-limiter.js.map +1 -0
- package/dist/src/production/retry.d.ts +48 -0
- package/dist/src/production/retry.d.ts.map +1 -0
- package/dist/src/production/retry.js +179 -0
- package/dist/src/production/retry.js.map +1 -0
- package/dist/src/prompt.d.ts +44 -0
- package/dist/src/prompt.d.ts.map +1 -0
- package/dist/src/prompt.js +501 -0
- package/dist/src/prompt.js.map +1 -0
- package/dist/src/runtime/headless.d.ts +60 -0
- package/dist/src/runtime/headless.d.ts.map +1 -0
- package/dist/src/runtime/headless.js +284 -0
- package/dist/src/runtime/headless.js.map +1 -0
- package/dist/src/ruvector/agent-wasm.d.ts +182 -0
- package/dist/src/ruvector/agent-wasm.d.ts.map +1 -0
- package/dist/src/ruvector/agent-wasm.js +316 -0
- package/dist/src/ruvector/agent-wasm.js.map +1 -0
- package/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/dist/src/ruvector/ast-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/ast-analyzer.js +277 -0
- package/dist/src/ruvector/ast-analyzer.js.map +1 -0
- package/dist/src/ruvector/coverage-router.d.ts +160 -0
- package/dist/src/ruvector/coverage-router.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-router.js +529 -0
- package/dist/src/ruvector/coverage-router.js.map +1 -0
- package/dist/src/ruvector/coverage-tools.d.ts +33 -0
- package/dist/src/ruvector/coverage-tools.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-tools.js +157 -0
- package/dist/src/ruvector/coverage-tools.js.map +1 -0
- package/dist/src/ruvector/diff-classifier.d.ts +175 -0
- package/dist/src/ruvector/diff-classifier.d.ts.map +1 -0
- package/dist/src/ruvector/diff-classifier.js +698 -0
- package/dist/src/ruvector/diff-classifier.js.map +1 -0
- package/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
- package/dist/src/ruvector/enhanced-model-router.d.ts.map +1 -0
- package/dist/src/ruvector/enhanced-model-router.js +529 -0
- package/dist/src/ruvector/enhanced-model-router.js.map +1 -0
- package/dist/src/ruvector/flash-attention.d.ts +195 -0
- package/dist/src/ruvector/flash-attention.d.ts.map +1 -0
- package/dist/src/ruvector/flash-attention.js +643 -0
- package/dist/src/ruvector/flash-attention.js.map +1 -0
- package/dist/src/ruvector/graph-analyzer.d.ts +187 -0
- package/dist/src/ruvector/graph-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/graph-analyzer.js +929 -0
- package/dist/src/ruvector/graph-analyzer.js.map +1 -0
- package/dist/src/ruvector/index.d.ts +40 -0
- package/dist/src/ruvector/index.d.ts.map +1 -0
- package/dist/src/ruvector/index.js +76 -0
- package/dist/src/ruvector/index.js.map +1 -0
- package/dist/src/ruvector/lora-adapter.d.ts +218 -0
- package/dist/src/ruvector/lora-adapter.d.ts.map +1 -0
- package/dist/src/ruvector/lora-adapter.js +455 -0
- package/dist/src/ruvector/lora-adapter.js.map +1 -0
- package/dist/src/ruvector/model-router.d.ts +220 -0
- package/dist/src/ruvector/model-router.d.ts.map +1 -0
- package/dist/src/ruvector/model-router.js +488 -0
- package/dist/src/ruvector/model-router.js.map +1 -0
- package/dist/src/ruvector/moe-router.d.ts +206 -0
- package/dist/src/ruvector/moe-router.d.ts.map +1 -0
- package/dist/src/ruvector/moe-router.js +626 -0
- package/dist/src/ruvector/moe-router.js.map +1 -0
- package/dist/src/ruvector/q-learning-router.d.ts +211 -0
- package/dist/src/ruvector/q-learning-router.d.ts.map +1 -0
- package/dist/src/ruvector/q-learning-router.js +681 -0
- package/dist/src/ruvector/q-learning-router.js.map +1 -0
- package/dist/src/ruvector/ruvllm-wasm.d.ts +179 -0
- package/dist/src/ruvector/ruvllm-wasm.d.ts.map +1 -0
- package/dist/src/ruvector/ruvllm-wasm.js +363 -0
- package/dist/src/ruvector/ruvllm-wasm.js.map +1 -0
- package/dist/src/ruvector/semantic-router.d.ts +77 -0
- package/dist/src/ruvector/semantic-router.d.ts.map +1 -0
- package/dist/src/ruvector/semantic-router.js +178 -0
- package/dist/src/ruvector/semantic-router.js.map +1 -0
- package/dist/src/ruvector/vector-db.d.ts +69 -0
- package/dist/src/ruvector/vector-db.d.ts.map +1 -0
- package/dist/src/ruvector/vector-db.js +243 -0
- package/dist/src/ruvector/vector-db.js.map +1 -0
- package/dist/src/services/agentic-flow-bridge.d.ts +50 -0
- package/dist/src/services/agentic-flow-bridge.d.ts.map +1 -0
- package/dist/src/services/agentic-flow-bridge.js +95 -0
- package/dist/src/services/agentic-flow-bridge.js.map +1 -0
- package/dist/src/services/claim-service.d.ts +204 -0
- package/dist/src/services/claim-service.d.ts.map +1 -0
- package/dist/src/services/claim-service.js +818 -0
- package/dist/src/services/claim-service.js.map +1 -0
- package/dist/src/services/config-file-manager.d.ts +37 -0
- package/dist/src/services/config-file-manager.d.ts.map +1 -0
- package/dist/src/services/config-file-manager.js +224 -0
- package/dist/src/services/config-file-manager.js.map +1 -0
- package/dist/src/services/container-worker-pool.d.ts +197 -0
- package/dist/src/services/container-worker-pool.d.ts.map +1 -0
- package/dist/src/services/container-worker-pool.js +583 -0
- package/dist/src/services/container-worker-pool.js.map +1 -0
- package/dist/src/services/headless-worker-executor.d.ts +304 -0
- package/dist/src/services/headless-worker-executor.d.ts.map +1 -0
- package/dist/src/services/headless-worker-executor.js +1024 -0
- package/dist/src/services/headless-worker-executor.js.map +1 -0
- package/dist/src/services/index.d.ts +13 -0
- package/dist/src/services/index.d.ts.map +1 -0
- package/dist/src/services/index.js +11 -0
- package/dist/src/services/index.js.map +1 -0
- package/dist/src/services/registry-api.d.ts +58 -0
- package/dist/src/services/registry-api.d.ts.map +1 -0
- package/dist/src/services/registry-api.js +146 -0
- package/dist/src/services/registry-api.js.map +1 -0
- package/dist/src/services/ruvector-training.d.ts +222 -0
- package/dist/src/services/ruvector-training.d.ts.map +1 -0
- package/dist/src/services/ruvector-training.js +688 -0
- package/dist/src/services/ruvector-training.js.map +1 -0
- package/dist/src/services/worker-daemon.d.ts +245 -0
- package/dist/src/services/worker-daemon.d.ts.map +1 -0
- package/dist/src/services/worker-daemon.js +999 -0
- package/dist/src/services/worker-daemon.js.map +1 -0
- package/dist/src/services/worker-queue.d.ts +194 -0
- package/dist/src/services/worker-queue.d.ts.map +1 -0
- package/dist/src/services/worker-queue.js +513 -0
- package/dist/src/services/worker-queue.js.map +1 -0
- package/dist/src/suggest.d.ts +53 -0
- package/dist/src/suggest.d.ts.map +1 -0
- package/dist/src/suggest.js +200 -0
- package/dist/src/suggest.js.map +1 -0
- package/dist/src/swarm/communication-graph.d.ts +25 -0
- package/dist/src/swarm/communication-graph.d.ts.map +1 -0
- package/dist/src/swarm/communication-graph.js +77 -0
- package/dist/src/swarm/communication-graph.js.map +1 -0
- package/dist/src/swarm/flow-enforcer.d.ts +29 -0
- package/dist/src/swarm/flow-enforcer.d.ts.map +1 -0
- package/dist/src/swarm/flow-enforcer.js +49 -0
- package/dist/src/swarm/flow-enforcer.js.map +1 -0
- package/dist/src/swarm/flow-visualizer.d.ts +16 -0
- package/dist/src/swarm/flow-visualizer.d.ts.map +1 -0
- package/dist/src/swarm/flow-visualizer.js +44 -0
- package/dist/src/swarm/flow-visualizer.js.map +1 -0
- package/dist/src/transfer/anonymization/index.d.ts +25 -0
- package/dist/src/transfer/anonymization/index.d.ts.map +1 -0
- package/dist/src/transfer/anonymization/index.js +175 -0
- package/dist/src/transfer/anonymization/index.js.map +1 -0
- package/dist/src/transfer/deploy-seraphine.d.ts +13 -0
- package/dist/src/transfer/deploy-seraphine.d.ts.map +1 -0
- package/dist/src/transfer/deploy-seraphine.js +205 -0
- package/dist/src/transfer/deploy-seraphine.js.map +1 -0
- package/dist/src/transfer/export.d.ts +25 -0
- package/dist/src/transfer/export.d.ts.map +1 -0
- package/dist/src/transfer/export.js +113 -0
- package/dist/src/transfer/export.js.map +1 -0
- package/dist/src/transfer/index.d.ts +12 -0
- package/dist/src/transfer/index.d.ts.map +1 -0
- package/dist/src/transfer/index.js +31 -0
- package/dist/src/transfer/index.js.map +1 -0
- package/dist/src/transfer/ipfs/client.d.ts +109 -0
- package/dist/src/transfer/ipfs/client.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/client.js +307 -0
- package/dist/src/transfer/ipfs/client.js.map +1 -0
- package/dist/src/transfer/ipfs/upload.d.ts +95 -0
- package/dist/src/transfer/ipfs/upload.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/upload.js +411 -0
- package/dist/src/transfer/ipfs/upload.js.map +1 -0
- package/dist/src/transfer/models/seraphine.d.ts +72 -0
- package/dist/src/transfer/models/seraphine.d.ts.map +1 -0
- package/dist/src/transfer/models/seraphine.js +373 -0
- package/dist/src/transfer/models/seraphine.js.map +1 -0
- package/dist/src/transfer/serialization/cfp.d.ts +49 -0
- package/dist/src/transfer/serialization/cfp.d.ts.map +1 -0
- package/dist/src/transfer/serialization/cfp.js +183 -0
- package/dist/src/transfer/serialization/cfp.js.map +1 -0
- package/dist/src/transfer/storage/gcs.d.ts +82 -0
- package/dist/src/transfer/storage/gcs.d.ts.map +1 -0
- package/dist/src/transfer/storage/gcs.js +272 -0
- package/dist/src/transfer/storage/gcs.js.map +1 -0
- package/dist/src/transfer/storage/index.d.ts +6 -0
- package/dist/src/transfer/storage/index.d.ts.map +1 -0
- package/dist/src/transfer/storage/index.js +6 -0
- package/dist/src/transfer/storage/index.js.map +1 -0
- package/dist/src/transfer/store/discovery.d.ts +84 -0
- package/dist/src/transfer/store/discovery.d.ts.map +1 -0
- package/dist/src/transfer/store/discovery.js +382 -0
- package/dist/src/transfer/store/discovery.js.map +1 -0
- package/dist/src/transfer/store/download.d.ts +70 -0
- package/dist/src/transfer/store/download.d.ts.map +1 -0
- package/dist/src/transfer/store/download.js +334 -0
- package/dist/src/transfer/store/download.js.map +1 -0
- package/dist/src/transfer/store/index.d.ts +84 -0
- package/dist/src/transfer/store/index.d.ts.map +1 -0
- package/dist/src/transfer/store/index.js +153 -0
- package/dist/src/transfer/store/index.js.map +1 -0
- package/dist/src/transfer/store/publish.d.ts +76 -0
- package/dist/src/transfer/store/publish.d.ts.map +1 -0
- package/dist/src/transfer/store/publish.js +294 -0
- package/dist/src/transfer/store/publish.js.map +1 -0
- package/dist/src/transfer/store/registry.d.ts +58 -0
- package/dist/src/transfer/store/registry.d.ts.map +1 -0
- package/dist/src/transfer/store/registry.js +285 -0
- package/dist/src/transfer/store/registry.js.map +1 -0
- package/dist/src/transfer/store/search.d.ts +54 -0
- package/dist/src/transfer/store/search.d.ts.map +1 -0
- package/dist/src/transfer/store/search.js +232 -0
- package/dist/src/transfer/store/search.js.map +1 -0
- package/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
- package/dist/src/transfer/store/tests/standalone-test.d.ts.map +1 -0
- package/dist/src/transfer/store/tests/standalone-test.js +190 -0
- package/dist/src/transfer/store/tests/standalone-test.js.map +1 -0
- package/dist/src/transfer/store/types.d.ts +193 -0
- package/dist/src/transfer/store/types.d.ts.map +1 -0
- package/dist/src/transfer/store/types.js +6 -0
- package/dist/src/transfer/store/types.js.map +1 -0
- package/dist/src/transfer/test-seraphine.d.ts +6 -0
- package/dist/src/transfer/test-seraphine.d.ts.map +1 -0
- package/dist/src/transfer/test-seraphine.js +105 -0
- package/dist/src/transfer/test-seraphine.js.map +1 -0
- package/dist/src/transfer/tests/test-store.d.ts +7 -0
- package/dist/src/transfer/tests/test-store.d.ts.map +1 -0
- package/dist/src/transfer/tests/test-store.js +214 -0
- package/dist/src/transfer/tests/test-store.js.map +1 -0
- package/dist/src/transfer/types.d.ts +245 -0
- package/dist/src/transfer/types.d.ts.map +1 -0
- package/dist/src/transfer/types.js +6 -0
- package/dist/src/transfer/types.js.map +1 -0
- package/dist/src/types.d.ts +198 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +38 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/ui/.monomind/data/pending-insights.jsonl +0 -0
- package/dist/src/ui/.monomind/data/ranked-context.json +5 -0
- package/dist/src/ui/.monomind/sessions/current.json +13 -0
- package/dist/src/ui/collector.mjs +517 -0
- package/dist/src/ui/dashboard.html +4409 -0
- package/dist/src/ui/server.mjs +909 -0
- package/dist/src/update/checker.d.ts +34 -0
- package/dist/src/update/checker.d.ts.map +1 -0
- package/dist/src/update/checker.js +185 -0
- package/dist/src/update/checker.js.map +1 -0
- package/dist/src/update/executor.d.ts +32 -0
- package/dist/src/update/executor.d.ts.map +1 -0
- package/dist/src/update/executor.js +181 -0
- package/dist/src/update/executor.js.map +1 -0
- package/dist/src/update/index.d.ts +33 -0
- package/dist/src/update/index.d.ts.map +1 -0
- package/dist/src/update/index.js +64 -0
- package/dist/src/update/index.js.map +1 -0
- package/dist/src/update/rate-limiter.d.ts +20 -0
- package/dist/src/update/rate-limiter.d.ts.map +1 -0
- package/dist/src/update/rate-limiter.js +96 -0
- package/dist/src/update/rate-limiter.js.map +1 -0
- package/dist/src/update/validator.d.ts +17 -0
- package/dist/src/update/validator.d.ts.map +1 -0
- package/dist/src/update/validator.js +118 -0
- package/dist/src/update/validator.js.map +1 -0
- package/dist/src/workflow/condition-evaluator.d.ts +10 -0
- package/dist/src/workflow/condition-evaluator.d.ts.map +1 -0
- package/dist/src/workflow/condition-evaluator.js +48 -0
- package/dist/src/workflow/condition-evaluator.js.map +1 -0
- package/dist/src/workflow/context-resolver.d.ts +12 -0
- package/dist/src/workflow/context-resolver.d.ts.map +1 -0
- package/dist/src/workflow/context-resolver.js +23 -0
- package/dist/src/workflow/context-resolver.js.map +1 -0
- package/dist/src/workflow/dag-builder.d.ts +17 -0
- package/dist/src/workflow/dag-builder.d.ts.map +1 -0
- package/dist/src/workflow/dag-builder.js +113 -0
- package/dist/src/workflow/dag-builder.js.map +1 -0
- package/dist/src/workflow/dag-executor.d.ts +9 -0
- package/dist/src/workflow/dag-executor.d.ts.map +1 -0
- package/dist/src/workflow/dag-executor.js +78 -0
- package/dist/src/workflow/dag-executor.js.map +1 -0
- package/dist/src/workflow/dag-types.d.ts +41 -0
- package/dist/src/workflow/dag-types.d.ts.map +1 -0
- package/dist/src/workflow/dag-types.js +8 -0
- package/dist/src/workflow/dag-types.js.map +1 -0
- package/dist/src/workflow/dsl-parser.d.ts +12 -0
- package/dist/src/workflow/dsl-parser.d.ts.map +1 -0
- package/dist/src/workflow/dsl-parser.js +20 -0
- package/dist/src/workflow/dsl-parser.js.map +1 -0
- package/dist/src/workflow/dsl-schema.d.ts +162 -0
- package/dist/src/workflow/dsl-schema.d.ts.map +1 -0
- package/dist/src/workflow/dsl-schema.js +78 -0
- package/dist/src/workflow/dsl-schema.js.map +1 -0
- package/dist/src/workflow/index.d.ts +13 -0
- package/dist/src/workflow/index.d.ts.map +1 -0
- package/dist/src/workflow/index.js +11 -0
- package/dist/src/workflow/index.js.map +1 -0
- package/dist/src/workflow/template-engine.d.ts +11 -0
- package/dist/src/workflow/template-engine.d.ts.map +1 -0
- package/dist/src/workflow/template-engine.js +33 -0
- package/dist/src/workflow/template-engine.js.map +1 -0
- package/dist/src/workflow/workflow-executor.d.ts +29 -0
- package/dist/src/workflow/workflow-executor.d.ts.map +1 -0
- package/dist/src/workflow/workflow-executor.js +146 -0
- package/dist/src/workflow/workflow-executor.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +105 -0
|
@@ -0,0 +1,2048 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Analyze Command
|
|
3
|
+
* Code analysis, diff classification, AST analysis, and change risk assessment
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - AST analysis using ruvector (tree-sitter) with graceful fallback
|
|
7
|
+
* - Symbol extraction (functions, classes, variables, types)
|
|
8
|
+
* - Cyclomatic complexity scoring
|
|
9
|
+
* - Diff classification and risk assessment
|
|
10
|
+
* - Graph boundaries using MinCut algorithm
|
|
11
|
+
* - Module communities using Louvain algorithm
|
|
12
|
+
* - Circular dependency detection
|
|
13
|
+
*
|
|
14
|
+
* github.com/nokhodian/monomind
|
|
15
|
+
*/
|
|
16
|
+
import { output } from '../output.js';
|
|
17
|
+
import { callMCPTool, MCPClientError } from '../mcp-client.js';
|
|
18
|
+
import * as path from 'path';
|
|
19
|
+
import * as fs from 'fs/promises';
|
|
20
|
+
import { writeFile } from 'fs/promises';
|
|
21
|
+
import { resolve } from 'path';
|
|
22
|
+
import { execSync } from 'child_process';
|
|
23
|
+
// Dynamic import for AST analyzer
|
|
24
|
+
async function getASTAnalyzer() {
|
|
25
|
+
try {
|
|
26
|
+
return await import('../ruvector/ast-analyzer.js');
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// Dynamic import for graph analyzer
|
|
33
|
+
async function getGraphAnalyzer() {
|
|
34
|
+
try {
|
|
35
|
+
return await import('../ruvector/graph-analyzer.js');
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Diff subcommand
|
|
42
|
+
const diffCommand = {
|
|
43
|
+
name: 'diff',
|
|
44
|
+
description: 'Analyze git diff for change risk assessment and classification',
|
|
45
|
+
options: [
|
|
46
|
+
{
|
|
47
|
+
name: 'risk',
|
|
48
|
+
short: 'r',
|
|
49
|
+
description: 'Show risk assessment',
|
|
50
|
+
type: 'boolean',
|
|
51
|
+
default: false,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'classify',
|
|
55
|
+
short: 'c',
|
|
56
|
+
description: 'Classify change type',
|
|
57
|
+
type: 'boolean',
|
|
58
|
+
default: false,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'reviewers',
|
|
62
|
+
description: 'Show recommended reviewers',
|
|
63
|
+
type: 'boolean',
|
|
64
|
+
default: false,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'format',
|
|
68
|
+
short: 'f',
|
|
69
|
+
description: 'Output format: text, json, table',
|
|
70
|
+
type: 'string',
|
|
71
|
+
default: 'text',
|
|
72
|
+
choices: ['text', 'json', 'table'],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'verbose',
|
|
76
|
+
short: 'v',
|
|
77
|
+
description: 'Show detailed file-level analysis',
|
|
78
|
+
type: 'boolean',
|
|
79
|
+
default: false,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
examples: [
|
|
83
|
+
{ command: 'monomind analyze diff --risk', description: 'Analyze current diff with risk assessment' },
|
|
84
|
+
{ command: 'monomind analyze diff HEAD~1 --classify', description: 'Classify changes from last commit' },
|
|
85
|
+
{ command: 'monomind analyze diff main..feature --format json', description: 'Compare branches with JSON output' },
|
|
86
|
+
{ command: 'monomind analyze diff --reviewers', description: 'Get recommended reviewers for changes' },
|
|
87
|
+
],
|
|
88
|
+
action: async (ctx) => {
|
|
89
|
+
const ref = ctx.args[0] || 'HEAD';
|
|
90
|
+
const showRisk = ctx.flags.risk;
|
|
91
|
+
const showClassify = ctx.flags.classify;
|
|
92
|
+
const showReviewers = ctx.flags.reviewers;
|
|
93
|
+
const formatType = ctx.flags.format || 'text';
|
|
94
|
+
const verbose = ctx.flags.verbose;
|
|
95
|
+
// If no specific flag, show all
|
|
96
|
+
const showAll = !showRisk && !showClassify && !showReviewers;
|
|
97
|
+
output.printInfo(`Analyzing diff: ${output.highlight(ref)}`);
|
|
98
|
+
try {
|
|
99
|
+
// Call MCP tool for diff analysis
|
|
100
|
+
const result = await callMCPTool('analyze_diff', {
|
|
101
|
+
ref,
|
|
102
|
+
includeFileRisks: verbose,
|
|
103
|
+
includeReviewers: showReviewers || showAll,
|
|
104
|
+
});
|
|
105
|
+
// JSON output
|
|
106
|
+
if (formatType === 'json') {
|
|
107
|
+
output.printJson(result);
|
|
108
|
+
return { success: true, data: result };
|
|
109
|
+
}
|
|
110
|
+
output.writeln();
|
|
111
|
+
// Summary box
|
|
112
|
+
const files = result.files || [];
|
|
113
|
+
const risk = result.risk || { overall: 'unknown', score: 0, breakdown: { fileCount: 0, totalChanges: 0, highRiskFiles: [], securityConcerns: [], breakingChanges: [], testCoverage: 'unknown' } };
|
|
114
|
+
const classification = result.classification || { category: 'unknown', confidence: 0, reasoning: '' };
|
|
115
|
+
output.printBox([
|
|
116
|
+
`Ref: ${result.ref || 'HEAD'}`,
|
|
117
|
+
`Files: ${files.length}`,
|
|
118
|
+
`Risk: ${getRiskDisplay(risk.overall)} (${risk.score}/100)`,
|
|
119
|
+
`Type: ${classification.category}${classification.subcategory ? ` (${classification.subcategory})` : ''}`,
|
|
120
|
+
``,
|
|
121
|
+
result.summary || 'No summary available',
|
|
122
|
+
].join('\n'), 'Diff Analysis');
|
|
123
|
+
// Risk assessment
|
|
124
|
+
if (showRisk || showAll) {
|
|
125
|
+
output.writeln();
|
|
126
|
+
output.writeln(output.bold('Risk Assessment'));
|
|
127
|
+
output.writeln(output.dim('-'.repeat(50)));
|
|
128
|
+
output.printTable({
|
|
129
|
+
columns: [
|
|
130
|
+
{ key: 'metric', header: 'Metric', width: 25 },
|
|
131
|
+
{ key: 'value', header: 'Value', width: 30 },
|
|
132
|
+
],
|
|
133
|
+
data: [
|
|
134
|
+
{ metric: 'Overall Risk', value: getRiskDisplay(risk.overall) },
|
|
135
|
+
{ metric: 'Risk Score', value: `${risk.score}/100` },
|
|
136
|
+
{ metric: 'Files Changed', value: risk.breakdown.fileCount },
|
|
137
|
+
{ metric: 'Total Lines Changed', value: risk.breakdown.totalChanges },
|
|
138
|
+
{ metric: 'Test Coverage', value: risk.breakdown.testCoverage },
|
|
139
|
+
],
|
|
140
|
+
});
|
|
141
|
+
// Security concerns
|
|
142
|
+
if (risk.breakdown.securityConcerns.length > 0) {
|
|
143
|
+
output.writeln();
|
|
144
|
+
output.writeln(output.bold(output.warning('Security Concerns')));
|
|
145
|
+
output.printList(risk.breakdown.securityConcerns.map(c => output.warning(c)));
|
|
146
|
+
}
|
|
147
|
+
// Breaking changes
|
|
148
|
+
if (risk.breakdown.breakingChanges.length > 0) {
|
|
149
|
+
output.writeln();
|
|
150
|
+
output.writeln(output.bold(output.error('Potential Breaking Changes')));
|
|
151
|
+
output.printList(risk.breakdown.breakingChanges.map(c => output.error(c)));
|
|
152
|
+
}
|
|
153
|
+
// High risk files
|
|
154
|
+
if (risk.breakdown.highRiskFiles.length > 0) {
|
|
155
|
+
output.writeln();
|
|
156
|
+
output.writeln(output.bold('High Risk Files'));
|
|
157
|
+
output.printList(risk.breakdown.highRiskFiles.map(f => output.warning(f)));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// Classification
|
|
161
|
+
if (showClassify || showAll) {
|
|
162
|
+
output.writeln();
|
|
163
|
+
output.writeln(output.bold('Classification'));
|
|
164
|
+
output.writeln(output.dim('-'.repeat(50)));
|
|
165
|
+
output.printTable({
|
|
166
|
+
columns: [
|
|
167
|
+
{ key: 'field', header: 'Field', width: 15 },
|
|
168
|
+
{ key: 'value', header: 'Value', width: 40 },
|
|
169
|
+
],
|
|
170
|
+
data: [
|
|
171
|
+
{ field: 'Category', value: classification.category },
|
|
172
|
+
{ field: 'Subcategory', value: classification.subcategory || '-' },
|
|
173
|
+
{ field: 'Confidence', value: `${(classification.confidence * 100).toFixed(0)}%` },
|
|
174
|
+
],
|
|
175
|
+
});
|
|
176
|
+
output.writeln();
|
|
177
|
+
output.writeln(output.dim(`Reasoning: ${classification.reasoning}`));
|
|
178
|
+
}
|
|
179
|
+
// Reviewers
|
|
180
|
+
if (showReviewers || showAll) {
|
|
181
|
+
output.writeln();
|
|
182
|
+
output.writeln(output.bold('Recommended Reviewers'));
|
|
183
|
+
output.writeln(output.dim('-'.repeat(50)));
|
|
184
|
+
const reviewers = result.recommendedReviewers || [];
|
|
185
|
+
if (reviewers.length > 0) {
|
|
186
|
+
output.printNumberedList(reviewers.map(r => output.highlight(r)));
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
output.writeln(output.dim('No specific reviewers recommended'));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// Verbose file-level details
|
|
193
|
+
if (verbose && result.fileRisks) {
|
|
194
|
+
output.writeln();
|
|
195
|
+
output.writeln(output.bold('File-Level Analysis'));
|
|
196
|
+
output.writeln(output.dim('-'.repeat(50)));
|
|
197
|
+
output.printTable({
|
|
198
|
+
columns: [
|
|
199
|
+
{ key: 'path', header: 'File', width: 40 },
|
|
200
|
+
{ key: 'risk', header: 'Risk', width: 12, format: (v) => getRiskDisplay(String(v)) },
|
|
201
|
+
{ key: 'score', header: 'Score', width: 8, align: 'right' },
|
|
202
|
+
{ key: 'reasons', header: 'Reasons', width: 30, format: (v) => {
|
|
203
|
+
const reasons = v;
|
|
204
|
+
return reasons.slice(0, 2).join('; ');
|
|
205
|
+
} },
|
|
206
|
+
],
|
|
207
|
+
data: result.fileRisks,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
// Files changed table
|
|
211
|
+
if (formatType === 'table' || showAll) {
|
|
212
|
+
output.writeln();
|
|
213
|
+
output.writeln(output.bold('Files Changed'));
|
|
214
|
+
output.writeln(output.dim('-'.repeat(50)));
|
|
215
|
+
output.printTable({
|
|
216
|
+
columns: [
|
|
217
|
+
{ key: 'status', header: 'Status', width: 10, format: (v) => getStatusDisplay(String(v)) },
|
|
218
|
+
{ key: 'path', header: 'File', width: 45 },
|
|
219
|
+
{ key: 'additions', header: '+', width: 8, align: 'right', format: (v) => output.success(`+${v}`) },
|
|
220
|
+
{ key: 'deletions', header: '-', width: 8, align: 'right', format: (v) => output.error(`-${v}`) },
|
|
221
|
+
],
|
|
222
|
+
data: files.slice(0, 20),
|
|
223
|
+
});
|
|
224
|
+
if (files.length > 20) {
|
|
225
|
+
output.writeln(output.dim(` ... and ${files.length - 20} more files`));
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return { success: true, data: result };
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
if (error instanceof MCPClientError) {
|
|
232
|
+
output.printError(`Diff analysis failed: ${error.message}`);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
236
|
+
}
|
|
237
|
+
return { success: false, exitCode: 1 };
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
// Code subcommand (placeholder for future code analysis)
|
|
242
|
+
const codeCommand = {
|
|
243
|
+
name: 'code',
|
|
244
|
+
description: 'Static code analysis and quality assessment',
|
|
245
|
+
options: [
|
|
246
|
+
{ name: 'path', short: 'p', type: 'string', description: 'Path to analyze', default: '.' },
|
|
247
|
+
{ name: 'type', short: 't', type: 'string', description: 'Analysis type: quality, complexity, security', default: 'quality' },
|
|
248
|
+
{ name: 'format', short: 'f', type: 'string', description: 'Output format: text, json', default: 'text' },
|
|
249
|
+
],
|
|
250
|
+
examples: [
|
|
251
|
+
{ command: 'monomind analyze code -p ./src', description: 'Analyze source directory' },
|
|
252
|
+
{ command: 'monomind analyze code --type complexity', description: 'Run complexity analysis' },
|
|
253
|
+
],
|
|
254
|
+
action: async (ctx) => {
|
|
255
|
+
const targetPath = resolve(ctx.flags.path || '.');
|
|
256
|
+
const analysisType = ctx.flags.type || 'quality';
|
|
257
|
+
const formatJson = ctx.flags.format === 'json';
|
|
258
|
+
output.writeln();
|
|
259
|
+
output.writeln(output.bold('Code Analysis'));
|
|
260
|
+
output.writeln(output.dim('-'.repeat(50)));
|
|
261
|
+
const spinner = output.createSpinner({ text: `Analyzing ${targetPath}...`, spinner: 'dots' });
|
|
262
|
+
spinner.start();
|
|
263
|
+
try {
|
|
264
|
+
const files = await scanSourceFiles(targetPath);
|
|
265
|
+
if (files.length === 0) {
|
|
266
|
+
spinner.stop();
|
|
267
|
+
output.printWarning('No source files found');
|
|
268
|
+
return { success: true };
|
|
269
|
+
}
|
|
270
|
+
const fileStats = [];
|
|
271
|
+
for (const filePath of files) {
|
|
272
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
273
|
+
const lines = content.split('\n');
|
|
274
|
+
const nonEmpty = lines.filter(l => l.trim().length > 0 && !/^\s*(\/\/|\/\*|\*\s|#)/.test(l)).length;
|
|
275
|
+
const todos = (content.match(/\b(TODO|FIXME|HACK|XXX)\b/gi) || []).length;
|
|
276
|
+
const fns = (content.match(/(?:export\s+)?(?:async\s+)?function\s+\w+|(?:const|let|var)\s+\w+\s*=\s*(?:async\s+)?\([^)]*\)\s*=>/g) || []).length;
|
|
277
|
+
const imps = (content.match(/^import\s+/gm) || []).length + (content.match(/require\s*\(/g) || []).length;
|
|
278
|
+
let maxNesting = 0;
|
|
279
|
+
let nesting = 0;
|
|
280
|
+
for (const line of lines) {
|
|
281
|
+
nesting += (line.match(/\{/g) || []).length;
|
|
282
|
+
nesting -= (line.match(/\}/g) || []).length;
|
|
283
|
+
if (nesting > maxNesting)
|
|
284
|
+
maxNesting = nesting;
|
|
285
|
+
}
|
|
286
|
+
const securityIssues = [];
|
|
287
|
+
if (/\beval\s*\(/.test(content))
|
|
288
|
+
securityIssues.push('eval()');
|
|
289
|
+
if (/\bexec\s*\(/.test(content))
|
|
290
|
+
securityIssues.push('exec()');
|
|
291
|
+
if (/\.innerHTML\s*=/.test(content))
|
|
292
|
+
securityIssues.push('innerHTML');
|
|
293
|
+
if (/dangerouslySetInnerHTML/.test(content))
|
|
294
|
+
securityIssues.push('dangerouslySetInnerHTML');
|
|
295
|
+
if (/['"](?:password|secret|api[_-]?key|token)\s*[:=]\s*['"][^'"]{3,}['"]/i.test(content))
|
|
296
|
+
securityIssues.push('hardcoded secret');
|
|
297
|
+
if (/new\s+Function\s*\(/.test(content))
|
|
298
|
+
securityIssues.push('new Function()');
|
|
299
|
+
fileStats.push({
|
|
300
|
+
file: filePath,
|
|
301
|
+
loc: nonEmpty,
|
|
302
|
+
todos,
|
|
303
|
+
functions: fns,
|
|
304
|
+
imports: imps,
|
|
305
|
+
maxNesting,
|
|
306
|
+
securityIssues,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
spinner.stop();
|
|
310
|
+
const totalLoc = fileStats.reduce((s, f) => s + f.loc, 0);
|
|
311
|
+
const totalTodos = fileStats.reduce((s, f) => s + f.todos, 0);
|
|
312
|
+
const totalFunctions = fileStats.reduce((s, f) => s + f.functions, 0);
|
|
313
|
+
const totalImports = fileStats.reduce((s, f) => s + f.imports, 0);
|
|
314
|
+
const avgFileSize = Math.round(totalLoc / files.length);
|
|
315
|
+
const longestFile = fileStats.reduce((a, b) => a.loc > b.loc ? a : b);
|
|
316
|
+
const avgFnPerFile = (totalFunctions / files.length).toFixed(1);
|
|
317
|
+
const deepestNesting = fileStats.reduce((a, b) => a.maxNesting > b.maxNesting ? a : b);
|
|
318
|
+
const allSecurityIssues = fileStats.filter(f => f.securityIssues.length > 0);
|
|
319
|
+
if (formatJson) {
|
|
320
|
+
const jsonData = { type: analysisType, path: targetPath, files: files.length, totalLoc, totalTodos, totalFunctions, totalImports, avgFileSize, fileStats: fileStats.map(f => ({ relativePath: path.relative(targetPath, f.file), loc: f.loc, todos: f.todos, functions: f.functions, imports: f.imports, maxNesting: f.maxNesting, securityIssues: f.securityIssues })) };
|
|
321
|
+
output.printJson(jsonData);
|
|
322
|
+
return { success: true, data: jsonData };
|
|
323
|
+
}
|
|
324
|
+
if (analysisType === 'quality') {
|
|
325
|
+
output.printBox([`Files: ${files.length}`, `Lines of Code: ${totalLoc.toLocaleString()}`, `Avg File Size: ${avgFileSize} LOC`, `TODO/FIXME: ${totalTodos}`, `Functions: ${totalFunctions}`, `Imports: ${totalImports}`].join('\n'), 'Quality Summary');
|
|
326
|
+
output.writeln();
|
|
327
|
+
output.writeln(output.bold('Largest Files'));
|
|
328
|
+
output.writeln(output.dim('-'.repeat(60)));
|
|
329
|
+
const top10 = [...fileStats].sort((a, b) => b.loc - a.loc).slice(0, 10);
|
|
330
|
+
output.printTable({
|
|
331
|
+
columns: [
|
|
332
|
+
{ key: 'file', header: 'File', width: 45 },
|
|
333
|
+
{ key: 'loc', header: 'LOC', width: 8, align: 'right' },
|
|
334
|
+
{ key: 'fns', header: 'Fns', width: 6, align: 'right' },
|
|
335
|
+
{ key: 'todos', header: 'TODOs', width: 7, align: 'right' },
|
|
336
|
+
],
|
|
337
|
+
data: top10.map(f => ({ file: path.relative(targetPath, f.file), loc: f.loc, fns: f.functions, todos: f.todos })),
|
|
338
|
+
});
|
|
339
|
+
if (totalTodos > 0) {
|
|
340
|
+
output.writeln();
|
|
341
|
+
output.printWarning(`${totalTodos} TODO/FIXME comments found across ${fileStats.filter(f => f.todos > 0).length} files`);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
else if (analysisType === 'complexity') {
|
|
345
|
+
output.printBox([`Files: ${files.length}`, `Total Functions: ${totalFunctions}`, `Avg Functions/File: ${avgFnPerFile}`, `Deepest Nesting: ${deepestNesting.maxNesting} levels (${path.relative(targetPath, deepestNesting.file)})`, `Longest File: ${longestFile.loc} LOC (${path.relative(targetPath, longestFile.file)})`].join('\n'), 'Complexity Summary');
|
|
346
|
+
output.writeln();
|
|
347
|
+
output.writeln(output.bold('High Complexity Files (nesting > 5)'));
|
|
348
|
+
output.writeln(output.dim('-'.repeat(60)));
|
|
349
|
+
const complex = fileStats.filter(f => f.maxNesting > 5).sort((a, b) => b.maxNesting - a.maxNesting);
|
|
350
|
+
if (complex.length === 0) {
|
|
351
|
+
output.printSuccess('No files with excessive nesting detected');
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
output.printTable({
|
|
355
|
+
columns: [
|
|
356
|
+
{ key: 'file', header: 'File', width: 45 },
|
|
357
|
+
{ key: 'nesting', header: 'Max Nest', width: 10, align: 'right' },
|
|
358
|
+
{ key: 'fns', header: 'Fns', width: 6, align: 'right' },
|
|
359
|
+
{ key: 'loc', header: 'LOC', width: 8, align: 'right' },
|
|
360
|
+
],
|
|
361
|
+
data: complex.slice(0, 15).map(f => ({ file: path.relative(targetPath, f.file), nesting: f.maxNesting, fns: f.functions, loc: f.loc })),
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
else if (analysisType === 'security') {
|
|
366
|
+
output.printBox([`Files Scanned: ${files.length}`, `Files with Issues: ${allSecurityIssues.length}`, `Total Issues: ${allSecurityIssues.reduce((s, f) => s + f.securityIssues.length, 0)}`].join('\n'), 'Security Summary');
|
|
367
|
+
if (allSecurityIssues.length === 0) {
|
|
368
|
+
output.writeln();
|
|
369
|
+
output.printSuccess('No common security patterns detected');
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
output.writeln();
|
|
373
|
+
output.writeln(output.bold('Security Concerns'));
|
|
374
|
+
output.writeln(output.dim('-'.repeat(60)));
|
|
375
|
+
output.printTable({
|
|
376
|
+
columns: [
|
|
377
|
+
{ key: 'file', header: 'File', width: 40 },
|
|
378
|
+
{ key: 'issues', header: 'Issues', width: 35 },
|
|
379
|
+
],
|
|
380
|
+
data: allSecurityIssues.map(f => ({ file: path.relative(targetPath, f.file), issues: f.securityIssues.join(', ') })),
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
output.printWarning(`Unknown analysis type: ${analysisType}. Use quality, complexity, or security.`);
|
|
386
|
+
}
|
|
387
|
+
return { success: true };
|
|
388
|
+
}
|
|
389
|
+
catch (error) {
|
|
390
|
+
spinner.stop();
|
|
391
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
392
|
+
output.printError(`Code analysis failed: ${message}`);
|
|
393
|
+
return { success: false, exitCode: 1 };
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
};
|
|
397
|
+
// ============================================================================
|
|
398
|
+
// AST Analysis Subcommands (using ruvector tree-sitter with fallback)
|
|
399
|
+
// ============================================================================
|
|
400
|
+
/**
|
|
401
|
+
* Helper: Truncate file path for display
|
|
402
|
+
*/
|
|
403
|
+
function truncatePathAst(filePath, maxLen = 45) {
|
|
404
|
+
if (filePath.length <= maxLen)
|
|
405
|
+
return filePath;
|
|
406
|
+
return '...' + filePath.slice(-(maxLen - 3));
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Helper: Format complexity value with color coding
|
|
410
|
+
*/
|
|
411
|
+
function formatComplexityValueAst(value) {
|
|
412
|
+
if (value <= 5)
|
|
413
|
+
return output.success(String(value));
|
|
414
|
+
if (value <= 10)
|
|
415
|
+
return output.warning(String(value));
|
|
416
|
+
return output.error(String(value));
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Helper: Get type marker for symbols
|
|
420
|
+
*/
|
|
421
|
+
function getTypeMarkerAst(type) {
|
|
422
|
+
switch (type) {
|
|
423
|
+
case 'function': return output.success('fn');
|
|
424
|
+
case 'class': return output.info('class');
|
|
425
|
+
case 'variable': return output.dim('var');
|
|
426
|
+
case 'type': return output.highlight('type');
|
|
427
|
+
case 'interface': return output.highlight('iface');
|
|
428
|
+
default: return output.dim(type.slice(0, 5));
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Helper: Get complexity rating text
|
|
433
|
+
*/
|
|
434
|
+
function getComplexityRatingAst(value) {
|
|
435
|
+
if (value <= 5)
|
|
436
|
+
return output.success('Simple');
|
|
437
|
+
if (value <= 10)
|
|
438
|
+
return output.warning('Moderate');
|
|
439
|
+
if (value <= 20)
|
|
440
|
+
return output.error('Complex');
|
|
441
|
+
return output.error(output.bold('Very Complex'));
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* AST analysis subcommand
|
|
445
|
+
*/
|
|
446
|
+
const astCommand = {
|
|
447
|
+
name: 'ast',
|
|
448
|
+
description: 'Analyze code using AST parsing (tree-sitter via ruvector)',
|
|
449
|
+
options: [
|
|
450
|
+
{
|
|
451
|
+
name: 'complexity',
|
|
452
|
+
short: 'c',
|
|
453
|
+
description: 'Include complexity metrics',
|
|
454
|
+
type: 'boolean',
|
|
455
|
+
default: false,
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
name: 'symbols',
|
|
459
|
+
short: 's',
|
|
460
|
+
description: 'Include symbol extraction',
|
|
461
|
+
type: 'boolean',
|
|
462
|
+
default: false,
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
name: 'format',
|
|
466
|
+
short: 'f',
|
|
467
|
+
description: 'Output format (text, json, table)',
|
|
468
|
+
type: 'string',
|
|
469
|
+
default: 'text',
|
|
470
|
+
choices: ['text', 'json', 'table'],
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
name: 'output',
|
|
474
|
+
short: 'o',
|
|
475
|
+
description: 'Output file path',
|
|
476
|
+
type: 'string',
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
name: 'verbose',
|
|
480
|
+
short: 'v',
|
|
481
|
+
description: 'Show detailed analysis',
|
|
482
|
+
type: 'boolean',
|
|
483
|
+
default: false,
|
|
484
|
+
},
|
|
485
|
+
],
|
|
486
|
+
examples: [
|
|
487
|
+
{ command: 'monomind analyze ast src/', description: 'Analyze all files in src/' },
|
|
488
|
+
{ command: 'monomind analyze ast src/index.ts --complexity', description: 'Analyze with complexity' },
|
|
489
|
+
{ command: 'monomind analyze ast . --format json', description: 'JSON output' },
|
|
490
|
+
{ command: 'monomind analyze ast src/ --symbols', description: 'Extract symbols' },
|
|
491
|
+
],
|
|
492
|
+
action: async (ctx) => {
|
|
493
|
+
const targetPath = ctx.args[0] || ctx.cwd;
|
|
494
|
+
const showComplexity = ctx.flags.complexity;
|
|
495
|
+
const showSymbols = ctx.flags.symbols;
|
|
496
|
+
const formatType = ctx.flags.format || 'text';
|
|
497
|
+
const outputFile = ctx.flags.output;
|
|
498
|
+
const verbose = ctx.flags.verbose;
|
|
499
|
+
// If no specific flags, show summary
|
|
500
|
+
const showAll = !showComplexity && !showSymbols;
|
|
501
|
+
output.printInfo(`Analyzing: ${output.highlight(targetPath)}`);
|
|
502
|
+
output.writeln();
|
|
503
|
+
const spinner = output.createSpinner({ text: 'Parsing AST...', spinner: 'dots' });
|
|
504
|
+
spinner.start();
|
|
505
|
+
try {
|
|
506
|
+
const astModule = await getASTAnalyzer();
|
|
507
|
+
if (!astModule) {
|
|
508
|
+
spinner.stop();
|
|
509
|
+
output.printWarning('AST analyzer not available, using regex fallback');
|
|
510
|
+
}
|
|
511
|
+
// Resolve path and check if file or directory
|
|
512
|
+
const resolvedPath = resolve(targetPath);
|
|
513
|
+
const stat = await fs.stat(resolvedPath);
|
|
514
|
+
const isDirectory = stat.isDirectory();
|
|
515
|
+
let results = [];
|
|
516
|
+
if (isDirectory) {
|
|
517
|
+
// Scan directory for source files
|
|
518
|
+
const files = await scanSourceFiles(resolvedPath);
|
|
519
|
+
spinner.stop();
|
|
520
|
+
output.printInfo(`Found ${files.length} source files`);
|
|
521
|
+
spinner.start();
|
|
522
|
+
for (const file of files.slice(0, 100)) {
|
|
523
|
+
try {
|
|
524
|
+
const content = await fs.readFile(file, 'utf-8');
|
|
525
|
+
if (astModule) {
|
|
526
|
+
const analyzer = astModule.createASTAnalyzer();
|
|
527
|
+
const analysis = analyzer.analyze(content, file);
|
|
528
|
+
results.push(analysis);
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
// Fallback analysis
|
|
532
|
+
results.push(fallbackAnalyze(content, file));
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
catch {
|
|
536
|
+
// Skip files that can't be analyzed
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
// Single file
|
|
542
|
+
const content = await fs.readFile(resolvedPath, 'utf-8');
|
|
543
|
+
if (astModule) {
|
|
544
|
+
const analyzer = astModule.createASTAnalyzer();
|
|
545
|
+
const analysis = analyzer.analyze(content, resolvedPath);
|
|
546
|
+
results.push(analysis);
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
results.push(fallbackAnalyze(content, resolvedPath));
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
spinner.stop();
|
|
553
|
+
if (results.length === 0) {
|
|
554
|
+
output.printWarning('No files analyzed');
|
|
555
|
+
return { success: true };
|
|
556
|
+
}
|
|
557
|
+
// Calculate totals
|
|
558
|
+
const totals = {
|
|
559
|
+
files: results.length,
|
|
560
|
+
functions: results.reduce((sum, r) => sum + r.functions.length, 0),
|
|
561
|
+
classes: results.reduce((sum, r) => sum + r.classes.length, 0),
|
|
562
|
+
imports: results.reduce((sum, r) => sum + r.imports.length, 0),
|
|
563
|
+
avgComplexity: results.reduce((sum, r) => sum + r.complexity.cyclomatic, 0) / results.length,
|
|
564
|
+
totalLoc: results.reduce((sum, r) => sum + r.complexity.loc, 0),
|
|
565
|
+
};
|
|
566
|
+
// JSON output
|
|
567
|
+
if (formatType === 'json') {
|
|
568
|
+
const jsonOutput = { files: results, totals };
|
|
569
|
+
if (outputFile) {
|
|
570
|
+
await writeFile(outputFile, JSON.stringify(jsonOutput, null, 2));
|
|
571
|
+
output.printSuccess(`Results written to ${outputFile}`);
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
output.printJson(jsonOutput);
|
|
575
|
+
}
|
|
576
|
+
return { success: true, data: jsonOutput };
|
|
577
|
+
}
|
|
578
|
+
// Summary box
|
|
579
|
+
output.printBox([
|
|
580
|
+
`Files analyzed: ${totals.files}`,
|
|
581
|
+
`Functions: ${totals.functions}`,
|
|
582
|
+
`Classes: ${totals.classes}`,
|
|
583
|
+
`Total LOC: ${totals.totalLoc}`,
|
|
584
|
+
`Avg Complexity: ${formatComplexityValueAst(Math.round(totals.avgComplexity))}`,
|
|
585
|
+
].join('\n'), 'AST Analysis Summary');
|
|
586
|
+
// Complexity view
|
|
587
|
+
if (showComplexity || showAll) {
|
|
588
|
+
output.writeln();
|
|
589
|
+
output.writeln(output.bold('Complexity by File'));
|
|
590
|
+
output.writeln(output.dim('-'.repeat(60)));
|
|
591
|
+
const complexityData = results
|
|
592
|
+
.map(r => ({
|
|
593
|
+
file: truncatePathAst(r.filePath),
|
|
594
|
+
cyclomatic: r.complexity.cyclomatic,
|
|
595
|
+
cognitive: r.complexity.cognitive,
|
|
596
|
+
loc: r.complexity.loc,
|
|
597
|
+
rating: getComplexityRatingAst(r.complexity.cyclomatic),
|
|
598
|
+
}))
|
|
599
|
+
.sort((a, b) => b.cyclomatic - a.cyclomatic)
|
|
600
|
+
.slice(0, 15);
|
|
601
|
+
output.printTable({
|
|
602
|
+
columns: [
|
|
603
|
+
{ key: 'file', header: 'File', width: 40 },
|
|
604
|
+
{ key: 'cyclomatic', header: 'Cyclo', width: 8, align: 'right', format: (v) => formatComplexityValueAst(v) },
|
|
605
|
+
{ key: 'cognitive', header: 'Cogni', width: 8, align: 'right' },
|
|
606
|
+
{ key: 'loc', header: 'LOC', width: 8, align: 'right' },
|
|
607
|
+
{ key: 'rating', header: 'Rating', width: 15 },
|
|
608
|
+
],
|
|
609
|
+
data: complexityData,
|
|
610
|
+
});
|
|
611
|
+
if (results.length > 15) {
|
|
612
|
+
output.writeln(output.dim(` ... and ${results.length - 15} more files`));
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
// Symbols view
|
|
616
|
+
if (showSymbols || showAll) {
|
|
617
|
+
output.writeln();
|
|
618
|
+
output.writeln(output.bold('Extracted Symbols'));
|
|
619
|
+
output.writeln(output.dim('-'.repeat(60)));
|
|
620
|
+
const allSymbols = [];
|
|
621
|
+
for (const r of results) {
|
|
622
|
+
for (const fn of r.functions) {
|
|
623
|
+
allSymbols.push({ name: fn.name, type: 'function', file: truncatePathAst(r.filePath, 30), line: fn.startLine });
|
|
624
|
+
}
|
|
625
|
+
for (const cls of r.classes) {
|
|
626
|
+
allSymbols.push({ name: cls.name, type: 'class', file: truncatePathAst(r.filePath, 30), line: cls.startLine });
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
const displaySymbols = allSymbols.slice(0, 20);
|
|
630
|
+
output.printTable({
|
|
631
|
+
columns: [
|
|
632
|
+
{ key: 'type', header: 'Type', width: 8, format: (v) => getTypeMarkerAst(v) },
|
|
633
|
+
{ key: 'name', header: 'Symbol', width: 30 },
|
|
634
|
+
{ key: 'file', header: 'File', width: 35 },
|
|
635
|
+
{ key: 'line', header: 'Line', width: 8, align: 'right' },
|
|
636
|
+
],
|
|
637
|
+
data: displaySymbols,
|
|
638
|
+
});
|
|
639
|
+
if (allSymbols.length > 20) {
|
|
640
|
+
output.writeln(output.dim(` ... and ${allSymbols.length - 20} more symbols`));
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
// Verbose output
|
|
644
|
+
if (verbose) {
|
|
645
|
+
output.writeln();
|
|
646
|
+
output.writeln(output.bold('Import Analysis'));
|
|
647
|
+
output.writeln(output.dim('-'.repeat(60)));
|
|
648
|
+
const importCounts = new Map();
|
|
649
|
+
for (const r of results) {
|
|
650
|
+
for (const imp of r.imports) {
|
|
651
|
+
importCounts.set(imp, (importCounts.get(imp) || 0) + 1);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
const topImports = Array.from(importCounts.entries())
|
|
655
|
+
.sort((a, b) => b[1] - a[1])
|
|
656
|
+
.slice(0, 10);
|
|
657
|
+
for (const [imp, count] of topImports) {
|
|
658
|
+
output.writeln(` ${output.highlight(count.toString().padStart(3))} ${imp}`);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
if (outputFile) {
|
|
662
|
+
await writeFile(outputFile, JSON.stringify({ files: results, totals }, null, 2));
|
|
663
|
+
output.printSuccess(`Results written to ${outputFile}`);
|
|
664
|
+
}
|
|
665
|
+
return { success: true, data: { files: results, totals } };
|
|
666
|
+
}
|
|
667
|
+
catch (error) {
|
|
668
|
+
spinner.stop();
|
|
669
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
670
|
+
output.printError(`AST analysis failed: ${message}`);
|
|
671
|
+
return { success: false, exitCode: 1 };
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
};
|
|
675
|
+
/**
|
|
676
|
+
* Complexity analysis subcommand
|
|
677
|
+
*/
|
|
678
|
+
const complexityAstCommand = {
|
|
679
|
+
name: 'complexity',
|
|
680
|
+
aliases: ['cx'],
|
|
681
|
+
description: 'Analyze code complexity metrics',
|
|
682
|
+
options: [
|
|
683
|
+
{
|
|
684
|
+
name: 'threshold',
|
|
685
|
+
short: 't',
|
|
686
|
+
description: 'Complexity threshold to flag (default: 10)',
|
|
687
|
+
type: 'number',
|
|
688
|
+
default: 10,
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
name: 'format',
|
|
692
|
+
short: 'f',
|
|
693
|
+
description: 'Output format (text, json)',
|
|
694
|
+
type: 'string',
|
|
695
|
+
default: 'text',
|
|
696
|
+
choices: ['text', 'json'],
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
name: 'output',
|
|
700
|
+
short: 'o',
|
|
701
|
+
description: 'Output file path',
|
|
702
|
+
type: 'string',
|
|
703
|
+
},
|
|
704
|
+
],
|
|
705
|
+
examples: [
|
|
706
|
+
{ command: 'monomind analyze complexity src/', description: 'Analyze complexity' },
|
|
707
|
+
{ command: 'monomind analyze complexity src/ --threshold 15', description: 'Flag high complexity' },
|
|
708
|
+
],
|
|
709
|
+
action: async (ctx) => {
|
|
710
|
+
const targetPath = ctx.args[0] || ctx.cwd;
|
|
711
|
+
const threshold = ctx.flags.threshold || 10;
|
|
712
|
+
const formatType = ctx.flags.format || 'text';
|
|
713
|
+
const outputFile = ctx.flags.output;
|
|
714
|
+
output.printInfo(`Analyzing complexity: ${output.highlight(targetPath)}`);
|
|
715
|
+
output.writeln();
|
|
716
|
+
const spinner = output.createSpinner({ text: 'Calculating complexity...', spinner: 'dots' });
|
|
717
|
+
spinner.start();
|
|
718
|
+
try {
|
|
719
|
+
const astModule = await getASTAnalyzer();
|
|
720
|
+
const resolvedPath = resolve(targetPath);
|
|
721
|
+
const stat = await fs.stat(resolvedPath);
|
|
722
|
+
const files = stat.isDirectory() ? await scanSourceFiles(resolvedPath) : [resolvedPath];
|
|
723
|
+
const results = [];
|
|
724
|
+
for (const file of files.slice(0, 100)) {
|
|
725
|
+
try {
|
|
726
|
+
const content = await fs.readFile(file, 'utf-8');
|
|
727
|
+
let analysis;
|
|
728
|
+
if (astModule) {
|
|
729
|
+
const analyzer = astModule.createASTAnalyzer();
|
|
730
|
+
analysis = analyzer.analyze(content, file);
|
|
731
|
+
}
|
|
732
|
+
else {
|
|
733
|
+
analysis = fallbackAnalyze(content, file);
|
|
734
|
+
}
|
|
735
|
+
const flagged = analysis.complexity.cyclomatic > threshold;
|
|
736
|
+
const rating = analysis.complexity.cyclomatic <= 5 ? 'Simple' :
|
|
737
|
+
analysis.complexity.cyclomatic <= 10 ? 'Moderate' :
|
|
738
|
+
analysis.complexity.cyclomatic <= 20 ? 'Complex' : 'Very Complex';
|
|
739
|
+
results.push({
|
|
740
|
+
file: file,
|
|
741
|
+
cyclomatic: analysis.complexity.cyclomatic,
|
|
742
|
+
cognitive: analysis.complexity.cognitive,
|
|
743
|
+
loc: analysis.complexity.loc,
|
|
744
|
+
commentDensity: analysis.complexity.commentDensity,
|
|
745
|
+
rating,
|
|
746
|
+
flagged,
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
catch {
|
|
750
|
+
// Skip files that can't be analyzed
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
spinner.stop();
|
|
754
|
+
// Sort by complexity descending
|
|
755
|
+
results.sort((a, b) => b.cyclomatic - a.cyclomatic);
|
|
756
|
+
const flaggedCount = results.filter(r => r.flagged).length;
|
|
757
|
+
const avgComplexity = results.length > 0
|
|
758
|
+
? results.reduce((sum, r) => sum + r.cyclomatic, 0) / results.length
|
|
759
|
+
: 0;
|
|
760
|
+
if (formatType === 'json') {
|
|
761
|
+
const jsonOutput = { files: results, summary: { total: results.length, flagged: flaggedCount, avgComplexity, threshold } };
|
|
762
|
+
if (outputFile) {
|
|
763
|
+
await writeFile(outputFile, JSON.stringify(jsonOutput, null, 2));
|
|
764
|
+
output.printSuccess(`Results written to ${outputFile}`);
|
|
765
|
+
}
|
|
766
|
+
else {
|
|
767
|
+
output.printJson(jsonOutput);
|
|
768
|
+
}
|
|
769
|
+
return { success: true, data: jsonOutput };
|
|
770
|
+
}
|
|
771
|
+
// Summary
|
|
772
|
+
output.printBox([
|
|
773
|
+
`Files analyzed: ${results.length}`,
|
|
774
|
+
`Threshold: ${threshold}`,
|
|
775
|
+
`Flagged files: ${flaggedCount > 0 ? output.error(String(flaggedCount)) : output.success('0')}`,
|
|
776
|
+
`Average complexity: ${formatComplexityValueAst(Math.round(avgComplexity))}`,
|
|
777
|
+
].join('\n'), 'Complexity Analysis');
|
|
778
|
+
// Show flagged files first
|
|
779
|
+
if (flaggedCount > 0) {
|
|
780
|
+
output.writeln();
|
|
781
|
+
output.writeln(output.bold(output.warning(`High Complexity Files (>${threshold})`)));
|
|
782
|
+
output.writeln(output.dim('-'.repeat(60)));
|
|
783
|
+
const flaggedFiles = results.filter(r => r.flagged).slice(0, 10);
|
|
784
|
+
output.printTable({
|
|
785
|
+
columns: [
|
|
786
|
+
{ key: 'file', header: 'File', width: 40, format: (v) => truncatePathAst(v) },
|
|
787
|
+
{ key: 'cyclomatic', header: 'Cyclo', width: 8, align: 'right', format: (v) => output.error(String(v)) },
|
|
788
|
+
{ key: 'cognitive', header: 'Cogni', width: 8, align: 'right' },
|
|
789
|
+
{ key: 'loc', header: 'LOC', width: 8, align: 'right' },
|
|
790
|
+
{ key: 'rating', header: 'Rating', width: 15 },
|
|
791
|
+
],
|
|
792
|
+
data: flaggedFiles,
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
// Show all files in table format
|
|
796
|
+
output.writeln();
|
|
797
|
+
output.writeln(output.bold('All Files'));
|
|
798
|
+
output.writeln(output.dim('-'.repeat(60)));
|
|
799
|
+
const displayFiles = results.slice(0, 15);
|
|
800
|
+
output.printTable({
|
|
801
|
+
columns: [
|
|
802
|
+
{ key: 'file', header: 'File', width: 40, format: (v) => truncatePathAst(v) },
|
|
803
|
+
{ key: 'cyclomatic', header: 'Cyclo', width: 8, align: 'right', format: (v) => formatComplexityValueAst(v) },
|
|
804
|
+
{ key: 'cognitive', header: 'Cogni', width: 8, align: 'right' },
|
|
805
|
+
{ key: 'loc', header: 'LOC', width: 8, align: 'right' },
|
|
806
|
+
],
|
|
807
|
+
data: displayFiles,
|
|
808
|
+
});
|
|
809
|
+
if (results.length > 15) {
|
|
810
|
+
output.writeln(output.dim(` ... and ${results.length - 15} more files`));
|
|
811
|
+
}
|
|
812
|
+
if (outputFile) {
|
|
813
|
+
await writeFile(outputFile, JSON.stringify({ files: results, summary: { total: results.length, flagged: flaggedCount, avgComplexity, threshold } }, null, 2));
|
|
814
|
+
output.printSuccess(`Results written to ${outputFile}`);
|
|
815
|
+
}
|
|
816
|
+
return { success: true, data: { files: results, flaggedCount } };
|
|
817
|
+
}
|
|
818
|
+
catch (error) {
|
|
819
|
+
spinner.stop();
|
|
820
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
821
|
+
output.printError(`Complexity analysis failed: ${message}`);
|
|
822
|
+
return { success: false, exitCode: 1 };
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
};
|
|
826
|
+
/**
|
|
827
|
+
* Symbol extraction subcommand
|
|
828
|
+
*/
|
|
829
|
+
const symbolsCommand = {
|
|
830
|
+
name: 'symbols',
|
|
831
|
+
aliases: ['sym'],
|
|
832
|
+
description: 'Extract and list code symbols (functions, classes, types)',
|
|
833
|
+
options: [
|
|
834
|
+
{
|
|
835
|
+
name: 'type',
|
|
836
|
+
short: 't',
|
|
837
|
+
description: 'Filter by symbol type (function, class, all)',
|
|
838
|
+
type: 'string',
|
|
839
|
+
default: 'all',
|
|
840
|
+
choices: ['function', 'class', 'all'],
|
|
841
|
+
},
|
|
842
|
+
{
|
|
843
|
+
name: 'format',
|
|
844
|
+
short: 'f',
|
|
845
|
+
description: 'Output format (text, json)',
|
|
846
|
+
type: 'string',
|
|
847
|
+
default: 'text',
|
|
848
|
+
choices: ['text', 'json'],
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
name: 'output',
|
|
852
|
+
short: 'o',
|
|
853
|
+
description: 'Output file path',
|
|
854
|
+
type: 'string',
|
|
855
|
+
},
|
|
856
|
+
],
|
|
857
|
+
examples: [
|
|
858
|
+
{ command: 'monomind analyze symbols src/', description: 'Extract all symbols' },
|
|
859
|
+
{ command: 'monomind analyze symbols src/ --type function', description: 'Only functions' },
|
|
860
|
+
{ command: 'monomind analyze symbols src/ --format json', description: 'JSON output' },
|
|
861
|
+
],
|
|
862
|
+
action: async (ctx) => {
|
|
863
|
+
const targetPath = ctx.args[0] || ctx.cwd;
|
|
864
|
+
const symbolType = ctx.flags.type || 'all';
|
|
865
|
+
const formatType = ctx.flags.format || 'text';
|
|
866
|
+
const outputFile = ctx.flags.output;
|
|
867
|
+
output.printInfo(`Extracting symbols: ${output.highlight(targetPath)}`);
|
|
868
|
+
output.writeln();
|
|
869
|
+
const spinner = output.createSpinner({ text: 'Parsing code...', spinner: 'dots' });
|
|
870
|
+
spinner.start();
|
|
871
|
+
try {
|
|
872
|
+
const astModule = await getASTAnalyzer();
|
|
873
|
+
const resolvedPath = resolve(targetPath);
|
|
874
|
+
const stat = await fs.stat(resolvedPath);
|
|
875
|
+
const files = stat.isDirectory() ? await scanSourceFiles(resolvedPath) : [resolvedPath];
|
|
876
|
+
const symbols = [];
|
|
877
|
+
for (const file of files.slice(0, 100)) {
|
|
878
|
+
try {
|
|
879
|
+
const content = await fs.readFile(file, 'utf-8');
|
|
880
|
+
let analysis;
|
|
881
|
+
if (astModule) {
|
|
882
|
+
const analyzer = astModule.createASTAnalyzer();
|
|
883
|
+
analysis = analyzer.analyze(content, file);
|
|
884
|
+
}
|
|
885
|
+
else {
|
|
886
|
+
analysis = fallbackAnalyze(content, file);
|
|
887
|
+
}
|
|
888
|
+
if (symbolType === 'all' || symbolType === 'function') {
|
|
889
|
+
for (const fn of analysis.functions) {
|
|
890
|
+
symbols.push({
|
|
891
|
+
name: fn.name,
|
|
892
|
+
type: 'function',
|
|
893
|
+
file,
|
|
894
|
+
startLine: fn.startLine,
|
|
895
|
+
endLine: fn.endLine,
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
if (symbolType === 'all' || symbolType === 'class') {
|
|
900
|
+
for (const cls of analysis.classes) {
|
|
901
|
+
symbols.push({
|
|
902
|
+
name: cls.name,
|
|
903
|
+
type: 'class',
|
|
904
|
+
file,
|
|
905
|
+
startLine: cls.startLine,
|
|
906
|
+
endLine: cls.endLine,
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
catch {
|
|
912
|
+
// Skip files that can't be parsed
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
spinner.stop();
|
|
916
|
+
// Sort by file then name
|
|
917
|
+
symbols.sort((a, b) => a.file.localeCompare(b.file) || a.name.localeCompare(b.name));
|
|
918
|
+
if (formatType === 'json') {
|
|
919
|
+
if (outputFile) {
|
|
920
|
+
await writeFile(outputFile, JSON.stringify(symbols, null, 2));
|
|
921
|
+
output.printSuccess(`Results written to ${outputFile}`);
|
|
922
|
+
}
|
|
923
|
+
else {
|
|
924
|
+
output.printJson(symbols);
|
|
925
|
+
}
|
|
926
|
+
return { success: true, data: symbols };
|
|
927
|
+
}
|
|
928
|
+
// Summary
|
|
929
|
+
const functionCount = symbols.filter(s => s.type === 'function').length;
|
|
930
|
+
const classCount = symbols.filter(s => s.type === 'class').length;
|
|
931
|
+
output.printBox([
|
|
932
|
+
`Total symbols: ${symbols.length}`,
|
|
933
|
+
`Functions: ${functionCount}`,
|
|
934
|
+
`Classes: ${classCount}`,
|
|
935
|
+
`Files: ${files.length}`,
|
|
936
|
+
].join('\n'), 'Symbol Extraction');
|
|
937
|
+
output.writeln();
|
|
938
|
+
output.writeln(output.bold('Symbols'));
|
|
939
|
+
output.writeln(output.dim('-'.repeat(60)));
|
|
940
|
+
const displaySymbols = symbols.slice(0, 30);
|
|
941
|
+
output.printTable({
|
|
942
|
+
columns: [
|
|
943
|
+
{ key: 'type', header: 'Type', width: 10, format: (v) => getTypeMarkerAst(v) },
|
|
944
|
+
{ key: 'name', header: 'Name', width: 30 },
|
|
945
|
+
{ key: 'file', header: 'File', width: 35, format: (v) => truncatePathAst(v, 33) },
|
|
946
|
+
{ key: 'startLine', header: 'Line', width: 8, align: 'right' },
|
|
947
|
+
],
|
|
948
|
+
data: displaySymbols,
|
|
949
|
+
});
|
|
950
|
+
if (symbols.length > 30) {
|
|
951
|
+
output.writeln(output.dim(` ... and ${symbols.length - 30} more symbols`));
|
|
952
|
+
}
|
|
953
|
+
if (outputFile) {
|
|
954
|
+
await writeFile(outputFile, JSON.stringify(symbols, null, 2));
|
|
955
|
+
output.printSuccess(`Results written to ${outputFile}`);
|
|
956
|
+
}
|
|
957
|
+
return { success: true, data: symbols };
|
|
958
|
+
}
|
|
959
|
+
catch (error) {
|
|
960
|
+
spinner.stop();
|
|
961
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
962
|
+
output.printError(`Symbol extraction failed: ${message}`);
|
|
963
|
+
return { success: false, exitCode: 1 };
|
|
964
|
+
}
|
|
965
|
+
},
|
|
966
|
+
};
|
|
967
|
+
/**
|
|
968
|
+
* Imports analysis subcommand
|
|
969
|
+
*/
|
|
970
|
+
const importsCommand = {
|
|
971
|
+
name: 'imports',
|
|
972
|
+
aliases: ['imp'],
|
|
973
|
+
description: 'Analyze import dependencies across files',
|
|
974
|
+
options: [
|
|
975
|
+
{
|
|
976
|
+
name: 'format',
|
|
977
|
+
short: 'f',
|
|
978
|
+
description: 'Output format (text, json)',
|
|
979
|
+
type: 'string',
|
|
980
|
+
default: 'text',
|
|
981
|
+
choices: ['text', 'json'],
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
name: 'output',
|
|
985
|
+
short: 'o',
|
|
986
|
+
description: 'Output file path',
|
|
987
|
+
type: 'string',
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
name: 'external',
|
|
991
|
+
short: 'e',
|
|
992
|
+
description: 'Show only external (npm) imports',
|
|
993
|
+
type: 'boolean',
|
|
994
|
+
default: false,
|
|
995
|
+
},
|
|
996
|
+
],
|
|
997
|
+
examples: [
|
|
998
|
+
{ command: 'monomind analyze imports src/', description: 'Analyze all imports' },
|
|
999
|
+
{ command: 'monomind analyze imports src/ --external', description: 'Only npm packages' },
|
|
1000
|
+
],
|
|
1001
|
+
action: async (ctx) => {
|
|
1002
|
+
const targetPath = ctx.args[0] || ctx.cwd;
|
|
1003
|
+
const formatType = ctx.flags.format || 'text';
|
|
1004
|
+
const outputFile = ctx.flags.output;
|
|
1005
|
+
const externalOnly = ctx.flags.external;
|
|
1006
|
+
output.printInfo(`Analyzing imports: ${output.highlight(targetPath)}`);
|
|
1007
|
+
output.writeln();
|
|
1008
|
+
const spinner = output.createSpinner({ text: 'Scanning imports...', spinner: 'dots' });
|
|
1009
|
+
spinner.start();
|
|
1010
|
+
try {
|
|
1011
|
+
const astModule = await getASTAnalyzer();
|
|
1012
|
+
const resolvedPath = resolve(targetPath);
|
|
1013
|
+
const stat = await fs.stat(resolvedPath);
|
|
1014
|
+
const files = stat.isDirectory() ? await scanSourceFiles(resolvedPath) : [resolvedPath];
|
|
1015
|
+
const importCounts = new Map();
|
|
1016
|
+
const fileImports = new Map();
|
|
1017
|
+
for (const file of files.slice(0, 100)) {
|
|
1018
|
+
try {
|
|
1019
|
+
const content = await fs.readFile(file, 'utf-8');
|
|
1020
|
+
let analysis;
|
|
1021
|
+
if (astModule) {
|
|
1022
|
+
const analyzer = astModule.createASTAnalyzer();
|
|
1023
|
+
analysis = analyzer.analyze(content, file);
|
|
1024
|
+
}
|
|
1025
|
+
else {
|
|
1026
|
+
analysis = fallbackAnalyze(content, file);
|
|
1027
|
+
}
|
|
1028
|
+
const imports = analysis.imports.filter(imp => {
|
|
1029
|
+
if (externalOnly) {
|
|
1030
|
+
return !imp.startsWith('.') && !imp.startsWith('/');
|
|
1031
|
+
}
|
|
1032
|
+
return true;
|
|
1033
|
+
});
|
|
1034
|
+
fileImports.set(file, imports);
|
|
1035
|
+
for (const imp of imports) {
|
|
1036
|
+
const existing = importCounts.get(imp) || { count: 0, files: [] };
|
|
1037
|
+
existing.count++;
|
|
1038
|
+
existing.files.push(file);
|
|
1039
|
+
importCounts.set(imp, existing);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
catch {
|
|
1043
|
+
// Skip files that can't be parsed
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
spinner.stop();
|
|
1047
|
+
// Sort by count
|
|
1048
|
+
const sortedImports = Array.from(importCounts.entries())
|
|
1049
|
+
.sort((a, b) => b[1].count - a[1].count);
|
|
1050
|
+
if (formatType === 'json') {
|
|
1051
|
+
const jsonOutput = {
|
|
1052
|
+
imports: Object.fromEntries(sortedImports),
|
|
1053
|
+
fileImports: Object.fromEntries(fileImports),
|
|
1054
|
+
};
|
|
1055
|
+
if (outputFile) {
|
|
1056
|
+
await writeFile(outputFile, JSON.stringify(jsonOutput, null, 2));
|
|
1057
|
+
output.printSuccess(`Results written to ${outputFile}`);
|
|
1058
|
+
}
|
|
1059
|
+
else {
|
|
1060
|
+
output.printJson(jsonOutput);
|
|
1061
|
+
}
|
|
1062
|
+
return { success: true, data: jsonOutput };
|
|
1063
|
+
}
|
|
1064
|
+
// Summary
|
|
1065
|
+
const externalImports = sortedImports.filter(([imp]) => !imp.startsWith('.') && !imp.startsWith('/'));
|
|
1066
|
+
const localImports = sortedImports.filter(([imp]) => imp.startsWith('.') || imp.startsWith('/'));
|
|
1067
|
+
output.printBox([
|
|
1068
|
+
`Total unique imports: ${sortedImports.length}`,
|
|
1069
|
+
`External (npm): ${externalImports.length}`,
|
|
1070
|
+
`Local (relative): ${localImports.length}`,
|
|
1071
|
+
`Files scanned: ${files.length}`,
|
|
1072
|
+
].join('\n'), 'Import Analysis');
|
|
1073
|
+
// Most used imports
|
|
1074
|
+
output.writeln();
|
|
1075
|
+
output.writeln(output.bold('Most Used Imports'));
|
|
1076
|
+
output.writeln(output.dim('-'.repeat(60)));
|
|
1077
|
+
const topImports = sortedImports.slice(0, 20);
|
|
1078
|
+
output.printTable({
|
|
1079
|
+
columns: [
|
|
1080
|
+
{ key: 'count', header: 'Uses', width: 8, align: 'right' },
|
|
1081
|
+
{ key: 'import', header: 'Import', width: 50 },
|
|
1082
|
+
{ key: 'type', header: 'Type', width: 10 },
|
|
1083
|
+
],
|
|
1084
|
+
data: topImports.map(([imp, data]) => ({
|
|
1085
|
+
count: data.count,
|
|
1086
|
+
import: imp,
|
|
1087
|
+
type: imp.startsWith('.') || imp.startsWith('/') ? output.dim('local') : output.highlight('npm'),
|
|
1088
|
+
})),
|
|
1089
|
+
});
|
|
1090
|
+
if (sortedImports.length > 20) {
|
|
1091
|
+
output.writeln(output.dim(` ... and ${sortedImports.length - 20} more imports`));
|
|
1092
|
+
}
|
|
1093
|
+
if (outputFile) {
|
|
1094
|
+
await writeFile(outputFile, JSON.stringify({
|
|
1095
|
+
imports: Object.fromEntries(sortedImports),
|
|
1096
|
+
fileImports: Object.fromEntries(fileImports),
|
|
1097
|
+
}, null, 2));
|
|
1098
|
+
output.printSuccess(`Results written to ${outputFile}`);
|
|
1099
|
+
}
|
|
1100
|
+
return { success: true, data: { imports: sortedImports } };
|
|
1101
|
+
}
|
|
1102
|
+
catch (error) {
|
|
1103
|
+
spinner.stop();
|
|
1104
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1105
|
+
output.printError(`Import analysis failed: ${message}`);
|
|
1106
|
+
return { success: false, exitCode: 1 };
|
|
1107
|
+
}
|
|
1108
|
+
},
|
|
1109
|
+
};
|
|
1110
|
+
/**
|
|
1111
|
+
* Helper: Scan directory for source files
|
|
1112
|
+
*/
|
|
1113
|
+
async function scanSourceFiles(dir, maxDepth = 10) {
|
|
1114
|
+
const files = [];
|
|
1115
|
+
const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'];
|
|
1116
|
+
const excludeDirs = ['node_modules', 'dist', 'build', '.git', 'coverage', '__pycache__'];
|
|
1117
|
+
async function scan(currentDir, depth) {
|
|
1118
|
+
if (depth > maxDepth)
|
|
1119
|
+
return;
|
|
1120
|
+
try {
|
|
1121
|
+
const entries = await fs.readdir(currentDir, { withFileTypes: true });
|
|
1122
|
+
for (const entry of entries) {
|
|
1123
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
1124
|
+
if (entry.isDirectory()) {
|
|
1125
|
+
if (!excludeDirs.includes(entry.name)) {
|
|
1126
|
+
await scan(fullPath, depth + 1);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
else if (entry.isFile()) {
|
|
1130
|
+
const ext = path.extname(entry.name);
|
|
1131
|
+
if (extensions.includes(ext)) {
|
|
1132
|
+
files.push(fullPath);
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
catch {
|
|
1138
|
+
// Skip directories we can't read
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
await scan(dir, 0);
|
|
1142
|
+
return files;
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Fallback analysis when ruvector is not available
|
|
1146
|
+
*/
|
|
1147
|
+
function fallbackAnalyze(code, filePath) {
|
|
1148
|
+
const lines = code.split('\n');
|
|
1149
|
+
const functions = [];
|
|
1150
|
+
const classes = [];
|
|
1151
|
+
const imports = [];
|
|
1152
|
+
const exports = [];
|
|
1153
|
+
// Extract functions
|
|
1154
|
+
const funcPattern = /(?:export\s+)?(?:async\s+)?function\s+(\w+)|(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?\([^)]*\)\s*=>|^\s*(?:async\s+)?(\w+)\s*\([^)]*\)\s*(?::\s*\w+)?\s*\{/gm;
|
|
1155
|
+
let match;
|
|
1156
|
+
while ((match = funcPattern.exec(code)) !== null) {
|
|
1157
|
+
const name = match[1] || match[2] || match[3];
|
|
1158
|
+
if (name && !['if', 'while', 'for', 'switch'].includes(name)) {
|
|
1159
|
+
const lineNum = code.substring(0, match.index).split('\n').length;
|
|
1160
|
+
functions.push({ name, startLine: lineNum, endLine: lineNum + 10 });
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
// Extract classes
|
|
1164
|
+
const classPattern = /(?:export\s+)?class\s+(\w+)/gm;
|
|
1165
|
+
while ((match = classPattern.exec(code)) !== null) {
|
|
1166
|
+
const lineNum = code.substring(0, match.index).split('\n').length;
|
|
1167
|
+
classes.push({ name: match[1], startLine: lineNum, endLine: lineNum + 20 });
|
|
1168
|
+
}
|
|
1169
|
+
// Extract imports
|
|
1170
|
+
const importPattern = /import\s+(?:.*\s+from\s+)?['"]([^'"]+)['"]/gm;
|
|
1171
|
+
while ((match = importPattern.exec(code)) !== null) {
|
|
1172
|
+
imports.push(match[1]);
|
|
1173
|
+
}
|
|
1174
|
+
const requirePattern = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/gm;
|
|
1175
|
+
while ((match = requirePattern.exec(code)) !== null) {
|
|
1176
|
+
imports.push(match[1]);
|
|
1177
|
+
}
|
|
1178
|
+
// Extract exports
|
|
1179
|
+
const exportPattern = /export\s+(?:default\s+)?(?:const|let|var|function|class|interface|type|enum)\s+(\w+)/gm;
|
|
1180
|
+
while ((match = exportPattern.exec(code)) !== null) {
|
|
1181
|
+
exports.push(match[1]);
|
|
1182
|
+
}
|
|
1183
|
+
// Calculate complexity
|
|
1184
|
+
const nonEmptyLines = lines.filter(l => l.trim().length > 0).length;
|
|
1185
|
+
const commentLines = lines.filter(l => /^\s*(\/\/|\/\*|\*|#)/.test(l)).length;
|
|
1186
|
+
const decisionPoints = (code.match(/\b(if|else|for|while|switch|case|catch|&&|\|\||\?)\b/g) || []).length;
|
|
1187
|
+
let cognitive = 0;
|
|
1188
|
+
let nestingLevel = 0;
|
|
1189
|
+
for (const line of lines) {
|
|
1190
|
+
const opens = (line.match(/\{/g) || []).length;
|
|
1191
|
+
const closes = (line.match(/\}/g) || []).length;
|
|
1192
|
+
if (/\b(if|for|while|switch)\b/.test(line)) {
|
|
1193
|
+
cognitive += 1 + nestingLevel;
|
|
1194
|
+
}
|
|
1195
|
+
nestingLevel = Math.max(0, nestingLevel + opens - closes);
|
|
1196
|
+
}
|
|
1197
|
+
// Detect language
|
|
1198
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
1199
|
+
const language = ext === '.ts' || ext === '.tsx' ? 'typescript' :
|
|
1200
|
+
ext === '.js' || ext === '.jsx' || ext === '.mjs' || ext === '.cjs' ? 'javascript' :
|
|
1201
|
+
ext === '.py' ? 'python' : 'unknown';
|
|
1202
|
+
return {
|
|
1203
|
+
filePath,
|
|
1204
|
+
language,
|
|
1205
|
+
functions,
|
|
1206
|
+
classes,
|
|
1207
|
+
imports,
|
|
1208
|
+
exports,
|
|
1209
|
+
complexity: {
|
|
1210
|
+
cyclomatic: decisionPoints + 1,
|
|
1211
|
+
cognitive,
|
|
1212
|
+
loc: nonEmptyLines,
|
|
1213
|
+
commentDensity: lines.length > 0 ? commentLines / lines.length : 0,
|
|
1214
|
+
},
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
// Dependencies subcommand
|
|
1218
|
+
const depsCommand = {
|
|
1219
|
+
name: 'deps',
|
|
1220
|
+
description: 'Analyze project dependencies',
|
|
1221
|
+
options: [
|
|
1222
|
+
{ name: 'outdated', short: 'o', type: 'boolean', description: 'Show only outdated dependencies' },
|
|
1223
|
+
{ name: 'security', short: 's', type: 'boolean', description: 'Check for security vulnerabilities' },
|
|
1224
|
+
{ name: 'format', short: 'f', type: 'string', description: 'Output format: text, json', default: 'text' },
|
|
1225
|
+
],
|
|
1226
|
+
examples: [
|
|
1227
|
+
{ command: 'monomind analyze deps --outdated', description: 'Show outdated dependencies' },
|
|
1228
|
+
{ command: 'monomind analyze deps --security', description: 'Check for vulnerabilities' },
|
|
1229
|
+
],
|
|
1230
|
+
action: async (ctx) => {
|
|
1231
|
+
const showOutdated = ctx.flags.outdated;
|
|
1232
|
+
const checkSecurity = ctx.flags.security;
|
|
1233
|
+
const formatJson = ctx.flags.format === 'json';
|
|
1234
|
+
output.writeln();
|
|
1235
|
+
output.writeln(output.bold('Dependency Analysis'));
|
|
1236
|
+
output.writeln(output.dim('-'.repeat(50)));
|
|
1237
|
+
try {
|
|
1238
|
+
const pkgPath = resolve('package.json');
|
|
1239
|
+
let pkgContent;
|
|
1240
|
+
try {
|
|
1241
|
+
pkgContent = await fs.readFile(pkgPath, 'utf-8');
|
|
1242
|
+
}
|
|
1243
|
+
catch {
|
|
1244
|
+
output.printError('No package.json found in current directory');
|
|
1245
|
+
return { success: false, exitCode: 1 };
|
|
1246
|
+
}
|
|
1247
|
+
const pkg = JSON.parse(pkgContent);
|
|
1248
|
+
const deps = Object.entries(pkg.dependencies || {});
|
|
1249
|
+
const devDeps = Object.entries(pkg.devDependencies || {});
|
|
1250
|
+
const optDeps = Object.entries(pkg.optionalDependencies || {});
|
|
1251
|
+
const peerDeps = Object.entries(pkg.peerDependencies || {});
|
|
1252
|
+
const total = deps.length + devDeps.length + optDeps.length + peerDeps.length;
|
|
1253
|
+
if (formatJson && !showOutdated && !checkSecurity) {
|
|
1254
|
+
const jsonData = { name: pkg.name, version: pkg.version, dependencies: deps.length, devDependencies: devDeps.length, optionalDependencies: optDeps.length, peerDependencies: peerDeps.length, total };
|
|
1255
|
+
output.printJson(jsonData);
|
|
1256
|
+
return { success: true, data: jsonData };
|
|
1257
|
+
}
|
|
1258
|
+
output.printBox([`Package: ${pkg.name || 'unknown'} @ ${pkg.version || '0.0.0'}`, `Dependencies: ${deps.length}`, `Dev Dependencies: ${devDeps.length}`, `Optional: ${optDeps.length}`, `Peer: ${peerDeps.length}`, `Total: ${total}`].join('\n'), 'Dependency Summary');
|
|
1259
|
+
if (showOutdated) {
|
|
1260
|
+
output.writeln();
|
|
1261
|
+
output.writeln(output.bold('Outdated Check'));
|
|
1262
|
+
output.writeln(output.dim('-'.repeat(60)));
|
|
1263
|
+
const outdated = [];
|
|
1264
|
+
const checkDeps = async (entries, category) => {
|
|
1265
|
+
for (const [name, declared] of entries) {
|
|
1266
|
+
try {
|
|
1267
|
+
const installedPkg = resolve('node_modules', name, 'package.json');
|
|
1268
|
+
const raw = await fs.readFile(installedPkg, 'utf-8');
|
|
1269
|
+
const installedContent = JSON.parse(raw);
|
|
1270
|
+
const installed = installedContent.version || 'unknown';
|
|
1271
|
+
const cleanDeclared = declared.replace(/^[\^~>=<]+/, '');
|
|
1272
|
+
if (installed !== cleanDeclared) {
|
|
1273
|
+
outdated.push({ name, declared: declared, installed, category });
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
catch {
|
|
1277
|
+
outdated.push({ name, declared: declared, installed: 'not installed', category });
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
};
|
|
1281
|
+
await checkDeps(deps, 'prod');
|
|
1282
|
+
await checkDeps(devDeps, 'dev');
|
|
1283
|
+
if (outdated.length === 0) {
|
|
1284
|
+
output.printSuccess('All dependencies match declared versions');
|
|
1285
|
+
}
|
|
1286
|
+
else {
|
|
1287
|
+
output.printTable({
|
|
1288
|
+
columns: [
|
|
1289
|
+
{ key: 'name', header: 'Package', width: 30 },
|
|
1290
|
+
{ key: 'declared', header: 'Declared', width: 14 },
|
|
1291
|
+
{ key: 'installed', header: 'Installed', width: 14 },
|
|
1292
|
+
{ key: 'category', header: 'Type', width: 6 },
|
|
1293
|
+
],
|
|
1294
|
+
data: outdated.slice(0, 30),
|
|
1295
|
+
});
|
|
1296
|
+
if (outdated.length > 30) {
|
|
1297
|
+
output.writeln(output.dim(` ... and ${outdated.length - 30} more`));
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
if (checkSecurity) {
|
|
1302
|
+
output.writeln();
|
|
1303
|
+
output.writeln(output.bold('Security Audit'));
|
|
1304
|
+
output.writeln(output.dim('-'.repeat(60)));
|
|
1305
|
+
try {
|
|
1306
|
+
const auditRaw = execSync('npm audit --json 2>/dev/null', { encoding: 'utf-8', maxBuffer: 10 * 1024 * 1024 });
|
|
1307
|
+
const audit = JSON.parse(auditRaw);
|
|
1308
|
+
const vulns = audit.metadata?.vulnerabilities || audit.vulnerabilities || {};
|
|
1309
|
+
const info = vulns.info || 0;
|
|
1310
|
+
const low = vulns.low || 0;
|
|
1311
|
+
const moderate = vulns.moderate || 0;
|
|
1312
|
+
const high = vulns.high || 0;
|
|
1313
|
+
const critical = vulns.critical || 0;
|
|
1314
|
+
const totalVulns = info + low + moderate + high + critical;
|
|
1315
|
+
if (totalVulns === 0) {
|
|
1316
|
+
output.printSuccess('No known vulnerabilities found');
|
|
1317
|
+
}
|
|
1318
|
+
else {
|
|
1319
|
+
output.printTable({
|
|
1320
|
+
columns: [
|
|
1321
|
+
{ key: 'severity', header: 'Severity', width: 12 },
|
|
1322
|
+
{ key: 'count', header: 'Count', width: 8, align: 'right' },
|
|
1323
|
+
],
|
|
1324
|
+
data: [
|
|
1325
|
+
...(critical > 0 ? [{ severity: 'Critical', count: critical }] : []),
|
|
1326
|
+
...(high > 0 ? [{ severity: 'High', count: high }] : []),
|
|
1327
|
+
...(moderate > 0 ? [{ severity: 'Moderate', count: moderate }] : []),
|
|
1328
|
+
...(low > 0 ? [{ severity: 'Low', count: low }] : []),
|
|
1329
|
+
...(info > 0 ? [{ severity: 'Info', count: info }] : []),
|
|
1330
|
+
{ severity: 'Total', count: totalVulns },
|
|
1331
|
+
],
|
|
1332
|
+
});
|
|
1333
|
+
if (critical > 0 || high > 0) {
|
|
1334
|
+
output.printWarning(`${critical + high} high/critical vulnerabilities found. Run 'npm audit' for details.`);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
catch {
|
|
1339
|
+
output.printWarning('npm audit failed. Ensure npm is available and node_modules is installed.');
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
return { success: true };
|
|
1343
|
+
}
|
|
1344
|
+
catch (error) {
|
|
1345
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1346
|
+
output.printError(`Dependency analysis failed: ${message}`);
|
|
1347
|
+
return { success: false, exitCode: 1 };
|
|
1348
|
+
}
|
|
1349
|
+
},
|
|
1350
|
+
};
|
|
1351
|
+
// ============================================================================
|
|
1352
|
+
// Graph Analysis Subcommands (MinCut, Louvain, Circular Dependencies)
|
|
1353
|
+
// ============================================================================
|
|
1354
|
+
/**
|
|
1355
|
+
* Analyze code boundaries using MinCut algorithm
|
|
1356
|
+
*/
|
|
1357
|
+
const boundariesCommand = {
|
|
1358
|
+
name: 'boundaries',
|
|
1359
|
+
aliases: ['boundary', 'mincut'],
|
|
1360
|
+
description: 'Find natural code boundaries using MinCut algorithm',
|
|
1361
|
+
options: [
|
|
1362
|
+
{
|
|
1363
|
+
name: 'partitions',
|
|
1364
|
+
short: 'p',
|
|
1365
|
+
description: 'Number of partitions to find',
|
|
1366
|
+
type: 'number',
|
|
1367
|
+
default: 2,
|
|
1368
|
+
},
|
|
1369
|
+
{
|
|
1370
|
+
name: 'output',
|
|
1371
|
+
short: 'o',
|
|
1372
|
+
description: 'Output file path',
|
|
1373
|
+
type: 'string',
|
|
1374
|
+
},
|
|
1375
|
+
{
|
|
1376
|
+
name: 'format',
|
|
1377
|
+
short: 'f',
|
|
1378
|
+
description: 'Output format (text, json, dot)',
|
|
1379
|
+
type: 'string',
|
|
1380
|
+
default: 'text',
|
|
1381
|
+
choices: ['text', 'json', 'dot'],
|
|
1382
|
+
},
|
|
1383
|
+
],
|
|
1384
|
+
examples: [
|
|
1385
|
+
{ command: 'monomind analyze boundaries src/', description: 'Find code boundaries in src/' },
|
|
1386
|
+
{ command: 'monomind analyze boundaries -p 3 src/', description: 'Find 3 partitions' },
|
|
1387
|
+
{ command: 'monomind analyze boundaries -f dot -o graph.dot src/', description: 'Export to DOT format' },
|
|
1388
|
+
],
|
|
1389
|
+
action: async (ctx) => {
|
|
1390
|
+
const targetDir = ctx.args[0] || ctx.cwd;
|
|
1391
|
+
const numPartitions = ctx.flags.partitions || 2;
|
|
1392
|
+
const outputFile = ctx.flags.output;
|
|
1393
|
+
const format = ctx.flags.format || 'text';
|
|
1394
|
+
output.printInfo(`Analyzing code boundaries in: ${output.highlight(targetDir)}`);
|
|
1395
|
+
output.writeln();
|
|
1396
|
+
const spinner = output.createSpinner({ text: 'Building dependency graph...', spinner: 'dots' });
|
|
1397
|
+
spinner.start();
|
|
1398
|
+
try {
|
|
1399
|
+
const analyzer = await getGraphAnalyzer();
|
|
1400
|
+
if (!analyzer) {
|
|
1401
|
+
spinner.stop();
|
|
1402
|
+
output.printError('Graph analyzer module not available');
|
|
1403
|
+
return { success: false, exitCode: 1 };
|
|
1404
|
+
}
|
|
1405
|
+
const result = await analyzer.analyzeGraph(resolve(targetDir), {
|
|
1406
|
+
includeBoundaries: true,
|
|
1407
|
+
includeModules: false,
|
|
1408
|
+
numPartitions,
|
|
1409
|
+
});
|
|
1410
|
+
spinner.stop();
|
|
1411
|
+
// Handle different output formats
|
|
1412
|
+
if (format === 'json') {
|
|
1413
|
+
const jsonOutput = {
|
|
1414
|
+
boundaries: result.boundaries,
|
|
1415
|
+
statistics: result.statistics,
|
|
1416
|
+
circularDependencies: result.circularDependencies,
|
|
1417
|
+
};
|
|
1418
|
+
if (outputFile) {
|
|
1419
|
+
await writeFile(outputFile, JSON.stringify(jsonOutput, null, 2));
|
|
1420
|
+
output.printSuccess(`Results written to ${outputFile}`);
|
|
1421
|
+
}
|
|
1422
|
+
else {
|
|
1423
|
+
output.printJson(jsonOutput);
|
|
1424
|
+
}
|
|
1425
|
+
return { success: true, data: jsonOutput };
|
|
1426
|
+
}
|
|
1427
|
+
if (format === 'dot') {
|
|
1428
|
+
const dotOutput = analyzer.exportToDot(result, {
|
|
1429
|
+
includeLabels: true,
|
|
1430
|
+
highlightCycles: true,
|
|
1431
|
+
});
|
|
1432
|
+
if (outputFile) {
|
|
1433
|
+
await writeFile(outputFile, dotOutput);
|
|
1434
|
+
output.printSuccess(`DOT graph written to ${outputFile}`);
|
|
1435
|
+
output.writeln(output.dim('Visualize with: dot -Tpng -o graph.png ' + outputFile));
|
|
1436
|
+
}
|
|
1437
|
+
else {
|
|
1438
|
+
output.writeln(dotOutput);
|
|
1439
|
+
}
|
|
1440
|
+
return { success: true };
|
|
1441
|
+
}
|
|
1442
|
+
// Text format (default)
|
|
1443
|
+
output.printBox([
|
|
1444
|
+
`Files analyzed: ${result.statistics.nodeCount}`,
|
|
1445
|
+
`Dependencies: ${result.statistics.edgeCount}`,
|
|
1446
|
+
`Avg degree: ${result.statistics.avgDegree.toFixed(2)}`,
|
|
1447
|
+
`Density: ${(result.statistics.density * 100).toFixed(2)}%`,
|
|
1448
|
+
`Components: ${result.statistics.componentCount}`,
|
|
1449
|
+
].join('\n'), 'Graph Statistics');
|
|
1450
|
+
if (result.boundaries && result.boundaries.length > 0) {
|
|
1451
|
+
output.writeln();
|
|
1452
|
+
output.writeln(output.bold('MinCut Boundaries'));
|
|
1453
|
+
output.writeln();
|
|
1454
|
+
for (let i = 0; i < result.boundaries.length; i++) {
|
|
1455
|
+
const boundary = result.boundaries[i];
|
|
1456
|
+
output.writeln(output.bold(`Boundary ${i + 1} (cut value: ${boundary.cutValue})`));
|
|
1457
|
+
output.writeln();
|
|
1458
|
+
output.writeln(output.dim('Partition 1:'));
|
|
1459
|
+
const p1Display = boundary.partition1.slice(0, 10);
|
|
1460
|
+
output.printList(p1Display);
|
|
1461
|
+
if (boundary.partition1.length > 10) {
|
|
1462
|
+
output.writeln(output.dim(` ... and ${boundary.partition1.length - 10} more files`));
|
|
1463
|
+
}
|
|
1464
|
+
output.writeln();
|
|
1465
|
+
output.writeln(output.dim('Partition 2:'));
|
|
1466
|
+
const p2Display = boundary.partition2.slice(0, 10);
|
|
1467
|
+
output.printList(p2Display);
|
|
1468
|
+
if (boundary.partition2.length > 10) {
|
|
1469
|
+
output.writeln(output.dim(` ... and ${boundary.partition2.length - 10} more files`));
|
|
1470
|
+
}
|
|
1471
|
+
output.writeln();
|
|
1472
|
+
output.writeln(output.success('Suggestion:'));
|
|
1473
|
+
output.writeln(` ${boundary.suggestion}`);
|
|
1474
|
+
output.writeln();
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
// Show circular dependencies
|
|
1478
|
+
if (result.circularDependencies.length > 0) {
|
|
1479
|
+
output.writeln();
|
|
1480
|
+
output.writeln(output.bold(output.warning('Circular Dependencies Detected')));
|
|
1481
|
+
output.writeln();
|
|
1482
|
+
for (const cycle of result.circularDependencies.slice(0, 5)) {
|
|
1483
|
+
const severityColor = cycle.severity === 'high' ? output.error : cycle.severity === 'medium' ? output.warning : output.dim;
|
|
1484
|
+
output.writeln(`${severityColor(`[${cycle.severity.toUpperCase()}]`)} ${cycle.cycle.join(' -> ')}`);
|
|
1485
|
+
output.writeln(output.dim(` ${cycle.suggestion}`));
|
|
1486
|
+
output.writeln();
|
|
1487
|
+
}
|
|
1488
|
+
if (result.circularDependencies.length > 5) {
|
|
1489
|
+
output.writeln(output.dim(`... and ${result.circularDependencies.length - 5} more cycles`));
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
if (outputFile) {
|
|
1493
|
+
await writeFile(outputFile, JSON.stringify(result, null, 2));
|
|
1494
|
+
output.printSuccess(`Full results written to ${outputFile}`);
|
|
1495
|
+
}
|
|
1496
|
+
return { success: true, data: result };
|
|
1497
|
+
}
|
|
1498
|
+
catch (error) {
|
|
1499
|
+
spinner.stop();
|
|
1500
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1501
|
+
output.printError(`Analysis failed: ${message}`);
|
|
1502
|
+
return { success: false, exitCode: 1 };
|
|
1503
|
+
}
|
|
1504
|
+
},
|
|
1505
|
+
};
|
|
1506
|
+
/**
|
|
1507
|
+
* Analyze modules/communities using Louvain algorithm
|
|
1508
|
+
*/
|
|
1509
|
+
const modulesCommand = {
|
|
1510
|
+
name: 'modules',
|
|
1511
|
+
aliases: ['communities', 'louvain'],
|
|
1512
|
+
description: 'Detect module communities using Louvain algorithm',
|
|
1513
|
+
options: [
|
|
1514
|
+
{
|
|
1515
|
+
name: 'output',
|
|
1516
|
+
short: 'o',
|
|
1517
|
+
description: 'Output file path',
|
|
1518
|
+
type: 'string',
|
|
1519
|
+
},
|
|
1520
|
+
{
|
|
1521
|
+
name: 'format',
|
|
1522
|
+
short: 'f',
|
|
1523
|
+
description: 'Output format (text, json, dot)',
|
|
1524
|
+
type: 'string',
|
|
1525
|
+
default: 'text',
|
|
1526
|
+
choices: ['text', 'json', 'dot'],
|
|
1527
|
+
},
|
|
1528
|
+
{
|
|
1529
|
+
name: 'min-size',
|
|
1530
|
+
short: 'm',
|
|
1531
|
+
description: 'Minimum community size to display',
|
|
1532
|
+
type: 'number',
|
|
1533
|
+
default: 2,
|
|
1534
|
+
},
|
|
1535
|
+
],
|
|
1536
|
+
examples: [
|
|
1537
|
+
{ command: 'monomind analyze modules src/', description: 'Detect module communities' },
|
|
1538
|
+
{ command: 'monomind analyze modules -f dot -o modules.dot src/', description: 'Export colored DOT graph' },
|
|
1539
|
+
{ command: 'monomind analyze modules -m 3 src/', description: 'Only show communities with 3+ files' },
|
|
1540
|
+
],
|
|
1541
|
+
action: async (ctx) => {
|
|
1542
|
+
const targetDir = ctx.args[0] || ctx.cwd;
|
|
1543
|
+
const outputFile = ctx.flags.output;
|
|
1544
|
+
const format = ctx.flags.format || 'text';
|
|
1545
|
+
const minSize = ctx.flags['min-size'] || 2;
|
|
1546
|
+
output.printInfo(`Detecting module communities in: ${output.highlight(targetDir)}`);
|
|
1547
|
+
output.writeln();
|
|
1548
|
+
const spinner = output.createSpinner({ text: 'Building dependency graph...', spinner: 'dots' });
|
|
1549
|
+
spinner.start();
|
|
1550
|
+
try {
|
|
1551
|
+
const analyzer = await getGraphAnalyzer();
|
|
1552
|
+
if (!analyzer) {
|
|
1553
|
+
spinner.stop();
|
|
1554
|
+
output.printError('Graph analyzer module not available');
|
|
1555
|
+
return { success: false, exitCode: 1 };
|
|
1556
|
+
}
|
|
1557
|
+
const result = await analyzer.analyzeGraph(resolve(targetDir), {
|
|
1558
|
+
includeBoundaries: false,
|
|
1559
|
+
includeModules: true,
|
|
1560
|
+
});
|
|
1561
|
+
spinner.stop();
|
|
1562
|
+
// Filter communities by size
|
|
1563
|
+
const communities = result.communities?.filter(c => c.members.length >= minSize) || [];
|
|
1564
|
+
// Handle different output formats
|
|
1565
|
+
if (format === 'json') {
|
|
1566
|
+
const jsonOutput = {
|
|
1567
|
+
communities,
|
|
1568
|
+
statistics: result.statistics,
|
|
1569
|
+
};
|
|
1570
|
+
if (outputFile) {
|
|
1571
|
+
await writeFile(outputFile, JSON.stringify(jsonOutput, null, 2));
|
|
1572
|
+
output.printSuccess(`Results written to ${outputFile}`);
|
|
1573
|
+
}
|
|
1574
|
+
else {
|
|
1575
|
+
output.printJson(jsonOutput);
|
|
1576
|
+
}
|
|
1577
|
+
return { success: true, data: jsonOutput };
|
|
1578
|
+
}
|
|
1579
|
+
if (format === 'dot') {
|
|
1580
|
+
const dotOutput = analyzer.exportToDot(result, {
|
|
1581
|
+
includeLabels: true,
|
|
1582
|
+
colorByCommunity: true,
|
|
1583
|
+
highlightCycles: true,
|
|
1584
|
+
});
|
|
1585
|
+
if (outputFile) {
|
|
1586
|
+
await writeFile(outputFile, dotOutput);
|
|
1587
|
+
output.printSuccess(`DOT graph written to ${outputFile}`);
|
|
1588
|
+
output.writeln(output.dim('Visualize with: dot -Tpng -o modules.png ' + outputFile));
|
|
1589
|
+
}
|
|
1590
|
+
else {
|
|
1591
|
+
output.writeln(dotOutput);
|
|
1592
|
+
}
|
|
1593
|
+
return { success: true };
|
|
1594
|
+
}
|
|
1595
|
+
// Text format (default)
|
|
1596
|
+
output.printBox([
|
|
1597
|
+
`Files analyzed: ${result.statistics.nodeCount}`,
|
|
1598
|
+
`Dependencies: ${result.statistics.edgeCount}`,
|
|
1599
|
+
`Communities found: ${result.communities?.length || 0}`,
|
|
1600
|
+
`Showing: ${communities.length} (min size: ${minSize})`,
|
|
1601
|
+
].join('\n'), 'Module Detection Results');
|
|
1602
|
+
if (communities.length > 0) {
|
|
1603
|
+
output.writeln();
|
|
1604
|
+
output.writeln(output.bold('Detected Communities'));
|
|
1605
|
+
output.writeln();
|
|
1606
|
+
for (const community of communities.slice(0, 10)) {
|
|
1607
|
+
const cohesionIndicator = community.cohesion > 0.5 ? output.success('High') :
|
|
1608
|
+
community.cohesion > 0.2 ? output.warning('Medium') : output.dim('Low');
|
|
1609
|
+
output.writeln(output.bold(`Community ${community.id}: ${community.suggestedName || 'unnamed'}`));
|
|
1610
|
+
output.writeln(` ${output.dim('Cohesion:')} ${cohesionIndicator} (${(community.cohesion * 100).toFixed(1)}%)`);
|
|
1611
|
+
output.writeln(` ${output.dim('Central node:')} ${community.centralNode || 'none'}`);
|
|
1612
|
+
output.writeln(` ${output.dim('Members:')} ${community.members.length} files`);
|
|
1613
|
+
const displayMembers = community.members.slice(0, 5);
|
|
1614
|
+
for (const member of displayMembers) {
|
|
1615
|
+
output.writeln(` - ${member}`);
|
|
1616
|
+
}
|
|
1617
|
+
if (community.members.length > 5) {
|
|
1618
|
+
output.writeln(output.dim(` ... and ${community.members.length - 5} more`));
|
|
1619
|
+
}
|
|
1620
|
+
output.writeln();
|
|
1621
|
+
}
|
|
1622
|
+
if (communities.length > 10) {
|
|
1623
|
+
output.writeln(output.dim(`... and ${communities.length - 10} more communities`));
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
if (outputFile) {
|
|
1627
|
+
await writeFile(outputFile, JSON.stringify(result, null, 2));
|
|
1628
|
+
output.printSuccess(`Full results written to ${outputFile}`);
|
|
1629
|
+
}
|
|
1630
|
+
return { success: true, data: result };
|
|
1631
|
+
}
|
|
1632
|
+
catch (error) {
|
|
1633
|
+
spinner.stop();
|
|
1634
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1635
|
+
output.printError(`Analysis failed: ${message}`);
|
|
1636
|
+
return { success: false, exitCode: 1 };
|
|
1637
|
+
}
|
|
1638
|
+
},
|
|
1639
|
+
};
|
|
1640
|
+
/**
|
|
1641
|
+
* Build and export dependency graph
|
|
1642
|
+
*/
|
|
1643
|
+
const dependenciesCommand = {
|
|
1644
|
+
name: 'dependencies',
|
|
1645
|
+
aliases: ['graph'],
|
|
1646
|
+
description: 'Build and export full dependency graph',
|
|
1647
|
+
options: [
|
|
1648
|
+
{
|
|
1649
|
+
name: 'output',
|
|
1650
|
+
short: 'o',
|
|
1651
|
+
description: 'Output file path',
|
|
1652
|
+
type: 'string',
|
|
1653
|
+
},
|
|
1654
|
+
{
|
|
1655
|
+
name: 'format',
|
|
1656
|
+
short: 'f',
|
|
1657
|
+
description: 'Output format (text, json, dot)',
|
|
1658
|
+
type: 'string',
|
|
1659
|
+
default: 'text',
|
|
1660
|
+
choices: ['text', 'json', 'dot'],
|
|
1661
|
+
},
|
|
1662
|
+
{
|
|
1663
|
+
name: 'include',
|
|
1664
|
+
short: 'i',
|
|
1665
|
+
description: 'File extensions to include (comma-separated)',
|
|
1666
|
+
type: 'string',
|
|
1667
|
+
default: '.ts,.tsx,.js,.jsx,.mjs,.cjs',
|
|
1668
|
+
},
|
|
1669
|
+
{
|
|
1670
|
+
name: 'exclude',
|
|
1671
|
+
short: 'e',
|
|
1672
|
+
description: 'Patterns to exclude (comma-separated)',
|
|
1673
|
+
type: 'string',
|
|
1674
|
+
default: 'node_modules,dist,build,.git',
|
|
1675
|
+
},
|
|
1676
|
+
{
|
|
1677
|
+
name: 'depth',
|
|
1678
|
+
short: 'd',
|
|
1679
|
+
description: 'Maximum directory depth',
|
|
1680
|
+
type: 'number',
|
|
1681
|
+
default: 10,
|
|
1682
|
+
},
|
|
1683
|
+
],
|
|
1684
|
+
examples: [
|
|
1685
|
+
{ command: 'monomind analyze dependencies src/', description: 'Build dependency graph' },
|
|
1686
|
+
{ command: 'monomind analyze dependencies -f dot -o deps.dot src/', description: 'Export to DOT' },
|
|
1687
|
+
{ command: 'monomind analyze dependencies -i .ts,.tsx src/', description: 'Only TypeScript files' },
|
|
1688
|
+
],
|
|
1689
|
+
action: async (ctx) => {
|
|
1690
|
+
const targetDir = ctx.args[0] || ctx.cwd;
|
|
1691
|
+
const outputFile = ctx.flags.output;
|
|
1692
|
+
const format = ctx.flags.format || 'text';
|
|
1693
|
+
const include = (ctx.flags.include || '.ts,.tsx,.js,.jsx,.mjs,.cjs').split(',');
|
|
1694
|
+
const exclude = (ctx.flags.exclude || 'node_modules,dist,build,.git').split(',');
|
|
1695
|
+
const maxDepth = ctx.flags.depth || 10;
|
|
1696
|
+
output.printInfo(`Building dependency graph for: ${output.highlight(targetDir)}`);
|
|
1697
|
+
output.writeln();
|
|
1698
|
+
const spinner = output.createSpinner({ text: 'Scanning files...', spinner: 'dots' });
|
|
1699
|
+
spinner.start();
|
|
1700
|
+
try {
|
|
1701
|
+
const analyzer = await getGraphAnalyzer();
|
|
1702
|
+
if (!analyzer) {
|
|
1703
|
+
spinner.stop();
|
|
1704
|
+
output.printError('Graph analyzer module not available');
|
|
1705
|
+
return { success: false, exitCode: 1 };
|
|
1706
|
+
}
|
|
1707
|
+
const graph = await analyzer.buildDependencyGraph(resolve(targetDir), {
|
|
1708
|
+
include,
|
|
1709
|
+
exclude,
|
|
1710
|
+
maxDepth,
|
|
1711
|
+
});
|
|
1712
|
+
spinner.stop();
|
|
1713
|
+
// Detect circular dependencies
|
|
1714
|
+
const circularDeps = analyzer.detectCircularDependencies(graph);
|
|
1715
|
+
// Handle different output formats
|
|
1716
|
+
if (format === 'json') {
|
|
1717
|
+
const jsonOutput = {
|
|
1718
|
+
nodes: Array.from(graph.nodes.values()),
|
|
1719
|
+
edges: graph.edges,
|
|
1720
|
+
metadata: graph.metadata,
|
|
1721
|
+
circularDependencies: circularDeps,
|
|
1722
|
+
};
|
|
1723
|
+
if (outputFile) {
|
|
1724
|
+
await writeFile(outputFile, JSON.stringify(jsonOutput, null, 2));
|
|
1725
|
+
output.printSuccess(`Graph written to ${outputFile}`);
|
|
1726
|
+
}
|
|
1727
|
+
else {
|
|
1728
|
+
output.printJson(jsonOutput);
|
|
1729
|
+
}
|
|
1730
|
+
return { success: true, data: jsonOutput };
|
|
1731
|
+
}
|
|
1732
|
+
if (format === 'dot') {
|
|
1733
|
+
const result = { graph, circularDependencies: circularDeps, statistics: {
|
|
1734
|
+
nodeCount: graph.nodes.size,
|
|
1735
|
+
edgeCount: graph.edges.length,
|
|
1736
|
+
avgDegree: 0,
|
|
1737
|
+
maxDegree: 0,
|
|
1738
|
+
density: 0,
|
|
1739
|
+
componentCount: 0,
|
|
1740
|
+
} };
|
|
1741
|
+
const dotOutput = analyzer.exportToDot(result, {
|
|
1742
|
+
includeLabels: true,
|
|
1743
|
+
highlightCycles: true,
|
|
1744
|
+
});
|
|
1745
|
+
if (outputFile) {
|
|
1746
|
+
await writeFile(outputFile, dotOutput);
|
|
1747
|
+
output.printSuccess(`DOT graph written to ${outputFile}`);
|
|
1748
|
+
output.writeln(output.dim('Visualize with: dot -Tpng -o deps.png ' + outputFile));
|
|
1749
|
+
}
|
|
1750
|
+
else {
|
|
1751
|
+
output.writeln(dotOutput);
|
|
1752
|
+
}
|
|
1753
|
+
return { success: true };
|
|
1754
|
+
}
|
|
1755
|
+
// Text format (default)
|
|
1756
|
+
output.printBox([
|
|
1757
|
+
`Files: ${graph.metadata.totalFiles}`,
|
|
1758
|
+
`Dependencies: ${graph.metadata.totalEdges}`,
|
|
1759
|
+
`Build time: ${graph.metadata.buildTime}ms`,
|
|
1760
|
+
`Root: ${graph.metadata.rootDir}`,
|
|
1761
|
+
].join('\n'), 'Dependency Graph');
|
|
1762
|
+
// Show top files by imports
|
|
1763
|
+
output.writeln();
|
|
1764
|
+
output.writeln(output.bold('Most Connected Files'));
|
|
1765
|
+
output.writeln();
|
|
1766
|
+
const nodesByDegree = Array.from(graph.nodes.values())
|
|
1767
|
+
.map(n => ({
|
|
1768
|
+
...n,
|
|
1769
|
+
degree: graph.edges.filter(e => e.source === n.id || e.target === n.id).length,
|
|
1770
|
+
}))
|
|
1771
|
+
.sort((a, b) => b.degree - a.degree)
|
|
1772
|
+
.slice(0, 10);
|
|
1773
|
+
output.printTable({
|
|
1774
|
+
columns: [
|
|
1775
|
+
{ key: 'path', header: 'File', width: 50 },
|
|
1776
|
+
{ key: 'degree', header: 'Connections', width: 12, align: 'right' },
|
|
1777
|
+
{ key: 'complexity', header: 'Complexity', width: 12, align: 'right' },
|
|
1778
|
+
],
|
|
1779
|
+
data: nodesByDegree.map(n => ({
|
|
1780
|
+
path: n.path.length > 48 ? '...' + n.path.slice(-45) : n.path,
|
|
1781
|
+
degree: n.degree,
|
|
1782
|
+
complexity: n.complexity || 0,
|
|
1783
|
+
})),
|
|
1784
|
+
});
|
|
1785
|
+
// Show circular dependencies
|
|
1786
|
+
if (circularDeps.length > 0) {
|
|
1787
|
+
output.writeln();
|
|
1788
|
+
output.writeln(output.bold(output.warning(`Circular Dependencies: ${circularDeps.length}`)));
|
|
1789
|
+
output.writeln();
|
|
1790
|
+
for (const cycle of circularDeps.slice(0, 3)) {
|
|
1791
|
+
output.writeln(` ${cycle.cycle.join(' -> ')}`);
|
|
1792
|
+
}
|
|
1793
|
+
if (circularDeps.length > 3) {
|
|
1794
|
+
output.writeln(output.dim(` ... and ${circularDeps.length - 3} more`));
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
if (outputFile) {
|
|
1798
|
+
const fullOutput = {
|
|
1799
|
+
nodes: Array.from(graph.nodes.values()),
|
|
1800
|
+
edges: graph.edges,
|
|
1801
|
+
metadata: graph.metadata,
|
|
1802
|
+
circularDependencies: circularDeps,
|
|
1803
|
+
};
|
|
1804
|
+
await writeFile(outputFile, JSON.stringify(fullOutput, null, 2));
|
|
1805
|
+
output.printSuccess(`Full results written to ${outputFile}`);
|
|
1806
|
+
}
|
|
1807
|
+
return { success: true };
|
|
1808
|
+
}
|
|
1809
|
+
catch (error) {
|
|
1810
|
+
spinner.stop();
|
|
1811
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1812
|
+
output.printError(`Analysis failed: ${message}`);
|
|
1813
|
+
return { success: false, exitCode: 1 };
|
|
1814
|
+
}
|
|
1815
|
+
},
|
|
1816
|
+
};
|
|
1817
|
+
/**
|
|
1818
|
+
* Detect circular dependencies
|
|
1819
|
+
*/
|
|
1820
|
+
const circularCommand = {
|
|
1821
|
+
name: 'circular',
|
|
1822
|
+
aliases: ['cycles'],
|
|
1823
|
+
description: 'Detect circular dependencies in codebase',
|
|
1824
|
+
options: [
|
|
1825
|
+
{
|
|
1826
|
+
name: 'output',
|
|
1827
|
+
short: 'o',
|
|
1828
|
+
description: 'Output file path',
|
|
1829
|
+
type: 'string',
|
|
1830
|
+
},
|
|
1831
|
+
{
|
|
1832
|
+
name: 'format',
|
|
1833
|
+
short: 'f',
|
|
1834
|
+
description: 'Output format (text, json)',
|
|
1835
|
+
type: 'string',
|
|
1836
|
+
default: 'text',
|
|
1837
|
+
choices: ['text', 'json'],
|
|
1838
|
+
},
|
|
1839
|
+
{
|
|
1840
|
+
name: 'severity',
|
|
1841
|
+
short: 's',
|
|
1842
|
+
description: 'Minimum severity to show (low, medium, high)',
|
|
1843
|
+
type: 'string',
|
|
1844
|
+
default: 'low',
|
|
1845
|
+
choices: ['low', 'medium', 'high'],
|
|
1846
|
+
},
|
|
1847
|
+
],
|
|
1848
|
+
examples: [
|
|
1849
|
+
{ command: 'monomind analyze circular src/', description: 'Find circular dependencies' },
|
|
1850
|
+
{ command: 'monomind analyze circular -s high src/', description: 'Only high severity cycles' },
|
|
1851
|
+
],
|
|
1852
|
+
action: async (ctx) => {
|
|
1853
|
+
const targetDir = ctx.args[0] || ctx.cwd;
|
|
1854
|
+
const outputFile = ctx.flags.output;
|
|
1855
|
+
const format = ctx.flags.format || 'text';
|
|
1856
|
+
const minSeverity = ctx.flags.severity || 'low';
|
|
1857
|
+
output.printInfo(`Detecting circular dependencies in: ${output.highlight(targetDir)}`);
|
|
1858
|
+
output.writeln();
|
|
1859
|
+
const spinner = output.createSpinner({ text: 'Analyzing dependencies...', spinner: 'dots' });
|
|
1860
|
+
spinner.start();
|
|
1861
|
+
try {
|
|
1862
|
+
const analyzer = await getGraphAnalyzer();
|
|
1863
|
+
if (!analyzer) {
|
|
1864
|
+
spinner.stop();
|
|
1865
|
+
output.printError('Graph analyzer module not available');
|
|
1866
|
+
return { success: false, exitCode: 1 };
|
|
1867
|
+
}
|
|
1868
|
+
const graph = await analyzer.buildDependencyGraph(resolve(targetDir));
|
|
1869
|
+
const cycles = analyzer.detectCircularDependencies(graph);
|
|
1870
|
+
spinner.stop();
|
|
1871
|
+
// Filter by severity
|
|
1872
|
+
const severityOrder = { low: 0, medium: 1, high: 2 };
|
|
1873
|
+
const minLevel = severityOrder[minSeverity] || 0;
|
|
1874
|
+
const filtered = cycles.filter(c => severityOrder[c.severity] >= minLevel);
|
|
1875
|
+
if (format === 'json') {
|
|
1876
|
+
const jsonOutput = { cycles: filtered, total: cycles.length, filtered: filtered.length };
|
|
1877
|
+
if (outputFile) {
|
|
1878
|
+
await writeFile(outputFile, JSON.stringify(jsonOutput, null, 2));
|
|
1879
|
+
output.printSuccess(`Results written to ${outputFile}`);
|
|
1880
|
+
}
|
|
1881
|
+
else {
|
|
1882
|
+
output.printJson(jsonOutput);
|
|
1883
|
+
}
|
|
1884
|
+
return { success: true, data: jsonOutput };
|
|
1885
|
+
}
|
|
1886
|
+
// Text format
|
|
1887
|
+
if (filtered.length === 0) {
|
|
1888
|
+
output.printSuccess('No circular dependencies found!');
|
|
1889
|
+
return { success: true };
|
|
1890
|
+
}
|
|
1891
|
+
output.printBox([
|
|
1892
|
+
`Total cycles: ${cycles.length}`,
|
|
1893
|
+
`Shown (${minSeverity}+): ${filtered.length}`,
|
|
1894
|
+
`High severity: ${cycles.filter(c => c.severity === 'high').length}`,
|
|
1895
|
+
`Medium severity: ${cycles.filter(c => c.severity === 'medium').length}`,
|
|
1896
|
+
`Low severity: ${cycles.filter(c => c.severity === 'low').length}`,
|
|
1897
|
+
].join('\n'), 'Circular Dependencies');
|
|
1898
|
+
output.writeln();
|
|
1899
|
+
// Group by severity
|
|
1900
|
+
const grouped = {
|
|
1901
|
+
high: filtered.filter(c => c.severity === 'high'),
|
|
1902
|
+
medium: filtered.filter(c => c.severity === 'medium'),
|
|
1903
|
+
low: filtered.filter(c => c.severity === 'low'),
|
|
1904
|
+
};
|
|
1905
|
+
for (const [severity, items] of Object.entries(grouped)) {
|
|
1906
|
+
if (items.length === 0)
|
|
1907
|
+
continue;
|
|
1908
|
+
const color = severity === 'high' ? output.error : severity === 'medium' ? output.warning : output.dim;
|
|
1909
|
+
output.writeln(color(output.bold(`${severity.toUpperCase()} SEVERITY (${items.length})`)));
|
|
1910
|
+
output.writeln();
|
|
1911
|
+
for (const cycle of items.slice(0, 5)) {
|
|
1912
|
+
output.writeln(` ${cycle.cycle.join(' -> ')}`);
|
|
1913
|
+
output.writeln(output.dim(` Fix: ${cycle.suggestion}`));
|
|
1914
|
+
output.writeln();
|
|
1915
|
+
}
|
|
1916
|
+
if (items.length > 5) {
|
|
1917
|
+
output.writeln(output.dim(` ... and ${items.length - 5} more ${severity} cycles`));
|
|
1918
|
+
output.writeln();
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
if (outputFile) {
|
|
1922
|
+
await writeFile(outputFile, JSON.stringify({ cycles: filtered }, null, 2));
|
|
1923
|
+
output.printSuccess(`Results written to ${outputFile}`);
|
|
1924
|
+
}
|
|
1925
|
+
return { success: true, data: { cycles: filtered } };
|
|
1926
|
+
}
|
|
1927
|
+
catch (error) {
|
|
1928
|
+
spinner.stop();
|
|
1929
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1930
|
+
output.printError(`Analysis failed: ${message}`);
|
|
1931
|
+
return { success: false, exitCode: 1 };
|
|
1932
|
+
}
|
|
1933
|
+
},
|
|
1934
|
+
};
|
|
1935
|
+
// Helper functions
|
|
1936
|
+
function getRiskDisplay(risk) {
|
|
1937
|
+
switch (risk) {
|
|
1938
|
+
case 'critical':
|
|
1939
|
+
return output.color(output.bold('CRITICAL'), 'bgRed', 'white');
|
|
1940
|
+
case 'high-risk':
|
|
1941
|
+
return output.error('HIGH');
|
|
1942
|
+
case 'medium-risk':
|
|
1943
|
+
return output.warning('MEDIUM');
|
|
1944
|
+
case 'low-risk':
|
|
1945
|
+
return output.success('LOW');
|
|
1946
|
+
default:
|
|
1947
|
+
return risk;
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
function getStatusDisplay(status) {
|
|
1951
|
+
switch (status) {
|
|
1952
|
+
case 'added':
|
|
1953
|
+
return output.success('A');
|
|
1954
|
+
case 'modified':
|
|
1955
|
+
return output.warning('M');
|
|
1956
|
+
case 'deleted':
|
|
1957
|
+
return output.error('D');
|
|
1958
|
+
case 'renamed':
|
|
1959
|
+
return output.info('R');
|
|
1960
|
+
default:
|
|
1961
|
+
return status;
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
// Main analyze command
|
|
1965
|
+
export const analyzeCommand = {
|
|
1966
|
+
name: 'analyze',
|
|
1967
|
+
description: 'Code analysis, diff classification, graph boundaries, and change risk assessment',
|
|
1968
|
+
aliases: ['an'],
|
|
1969
|
+
subcommands: [
|
|
1970
|
+
diffCommand,
|
|
1971
|
+
codeCommand,
|
|
1972
|
+
depsCommand,
|
|
1973
|
+
astCommand,
|
|
1974
|
+
complexityAstCommand,
|
|
1975
|
+
symbolsCommand,
|
|
1976
|
+
importsCommand,
|
|
1977
|
+
boundariesCommand,
|
|
1978
|
+
modulesCommand,
|
|
1979
|
+
dependenciesCommand,
|
|
1980
|
+
circularCommand,
|
|
1981
|
+
],
|
|
1982
|
+
options: [
|
|
1983
|
+
{
|
|
1984
|
+
name: 'format',
|
|
1985
|
+
short: 'f',
|
|
1986
|
+
description: 'Output format: text, json, table',
|
|
1987
|
+
type: 'string',
|
|
1988
|
+
default: 'text',
|
|
1989
|
+
},
|
|
1990
|
+
],
|
|
1991
|
+
examples: [
|
|
1992
|
+
{ command: 'monomind analyze ast src/', description: 'Analyze code with AST parsing' },
|
|
1993
|
+
{ command: 'monomind analyze complexity src/ --threshold 15', description: 'Find high-complexity files' },
|
|
1994
|
+
{ command: 'monomind analyze symbols src/ --type function', description: 'Extract all functions' },
|
|
1995
|
+
{ command: 'monomind analyze imports src/ --external', description: 'List npm dependencies' },
|
|
1996
|
+
{ command: 'monomind analyze diff --risk', description: 'Analyze diff with risk assessment' },
|
|
1997
|
+
{ command: 'monomind analyze boundaries src/', description: 'Find code boundaries using MinCut' },
|
|
1998
|
+
{ command: 'monomind analyze modules src/', description: 'Detect module communities with Louvain' },
|
|
1999
|
+
{ command: 'monomind analyze dependencies src/ --format dot', description: 'Export dependency graph as DOT' },
|
|
2000
|
+
{ command: 'monomind analyze circular src/', description: 'Find circular dependencies' },
|
|
2001
|
+
{ command: 'monomind analyze deps --security', description: 'Check dependency vulnerabilities' },
|
|
2002
|
+
],
|
|
2003
|
+
action: async (ctx) => {
|
|
2004
|
+
// If no subcommand, show help
|
|
2005
|
+
output.writeln();
|
|
2006
|
+
output.writeln(output.bold('Analyze Commands'));
|
|
2007
|
+
output.writeln(output.dim('-'.repeat(50)));
|
|
2008
|
+
output.writeln();
|
|
2009
|
+
output.writeln(output.bold('Available subcommands:'));
|
|
2010
|
+
output.writeln();
|
|
2011
|
+
output.writeln(` ${output.highlight('diff')} Analyze git diff for change risk and classification`);
|
|
2012
|
+
output.writeln(` ${output.highlight('code')} Static code analysis and quality assessment`);
|
|
2013
|
+
output.writeln(` ${output.highlight('deps')} Analyze project dependencies`);
|
|
2014
|
+
output.writeln(` ${output.highlight('ast')} AST analysis with symbol extraction and complexity`);
|
|
2015
|
+
output.writeln(` ${output.highlight('complexity')} Analyze cyclomatic and cognitive complexity`);
|
|
2016
|
+
output.writeln(` ${output.highlight('symbols')} Extract functions, classes, and types`);
|
|
2017
|
+
output.writeln(` ${output.highlight('imports')} Analyze import dependencies`);
|
|
2018
|
+
output.writeln(` ${output.highlight('boundaries')} Find code boundaries using MinCut algorithm`);
|
|
2019
|
+
output.writeln(` ${output.highlight('modules')} Detect module communities using Louvain algorithm`);
|
|
2020
|
+
output.writeln(` ${output.highlight('dependencies')} Build and export full dependency graph`);
|
|
2021
|
+
output.writeln(` ${output.highlight('circular')} Detect circular dependencies in codebase`);
|
|
2022
|
+
output.writeln();
|
|
2023
|
+
output.writeln(output.bold('AST Analysis Examples:'));
|
|
2024
|
+
output.writeln();
|
|
2025
|
+
output.writeln(` ${output.dim('monomind analyze ast src/')} # Full AST analysis`);
|
|
2026
|
+
output.writeln(` ${output.dim('monomind analyze ast src/index.ts -c')} # Include complexity`);
|
|
2027
|
+
output.writeln(` ${output.dim('monomind analyze complexity src/ -t 15')} # Flag high complexity`);
|
|
2028
|
+
output.writeln(` ${output.dim('monomind analyze symbols src/ --type fn')} # Extract functions`);
|
|
2029
|
+
output.writeln(` ${output.dim('monomind analyze imports src/ --external')} # Only npm imports`);
|
|
2030
|
+
output.writeln();
|
|
2031
|
+
output.writeln(output.bold('Graph Analysis Examples:'));
|
|
2032
|
+
output.writeln();
|
|
2033
|
+
output.writeln(` ${output.dim('monomind analyze boundaries src/')} # Find natural code boundaries`);
|
|
2034
|
+
output.writeln(` ${output.dim('monomind analyze modules src/')} # Detect module communities`);
|
|
2035
|
+
output.writeln(` ${output.dim('monomind analyze dependencies -f dot src/')} # Export to DOT format`);
|
|
2036
|
+
output.writeln(` ${output.dim('monomind analyze circular src/')} # Find circular deps`);
|
|
2037
|
+
output.writeln();
|
|
2038
|
+
output.writeln(output.bold('Diff Analysis Examples:'));
|
|
2039
|
+
output.writeln();
|
|
2040
|
+
output.writeln(` ${output.dim('monomind analyze diff --risk')} # Risk assessment`);
|
|
2041
|
+
output.writeln(` ${output.dim('monomind analyze diff HEAD~1 --classify')} # Classify changes`);
|
|
2042
|
+
output.writeln(` ${output.dim('monomind analyze diff main..feature')} # Compare branches`);
|
|
2043
|
+
output.writeln();
|
|
2044
|
+
return { success: true };
|
|
2045
|
+
},
|
|
2046
|
+
};
|
|
2047
|
+
export default analyzeCommand;
|
|
2048
|
+
//# sourceMappingURL=analyze.js.map
|