fivocell 4.3.0 → 4.3.2
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/README.md +45 -23
- package/bin/cell.js +1 -1
- package/dist/__tests__/agents-md.test.js +1 -1
- package/dist/__tests__/agents-md.test.js.map +1 -1
- package/dist/__tests__/antigravity-rich-format.test.js +2 -2
- package/dist/__tests__/antigravity-rich-format.test.js.map +1 -1
- package/dist/__tests__/atcell-live-fallback.test.js +2 -2
- package/dist/__tests__/atcell-live-fallback.test.js.map +1 -1
- package/dist/__tests__/behavior-intelligence-bug.test.js +1 -1
- package/dist/__tests__/behavior-intelligence-bug.test.js.map +1 -1
- package/dist/__tests__/branch-context.test.d.ts +2 -0
- package/dist/__tests__/branch-context.test.d.ts.map +1 -0
- package/dist/__tests__/branch-context.test.js +215 -0
- package/dist/__tests__/branch-context.test.js.map +1 -0
- package/dist/__tests__/cell-state-setup.test.d.ts +2 -0
- package/dist/__tests__/cell-state-setup.test.d.ts.map +1 -0
- package/dist/__tests__/cell-state-setup.test.js +190 -0
- package/dist/__tests__/cell-state-setup.test.js.map +1 -0
- package/dist/__tests__/cli-regression.test.d.ts +2 -0
- package/dist/__tests__/cli-regression.test.d.ts.map +1 -0
- package/dist/__tests__/cli-regression.test.js +105 -0
- package/dist/__tests__/cli-regression.test.js.map +1 -0
- package/dist/__tests__/cli-smoke.test.d.ts +2 -0
- package/dist/__tests__/cli-smoke.test.d.ts.map +1 -0
- package/dist/__tests__/cli-smoke.test.js +79 -0
- package/dist/__tests__/cli-smoke.test.js.map +1 -0
- package/dist/__tests__/code-scanner-blindspot.test.js +1 -1
- package/dist/__tests__/code-scanner-blindspot.test.js.map +1 -1
- package/dist/__tests__/code-scanner-error-recovery.test.js +1 -1
- package/dist/__tests__/code-scanner-error-recovery.test.js.map +1 -1
- package/dist/__tests__/code-scanner-sql-fix.test.js +1 -1
- package/dist/__tests__/code-scanner-sql-fix.test.js.map +1 -1
- package/dist/__tests__/community-store.test.js +20 -20
- package/dist/__tests__/community-store.test.js.map +1 -1
- package/dist/__tests__/cross-memory-continue.test.d.ts +8 -0
- package/dist/__tests__/cross-memory-continue.test.d.ts.map +1 -0
- package/dist/__tests__/cross-memory-continue.test.js +179 -0
- package/dist/__tests__/cross-memory-continue.test.js.map +1 -0
- package/dist/__tests__/cross-memory-editor-monitor.test.d.ts +6 -0
- package/dist/__tests__/cross-memory-editor-monitor.test.d.ts.map +1 -0
- package/dist/__tests__/cross-memory-editor-monitor.test.js +109 -0
- package/dist/__tests__/cross-memory-editor-monitor.test.js.map +1 -0
- package/dist/__tests__/cross-memory-event-capture.test.d.ts +2 -0
- package/dist/__tests__/cross-memory-event-capture.test.d.ts.map +1 -0
- package/dist/__tests__/cross-memory-event-capture.test.js +530 -0
- package/dist/__tests__/cross-memory-event-capture.test.js.map +1 -0
- package/dist/__tests__/cross-memory-replay.test.d.ts +2 -0
- package/dist/__tests__/cross-memory-replay.test.d.ts.map +1 -0
- package/dist/__tests__/cross-memory-replay.test.js +362 -0
- package/dist/__tests__/cross-memory-replay.test.js.map +1 -0
- package/dist/__tests__/cross-memory-socket-bridge.test.d.ts +9 -0
- package/dist/__tests__/cross-memory-socket-bridge.test.d.ts.map +1 -0
- package/dist/__tests__/cross-memory-socket-bridge.test.js +633 -0
- package/dist/__tests__/cross-memory-socket-bridge.test.js.map +1 -0
- package/dist/__tests__/enhanced-blind-spots.test.js +89 -1
- package/dist/__tests__/enhanced-blind-spots.test.js.map +1 -1
- package/dist/__tests__/failure-memory.test.d.ts +2 -0
- package/dist/__tests__/failure-memory.test.d.ts.map +1 -0
- package/dist/__tests__/failure-memory.test.js +108 -0
- package/dist/__tests__/failure-memory.test.js.map +1 -0
- package/dist/__tests__/journey-memory.test.d.ts +2 -0
- package/dist/__tests__/journey-memory.test.d.ts.map +1 -0
- package/dist/__tests__/journey-memory.test.js +141 -0
- package/dist/__tests__/journey-memory.test.js.map +1 -0
- package/dist/__tests__/knowledge-graph-store.test.js +3 -3
- package/dist/__tests__/knowledge-graph-store.test.js.map +1 -1
- package/dist/__tests__/live-watcher.test.js +24 -24
- package/dist/__tests__/live-watcher.test.js.map +1 -1
- package/dist/__tests__/mcp-cell-tools.test.js +2 -2
- package/dist/__tests__/mcp-cell-tools.test.js.map +1 -1
- package/dist/__tests__/multi-project.test.js +1 -1
- package/dist/__tests__/multi-project.test.js.map +1 -1
- package/dist/__tests__/pc-scanner-paths.test.js +1 -1
- package/dist/__tests__/pc-scanner-paths.test.js.map +1 -1
- package/dist/__tests__/prelaunch-reality-check.test.js +27 -27
- package/dist/__tests__/prelaunch-reality-check.test.js.map +1 -1
- package/dist/__tests__/project-name-override.test.js +2 -2
- package/dist/__tests__/project-name-override.test.js.map +1 -1
- package/dist/__tests__/prompt-builder-realdata.test.js +90 -2
- package/dist/__tests__/prompt-builder-realdata.test.js.map +1 -1
- package/dist/__tests__/prompt-builder-sessions.test.js +2 -2
- package/dist/__tests__/prompt-builder-sessions.test.js.map +1 -1
- package/dist/__tests__/repl.test.d.ts +2 -0
- package/dist/__tests__/repl.test.d.ts.map +1 -0
- package/dist/__tests__/repl.test.js +77 -0
- package/dist/__tests__/repl.test.js.map +1 -0
- package/dist/__tests__/security.test.js +19 -19
- package/dist/__tests__/security.test.js.map +1 -1
- package/dist/__tests__/session-bridge.test.js +2 -2
- package/dist/__tests__/session-bridge.test.js.map +1 -1
- package/dist/__tests__/session-memory-tables.test.js +2 -2
- package/dist/__tests__/session-memory-tables.test.js.map +1 -1
- package/dist/__tests__/setup.test.js +1 -1
- package/dist/__tests__/setup.test.js.map +1 -1
- package/dist/__tests__/staleness-detection.test.js +3 -3
- package/dist/__tests__/staleness-detection.test.js.map +1 -1
- package/dist/__tests__/team-collaboration.test.js +10 -10
- package/dist/__tests__/team-collaboration.test.js.map +1 -1
- package/dist/__tests__/tool-specific-format.test.js +2 -2
- package/dist/__tests__/tool-specific-format.test.js.map +1 -1
- package/dist/__tests__/usage-intelligence-store.test.js +23 -23
- package/dist/__tests__/usage-intelligence-store.test.js.map +1 -1
- package/dist/__tests__/watch-cli.test.js +1 -1
- package/dist/__tests__/watch-cli.test.js.map +1 -1
- package/dist/core/__tests__/ab-test-framework.test.js +1 -1
- package/dist/core/__tests__/ab-test-framework.test.js.map +1 -1
- package/dist/core/__tests__/ai-memory.test.js +1 -1
- package/dist/core/__tests__/ai-memory.test.js.map +1 -1
- package/dist/core/__tests__/ast-differ.test.d.ts +2 -0
- package/dist/core/__tests__/ast-differ.test.d.ts.map +1 -0
- package/dist/core/__tests__/ast-differ.test.js +68 -0
- package/dist/core/__tests__/ast-differ.test.js.map +1 -0
- package/dist/core/__tests__/build-failure-predictor.test.js +1 -1
- package/dist/core/__tests__/build-failure-predictor.test.js.map +1 -1
- package/dist/core/__tests__/chapter3-verify.test.js +3 -3
- package/dist/core/__tests__/chapter3-verify.test.js.map +1 -1
- package/dist/core/__tests__/chapter4-hostile.test.js +2 -2
- package/dist/core/__tests__/chapter4-hostile.test.js.map +1 -1
- package/dist/core/__tests__/chapter4-verify.test.js +3 -3
- package/dist/core/__tests__/chapter4-verify.test.js.map +1 -1
- package/dist/core/__tests__/community-full.test.js +1 -1
- package/dist/core/__tests__/community-full.test.js.map +1 -1
- package/dist/core/__tests__/community-live.test.js +1 -1
- package/dist/core/__tests__/community-live.test.js.map +1 -1
- package/dist/core/__tests__/config-attribution.test.js +1 -1
- package/dist/core/__tests__/config-attribution.test.js.map +1 -1
- package/dist/core/__tests__/convention-detector.test.js +1 -1
- package/dist/core/__tests__/convention-detector.test.js.map +1 -1
- package/dist/core/__tests__/cost-optimizer.test.js +1 -1
- package/dist/core/__tests__/cost-optimizer.test.js.map +1 -1
- package/dist/core/__tests__/cross-domain-projections.test.js +1 -1
- package/dist/core/__tests__/cross-domain-projections.test.js.map +1 -1
- package/dist/core/__tests__/cross-project-sync.test.js +1 -1
- package/dist/core/__tests__/cross-project-sync.test.js.map +1 -1
- package/dist/core/__tests__/error-predictor.test.js +1 -1
- package/dist/core/__tests__/error-predictor.test.js.map +1 -1
- package/dist/core/__tests__/explainability.test.js +3 -3
- package/dist/core/__tests__/explainability.test.js.map +1 -1
- package/dist/core/__tests__/extraction-cascade.test.d.ts +2 -0
- package/dist/core/__tests__/extraction-cascade.test.d.ts.map +1 -0
- package/dist/core/__tests__/extraction-cascade.test.js +59 -0
- package/dist/core/__tests__/extraction-cascade.test.js.map +1 -0
- package/dist/core/__tests__/failure-memory.test.js +1 -1
- package/dist/core/__tests__/failure-memory.test.js.map +1 -1
- package/dist/core/__tests__/git-branch-pregenerator.test.js +1 -1
- package/dist/core/__tests__/git-branch-pregenerator.test.js.map +1 -1
- package/dist/core/__tests__/interruption-recovery.test.js +1 -1
- package/dist/core/__tests__/interruption-recovery.test.js.map +1 -1
- package/dist/core/__tests__/knowledge-graph.test.js +1 -1
- package/dist/core/__tests__/knowledge-graph.test.js.map +1 -1
- package/dist/core/__tests__/marketplace.test.js +1 -1
- package/dist/core/__tests__/marketplace.test.js.map +1 -1
- package/dist/core/__tests__/merge-conflict-predictor.test.js +1 -1
- package/dist/core/__tests__/merge-conflict-predictor.test.js.map +1 -1
- package/dist/core/__tests__/performance-predictor.test.js +1 -1
- package/dist/core/__tests__/performance-predictor.test.js.map +1 -1
- package/dist/core/__tests__/playbook-generator.test.js +1 -1
- package/dist/core/__tests__/playbook-generator.test.js.map +1 -1
- package/dist/core/__tests__/pr-review-assistant.test.js +1 -1
- package/dist/core/__tests__/pr-review-assistant.test.js.map +1 -1
- package/dist/core/__tests__/privacy-manager.test.js +1 -1
- package/dist/core/__tests__/privacy-manager.test.js.map +1 -1
- package/dist/core/__tests__/project-dna.test.js +1 -1
- package/dist/core/__tests__/project-dna.test.js.map +1 -1
- package/dist/core/__tests__/reputation.test.js +1 -1
- package/dist/core/__tests__/reputation.test.js.map +1 -1
- package/dist/core/__tests__/security-predictor.test.js +1 -1
- package/dist/core/__tests__/security-predictor.test.js.map +1 -1
- package/dist/core/__tests__/signal-capture.test.js +1 -1
- package/dist/core/__tests__/signal-capture.test.js.map +1 -1
- package/dist/core/__tests__/team-composer.test.js +1 -1
- package/dist/core/__tests__/team-composer.test.js.map +1 -1
- package/dist/core/__tests__/time-saved.test.js +1 -1
- package/dist/core/__tests__/time-saved.test.js.map +1 -1
- package/dist/core/__tests__/validation-run.test.js +1 -1
- package/dist/core/__tests__/validation-run.test.js.map +1 -1
- package/dist/core/__tests__/workflow-outcome-graph.test.js +1 -1
- package/dist/core/__tests__/workflow-outcome-graph.test.js.map +1 -1
- package/dist/core/architecture-engine.js +1 -1
- package/dist/core/architecture-engine.js.map +1 -1
- package/dist/core/backend-engine.js +1 -1
- package/dist/core/backend-engine.js.map +1 -1
- package/dist/core/cross-project-sync.d.ts +1 -1
- package/dist/core/cross-project-sync.d.ts.map +1 -1
- package/dist/core/enhanced-blind-spots.d.ts +8 -0
- package/dist/core/enhanced-blind-spots.d.ts.map +1 -1
- package/dist/core/enhanced-blind-spots.js +59 -0
- package/dist/core/enhanced-blind-spots.js.map +1 -1
- package/dist/core/extraction-cascade.d.ts +2 -2
- package/dist/core/extraction-cascade.d.ts.map +1 -1
- package/dist/core/extraction-cascade.js +2 -2
- package/dist/core/extraction-cascade.js.map +1 -1
- package/dist/core/frontend-engine.js +1 -1
- package/dist/core/frontend-engine.js.map +1 -1
- package/dist/core/learning-layer.d.ts +1 -1
- package/dist/core/learning-layer.d.ts.map +1 -1
- package/dist/core/naming-engine.js +1 -1
- package/dist/core/naming-engine.js.map +1 -1
- package/dist/core/productivity-engine.js +1 -1
- package/dist/core/productivity-engine.js.map +1 -1
- package/dist/core/project-registry.js +1 -1
- package/dist/core/project-registry.js.map +1 -1
- package/dist/core/search-engine.js +1 -1
- package/dist/core/search-engine.js.map +1 -1
- package/dist/core/similarity-engine.d.ts +1 -1
- package/dist/core/similarity-engine.d.ts.map +1 -1
- package/dist/core/structure-engine.js +1 -1
- package/dist/core/structure-engine.js.map +1 -1
- package/dist/core/syntax-engine.js +1 -1
- package/dist/core/syntax-engine.js.map +1 -1
- package/dist/core/team-advanced-engine.js +1 -1
- package/dist/core/team-advanced-engine.js.map +1 -1
- package/dist/core/team-composer.d.ts +1 -1
- package/dist/core/team-composer.d.ts.map +1 -1
- package/dist/core/team-engine.js +1 -1
- package/dist/core/team-engine.js.map +1 -1
- package/dist/index.d.ts +40 -46
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -65
- package/dist/index.js.map +1 -1
- package/dist/validation/quick-run.js +1 -1
- package/dist/validation/quick-run.js.map +1 -1
- package/dist/walls/01-context/context/agents-md.d.ts.map +1 -0
- package/dist/walls/01-context/context/agents-md.js.map +1 -0
- package/dist/walls/01-context/context/ide-intelligence.d.ts.map +1 -0
- package/dist/{ide-intelligence.js → walls/01-context/context/ide-intelligence.js} +1 -1
- package/dist/walls/01-context/context/ide-intelligence.js.map +1 -0
- package/dist/walls/01-context/context/prompt-builder.d.ts.map +1 -0
- package/dist/{core → walls/01-context/context}/prompt-builder.js +27 -3
- package/dist/walls/01-context/context/prompt-builder.js.map +1 -0
- package/dist/walls/01-context/context/user-intelligence.d.ts.map +1 -0
- package/dist/walls/01-context/context/user-intelligence.js.map +1 -0
- package/dist/walls/01-context/sessions/event-capture.d.ts +126 -0
- package/dist/walls/01-context/sessions/event-capture.d.ts.map +1 -0
- package/dist/walls/01-context/sessions/event-capture.js +418 -0
- package/dist/walls/01-context/sessions/event-capture.js.map +1 -0
- package/dist/walls/01-context/sessions/interruption-recovery.d.ts.map +1 -0
- package/dist/walls/01-context/sessions/interruption-recovery.js.map +1 -0
- package/dist/walls/01-context/sessions/replay.d.ts +50 -0
- package/dist/walls/01-context/sessions/replay.d.ts.map +1 -0
- package/dist/walls/01-context/sessions/replay.js +426 -0
- package/dist/walls/01-context/sessions/replay.js.map +1 -0
- package/dist/walls/01-context/sessions/session-memory.d.ts.map +1 -0
- package/dist/{core → walls/01-context/sessions}/session-memory.js +2 -2
- package/dist/walls/01-context/sessions/session-memory.js.map +1 -0
- package/dist/walls/02-scanner/blindspots/code-scanner.d.ts.map +1 -0
- package/dist/{code-scanner.js → walls/02-scanner/blindspots/code-scanner.js} +15 -10
- package/dist/walls/02-scanner/blindspots/code-scanner.js.map +1 -0
- package/dist/{developer-intelligence.d.ts → walls/02-scanner/profile/developer-intelligence.d.ts} +3 -3
- package/dist/walls/02-scanner/profile/developer-intelligence.d.ts.map +1 -0
- package/dist/{developer-intelligence.js → walls/02-scanner/profile/developer-intelligence.js} +4 -4
- package/dist/walls/02-scanner/profile/developer-intelligence.js.map +1 -0
- package/dist/walls/02-scanner/stack/pc-scanner.d.ts.map +1 -0
- package/dist/{pc-scanner.js → walls/02-scanner/stack/pc-scanner.js} +1 -1
- package/dist/walls/02-scanner/stack/pc-scanner.js.map +1 -0
- package/dist/walls/02-scanner/stack/stack-detector.d.ts.map +1 -0
- package/dist/walls/02-scanner/stack/stack-detector.js.map +1 -0
- package/dist/walls/02-scanner/style/style-pull.d.ts.map +1 -0
- package/dist/walls/02-scanner/style/style-pull.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/ab-test-framework.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/ab-test-framework.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/ai-bridge.d.ts.map +1 -0
- package/dist/{ai-bridge.js → walls/03-knowledge/decisions/ai-bridge.js} +68 -68
- package/dist/walls/03-knowledge/decisions/ai-bridge.js.map +1 -0
- package/dist/{core → walls/03-knowledge/decisions}/ai-memory.d.ts +1 -1
- package/dist/walls/03-knowledge/decisions/ai-memory.d.ts.map +1 -0
- package/dist/{core → walls/03-knowledge/decisions}/ai-memory.js +1 -1
- package/dist/walls/03-knowledge/decisions/ai-memory.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/behavior-intelligence.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/behavior-intelligence.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/behavioral-tracker.d.ts.map +1 -0
- package/dist/{behavioral-tracker.js → walls/03-knowledge/decisions/behavioral-tracker.js} +80 -80
- package/dist/walls/03-knowledge/decisions/behavioral-tracker.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/branch-snapshot.d.ts +20 -0
- package/dist/walls/03-knowledge/decisions/branch-snapshot.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/branch-snapshot.js +175 -0
- package/dist/walls/03-knowledge/decisions/branch-snapshot.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/build-failure-predictor.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/build-failure-predictor.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/cost-optimizer.d.ts.map +1 -0
- package/dist/{core → walls/03-knowledge/decisions}/cost-optimizer.js +1 -1
- package/dist/walls/03-knowledge/decisions/cost-optimizer.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/cross-model-engine.d.ts.map +1 -0
- package/dist/{cross-model-engine.js → walls/03-knowledge/decisions/cross-model-engine.js} +23 -23
- package/dist/walls/03-knowledge/decisions/cross-model-engine.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/cross-model-memory.d.ts.map +1 -0
- package/dist/{cross-model-memory.js → walls/03-knowledge/decisions/cross-model-memory.js} +1 -1
- package/dist/walls/03-knowledge/decisions/cross-model-memory.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/developer-profile.d.ts +6 -0
- package/dist/walls/03-knowledge/decisions/developer-profile.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/developer-profile.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/error-predictor.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/error-predictor.js.map +1 -0
- package/dist/{core → walls/03-knowledge/decisions}/failure-memory.d.ts +7 -6
- package/dist/walls/03-knowledge/decisions/failure-memory.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/failure-memory.js +288 -0
- package/dist/walls/03-knowledge/decisions/failure-memory.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/focus-report.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/focus-report.js.map +1 -0
- package/dist/{core → walls/03-knowledge/decisions}/git-branch-pregenerator.d.ts +1 -1
- package/dist/walls/03-knowledge/decisions/git-branch-pregenerator.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/git-branch-pregenerator.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/insight-generator.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/insight-generator.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/journey-memory.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/journey-memory.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/merge-conflict-predictor.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/merge-conflict-predictor.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/model-intelligence.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/model-intelligence.js.map +1 -0
- package/dist/{core → walls/03-knowledge/decisions}/outcome-engine.d.ts +2 -2
- package/dist/walls/03-knowledge/decisions/outcome-engine.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/outcome-engine.js.map +1 -0
- package/dist/{core → walls/03-knowledge/decisions}/outcome-recorder.d.ts +1 -1
- package/dist/walls/03-knowledge/decisions/outcome-recorder.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/outcome-recorder.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/performance-predictor.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/performance-predictor.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/platt-calibration.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/platt-calibration.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/predictive-engine.d.ts.map +1 -0
- package/dist/{predictive-engine.js → walls/03-knowledge/decisions/predictive-engine.js} +1 -1
- package/dist/walls/03-knowledge/decisions/predictive-engine.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/predictive-intelligence.d.ts.map +1 -0
- package/dist/{predictive-intelligence.js → walls/03-knowledge/decisions/predictive-intelligence.js} +1 -1
- package/dist/walls/03-knowledge/decisions/predictive-intelligence.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/realtime-guardian.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/realtime-guardian.js.map +1 -0
- package/dist/{core → walls/03-knowledge/decisions}/recommendation-engine.d.ts +5 -5
- package/dist/walls/03-knowledge/decisions/recommendation-engine.d.ts.map +1 -0
- package/dist/{core → walls/03-knowledge/decisions}/recommendation-engine.js +1 -1
- package/dist/walls/03-knowledge/decisions/recommendation-engine.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/security-predictor.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/security-predictor.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/time-saved.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/time-saved.js.map +1 -0
- package/dist/walls/03-knowledge/decisions/workflow-outcome-graph.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/workflow-outcome-graph.js.map +1 -0
- package/dist/{core → walls/03-knowledge/decisions}/workflow-tracker.d.ts +1 -1
- package/dist/walls/03-knowledge/decisions/workflow-tracker.d.ts.map +1 -0
- package/dist/walls/03-knowledge/decisions/workflow-tracker.js.map +1 -0
- package/dist/{core → walls/03-knowledge/dna}/config-attribution.d.ts +1 -1
- package/dist/walls/03-knowledge/dna/config-attribution.d.ts.map +1 -0
- package/dist/walls/03-knowledge/dna/config-attribution.js.map +1 -0
- package/dist/{core → walls/03-knowledge/dna}/convention-detector.d.ts +1 -1
- package/dist/walls/03-knowledge/dna/convention-detector.d.ts.map +1 -0
- package/dist/{core → walls/03-knowledge/dna}/convention-detector.js +1 -1
- package/dist/walls/03-knowledge/dna/convention-detector.js.map +1 -0
- package/dist/walls/03-knowledge/dna/cross-domain-projections.d.ts.map +1 -0
- package/dist/walls/03-knowledge/dna/cross-domain-projections.js.map +1 -0
- package/dist/walls/03-knowledge/dna/cross-language-mappings.d.ts.map +1 -0
- package/dist/walls/03-knowledge/dna/cross-language-mappings.js.map +1 -0
- package/dist/{core → walls/03-knowledge/dna}/explainability.d.ts +1 -1
- package/dist/walls/03-knowledge/dna/explainability.d.ts.map +1 -0
- package/dist/{core → walls/03-knowledge/dna}/explainability.js +2 -2
- package/dist/walls/03-knowledge/dna/explainability.js.map +1 -0
- package/dist/walls/03-knowledge/dna/personal-intelligence.d.ts.map +1 -0
- package/dist/{personal-intelligence.js → walls/03-knowledge/dna/personal-intelligence.js} +1 -1
- package/dist/walls/03-knowledge/dna/personal-intelligence.js.map +1 -0
- package/dist/{core → walls/03-knowledge/dna}/project-dna.d.ts +2 -2
- package/dist/walls/03-knowledge/dna/project-dna.d.ts.map +1 -0
- package/dist/{core → walls/03-knowledge/dna}/project-dna.js +1 -1
- package/dist/walls/03-knowledge/dna/project-dna.js.map +1 -0
- package/dist/walls/03-knowledge/dna/proof-engine.d.ts.map +1 -0
- package/dist/{core → walls/03-knowledge/dna}/proof-engine.js +1 -1
- package/dist/walls/03-knowledge/dna/proof-engine.js.map +1 -0
- package/dist/walls/03-knowledge/graph/knowledge-graph-builder.d.ts.map +1 -0
- package/dist/walls/03-knowledge/graph/knowledge-graph-builder.js.map +1 -0
- package/dist/walls/03-knowledge/graph/knowledge-graph-engine.d.ts.map +1 -0
- package/dist/{core → walls/03-knowledge/graph}/knowledge-graph-engine.js +1 -1
- package/dist/walls/03-knowledge/graph/knowledge-graph-engine.js.map +1 -0
- package/dist/walls/03-knowledge/graph/knowledge-graph.d.ts.map +1 -0
- package/dist/{core → walls/03-knowledge/graph}/knowledge-graph.js +1 -1
- package/dist/walls/03-knowledge/graph/knowledge-graph.js.map +1 -0
- package/dist/walls/04-team/collab/team-collaboration.d.ts.map +1 -0
- package/dist/{team-collaboration.js → walls/04-team/collab/team-collaboration.js} +1 -1
- package/dist/walls/04-team/collab/team-collaboration.js.map +1 -0
- package/dist/walls/04-team/collab/team-git.d.ts.map +1 -0
- package/dist/{team-git.js → walls/04-team/collab/team-git.js} +1 -1
- package/dist/walls/04-team/collab/team-git.js.map +1 -0
- package/dist/walls/04-team/collab/team-intel.d.ts.map +1 -0
- package/dist/walls/04-team/collab/team-intel.js.map +1 -0
- package/dist/{core → walls/04-team/review}/pr-review-assistant.d.ts +1 -1
- package/dist/walls/04-team/review/pr-review-assistant.d.ts.map +1 -0
- package/dist/walls/04-team/review/pr-review-assistant.js.map +1 -0
- package/dist/walls/05-community/privacy/privacy-manager.d.ts.map +1 -0
- package/dist/walls/05-community/privacy/privacy-manager.js.map +1 -0
- package/dist/walls/05-community/privacy/security.d.ts.map +1 -0
- package/dist/walls/05-community/privacy/security.js.map +1 -0
- package/dist/walls/05-community/share/identity-resolver.d.ts.map +1 -0
- package/dist/walls/05-community/share/identity-resolver.js.map +1 -0
- package/dist/walls/05-community/share/marketplace.d.ts.map +1 -0
- package/dist/walls/05-community/share/marketplace.js.map +1 -0
- package/dist/walls/05-community/share/reputation.d.ts.map +1 -0
- package/dist/walls/05-community/share/reputation.js.map +1 -0
- package/dist/{core → walls/05-community/share}/signal-capture.d.ts +1 -1
- package/dist/walls/05-community/share/signal-capture.d.ts.map +1 -0
- package/dist/{core → walls/05-community/share}/signal-capture.js +2 -2
- package/dist/walls/05-community/share/signal-capture.js.map +1 -0
- package/dist/walls/05-community/stats/community-advanced-engine.d.ts.map +1 -0
- package/dist/{core → walls/05-community/stats}/community-advanced-engine.js +1 -1
- package/dist/walls/05-community/stats/community-advanced-engine.js.map +1 -0
- package/dist/walls/05-community/stats/community-engine.d.ts.map +1 -0
- package/dist/{core → walls/05-community/stats}/community-engine.js +1 -1
- package/dist/walls/05-community/stats/community-engine.js.map +1 -0
- package/dist/{core → walls/05-community/stats}/community-full.d.ts +1 -1
- package/dist/walls/05-community/stats/community-full.d.ts.map +1 -0
- package/dist/walls/05-community/stats/community-full.js.map +1 -0
- package/dist/walls/05-community/stats/community-intel.d.ts.map +1 -0
- package/dist/{community-intel.js → walls/05-community/stats/community-intel.js} +1 -1
- package/dist/walls/05-community/stats/community-intel.js.map +1 -0
- package/dist/walls/05-community/stats/community-intelligence.d.ts.map +1 -0
- package/dist/walls/05-community/stats/community-intelligence.js.map +1 -0
- package/dist/walls/05-community/stats/community-live.d.ts.map +1 -0
- package/dist/walls/05-community/stats/community-live.js.map +1 -0
- package/dist/{core → walls/05-community/stats}/community-prior.d.ts +1 -1
- package/dist/walls/05-community/stats/community-prior.d.ts.map +1 -0
- package/dist/walls/05-community/stats/community-prior.js.map +1 -0
- package/dist/walls/05-community/stats/community-v2.d.ts.map +1 -0
- package/dist/{community-v2.js → walls/05-community/stats/community-v2.js} +1 -1
- package/dist/walls/05-community/stats/community-v2.js.map +1 -0
- package/dist/walls/05-community/stats/layers.d.ts.map +1 -0
- package/dist/walls/05-community/stats/layers.js.map +1 -0
- package/dist/{core → walls/05-community/stats}/playbook-generator.d.ts +1 -1
- package/dist/walls/05-community/stats/playbook-generator.d.ts.map +1 -0
- package/dist/walls/05-community/stats/playbook-generator.js.map +1 -0
- package/dist/walls/06-memory/database/database.d.ts.map +1 -0
- package/dist/{core → walls/06-memory/database}/database.js +37 -2
- package/dist/walls/06-memory/database/database.js.map +1 -0
- package/dist/walls/06-memory/database/logger.d.ts.map +1 -0
- package/dist/walls/06-memory/database/logger.js.map +1 -0
- package/dist/walls/06-memory/stores/cell-store.d.ts.map +1 -0
- package/dist/walls/06-memory/stores/cell-store.js.map +1 -0
- package/dist/walls/06-memory/stores/community-store.d.ts.map +1 -0
- package/dist/{core → walls/06-memory/stores}/community-store.js +1 -1
- package/dist/walls/06-memory/stores/community-store.js.map +1 -0
- package/dist/walls/06-memory/stores/decay-engine.d.ts.map +1 -0
- package/dist/walls/06-memory/stores/decay-engine.js.map +1 -0
- package/dist/{core → walls/06-memory/stores}/knowledge-graph-store.d.ts +1 -1
- package/dist/walls/06-memory/stores/knowledge-graph-store.d.ts.map +1 -0
- package/dist/{core → walls/06-memory/stores}/knowledge-graph-store.js +47 -47
- package/dist/walls/06-memory/stores/knowledge-graph-store.js.map +1 -0
- package/dist/walls/06-memory/stores/outcome-store.d.ts.map +1 -0
- package/dist/walls/06-memory/stores/outcome-store.js.map +1 -0
- package/dist/walls/06-memory/stores/outcome-types.d.ts.map +1 -0
- package/dist/walls/06-memory/stores/outcome-types.js.map +1 -0
- package/dist/{core → walls/06-memory/stores}/pattern-store.d.ts +4 -4
- package/dist/walls/06-memory/stores/pattern-store.d.ts.map +1 -0
- package/dist/{core → walls/06-memory/stores}/pattern-store.js +9 -9
- package/dist/walls/06-memory/stores/pattern-store.js.map +1 -0
- package/dist/walls/06-memory/stores/recommendation-store.d.ts.map +1 -0
- package/dist/walls/06-memory/stores/recommendation-store.js.map +1 -0
- package/dist/walls/06-memory/stores/recommendation-types.d.ts.map +1 -0
- package/dist/walls/06-memory/stores/recommendation-types.js.map +1 -0
- package/dist/walls/06-memory/stores/usage-intelligence-store.d.ts.map +1 -0
- package/dist/{core → walls/06-memory/stores}/usage-intelligence-store.js +1 -1
- package/dist/walls/06-memory/stores/usage-intelligence-store.js.map +1 -0
- package/dist/walls/07-runtime/cli/cli-repl.d.ts +27 -0
- package/dist/walls/07-runtime/cli/cli-repl.d.ts.map +1 -0
- package/dist/walls/07-runtime/cli/cli-repl.js +76 -0
- package/dist/walls/07-runtime/cli/cli-repl.js.map +1 -0
- package/dist/walls/07-runtime/cli/cli.d.ts.map +1 -0
- package/dist/walls/07-runtime/cli/cli.js +3183 -0
- package/dist/walls/07-runtime/cli/cli.js.map +1 -0
- package/dist/walls/07-runtime/daemon/lifecycle.d.ts.map +1 -0
- package/dist/walls/07-runtime/daemon/lifecycle.js.map +1 -0
- package/dist/walls/07-runtime/daemon/server.d.ts +83 -0
- package/dist/walls/07-runtime/daemon/server.d.ts.map +1 -0
- package/dist/{daemon → walls/07-runtime/daemon}/server.js +211 -279
- package/dist/walls/07-runtime/daemon/server.js.map +1 -0
- package/dist/walls/07-runtime/daemon/watchdog.d.ts.map +1 -0
- package/dist/walls/07-runtime/daemon/watchdog.js.map +1 -0
- package/dist/walls/07-runtime/daemon/websocket.d.ts.map +1 -0
- package/dist/{daemon → walls/07-runtime/daemon}/websocket.js +1 -1
- package/dist/walls/07-runtime/daemon/websocket.js.map +1 -0
- package/dist/walls/07-runtime/setup/cell-state.d.ts +17 -0
- package/dist/walls/07-runtime/setup/cell-state.d.ts.map +1 -0
- package/dist/walls/07-runtime/setup/cell-state.js +94 -0
- package/dist/walls/07-runtime/setup/cell-state.js.map +1 -0
- package/dist/walls/07-runtime/setup/first-run.d.ts.map +1 -0
- package/dist/walls/07-runtime/setup/first-run.js.map +1 -0
- package/dist/walls/07-runtime/setup/production.d.ts.map +1 -0
- package/dist/{production.js → walls/07-runtime/setup/production.js} +2 -2
- package/dist/walls/07-runtime/setup/production.js.map +1 -0
- package/dist/walls/07-runtime/setup/setup.d.ts.map +1 -0
- package/dist/{core → walls/07-runtime/setup}/setup.js +5 -5
- package/dist/walls/07-runtime/setup/setup.js.map +1 -0
- package/dist/walls/07-runtime/watcher/editor-monitor.d.ts +93 -0
- package/dist/walls/07-runtime/watcher/editor-monitor.d.ts.map +1 -0
- package/dist/walls/07-runtime/watcher/editor-monitor.js +497 -0
- package/dist/walls/07-runtime/watcher/editor-monitor.js.map +1 -0
- package/dist/walls/07-runtime/watcher/live-watcher.d.ts.map +1 -0
- package/dist/{core → walls/07-runtime/watcher}/live-watcher.js +46 -46
- package/dist/walls/07-runtime/watcher/live-watcher.js.map +1 -0
- package/dist/walls/07-runtime/watcher/socket-bridge.d.ts +139 -0
- package/dist/walls/07-runtime/watcher/socket-bridge.d.ts.map +1 -0
- package/dist/walls/07-runtime/watcher/socket-bridge.js +566 -0
- package/dist/walls/07-runtime/watcher/socket-bridge.js.map +1 -0
- package/dist/walls/07-runtime/watcher/watch-cli.d.ts.map +1 -0
- package/dist/walls/07-runtime/watcher/watch-cli.js.map +1 -0
- package/dist/walls/08-cloud-bridge/sync/ai-bridge.d.ts +20 -0
- package/dist/walls/08-cloud-bridge/sync/ai-bridge.d.ts.map +1 -0
- package/dist/walls/08-cloud-bridge/sync/ai-bridge.js +250 -0
- package/dist/walls/08-cloud-bridge/sync/ai-bridge.js.map +1 -0
- package/dist/walls/08-cloud-bridge/sync/cloud-client.d.ts.map +1 -0
- package/dist/{core → walls/08-cloud-bridge/sync}/cloud-client.js +1 -1
- package/dist/walls/08-cloud-bridge/sync/cloud-client.js.map +1 -0
- package/dist/walls/08-cloud-bridge/sync/cloud-sync.d.ts.map +1 -0
- package/dist/{cloud-sync.js → walls/08-cloud-bridge/sync/cloud-sync.js} +2 -2
- package/dist/walls/08-cloud-bridge/sync/cloud-sync.js.map +1 -0
- package/package.json +4 -5
- package/dist/ai-bridge.d.ts.map +0 -1
- package/dist/ai-bridge.js.map +0 -1
- package/dist/behavior-intelligence.d.ts.map +0 -1
- package/dist/behavior-intelligence.js.map +0 -1
- package/dist/behavioral-tracker.d.ts.map +0 -1
- package/dist/behavioral-tracker.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -1538
- package/dist/cli.js.map +0 -1
- package/dist/cloud-sync.d.ts.map +0 -1
- package/dist/cloud-sync.js.map +0 -1
- package/dist/code-scanner.d.ts.map +0 -1
- package/dist/code-scanner.js.map +0 -1
- package/dist/community-intel.d.ts.map +0 -1
- package/dist/community-intel.js.map +0 -1
- package/dist/community-intelligence.d.ts.map +0 -1
- package/dist/community-intelligence.js.map +0 -1
- package/dist/community-v2.d.ts.map +0 -1
- package/dist/community-v2.js.map +0 -1
- package/dist/core/ab-test-framework.d.ts.map +0 -1
- package/dist/core/ab-test-framework.js.map +0 -1
- package/dist/core/agents-md.d.ts.map +0 -1
- package/dist/core/agents-md.js.map +0 -1
- package/dist/core/ai-memory.d.ts.map +0 -1
- package/dist/core/ai-memory.js.map +0 -1
- package/dist/core/build-failure-predictor.d.ts.map +0 -1
- package/dist/core/build-failure-predictor.js.map +0 -1
- package/dist/core/cell-store.d.ts.map +0 -1
- package/dist/core/cell-store.js.map +0 -1
- package/dist/core/cloud-client.d.ts.map +0 -1
- package/dist/core/cloud-client.js.map +0 -1
- package/dist/core/community-advanced-engine.d.ts.map +0 -1
- package/dist/core/community-advanced-engine.js.map +0 -1
- package/dist/core/community-engine.d.ts.map +0 -1
- package/dist/core/community-engine.js.map +0 -1
- package/dist/core/community-full.d.ts.map +0 -1
- package/dist/core/community-full.js.map +0 -1
- package/dist/core/community-live.d.ts.map +0 -1
- package/dist/core/community-live.js.map +0 -1
- package/dist/core/community-prior.d.ts.map +0 -1
- package/dist/core/community-prior.js.map +0 -1
- package/dist/core/community-store.d.ts.map +0 -1
- package/dist/core/community-store.js.map +0 -1
- package/dist/core/config-attribution.d.ts.map +0 -1
- package/dist/core/config-attribution.js.map +0 -1
- package/dist/core/convention-detector.d.ts.map +0 -1
- package/dist/core/convention-detector.js.map +0 -1
- package/dist/core/cost-optimizer.d.ts.map +0 -1
- package/dist/core/cost-optimizer.js.map +0 -1
- package/dist/core/cross-domain-projections.d.ts.map +0 -1
- package/dist/core/cross-domain-projections.js.map +0 -1
- package/dist/core/cross-language-mappings.d.ts.map +0 -1
- package/dist/core/cross-language-mappings.js.map +0 -1
- package/dist/core/database.d.ts.map +0 -1
- package/dist/core/database.js.map +0 -1
- package/dist/core/decay-engine.d.ts.map +0 -1
- package/dist/core/decay-engine.js.map +0 -1
- package/dist/core/developer-profile.d.ts +0 -6
- package/dist/core/developer-profile.d.ts.map +0 -1
- package/dist/core/developer-profile.js.map +0 -1
- package/dist/core/error-predictor.d.ts.map +0 -1
- package/dist/core/error-predictor.js.map +0 -1
- package/dist/core/explainability.d.ts.map +0 -1
- package/dist/core/explainability.js.map +0 -1
- package/dist/core/failure-memory.d.ts.map +0 -1
- package/dist/core/failure-memory.js +0 -113
- package/dist/core/failure-memory.js.map +0 -1
- package/dist/core/git-branch-pregenerator.d.ts.map +0 -1
- package/dist/core/git-branch-pregenerator.js.map +0 -1
- package/dist/core/identity-resolver.d.ts.map +0 -1
- package/dist/core/identity-resolver.js.map +0 -1
- package/dist/core/interruption-recovery.d.ts.map +0 -1
- package/dist/core/interruption-recovery.js.map +0 -1
- package/dist/core/knowledge-graph-engine.d.ts.map +0 -1
- package/dist/core/knowledge-graph-engine.js.map +0 -1
- package/dist/core/knowledge-graph-store.d.ts.map +0 -1
- package/dist/core/knowledge-graph-store.js.map +0 -1
- package/dist/core/knowledge-graph.d.ts.map +0 -1
- package/dist/core/knowledge-graph.js.map +0 -1
- package/dist/core/live-watcher.d.ts.map +0 -1
- package/dist/core/live-watcher.js.map +0 -1
- package/dist/core/logger.d.ts.map +0 -1
- package/dist/core/logger.js.map +0 -1
- package/dist/core/marketplace.d.ts.map +0 -1
- package/dist/core/marketplace.js.map +0 -1
- package/dist/core/merge-conflict-predictor.d.ts.map +0 -1
- package/dist/core/merge-conflict-predictor.js.map +0 -1
- package/dist/core/model-intelligence.d.ts.map +0 -1
- package/dist/core/model-intelligence.js.map +0 -1
- package/dist/core/outcome-engine.d.ts.map +0 -1
- package/dist/core/outcome-engine.js.map +0 -1
- package/dist/core/outcome-recorder.d.ts.map +0 -1
- package/dist/core/outcome-recorder.js.map +0 -1
- package/dist/core/outcome-store.d.ts.map +0 -1
- package/dist/core/outcome-store.js.map +0 -1
- package/dist/core/outcome-types.d.ts.map +0 -1
- package/dist/core/outcome-types.js.map +0 -1
- package/dist/core/pattern-store.d.ts.map +0 -1
- package/dist/core/pattern-store.js.map +0 -1
- package/dist/core/performance-predictor.d.ts.map +0 -1
- package/dist/core/performance-predictor.js.map +0 -1
- package/dist/core/platt-calibration.d.ts.map +0 -1
- package/dist/core/platt-calibration.js.map +0 -1
- package/dist/core/playbook-generator.d.ts.map +0 -1
- package/dist/core/playbook-generator.js.map +0 -1
- package/dist/core/pr-review-assistant.d.ts.map +0 -1
- package/dist/core/pr-review-assistant.js.map +0 -1
- package/dist/core/privacy-manager.d.ts.map +0 -1
- package/dist/core/privacy-manager.js.map +0 -1
- package/dist/core/project-dna.d.ts.map +0 -1
- package/dist/core/project-dna.js.map +0 -1
- package/dist/core/prompt-builder.d.ts.map +0 -1
- package/dist/core/prompt-builder.js.map +0 -1
- package/dist/core/proof-engine.d.ts.map +0 -1
- package/dist/core/proof-engine.js.map +0 -1
- package/dist/core/realtime-guardian.d.ts.map +0 -1
- package/dist/core/realtime-guardian.js.map +0 -1
- package/dist/core/recommendation-engine.d.ts.map +0 -1
- package/dist/core/recommendation-engine.js.map +0 -1
- package/dist/core/recommendation-store.d.ts.map +0 -1
- package/dist/core/recommendation-store.js.map +0 -1
- package/dist/core/recommendation-types.d.ts.map +0 -1
- package/dist/core/recommendation-types.js.map +0 -1
- package/dist/core/reputation.d.ts.map +0 -1
- package/dist/core/reputation.js.map +0 -1
- package/dist/core/security-predictor.d.ts.map +0 -1
- package/dist/core/security-predictor.js.map +0 -1
- package/dist/core/security.d.ts.map +0 -1
- package/dist/core/security.js.map +0 -1
- package/dist/core/session-memory.d.ts.map +0 -1
- package/dist/core/session-memory.js.map +0 -1
- package/dist/core/setup.d.ts.map +0 -1
- package/dist/core/setup.js.map +0 -1
- package/dist/core/signal-capture.d.ts.map +0 -1
- package/dist/core/signal-capture.js.map +0 -1
- package/dist/core/time-saved.d.ts.map +0 -1
- package/dist/core/time-saved.js.map +0 -1
- package/dist/core/usage-intelligence-store.d.ts.map +0 -1
- package/dist/core/usage-intelligence-store.js.map +0 -1
- package/dist/core/watch-cli.d.ts.map +0 -1
- package/dist/core/watch-cli.js.map +0 -1
- package/dist/core/workflow-outcome-graph.d.ts.map +0 -1
- package/dist/core/workflow-outcome-graph.js.map +0 -1
- package/dist/core/workflow-tracker.d.ts.map +0 -1
- package/dist/core/workflow-tracker.js.map +0 -1
- package/dist/cross-model-engine.d.ts.map +0 -1
- package/dist/cross-model-engine.js.map +0 -1
- package/dist/cross-model-memory.d.ts.map +0 -1
- package/dist/cross-model-memory.js.map +0 -1
- package/dist/daemon/lifecycle.d.ts.map +0 -1
- package/dist/daemon/lifecycle.js.map +0 -1
- package/dist/daemon/server.d.ts +0 -83
- package/dist/daemon/server.d.ts.map +0 -1
- package/dist/daemon/server.js.map +0 -1
- package/dist/daemon/watchdog.d.ts.map +0 -1
- package/dist/daemon/watchdog.js.map +0 -1
- package/dist/daemon/websocket.d.ts.map +0 -1
- package/dist/daemon/websocket.js.map +0 -1
- package/dist/developer-intelligence.d.ts.map +0 -1
- package/dist/developer-intelligence.js.map +0 -1
- package/dist/first-run.d.ts.map +0 -1
- package/dist/first-run.js.map +0 -1
- package/dist/focus-report.d.ts.map +0 -1
- package/dist/focus-report.js.map +0 -1
- package/dist/ide-intelligence.d.ts.map +0 -1
- package/dist/ide-intelligence.js.map +0 -1
- package/dist/insight-generator.d.ts.map +0 -1
- package/dist/insight-generator.js.map +0 -1
- package/dist/journey-memory.d.ts.map +0 -1
- package/dist/journey-memory.js.map +0 -1
- package/dist/knowledge-graph-builder.d.ts.map +0 -1
- package/dist/knowledge-graph-builder.js.map +0 -1
- package/dist/layers.d.ts.map +0 -1
- package/dist/layers.js.map +0 -1
- package/dist/mcp-server.d.ts +0 -406
- package/dist/mcp-server.d.ts.map +0 -1
- package/dist/mcp-server.js +0 -414
- package/dist/mcp-server.js.map +0 -1
- package/dist/onboarding-scan.d.ts +0 -174
- package/dist/onboarding-scan.d.ts.map +0 -1
- package/dist/onboarding-scan.js +0 -1039
- package/dist/onboarding-scan.js.map +0 -1
- package/dist/pc-scanner.d.ts.map +0 -1
- package/dist/pc-scanner.js.map +0 -1
- package/dist/personal-intelligence.d.ts.map +0 -1
- package/dist/personal-intelligence.js.map +0 -1
- package/dist/predictive-engine.d.ts.map +0 -1
- package/dist/predictive-engine.js.map +0 -1
- package/dist/predictive-intelligence.d.ts.map +0 -1
- package/dist/predictive-intelligence.js.map +0 -1
- package/dist/production.d.ts.map +0 -1
- package/dist/production.js.map +0 -1
- package/dist/senior-features.d.ts +0 -63
- package/dist/senior-features.d.ts.map +0 -1
- package/dist/senior-features.js +0 -325
- package/dist/senior-features.js.map +0 -1
- package/dist/stack-detector.d.ts.map +0 -1
- package/dist/stack-detector.js.map +0 -1
- package/dist/store.d.ts +0 -4
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js +0 -47
- package/dist/store.js.map +0 -1
- package/dist/style-pull.d.ts.map +0 -1
- package/dist/style-pull.js.map +0 -1
- package/dist/team-collaboration.d.ts.map +0 -1
- package/dist/team-collaboration.js.map +0 -1
- package/dist/team-git.d.ts.map +0 -1
- package/dist/team-git.js.map +0 -1
- package/dist/team-intel.d.ts.map +0 -1
- package/dist/team-intel.js.map +0 -1
- package/dist/team-intelligence.d.ts +0 -64
- package/dist/team-intelligence.d.ts.map +0 -1
- package/dist/team-intelligence.js +0 -289
- package/dist/team-intelligence.js.map +0 -1
- package/dist/test-touch-145026.d.ts +0 -1
- package/dist/test-touch-145026.d.ts.map +0 -1
- package/dist/test-touch-145026.js +0 -2
- package/dist/test-touch-145026.js.map +0 -1
- package/dist/test-watch.d.ts +0 -2
- package/dist/test-watch.d.ts.map +0 -1
- package/dist/test-watch.js +0 -8
- package/dist/test-watch.js.map +0 -1
- package/dist/user-intelligence.d.ts.map +0 -1
- package/dist/user-intelligence.js.map +0 -1
- package/dist/verify-145929.d.ts +0 -1
- package/dist/verify-145929.d.ts.map +0 -1
- package/dist/verify-145929.js +0 -2
- package/dist/verify-145929.js.map +0 -1
- package/dist/verify2-150021.d.ts +0 -1
- package/dist/verify2-150021.d.ts.map +0 -1
- package/dist/verify2-150021.js +0 -2
- package/dist/verify2-150021.js.map +0 -1
- package/dist/work-style.d.ts +0 -49
- package/dist/work-style.d.ts.map +0 -1
- package/dist/work-style.js +0 -247
- package/dist/work-style.js.map +0 -1
- /package/dist/{core → walls/01-context/context}/agents-md.d.ts +0 -0
- /package/dist/{core → walls/01-context/context}/agents-md.js +0 -0
- /package/dist/{ide-intelligence.d.ts → walls/01-context/context/ide-intelligence.d.ts} +0 -0
- /package/dist/{core → walls/01-context/context}/prompt-builder.d.ts +0 -0
- /package/dist/{user-intelligence.d.ts → walls/01-context/context/user-intelligence.d.ts} +0 -0
- /package/dist/{user-intelligence.js → walls/01-context/context/user-intelligence.js} +0 -0
- /package/dist/{core → walls/01-context/sessions}/interruption-recovery.d.ts +0 -0
- /package/dist/{core → walls/01-context/sessions}/interruption-recovery.js +0 -0
- /package/dist/{core → walls/01-context/sessions}/session-memory.d.ts +0 -0
- /package/dist/{code-scanner.d.ts → walls/02-scanner/blindspots/code-scanner.d.ts} +0 -0
- /package/dist/{pc-scanner.d.ts → walls/02-scanner/stack/pc-scanner.d.ts} +0 -0
- /package/dist/{stack-detector.d.ts → walls/02-scanner/stack/stack-detector.d.ts} +0 -0
- /package/dist/{stack-detector.js → walls/02-scanner/stack/stack-detector.js} +0 -0
- /package/dist/{style-pull.d.ts → walls/02-scanner/style/style-pull.d.ts} +0 -0
- /package/dist/{style-pull.js → walls/02-scanner/style/style-pull.js} +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/ab-test-framework.d.ts +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/ab-test-framework.js +0 -0
- /package/dist/{ai-bridge.d.ts → walls/03-knowledge/decisions/ai-bridge.d.ts} +0 -0
- /package/dist/{behavior-intelligence.d.ts → walls/03-knowledge/decisions/behavior-intelligence.d.ts} +0 -0
- /package/dist/{behavior-intelligence.js → walls/03-knowledge/decisions/behavior-intelligence.js} +0 -0
- /package/dist/{behavioral-tracker.d.ts → walls/03-knowledge/decisions/behavioral-tracker.d.ts} +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/build-failure-predictor.d.ts +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/build-failure-predictor.js +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/cost-optimizer.d.ts +0 -0
- /package/dist/{cross-model-engine.d.ts → walls/03-knowledge/decisions/cross-model-engine.d.ts} +0 -0
- /package/dist/{cross-model-memory.d.ts → walls/03-knowledge/decisions/cross-model-memory.d.ts} +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/developer-profile.js +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/error-predictor.d.ts +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/error-predictor.js +0 -0
- /package/dist/{focus-report.d.ts → walls/03-knowledge/decisions/focus-report.d.ts} +0 -0
- /package/dist/{focus-report.js → walls/03-knowledge/decisions/focus-report.js} +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/git-branch-pregenerator.js +0 -0
- /package/dist/{insight-generator.d.ts → walls/03-knowledge/decisions/insight-generator.d.ts} +0 -0
- /package/dist/{insight-generator.js → walls/03-knowledge/decisions/insight-generator.js} +0 -0
- /package/dist/{journey-memory.d.ts → walls/03-knowledge/decisions/journey-memory.d.ts} +0 -0
- /package/dist/{journey-memory.js → walls/03-knowledge/decisions/journey-memory.js} +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/merge-conflict-predictor.d.ts +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/merge-conflict-predictor.js +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/model-intelligence.d.ts +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/model-intelligence.js +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/outcome-engine.js +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/outcome-recorder.js +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/performance-predictor.d.ts +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/performance-predictor.js +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/platt-calibration.d.ts +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/platt-calibration.js +0 -0
- /package/dist/{predictive-engine.d.ts → walls/03-knowledge/decisions/predictive-engine.d.ts} +0 -0
- /package/dist/{predictive-intelligence.d.ts → walls/03-knowledge/decisions/predictive-intelligence.d.ts} +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/realtime-guardian.d.ts +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/realtime-guardian.js +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/security-predictor.d.ts +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/security-predictor.js +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/time-saved.d.ts +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/time-saved.js +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/workflow-outcome-graph.d.ts +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/workflow-outcome-graph.js +0 -0
- /package/dist/{core → walls/03-knowledge/decisions}/workflow-tracker.js +0 -0
- /package/dist/{core → walls/03-knowledge/dna}/config-attribution.js +0 -0
- /package/dist/{core → walls/03-knowledge/dna}/cross-domain-projections.d.ts +0 -0
- /package/dist/{core → walls/03-knowledge/dna}/cross-domain-projections.js +0 -0
- /package/dist/{core → walls/03-knowledge/dna}/cross-language-mappings.d.ts +0 -0
- /package/dist/{core → walls/03-knowledge/dna}/cross-language-mappings.js +0 -0
- /package/dist/{personal-intelligence.d.ts → walls/03-knowledge/dna/personal-intelligence.d.ts} +0 -0
- /package/dist/{core → walls/03-knowledge/dna}/proof-engine.d.ts +0 -0
- /package/dist/{knowledge-graph-builder.d.ts → walls/03-knowledge/graph/knowledge-graph-builder.d.ts} +0 -0
- /package/dist/{knowledge-graph-builder.js → walls/03-knowledge/graph/knowledge-graph-builder.js} +0 -0
- /package/dist/{core → walls/03-knowledge/graph}/knowledge-graph-engine.d.ts +0 -0
- /package/dist/{core → walls/03-knowledge/graph}/knowledge-graph.d.ts +0 -0
- /package/dist/{team-collaboration.d.ts → walls/04-team/collab/team-collaboration.d.ts} +0 -0
- /package/dist/{team-git.d.ts → walls/04-team/collab/team-git.d.ts} +0 -0
- /package/dist/{team-intel.d.ts → walls/04-team/collab/team-intel.d.ts} +0 -0
- /package/dist/{team-intel.js → walls/04-team/collab/team-intel.js} +0 -0
- /package/dist/{core → walls/04-team/review}/pr-review-assistant.js +0 -0
- /package/dist/{core → walls/05-community/privacy}/privacy-manager.d.ts +0 -0
- /package/dist/{core → walls/05-community/privacy}/privacy-manager.js +0 -0
- /package/dist/{core → walls/05-community/privacy}/security.d.ts +0 -0
- /package/dist/{core → walls/05-community/privacy}/security.js +0 -0
- /package/dist/{core → walls/05-community/share}/identity-resolver.d.ts +0 -0
- /package/dist/{core → walls/05-community/share}/identity-resolver.js +0 -0
- /package/dist/{core → walls/05-community/share}/marketplace.d.ts +0 -0
- /package/dist/{core → walls/05-community/share}/marketplace.js +0 -0
- /package/dist/{core → walls/05-community/share}/reputation.d.ts +0 -0
- /package/dist/{core → walls/05-community/share}/reputation.js +0 -0
- /package/dist/{core → walls/05-community/stats}/community-advanced-engine.d.ts +0 -0
- /package/dist/{core → walls/05-community/stats}/community-engine.d.ts +0 -0
- /package/dist/{core → walls/05-community/stats}/community-full.js +0 -0
- /package/dist/{community-intel.d.ts → walls/05-community/stats/community-intel.d.ts} +0 -0
- /package/dist/{community-intelligence.d.ts → walls/05-community/stats/community-intelligence.d.ts} +0 -0
- /package/dist/{community-intelligence.js → walls/05-community/stats/community-intelligence.js} +0 -0
- /package/dist/{core → walls/05-community/stats}/community-live.d.ts +0 -0
- /package/dist/{core → walls/05-community/stats}/community-live.js +0 -0
- /package/dist/{core → walls/05-community/stats}/community-prior.js +0 -0
- /package/dist/{community-v2.d.ts → walls/05-community/stats/community-v2.d.ts} +0 -0
- /package/dist/{layers.d.ts → walls/05-community/stats/layers.d.ts} +0 -0
- /package/dist/{layers.js → walls/05-community/stats/layers.js} +0 -0
- /package/dist/{core → walls/05-community/stats}/playbook-generator.js +0 -0
- /package/dist/{core → walls/06-memory/database}/database.d.ts +0 -0
- /package/dist/{core → walls/06-memory/database}/logger.d.ts +0 -0
- /package/dist/{core → walls/06-memory/database}/logger.js +0 -0
- /package/dist/{core → walls/06-memory/stores}/cell-store.d.ts +0 -0
- /package/dist/{core → walls/06-memory/stores}/cell-store.js +0 -0
- /package/dist/{core → walls/06-memory/stores}/community-store.d.ts +0 -0
- /package/dist/{core → walls/06-memory/stores}/decay-engine.d.ts +0 -0
- /package/dist/{core → walls/06-memory/stores}/decay-engine.js +0 -0
- /package/dist/{core → walls/06-memory/stores}/outcome-store.d.ts +0 -0
- /package/dist/{core → walls/06-memory/stores}/outcome-store.js +0 -0
- /package/dist/{core → walls/06-memory/stores}/outcome-types.d.ts +0 -0
- /package/dist/{core → walls/06-memory/stores}/outcome-types.js +0 -0
- /package/dist/{core → walls/06-memory/stores}/recommendation-store.d.ts +0 -0
- /package/dist/{core → walls/06-memory/stores}/recommendation-store.js +0 -0
- /package/dist/{core → walls/06-memory/stores}/recommendation-types.d.ts +0 -0
- /package/dist/{core → walls/06-memory/stores}/recommendation-types.js +0 -0
- /package/dist/{core → walls/06-memory/stores}/usage-intelligence-store.d.ts +0 -0
- /package/dist/{cli.d.ts → walls/07-runtime/cli/cli.d.ts} +0 -0
- /package/dist/{daemon → walls/07-runtime/daemon}/lifecycle.d.ts +0 -0
- /package/dist/{daemon → walls/07-runtime/daemon}/lifecycle.js +0 -0
- /package/dist/{daemon → walls/07-runtime/daemon}/watchdog.d.ts +0 -0
- /package/dist/{daemon → walls/07-runtime/daemon}/watchdog.js +0 -0
- /package/dist/{daemon → walls/07-runtime/daemon}/websocket.d.ts +0 -0
- /package/dist/{first-run.d.ts → walls/07-runtime/setup/first-run.d.ts} +0 -0
- /package/dist/{first-run.js → walls/07-runtime/setup/first-run.js} +0 -0
- /package/dist/{production.d.ts → walls/07-runtime/setup/production.d.ts} +0 -0
- /package/dist/{core → walls/07-runtime/setup}/setup.d.ts +0 -0
- /package/dist/{core → walls/07-runtime/watcher}/live-watcher.d.ts +0 -0
- /package/dist/{core → walls/07-runtime/watcher}/watch-cli.d.ts +0 -0
- /package/dist/{core → walls/07-runtime/watcher}/watch-cli.js +0 -0
- /package/dist/{core → walls/08-cloud-bridge/sync}/cloud-client.d.ts +0 -0
- /package/dist/{cloud-sync.d.ts → walls/08-cloud-bridge/sync/cloud-sync.d.ts} +0 -0
|
@@ -0,0 +1,3183 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
42
|
+
const os = __importStar(require("os"));
|
|
43
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
44
|
+
const figlet_1 = __importDefault(require("figlet"));
|
|
45
|
+
const gradient_string_1 = __importDefault(require("gradient-string"));
|
|
46
|
+
const database_1 = require("../../06-memory/database/database");
|
|
47
|
+
const layers_1 = require("../../05-community/stats/layers");
|
|
48
|
+
const cli_repl_1 = require("./cli-repl");
|
|
49
|
+
(0, database_1.initializeDatabase)();
|
|
50
|
+
const C = {
|
|
51
|
+
primary: chalk_1.default.hex('#FF6B35'),
|
|
52
|
+
success: chalk_1.default.green,
|
|
53
|
+
warn: chalk_1.default.yellow,
|
|
54
|
+
dim: chalk_1.default.dim,
|
|
55
|
+
bold: chalk_1.default.bold,
|
|
56
|
+
num: (s) => chalk_1.default.hex('#FF6B35').bold(s),
|
|
57
|
+
};
|
|
58
|
+
const project = path.basename(process.cwd());
|
|
59
|
+
// ─── Parse ──────────────────────────────────────────────────────────────────
|
|
60
|
+
// Parse args, treating double-quoted values as single tokens (so paths with spaces survive).
|
|
61
|
+
function parseArgs(argv) {
|
|
62
|
+
const out = [];
|
|
63
|
+
let buf = '';
|
|
64
|
+
let inQuote = false;
|
|
65
|
+
for (const a of argv) {
|
|
66
|
+
if (inQuote) {
|
|
67
|
+
buf += ' ' + a;
|
|
68
|
+
if (a.endsWith('"')) {
|
|
69
|
+
out.push(buf.slice(0, -1));
|
|
70
|
+
buf = '';
|
|
71
|
+
inQuote = false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else if (a.startsWith('"') && !a.endsWith('"')) {
|
|
75
|
+
buf = a.slice(1);
|
|
76
|
+
inQuote = true;
|
|
77
|
+
}
|
|
78
|
+
else if (a.startsWith('"') && a.endsWith('"') && a.length > 1) {
|
|
79
|
+
out.push(a.slice(1, -1));
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
out.push(a);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (buf)
|
|
86
|
+
out.push(buf);
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
const args = parseArgs(process.argv.slice(2));
|
|
90
|
+
const cmd = args[0] || '';
|
|
91
|
+
// Module-level state for watch-editor (must be declared before switch)
|
|
92
|
+
let activeMonitor = null;
|
|
93
|
+
let monitorStateFile = null;
|
|
94
|
+
function isPidAlive(pid) {
|
|
95
|
+
try {
|
|
96
|
+
process.kill(pid, 0);
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
switch (cmd) {
|
|
104
|
+
case '--version':
|
|
105
|
+
case '-v':
|
|
106
|
+
case 'version':
|
|
107
|
+
doVersion();
|
|
108
|
+
break;
|
|
109
|
+
case 'start':
|
|
110
|
+
doStart();
|
|
111
|
+
break;
|
|
112
|
+
case 'stop':
|
|
113
|
+
doStop();
|
|
114
|
+
break;
|
|
115
|
+
case 'setup':
|
|
116
|
+
doSetup().catch((e) => {
|
|
117
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
118
|
+
console.log(C.warn(' Setup crashed: ' + msg));
|
|
119
|
+
process.exit(1);
|
|
120
|
+
});
|
|
121
|
+
break;
|
|
122
|
+
case 'scan':
|
|
123
|
+
doScan();
|
|
124
|
+
break;
|
|
125
|
+
case 'analyze':
|
|
126
|
+
doAnalyze();
|
|
127
|
+
break;
|
|
128
|
+
case 'status':
|
|
129
|
+
doStatus();
|
|
130
|
+
break;
|
|
131
|
+
case 'session':
|
|
132
|
+
doSession();
|
|
133
|
+
break;
|
|
134
|
+
case 'decisions':
|
|
135
|
+
doDecisions();
|
|
136
|
+
break;
|
|
137
|
+
case 'team':
|
|
138
|
+
doTeam();
|
|
139
|
+
break;
|
|
140
|
+
case 'community':
|
|
141
|
+
doCommunity();
|
|
142
|
+
break;
|
|
143
|
+
case 'watch':
|
|
144
|
+
doWatch();
|
|
145
|
+
break;
|
|
146
|
+
case 'blindspots':
|
|
147
|
+
doBlindspots();
|
|
148
|
+
break;
|
|
149
|
+
case 'doctor':
|
|
150
|
+
doDoctor().catch((e) => {
|
|
151
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
152
|
+
console.log(C.warn(' Doctor failed: ' + msg));
|
|
153
|
+
process.exit(1);
|
|
154
|
+
});
|
|
155
|
+
break;
|
|
156
|
+
case 'context':
|
|
157
|
+
doContext();
|
|
158
|
+
break;
|
|
159
|
+
case 'mcp-config':
|
|
160
|
+
doMcpConfig();
|
|
161
|
+
break;
|
|
162
|
+
case 'replay':
|
|
163
|
+
doReplay();
|
|
164
|
+
break;
|
|
165
|
+
case 'continue':
|
|
166
|
+
doContinue();
|
|
167
|
+
break;
|
|
168
|
+
case 'bridge':
|
|
169
|
+
doBridge();
|
|
170
|
+
break;
|
|
171
|
+
case 'watch-editor':
|
|
172
|
+
doWatchEditor();
|
|
173
|
+
break;
|
|
174
|
+
case 'switch-back':
|
|
175
|
+
doSwitchBack();
|
|
176
|
+
break;
|
|
177
|
+
case 'branches':
|
|
178
|
+
doBranches();
|
|
179
|
+
break;
|
|
180
|
+
case 'lessons':
|
|
181
|
+
doLessons();
|
|
182
|
+
break;
|
|
183
|
+
case 'evolution':
|
|
184
|
+
doEvolution();
|
|
185
|
+
break;
|
|
186
|
+
case 'focus':
|
|
187
|
+
doFocus();
|
|
188
|
+
break;
|
|
189
|
+
case 'why':
|
|
190
|
+
doWhy();
|
|
191
|
+
break;
|
|
192
|
+
case 'repl':
|
|
193
|
+
case '-i':
|
|
194
|
+
case '--interactive':
|
|
195
|
+
doRepl();
|
|
196
|
+
break;
|
|
197
|
+
case 'help':
|
|
198
|
+
case '--help':
|
|
199
|
+
case '-h':
|
|
200
|
+
doHelp();
|
|
201
|
+
break;
|
|
202
|
+
default:
|
|
203
|
+
// If no command and TTY → open interactive REPL; else show status (safe default for scripts/automation)
|
|
204
|
+
if (!cmd && process.stdin.isTTY) {
|
|
205
|
+
doRepl();
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
doStatus();
|
|
209
|
+
}
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
// ─── cell start ─────────────────────────────────────────────────────────────
|
|
213
|
+
function doStart() {
|
|
214
|
+
const banner = figlet_1.default.textSync('CELL', { font: 'ANSI Shadow', horizontalLayout: 'fitted' });
|
|
215
|
+
console.log((0, gradient_string_1.default)(['#FF6B35', '#FFAB91'])(banner));
|
|
216
|
+
console.log(C.dim(' Starting everything...\n'));
|
|
217
|
+
// 0. First-run greeting
|
|
218
|
+
try {
|
|
219
|
+
const { firstRunGreeting } = require('../setup/first-run');
|
|
220
|
+
firstRunGreeting();
|
|
221
|
+
}
|
|
222
|
+
catch { }
|
|
223
|
+
// 1. Check if daemon is already running (cheap /health probe) — if so,
|
|
224
|
+
// skip restart and just print status. This makes `cell start` re-run safe.
|
|
225
|
+
const http = require('http');
|
|
226
|
+
const probeReq = http.request({
|
|
227
|
+
hostname: '127.0.0.1', port: 9876, path: '/health', method: 'GET', timeout: 1000,
|
|
228
|
+
}, (res) => {
|
|
229
|
+
if (res.statusCode === 200) {
|
|
230
|
+
let data = '';
|
|
231
|
+
res.on('data', (chunk) => { data += chunk ? chunk.toString() : ''; });
|
|
232
|
+
res.on('end', () => {
|
|
233
|
+
let up = 0;
|
|
234
|
+
try {
|
|
235
|
+
up = JSON.parse(data).uptimeSeconds || 0;
|
|
236
|
+
}
|
|
237
|
+
catch { }
|
|
238
|
+
const upH = Math.floor(up / 3600);
|
|
239
|
+
const upM = Math.floor((up % 3600) / 60);
|
|
240
|
+
const upStr = upH > 0 ? `${upH}h ${upM}m` : upM > 0 ? `${upM}m` : `${up}s`;
|
|
241
|
+
console.log(C.success(` Daemon: already running on port 9876 (uptime ${upStr})`));
|
|
242
|
+
printProjectStatusAndExit();
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
startDaemon();
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
probeReq.on('error', () => { startDaemon(); });
|
|
250
|
+
probeReq.on('timeout', () => { probeReq.destroy(); startDaemon(); });
|
|
251
|
+
probeReq.end();
|
|
252
|
+
}
|
|
253
|
+
function startDaemon() {
|
|
254
|
+
// 1. Kill any stale daemon (clean restart)
|
|
255
|
+
try {
|
|
256
|
+
const { stopDaemon } = require('../daemon/lifecycle');
|
|
257
|
+
stopDaemon();
|
|
258
|
+
// Wait for port to be released
|
|
259
|
+
const { execSync } = require('child_process');
|
|
260
|
+
execSync('timeout /t 1 /nobreak >nul 2>&1', { stdio: 'ignore' });
|
|
261
|
+
}
|
|
262
|
+
catch { }
|
|
263
|
+
try {
|
|
264
|
+
const fsMod = require('fs');
|
|
265
|
+
const osMod = require('os');
|
|
266
|
+
const pidFile = require('path').join(osMod.homedir(), '.fivo', 'cell', 'daemon.pid');
|
|
267
|
+
try {
|
|
268
|
+
fsMod.unlinkSync(pidFile);
|
|
269
|
+
}
|
|
270
|
+
catch { }
|
|
271
|
+
}
|
|
272
|
+
catch { }
|
|
273
|
+
// 2. Start daemon as detached background process
|
|
274
|
+
console.log(C.primary(' Starting daemon + MCP...'));
|
|
275
|
+
try {
|
|
276
|
+
const { spawn } = require('child_process');
|
|
277
|
+
const pathMod = require('path');
|
|
278
|
+
const fsMod = require('fs');
|
|
279
|
+
const osMod = require('os');
|
|
280
|
+
const serverPath = pathMod.join(__dirname, '..', 'daemon', 'server.js');
|
|
281
|
+
const logFile = pathMod.join(osMod.homedir(), '.fivo', 'cell', 'daemon.log');
|
|
282
|
+
fsMod.mkdirSync(pathMod.dirname(logFile), { recursive: true });
|
|
283
|
+
const out = fsMod.openSync(logFile, 'a');
|
|
284
|
+
const err = fsMod.openSync(logFile, 'a');
|
|
285
|
+
const child = spawn('node', [serverPath], {
|
|
286
|
+
detached: true,
|
|
287
|
+
stdio: ['ignore', out, err],
|
|
288
|
+
});
|
|
289
|
+
child.unref();
|
|
290
|
+
// Write PID
|
|
291
|
+
const pidFile = pathMod.join(osMod.homedir(), '.fivo', 'cell', 'daemon.pid');
|
|
292
|
+
fsMod.mkdirSync(pathMod.dirname(pidFile), { recursive: true });
|
|
293
|
+
fsMod.writeFileSync(pidFile, String(child.pid), 'utf-8');
|
|
294
|
+
console.log(C.success(` Daemon + MCP started (PID: ${child.pid})`));
|
|
295
|
+
console.log(C.dim(' Daemon + MCP: http://localhost:9876'));
|
|
296
|
+
console.log(C.dim(' MCP endpoint: POST http://localhost:9876/mcp'));
|
|
297
|
+
console.log();
|
|
298
|
+
// Give the daemon a moment to bind to the port, then print project status.
|
|
299
|
+
setTimeout(() => { printProjectStatusAndExit(); }, 500);
|
|
300
|
+
}
|
|
301
|
+
catch (e) {
|
|
302
|
+
console.log(C.warn(' Start failed: ' + String(e)));
|
|
303
|
+
process.exit(1);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
function printProjectStatusAndExit() {
|
|
307
|
+
try {
|
|
308
|
+
const { detectProject, checkScanState, checkWatchState, checkMcpState, isDaemonRunning } = require('../setup/setup');
|
|
309
|
+
const httpMod = require('http');
|
|
310
|
+
const project = detectProject(process.cwd());
|
|
311
|
+
const scan = checkScanState(process.cwd());
|
|
312
|
+
const watch = checkWatchState(project.name);
|
|
313
|
+
const mcp = checkMcpState(os.homedir());
|
|
314
|
+
console.log();
|
|
315
|
+
console.log(C.bold(' Project:'), C.num(project.name), C.dim(`(${project.source})`));
|
|
316
|
+
console.log();
|
|
317
|
+
console.log(` ${scan.done ? C.success('OK') : C.dim('--')} scan: ${scan.reason}`);
|
|
318
|
+
console.log(` ${watch.done ? C.success('OK') : C.dim('--')} watch: ${watch.reason}`);
|
|
319
|
+
console.log(` ${mcp.done === mcp.total ? C.success('OK') : C.dim('--')} mcp: ${mcp.done}/${mcp.total} IDEs wired${mcp.needsWrite.length > 0 ? C.warn(' (need: ' + mcp.needsWrite.join(', ') + ')') : ''}`);
|
|
320
|
+
console.log();
|
|
321
|
+
const allReady = scan.done && watch.done && mcp.done === mcp.total;
|
|
322
|
+
if (allReady) {
|
|
323
|
+
console.log(C.dim(' Cell is fully ready. Use @cell in your AI chat.'));
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
console.log(C.primary(' Run: cell setup (one-time, idempotent) to finish setup'));
|
|
327
|
+
}
|
|
328
|
+
console.log();
|
|
329
|
+
process.exit(0);
|
|
330
|
+
}
|
|
331
|
+
catch {
|
|
332
|
+
console.log(C.dim(' Next: cell scan (scan codebase + build layers)'));
|
|
333
|
+
console.log(C.dim(' Then: cell status'));
|
|
334
|
+
console.log();
|
|
335
|
+
process.exit(0);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
// ─── cell stop ──────────────────────────────────────────────────────────────
|
|
339
|
+
function doStop() {
|
|
340
|
+
console.log(C.dim(' Stopping Cell daemon...'));
|
|
341
|
+
try {
|
|
342
|
+
const { stopDaemon } = require('../daemon/lifecycle');
|
|
343
|
+
const result = stopDaemon();
|
|
344
|
+
console.log(result.success ? C.success(` ${result.message}`) : C.warn(` ${result.message}`));
|
|
345
|
+
}
|
|
346
|
+
catch (e) {
|
|
347
|
+
console.log(C.warn(' Stop failed: ' + String(e)));
|
|
348
|
+
}
|
|
349
|
+
console.log();
|
|
350
|
+
}
|
|
351
|
+
// ─── cell analyze ───────────────────────────────────────────────────────────
|
|
352
|
+
function doAnalyze() {
|
|
353
|
+
console.log();
|
|
354
|
+
console.log(C.bold(' Cell AI Analysis'));
|
|
355
|
+
console.log(C.dim(' ────────────────'));
|
|
356
|
+
console.log();
|
|
357
|
+
const sub = args[1] || '';
|
|
358
|
+
// ─── Save AI-generated insights ────────────────────────────────────
|
|
359
|
+
if (sub === '--save' && args[2]) {
|
|
360
|
+
const category = args[2];
|
|
361
|
+
console.log(C.primary(` Save AI insights for: ${category}`));
|
|
362
|
+
console.log(C.dim(' Paste the AI-generated response below (Ctrl+Z or Ctrl+D to finish):'));
|
|
363
|
+
console.log();
|
|
364
|
+
// Read from stdin
|
|
365
|
+
const chunks = [];
|
|
366
|
+
process.stdin.on('data', (chunk) => chunks.push(chunk));
|
|
367
|
+
process.stdin.on('end', () => {
|
|
368
|
+
const content = Buffer.concat(chunks).toString().trim();
|
|
369
|
+
if (content) {
|
|
370
|
+
const { saveAIInsight } = require('../../03-knowledge/decisions/ai-bridge');
|
|
371
|
+
saveAIInsight(project, category, content);
|
|
372
|
+
console.log(C.success(` Insights saved: ${category}`));
|
|
373
|
+
console.log(C.dim(` .cell/personal/insights/${category}.md`));
|
|
374
|
+
console.log();
|
|
375
|
+
process.exit(0);
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
console.log(C.warn(' No content provided.'));
|
|
379
|
+
console.log();
|
|
380
|
+
process.exit(1);
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
process.stdin.resume();
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
// ─── Show insights ─────────────────────────────────────────────────
|
|
387
|
+
if (sub === '--show') {
|
|
388
|
+
const { getAIInsights } = require('../../03-knowledge/decisions/ai-bridge');
|
|
389
|
+
const insights = getAIInsights(project);
|
|
390
|
+
if (insights.length === 0) {
|
|
391
|
+
console.log(C.dim(' No AI insights yet. Run: cell analyze'));
|
|
392
|
+
console.log();
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
for (const i of insights) {
|
|
396
|
+
console.log(C.bold(` ${i.category}`));
|
|
397
|
+
console.log(C.dim(` ${i.timestamp} | Source: ${i.source}`));
|
|
398
|
+
console.log(i.content.substring(0, 300));
|
|
399
|
+
console.log(C.dim(' ...'));
|
|
400
|
+
console.log();
|
|
401
|
+
}
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
// ─── Default: Generate prompts ─────────────────────────────────────
|
|
405
|
+
const { getAnalysisCommand } = require('../../03-knowledge/decisions/ai-bridge');
|
|
406
|
+
const { intro, prompts } = getAnalysisCommand(process.cwd());
|
|
407
|
+
console.log(C.dim(intro));
|
|
408
|
+
console.log();
|
|
409
|
+
for (const p of prompts) {
|
|
410
|
+
console.log(C.bold(` ━━━ ${p.title} ━━━`));
|
|
411
|
+
console.log(C.dim(` Tokens: ~${p.tokensEstimate} | Category: ${p.category}`));
|
|
412
|
+
console.log();
|
|
413
|
+
const promptLines = p.prompt.split('\n');
|
|
414
|
+
for (const line of promptLines.slice(0, 10)) {
|
|
415
|
+
console.log(` ${C.dim('│')} ${line}`);
|
|
416
|
+
}
|
|
417
|
+
if (promptLines.length > 10) {
|
|
418
|
+
console.log(` ${C.dim('│')} ... (${promptLines.length - 10} more lines)`);
|
|
419
|
+
}
|
|
420
|
+
console.log();
|
|
421
|
+
console.log(C.primary(` → Copy to AI tool, get answer, then: cell analyze --save ${p.category}`));
|
|
422
|
+
console.log();
|
|
423
|
+
}
|
|
424
|
+
console.log(C.dim(' cell analyze --show View saved insights'));
|
|
425
|
+
console.log();
|
|
426
|
+
}
|
|
427
|
+
// ─── cell scan ───────────────────────────────────────────────────────────────
|
|
428
|
+
function doScan() {
|
|
429
|
+
const banner = figlet_1.default.textSync('CELL', { font: 'ANSI Shadow', horizontalLayout: 'fitted' });
|
|
430
|
+
console.log((0, gradient_string_1.default)(['#FF6B35', '#FFAB91'])(banner));
|
|
431
|
+
console.log(C.dim(' Scanning codebase + building all layers...\n'));
|
|
432
|
+
// ─── Flag parsing ─────────────────────────────────────────────────────
|
|
433
|
+
// --no-rules → skip writing AGENTS.md and .cursorrules to project root
|
|
434
|
+
// --force-rules → overwrite existing AGENTS.md/.cursorrules (otherwise keep user edits)
|
|
435
|
+
const noRules = args.includes('--no-rules');
|
|
436
|
+
const forceRules = args.includes('--force-rules');
|
|
437
|
+
// First positional arg (after `scan`) is an optional explicit path.
|
|
438
|
+
// Default to current working directory (process.cwd()) — never to
|
|
439
|
+
// path.basename(cwd) which is a *name*, not a directory path.
|
|
440
|
+
const scanPathArg = args.find((a, i) => i >= 1 && !a.startsWith('--'));
|
|
441
|
+
const scanCwd = scanPathArg ? path.resolve(scanPathArg) : process.cwd();
|
|
442
|
+
let scanProject = path.basename(scanCwd);
|
|
443
|
+
try {
|
|
444
|
+
const { detectProject } = require('../setup/setup');
|
|
445
|
+
scanProject = detectProject(scanCwd).name;
|
|
446
|
+
}
|
|
447
|
+
catch { }
|
|
448
|
+
try {
|
|
449
|
+
const { scanCodebase } = require('../../02-scanner/blindspots/code-scanner');
|
|
450
|
+
const result = scanCodebase(scanCwd, scanProject);
|
|
451
|
+
console.log(C.success(` [1/2] Scanned ${result.filesScanned} files, ${result.totalLines.toLocaleString()} lines`));
|
|
452
|
+
(0, layers_1.populateAllLayers)({
|
|
453
|
+
profile: result.profile,
|
|
454
|
+
patterns: result.patterns,
|
|
455
|
+
project: scanProject,
|
|
456
|
+
});
|
|
457
|
+
console.log(C.success(' [2/2] Populated all layers:'));
|
|
458
|
+
console.log(C.dim(' .cell/personal/ — profile, style, errors, decisions'));
|
|
459
|
+
console.log(C.dim(' .cell/team/ — shared patterns, blind spots'));
|
|
460
|
+
console.log(C.dim(' .cell/community/ — community patterns, trends'));
|
|
461
|
+
// ─── AI rules files (AGENTS.md, .cursorrules) ─────────────────────────
|
|
462
|
+
if (!noRules) {
|
|
463
|
+
const { writeCellRules } = require('../../01-context/context/agents-md');
|
|
464
|
+
const rulesResult = writeCellRules(scanCwd, { overwrite: forceRules });
|
|
465
|
+
const lines = [];
|
|
466
|
+
if (rulesResult.agentsMd === 'written')
|
|
467
|
+
lines.push('AGENTS.md');
|
|
468
|
+
if (rulesResult.cursorRules === 'written')
|
|
469
|
+
lines.push('.cursorrules');
|
|
470
|
+
if (lines.length > 0) {
|
|
471
|
+
console.log(C.success(` [3/3] Wrote AI rules: ${lines.join(', ')} (idempotent — kept existing files)`));
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
console.log(C.dim(' [3/3] AI rules: AGENTS.md + .cursorrules already present (kept as-is)'));
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
console.log(C.dim(' [3/3] AI rules: skipped (--no-rules)'));
|
|
479
|
+
}
|
|
480
|
+
// ─── Top 5 fixes ────────────────────────────────────────────────────
|
|
481
|
+
try {
|
|
482
|
+
const { scanDirectoryForBlindSpots, getTopFixes, getCategorySummary } = require('../../../core/enhanced-blind-spots');
|
|
483
|
+
const spots = scanDirectoryForBlindSpots(scanCwd, 200);
|
|
484
|
+
const topFixes = getTopFixes(spots, 5);
|
|
485
|
+
if (topFixes.length > 0) {
|
|
486
|
+
console.log();
|
|
487
|
+
console.log(C.bold(' Top 5 fixes first:'));
|
|
488
|
+
for (let i = 0; i < topFixes.length; i++) {
|
|
489
|
+
const s = topFixes[i];
|
|
490
|
+
console.log(` ${C.num(String(i + 1))}. ${s.message}`);
|
|
491
|
+
console.log(` ${C.dim(s.filePath + ':' + s.lineNumber)}`);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
const catSummary = getCategorySummary(spots);
|
|
495
|
+
if (catSummary.length > 0) {
|
|
496
|
+
console.log();
|
|
497
|
+
console.log(C.dim(' Category breakdown:'));
|
|
498
|
+
for (const c of catSummary.slice(0, 6)) {
|
|
499
|
+
console.log(C.dim(` ${c.category}: ${c.count} (${c.topSeverity})`));
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
catch { }
|
|
504
|
+
console.log();
|
|
505
|
+
console.log(C.dim(' Run: cell status'));
|
|
506
|
+
console.log();
|
|
507
|
+
try {
|
|
508
|
+
const { markFirstScan } = require('../setup/cell-state');
|
|
509
|
+
markFirstScan();
|
|
510
|
+
}
|
|
511
|
+
catch { }
|
|
512
|
+
try {
|
|
513
|
+
const { captureCurrentBranchSnapshot } = require('../../03-knowledge/decisions/branch-snapshot');
|
|
514
|
+
captureCurrentBranchSnapshot(scanProject, scanCwd);
|
|
515
|
+
}
|
|
516
|
+
catch { }
|
|
517
|
+
}
|
|
518
|
+
catch (e) {
|
|
519
|
+
console.log(C.warn(' Scan failed: ' + String(e)));
|
|
520
|
+
console.log();
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
// ─── cell setup (idempotent one-time project setup) ─────────────────────────
|
|
524
|
+
/**
|
|
525
|
+
* One-command setup for a new project. Runs scan + watcher + MCP config
|
|
526
|
+
* with full idempotency — safe to re-run any number of times. Skips steps
|
|
527
|
+
* that are already done and only does the missing pieces.
|
|
528
|
+
*
|
|
529
|
+
* Flags:
|
|
530
|
+
* --project <name> Override project name (default: package.json name or folder basename)
|
|
531
|
+
* --no-rules Skip writing AGENTS.md / .cursorrules
|
|
532
|
+
* --force-rules Overwrite existing AGENTS.md / .cursorrules
|
|
533
|
+
* --skip-scan Don't run scan
|
|
534
|
+
* --skip-watch Don't start watcher
|
|
535
|
+
* --skip-mcp Don't write MCP configs
|
|
536
|
+
* --dir <path> Watch dir (default: cwd)
|
|
537
|
+
* --dry-run Print what would happen, don't change anything
|
|
538
|
+
*/
|
|
539
|
+
async function doSetup() {
|
|
540
|
+
const banner = figlet_1.default.textSync('CELL', { font: 'ANSI Shadow', horizontalLayout: 'fitted' });
|
|
541
|
+
console.log((0, gradient_string_1.default)(['#FF6B35', '#FFAB91'])(banner));
|
|
542
|
+
console.log(C.dim(' Setting up project (idempotent)...\n'));
|
|
543
|
+
// ─── Flag parsing ─────────────────────────────────────────────────────
|
|
544
|
+
const noRules = args.includes('--no-rules');
|
|
545
|
+
const forceRules = args.includes('--force-rules');
|
|
546
|
+
const skipScan = args.includes('--skip-scan');
|
|
547
|
+
const skipWatch = args.includes('--skip-watch');
|
|
548
|
+
const skipMcp = args.includes('--skip-mcp');
|
|
549
|
+
const dryRun = args.includes('--dry-run');
|
|
550
|
+
const projectIdx = args.indexOf('--project');
|
|
551
|
+
const projectName = projectIdx > 0 ? args[projectIdx + 1] : undefined;
|
|
552
|
+
const dirIdx = args.indexOf('--dir');
|
|
553
|
+
const dir = dirIdx > 0 ? args[dirIdx + 1] : undefined;
|
|
554
|
+
try {
|
|
555
|
+
const { runSetup, detectProject, checkScanState, checkWatchState, checkMcpState, isDaemonRunning, } = require('../setup/setup');
|
|
556
|
+
const cwd = process.cwd();
|
|
557
|
+
const project = detectProject(cwd, projectName);
|
|
558
|
+
console.log(C.bold(` Project: ${C.num(project.name)}`));
|
|
559
|
+
console.log(C.dim(` Source: ${project.source}${project.packageJsonPath ? ' (' + project.packageJsonPath + ')' : ''}`));
|
|
560
|
+
console.log(C.dim(` Cwd: ${cwd}`));
|
|
561
|
+
if (dryRun)
|
|
562
|
+
console.log(C.warn(' Mode: DRY RUN (no changes will be made)'));
|
|
563
|
+
console.log();
|
|
564
|
+
// ─── Daemon check ────────────────────────────────────────────────────
|
|
565
|
+
const daemonUp = await isDaemonRunning();
|
|
566
|
+
if (daemonUp) {
|
|
567
|
+
console.log(C.success(' [daemon] running on http://localhost:9876'));
|
|
568
|
+
}
|
|
569
|
+
else {
|
|
570
|
+
console.log(C.warn(' [daemon] not running — watcher will be skipped'));
|
|
571
|
+
console.log(C.dim(' run `cell start` to bring it up, then re-run `cell setup`'));
|
|
572
|
+
}
|
|
573
|
+
console.log();
|
|
574
|
+
// ─── Pre-flight state report ────────────────────────────────────────
|
|
575
|
+
if (!dryRun) {
|
|
576
|
+
const scan = checkScanState(cwd);
|
|
577
|
+
const watch = daemonUp ? checkWatchState(project.name) : { done: false, reason: 'daemon not running' };
|
|
578
|
+
const mcp = checkMcpState(os.homedir());
|
|
579
|
+
console.log(C.bold(' Pre-flight:'));
|
|
580
|
+
console.log(` scan: ${scan.done ? C.success('done') : C.dim('missing')} (${scan.reason})`);
|
|
581
|
+
console.log(` watch: ${watch.done ? C.success('active') : C.dim('inactive')} (${watch.reason})`);
|
|
582
|
+
console.log(` mcp: ${mcp.done}/${mcp.total} IDEs wired${mcp.needsWrite.length > 0 ? C.warn(' (need: ' + mcp.needsWrite.join(', ') + ')') : ''}`);
|
|
583
|
+
console.log();
|
|
584
|
+
const allDone = scan.done && watch.done && mcp.done === mcp.total;
|
|
585
|
+
if (allDone) {
|
|
586
|
+
console.log(C.success(' Already fully set up — nothing to do.'));
|
|
587
|
+
console.log(C.dim(' Tip: re-run anytime; it is safe and idempotent.'));
|
|
588
|
+
console.log();
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
// ─── Run setup ───────────────────────────────────────────────────────
|
|
593
|
+
const start = Date.now();
|
|
594
|
+
const result = await runSetup({
|
|
595
|
+
cwd,
|
|
596
|
+
homedir: os.homedir(),
|
|
597
|
+
noRules,
|
|
598
|
+
forceRules,
|
|
599
|
+
projectName,
|
|
600
|
+
skipScan,
|
|
601
|
+
skipWatch: skipWatch || !daemonUp,
|
|
602
|
+
skipMcp,
|
|
603
|
+
dir,
|
|
604
|
+
dryRun,
|
|
605
|
+
});
|
|
606
|
+
const ms = Date.now() - start;
|
|
607
|
+
// ─── Result summary ─────────────────────────────────────────────────
|
|
608
|
+
console.log(C.bold(' Result:'));
|
|
609
|
+
console.log(` ${result.scan.done ? C.success('OK') : C.warn('FAIL')} scan: ${result.scan.reason}`);
|
|
610
|
+
console.log(` ${result.watch.done ? C.success('OK') : C.warn('FAIL')} watch: ${result.watch.reason}`);
|
|
611
|
+
const mcpOk = result.mcp.done === result.mcp.total;
|
|
612
|
+
console.log(` ${mcpOk ? C.success('OK') : C.warn('PARTIAL')} mcp: ${result.mcp.done}/${result.mcp.total} IDEs wired${result.mcp.written.length > 0 ? ' (' + result.mcp.written.length + ' just written)' : ''}`);
|
|
613
|
+
console.log();
|
|
614
|
+
if (result.warnings.length > 0) {
|
|
615
|
+
console.log(C.warn(' Warnings:'));
|
|
616
|
+
for (const w of result.warnings)
|
|
617
|
+
console.log(C.warn(` ! ${w}`));
|
|
618
|
+
console.log();
|
|
619
|
+
}
|
|
620
|
+
if (result.errors.length > 0) {
|
|
621
|
+
console.log(C.warn(' Errors:'));
|
|
622
|
+
for (const e of result.errors)
|
|
623
|
+
console.log(C.warn(` x ${e}`));
|
|
624
|
+
console.log();
|
|
625
|
+
}
|
|
626
|
+
// ─── Final verdict ──────────────────────────────────────────────────
|
|
627
|
+
const allGood = result.scan.done && result.watch.done && mcpOk && result.errors.length === 0;
|
|
628
|
+
if (allGood) {
|
|
629
|
+
console.log(C.success(` Setup complete in ${ms}ms. Cell is ready.`));
|
|
630
|
+
try {
|
|
631
|
+
const { markSetupCompleted } = require('../setup/cell-state');
|
|
632
|
+
markSetupCompleted();
|
|
633
|
+
}
|
|
634
|
+
catch { }
|
|
635
|
+
}
|
|
636
|
+
else {
|
|
637
|
+
console.log(C.warn(` Setup finished in ${ms}ms with warnings (see above).`));
|
|
638
|
+
}
|
|
639
|
+
console.log();
|
|
640
|
+
console.log(C.bold(' Next commands:'));
|
|
641
|
+
console.log(` ${C.num('1.')} ${C.primary('cell context')} See what Cell knows about your project`);
|
|
642
|
+
console.log(` ${C.num('2.')} ${C.primary('cell blindspots --top')} See your top fixes`);
|
|
643
|
+
console.log(` ${C.primary('3.')} ${C.primary('cell bridge start')} Connect your IDE`);
|
|
644
|
+
console.log(` ${C.num('4.')} ${C.primary('cell continue')} Resume your last session`);
|
|
645
|
+
console.log();
|
|
646
|
+
console.log(C.dim(' Run cell doctor anytime to check health.'));
|
|
647
|
+
console.log();
|
|
648
|
+
}
|
|
649
|
+
catch (e) {
|
|
650
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
651
|
+
console.log(C.warn(' Setup failed: ' + msg));
|
|
652
|
+
console.log();
|
|
653
|
+
}
|
|
654
|
+
process.exit(0);
|
|
655
|
+
}
|
|
656
|
+
// ─── cell status ────────────────────────────────────────────────────────────
|
|
657
|
+
function semiLabel(s) {
|
|
658
|
+
if (s === 'with semicolons' || s === 'always')
|
|
659
|
+
return 'always';
|
|
660
|
+
if (s === 'no semicolons' || s === 'never')
|
|
661
|
+
return 'never';
|
|
662
|
+
if (s === 'mixed')
|
|
663
|
+
return 'mixed';
|
|
664
|
+
return s;
|
|
665
|
+
}
|
|
666
|
+
// ─── cell --version / -v / version ───────────────────────────────────────────
|
|
667
|
+
function doVersion() {
|
|
668
|
+
const pkg = require('../../../../package.json');
|
|
669
|
+
console.log(`${C.primary('cell')} v${C.num(pkg.version)}`);
|
|
670
|
+
console.log(C.dim(` ${pkg.description}`));
|
|
671
|
+
console.log();
|
|
672
|
+
// Live info that's useful at a glance
|
|
673
|
+
try {
|
|
674
|
+
const http = require('http');
|
|
675
|
+
http.get('http://localhost:9876/health', (res) => {
|
|
676
|
+
let data = '';
|
|
677
|
+
res.on('data', (c) => { data += c || ''; });
|
|
678
|
+
res.on('end', () => {
|
|
679
|
+
const live = res.statusCode === 200 ? C.success('running') : C.warn(`status ${res.statusCode}`);
|
|
680
|
+
console.log(` Daemon: ${live} on port 9876`);
|
|
681
|
+
console.log(` Tools: 67 MCP tools registered`);
|
|
682
|
+
console.log(` License: Apache-2.0`);
|
|
683
|
+
console.log();
|
|
684
|
+
});
|
|
685
|
+
}).on('error', () => {
|
|
686
|
+
console.log(` Daemon: ${C.warn('not running')} — start with: cell start`);
|
|
687
|
+
console.log(` Tools: 67 MCP tools (ready when daemon starts)`);
|
|
688
|
+
console.log(` License: Apache-2.0`);
|
|
689
|
+
console.log();
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
catch { }
|
|
693
|
+
}
|
|
694
|
+
function doStatus() {
|
|
695
|
+
// ─── Flag passthroughs (Pre-Launch Test 1 + Test 3) ────────────────────
|
|
696
|
+
// Allow `cell status --session` and `cell status --decisions` as
|
|
697
|
+
// documented in the pre-launch test suite. The dedicated `cell session`
|
|
698
|
+
// and `cell decisions` top-level commands still work.
|
|
699
|
+
if (args[1] === '--session') {
|
|
700
|
+
doSession();
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
if (args[1] === '--decisions') {
|
|
704
|
+
doDecisions();
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
const banner = figlet_1.default.textSync('CELL', { font: 'ANSI Shadow', horizontalLayout: 'fitted' });
|
|
708
|
+
console.log((0, gradient_string_1.default)(['#FF6B35', '#FFAB91'])(banner));
|
|
709
|
+
console.log();
|
|
710
|
+
// Check daemon
|
|
711
|
+
const http = require('http');
|
|
712
|
+
try {
|
|
713
|
+
http.get('http://localhost:9876/health', (res) => {
|
|
714
|
+
let data = '';
|
|
715
|
+
res.on('data', (c) => data += c);
|
|
716
|
+
res.on('end', () => {
|
|
717
|
+
console.log(C.success(' Daemon: Running'));
|
|
718
|
+
showProjectStatus();
|
|
719
|
+
});
|
|
720
|
+
}).on('error', () => {
|
|
721
|
+
console.log(C.warn(' Daemon: Not running (run: cell start)'));
|
|
722
|
+
showProjectStatus();
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
catch {
|
|
726
|
+
showProjectStatus();
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
function showProjectStatus() {
|
|
730
|
+
const { getDeveloperProfile } = require('../../02-scanner/blindspots/code-scanner');
|
|
731
|
+
const profile = getDeveloperProfile(project);
|
|
732
|
+
if (!profile) {
|
|
733
|
+
console.log(C.warn(`\n No profile for "${project}". Run: cell start`));
|
|
734
|
+
console.log();
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
console.log();
|
|
738
|
+
console.log(C.bold(` Project: ${project}`));
|
|
739
|
+
// ─── Personal Layer ──────────────────────────────────────────────────────
|
|
740
|
+
console.log();
|
|
741
|
+
console.log(C.bold(' 📂 Personal Layer'));
|
|
742
|
+
console.log(C.dim(' ─────────────────'));
|
|
743
|
+
// Stack fingerprint (from stack-detector)
|
|
744
|
+
try {
|
|
745
|
+
const { detectProjectDNA } = require('../../02-scanner/stack/stack-detector');
|
|
746
|
+
const dna = detectProjectDNA(process.cwd());
|
|
747
|
+
if (dna && dna.stack.trustScore > 0) {
|
|
748
|
+
const s = dna.stack;
|
|
749
|
+
console.log(` Stack: ${C.num(s.languages?.join(', ') || '')} · ${s.frontend !== 'none' ? s.frontend + ' + ' : ''}${s.backend}${s.database[0] !== 'none' ? ' · ' + s.database.join(', ') : ''}`);
|
|
750
|
+
console.log(` ${s.orm !== 'none' ? 'ORM: ' + s.orm + ' · ' : ''}Test: ${s.testing.join(', ')}${s.validation !== 'none' ? ' · Validation: ' + s.validation : ''}`);
|
|
751
|
+
console.log(` Arch: ${dna.architecture.type} (${dna.architecture.confidence}), Entry: ${dna.architecture.entryPoints.join(', ')}`);
|
|
752
|
+
console.log(` Style: ${C.num(profile.quoteStyle)} quotes, ${C.num(semiLabel(profile.semicolonStyle))} semis, ${C.num(profile.indentStyle)}`);
|
|
753
|
+
}
|
|
754
|
+
else {
|
|
755
|
+
console.log(` Style: ${C.num(profile.quoteStyle)} quotes, ${C.num(semiLabel(profile.semicolonStyle))} semis, ${C.num(profile.indentStyle)}`);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
catch {
|
|
759
|
+
console.log(` Style: ${C.num(profile.quoteStyle)} quotes, ${C.num(semiLabel(profile.semicolonStyle))} semis, ${C.num(profile.indentStyle)}`);
|
|
760
|
+
}
|
|
761
|
+
console.log(` Code: ${C.num(profile.functionStyle)} functions, ${C.num(profile.asyncStyle)}, ${C.num(profile.errorHandling)} errors`);
|
|
762
|
+
if (profile.strengths.length) {
|
|
763
|
+
for (const s of profile.strengths)
|
|
764
|
+
console.log(` ${C.success('+')} ${s}`);
|
|
765
|
+
}
|
|
766
|
+
if (profile.improvements.length) {
|
|
767
|
+
for (const i of profile.improvements)
|
|
768
|
+
console.log(` ${C.warn('!')} ${i}`);
|
|
769
|
+
}
|
|
770
|
+
// Show .cell/personal/ files
|
|
771
|
+
const personalDir = path.join(layers_1.CELL_DIR, 'personal');
|
|
772
|
+
if (fs.existsSync(personalDir)) {
|
|
773
|
+
const files = fs.readdirSync(personalDir);
|
|
774
|
+
console.log(C.dim(` Files: ${files.join(', ')}`));
|
|
775
|
+
}
|
|
776
|
+
// Behavioral data
|
|
777
|
+
try {
|
|
778
|
+
const { getBehaviorSummary } = require('../../03-knowledge/decisions/behavioral-tracker');
|
|
779
|
+
const b = getBehaviorSummary(project);
|
|
780
|
+
if (b.totalErrors > 0 || b.totalDecisions > 0 || b.currentContext || b.stuckIssues.length > 0) {
|
|
781
|
+
console.log(C.bold(' Behavior:'));
|
|
782
|
+
if (b.totalErrors > 0)
|
|
783
|
+
console.log(` Errors: ${b.totalErrors} logged`);
|
|
784
|
+
if (b.totalDecisions > 0)
|
|
785
|
+
console.log(` Decisions: ${b.totalDecisions} logged`);
|
|
786
|
+
if (b.currentContext)
|
|
787
|
+
console.log(` Working on: ${b.currentContext.task}`);
|
|
788
|
+
if (b.stuckIssues.length > 0)
|
|
789
|
+
console.log(` Stuck: ${b.stuckIssues.length} issues`);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
catch { }
|
|
793
|
+
// ─── Git Intelligence ────────────────────────────────────────────────────
|
|
794
|
+
try {
|
|
795
|
+
const { buildDeveloperIntelligence } = require('../../02-scanner/profile/developer-intelligence');
|
|
796
|
+
const gitIntel = buildDeveloperIntelligence(process.cwd());
|
|
797
|
+
if (gitIntel) {
|
|
798
|
+
console.log();
|
|
799
|
+
console.log(C.bold(' 🧠 Git Intelligence'));
|
|
800
|
+
console.log(C.dim(' ──────────────────'));
|
|
801
|
+
console.log(` Score: ${C.num(String(gitIntel.behavioralScore))}/100`);
|
|
802
|
+
if (gitIntel.timeSummary)
|
|
803
|
+
console.log(C.dim(` ${gitIntel.timeSummary}`));
|
|
804
|
+
if (gitIntel.journeySummary)
|
|
805
|
+
console.log(C.dim(` ${gitIntel.journeySummary}`));
|
|
806
|
+
if (gitIntel.topBlindSpots.length > 0) {
|
|
807
|
+
console.log(C.bold(' Top Blind Spots:'));
|
|
808
|
+
for (const bs of gitIntel.topBlindSpots.slice(0, 3)) {
|
|
809
|
+
console.log(` ${C.warn('!')} ${bs}`);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
if (gitIntel.topMistakes.length > 0) {
|
|
813
|
+
console.log(C.bold(' Repeat Mistakes:'));
|
|
814
|
+
for (const m of gitIntel.topMistakes.slice(0, 3)) {
|
|
815
|
+
console.log(` ${C.warn('↻')} ${m}`);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
if (gitIntel.topStrengths.length > 0) {
|
|
819
|
+
for (const s of gitIntel.topStrengths.slice(0, 3)) {
|
|
820
|
+
console.log(` ${C.success('+')} ${s}`);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
catch { }
|
|
826
|
+
// ─── Predictions ─────────────────────────────────────────────────────────
|
|
827
|
+
try {
|
|
828
|
+
const { getQuickWarnings } = require('../../03-knowledge/decisions/predictive-engine');
|
|
829
|
+
const warnings = getQuickWarnings(project);
|
|
830
|
+
if (warnings.length > 0) {
|
|
831
|
+
console.log();
|
|
832
|
+
console.log(C.bold(' 🔮 Predictions'));
|
|
833
|
+
console.log(C.dim(' ──────────────'));
|
|
834
|
+
for (const w of warnings) {
|
|
835
|
+
console.log(` ${w}`);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
catch { }
|
|
840
|
+
// ─── Team Layer ──────────────────────────────────────────────────────────
|
|
841
|
+
console.log();
|
|
842
|
+
console.log(C.bold(' 👥 Team Layer'));
|
|
843
|
+
console.log(C.dim(' ─────────────'));
|
|
844
|
+
const teamData = (0, layers_1.getTeamMembers)();
|
|
845
|
+
if (teamData && teamData.members && teamData.members.length > 0) {
|
|
846
|
+
for (const m of teamData.members) {
|
|
847
|
+
console.log(` ${C.success('•')} ${m.name} — ${m.role}`);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
else {
|
|
851
|
+
console.log(C.dim(' No team members. Add: cell team add <name>'));
|
|
852
|
+
}
|
|
853
|
+
const teamPatterns = (0, layers_1.getTeamPatterns)();
|
|
854
|
+
if (teamPatterns && teamPatterns.patterns && teamPatterns.patterns.length > 0) {
|
|
855
|
+
console.log(C.dim(` Shared patterns: ${teamPatterns.patterns.length}`));
|
|
856
|
+
}
|
|
857
|
+
const teamBlinds = (0, layers_1.getTeamBlindSpots)();
|
|
858
|
+
if (teamBlinds && teamBlinds.blindSpots && teamBlinds.blindSpots.length > 0) {
|
|
859
|
+
console.log(C.warn(` Blind spots: ${teamBlinds.blindSpots.length}`));
|
|
860
|
+
}
|
|
861
|
+
// ─── Community Layer ─────────────────────────────────────────────────────
|
|
862
|
+
console.log();
|
|
863
|
+
console.log(C.bold(' 🌐 Community Layer'));
|
|
864
|
+
console.log(C.dim(' ──────────────────'));
|
|
865
|
+
const commPatterns = (0, layers_1.getCommunityPatterns)();
|
|
866
|
+
if (commPatterns && commPatterns.patterns && commPatterns.patterns.length > 0) {
|
|
867
|
+
console.log(C.dim(` Patterns shared: ${commPatterns.patterns.length}`));
|
|
868
|
+
}
|
|
869
|
+
else {
|
|
870
|
+
console.log(C.dim(' No community patterns yet. Run: cell community'));
|
|
871
|
+
}
|
|
872
|
+
const commTrends = (0, layers_1.getCommunityTrends)();
|
|
873
|
+
if (commTrends && commTrends.trends && commTrends.trends.length > 0) {
|
|
874
|
+
console.log(C.dim(` Trends: ${commTrends.trends.length}`));
|
|
875
|
+
}
|
|
876
|
+
const commRank = (0, layers_1.getCommunityRankings)();
|
|
877
|
+
if (commRank && commRank.rankings && commRank.rankings.length > 0) {
|
|
878
|
+
console.log(C.dim(` Rankings: ${commRank.rankings.length}`));
|
|
879
|
+
}
|
|
880
|
+
console.log();
|
|
881
|
+
}
|
|
882
|
+
// ─── cell status --session (Pre-Launch Test 1) ──────────────────────────────
|
|
883
|
+
function doSession() {
|
|
884
|
+
console.log();
|
|
885
|
+
console.log(C.bold(' Cell Session — Last Activity'));
|
|
886
|
+
console.log(C.dim(' ───────────────────────────────'));
|
|
887
|
+
console.log();
|
|
888
|
+
try {
|
|
889
|
+
const { getLastTouchedFile, getPatternCounts, getBehaviorSummary } = require('../../03-knowledge/decisions/behavioral-tracker');
|
|
890
|
+
const last = getLastTouchedFile(project);
|
|
891
|
+
const patterns = getPatternCounts(project);
|
|
892
|
+
const behavior = getBehaviorSummary(project);
|
|
893
|
+
if (last) {
|
|
894
|
+
const ago = formatTimeAgo(parseSqliteUtc(last.lastTouched));
|
|
895
|
+
console.log(` Last file: ${C.num(last.file)}`);
|
|
896
|
+
console.log(` Time: ${ago} (${last.touchCount} touch${last.touchCount === 1 ? '' : 'es'})`);
|
|
897
|
+
}
|
|
898
|
+
else {
|
|
899
|
+
console.log(C.dim(' Last file: (none yet — save a file to start tracking)'));
|
|
900
|
+
}
|
|
901
|
+
console.log(` Patterns: ${C.num(String(patterns.total))} detected`);
|
|
902
|
+
if (Object.keys(patterns.byCategory).length > 0) {
|
|
903
|
+
const catStr = Object.entries(patterns.byCategory)
|
|
904
|
+
.slice(0, 5)
|
|
905
|
+
.map(([cat, n]) => `${cat}=${n}`)
|
|
906
|
+
.join(', ');
|
|
907
|
+
console.log(C.dim(` ${catStr}`));
|
|
908
|
+
}
|
|
909
|
+
if (behavior.currentContext) {
|
|
910
|
+
console.log(` Current task: ${C.num(behavior.currentContext.task)}`);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
catch (err) {
|
|
914
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
915
|
+
console.log(C.warn(` Session lookup failed: ${msg}`));
|
|
916
|
+
}
|
|
917
|
+
console.log();
|
|
918
|
+
}
|
|
919
|
+
// ─── cell status --decisions (Pre-Launch Test 3) ────────────────────────────
|
|
920
|
+
function doDecisions() {
|
|
921
|
+
console.log();
|
|
922
|
+
console.log(C.bold(' Cell Decisions — Recent Activity'));
|
|
923
|
+
console.log(C.dim(' ─────────────────────────────────'));
|
|
924
|
+
console.log();
|
|
925
|
+
try {
|
|
926
|
+
const { getRecentDecisionsWithAgo, getBehaviorSummary } = require('../../03-knowledge/decisions/behavioral-tracker');
|
|
927
|
+
const decisions = getRecentDecisionsWithAgo(project, 5);
|
|
928
|
+
const behavior = getBehaviorSummary(project);
|
|
929
|
+
if (decisions.length === 0) {
|
|
930
|
+
console.log(C.dim(' No decisions logged yet.'));
|
|
931
|
+
console.log(C.dim(' Decisions are auto-logged when AI suggestions are accepted/rejected in your IDE.'));
|
|
932
|
+
}
|
|
933
|
+
else {
|
|
934
|
+
for (const d of decisions) {
|
|
935
|
+
const verdict = d.worked ? C.success('Accepted') : C.warn('Rejected');
|
|
936
|
+
console.log(` ${verdict} ${d.decision}`);
|
|
937
|
+
console.log(C.dim(` ${d.ago}${d.file ? ' · ' + d.file : ''}`));
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
console.log();
|
|
941
|
+
console.log(C.dim(` Total: ${behavior.totalDecisions} decision${behavior.totalDecisions === 1 ? '' : 's'} logged`));
|
|
942
|
+
}
|
|
943
|
+
catch (err) {
|
|
944
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
945
|
+
console.log(C.warn(` Decisions lookup failed: ${msg}`));
|
|
946
|
+
}
|
|
947
|
+
console.log();
|
|
948
|
+
}
|
|
949
|
+
function formatTimeAgo(ts) {
|
|
950
|
+
const diff = Date.now() - ts;
|
|
951
|
+
if (diff < 0)
|
|
952
|
+
return 'just now';
|
|
953
|
+
const sec = Math.floor(diff / 1000);
|
|
954
|
+
if (sec < 60)
|
|
955
|
+
return `${sec} second${sec === 1 ? '' : 's'} ago`;
|
|
956
|
+
const min = Math.floor(sec / 60);
|
|
957
|
+
if (min < 60)
|
|
958
|
+
return `${min} minute${min === 1 ? '' : 's'} ago`;
|
|
959
|
+
const hr = Math.floor(min / 60);
|
|
960
|
+
if (hr < 24)
|
|
961
|
+
return `${hr} hour${hr === 1 ? '' : 's'} ago`;
|
|
962
|
+
const day = Math.floor(hr / 24);
|
|
963
|
+
if (day < 30)
|
|
964
|
+
return `${day} day${day === 1 ? '' : 's'} ago`;
|
|
965
|
+
const month = Math.floor(day / 30);
|
|
966
|
+
return `${month} month${month === 1 ? '' : 's'} ago`;
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Parse a SQLite `datetime('now')` string into a JS millisecond timestamp.
|
|
970
|
+
* SQLite's datetime() returns UTC time as a string like "2026-06-05 09:20:26"
|
|
971
|
+
* (no timezone marker). JS `new Date(str)` would treat this as LOCAL time,
|
|
972
|
+
* which causes a 5h30m offset in IST. We force UTC interpretation by
|
|
973
|
+
* appending "Z" or by replacing the space with "T" + "Z".
|
|
974
|
+
*/
|
|
975
|
+
function parseSqliteUtc(s) {
|
|
976
|
+
if (!s)
|
|
977
|
+
return 0;
|
|
978
|
+
// Already has TZ marker
|
|
979
|
+
if (s.endsWith('Z') || /[+-]\d{2}:?\d{2}$/.test(s)) {
|
|
980
|
+
return new Date(s).getTime();
|
|
981
|
+
}
|
|
982
|
+
// Replace space separator with T, append Z
|
|
983
|
+
return new Date(s.replace(' ', 'T') + 'Z').getTime();
|
|
984
|
+
}
|
|
985
|
+
// ─── cell team ──────────────────────────────────────────────────────────────
|
|
986
|
+
function doTeam() {
|
|
987
|
+
console.log();
|
|
988
|
+
console.log(C.bold(' Cell Team'));
|
|
989
|
+
console.log(C.dim(' ─────────'));
|
|
990
|
+
console.log();
|
|
991
|
+
const db = (0, database_1.getDb)();
|
|
992
|
+
db.exec(`
|
|
993
|
+
CREATE TABLE IF NOT EXISTS team_members (
|
|
994
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
995
|
+
name TEXT NOT NULL,
|
|
996
|
+
role TEXT DEFAULT 'developer',
|
|
997
|
+
joined_at TEXT DEFAULT (datetime('now'))
|
|
998
|
+
)
|
|
999
|
+
`);
|
|
1000
|
+
const sub = args[1] || '';
|
|
1001
|
+
// ─── team push ──────────────────────────────────────────────────────
|
|
1002
|
+
if (sub === 'push') {
|
|
1003
|
+
console.log(C.primary(' Pushing your patterns to team...'));
|
|
1004
|
+
const { teamPush } = require('../../04-team/collab/team-git');
|
|
1005
|
+
const name = args[2];
|
|
1006
|
+
if (!name) {
|
|
1007
|
+
console.log(C.warn(' Usage: cell team push <your-name> [role]'));
|
|
1008
|
+
console.log();
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
const role = args[3] || 'developer';
|
|
1012
|
+
const result = teamPush(name, role);
|
|
1013
|
+
console.log(result.success ? C.success(` ${result.message}`) : C.warn(` ${result.message}`));
|
|
1014
|
+
console.log();
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
// ─── team pull ──────────────────────────────────────────────────────
|
|
1018
|
+
if (sub === 'pull') {
|
|
1019
|
+
console.log(C.primary(' Pulling team data...'));
|
|
1020
|
+
const { teamPull } = require('../../04-team/collab/team-git');
|
|
1021
|
+
const result = teamPull();
|
|
1022
|
+
if (result.success) {
|
|
1023
|
+
console.log(C.success(` ${result.message}`));
|
|
1024
|
+
console.log(C.dim(` Members: ${result.newMembers}, Patterns: ${result.newPatterns}`));
|
|
1025
|
+
}
|
|
1026
|
+
else {
|
|
1027
|
+
console.log(C.warn(` ${result.message}`));
|
|
1028
|
+
}
|
|
1029
|
+
console.log();
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
1032
|
+
// ─── team onboard ───────────────────────────────────────────────────
|
|
1033
|
+
if (sub === 'onboard' && args[2]) {
|
|
1034
|
+
const newMember = args[2];
|
|
1035
|
+
const teamPath = path.join(process.cwd(), '.cell', 'team');
|
|
1036
|
+
console.log(C.primary(` Generating onboarding guide for ${newMember}...`));
|
|
1037
|
+
const { generateOnboardingGuide, formatOnboardingText } = require('../../04-team/collab/team-intel');
|
|
1038
|
+
const guide = generateOnboardingGuide(teamPath, newMember);
|
|
1039
|
+
if (guide) {
|
|
1040
|
+
console.log(formatOnboardingText(guide));
|
|
1041
|
+
}
|
|
1042
|
+
else {
|
|
1043
|
+
console.log(C.warn(' No team data found. Run: cell team push <your-name> first.'));
|
|
1044
|
+
}
|
|
1045
|
+
console.log();
|
|
1046
|
+
return;
|
|
1047
|
+
}
|
|
1048
|
+
// ─── team status ────────────────────────────────────────────────────
|
|
1049
|
+
if (sub === 'status') {
|
|
1050
|
+
const { teamStatus } = require('../../04-team/collab/team-git');
|
|
1051
|
+
const intel = teamStatus();
|
|
1052
|
+
if (!intel) {
|
|
1053
|
+
console.log(C.dim(' No team data. Run: cell team push <your-name>'));
|
|
1054
|
+
console.log();
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
1057
|
+
console.log(C.bold(` Team: ${intel.summary.totalMembers} members`));
|
|
1058
|
+
console.log(C.dim(` Patterns: ${intel.summary.totalPatterns}, Bus Factor: ${intel.summary.avgBusFactor}`));
|
|
1059
|
+
console.log();
|
|
1060
|
+
if (intel.members.length > 0) {
|
|
1061
|
+
console.log(C.bold(' Members:'));
|
|
1062
|
+
for (const m of intel.members) {
|
|
1063
|
+
console.log(` ${C.success('•')} ${m.name} (${m.role}) — ${m.patterns} patterns`);
|
|
1064
|
+
if (m.strengths.length > 0)
|
|
1065
|
+
console.log(C.dim(` Strengths: ${m.strengths.join(', ')}`));
|
|
1066
|
+
}
|
|
1067
|
+
console.log();
|
|
1068
|
+
}
|
|
1069
|
+
if (intel.knowledgeMap.length > 0) {
|
|
1070
|
+
console.log(C.bold(' Knowledge Map:'));
|
|
1071
|
+
for (const k of intel.knowledgeMap) {
|
|
1072
|
+
const risk = k.busFactor <= 1 ? C.warn('⚠ BUS=1') : C.dim(`bus=${k.busFactor}`);
|
|
1073
|
+
console.log(` ${k.area}: ${k.experts.join(', ')} ${risk}`);
|
|
1074
|
+
}
|
|
1075
|
+
console.log();
|
|
1076
|
+
}
|
|
1077
|
+
if (intel.sharedPatterns.length > 0) {
|
|
1078
|
+
console.log(C.bold(' Top Shared Patterns:'));
|
|
1079
|
+
for (const p of intel.sharedPatterns.slice(0, 5)) {
|
|
1080
|
+
console.log(` ${C.dim('•')} ${p.name}: ${p.value} (${p.count}x)`);
|
|
1081
|
+
}
|
|
1082
|
+
console.log();
|
|
1083
|
+
}
|
|
1084
|
+
if (intel.summary.strongestArea)
|
|
1085
|
+
console.log(C.success(` + Strongest: ${intel.summary.strongestArea}`));
|
|
1086
|
+
if (intel.summary.weakestArea)
|
|
1087
|
+
console.log(C.warn(` ! Weakest: ${intel.summary.weakestArea}`));
|
|
1088
|
+
// Team pattern library
|
|
1089
|
+
const teamPath = path.join(process.cwd(), '.cell', 'team');
|
|
1090
|
+
try {
|
|
1091
|
+
const { buildTeamPatternLibrary } = require('../../04-team/collab/team-intel');
|
|
1092
|
+
const rules = buildTeamPatternLibrary(teamPath);
|
|
1093
|
+
if (rules.length > 0) {
|
|
1094
|
+
console.log(C.bold(' 📋 Pattern Library:'));
|
|
1095
|
+
const doRules = rules.filter((r) => r.type === 'do').slice(0, 3);
|
|
1096
|
+
const dontRules = rules.filter((r) => r.type === 'dont').slice(0, 2);
|
|
1097
|
+
for (const r of doRules) {
|
|
1098
|
+
console.log(` ${C.success('✓')} ${r.rule} (${r.agreement}% agreement)`);
|
|
1099
|
+
}
|
|
1100
|
+
for (const r of dontRules) {
|
|
1101
|
+
console.log(` ${C.warn('✗')} ${r.rule}`);
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
catch { }
|
|
1106
|
+
if (intel.summary.criticalBlindSpots > 0)
|
|
1107
|
+
console.log(C.warn(` ! ${intel.summary.criticalBlindSpots} critical blind spots`));
|
|
1108
|
+
console.log();
|
|
1109
|
+
return;
|
|
1110
|
+
}
|
|
1111
|
+
// ─── team silos ─────────────────────────────────────────────────────
|
|
1112
|
+
if (sub === 'silos') {
|
|
1113
|
+
const { detectKnowledgeSilos } = require('../../04-team/collab/team-collaboration');
|
|
1114
|
+
const silos = detectKnowledgeSilos();
|
|
1115
|
+
console.log(C.bold(` Knowledge Silos: ${silos.length}`));
|
|
1116
|
+
console.log();
|
|
1117
|
+
if (silos.length === 0) {
|
|
1118
|
+
console.log(C.dim(' No silos detected. Knowledge is well distributed.'));
|
|
1119
|
+
}
|
|
1120
|
+
else {
|
|
1121
|
+
for (const s of silos.slice(0, 10)) {
|
|
1122
|
+
const riskColor = s.riskLevel === 'high' ? C.warn : s.riskLevel === 'medium' ? C.primary : C.dim;
|
|
1123
|
+
console.log(` ${riskColor('●')} ${s.name} — ${s.knowledgeArea}`);
|
|
1124
|
+
console.log(C.dim(` ${s.members.join(', ')} (bus factor: ${s.busFactor})`));
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
console.log();
|
|
1128
|
+
return;
|
|
1129
|
+
}
|
|
1130
|
+
// ─── team bus-factor ───────────────────────────────────────────────
|
|
1131
|
+
if (sub === 'bus-factor') {
|
|
1132
|
+
const { calculateBusFactor } = require('../../04-team/collab/team-collaboration');
|
|
1133
|
+
const report = calculateBusFactor();
|
|
1134
|
+
console.log(C.bold(` Bus Factor: ${report.overallScore}/100`));
|
|
1135
|
+
console.log();
|
|
1136
|
+
if (report.singlePointsOfFailure.length > 0) {
|
|
1137
|
+
console.log(C.warn(' Single Points of Failure:'));
|
|
1138
|
+
for (const spof of report.singlePointsOfFailure.slice(0, 5)) {
|
|
1139
|
+
console.log(C.warn(` ⚠ ${spof}`));
|
|
1140
|
+
}
|
|
1141
|
+
console.log();
|
|
1142
|
+
}
|
|
1143
|
+
if (report.members.length > 0) {
|
|
1144
|
+
console.log(C.dim(' Top members:'));
|
|
1145
|
+
for (const m of report.members.slice(0, 5)) {
|
|
1146
|
+
console.log(` ${m.name}: score ${m.score} (${m.risk} risk)`);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
console.log();
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
// ─── team health ───────────────────────────────────────────────────
|
|
1153
|
+
if (sub === 'health') {
|
|
1154
|
+
const { getTeamHealth } = require('../../04-team/collab/team-collaboration');
|
|
1155
|
+
const health = getTeamHealth(args[2]);
|
|
1156
|
+
console.log(C.bold(` Team Health: ${health.score}/100`));
|
|
1157
|
+
console.log();
|
|
1158
|
+
console.log(C.dim(` Bus factor: ${health.busFactor}, Silos: ${health.siloCount}, Edges: ${health.collaborationEdges}`));
|
|
1159
|
+
if (health.strengths.length > 0) {
|
|
1160
|
+
console.log(C.success(' Strengths:'));
|
|
1161
|
+
for (const s of health.strengths.slice(0, 3))
|
|
1162
|
+
console.log(C.success(` + ${s}`));
|
|
1163
|
+
}
|
|
1164
|
+
if (health.skillGaps.length > 0) {
|
|
1165
|
+
console.log(C.warn(' Skill gaps:'));
|
|
1166
|
+
for (const g of health.skillGaps.slice(0, 3))
|
|
1167
|
+
console.log(C.warn(` ! ${g}`));
|
|
1168
|
+
}
|
|
1169
|
+
if (health.recommendations.length > 0) {
|
|
1170
|
+
console.log(C.primary(' Recommendations:'));
|
|
1171
|
+
for (const r of health.recommendations.slice(0, 3))
|
|
1172
|
+
console.log(` → ${r}`);
|
|
1173
|
+
}
|
|
1174
|
+
console.log();
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
// ─── community sub-commands ─────────────────────────────────────────
|
|
1178
|
+
if (sub === 'community' || sub === 'comm') {
|
|
1179
|
+
const csub = args[2];
|
|
1180
|
+
if (csub === 'stats') {
|
|
1181
|
+
const { getCommunityStats } = require('../../06-memory/stores/community-store');
|
|
1182
|
+
const stats = getCommunityStats();
|
|
1183
|
+
console.log(C.bold(' Community Stats'));
|
|
1184
|
+
console.log(C.dim(` Patterns: ${stats.totalPatterns}, Insights: ${stats.totalInsights}, Benchmarks: ${stats.totalBenchmarks}`));
|
|
1185
|
+
console.log(C.dim(` Total votes: ${stats.totalVotes}`));
|
|
1186
|
+
if (Object.keys(stats.byCategory).length > 0) {
|
|
1187
|
+
console.log(C.dim(' By category:'));
|
|
1188
|
+
for (const [cat, count] of Object.entries(stats.byCategory)) {
|
|
1189
|
+
console.log(` ${cat}: ${count}`);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
console.log();
|
|
1193
|
+
return;
|
|
1194
|
+
}
|
|
1195
|
+
if (csub === 'share' && args[3]) {
|
|
1196
|
+
const { shareCommunityPattern, validatePrivacy } = require('../../06-memory/stores/community-store');
|
|
1197
|
+
const rule = args[3];
|
|
1198
|
+
const category = args[4] || 'general';
|
|
1199
|
+
const language = args[5];
|
|
1200
|
+
const validation = validatePrivacy(rule);
|
|
1201
|
+
if (!validation.safe) {
|
|
1202
|
+
console.log(C.warn(' Blocked — privacy violations:'));
|
|
1203
|
+
for (const e of validation.errors)
|
|
1204
|
+
console.log(C.warn(` ✗ ${e}`));
|
|
1205
|
+
console.log();
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
const result = shareCommunityPattern({ category, rule, language });
|
|
1209
|
+
console.log(C.success(` Shared: ${result.patternId}`));
|
|
1210
|
+
if (result.warnings.length > 0) {
|
|
1211
|
+
console.log(C.dim(' Warnings:'));
|
|
1212
|
+
for (const w of result.warnings)
|
|
1213
|
+
console.log(C.dim(` - ${w}`));
|
|
1214
|
+
}
|
|
1215
|
+
console.log();
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
if (csub === 'trends') {
|
|
1219
|
+
const { getTechEvolution } = require('../../06-memory/stores/community-store');
|
|
1220
|
+
const trends = getTechEvolution();
|
|
1221
|
+
console.log(C.bold(' Technology Trends'));
|
|
1222
|
+
for (const t of trends.slice(0, 10)) {
|
|
1223
|
+
const arrow = t.trend30d > 0 ? C.success('↑') : t.trend30d < 0 ? C.warn('↓') : C.dim('→');
|
|
1224
|
+
console.log(` ${arrow} ${t.technology} — ${t.adoptionPhase} (${t.currentUsage} signals)`);
|
|
1225
|
+
}
|
|
1226
|
+
console.log();
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1229
|
+
console.log(C.dim(' Usage: cell team community [stats|share <rule> <category>|trends]'));
|
|
1230
|
+
console.log();
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
// ─── team usage (Phase 6) ──────────────────────────────────────────
|
|
1234
|
+
if (sub === 'usage') {
|
|
1235
|
+
const { getUsageDashboard, getDecisionPatterns, detectRepeatMistakes, getBurnoutSignals } = require('../../06-memory/stores/usage-intelligence-store');
|
|
1236
|
+
const project = args[2] || 'Fivo-Cell';
|
|
1237
|
+
const dash = getUsageDashboard(project);
|
|
1238
|
+
console.log(C.bold(` Usage Dashboard — ${project}`));
|
|
1239
|
+
console.log();
|
|
1240
|
+
console.log(C.dim(` Decisions: ${dash.decisions.total} (${dash.decisions.right} right, ${dash.decisions.wrong} wrong)`));
|
|
1241
|
+
if (dash.decisions.topPatterns.length > 0) {
|
|
1242
|
+
console.log(C.bold(' Decision Patterns:'));
|
|
1243
|
+
for (const p of dash.decisions.topPatterns.slice(0, 3)) {
|
|
1244
|
+
console.log(` ${p.advice}`);
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
console.log();
|
|
1248
|
+
console.log(C.dim(` Mistakes: ${dash.mistakes.total} repeated (${dash.mistakes.critical} critical)`));
|
|
1249
|
+
if (dash.mistakes.top.length > 0) {
|
|
1250
|
+
for (const m of dash.mistakes.top.slice(0, 3)) {
|
|
1251
|
+
console.log(` ${C.warn('!')} ${m.errorType} (${m.count}x) — ${m.suggestion}`);
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
console.log();
|
|
1255
|
+
console.log(C.dim(` AI: ${dash.ai.modelsUsed} models, avg acceptance ${dash.ai.avgAcceptance}%`));
|
|
1256
|
+
if (dash.ai.topModel !== 'none')
|
|
1257
|
+
console.log(C.dim(` Top model: ${dash.ai.topModel}`));
|
|
1258
|
+
console.log();
|
|
1259
|
+
console.log(C.dim(` Productivity: flow ${dash.productivity.flowScore}, friction ${dash.productivity.frictionScore}`));
|
|
1260
|
+
console.log();
|
|
1261
|
+
console.log(C.dim(` Skills: ${dash.skills.improving} improving, ${dash.skills.plateau} plateau, ${dash.skills.regressing} regressing`));
|
|
1262
|
+
console.log();
|
|
1263
|
+
const burnoutColor = dash.burnout.risk === 'high' ? C.warn : dash.burnout.risk === 'medium' ? C.primary : C.success;
|
|
1264
|
+
console.log(burnoutColor(` Burnout risk: ${dash.burnout.risk.toUpperCase()}`));
|
|
1265
|
+
if (dash.burnout.signals.length > 0) {
|
|
1266
|
+
for (const s of dash.burnout.signals)
|
|
1267
|
+
console.log(C.dim(` - ${s}`));
|
|
1268
|
+
}
|
|
1269
|
+
console.log(C.dim(` ${dash.burnout.advice}`));
|
|
1270
|
+
console.log();
|
|
1271
|
+
return;
|
|
1272
|
+
}
|
|
1273
|
+
if (sub === 'add' && args[2]) {
|
|
1274
|
+
const name = args[2];
|
|
1275
|
+
const role = args[3] || 'developer';
|
|
1276
|
+
db.prepare('INSERT INTO team_members (name, role) VALUES (?, ?)').run(name, role);
|
|
1277
|
+
const members = db.prepare('SELECT name, role, joined_at FROM team_members').all();
|
|
1278
|
+
(0, layers_1.saveTeamMembers)(members.map((m) => ({ name: m.name, role: m.role, joinedAt: m.joined_at })));
|
|
1279
|
+
console.log(C.success(` Added: ${name} (${role})`));
|
|
1280
|
+
console.log(C.dim(' Saved to .cell/team/members.json'));
|
|
1281
|
+
console.log();
|
|
1282
|
+
return;
|
|
1283
|
+
}
|
|
1284
|
+
if (sub === 'remove' && args[2]) {
|
|
1285
|
+
db.prepare('DELETE FROM team_members WHERE name = ?').run(args[2]);
|
|
1286
|
+
const members = db.prepare('SELECT name, role, joined_at FROM team_members').all();
|
|
1287
|
+
(0, layers_1.saveTeamMembers)(members.map((m) => ({ name: m.name, role: m.role, joinedAt: m.joined_at })));
|
|
1288
|
+
console.log(C.success(` Removed: ${args[2]}`));
|
|
1289
|
+
console.log();
|
|
1290
|
+
return;
|
|
1291
|
+
}
|
|
1292
|
+
// Default: show member list + team commands
|
|
1293
|
+
const members = db.prepare('SELECT name, role, joined_at FROM team_members').all();
|
|
1294
|
+
if (members.length === 0) {
|
|
1295
|
+
console.log(C.dim(' No team members yet.'));
|
|
1296
|
+
console.log();
|
|
1297
|
+
}
|
|
1298
|
+
console.log(C.bold(' Members:'));
|
|
1299
|
+
for (const m of members) {
|
|
1300
|
+
console.log(` ${C.num(m.name)} — ${m.role}`);
|
|
1301
|
+
}
|
|
1302
|
+
console.log();
|
|
1303
|
+
console.log(' Commands:');
|
|
1304
|
+
console.log(` ${C.primary('cell team push <name>')} Share your patterns with team`);
|
|
1305
|
+
console.log(` ${C.primary('cell team pull')} Pull team data from git`);
|
|
1306
|
+
console.log(` ${C.primary('cell team status')} Team intelligence dashboard`);
|
|
1307
|
+
console.log(` ${C.primary('cell team silos')} Knowledge silo detection`);
|
|
1308
|
+
console.log(` ${C.primary('cell team bus-factor')} Bus factor analysis`);
|
|
1309
|
+
console.log(` ${C.primary('cell team health [proj]')} Team health score`);
|
|
1310
|
+
console.log(` ${C.primary('cell team community')} Community stats/share/trends`);
|
|
1311
|
+
console.log(` ${C.primary('cell team usage [proj]')} Personal usage intelligence`);
|
|
1312
|
+
console.log(` ${C.primary('cell team add/remove')} Manage members`);
|
|
1313
|
+
console.log();
|
|
1314
|
+
}
|
|
1315
|
+
// ─── cell watch ─────────────────────────────────────────────────────────────
|
|
1316
|
+
function doWatch() {
|
|
1317
|
+
console.log();
|
|
1318
|
+
console.log(C.bold(' Cell Live Watcher'));
|
|
1319
|
+
console.log(C.dim(' ─────────────────'));
|
|
1320
|
+
console.log();
|
|
1321
|
+
const sub = args[1] || 'daemon';
|
|
1322
|
+
// Parse flags first so positional args don't get eaten by --limit / --type.
|
|
1323
|
+
// Examples supported:
|
|
1324
|
+
// cell watch events
|
|
1325
|
+
// cell watch events fivo-cell
|
|
1326
|
+
// cell watch events fivo-cell --limit 10
|
|
1327
|
+
// cell watch events fivo-cell --type file_save
|
|
1328
|
+
// cell watch events --limit 5 --type file_create
|
|
1329
|
+
const watchArgs = args.slice(2);
|
|
1330
|
+
const { positional } = require('../watcher/watch-cli').parseWatchFlags(watchArgs);
|
|
1331
|
+
const watchLimit = require('../watcher/watch-cli').parseWatchLimit(watchArgs);
|
|
1332
|
+
const watchEventType = require('../watcher/watch-cli').parseWatchEventType(watchArgs);
|
|
1333
|
+
const project = positional[0] || path.basename(process.cwd());
|
|
1334
|
+
const dir = positional[1] || process.cwd();
|
|
1335
|
+
// If invoked with no subcommand: run as a long-lived watcher daemon (for .bat auto-restart loop)
|
|
1336
|
+
if (sub === 'daemon' || sub === '') {
|
|
1337
|
+
runWatchDaemon(project, dir);
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
try {
|
|
1341
|
+
const liveWatcher = require('../watcher/live-watcher');
|
|
1342
|
+
const http = require('http');
|
|
1343
|
+
function callDaemon(toolName, toolArgs) {
|
|
1344
|
+
return new Promise((resolve, reject) => {
|
|
1345
|
+
const body = JSON.stringify({ method: 'tools/call', params: { name: toolName, arguments: toolArgs } });
|
|
1346
|
+
const req = http.request({ hostname: '127.0.0.1', port: 9876, path: '/mcp', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body) } }, (res) => {
|
|
1347
|
+
let data = '';
|
|
1348
|
+
res.on('data', (chunk) => { data += chunk; });
|
|
1349
|
+
res.on('end', () => {
|
|
1350
|
+
try {
|
|
1351
|
+
const parsed = JSON.parse(data);
|
|
1352
|
+
resolve(parsed.result || parsed);
|
|
1353
|
+
}
|
|
1354
|
+
catch (e) {
|
|
1355
|
+
reject(e);
|
|
1356
|
+
}
|
|
1357
|
+
});
|
|
1358
|
+
});
|
|
1359
|
+
req.on('error', reject);
|
|
1360
|
+
req.write(body);
|
|
1361
|
+
req.end();
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
if (sub === 'start' || sub === 'stop') {
|
|
1365
|
+
// Watcher state lives in daemon's in-memory map; CLI must talk to daemon
|
|
1366
|
+
const toolName = sub === 'start' ? 'cell_watch_start' : 'cell_watch_stop';
|
|
1367
|
+
const toolArgs = { project };
|
|
1368
|
+
if (sub === 'start')
|
|
1369
|
+
toolArgs.dir = dir;
|
|
1370
|
+
callDaemon(toolName, toolArgs).then((r) => {
|
|
1371
|
+
const ok = sub === 'start' ? r.started : r.stopped;
|
|
1372
|
+
console.log(ok ? C.success(` ✓ ${r.message}`) : C.warn(` ! ${r.message}`));
|
|
1373
|
+
console.log();
|
|
1374
|
+
}).catch((e) => {
|
|
1375
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
1376
|
+
console.log(C.warn(` Daemon not running (${msg}). Start with: cell start`));
|
|
1377
|
+
console.log();
|
|
1378
|
+
});
|
|
1379
|
+
return;
|
|
1380
|
+
}
|
|
1381
|
+
if (sub === 'events') {
|
|
1382
|
+
const { isValidEventType } = require('../watcher/watch-cli');
|
|
1383
|
+
const typeFilter = isValidEventType(watchEventType) ? watchEventType : undefined;
|
|
1384
|
+
const events = liveWatcher.getLiveEvents(project, watchLimit, typeFilter);
|
|
1385
|
+
if (events.length === 0) {
|
|
1386
|
+
const hint = typeFilter
|
|
1387
|
+
? `No ${typeFilter} events for ${project} in the last ${watchLimit}.`
|
|
1388
|
+
: `No live events for ${project} yet. Start watcher with: cell watch start ${project}`;
|
|
1389
|
+
console.log(C.dim(` ${hint}`));
|
|
1390
|
+
}
|
|
1391
|
+
else {
|
|
1392
|
+
const header = typeFilter
|
|
1393
|
+
? `Recent ${typeFilter} events for ${project} (${events.length}, limit ${watchLimit}):`
|
|
1394
|
+
: `Recent events for ${project} (${events.length}, limit ${watchLimit}):`;
|
|
1395
|
+
console.log(C.bold(` ${header}`));
|
|
1396
|
+
for (const e of events) {
|
|
1397
|
+
const icon = e.eventType === 'file_save' ? '~' : e.eventType === 'file_create' ? '+' : e.eventType === 'file_delete' ? '-' : e.eventType === 'file_rename' ? '>' : e.eventType === 'git_commit' ? '@' : '*';
|
|
1398
|
+
console.log(` ${C.dim(icon)} ${C.dim(e.createdAt)} ${e.eventType}: ${C.num(e.filePath)}`);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
else if (sub === 'refresh') {
|
|
1403
|
+
const result = liveWatcher.performAutoRefresh(project, true);
|
|
1404
|
+
console.log(C.success(` ✓ Refresh logged: ${result.details} (${result.durationMs}ms)`));
|
|
1405
|
+
}
|
|
1406
|
+
else if (sub === 'check') {
|
|
1407
|
+
const check = liveWatcher.checkIfNeedsRefresh(project);
|
|
1408
|
+
const needs = check.needsRefresh;
|
|
1409
|
+
console.log(needs ? C.warn(` ⚠ Needs refresh: ${check.reason}`) : C.success(` ✓ ${check.reason}`));
|
|
1410
|
+
console.log(C.dim(` Data age: ${check.dataAge} | Recommended: ${check.recommendedAction}`));
|
|
1411
|
+
}
|
|
1412
|
+
else {
|
|
1413
|
+
// status
|
|
1414
|
+
const status = liveWatcher.getWatcherStatus(project);
|
|
1415
|
+
const active = liveWatcher.getActiveWatchers();
|
|
1416
|
+
if (status && status.active) {
|
|
1417
|
+
console.log(C.success(` ● ${project}: ${C.bold('LIVE')} — ${status.eventCount} events, last: ${status.lastEventAt || 'never'}`));
|
|
1418
|
+
}
|
|
1419
|
+
else {
|
|
1420
|
+
console.log(C.dim(` ○ ${project}: not watched`));
|
|
1421
|
+
}
|
|
1422
|
+
if (active.length > 1 || (active.length === 1 && active[0]?.project !== project)) {
|
|
1423
|
+
console.log();
|
|
1424
|
+
console.log(C.bold(' Other active watchers:'));
|
|
1425
|
+
for (const a of active) {
|
|
1426
|
+
if (a.project !== project)
|
|
1427
|
+
console.log(` ● ${a.project} (${a.eventCount} events)`);
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
catch (err) {
|
|
1433
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1434
|
+
console.log(C.warn(` Watch error: ${msg}`));
|
|
1435
|
+
}
|
|
1436
|
+
console.log();
|
|
1437
|
+
}
|
|
1438
|
+
// ─── cell blindspots ────────────────────────────────────────────────────────
|
|
1439
|
+
function doBlindspots() {
|
|
1440
|
+
console.log();
|
|
1441
|
+
console.log(C.bold(' Cell Blind Spots'));
|
|
1442
|
+
console.log(C.dim(' ────────────────'));
|
|
1443
|
+
console.log();
|
|
1444
|
+
const showTop = args.includes('--top');
|
|
1445
|
+
const topN = (() => {
|
|
1446
|
+
const idx = args.indexOf('--top');
|
|
1447
|
+
if (idx >= 0 && args[idx + 1] && /^\d+$/.test(args[idx + 1]))
|
|
1448
|
+
return parseInt(args[idx + 1], 10);
|
|
1449
|
+
return 5;
|
|
1450
|
+
})();
|
|
1451
|
+
const dirArg = args.find((a, i) => i >= 1 && !a.startsWith('--') && a !== String(topN));
|
|
1452
|
+
const dir = dirArg || process.cwd();
|
|
1453
|
+
const maxFiles = parseInt(args.find((a, i) => i >= 1 && !a.startsWith('--') && /^\d+$/.test(a) && a !== String(topN)) || '200', 10);
|
|
1454
|
+
try {
|
|
1455
|
+
const { scanDirectoryForBlindSpots, formatBlindSpotReport, summarizeBlindSpots, getTopFixes, getCategorySummary } = require('../../../core/enhanced-blind-spots');
|
|
1456
|
+
console.log(C.dim(` Scanning ${dir} (max ${maxFiles} files)...`));
|
|
1457
|
+
const spots = scanDirectoryForBlindSpots(dir, maxFiles);
|
|
1458
|
+
console.log();
|
|
1459
|
+
if (showTop) {
|
|
1460
|
+
const topFixes = getTopFixes(spots, topN);
|
|
1461
|
+
console.log(C.bold(` Top ${topFixes.length} fixes first:`));
|
|
1462
|
+
for (let i = 0; i < topFixes.length; i++) {
|
|
1463
|
+
const s = topFixes[i];
|
|
1464
|
+
const score = s.priorityScore ? ` (score ${s.priorityScore.toFixed(1)})` : '';
|
|
1465
|
+
console.log(` ${C.num(String(i + 1))}. ${s.message}${score}`);
|
|
1466
|
+
console.log(` ${C.dim(s.filePath + ':' + s.lineNumber)} → ${s.recommendation}`);
|
|
1467
|
+
}
|
|
1468
|
+
console.log();
|
|
1469
|
+
}
|
|
1470
|
+
else {
|
|
1471
|
+
console.log(formatBlindSpotReport(spots));
|
|
1472
|
+
}
|
|
1473
|
+
const catSummary = getCategorySummary(spots);
|
|
1474
|
+
if (catSummary.length > 0) {
|
|
1475
|
+
console.log();
|
|
1476
|
+
console.log(C.bold(' By category:'));
|
|
1477
|
+
for (const c of catSummary) {
|
|
1478
|
+
console.log(` ${C.num(String(c.count))} ${c.category} (top: ${c.topSeverity})`);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
catch (err) {
|
|
1483
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1484
|
+
console.log(C.warn(` Blind spot scan failed: ${msg}`));
|
|
1485
|
+
}
|
|
1486
|
+
console.log();
|
|
1487
|
+
}
|
|
1488
|
+
// ─── cell doctor ─────────────────────────────────────────────────────────────
|
|
1489
|
+
async function doDoctor() {
|
|
1490
|
+
console.log();
|
|
1491
|
+
console.log(C.bold(' Cell Doctor — Health Check'));
|
|
1492
|
+
console.log(C.dim(' ─────────────────────────'));
|
|
1493
|
+
console.log();
|
|
1494
|
+
const { detectProject, checkScanState, checkWatchState, checkMcpState, isDaemonRunning, } = require('../setup/setup');
|
|
1495
|
+
const cwd = process.cwd();
|
|
1496
|
+
const project = detectProject(cwd);
|
|
1497
|
+
const issues = [];
|
|
1498
|
+
const passes = [];
|
|
1499
|
+
// 1. Git repo
|
|
1500
|
+
const gitDir = path.join(cwd, '.git');
|
|
1501
|
+
if (fs.existsSync(gitDir)) {
|
|
1502
|
+
console.log(` ${C.success('OK')} Git repo detected`);
|
|
1503
|
+
passes.push('git');
|
|
1504
|
+
}
|
|
1505
|
+
else {
|
|
1506
|
+
console.log(` ${C.warn('--')} Git repo not found (optional, but recommended)`);
|
|
1507
|
+
issues.push('git');
|
|
1508
|
+
}
|
|
1509
|
+
// 2. Node/TypeScript project
|
|
1510
|
+
const pkgJson = path.join(cwd, 'package.json');
|
|
1511
|
+
const tsconfig = path.join(cwd, 'tsconfig.json');
|
|
1512
|
+
if (fs.existsSync(pkgJson)) {
|
|
1513
|
+
console.log(` ${C.success('OK')} Node.js project detected (package.json)`);
|
|
1514
|
+
passes.push('node');
|
|
1515
|
+
}
|
|
1516
|
+
else {
|
|
1517
|
+
console.log(` ${C.warn('--')} No package.json found (non-Node project?)`);
|
|
1518
|
+
issues.push('node');
|
|
1519
|
+
}
|
|
1520
|
+
if (fs.existsSync(tsconfig)) {
|
|
1521
|
+
console.log(` ${C.success('OK')} TypeScript project detected (tsconfig.json)`);
|
|
1522
|
+
passes.push('typescript');
|
|
1523
|
+
}
|
|
1524
|
+
// 3. .cell folder
|
|
1525
|
+
const cellDir = path.join(cwd, '.cell');
|
|
1526
|
+
if (fs.existsSync(cellDir)) {
|
|
1527
|
+
const personalDir = path.join(cellDir, 'personal');
|
|
1528
|
+
const fileCount = fs.existsSync(personalDir) ? fs.readdirSync(personalDir).length : 0;
|
|
1529
|
+
console.log(` ${C.success('OK')} .cell/ folder exists (${fileCount} personal files)`);
|
|
1530
|
+
passes.push('cell-dir');
|
|
1531
|
+
}
|
|
1532
|
+
else {
|
|
1533
|
+
console.log(` ${C.warn('--')} No .cell/ folder found`);
|
|
1534
|
+
issues.push('cell-dir');
|
|
1535
|
+
}
|
|
1536
|
+
// 4. SQLite DB
|
|
1537
|
+
const dbPath = path.join(os.homedir(), '.fivo', 'cell', 'cell.db');
|
|
1538
|
+
if (fs.existsSync(dbPath)) {
|
|
1539
|
+
try {
|
|
1540
|
+
const stat = fs.statSync(dbPath);
|
|
1541
|
+
const sizeMB = (stat.size / 1024 / 1024).toFixed(1);
|
|
1542
|
+
console.log(` ${C.success('OK')} SQLite DB exists (${sizeMB} MB)`);
|
|
1543
|
+
passes.push('db');
|
|
1544
|
+
}
|
|
1545
|
+
catch {
|
|
1546
|
+
console.log(` ${C.warn('--')} SQLite DB exists but not readable`);
|
|
1547
|
+
issues.push('db');
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
else {
|
|
1551
|
+
console.log(` ${C.warn('--')} No SQLite DB found`);
|
|
1552
|
+
issues.push('db');
|
|
1553
|
+
}
|
|
1554
|
+
// 5. Last scan
|
|
1555
|
+
const scan = checkScanState(cwd);
|
|
1556
|
+
if (scan.done) {
|
|
1557
|
+
console.log(` ${C.success('OK')} Scan completed (${scan.reason})`);
|
|
1558
|
+
passes.push('scan');
|
|
1559
|
+
}
|
|
1560
|
+
else {
|
|
1561
|
+
console.log(` ${C.warn('--')} No scan found (${scan.reason})`);
|
|
1562
|
+
issues.push('scan');
|
|
1563
|
+
}
|
|
1564
|
+
// 6. Daemon / bridge status
|
|
1565
|
+
const daemonUp = await isDaemonRunning();
|
|
1566
|
+
if (daemonUp) {
|
|
1567
|
+
console.log(` ${C.success('OK')} Daemon running on http://localhost:9876`);
|
|
1568
|
+
passes.push('daemon');
|
|
1569
|
+
}
|
|
1570
|
+
else {
|
|
1571
|
+
console.log(` ${C.warn('--')} Daemon not running`);
|
|
1572
|
+
issues.push('daemon');
|
|
1573
|
+
}
|
|
1574
|
+
// 7. Watcher status
|
|
1575
|
+
const watch = checkWatchState(project.name);
|
|
1576
|
+
if (watch.done) {
|
|
1577
|
+
console.log(` ${C.success('OK')} Watcher active (${watch.reason})`);
|
|
1578
|
+
passes.push('watcher');
|
|
1579
|
+
}
|
|
1580
|
+
else {
|
|
1581
|
+
console.log(` ${C.warn('--')} Watcher not active (${watch.reason})`);
|
|
1582
|
+
if (daemonUp)
|
|
1583
|
+
issues.push('watcher');
|
|
1584
|
+
}
|
|
1585
|
+
// 8. Bridge status
|
|
1586
|
+
try {
|
|
1587
|
+
const { discoverBridgePort } = require('../watcher/socket-bridge');
|
|
1588
|
+
const port = discoverBridgePort();
|
|
1589
|
+
if (port) {
|
|
1590
|
+
console.log(` ${C.success('OK')} Bridge reachable (port ${port})`);
|
|
1591
|
+
passes.push('bridge');
|
|
1592
|
+
}
|
|
1593
|
+
else {
|
|
1594
|
+
console.log(` ${C.warn('--')} Bridge not running`);
|
|
1595
|
+
issues.push('bridge');
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
catch {
|
|
1599
|
+
console.log(` ${C.warn('--')} Bridge not running`);
|
|
1600
|
+
issues.push('bridge');
|
|
1601
|
+
}
|
|
1602
|
+
// 9. AGENTS.md / .cursorrules
|
|
1603
|
+
const agentsMd = path.join(cwd, 'AGENTS.md');
|
|
1604
|
+
const cursorRules = path.join(cwd, '.cursorrules');
|
|
1605
|
+
const rulesFound = [];
|
|
1606
|
+
if (fs.existsSync(agentsMd))
|
|
1607
|
+
rulesFound.push('AGENTS.md');
|
|
1608
|
+
if (fs.existsSync(cursorRules))
|
|
1609
|
+
rulesFound.push('.cursorrules');
|
|
1610
|
+
if (rulesFound.length > 0) {
|
|
1611
|
+
console.log(` ${C.success('OK')} AI rules: ${rulesFound.join(', ')}`);
|
|
1612
|
+
passes.push('rules');
|
|
1613
|
+
}
|
|
1614
|
+
else {
|
|
1615
|
+
console.log(` ${C.warn('--')} No AGENTS.md or .cursorrules found`);
|
|
1616
|
+
issues.push('rules');
|
|
1617
|
+
}
|
|
1618
|
+
// 10. MCP config
|
|
1619
|
+
const mcp = checkMcpState(os.homedir());
|
|
1620
|
+
if (mcp.done > 0) {
|
|
1621
|
+
console.log(` ${C.success('OK')} MCP config: ${mcp.done}/${mcp.total} IDEs wired`);
|
|
1622
|
+
passes.push('mcp');
|
|
1623
|
+
}
|
|
1624
|
+
else {
|
|
1625
|
+
console.log(` ${C.warn('--')} No MCP configs found (run: cell mcp-config)`);
|
|
1626
|
+
issues.push('mcp');
|
|
1627
|
+
}
|
|
1628
|
+
// 11. First-run state
|
|
1629
|
+
const firstRunFile = path.join(os.homedir(), '.fivo', 'cell', '.first-run-shown');
|
|
1630
|
+
const stateFile = path.join(os.homedir(), '.fivo', 'cell', 'cell-state.json');
|
|
1631
|
+
if (fs.existsSync(stateFile)) {
|
|
1632
|
+
try {
|
|
1633
|
+
const state = JSON.parse(fs.readFileSync(stateFile, 'utf8'));
|
|
1634
|
+
console.log(` ${C.success('OK')} First-run state: setup at ${state.setup_completed || 'unknown'}`);
|
|
1635
|
+
passes.push('first-run');
|
|
1636
|
+
}
|
|
1637
|
+
catch {
|
|
1638
|
+
console.log(` ${C.dim('--')} First-run state file exists but unreadable`);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
else if (fs.existsSync(firstRunFile)) {
|
|
1642
|
+
console.log(` ${C.success('OK')} First-run greeting shown`);
|
|
1643
|
+
passes.push('first-run');
|
|
1644
|
+
}
|
|
1645
|
+
else {
|
|
1646
|
+
console.log(` ${C.dim('--')} First-run not completed yet`);
|
|
1647
|
+
issues.push('first-run');
|
|
1648
|
+
}
|
|
1649
|
+
// ─── Summary ──────────────────────────────────────────────────────────
|
|
1650
|
+
console.log();
|
|
1651
|
+
const total = passes.length + issues.length;
|
|
1652
|
+
if (issues.length === 0) {
|
|
1653
|
+
console.log(C.success(` All ${total} checks passed. Cell is fully healthy.`));
|
|
1654
|
+
}
|
|
1655
|
+
else {
|
|
1656
|
+
console.log(C.warn(` ${passes.length}/${total} checks passed, ${issues.length} need attention:`));
|
|
1657
|
+
console.log();
|
|
1658
|
+
const recovery = {
|
|
1659
|
+
'cell-dir': 'cell scan',
|
|
1660
|
+
'db': 'cell start',
|
|
1661
|
+
'scan': 'cell scan',
|
|
1662
|
+
'daemon': 'cell start',
|
|
1663
|
+
'watcher': 'cell start (then: cell watch start)',
|
|
1664
|
+
'bridge': 'cell bridge start',
|
|
1665
|
+
'rules': 'cell scan (writes AGENTS.md + .cursorrules)',
|
|
1666
|
+
'mcp': 'cell mcp-config',
|
|
1667
|
+
'first-run': 'cell setup',
|
|
1668
|
+
'git': 'git init',
|
|
1669
|
+
'node': 'npm init -y',
|
|
1670
|
+
};
|
|
1671
|
+
for (const issue of issues) {
|
|
1672
|
+
const fix = recovery[issue];
|
|
1673
|
+
if (fix) {
|
|
1674
|
+
console.log(` ${C.warn('!')} ${issue}: Run ${C.primary(fix)}`);
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
console.log();
|
|
1679
|
+
try {
|
|
1680
|
+
const { markDoctorRun } = require('../setup/cell-state');
|
|
1681
|
+
markDoctorRun();
|
|
1682
|
+
}
|
|
1683
|
+
catch { }
|
|
1684
|
+
}
|
|
1685
|
+
// Long-lived watcher daemon — auto-attaches to current project, runs forever.
|
|
1686
|
+
// Used by fivo-cell-daemon.bat to keep a watcher alive in the background.
|
|
1687
|
+
function runWatchDaemon(project, dir) {
|
|
1688
|
+
const liveWatcher = require('../watcher/live-watcher');
|
|
1689
|
+
const result = liveWatcher.startWatcher(project, dir);
|
|
1690
|
+
if (!result.started) {
|
|
1691
|
+
// "already running" means the daemon process already has a watcher; keep this process alive anyway
|
|
1692
|
+
console.log(` Watcher for ${project}: ${result.message}`);
|
|
1693
|
+
}
|
|
1694
|
+
else {
|
|
1695
|
+
console.log(` ✓ Watcher attached: ${result.message}`);
|
|
1696
|
+
}
|
|
1697
|
+
console.log(` Watching ${dir} for changes. Press Ctrl+C to stop.`);
|
|
1698
|
+
console.log();
|
|
1699
|
+
// Keep the process alive — the file watcher uses fs.watch which keeps the event loop busy,
|
|
1700
|
+
// but we add an explicit interval as a belt-and-braces guard against premature exit.
|
|
1701
|
+
const keepAlive = setInterval(() => { }, 60_000);
|
|
1702
|
+
process.on('SIGINT', () => {
|
|
1703
|
+
clearInterval(keepAlive);
|
|
1704
|
+
liveWatcher.stopWatcher(project);
|
|
1705
|
+
console.log(`\n Watcher stopped for ${project}.`);
|
|
1706
|
+
process.exit(0);
|
|
1707
|
+
});
|
|
1708
|
+
process.on('SIGTERM', () => {
|
|
1709
|
+
clearInterval(keepAlive);
|
|
1710
|
+
liveWatcher.stopWatcher(project);
|
|
1711
|
+
process.exit(0);
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1714
|
+
// ─── cell community ─────────────────────────────────────────────────────────
|
|
1715
|
+
function doCommunity() {
|
|
1716
|
+
console.log();
|
|
1717
|
+
console.log(C.bold(' Cell Community'));
|
|
1718
|
+
console.log(C.dim(' ──────────────'));
|
|
1719
|
+
console.log();
|
|
1720
|
+
const sub = args[1] || '';
|
|
1721
|
+
if (sub === 'share') {
|
|
1722
|
+
try {
|
|
1723
|
+
const { sharePatterns } = require('../../05-community/stats/community-intel');
|
|
1724
|
+
const result = sharePatterns();
|
|
1725
|
+
console.log(result.success ? C.success(` ${result.message}`) : C.warn(` ${result.message}`));
|
|
1726
|
+
console.log(C.dim(' Anonymous — only pattern types shared, zero code.'));
|
|
1727
|
+
}
|
|
1728
|
+
catch {
|
|
1729
|
+
console.log(C.warn(' Share failed. Run cell scan first.'));
|
|
1730
|
+
}
|
|
1731
|
+
console.log();
|
|
1732
|
+
return;
|
|
1733
|
+
}
|
|
1734
|
+
if (sub === 'browse' || sub === '') {
|
|
1735
|
+
try {
|
|
1736
|
+
const { generateCommunityReport } = require('../../05-community/stats/community-intel');
|
|
1737
|
+
const report = generateCommunityReport();
|
|
1738
|
+
if (report.patterns.length > 0) {
|
|
1739
|
+
console.log(C.bold(` 📊 Top Patterns (${report.patterns.length} total):`));
|
|
1740
|
+
for (const p of report.patterns.slice(0, 8)) {
|
|
1741
|
+
console.log(` ${C.num(String(p.percentage))}% ${p.category}: ${p.description}`);
|
|
1742
|
+
}
|
|
1743
|
+
console.log();
|
|
1744
|
+
}
|
|
1745
|
+
if (report.benchmarks.length > 0) {
|
|
1746
|
+
console.log(C.bold(' 📈 Benchmarks:'));
|
|
1747
|
+
for (const b of report.benchmarks) {
|
|
1748
|
+
console.log(` ${b.metric}: ${C.num(String(b.percentile))}th percentile — ${b.interpretation}`);
|
|
1749
|
+
}
|
|
1750
|
+
console.log();
|
|
1751
|
+
}
|
|
1752
|
+
if (report.topStacks.length > 0) {
|
|
1753
|
+
console.log(C.bold(' 🏗️ Top Stacks:'));
|
|
1754
|
+
for (const s of report.topStacks) {
|
|
1755
|
+
console.log(` ${C.success('•')} ${s.stack} (${s.count}x)`);
|
|
1756
|
+
}
|
|
1757
|
+
console.log();
|
|
1758
|
+
}
|
|
1759
|
+
if (report.topBlindSpots.length > 0) {
|
|
1760
|
+
console.log(C.bold(' ⚠️ Common Blind Spots:'));
|
|
1761
|
+
for (const b of report.topBlindSpots) {
|
|
1762
|
+
console.log(` ${C.warn('!')} ${b.blindSpot} (${b.percentage}%)`);
|
|
1763
|
+
}
|
|
1764
|
+
console.log();
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
catch {
|
|
1768
|
+
console.log(C.dim(' No community data yet. Run: cell scan first.'));
|
|
1769
|
+
}
|
|
1770
|
+
return;
|
|
1771
|
+
}
|
|
1772
|
+
console.log(' Commands:');
|
|
1773
|
+
console.log(' cell community browse Browse community patterns & benchmarks');
|
|
1774
|
+
console.log(' cell community share Share patterns anonymously');
|
|
1775
|
+
console.log();
|
|
1776
|
+
}
|
|
1777
|
+
// ─── cell context ───────────────────────────────────────────────────────────
|
|
1778
|
+
function doContext() {
|
|
1779
|
+
const positionalArgs = args.slice(1).filter(a => !a.startsWith('--'));
|
|
1780
|
+
const projectArg = positionalArgs[0] || project;
|
|
1781
|
+
const toolArg = positionalArgs[1] || 'claude-code';
|
|
1782
|
+
let showLive = true;
|
|
1783
|
+
let asJson = false;
|
|
1784
|
+
let port = null;
|
|
1785
|
+
let host = '127.0.0.1';
|
|
1786
|
+
let shortMode = false;
|
|
1787
|
+
let fullMode = false;
|
|
1788
|
+
for (let i = 2; i < args.length; i++) {
|
|
1789
|
+
const a = args[i];
|
|
1790
|
+
if (a === '--no-live') {
|
|
1791
|
+
showLive = false;
|
|
1792
|
+
continue;
|
|
1793
|
+
}
|
|
1794
|
+
if (a === '--json') {
|
|
1795
|
+
asJson = true;
|
|
1796
|
+
continue;
|
|
1797
|
+
}
|
|
1798
|
+
if (a === '--short') {
|
|
1799
|
+
shortMode = true;
|
|
1800
|
+
continue;
|
|
1801
|
+
}
|
|
1802
|
+
if (a === '--full') {
|
|
1803
|
+
fullMode = true;
|
|
1804
|
+
continue;
|
|
1805
|
+
}
|
|
1806
|
+
if (typeof a === 'string' && a.startsWith('--port='))
|
|
1807
|
+
port = parseInt(a.split('=')[1], 10) || null;
|
|
1808
|
+
if (typeof a === 'string' && a.startsWith('--host='))
|
|
1809
|
+
host = a.split('=')[1] || '127.0.0.1';
|
|
1810
|
+
}
|
|
1811
|
+
// Try to discover bridge port from pid file if not specified
|
|
1812
|
+
if (port === null) {
|
|
1813
|
+
try {
|
|
1814
|
+
const { discoverBridgePort } = require('../watcher/socket-bridge');
|
|
1815
|
+
const discovered = discoverBridgePort();
|
|
1816
|
+
if (discovered)
|
|
1817
|
+
port = discovered;
|
|
1818
|
+
}
|
|
1819
|
+
catch { /* ignore */ }
|
|
1820
|
+
}
|
|
1821
|
+
if (port === null)
|
|
1822
|
+
port = 9877;
|
|
1823
|
+
// Async wrapper to print live state then static context (in order).
|
|
1824
|
+
const run = async () => {
|
|
1825
|
+
let liveStates = [];
|
|
1826
|
+
let liveError;
|
|
1827
|
+
if (showLive) {
|
|
1828
|
+
try {
|
|
1829
|
+
const { queryBridgeEditorStates } = require('../watcher/socket-bridge');
|
|
1830
|
+
const result = await queryBridgeEditorStates(projectArg, port, host);
|
|
1831
|
+
liveStates = result.states;
|
|
1832
|
+
liveError = result.error;
|
|
1833
|
+
}
|
|
1834
|
+
catch (e) {
|
|
1835
|
+
liveError = e?.message || String(e);
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
if (asJson) {
|
|
1839
|
+
let ctx;
|
|
1840
|
+
try {
|
|
1841
|
+
const { buildContext } = require('../../01-context/context/prompt-builder');
|
|
1842
|
+
ctx = buildContext(projectArg, toolArg);
|
|
1843
|
+
}
|
|
1844
|
+
catch (e) {
|
|
1845
|
+
console.log(JSON.stringify({ error: e?.message || String(e) }));
|
|
1846
|
+
return;
|
|
1847
|
+
}
|
|
1848
|
+
console.log(JSON.stringify({
|
|
1849
|
+
...ctx,
|
|
1850
|
+
liveEditorStates: liveStates,
|
|
1851
|
+
liveError: liveError,
|
|
1852
|
+
}, null, 2));
|
|
1853
|
+
return;
|
|
1854
|
+
}
|
|
1855
|
+
// Print live state at top
|
|
1856
|
+
if (showLive) {
|
|
1857
|
+
if (liveStates.length > 0) {
|
|
1858
|
+
console.log(C.bold(' ── Live Editor State (Feature #2) ──'));
|
|
1859
|
+
for (const s of liveStates) {
|
|
1860
|
+
const dirtyMark = s.isDirty ? C.warn(' [unsaved]') : '';
|
|
1861
|
+
console.log(` ${C.primary(s.editorName)}: ${s.filePath}:${s.line}:${s.column}${dirtyMark}`);
|
|
1862
|
+
if (s.language)
|
|
1863
|
+
console.log(C.dim(` language: ${s.language}`));
|
|
1864
|
+
if (s.unsavedBuffer) {
|
|
1865
|
+
const allLines = s.unsavedBuffer.split('\n');
|
|
1866
|
+
const head = allLines.slice(0, 5);
|
|
1867
|
+
console.log(C.dim(` unsaved (${s.unsavedLength || s.unsavedBuffer.length} chars):`));
|
|
1868
|
+
for (const line of head) {
|
|
1869
|
+
console.log(C.dim(` ${line.length > 80 ? line.slice(0, 77) + '...' : line}`));
|
|
1870
|
+
}
|
|
1871
|
+
if (allLines.length > 5) {
|
|
1872
|
+
console.log(C.dim(` ... ${allLines.length - 5} more lines`));
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
console.log('');
|
|
1877
|
+
}
|
|
1878
|
+
else if (liveError) {
|
|
1879
|
+
console.log(C.dim(' ── Live Editor State ──'));
|
|
1880
|
+
console.log(C.dim(` Bridge not reachable (${liveError}). Start with: cell bridge start`));
|
|
1881
|
+
console.log('');
|
|
1882
|
+
}
|
|
1883
|
+
else {
|
|
1884
|
+
console.log(C.dim(' ── Live Editor State ──'));
|
|
1885
|
+
console.log(C.dim(` No editors connected for "${projectArg}"`));
|
|
1886
|
+
console.log(C.dim(' Start an editor that pushes to the bridge (or run cell bridge status)'));
|
|
1887
|
+
console.log('');
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
// Static project context
|
|
1891
|
+
try {
|
|
1892
|
+
const { buildContext, formatContextForTool } = require('../../01-context/context/prompt-builder');
|
|
1893
|
+
const ctx = buildContext(projectArg, toolArg);
|
|
1894
|
+
const text = formatContextForTool(ctx, toolArg, projectArg);
|
|
1895
|
+
if (shortMode) {
|
|
1896
|
+
const lines = text.split('\n');
|
|
1897
|
+
const shortLines = [];
|
|
1898
|
+
let inCore = false;
|
|
1899
|
+
let coreCount = 0;
|
|
1900
|
+
for (const line of lines) {
|
|
1901
|
+
if (line.startsWith('## ') || line.startsWith('# ')) {
|
|
1902
|
+
if (coreCount > 0)
|
|
1903
|
+
break;
|
|
1904
|
+
inCore = true;
|
|
1905
|
+
}
|
|
1906
|
+
if (inCore) {
|
|
1907
|
+
shortLines.push(line);
|
|
1908
|
+
if (line.trim() && !line.startsWith('#') && !line.startsWith('─'))
|
|
1909
|
+
coreCount++;
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
if (shortLines.length === 0) {
|
|
1913
|
+
const first5 = lines.slice(0, 5);
|
|
1914
|
+
console.log(first5.join('\n'));
|
|
1915
|
+
console.log(C.dim(` ... (${lines.length} total lines. Use --full to see all)`));
|
|
1916
|
+
}
|
|
1917
|
+
else {
|
|
1918
|
+
console.log(shortLines.join('\n'));
|
|
1919
|
+
console.log(C.dim(` ... (${lines.length} total lines. Use --full or no flag for default)`));
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
else if (fullMode) {
|
|
1923
|
+
console.log(text);
|
|
1924
|
+
}
|
|
1925
|
+
else {
|
|
1926
|
+
console.log(text);
|
|
1927
|
+
}
|
|
1928
|
+
try {
|
|
1929
|
+
const { markFirstContext } = require('../setup/cell-state');
|
|
1930
|
+
markFirstContext();
|
|
1931
|
+
}
|
|
1932
|
+
catch { }
|
|
1933
|
+
try {
|
|
1934
|
+
const { captureCurrentBranchSnapshot } = require('../../03-knowledge/decisions/branch-snapshot');
|
|
1935
|
+
captureCurrentBranchSnapshot(projectArg, process.cwd());
|
|
1936
|
+
}
|
|
1937
|
+
catch { }
|
|
1938
|
+
}
|
|
1939
|
+
catch (e) {
|
|
1940
|
+
console.log(C.warn(' No context available yet.'));
|
|
1941
|
+
console.log(C.dim(' Run these commands first:'));
|
|
1942
|
+
console.log(C.primary(' cell scan'));
|
|
1943
|
+
console.log(C.primary(' cell doctor'));
|
|
1944
|
+
}
|
|
1945
|
+
};
|
|
1946
|
+
run();
|
|
1947
|
+
}
|
|
1948
|
+
// ─── cell replay — show full session timeline ──────────────────────────────
|
|
1949
|
+
function doReplay() {
|
|
1950
|
+
// args[1] = project (optional, defaults to cwd)
|
|
1951
|
+
// args[2] = sessionId (optional)
|
|
1952
|
+
// --since <ISO>
|
|
1953
|
+
// --until <ISO>
|
|
1954
|
+
// --type file_save,cursor_move,...
|
|
1955
|
+
// --file <path>
|
|
1956
|
+
// --format text|json|markdown|compact
|
|
1957
|
+
// --group minute|hour|file|type
|
|
1958
|
+
// --limit <n>
|
|
1959
|
+
// --recent <n> (replay last N events, ignoring other filters)
|
|
1960
|
+
// --summary (just show session summary, no events)
|
|
1961
|
+
// --last (shorthand for --recent 50)
|
|
1962
|
+
const projectArg = args[1] || project;
|
|
1963
|
+
let sessionId;
|
|
1964
|
+
let since;
|
|
1965
|
+
let until;
|
|
1966
|
+
let eventTypes;
|
|
1967
|
+
let filePath;
|
|
1968
|
+
let filePattern;
|
|
1969
|
+
let format = 'text';
|
|
1970
|
+
let groupBy = 'none';
|
|
1971
|
+
let limit;
|
|
1972
|
+
let recent;
|
|
1973
|
+
let summaryOnly = false;
|
|
1974
|
+
for (let i = 2; i < args.length; i++) {
|
|
1975
|
+
const a = args[i];
|
|
1976
|
+
if (a === '--since' && i + 1 < args.length) {
|
|
1977
|
+
since = args[++i];
|
|
1978
|
+
continue;
|
|
1979
|
+
}
|
|
1980
|
+
if (a.startsWith('--since=')) {
|
|
1981
|
+
since = a.slice('--since='.length);
|
|
1982
|
+
continue;
|
|
1983
|
+
}
|
|
1984
|
+
if (a === '--until' && i + 1 < args.length) {
|
|
1985
|
+
until = args[++i];
|
|
1986
|
+
continue;
|
|
1987
|
+
}
|
|
1988
|
+
if (a.startsWith('--until=')) {
|
|
1989
|
+
until = a.slice('--until='.length);
|
|
1990
|
+
continue;
|
|
1991
|
+
}
|
|
1992
|
+
if (a === '--type' && i + 1 < args.length) {
|
|
1993
|
+
eventTypes = args[++i].split(',');
|
|
1994
|
+
continue;
|
|
1995
|
+
}
|
|
1996
|
+
if (a.startsWith('--type=')) {
|
|
1997
|
+
eventTypes = a.slice('--type='.length).split(',');
|
|
1998
|
+
continue;
|
|
1999
|
+
}
|
|
2000
|
+
if (a === '--file' && i + 1 < args.length) {
|
|
2001
|
+
filePath = args[++i];
|
|
2002
|
+
continue;
|
|
2003
|
+
}
|
|
2004
|
+
if (a.startsWith('--file=')) {
|
|
2005
|
+
filePath = a.slice('--file='.length);
|
|
2006
|
+
continue;
|
|
2007
|
+
}
|
|
2008
|
+
if (a === '--pattern' && i + 1 < args.length) {
|
|
2009
|
+
filePattern = args[++i];
|
|
2010
|
+
continue;
|
|
2011
|
+
}
|
|
2012
|
+
if (a.startsWith('--pattern=')) {
|
|
2013
|
+
filePattern = a.slice('--pattern='.length);
|
|
2014
|
+
continue;
|
|
2015
|
+
}
|
|
2016
|
+
if (a === '--format' && i + 1 < args.length) {
|
|
2017
|
+
format = args[++i];
|
|
2018
|
+
continue;
|
|
2019
|
+
}
|
|
2020
|
+
if (a.startsWith('--format=')) {
|
|
2021
|
+
format = a.slice('--format='.length);
|
|
2022
|
+
continue;
|
|
2023
|
+
}
|
|
2024
|
+
if (a === '--group' && i + 1 < args.length) {
|
|
2025
|
+
groupBy = args[++i];
|
|
2026
|
+
continue;
|
|
2027
|
+
}
|
|
2028
|
+
if (a.startsWith('--group=')) {
|
|
2029
|
+
groupBy = a.slice('--group='.length);
|
|
2030
|
+
continue;
|
|
2031
|
+
}
|
|
2032
|
+
if (a === '--limit' && i + 1 < args.length) {
|
|
2033
|
+
limit = parseInt(args[++i], 10);
|
|
2034
|
+
continue;
|
|
2035
|
+
}
|
|
2036
|
+
if (a.startsWith('--limit=')) {
|
|
2037
|
+
limit = parseInt(a.slice('--limit='.length), 10);
|
|
2038
|
+
continue;
|
|
2039
|
+
}
|
|
2040
|
+
if (a === '--recent' && i + 1 < args.length) {
|
|
2041
|
+
recent = parseInt(args[++i], 10);
|
|
2042
|
+
continue;
|
|
2043
|
+
}
|
|
2044
|
+
if (a.startsWith('--recent=')) {
|
|
2045
|
+
recent = parseInt(a.slice('--recent='.length), 10);
|
|
2046
|
+
continue;
|
|
2047
|
+
}
|
|
2048
|
+
if (a === '--last') {
|
|
2049
|
+
recent = 50;
|
|
2050
|
+
continue;
|
|
2051
|
+
}
|
|
2052
|
+
if (a === '--summary') {
|
|
2053
|
+
summaryOnly = true;
|
|
2054
|
+
continue;
|
|
2055
|
+
}
|
|
2056
|
+
if (a === '--session' && i + 1 < args.length) {
|
|
2057
|
+
sessionId = parseInt(args[++i], 10);
|
|
2058
|
+
continue;
|
|
2059
|
+
}
|
|
2060
|
+
if (a.startsWith('--session=')) {
|
|
2061
|
+
sessionId = parseInt(a.slice('--session='.length), 10);
|
|
2062
|
+
continue;
|
|
2063
|
+
}
|
|
2064
|
+
if (/^\d+$/.test(a) && sessionId === undefined) {
|
|
2065
|
+
sessionId = parseInt(a, 10);
|
|
2066
|
+
continue;
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
let result;
|
|
2070
|
+
try {
|
|
2071
|
+
const { replay, replayRecent, summarizeSession, renderSessionSummary } = require('../../01-context/sessions/replay');
|
|
2072
|
+
if (recent !== undefined) {
|
|
2073
|
+
result = replayRecent(projectArg, recent, format);
|
|
2074
|
+
}
|
|
2075
|
+
else {
|
|
2076
|
+
result = replay({
|
|
2077
|
+
project: projectArg,
|
|
2078
|
+
sessionId,
|
|
2079
|
+
eventTypes: eventTypes,
|
|
2080
|
+
since,
|
|
2081
|
+
until,
|
|
2082
|
+
filePath,
|
|
2083
|
+
filePattern,
|
|
2084
|
+
limit,
|
|
2085
|
+
format,
|
|
2086
|
+
groupBy,
|
|
2087
|
+
});
|
|
2088
|
+
}
|
|
2089
|
+
if (summaryOnly && sessionId !== undefined) {
|
|
2090
|
+
const summary = summarizeSession(projectArg, sessionId);
|
|
2091
|
+
if (!summary) {
|
|
2092
|
+
console.log(C.warn(` No session #${sessionId} found for project "${projectArg}".`));
|
|
2093
|
+
return;
|
|
2094
|
+
}
|
|
2095
|
+
console.log(renderSessionSummary(summary));
|
|
2096
|
+
return;
|
|
2097
|
+
}
|
|
2098
|
+
if (result.filteredCount === 0) {
|
|
2099
|
+
console.log(C.warn(` No${eventTypes ? ' ' + eventTypes.join(',') : ''} events to replay yet.`));
|
|
2100
|
+
console.log(C.dim(` Project: ${projectArg}`));
|
|
2101
|
+
console.log(C.dim(' Start capturing by running:'));
|
|
2102
|
+
console.log(C.primary(' cell scan'));
|
|
2103
|
+
console.log(C.primary(' cell session start --tool claude-code'));
|
|
2104
|
+
console.log(C.primary(' cell bridge start'));
|
|
2105
|
+
return;
|
|
2106
|
+
}
|
|
2107
|
+
console.log(result.formatted);
|
|
2108
|
+
}
|
|
2109
|
+
catch (e) {
|
|
2110
|
+
console.log(C.warn(' Replay failed: ' + (e?.message || String(e))));
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
// ─── cell continue — resume last session with full context ────────────────
|
|
2114
|
+
function doContinue() {
|
|
2115
|
+
// args[1] = project (optional, defaults to cwd)
|
|
2116
|
+
// args[2] = tool (optional, e.g. 'cursor', 'claude-code')
|
|
2117
|
+
// --tool <name> tool to format context for
|
|
2118
|
+
// --no-snapshot skip writing the session-end snapshot
|
|
2119
|
+
const projectArg = args[1] || project;
|
|
2120
|
+
let toolArg = args[2] || 'claude-code';
|
|
2121
|
+
let writeSnapshot = true;
|
|
2122
|
+
for (let i = 2; i < args.length; i++) {
|
|
2123
|
+
const a = args[i];
|
|
2124
|
+
if (a === '--tool' && i + 1 < args.length) {
|
|
2125
|
+
toolArg = args[++i];
|
|
2126
|
+
continue;
|
|
2127
|
+
}
|
|
2128
|
+
if (a.startsWith('--tool=')) {
|
|
2129
|
+
toolArg = a.slice('--tool='.length);
|
|
2130
|
+
continue;
|
|
2131
|
+
}
|
|
2132
|
+
if (a === '--no-snapshot') {
|
|
2133
|
+
writeSnapshot = false;
|
|
2134
|
+
continue;
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
try {
|
|
2138
|
+
const { SessionMemory } = require('../../01-context/sessions/session-memory');
|
|
2139
|
+
const { linkSessionToRecentEvents, recordSessionStart, recordSessionEnd, recordFileFocus } = require('../../01-context/sessions/event-capture');
|
|
2140
|
+
const { summarizeSession, renderSessionSummary } = require('../../01-context/sessions/replay');
|
|
2141
|
+
const { buildContext, formatContextForTool } = require('../../01-context/context/prompt-builder');
|
|
2142
|
+
const mem = new SessionMemory();
|
|
2143
|
+
// 1) Find the last session for this project
|
|
2144
|
+
const lastSession = mem.getLastSessionForProject(projectArg);
|
|
2145
|
+
if (!lastSession) {
|
|
2146
|
+
console.log(C.warn(' No previous session found for this project.'));
|
|
2147
|
+
console.log(C.dim(' Start one with:'));
|
|
2148
|
+
console.log(C.primary(' cell session start --tool claude-code'));
|
|
2149
|
+
console.log(C.dim(' Then: cell continue (resume anytime)'));
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2152
|
+
// 2) Show summary of the last session
|
|
2153
|
+
const summary = summarizeSession(projectArg, lastSession.id);
|
|
2154
|
+
if (summary) {
|
|
2155
|
+
console.log(C.bold(' ── Last Session ──'));
|
|
2156
|
+
console.log(renderSessionSummary(summary));
|
|
2157
|
+
console.log('');
|
|
2158
|
+
}
|
|
2159
|
+
// 3) Open a new session
|
|
2160
|
+
const newSessionId = mem.startSession(toolArg, projectArg);
|
|
2161
|
+
recordSessionStart({ project: projectArg, sessionId: newSessionId, toolName: toolArg });
|
|
2162
|
+
const linked = linkSessionToRecentEvents(projectArg, newSessionId, true);
|
|
2163
|
+
console.log(C.success(` ✓ New session #${newSessionId} started in ${toolArg}`));
|
|
2164
|
+
if (linked > 0) {
|
|
2165
|
+
console.log(C.dim(` Linked ${linked} recent events to this session`));
|
|
2166
|
+
}
|
|
2167
|
+
console.log('');
|
|
2168
|
+
// 4) Build and show the cross-tool context block
|
|
2169
|
+
try {
|
|
2170
|
+
const ctx = buildContext(projectArg, toolArg);
|
|
2171
|
+
const text = formatContextForTool(ctx, toolArg, projectArg);
|
|
2172
|
+
console.log(C.bold(' ── Context to inject ──'));
|
|
2173
|
+
console.log(text);
|
|
2174
|
+
}
|
|
2175
|
+
catch (e) {
|
|
2176
|
+
console.log(C.warn(' Could not build context (run cell scan first).'));
|
|
2177
|
+
}
|
|
2178
|
+
// 5) Print session ID for later use with `cell replay --session <id>`
|
|
2179
|
+
console.log('');
|
|
2180
|
+
console.log(C.dim(` To replay this session later: cell replay ${projectArg} ${newSessionId}`));
|
|
2181
|
+
console.log(C.dim(` To end this session: cell session end ${newSessionId} ${projectArg}`));
|
|
2182
|
+
}
|
|
2183
|
+
catch (e) {
|
|
2184
|
+
console.log(C.warn(' Continue failed: ' + (e?.message || String(e))));
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
// ─── cell bridge — bidirectional editor↔daemon socket ────────────────────
|
|
2188
|
+
function doBridge() {
|
|
2189
|
+
// args[1] = subcommand: start | stop | status | kill (default: status)
|
|
2190
|
+
// --port <n> port to bind (default 9877)
|
|
2191
|
+
// --host <ip> host to bind (default 127.0.0.1)
|
|
2192
|
+
// --foreground don't detach (default for tests/debug)
|
|
2193
|
+
const sub = args[1] || 'status';
|
|
2194
|
+
let port = 9877;
|
|
2195
|
+
let host = '127.0.0.1';
|
|
2196
|
+
for (let i = 2; i < args.length; i++) {
|
|
2197
|
+
const a = args[i];
|
|
2198
|
+
if (a === '--port' && i + 1 < args.length) {
|
|
2199
|
+
port = parseInt(args[++i], 10);
|
|
2200
|
+
continue;
|
|
2201
|
+
}
|
|
2202
|
+
if (a.startsWith('--port=')) {
|
|
2203
|
+
port = parseInt(a.slice('--port='.length), 10);
|
|
2204
|
+
continue;
|
|
2205
|
+
}
|
|
2206
|
+
if (a === '--host' && i + 1 < args.length) {
|
|
2207
|
+
host = args[++i];
|
|
2208
|
+
continue;
|
|
2209
|
+
}
|
|
2210
|
+
if (a.startsWith('--host=')) {
|
|
2211
|
+
host = a.slice('--host='.length);
|
|
2212
|
+
continue;
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
try {
|
|
2216
|
+
const { startBridge, stopBridge, getBridgeInfo, isBridgeRunning, killStaleBridge, discoverBridgePort, } = require('../watcher/socket-bridge');
|
|
2217
|
+
if (sub === 'start') {
|
|
2218
|
+
if (isBridgeRunning()) {
|
|
2219
|
+
const info = getBridgeInfo();
|
|
2220
|
+
console.log(C.warn(` Bridge already running on port ${info.port} (${info.clientCount} clients, ${info.totalEventsReceived} events received)`));
|
|
2221
|
+
return;
|
|
2222
|
+
}
|
|
2223
|
+
startBridge(port, host)
|
|
2224
|
+
.then((info) => {
|
|
2225
|
+
console.log(C.success(` ✓ Bridge started on ${info.host}:${info.port}`));
|
|
2226
|
+
console.log(C.dim(` Editors can connect to ws://${info.host}:${info.port} (newline-delimited JSON)`));
|
|
2227
|
+
console.log(C.dim(` To stop: cell bridge stop`));
|
|
2228
|
+
try {
|
|
2229
|
+
const { markBridgeStarted } = require('../setup/cell-state');
|
|
2230
|
+
markBridgeStarted();
|
|
2231
|
+
}
|
|
2232
|
+
catch { }
|
|
2233
|
+
})
|
|
2234
|
+
.catch((e) => {
|
|
2235
|
+
console.log(C.warn(' Bridge start failed: ' + e.message));
|
|
2236
|
+
});
|
|
2237
|
+
}
|
|
2238
|
+
else if (sub === 'stop') {
|
|
2239
|
+
const ok = stopBridge();
|
|
2240
|
+
if (ok) {
|
|
2241
|
+
console.log(C.success(' ✓ Bridge stopped'));
|
|
2242
|
+
}
|
|
2243
|
+
else {
|
|
2244
|
+
console.log(C.dim(' Bridge was not running'));
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
else if (sub === 'kill') {
|
|
2248
|
+
const killed = killStaleBridge();
|
|
2249
|
+
if (killed) {
|
|
2250
|
+
console.log(C.success(' ✓ Killed stale bridge process'));
|
|
2251
|
+
}
|
|
2252
|
+
else {
|
|
2253
|
+
console.log(C.dim(' No stale bridge found'));
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
else {
|
|
2257
|
+
// status
|
|
2258
|
+
const info = getBridgeInfo();
|
|
2259
|
+
const discovered = discoverBridgePort();
|
|
2260
|
+
const liveInfo = discovered && !info.running
|
|
2261
|
+
? { running: true, port: discovered, host: host, startedAt: C.dim('(another process)'), clientCount: -1, totalEventsReceived: -1, clients: [] }
|
|
2262
|
+
: info;
|
|
2263
|
+
const i = liveInfo;
|
|
2264
|
+
console.log(C.bold(' Cell Bridge'));
|
|
2265
|
+
console.log(' ───────────');
|
|
2266
|
+
console.log(` Running: ${i.running ? C.success('yes') : C.dim('no')}`);
|
|
2267
|
+
console.log(` Port: ${i.port}`);
|
|
2268
|
+
console.log(` Host: ${i.host}`);
|
|
2269
|
+
console.log(` Started: ${i.startedAt || C.dim('(never)')}`);
|
|
2270
|
+
console.log(` Clients: ${i.clientCount >= 0 ? i.clientCount : '?'}`);
|
|
2271
|
+
console.log(` Events rx: ${i.totalEventsReceived >= 0 ? i.totalEventsReceived : '?'}`);
|
|
2272
|
+
if (i.clients && i.clients.length > 0) {
|
|
2273
|
+
console.log('');
|
|
2274
|
+
console.log(C.dim(' Connected clients:'));
|
|
2275
|
+
for (const c of i.clients) {
|
|
2276
|
+
console.log(C.dim(` #${c.id} ${c.remoteAddress}:${c.remotePort} project=${c.project} events=${c.eventsReceived}`));
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
if (!info.running) {
|
|
2280
|
+
console.log('');
|
|
2281
|
+
console.log(C.dim(' To start: cell bridge start [--port 9877] [--host 127.0.0.1]'));
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
catch (e) {
|
|
2286
|
+
console.log(C.warn(' Bridge failed: ' + (e?.message || String(e))));
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
// ─── cell watch-editor (Feature #2: push active editor state to bridge) ────
|
|
2290
|
+
function monitorStatePath(project) {
|
|
2291
|
+
const os = require('os');
|
|
2292
|
+
const path = require('path');
|
|
2293
|
+
const fs = require('fs');
|
|
2294
|
+
const dir = path.join(os.tmpdir(), 'fivo-cell');
|
|
2295
|
+
if (!fs.existsSync(dir))
|
|
2296
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
2297
|
+
return path.join(dir, `watch-editor-${project}.json`);
|
|
2298
|
+
}
|
|
2299
|
+
function readMonitorState(project) {
|
|
2300
|
+
const fs = require('fs');
|
|
2301
|
+
const p = monitorStatePath(project);
|
|
2302
|
+
try {
|
|
2303
|
+
if (!fs.existsSync(p))
|
|
2304
|
+
return null;
|
|
2305
|
+
return JSON.parse(fs.readFileSync(p, 'utf8'));
|
|
2306
|
+
}
|
|
2307
|
+
catch {
|
|
2308
|
+
return null;
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
function writeMonitorState(project, data) {
|
|
2312
|
+
const fs = require('fs');
|
|
2313
|
+
try {
|
|
2314
|
+
fs.writeFileSync(monitorStatePath(project), JSON.stringify(data, null, 2));
|
|
2315
|
+
}
|
|
2316
|
+
catch { /* ignore */ }
|
|
2317
|
+
}
|
|
2318
|
+
function clearMonitorState(project) {
|
|
2319
|
+
const fs = require('fs');
|
|
2320
|
+
try {
|
|
2321
|
+
fs.unlinkSync(monitorStatePath(project));
|
|
2322
|
+
}
|
|
2323
|
+
catch { /* ignore */ }
|
|
2324
|
+
}
|
|
2325
|
+
function doWatchEditor() {
|
|
2326
|
+
const sub = (args[1] || 'status').toString();
|
|
2327
|
+
// Find --project=... flag, or fall back to positional args[2] or cwd basename
|
|
2328
|
+
const projectFlag = args.find((a) => typeof a === 'string' && a.startsWith('--project='));
|
|
2329
|
+
const project = projectFlag ? projectFlag.split('=')[1] : ((args[2] && !String(args[2]).startsWith('--')) ? String(args[2]) : path.basename(process.cwd()));
|
|
2330
|
+
const intervalArg = args.find((a) => typeof a === 'string' && a.startsWith('--interval='));
|
|
2331
|
+
const portArg = args.find((a) => typeof a === 'string' && a.startsWith('--port='));
|
|
2332
|
+
const hostArg = args.find((a) => typeof a === 'string' && a.startsWith('--host='));
|
|
2333
|
+
const interval = parseInt(intervalArg ? intervalArg.split('=')[1] : '3000', 10);
|
|
2334
|
+
let port = portArg ? parseInt(portArg.split('=')[1], 10) : null;
|
|
2335
|
+
const host = (hostArg ? hostArg.split('=')[1] : '127.0.0.1') || '127.0.0.1';
|
|
2336
|
+
// Try to discover bridge port from pid file if not specified
|
|
2337
|
+
if (port === null) {
|
|
2338
|
+
try {
|
|
2339
|
+
const { discoverBridgePort } = require('../watcher/socket-bridge');
|
|
2340
|
+
const discovered = discoverBridgePort();
|
|
2341
|
+
if (discovered)
|
|
2342
|
+
port = discovered;
|
|
2343
|
+
}
|
|
2344
|
+
catch { /* ignore */ }
|
|
2345
|
+
}
|
|
2346
|
+
if (port === null)
|
|
2347
|
+
port = 9877;
|
|
2348
|
+
try {
|
|
2349
|
+
const { EditorMonitor, getActiveWindow, parseTitleToState } = require('../watcher/editor-monitor');
|
|
2350
|
+
if (sub === 'start') {
|
|
2351
|
+
if (activeMonitor) {
|
|
2352
|
+
console.log(C.warn(' Monitor already running in this process'));
|
|
2353
|
+
return;
|
|
2354
|
+
}
|
|
2355
|
+
const prev = readMonitorState(project);
|
|
2356
|
+
if (prev && prev.running) {
|
|
2357
|
+
console.log(C.warn(` Monitor for "${project}" already started at ${prev.startTime}`));
|
|
2358
|
+
console.log(C.dim(' Use `cell watch-editor stop --project ' + project + '` first'));
|
|
2359
|
+
return;
|
|
2360
|
+
}
|
|
2361
|
+
const monitor = new EditorMonitor({
|
|
2362
|
+
project,
|
|
2363
|
+
intervalMs: interval,
|
|
2364
|
+
bridgeHost: host,
|
|
2365
|
+
bridgePort: port,
|
|
2366
|
+
fileBaseDir: process.cwd(),
|
|
2367
|
+
watchFiles: true,
|
|
2368
|
+
onState: (s) => {
|
|
2369
|
+
if (process.env.CELL_VERBOSE) {
|
|
2370
|
+
console.log(C.dim(` [${new Date().toISOString()}] ${s.editorName}: ${s.filePath} [${s.isDirty ? 'unsaved' : 'clean'}]`));
|
|
2371
|
+
}
|
|
2372
|
+
},
|
|
2373
|
+
onError: (e) => {
|
|
2374
|
+
if (process.env.CELL_VERBOSE)
|
|
2375
|
+
console.error(C.warn(' ' + e.message));
|
|
2376
|
+
},
|
|
2377
|
+
onSkip: (reason) => {
|
|
2378
|
+
if (process.env.CELL_VERBOSE)
|
|
2379
|
+
console.log(C.dim(' skip: ' + reason));
|
|
2380
|
+
},
|
|
2381
|
+
});
|
|
2382
|
+
monitor.start();
|
|
2383
|
+
activeMonitor = monitor;
|
|
2384
|
+
monitorStateFile = project;
|
|
2385
|
+
writeMonitorState(project, { running: true, startTime: new Date().toISOString(), pid: process.pid, project, port, host, interval });
|
|
2386
|
+
console.log(C.success(` Watch-editor started for project "${project}"`));
|
|
2387
|
+
console.log(C.dim(` Bridge: ${host}:${port} | Interval: ${interval}ms`));
|
|
2388
|
+
console.log(C.dim(' State will appear in `cell context ' + project + '`'));
|
|
2389
|
+
console.log(C.dim(' Press Ctrl+C to stop'));
|
|
2390
|
+
// Keep the process alive
|
|
2391
|
+
process.on('SIGINT', () => {
|
|
2392
|
+
console.log(C.dim('\n Stopping watch-editor...'));
|
|
2393
|
+
if (activeMonitor)
|
|
2394
|
+
activeMonitor.stop();
|
|
2395
|
+
clearMonitorState(project);
|
|
2396
|
+
process.exit(0);
|
|
2397
|
+
});
|
|
2398
|
+
process.on('SIGTERM', () => {
|
|
2399
|
+
if (activeMonitor)
|
|
2400
|
+
activeMonitor.stop();
|
|
2401
|
+
clearMonitorState(project);
|
|
2402
|
+
process.exit(0);
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2405
|
+
else if (sub === 'stop') {
|
|
2406
|
+
if (activeMonitor) {
|
|
2407
|
+
activeMonitor.stop();
|
|
2408
|
+
activeMonitor = null;
|
|
2409
|
+
}
|
|
2410
|
+
clearMonitorState(project);
|
|
2411
|
+
console.log(C.success(` Watch-editor stopped for "${project}"`));
|
|
2412
|
+
}
|
|
2413
|
+
else if (sub === 'status') {
|
|
2414
|
+
const local = activeMonitor ? activeMonitor.getInfo() : null;
|
|
2415
|
+
const saved = readMonitorState(project);
|
|
2416
|
+
if (local) {
|
|
2417
|
+
console.log(C.bold(` Watch-editor (in-process) — ${project}`));
|
|
2418
|
+
console.log(` Running: ${C.success('yes')}`);
|
|
2419
|
+
console.log(` Started: ${local.startTime}`);
|
|
2420
|
+
console.log(` Polls: ${local.pollsCompleted}`);
|
|
2421
|
+
console.log(` Detected: ${local.statesDetected}`);
|
|
2422
|
+
console.log(` Pushed: ${local.statesPushed}`);
|
|
2423
|
+
console.log(` Bridge: ${local.bridgeConnected ? C.success('connected') : C.warn('not connected')}`);
|
|
2424
|
+
if (local.lastState) {
|
|
2425
|
+
console.log(` Last: ${local.lastState.editorName} → ${local.lastState.filePath}${local.lastState.isDirty ? ' [unsaved]' : ''}`);
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
else if (saved) {
|
|
2429
|
+
console.log(C.bold(` Watch-editor (saved state) — ${project}`));
|
|
2430
|
+
console.log(` Started: ${saved.startTime}`);
|
|
2431
|
+
console.log(` PID: ${saved.pid}${saved.pid && !isPidAlive(saved.pid) ? C.warn(' (not running)') : ''}`);
|
|
2432
|
+
console.log(` Bridge: ${saved.host}:${saved.port}`);
|
|
2433
|
+
console.log(` Interval: ${saved.interval}ms`);
|
|
2434
|
+
}
|
|
2435
|
+
else {
|
|
2436
|
+
console.log(C.dim(` No watch-editor session for "${project}"`));
|
|
2437
|
+
console.log(C.dim(' Start with: cell watch-editor start --project ' + project));
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
else if (sub === 'check') {
|
|
2441
|
+
// One-shot check — useful for testing
|
|
2442
|
+
getActiveWindow().then((win) => {
|
|
2443
|
+
if (!win) {
|
|
2444
|
+
console.log(C.dim(' No active window detected'));
|
|
2445
|
+
return;
|
|
2446
|
+
}
|
|
2447
|
+
console.log(` Active: ${win.processName} (PID ${win.pid})`);
|
|
2448
|
+
console.log(` Title: ${win.title}`);
|
|
2449
|
+
const state = parseTitleToState(win.title, win.processName, project, process.cwd());
|
|
2450
|
+
if (state) {
|
|
2451
|
+
console.log(C.success(' Parsed:'));
|
|
2452
|
+
console.log(` editor: ${state.editorName}`);
|
|
2453
|
+
console.log(` file: ${state.filePath}`);
|
|
2454
|
+
console.log(` line: ${state.line}`);
|
|
2455
|
+
console.log(` dirty: ${state.isDirty}`);
|
|
2456
|
+
console.log(` lang: ${state.language || 'unknown'}`);
|
|
2457
|
+
}
|
|
2458
|
+
else {
|
|
2459
|
+
console.log(C.warn(' Could not parse title into editor state'));
|
|
2460
|
+
}
|
|
2461
|
+
});
|
|
2462
|
+
}
|
|
2463
|
+
else {
|
|
2464
|
+
console.log(C.dim(' Usage: cell watch-editor <start|stop|status|check> [--project NAME] [--interval 3000] [--port 9877] [--host 127.0.0.1]'));
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
catch (e) {
|
|
2468
|
+
console.log(C.warn(' watch-editor failed: ' + (e?.message || String(e))));
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
// ─── cell mcp-config (Pre-Launch: auto-register all IDEs) ────────────────────
|
|
2472
|
+
/**
|
|
2473
|
+
* Auto-write MCP config for every supported IDE. Detects which config files
|
|
2474
|
+
* exist and creates/updates the cell MCP entry in each.
|
|
2475
|
+
*
|
|
2476
|
+
* Supported IDEs:
|
|
2477
|
+
* - Cursor: ~/.cursor/mcp.json
|
|
2478
|
+
* - Gemini CLI: ~/.gemini/settings.json
|
|
2479
|
+
* - Antigravity: ~/.gemini/config/mcp_config.json
|
|
2480
|
+
* - Codex: ~/.codex/config.json
|
|
2481
|
+
* - OpenCode: ~/.config/opencode/opencode.jsonc
|
|
2482
|
+
*/
|
|
2483
|
+
function doMcpConfig() {
|
|
2484
|
+
console.log();
|
|
2485
|
+
console.log(C.bold(' Cell MCP Auto-Config'));
|
|
2486
|
+
console.log(C.dim(' ─────────────────────'));
|
|
2487
|
+
console.log();
|
|
2488
|
+
const { writeMcpConfig, getMcpTargets } = require('../../../core/mcp-config');
|
|
2489
|
+
const homedir = os.homedir();
|
|
2490
|
+
const targets = getMcpTargets(homedir);
|
|
2491
|
+
const result = writeMcpConfig(homedir);
|
|
2492
|
+
for (const t of targets) {
|
|
2493
|
+
if (result.written.includes(t.configPath)) {
|
|
2494
|
+
const action = fs.existsSync(t.configPath) ? 'updated' : 'created';
|
|
2495
|
+
console.log(` ${C.success('✓')} ${t.name.padEnd(14)} ${C.dim(action)} — ${t.configPath}`);
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
for (const s of result.skipped) {
|
|
2499
|
+
console.log(` ${C.warn('!')} ${s.name}: ${s.reason}`);
|
|
2500
|
+
}
|
|
2501
|
+
console.log();
|
|
2502
|
+
console.log(` ${C.success('Done')}: ${result.written.length} config file${result.written.length === 1 ? '' : 's'} written`);
|
|
2503
|
+
if (result.skipped.length > 0)
|
|
2504
|
+
console.log(C.dim(` ${result.skipped.length} skipped (parse errors)`));
|
|
2505
|
+
console.log();
|
|
2506
|
+
console.log(C.dim(' Restart your IDE to load the new MCP config.'));
|
|
2507
|
+
console.log(C.dim(' Make sure `cell start` is running for tools to connect.'));
|
|
2508
|
+
console.log();
|
|
2509
|
+
}
|
|
2510
|
+
// ─── cell repl (interactive mode with tab completion) ────────────────────────
|
|
2511
|
+
/**
|
|
2512
|
+
* Interactive REPL — opened by `cell` (no args) in a TTY, or by `cell repl`.
|
|
2513
|
+
* User types a command (with or without leading `/`), press Enter to run.
|
|
2514
|
+
* Type `/` then Tab to see all commands. Type `exit`/`quit` to leave.
|
|
2515
|
+
*
|
|
2516
|
+
* Tab completion: when the input starts with `/`, returns matching commands.
|
|
2517
|
+
* Otherwise no completion (user is typing a command name without prefix).
|
|
2518
|
+
*/
|
|
2519
|
+
function showReplHelp() {
|
|
2520
|
+
console.log();
|
|
2521
|
+
console.log(C.bold(' Commands:'));
|
|
2522
|
+
console.log(C.dim(' ────────'));
|
|
2523
|
+
for (const [name, desc] of cli_repl_1.REPL_COMMANDS) {
|
|
2524
|
+
const padded = name.padEnd(14);
|
|
2525
|
+
console.log(` ${C.primary('/' + padded)} ${C.dim(desc)}`);
|
|
2526
|
+
}
|
|
2527
|
+
console.log();
|
|
2528
|
+
console.log(C.dim(' Type a command and press Enter. Use /<TAB> to filter.'));
|
|
2529
|
+
console.log(C.dim(' Tab completion works after `/` — try typing `/s` then Tab.'));
|
|
2530
|
+
console.log();
|
|
2531
|
+
}
|
|
2532
|
+
function doRepl() {
|
|
2533
|
+
// Only run if stdin is a TTY. If piped (e.g. `echo help | cell`), fall back to status.
|
|
2534
|
+
if (!process.stdin.isTTY) {
|
|
2535
|
+
doStatus();
|
|
2536
|
+
return;
|
|
2537
|
+
}
|
|
2538
|
+
const readline = require('readline');
|
|
2539
|
+
const { spawn } = require('child_process');
|
|
2540
|
+
const pathMod = require('path');
|
|
2541
|
+
// Show banner
|
|
2542
|
+
console.log();
|
|
2543
|
+
const banner = figlet_1.default.textSync('CELL', { font: 'ANSI Shadow', horizontalLayout: 'fitted' });
|
|
2544
|
+
console.log((0, gradient_string_1.default)(['#FF6B35', '#FFAB91'])(banner));
|
|
2545
|
+
console.log(C.dim(' Interactive REPL — type a command, / for list, exit to quit'));
|
|
2546
|
+
console.log();
|
|
2547
|
+
// First-run greeting
|
|
2548
|
+
try {
|
|
2549
|
+
const { firstRunGreeting } = require('../setup/first-run');
|
|
2550
|
+
firstRunGreeting();
|
|
2551
|
+
}
|
|
2552
|
+
catch { }
|
|
2553
|
+
const rl = readline.createInterface({
|
|
2554
|
+
input: process.stdin,
|
|
2555
|
+
output: process.stdout,
|
|
2556
|
+
prompt: C.primary('cell> '),
|
|
2557
|
+
completer: cli_repl_1.replCompleter,
|
|
2558
|
+
terminal: true,
|
|
2559
|
+
});
|
|
2560
|
+
// Track command history
|
|
2561
|
+
const historyFile = pathMod.join(os.homedir(), '.fivo', 'cell', 'repl_history');
|
|
2562
|
+
try {
|
|
2563
|
+
const fsMod = require('fs');
|
|
2564
|
+
if (fsMod.existsSync(historyFile)) {
|
|
2565
|
+
const lines = fsMod.readFileSync(historyFile, 'utf8').split('\n').filter(Boolean);
|
|
2566
|
+
// readline.history is an array; pushing to it adds to up-arrow memory
|
|
2567
|
+
for (const l of lines)
|
|
2568
|
+
rl.history.push(l);
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
catch { }
|
|
2572
|
+
const persistHistory = () => {
|
|
2573
|
+
try {
|
|
2574
|
+
const fsMod = require('fs');
|
|
2575
|
+
const pathMod2 = require('path');
|
|
2576
|
+
fsMod.mkdirSync(pathMod2.dirname(historyFile), { recursive: true });
|
|
2577
|
+
// Keep last 100 commands
|
|
2578
|
+
const recent = rl.history.slice(-100);
|
|
2579
|
+
fsMod.writeFileSync(historyFile, recent.join('\n') + '\n', 'utf8');
|
|
2580
|
+
}
|
|
2581
|
+
catch { }
|
|
2582
|
+
};
|
|
2583
|
+
rl.prompt();
|
|
2584
|
+
rl.on('line', (line) => {
|
|
2585
|
+
const trimmed = line.trim();
|
|
2586
|
+
if (!trimmed) {
|
|
2587
|
+
rl.prompt();
|
|
2588
|
+
return;
|
|
2589
|
+
}
|
|
2590
|
+
// Handle exit
|
|
2591
|
+
if (trimmed === 'exit' || trimmed === 'quit' || trimmed === 'q') {
|
|
2592
|
+
persistHistory();
|
|
2593
|
+
console.log(C.dim(' Bye!'));
|
|
2594
|
+
rl.close();
|
|
2595
|
+
return;
|
|
2596
|
+
}
|
|
2597
|
+
// Strip leading `/` if present
|
|
2598
|
+
const cmd = (0, cli_repl_1.stripSlash)(trimmed);
|
|
2599
|
+
// In-REPL help (no spawn overhead)
|
|
2600
|
+
if (cmd === 'help' || cmd === '?') {
|
|
2601
|
+
showReplHelp();
|
|
2602
|
+
rl.prompt();
|
|
2603
|
+
return;
|
|
2604
|
+
}
|
|
2605
|
+
// In-REPL version (avoid child spawn for trivial info)
|
|
2606
|
+
if (cmd === 'version' || cmd === '--version' || cmd === '-v') {
|
|
2607
|
+
try {
|
|
2608
|
+
const pkg = require('../../../../package.json');
|
|
2609
|
+
console.log(`${C.primary('cell')} v${C.num(pkg.version)}`);
|
|
2610
|
+
}
|
|
2611
|
+
catch { }
|
|
2612
|
+
rl.prompt();
|
|
2613
|
+
return;
|
|
2614
|
+
}
|
|
2615
|
+
// Validate the command is known (so typos get a hint instead of a silent no-op)
|
|
2616
|
+
const firstToken = cmd.split(/\s+/)[0];
|
|
2617
|
+
if (!(0, cli_repl_1.isKnownCommand)(firstToken)) {
|
|
2618
|
+
console.log(C.warn(` Unknown command: ${firstToken}`));
|
|
2619
|
+
console.log(C.dim(' Type `help` for the list, or `/` then Tab.'));
|
|
2620
|
+
console.log();
|
|
2621
|
+
rl.prompt();
|
|
2622
|
+
return;
|
|
2623
|
+
}
|
|
2624
|
+
// Spawn cell <cmd> as child process (shares stdio so output is real-time)
|
|
2625
|
+
const cellPath = pathMod.join(__dirname, 'cli.js');
|
|
2626
|
+
const childArgs = cmd.split(/\s+/);
|
|
2627
|
+
const child = spawn(process.execPath, [cellPath, ...childArgs], {
|
|
2628
|
+
stdio: 'inherit',
|
|
2629
|
+
});
|
|
2630
|
+
child.on('exit', (code) => {
|
|
2631
|
+
if (code !== 0 && code !== null) {
|
|
2632
|
+
console.log(C.dim(` (exit ${code})`));
|
|
2633
|
+
}
|
|
2634
|
+
console.log();
|
|
2635
|
+
rl.prompt();
|
|
2636
|
+
});
|
|
2637
|
+
child.on('error', (err) => {
|
|
2638
|
+
console.log(C.warn(` Failed to run command: ${err.message}`));
|
|
2639
|
+
console.log();
|
|
2640
|
+
rl.prompt();
|
|
2641
|
+
});
|
|
2642
|
+
});
|
|
2643
|
+
rl.on('close', () => {
|
|
2644
|
+
persistHistory();
|
|
2645
|
+
console.log();
|
|
2646
|
+
process.exit(0);
|
|
2647
|
+
});
|
|
2648
|
+
}
|
|
2649
|
+
// ─── cell switch-back ──────────────────────────────────────────────────────
|
|
2650
|
+
function doSwitchBack() {
|
|
2651
|
+
const switchArgs = process.argv.slice(3);
|
|
2652
|
+
const branch = switchArgs[0];
|
|
2653
|
+
if (!branch) {
|
|
2654
|
+
console.log();
|
|
2655
|
+
console.log(C.bold(' Branch Context Recovery'));
|
|
2656
|
+
console.log(C.dim(' ──────────────────────'));
|
|
2657
|
+
console.log();
|
|
2658
|
+
console.log(' Usage: cell switch-back <branch-name>');
|
|
2659
|
+
console.log();
|
|
2660
|
+
console.log(' Shows saved context for a branch (goal, files, errors, decisions).');
|
|
2661
|
+
console.log();
|
|
2662
|
+
console.log(' Examples:');
|
|
2663
|
+
console.log(' cell switch-back feature-auth');
|
|
2664
|
+
console.log(' cell switch-back fix/login-bug');
|
|
2665
|
+
console.log();
|
|
2666
|
+
return;
|
|
2667
|
+
}
|
|
2668
|
+
console.log();
|
|
2669
|
+
console.log(C.bold(` Branch: ${branch}`));
|
|
2670
|
+
console.log(C.dim(' ──────────────────────'));
|
|
2671
|
+
console.log();
|
|
2672
|
+
let project = path.basename(process.cwd());
|
|
2673
|
+
try {
|
|
2674
|
+
const { detectProject } = require('../setup/setup');
|
|
2675
|
+
const detected = detectProject(process.cwd());
|
|
2676
|
+
project = detected.name;
|
|
2677
|
+
}
|
|
2678
|
+
catch { }
|
|
2679
|
+
// Try real saved context first
|
|
2680
|
+
try {
|
|
2681
|
+
const { loadBranchSnapshot } = require('../../03-knowledge/decisions/branch-snapshot');
|
|
2682
|
+
const snapshot = loadBranchSnapshot(project, branch);
|
|
2683
|
+
if (snapshot) {
|
|
2684
|
+
if (snapshot.goal)
|
|
2685
|
+
console.log(` Goal: ${C.primary(snapshot.goal)}`);
|
|
2686
|
+
if (snapshot.filesTouched && snapshot.filesTouched.length > 0) {
|
|
2687
|
+
console.log(` Files: ${C.num(String(snapshot.filesTouched.length))} touched`);
|
|
2688
|
+
for (const f of snapshot.filesTouched.slice(0, 8)) {
|
|
2689
|
+
console.log(C.dim(` - ${f}`));
|
|
2690
|
+
}
|
|
2691
|
+
if (snapshot.filesTouched.length > 8) {
|
|
2692
|
+
console.log(C.dim(` ... ${snapshot.filesTouched.length - 8} more`));
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
if (snapshot.pendingTasks && snapshot.pendingTasks.length > 0) {
|
|
2696
|
+
console.log(` Pending: ${snapshot.pendingTasks.length} task(s)`);
|
|
2697
|
+
for (const t of snapshot.pendingTasks.slice(0, 5)) {
|
|
2698
|
+
console.log(C.warn(` ! ${t}`));
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
if (snapshot.recentErrors && snapshot.recentErrors.length > 0) {
|
|
2702
|
+
console.log(` Errors: ${snapshot.recentErrors.length} recent`);
|
|
2703
|
+
for (const e of snapshot.recentErrors.slice(0, 3)) {
|
|
2704
|
+
console.log(C.warn(` x ${e}`));
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
if (snapshot.recentDecisions && snapshot.recentDecisions.length > 0) {
|
|
2708
|
+
console.log(` Recent commits:`);
|
|
2709
|
+
for (const d of snapshot.recentDecisions.slice(0, 5)) {
|
|
2710
|
+
console.log(C.dim(` - ${d}`));
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2713
|
+
if (snapshot.lastActiveAt) {
|
|
2714
|
+
console.log(C.dim(` Last active: ${snapshot.lastActiveAt}`));
|
|
2715
|
+
}
|
|
2716
|
+
console.log();
|
|
2717
|
+
console.log(C.dim(' Restore context:'));
|
|
2718
|
+
console.log(' 1. git checkout ' + branch);
|
|
2719
|
+
console.log(' 2. cell context');
|
|
2720
|
+
console.log();
|
|
2721
|
+
return;
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
catch { }
|
|
2725
|
+
// Fallback to name parser
|
|
2726
|
+
const { GitBranchPreGenerator } = require('../../03-knowledge/decisions/git-branch-pregenerator');
|
|
2727
|
+
const gen = new GitBranchPreGenerator();
|
|
2728
|
+
const summary = gen.getIntentSummary(branch);
|
|
2729
|
+
const parsed = gen.parseBranchName(branch);
|
|
2730
|
+
console.log(C.dim(' (No saved context for this branch — showing inferred intent)'));
|
|
2731
|
+
console.log();
|
|
2732
|
+
console.log(` Type: ${C.primary(parsed.type)}`);
|
|
2733
|
+
console.log(` Intent: ${parsed.intent}`);
|
|
2734
|
+
console.log(` Summary: ${summary}`);
|
|
2735
|
+
console.log();
|
|
2736
|
+
const patterns = gen.generateFiles(branch, [], 'typescript');
|
|
2737
|
+
if (patterns.length > 0) {
|
|
2738
|
+
console.log(C.dim(' Expected files:'));
|
|
2739
|
+
for (const f of patterns) {
|
|
2740
|
+
console.log(` ${C.primary(f.path)} (${f.type})`);
|
|
2741
|
+
}
|
|
2742
|
+
console.log();
|
|
2743
|
+
}
|
|
2744
|
+
console.log(C.dim(' Save real context by running:'));
|
|
2745
|
+
console.log(C.primary(' cell scan'));
|
|
2746
|
+
console.log(C.primary(' cell context'));
|
|
2747
|
+
console.log();
|
|
2748
|
+
console.log(C.dim(' Restore context:'));
|
|
2749
|
+
console.log(' 1. git checkout ' + branch);
|
|
2750
|
+
console.log(' 2. cell context');
|
|
2751
|
+
console.log();
|
|
2752
|
+
}
|
|
2753
|
+
// ─── cell branches ──────────────────────────────────────────────────────────
|
|
2754
|
+
function doBranches() {
|
|
2755
|
+
console.log();
|
|
2756
|
+
console.log(C.bold(' Known Branches'));
|
|
2757
|
+
console.log(C.dim(' ──────────────'));
|
|
2758
|
+
console.log();
|
|
2759
|
+
let project = path.basename(process.cwd());
|
|
2760
|
+
try {
|
|
2761
|
+
const { detectProject } = require('../setup/setup');
|
|
2762
|
+
const detected = detectProject(process.cwd());
|
|
2763
|
+
project = detected.name;
|
|
2764
|
+
}
|
|
2765
|
+
catch { }
|
|
2766
|
+
try {
|
|
2767
|
+
const { listBranchSnapshots } = require('../../03-knowledge/decisions/branch-snapshot');
|
|
2768
|
+
const snapshots = listBranchSnapshots(project);
|
|
2769
|
+
if (snapshots.length === 0) {
|
|
2770
|
+
console.log(C.dim(' No branch context saved yet.'));
|
|
2771
|
+
console.log();
|
|
2772
|
+
console.log(C.dim(' Save context by running cell scan or cell context on a branch.'));
|
|
2773
|
+
console.log();
|
|
2774
|
+
return;
|
|
2775
|
+
}
|
|
2776
|
+
for (const s of snapshots) {
|
|
2777
|
+
const active = s.lastActiveAt ? s.lastActiveAt.slice(0, 10) : 'unknown';
|
|
2778
|
+
const goalStr = s.goal ? ` — ${s.goal}` : '';
|
|
2779
|
+
const fileCount = s.filesTouched?.length || 0;
|
|
2780
|
+
console.log(` ${C.primary(s.branch)}${goalStr}`);
|
|
2781
|
+
console.log(C.dim(` Last active: ${active} | Files: ${fileCount} | Commits: ${s.recentDecisions?.length || 0}`));
|
|
2782
|
+
}
|
|
2783
|
+
console.log();
|
|
2784
|
+
console.log(C.dim(` ${snapshots.length} branch(es) tracked. Run cell switch-back <branch> for details.`));
|
|
2785
|
+
}
|
|
2786
|
+
catch (err) {
|
|
2787
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
2788
|
+
console.log(C.warn(` Branch list failed: ${msg}`));
|
|
2789
|
+
}
|
|
2790
|
+
// Also show git branches
|
|
2791
|
+
try {
|
|
2792
|
+
const { execSync } = require('child_process');
|
|
2793
|
+
const gitBranches = execSync('git branch --list', { encoding: 'utf8' }).trim();
|
|
2794
|
+
if (gitBranches) {
|
|
2795
|
+
console.log();
|
|
2796
|
+
console.log(C.dim(' Git branches:'));
|
|
2797
|
+
for (const line of gitBranches.split('\n').filter(Boolean)) {
|
|
2798
|
+
console.log(C.dim(` ${line}`));
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
catch { }
|
|
2803
|
+
console.log();
|
|
2804
|
+
}
|
|
2805
|
+
// ─── cell lessons ──────────────────────────────────────────────────────────
|
|
2806
|
+
function doLessons() {
|
|
2807
|
+
const { getAvoidSuggestions, getFailureStats, getAllFailureRecords } = require('../../03-knowledge/decisions/failure-memory');
|
|
2808
|
+
const lessonArgs = process.argv.slice(3);
|
|
2809
|
+
const topic = lessonArgs[0];
|
|
2810
|
+
let lessonProject = project;
|
|
2811
|
+
try {
|
|
2812
|
+
const { detectProject } = require('../setup/setup');
|
|
2813
|
+
lessonProject = detectProject().name;
|
|
2814
|
+
}
|
|
2815
|
+
catch { }
|
|
2816
|
+
console.log();
|
|
2817
|
+
console.log(C.bold(' Engineering Lessons'));
|
|
2818
|
+
console.log(C.dim(' ──────────────────'));
|
|
2819
|
+
console.log();
|
|
2820
|
+
const stats = getFailureStats(lessonProject);
|
|
2821
|
+
if (stats.totalTracked === 0) {
|
|
2822
|
+
console.log(C.warn(' No lessons recorded yet.'));
|
|
2823
|
+
console.log();
|
|
2824
|
+
console.log(C.dim(' Lessons are learned from pattern rejections during:'));
|
|
2825
|
+
console.log(C.dim(' - AI code suggestions'));
|
|
2826
|
+
console.log(C.dim(' - Code review feedback'));
|
|
2827
|
+
console.log(C.dim(' - Scanner repeat issues'));
|
|
2828
|
+
console.log();
|
|
2829
|
+
console.log(C.dim(' Start collecting:'));
|
|
2830
|
+
console.log(C.primary(' cell scan'));
|
|
2831
|
+
console.log(C.primary(' cell blindspots --top'));
|
|
2832
|
+
return;
|
|
2833
|
+
}
|
|
2834
|
+
console.log(` Tracked: ${stats.totalTracked} patterns`);
|
|
2835
|
+
console.log(` Critical: ${stats.criticalCount} | High: ${stats.highCount} | Medium: ${stats.mediumCount} | Low: ${stats.lowCount}`);
|
|
2836
|
+
console.log(` Avg failure rate: ${Math.round(stats.avgFailureRate * 100)}%`);
|
|
2837
|
+
console.log();
|
|
2838
|
+
const suggestions = getAvoidSuggestions(0.5, lessonProject);
|
|
2839
|
+
if (topic) {
|
|
2840
|
+
const filtered = suggestions.filter((s) => s.description.toLowerCase().includes(topic.toLowerCase()) ||
|
|
2841
|
+
s.patternId.toLowerCase().includes(topic.toLowerCase()));
|
|
2842
|
+
if (filtered.length === 0) {
|
|
2843
|
+
console.log(` No lessons found for "${topic}".`);
|
|
2844
|
+
}
|
|
2845
|
+
else {
|
|
2846
|
+
console.log(C.bold(` Lessons for "${topic}":`));
|
|
2847
|
+
console.log();
|
|
2848
|
+
for (const s of filtered.slice(0, 10)) {
|
|
2849
|
+
const icon = s.severity === 'critical' ? '!!!' : s.severity === 'high' ? '!!' : s.severity === 'medium' ? '!' : '-';
|
|
2850
|
+
console.log(` ${C.warn(icon)} ${s.description}`);
|
|
2851
|
+
console.log(` Failure rate: ${Math.round(s.failureRate * 100)}% (${s.severity})`);
|
|
2852
|
+
console.log(` ${s.alternativeDescription}`);
|
|
2853
|
+
console.log();
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
else {
|
|
2858
|
+
if (suggestions.length === 0) {
|
|
2859
|
+
console.log(' No lessons to show yet. Keep building!');
|
|
2860
|
+
}
|
|
2861
|
+
else {
|
|
2862
|
+
console.log(C.bold(' Top lessons (patterns to avoid):'));
|
|
2863
|
+
console.log();
|
|
2864
|
+
for (const s of suggestions.slice(0, 10)) {
|
|
2865
|
+
const icon = s.severity === 'critical' ? '!!!' : s.severity === 'high' ? '!!' : s.severity === 'medium' ? '!' : '-';
|
|
2866
|
+
console.log(` ${C.warn(icon)} ${s.description}`);
|
|
2867
|
+
console.log(` Failure rate: ${Math.round(s.failureRate * 100)}% (${s.severity})`);
|
|
2868
|
+
console.log(` ${s.alternativeDescription}`);
|
|
2869
|
+
console.log();
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
console.log(C.dim(' Use: cell lessons <topic> to filter by topic'));
|
|
2874
|
+
console.log();
|
|
2875
|
+
}
|
|
2876
|
+
// ─── cell evolution ────────────────────────────────────────────────────────
|
|
2877
|
+
function doEvolution() {
|
|
2878
|
+
const { buildJourneyReport, saveJourneyReport } = require('../../03-knowledge/decisions/journey-memory');
|
|
2879
|
+
const evoArgs = process.argv.slice(3);
|
|
2880
|
+
const dir = evoArgs[0] || process.cwd();
|
|
2881
|
+
const showStack = evoArgs.includes('--stack');
|
|
2882
|
+
let evoProject = project;
|
|
2883
|
+
try {
|
|
2884
|
+
const { detectProject } = require('../setup/setup');
|
|
2885
|
+
evoProject = detectProject(dir).name;
|
|
2886
|
+
}
|
|
2887
|
+
catch {
|
|
2888
|
+
try {
|
|
2889
|
+
const pkgPath = require('path').join(dir, 'package.json');
|
|
2890
|
+
const pkg = JSON.parse(require('fs').readFileSync(pkgPath, 'utf-8'));
|
|
2891
|
+
if (pkg.name)
|
|
2892
|
+
evoProject = pkg.name;
|
|
2893
|
+
}
|
|
2894
|
+
catch { }
|
|
2895
|
+
}
|
|
2896
|
+
console.log();
|
|
2897
|
+
console.log(C.bold(' Project Evolution Map'));
|
|
2898
|
+
console.log(C.dim(' ────────────────────'));
|
|
2899
|
+
console.log();
|
|
2900
|
+
if (showStack) {
|
|
2901
|
+
try {
|
|
2902
|
+
const rows = (0, database_1.getDb)().prepare(`SELECT stack_json, file_count, line_count, scanned_at FROM stack_history WHERE LOWER(project) = LOWER(?) ORDER BY scanned_at ASC`).all(evoProject);
|
|
2903
|
+
if (rows.length === 0) {
|
|
2904
|
+
console.log(C.dim(' No stack history yet. Run: cell scan'));
|
|
2905
|
+
}
|
|
2906
|
+
else {
|
|
2907
|
+
console.log(C.bold(' Stack Timeline:'));
|
|
2908
|
+
console.log();
|
|
2909
|
+
let prevStack = '';
|
|
2910
|
+
for (const row of rows) {
|
|
2911
|
+
const date = String(row.scanned_at).slice(0, 10);
|
|
2912
|
+
let langs = {};
|
|
2913
|
+
try {
|
|
2914
|
+
langs = JSON.parse(String(row.stack_json));
|
|
2915
|
+
}
|
|
2916
|
+
catch { }
|
|
2917
|
+
const langList = Object.entries(langs).sort((a, b) => b[1] - a[1]).slice(0, 5).map(([l, c]) => `${l}(${c})`).join(', ');
|
|
2918
|
+
const currentStack = Object.keys(langs).sort().join(',');
|
|
2919
|
+
const changed = prevStack && prevStack !== currentStack;
|
|
2920
|
+
const marker = changed ? C.warn('CHANGED') : C.dim('same');
|
|
2921
|
+
console.log(` ${date} ${langList || 'unknown'} ${row.file_count} files ${row.line_count} lines ${marker}`);
|
|
2922
|
+
prevStack = currentStack;
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
catch (e) {
|
|
2927
|
+
console.log(C.warn(` Stack history failed: ${e?.message || String(e)}`));
|
|
2928
|
+
}
|
|
2929
|
+
console.log();
|
|
2930
|
+
return;
|
|
2931
|
+
}
|
|
2932
|
+
console.log(' Building journey report...');
|
|
2933
|
+
try {
|
|
2934
|
+
const report = buildJourneyReport(dir);
|
|
2935
|
+
const savedPath = saveJourneyReport(report);
|
|
2936
|
+
console.log();
|
|
2937
|
+
console.log(C.bold(' Summary'));
|
|
2938
|
+
console.log(` Projects: ${report.summary.totalProjects}`);
|
|
2939
|
+
console.log(` Active since: ${report.summary.activeSince}`);
|
|
2940
|
+
console.log(` Languages: ${report.summary.languagesLearned}`);
|
|
2941
|
+
console.log(` Total commits: ${report.summary.totalCommits}`);
|
|
2942
|
+
console.log(` Top language: ${report.summary.mostUsedLanguage}`);
|
|
2943
|
+
console.log(` Top skill: ${report.summary.topSkill}`);
|
|
2944
|
+
console.log(` Growth: ${report.summary.growthRate}`);
|
|
2945
|
+
console.log();
|
|
2946
|
+
if (report.skills.length > 0) {
|
|
2947
|
+
console.log(C.bold(' Skill Progression'));
|
|
2948
|
+
console.log();
|
|
2949
|
+
for (const s of report.skills.slice(0, 8)) {
|
|
2950
|
+
const bar = '█'.repeat(Math.min(s.metrics.cleanFileRatio / 10, 10));
|
|
2951
|
+
console.log(` ${s.area.padEnd(15)} ${s.currentLevel.padEnd(14)} ${bar} ${s.metrics.cleanFileRatio}% clean`);
|
|
2952
|
+
}
|
|
2953
|
+
console.log();
|
|
2954
|
+
}
|
|
2955
|
+
if (report.chains.length > 0) {
|
|
2956
|
+
console.log(C.bold(' Reused Patterns'));
|
|
2957
|
+
console.log();
|
|
2958
|
+
for (const c of report.chains.slice(0, 5)) {
|
|
2959
|
+
console.log(` ${c.pattern} (${Math.round(c.successRate * 100)}% success)`);
|
|
2960
|
+
console.log(` Used in: ${c.firstUsed.project}${c.reusedIn.length > 0 ? ', ' + c.reusedIn.map((r) => r.project).join(', ') : ''}`);
|
|
2961
|
+
}
|
|
2962
|
+
console.log();
|
|
2963
|
+
}
|
|
2964
|
+
if (report.goals.recommendations.length > 0) {
|
|
2965
|
+
console.log(C.bold(' Recommendations'));
|
|
2966
|
+
console.log();
|
|
2967
|
+
for (const rec of report.goals.recommendations.slice(0, 5)) {
|
|
2968
|
+
console.log(` -> ${rec}`);
|
|
2969
|
+
}
|
|
2970
|
+
console.log();
|
|
2971
|
+
}
|
|
2972
|
+
console.log(C.dim(` Full report: ${savedPath}`));
|
|
2973
|
+
console.log(C.dim(' Also saved as: ~/.fivo/cell/journey.md'));
|
|
2974
|
+
console.log();
|
|
2975
|
+
}
|
|
2976
|
+
catch (e) {
|
|
2977
|
+
console.log(C.warn(` Failed to build evolution map: ${e instanceof Error ? e.message : String(e)}`));
|
|
2978
|
+
console.log();
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
// ─── cell help ──────────────────────────────────────────────────────────────
|
|
2982
|
+
function doHelp() {
|
|
2983
|
+
console.log();
|
|
2984
|
+
console.log(C.bold(' Cell Commands'));
|
|
2985
|
+
console.log(C.dim(' ─────────────'));
|
|
2986
|
+
console.log();
|
|
2987
|
+
console.log(` ${C.primary('cell start')} Start daemon + MCP (port 9876) — re-run safe`);
|
|
2988
|
+
console.log(` ${C.primary('cell stop')} Stop daemon`);
|
|
2989
|
+
console.log(` ${C.primary('cell setup')} One-time project setup: scan + watcher + MCP (idempotent)`);
|
|
2990
|
+
console.log(` ${C.primary('cell doctor')} Health check — diagnose what's missing and how to fix`);
|
|
2991
|
+
console.log(` ${C.primary('cell --version')} Print version + daemon status`);
|
|
2992
|
+
console.log(` ${C.primary('cell mcp-config')} Auto-register cell MCP in Cursor/Antigravity/Codex/OpenCode`);
|
|
2993
|
+
console.log(` ${C.primary('cell scan')} Scan codebase + build layers`);
|
|
2994
|
+
console.log(` ${C.primary('cell analyze')} AI prompts from scan data`);
|
|
2995
|
+
console.log(` ${C.primary('cell status')} What Cell knows about you`);
|
|
2996
|
+
console.log(` ${C.primary('cell status --session')} Last touched file + patterns (Pre-Launch Test 1)`);
|
|
2997
|
+
console.log(` ${C.primary('cell status --decisions')} Recent decisions with verdict (Pre-Launch Test 3)`);
|
|
2998
|
+
console.log(` ${C.primary('cell session')} Same as cell status --session`);
|
|
2999
|
+
console.log(` ${C.primary('cell decisions')} Same as cell status --decisions`);
|
|
3000
|
+
console.log(` ${C.primary('cell team')} Team collaboration (git-based)`);
|
|
3001
|
+
console.log(` ${C.primary('cell community')} Community patterns + benchmarks`);
|
|
3002
|
+
console.log(` ${C.primary('cell watch [start|stop|events|check|status] [proj] [dir]')} Live file watcher`);
|
|
3003
|
+
console.log(` ${C.primary('cell watch daemon [proj] [dir]')} Run as long-lived watcher (for .bat)`);
|
|
3004
|
+
console.log(` ${C.primary('cell blindspots [dir] [maxFiles]')} Scan for blind spots (15+ types)`);
|
|
3005
|
+
console.log(` ${C.primary('cell blindspots --top [N]')} Show top N prioritized fixes (default 5)`);
|
|
3006
|
+
console.log(` ${C.primary('cell context [project] [tool] [--short|--full]')} Inject @cell context block`);
|
|
3007
|
+
console.log(` ${C.primary('cell switch-back <branch>')} Restore branch context`);
|
|
3008
|
+
console.log(` ${C.primary('cell branches')} List known branches with last context`);
|
|
3009
|
+
console.log(` ${C.primary('cell lessons [topic]')} Engineering lessons from failures`);
|
|
3010
|
+
console.log(` ${C.primary('cell evolution [dir] [--stack]')} Project evolution map + stack timeline`);
|
|
3011
|
+
console.log(` ${C.primary('cell focus [dir]')} Focus report — active/stalled/abandoned projects`);
|
|
3012
|
+
console.log(` ${C.primary('cell why <topic>')} Search decisions by topic`);
|
|
3013
|
+
console.log(` ${C.primary('cell repl')} Interactive REPL with / completion (or just run \`cell\` in a TTY)`);
|
|
3014
|
+
console.log(` ${C.primary('cell help')} Show this help`);
|
|
3015
|
+
console.log();
|
|
3016
|
+
console.log(C.dim(' Install: npm i -g fivocell'));
|
|
3017
|
+
console.log(C.dim(' Then: cell start'));
|
|
3018
|
+
console.log();
|
|
3019
|
+
}
|
|
3020
|
+
// ─── cell focus ────────────────────────────────────────────────────────────
|
|
3021
|
+
function doFocus() {
|
|
3022
|
+
const { buildFocusReport, renderFocusMd } = require('../../03-knowledge/decisions/focus-report');
|
|
3023
|
+
const focusArgs = process.argv.slice(3);
|
|
3024
|
+
const rootDir = focusArgs[0] || path.dirname(process.cwd());
|
|
3025
|
+
const asJson = focusArgs.includes('--json');
|
|
3026
|
+
console.log();
|
|
3027
|
+
console.log(C.bold(' Focus Report — Project Activity'));
|
|
3028
|
+
console.log(C.dim(' ───────────────────────────────'));
|
|
3029
|
+
console.log();
|
|
3030
|
+
try {
|
|
3031
|
+
const report = buildFocusReport(rootDir);
|
|
3032
|
+
if (asJson) {
|
|
3033
|
+
console.log(JSON.stringify(report, null, 2));
|
|
3034
|
+
return;
|
|
3035
|
+
}
|
|
3036
|
+
console.log(` Total: ${report.totalProjects} projects`);
|
|
3037
|
+
console.log(` Active: ${C.success(String(report.active))} | Stalled: ${C.warn(String(report.stalled))} | Abandoned: ${C.primary(String(report.abandoned))} | Fresh: ${report.fresh}`);
|
|
3038
|
+
console.log();
|
|
3039
|
+
if (report.topPicks.length > 0) {
|
|
3040
|
+
console.log(C.bold(' Keep doing this:'));
|
|
3041
|
+
for (const p of report.topPicks) {
|
|
3042
|
+
console.log(` ${C.success('>>')} ${p.name} — ${p.reason}`);
|
|
3043
|
+
}
|
|
3044
|
+
console.log();
|
|
3045
|
+
}
|
|
3046
|
+
if (report.shouldPause.length > 0) {
|
|
3047
|
+
console.log(C.bold(' Pause / Decide:'));
|
|
3048
|
+
for (const p of report.shouldPause) {
|
|
3049
|
+
console.log(` ${C.warn('??')} ${p.name} (${p.lastModifiedDays}d silent) — ${p.reason}`);
|
|
3050
|
+
}
|
|
3051
|
+
console.log();
|
|
3052
|
+
}
|
|
3053
|
+
if (report.shouldArchive.length > 0) {
|
|
3054
|
+
console.log(C.bold(' Archive:'));
|
|
3055
|
+
for (const p of report.shouldArchive) {
|
|
3056
|
+
console.log(` ${C.dim('..')} ${p.name} (${p.lastModifiedDays}d silent) — ${p.reason}`);
|
|
3057
|
+
}
|
|
3058
|
+
console.log();
|
|
3059
|
+
}
|
|
3060
|
+
if (report.shouldResurrect.length > 0) {
|
|
3061
|
+
console.log(C.bold(' Resurrect:'));
|
|
3062
|
+
for (const p of report.shouldResurrect) {
|
|
3063
|
+
console.log(` ${C.primary('!!')} ${p.name} (${p.lastModifiedDays}d silent) — ${p.reason}`);
|
|
3064
|
+
}
|
|
3065
|
+
console.log();
|
|
3066
|
+
}
|
|
3067
|
+
if (report.overallAdvice.length > 0) {
|
|
3068
|
+
console.log(C.bold(' Advice:'));
|
|
3069
|
+
for (const a of report.overallAdvice) {
|
|
3070
|
+
console.log(` ${C.dim('>')} ${a}`);
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
}
|
|
3074
|
+
catch (e) {
|
|
3075
|
+
console.log(C.warn(` Focus report failed: ${e?.message || String(e)}`));
|
|
3076
|
+
console.log(C.dim(' Tip: run from a parent directory containing multiple projects'));
|
|
3077
|
+
}
|
|
3078
|
+
console.log();
|
|
3079
|
+
}
|
|
3080
|
+
// ─── cell why <topic> ──────────────────────────────────────────────────────
|
|
3081
|
+
function doWhy() {
|
|
3082
|
+
const whyArgs = process.argv.slice(3);
|
|
3083
|
+
const topic = whyArgs[0];
|
|
3084
|
+
if (!topic) {
|
|
3085
|
+
console.log();
|
|
3086
|
+
console.log(C.bold(' Cell Why — Decision Search'));
|
|
3087
|
+
console.log(C.dim(' ───────────────────────────'));
|
|
3088
|
+
console.log();
|
|
3089
|
+
console.log(C.dim(' Usage: cell why <topic>'));
|
|
3090
|
+
console.log(C.dim(' Example: cell why typescript'));
|
|
3091
|
+
console.log(C.dim(' Example: cell why testing'));
|
|
3092
|
+
console.log();
|
|
3093
|
+
return;
|
|
3094
|
+
}
|
|
3095
|
+
const db = (0, database_1.getDb)();
|
|
3096
|
+
console.log();
|
|
3097
|
+
console.log(C.bold(` Why — Decisions about "${topic}"`));
|
|
3098
|
+
console.log(C.dim(' ─────────────────────────────'));
|
|
3099
|
+
console.log();
|
|
3100
|
+
const likeTopic = `%${topic}%`;
|
|
3101
|
+
try {
|
|
3102
|
+
const decisionRows = db.prepare(`
|
|
3103
|
+
SELECT technology, reason, outcome, was_right, project, created_at
|
|
3104
|
+
FROM decisions
|
|
3105
|
+
WHERE technology LIKE ? OR reason LIKE ? OR outcome LIKE ?
|
|
3106
|
+
ORDER BY created_at DESC LIMIT 10
|
|
3107
|
+
`).all(likeTopic, likeTopic, likeTopic);
|
|
3108
|
+
const decisionOutcomeRows = db.prepare(`
|
|
3109
|
+
SELECT technology, reason, outcome, was_right, confidence, context, project, created_at
|
|
3110
|
+
FROM decision_outcomes
|
|
3111
|
+
WHERE technology LIKE ? OR reason LIKE ? OR outcome LIKE ? OR context LIKE ?
|
|
3112
|
+
ORDER BY created_at DESC LIMIT 10
|
|
3113
|
+
`).all(likeTopic, likeTopic, likeTopic, likeTopic);
|
|
3114
|
+
const logRows = db.prepare(`
|
|
3115
|
+
SELECT decision, approach, result, worked, file_path as file, decided_at
|
|
3116
|
+
FROM decision_log
|
|
3117
|
+
WHERE decision LIKE ? OR approach LIKE ? OR result LIKE ?
|
|
3118
|
+
ORDER BY decided_at DESC LIMIT 10
|
|
3119
|
+
`).all(likeTopic, likeTopic, likeTopic);
|
|
3120
|
+
let found = 0;
|
|
3121
|
+
if (decisionRows.length > 0) {
|
|
3122
|
+
console.log(C.bold(' Technology Decisions:'));
|
|
3123
|
+
for (const r of decisionRows) {
|
|
3124
|
+
const verdict = Number(r.was_right) ? C.success('Right') : C.warn('Wrong');
|
|
3125
|
+
console.log(` ${verdict} ${r.technology || r.reason}`);
|
|
3126
|
+
if (r.reason)
|
|
3127
|
+
console.log(C.dim(` Reason: ${r.reason}`));
|
|
3128
|
+
if (r.outcome)
|
|
3129
|
+
console.log(C.dim(` Outcome: ${r.outcome}`));
|
|
3130
|
+
if (r.project)
|
|
3131
|
+
console.log(C.dim(` Project: ${r.project}`));
|
|
3132
|
+
console.log();
|
|
3133
|
+
}
|
|
3134
|
+
found += decisionRows.length;
|
|
3135
|
+
}
|
|
3136
|
+
if (decisionOutcomeRows.length > 0) {
|
|
3137
|
+
console.log(C.bold(' Decision Outcomes:'));
|
|
3138
|
+
for (const r of decisionOutcomeRows) {
|
|
3139
|
+
const verdict = Number(r.was_right) ? C.success('Right') : C.warn('Wrong');
|
|
3140
|
+
console.log(` ${verdict} ${r.technology || r.reason}`);
|
|
3141
|
+
if (r.reason)
|
|
3142
|
+
console.log(C.dim(` Reason: ${r.reason}`));
|
|
3143
|
+
if (r.outcome)
|
|
3144
|
+
console.log(C.dim(` Outcome: ${r.outcome}`));
|
|
3145
|
+
if (r.context)
|
|
3146
|
+
console.log(C.dim(` Context: ${r.context}`));
|
|
3147
|
+
if (r.confidence)
|
|
3148
|
+
console.log(C.dim(` Confidence: ${r.confidence}%`));
|
|
3149
|
+
console.log();
|
|
3150
|
+
}
|
|
3151
|
+
found += decisionOutcomeRows.length;
|
|
3152
|
+
}
|
|
3153
|
+
if (logRows.length > 0) {
|
|
3154
|
+
console.log(C.bold(' Session Decisions:'));
|
|
3155
|
+
for (const r of logRows) {
|
|
3156
|
+
const verdict = Number(r.worked) ? C.success('Worked') : C.warn("Didn't");
|
|
3157
|
+
console.log(` ${verdict} ${r.decision}`);
|
|
3158
|
+
if (r.approach)
|
|
3159
|
+
console.log(C.dim(` Approach: ${r.approach}`));
|
|
3160
|
+
if (r.result)
|
|
3161
|
+
console.log(C.dim(` Result: ${r.result}`));
|
|
3162
|
+
if (r.file)
|
|
3163
|
+
console.log(C.dim(` File: ${r.file}`));
|
|
3164
|
+
console.log();
|
|
3165
|
+
}
|
|
3166
|
+
found += logRows.length;
|
|
3167
|
+
}
|
|
3168
|
+
if (found === 0) {
|
|
3169
|
+
console.log(C.dim(` No decisions found about "${topic}".`));
|
|
3170
|
+
console.log();
|
|
3171
|
+
console.log(C.dim(' Decisions are logged when you:'));
|
|
3172
|
+
console.log(C.dim(' - Accept/reject AI suggestions in your IDE'));
|
|
3173
|
+
console.log(C.dim(' - Run cell scan + cell setup'));
|
|
3174
|
+
console.log(C.dim(' - Use the decision MCP tool'));
|
|
3175
|
+
}
|
|
3176
|
+
}
|
|
3177
|
+
catch (e) {
|
|
3178
|
+
console.log(C.warn(` Search failed: ${e?.message || String(e)}`));
|
|
3179
|
+
}
|
|
3180
|
+
console.log();
|
|
3181
|
+
}
|
|
3182
|
+
// test touch 14:40:59
|
|
3183
|
+
//# sourceMappingURL=cli.js.map
|