fivocell 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/CONTRIBUTING.md +60 -0
- package/LICENSE +98 -0
- package/README.md +267 -0
- package/bin/cell.js +2 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1131 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/ab-test-framework.d.ts +33 -0
- package/dist/core/ab-test-framework.d.ts.map +1 -0
- package/dist/core/ab-test-framework.js +93 -0
- package/dist/core/ab-test-framework.js.map +1 -0
- package/dist/core/ast-extractor.d.ts +10 -0
- package/dist/core/ast-extractor.d.ts.map +1 -0
- package/dist/core/ast-extractor.js +111 -0
- package/dist/core/ast-extractor.js.map +1 -0
- package/dist/core/build-failure-predictor.d.ts +25 -0
- package/dist/core/build-failure-predictor.d.ts.map +1 -0
- package/dist/core/build-failure-predictor.js +124 -0
- package/dist/core/build-failure-predictor.js.map +1 -0
- package/dist/core/cell-pro.d.ts +28 -0
- package/dist/core/cell-pro.d.ts.map +1 -0
- package/dist/core/cell-pro.js +70 -0
- package/dist/core/cell-pro.js.map +1 -0
- package/dist/core/circular-dependency-detector.d.ts +22 -0
- package/dist/core/circular-dependency-detector.d.ts.map +1 -0
- package/dist/core/circular-dependency-detector.js +95 -0
- package/dist/core/circular-dependency-detector.js.map +1 -0
- package/dist/core/cloud-client.d.ts +40 -0
- package/dist/core/cloud-client.d.ts.map +1 -0
- package/dist/core/cloud-client.js +126 -0
- package/dist/core/cloud-client.js.map +1 -0
- package/dist/core/community-full.d.ts +38 -0
- package/dist/core/community-full.d.ts.map +1 -0
- package/dist/core/community-full.js +125 -0
- package/dist/core/community-full.js.map +1 -0
- package/dist/core/community-live.d.ts +31 -0
- package/dist/core/community-live.d.ts.map +1 -0
- package/dist/core/community-live.js +187 -0
- package/dist/core/community-live.js.map +1 -0
- package/dist/core/community-prior.d.ts +25 -0
- package/dist/core/community-prior.d.ts.map +1 -0
- package/dist/core/community-prior.js +181 -0
- package/dist/core/community-prior.js.map +1 -0
- package/dist/core/complexity-analyzer.d.ts +28 -0
- package/dist/core/complexity-analyzer.d.ts.map +1 -0
- package/dist/core/complexity-analyzer.js +110 -0
- package/dist/core/complexity-analyzer.js.map +1 -0
- package/dist/core/confidence-engine.d.ts +16 -0
- package/dist/core/confidence-engine.d.ts.map +1 -0
- package/dist/core/confidence-engine.js +155 -0
- package/dist/core/confidence-engine.js.map +1 -0
- package/dist/core/config-attribution.d.ts +30 -0
- package/dist/core/config-attribution.d.ts.map +1 -0
- package/dist/core/config-attribution.js +288 -0
- package/dist/core/config-attribution.js.map +1 -0
- package/dist/core/conflict-detector.d.ts +43 -0
- package/dist/core/conflict-detector.d.ts.map +1 -0
- package/dist/core/conflict-detector.js +205 -0
- package/dist/core/conflict-detector.js.map +1 -0
- package/dist/core/context-restore.d.ts +25 -0
- package/dist/core/context-restore.d.ts.map +1 -0
- package/dist/core/context-restore.js +129 -0
- package/dist/core/context-restore.js.map +1 -0
- package/dist/core/cross-domain-projections.d.ts +19 -0
- package/dist/core/cross-domain-projections.d.ts.map +1 -0
- package/dist/core/cross-domain-projections.js +69 -0
- package/dist/core/cross-domain-projections.js.map +1 -0
- package/dist/core/cross-language-mappings.d.ts +15 -0
- package/dist/core/cross-language-mappings.d.ts.map +1 -0
- package/dist/core/cross-language-mappings.js +202 -0
- package/dist/core/cross-language-mappings.js.map +1 -0
- package/dist/core/cross-project-sync.d.ts +24 -0
- package/dist/core/cross-project-sync.d.ts.map +1 -0
- package/dist/core/cross-project-sync.js +132 -0
- package/dist/core/cross-project-sync.js.map +1 -0
- package/dist/core/dead-code-detector.d.ts +20 -0
- package/dist/core/dead-code-detector.d.ts.map +1 -0
- package/dist/core/dead-code-detector.js +106 -0
- package/dist/core/dead-code-detector.js.map +1 -0
- package/dist/core/decay-engine.d.ts +14 -0
- package/dist/core/decay-engine.d.ts.map +1 -0
- package/dist/core/decay-engine.js +41 -0
- package/dist/core/decay-engine.js.map +1 -0
- package/dist/core/dependency-health-checker.d.ts +23 -0
- package/dist/core/dependency-health-checker.d.ts.map +1 -0
- package/dist/core/dependency-health-checker.js +94 -0
- package/dist/core/dependency-health-checker.js.map +1 -0
- package/dist/core/duplication-detector.d.ts +29 -0
- package/dist/core/duplication-detector.d.ts.map +1 -0
- package/dist/core/duplication-detector.js +115 -0
- package/dist/core/duplication-detector.js.map +1 -0
- package/dist/core/enterprise-features.d.ts +32 -0
- package/dist/core/enterprise-features.d.ts.map +1 -0
- package/dist/core/enterprise-features.js +87 -0
- package/dist/core/enterprise-features.js.map +1 -0
- package/dist/core/enterprise.d.ts +27 -0
- package/dist/core/enterprise.d.ts.map +1 -0
- package/dist/core/enterprise.js +41 -0
- package/dist/core/enterprise.js.map +1 -0
- package/dist/core/error-predictor.d.ts +16 -0
- package/dist/core/error-predictor.d.ts.map +1 -0
- package/dist/core/error-predictor.js +123 -0
- package/dist/core/error-predictor.js.map +1 -0
- package/dist/core/extraction-cascade.d.ts +18 -0
- package/dist/core/extraction-cascade.d.ts.map +1 -0
- package/dist/core/extraction-cascade.js +48 -0
- package/dist/core/extraction-cascade.js.map +1 -0
- package/dist/core/git-branch-pregenerator.d.ts +23 -0
- package/dist/core/git-branch-pregenerator.d.ts.map +1 -0
- package/dist/core/git-branch-pregenerator.js +100 -0
- package/dist/core/git-branch-pregenerator.js.map +1 -0
- package/dist/core/handoff-detector.d.ts +24 -0
- package/dist/core/handoff-detector.d.ts.map +1 -0
- package/dist/core/handoff-detector.js +116 -0
- package/dist/core/handoff-detector.js.map +1 -0
- package/dist/core/identity-resolver.d.ts +7 -0
- package/dist/core/identity-resolver.d.ts.map +1 -0
- package/dist/core/identity-resolver.js +82 -0
- package/dist/core/identity-resolver.js.map +1 -0
- package/dist/core/interruption-recovery.d.ts +26 -0
- package/dist/core/interruption-recovery.d.ts.map +1 -0
- package/dist/core/interruption-recovery.js +135 -0
- package/dist/core/interruption-recovery.js.map +1 -0
- package/dist/core/knowledge-silo-detector.d.ts +20 -0
- package/dist/core/knowledge-silo-detector.d.ts.map +1 -0
- package/dist/core/knowledge-silo-detector.js +117 -0
- package/dist/core/knowledge-silo-detector.js.map +1 -0
- package/dist/core/language-switch-assistant.d.ts +18 -0
- package/dist/core/language-switch-assistant.d.ts.map +1 -0
- package/dist/core/language-switch-assistant.js +98 -0
- package/dist/core/language-switch-assistant.js.map +1 -0
- package/dist/core/merge-conflict-predictor.d.ts +18 -0
- package/dist/core/merge-conflict-predictor.d.ts.map +1 -0
- package/dist/core/merge-conflict-predictor.js +98 -0
- package/dist/core/merge-conflict-predictor.js.map +1 -0
- package/dist/core/model-intelligence.d.ts +24 -0
- package/dist/core/model-intelligence.d.ts.map +1 -0
- package/dist/core/model-intelligence.js +73 -0
- package/dist/core/model-intelligence.js.map +1 -0
- package/dist/core/next-action-predictor.d.ts +26 -0
- package/dist/core/next-action-predictor.d.ts.map +1 -0
- package/dist/core/next-action-predictor.js +136 -0
- package/dist/core/next-action-predictor.js.map +1 -0
- package/dist/core/offline-queue.d.ts +40 -0
- package/dist/core/offline-queue.d.ts.map +1 -0
- package/dist/core/offline-queue.js +193 -0
- package/dist/core/offline-queue.js.map +1 -0
- package/dist/core/pattern-store.d.ts +27 -0
- package/dist/core/pattern-store.d.ts.map +1 -0
- package/dist/core/pattern-store.js +233 -0
- package/dist/core/pattern-store.js.map +1 -0
- package/dist/core/performance-predictor.d.ts +16 -0
- package/dist/core/performance-predictor.d.ts.map +1 -0
- package/dist/core/performance-predictor.js +111 -0
- package/dist/core/performance-predictor.js.map +1 -0
- package/dist/core/platt-calibration.d.ts +18 -0
- package/dist/core/platt-calibration.d.ts.map +1 -0
- package/dist/core/platt-calibration.js +89 -0
- package/dist/core/platt-calibration.js.map +1 -0
- package/dist/core/pr-review-assistant.d.ts +17 -0
- package/dist/core/pr-review-assistant.d.ts.map +1 -0
- package/dist/core/pr-review-assistant.js +85 -0
- package/dist/core/pr-review-assistant.js.map +1 -0
- package/dist/core/prompt-conditioner.d.ts +10 -0
- package/dist/core/prompt-conditioner.d.ts.map +1 -0
- package/dist/core/prompt-conditioner.js +54 -0
- package/dist/core/prompt-conditioner.js.map +1 -0
- package/dist/core/realtime-guardian.d.ts +19 -0
- package/dist/core/realtime-guardian.d.ts.map +1 -0
- package/dist/core/realtime-guardian.js +64 -0
- package/dist/core/realtime-guardian.js.map +1 -0
- package/dist/core/regex-extractor.d.ts +10 -0
- package/dist/core/regex-extractor.d.ts.map +1 -0
- package/dist/core/regex-extractor.js +141 -0
- package/dist/core/regex-extractor.js.map +1 -0
- package/dist/core/scale-tester.d.ts +20 -0
- package/dist/core/scale-tester.d.ts.map +1 -0
- package/dist/core/scale-tester.js +79 -0
- package/dist/core/scale-tester.js.map +1 -0
- package/dist/core/security-predictor.d.ts +15 -0
- package/dist/core/security-predictor.d.ts.map +1 -0
- package/dist/core/security-predictor.js +91 -0
- package/dist/core/security-predictor.js.map +1 -0
- package/dist/core/session-recovery.d.ts +19 -0
- package/dist/core/session-recovery.d.ts.map +1 -0
- package/dist/core/session-recovery.js +138 -0
- package/dist/core/session-recovery.js.map +1 -0
- package/dist/core/signal-capture.d.ts +22 -0
- package/dist/core/signal-capture.d.ts.map +1 -0
- package/dist/core/signal-capture.js +76 -0
- package/dist/core/signal-capture.js.map +1 -0
- package/dist/core/solution-index.d.ts +33 -0
- package/dist/core/solution-index.d.ts.map +1 -0
- package/dist/core/solution-index.js +175 -0
- package/dist/core/solution-index.js.map +1 -0
- package/dist/core/standup-generator.d.ts +17 -0
- package/dist/core/standup-generator.d.ts.map +1 -0
- package/dist/core/standup-generator.js +84 -0
- package/dist/core/standup-generator.js.map +1 -0
- package/dist/core/team-composer.d.ts +29 -0
- package/dist/core/team-composer.d.ts.map +1 -0
- package/dist/core/team-composer.js +150 -0
- package/dist/core/team-composer.js.map +1 -0
- package/dist/core/test-anticipator.d.ts +17 -0
- package/dist/core/test-anticipator.d.ts.map +1 -0
- package/dist/core/test-anticipator.js +113 -0
- package/dist/core/test-anticipator.js.map +1 -0
- package/dist/daemon/lifecycle.d.ts +19 -0
- package/dist/daemon/lifecycle.d.ts.map +1 -0
- package/dist/daemon/lifecycle.js +199 -0
- package/dist/daemon/lifecycle.js.map +1 -0
- package/dist/daemon/server.d.ts +81 -0
- package/dist/daemon/server.d.ts.map +1 -0
- package/dist/daemon/server.js +505 -0
- package/dist/daemon/server.js.map +1 -0
- package/dist/daemon/watchdog.d.ts +2 -0
- package/dist/daemon/watchdog.d.ts.map +1 -0
- package/dist/daemon/watchdog.js +93 -0
- package/dist/daemon/watchdog.js.map +1 -0
- package/dist/daemon/websocket.d.ts +5 -0
- package/dist/daemon/websocket.d.ts.map +1 -0
- package/dist/daemon/websocket.js +90 -0
- package/dist/daemon/websocket.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +90 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +88 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +28 -0
- package/dist/types.js.map +1 -0
- package/extensions/jetbrains/plugin.json +9 -0
- package/extensions/shell/copilot-sync.js +59 -0
- package/extensions/shell/install.sh +38 -0
- package/extensions/shell/watcher.js +113 -0
- package/extensions/vscode/.vscodeignore +5 -0
- package/extensions/vscode/dist/daemon-client.js +94 -0
- package/extensions/vscode/dist/diff-tracker.js +94 -0
- package/extensions/vscode/dist/extension.js +100 -0
- package/extensions/vscode/dist/status-bar.js +70 -0
- package/extensions/vscode/package-lock.json +40 -0
- package/extensions/vscode/package.json +27 -0
- package/package.json +53 -0
- package/packages/mcp-server/dist/server.d.ts +2 -0
- package/packages/mcp-server/dist/server.js +213 -0
- package/packages/mcp-server/package-lock.json +970 -0
- package/packages/mcp-server/package.json +19 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,1131 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
const commander_1 = require("commander");
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
40
|
+
const os = __importStar(require("os"));
|
|
41
|
+
const index_1 = require("./index");
|
|
42
|
+
const program = new commander_1.Command();
|
|
43
|
+
program
|
|
44
|
+
.name('cell')
|
|
45
|
+
.description('FIVO Cell ā Anticipatory Intelligence. Learns your coding taste.')
|
|
46
|
+
.version('1.0.0');
|
|
47
|
+
program
|
|
48
|
+
.command('init')
|
|
49
|
+
.description('Initialize FIVO Cell in the current project')
|
|
50
|
+
.action(() => {
|
|
51
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
52
|
+
if (!fs.existsSync(cellDir)) {
|
|
53
|
+
fs.mkdirSync(cellDir, { recursive: true });
|
|
54
|
+
}
|
|
55
|
+
const store = new index_1.PatternStore(cellDir);
|
|
56
|
+
store.save();
|
|
57
|
+
console.log('ā
FIVO Cell initialized.');
|
|
58
|
+
console.log(` Directory: ${cellDir}`);
|
|
59
|
+
console.log('');
|
|
60
|
+
console.log('š Cloud Sync: ON (Anonymous pattern stats only)');
|
|
61
|
+
console.log(' ā Better suggestions from 10K+ developers');
|
|
62
|
+
console.log(' ā Your code NEVER leaves your machine');
|
|
63
|
+
console.log(' ā What we share (just stats, no code):');
|
|
64
|
+
console.log(' "prefers const over let (92%)"');
|
|
65
|
+
console.log(' "uses named exports, not default (88%)"');
|
|
66
|
+
console.log(' "vitest over jest (95%)"');
|
|
67
|
+
console.log(' "pnpm over npm (90%)"');
|
|
68
|
+
console.log(' ā No file paths. No project names. No source code.');
|
|
69
|
+
console.log(' ā Turn off anytime: cell cloud off');
|
|
70
|
+
console.log('');
|
|
71
|
+
console.log(' Run `cell status` to see your taste profile.');
|
|
72
|
+
});
|
|
73
|
+
program
|
|
74
|
+
.command('status')
|
|
75
|
+
.description('Show current taste profile summary')
|
|
76
|
+
.action(() => {
|
|
77
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
78
|
+
if (!fs.existsSync(cellDir)) {
|
|
79
|
+
console.log('ā Cell not initialized. Run `cell init` first.');
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const store = new index_1.PatternStore(cellDir);
|
|
83
|
+
console.log('\nš FIVO Cell ā Taste Profile');
|
|
84
|
+
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
85
|
+
const patterns = store.getAllPatterns();
|
|
86
|
+
if (patterns.length === 0) {
|
|
87
|
+
console.log('No patterns learned yet. Start coding to teach Cell your style.');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
console.log(`Total patterns: ${patterns.length}`);
|
|
91
|
+
console.log(`Total signals: ${store.getTotalSignals()}`);
|
|
92
|
+
const strong = store.getPatternsByTier('strong');
|
|
93
|
+
const moderate = store.getPatternsByTier('moderate');
|
|
94
|
+
const weak = store.getPatternsByTier('weak');
|
|
95
|
+
console.log(`\nTiers:`);
|
|
96
|
+
console.log(` Strong (>0.80): ${strong.length} patterns`);
|
|
97
|
+
console.log(` Moderate (0.50-0.80): ${moderate.length} patterns`);
|
|
98
|
+
console.log(` Weak (0.30-0.50): ${weak.length} patterns`);
|
|
99
|
+
if (strong.length > 0) {
|
|
100
|
+
console.log('\nTop patterns:');
|
|
101
|
+
const top = patterns
|
|
102
|
+
.sort((a, b) => b.confidence.mean - a.confidence.mean)
|
|
103
|
+
.slice(0, 5);
|
|
104
|
+
for (const p of top) {
|
|
105
|
+
console.log(` ā
${p.description} (${p.confidence.mean}, ${p.signals?.positive || 0}/${p.signals?.total || 0} signals)`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
console.log('');
|
|
109
|
+
});
|
|
110
|
+
program
|
|
111
|
+
.command('taste show')
|
|
112
|
+
.description('Display your cell.md profile')
|
|
113
|
+
.action(() => {
|
|
114
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
115
|
+
const mdPath = path.join(cellDir, 'cell.md');
|
|
116
|
+
if (!fs.existsSync(mdPath)) {
|
|
117
|
+
console.log('ā No taste profile found. Run `cell init` first, then start coding.');
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
console.log(fs.readFileSync(mdPath, 'utf-8'));
|
|
121
|
+
});
|
|
122
|
+
program
|
|
123
|
+
.command('taste reset')
|
|
124
|
+
.description('Reset all learned patterns')
|
|
125
|
+
.action(() => {
|
|
126
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
127
|
+
if (!fs.existsSync(cellDir)) {
|
|
128
|
+
console.log('ā Cell not initialized.');
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const store = new index_1.PatternStore(cellDir);
|
|
132
|
+
store.clear();
|
|
133
|
+
console.log('ā
All patterns reset. Cell will relearn from scratch.');
|
|
134
|
+
});
|
|
135
|
+
program
|
|
136
|
+
.command('learn')
|
|
137
|
+
.description('Feed a code edit to Cell for learning')
|
|
138
|
+
.option('-o, --original <code>', 'Original AI-generated code')
|
|
139
|
+
.option('-e, --edited <code>', 'Your edited version')
|
|
140
|
+
.option('-a, --accept', 'Mark as accepted (no edits)')
|
|
141
|
+
.option('-r, --reject', 'Mark as rejected')
|
|
142
|
+
.action((options) => {
|
|
143
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
144
|
+
if (!fs.existsSync(cellDir)) {
|
|
145
|
+
console.log('ā Cell not initialized. Run `cell init` first.');
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const capture = new index_1.SignalCapture();
|
|
149
|
+
const cascade = new index_1.ExtractionCascade();
|
|
150
|
+
const store = new index_1.PatternStore(cellDir);
|
|
151
|
+
const context = {
|
|
152
|
+
language: 'typescript',
|
|
153
|
+
framework: 'unknown',
|
|
154
|
+
fileType: 'unknown',
|
|
155
|
+
strictness: 'moderate',
|
|
156
|
+
projectId: path.basename(process.cwd()),
|
|
157
|
+
};
|
|
158
|
+
if (options.accept && options.original) {
|
|
159
|
+
const signal = capture.captureAccept(options.original, context);
|
|
160
|
+
console.log(`ā
Accept signal captured (session: ${signal.sessionId})`);
|
|
161
|
+
}
|
|
162
|
+
else if (options.reject && options.original) {
|
|
163
|
+
const signal = capture.captureReject(options.original, context);
|
|
164
|
+
console.log(`ā Reject signal captured (session: ${signal.sessionId})`);
|
|
165
|
+
}
|
|
166
|
+
else if (options.original && options.edited) {
|
|
167
|
+
const signal = capture.captureEditDiff(options.original, options.edited, context);
|
|
168
|
+
const result = cascade.extract(options.original, options.edited);
|
|
169
|
+
console.log(`š Edit diff captured (session: ${signal.sessionId})`);
|
|
170
|
+
console.log(` Step used: ${result.stepUsed}`);
|
|
171
|
+
console.log(` Latency: ${result.latencyMs}ms`);
|
|
172
|
+
console.log(` Patterns found: ${result.patterns.length}`);
|
|
173
|
+
for (const p of result.patterns) {
|
|
174
|
+
const pattern = store.addOrUpdatePattern(p.category, p.description, p.from, p.to, true, p.conditions);
|
|
175
|
+
console.log(` ā ${p.description} (confidence: ${pattern.confidence.mean})`);
|
|
176
|
+
}
|
|
177
|
+
store.save();
|
|
178
|
+
console.log(`\nā
Taste profile updated. ${store.getPatternCount()} patterns total.`);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
console.log('ā Provide --original and --edited, or --accept, or --reject');
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
program
|
|
185
|
+
.command('push')
|
|
186
|
+
.description('Push your taste to team directory')
|
|
187
|
+
.option('-u, --username <name>', 'Your username')
|
|
188
|
+
.action((options) => {
|
|
189
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
190
|
+
if (!fs.existsSync(cellDir)) {
|
|
191
|
+
console.log('ā Cell not initialized. Run `cell init` first.');
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const username = options.username || process.env.USER || process.env.USERNAME || 'anonymous';
|
|
195
|
+
const store = new index_1.PatternStore(cellDir);
|
|
196
|
+
const composer = new index_1.TeamComposer(store, cellDir);
|
|
197
|
+
composer.pushTaste(username);
|
|
198
|
+
console.log(`ā
Taste pushed for ${username}.`);
|
|
199
|
+
console.log(` Team members: ${composer.getTeamMembers().join(', ') || 'none yet'}`);
|
|
200
|
+
});
|
|
201
|
+
program
|
|
202
|
+
.command('pull')
|
|
203
|
+
.description('Pull team or member taste')
|
|
204
|
+
.option('-u, --username <name>', 'Pull specific member taste')
|
|
205
|
+
.option('--team', 'Pull full team composite')
|
|
206
|
+
.action((options) => {
|
|
207
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
208
|
+
if (!fs.existsSync(cellDir)) {
|
|
209
|
+
console.log('ā Cell not initialized.');
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const store = new index_1.PatternStore(cellDir);
|
|
213
|
+
const composer = new index_1.TeamComposer(store, cellDir);
|
|
214
|
+
if (options.username) {
|
|
215
|
+
const taste = composer.pullTaste(options.username);
|
|
216
|
+
if (!taste) {
|
|
217
|
+
console.log(`ā No taste found for ${options.username}.`);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
console.log(`š„ Pulled taste from ${options.username}:`);
|
|
221
|
+
console.log(` Patterns: ${taste.patterns.length}`);
|
|
222
|
+
console.log(` Signals: ${taste.totalSignals}`);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
const taste = composer.pullTeamTaste();
|
|
226
|
+
if (!taste) {
|
|
227
|
+
console.log('ā No team taste available. Have teammates pushed yet?');
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
console.log(`š„ Pulled team taste (${composer.getTeamMembers().length} members):`);
|
|
231
|
+
console.log(` Patterns: ${taste.patterns.length}`);
|
|
232
|
+
console.log(` Total signals: ${taste.totalSignals}`);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
program
|
|
236
|
+
.command('vote')
|
|
237
|
+
.description('Vote on a pattern conflict')
|
|
238
|
+
.option('-p, --pattern <id>', 'Pattern conflict ID (e.g., p_abc_vs_p_def)')
|
|
239
|
+
.option('-v, --vote <choice>', 'Your vote: A, B, or none')
|
|
240
|
+
.option('--status', 'Show vote status')
|
|
241
|
+
.action((options) => {
|
|
242
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
243
|
+
if (!fs.existsSync(cellDir)) {
|
|
244
|
+
console.log('ā Cell not initialized.');
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const detector = new index_1.ConflictDetector(cellDir);
|
|
248
|
+
if (options.status && options.pattern) {
|
|
249
|
+
const sessions = fs.existsSync(detector['voteStorePath'])
|
|
250
|
+
? JSON.parse(fs.readFileSync(detector['voteStorePath'], 'utf-8'))
|
|
251
|
+
: [];
|
|
252
|
+
const session = sessions.find((s) => s.patternId === options.pattern);
|
|
253
|
+
if (!session) {
|
|
254
|
+
console.log('ā Vote session not found.');
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
console.log(detector.getVoteStatus(session));
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (options.pattern && options.vote) {
|
|
261
|
+
const username = process.env.USER || process.env.USERNAME || 'anonymous';
|
|
262
|
+
const session = detector.castVote(options.pattern, username, options.vote);
|
|
263
|
+
if (!session) {
|
|
264
|
+
console.log('ā Vote failed. Check pattern ID and deadline.');
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
console.log(`ā
Vote cast: ${options.vote}`);
|
|
268
|
+
console.log(detector.getVoteStatus(session));
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
console.log('Usage: cell taste vote --pattern "X_vs_Y" --vote A');
|
|
272
|
+
console.log(' cell taste vote --pattern "X_vs_Y" --status');
|
|
273
|
+
});
|
|
274
|
+
program
|
|
275
|
+
.command('community')
|
|
276
|
+
.description('Show community prior patterns')
|
|
277
|
+
.action(() => {
|
|
278
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
279
|
+
if (!fs.existsSync(cellDir)) {
|
|
280
|
+
console.log('ā Cell not initialized.');
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const prior = new index_1.CommunityPrior(cellDir);
|
|
284
|
+
if (prior.getPatternCount() === 0) {
|
|
285
|
+
console.log('š± Generating synthetic community seed...');
|
|
286
|
+
prior.generateSyntheticSeed();
|
|
287
|
+
}
|
|
288
|
+
console.log(`\nš ${prior.getDisplayLabel()}`);
|
|
289
|
+
console.log(` Total patterns: ${prior.getPatternCount()}`);
|
|
290
|
+
console.log(` Synthetic: ${prior.getSyntheticPatterns().length}`);
|
|
291
|
+
console.log(` Live-learned: ${prior.getLivePatterns().length}`);
|
|
292
|
+
const patterns = prior.getPatterns(0.5);
|
|
293
|
+
if (patterns.length > 0) {
|
|
294
|
+
console.log('\nTop community patterns:');
|
|
295
|
+
for (const p of patterns.slice(0, 5)) {
|
|
296
|
+
const marker = prior.getSyntheticPatterns().some(sp => sp.patternId === p.patternId) ? 'š§Ŗ' : 'š„';
|
|
297
|
+
console.log(` ${marker} ${p.description} (${p.confidence.mean})`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
console.log('');
|
|
301
|
+
});
|
|
302
|
+
program
|
|
303
|
+
.command('next')
|
|
304
|
+
.description('Predict next coding action')
|
|
305
|
+
.option('-a, --action <name>', 'Record an action for sequence learning')
|
|
306
|
+
.option('-f, --feedback <action>', 'Give feedback on a prediction (was it useful?)')
|
|
307
|
+
.action((options) => {
|
|
308
|
+
const predictor = new index_1.NextActionPredictor();
|
|
309
|
+
if (options.action) {
|
|
310
|
+
predictor.recordAction(options.action);
|
|
311
|
+
console.log(`ā
Recorded action: ${options.action}`);
|
|
312
|
+
const predictions = predictor.predictNext([]);
|
|
313
|
+
if (predictions.length > 0) {
|
|
314
|
+
console.log('\nPredicted next actions:');
|
|
315
|
+
for (const p of predictions) {
|
|
316
|
+
console.log(` ā ${p.description} (confidence: ${p.confidence})`);
|
|
317
|
+
}
|
|
318
|
+
const bulk = predictor.getBulkSuggestion(predictions);
|
|
319
|
+
if (bulk)
|
|
320
|
+
console.log(` ā” ${bulk.description}`);
|
|
321
|
+
}
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
if (options.feedback) {
|
|
325
|
+
predictor.recordFeedback(options.feedback, true);
|
|
326
|
+
console.log(`ā
Feedback recorded for: ${options.feedback}`);
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
const predictions = predictor.predictNext([]);
|
|
330
|
+
console.log('Predicted next actions:');
|
|
331
|
+
for (const p of predictions) {
|
|
332
|
+
console.log(` ā ${p.description} (confidence: ${p.confidence})`);
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
program
|
|
336
|
+
.command('branch')
|
|
337
|
+
.description('Pre-generate files from git branch name')
|
|
338
|
+
.option('-b, --branch <name>', 'Branch name (e.g., feature/payment-gateway)')
|
|
339
|
+
.action((options) => {
|
|
340
|
+
if (!options.branch) {
|
|
341
|
+
console.log('ā Provide --branch name');
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const generator = new index_1.GitBranchPreGenerator();
|
|
345
|
+
const summary = generator.getIntentSummary(options.branch);
|
|
346
|
+
console.log(`š ${summary}`);
|
|
347
|
+
const files = generator.generateFiles(options.branch, []);
|
|
348
|
+
for (const f of files) {
|
|
349
|
+
console.log(`\n--- ${f.path} ---`);
|
|
350
|
+
console.log(f.content);
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
program
|
|
354
|
+
.command('gentests')
|
|
355
|
+
.description('Generate test cases for a function')
|
|
356
|
+
.option('-c, --code <code>', 'Function code to analyze')
|
|
357
|
+
.action((options) => {
|
|
358
|
+
if (!options.code) {
|
|
359
|
+
console.log('ā Provide --code with function signature');
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
const anticipator = new index_1.TestAnticipator();
|
|
363
|
+
const tests = anticipator.generateTests(options.code);
|
|
364
|
+
console.log(`Generated ${tests.length} test cases:\n`);
|
|
365
|
+
for (const t of tests) {
|
|
366
|
+
console.log(`[${t.type}] ${t.name}`);
|
|
367
|
+
console.log(t.code);
|
|
368
|
+
console.log('');
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
program
|
|
372
|
+
.command('errors')
|
|
373
|
+
.description('Predict potential errors in code')
|
|
374
|
+
.option('-c, --code <code>', 'Code to analyze')
|
|
375
|
+
.action((options) => {
|
|
376
|
+
if (!options.code) {
|
|
377
|
+
console.log('ā Provide --code to analyze');
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
const predictor = new index_1.ErrorPredictor();
|
|
381
|
+
const predictions = predictor.predict(options.code);
|
|
382
|
+
if (predictions.length === 0) {
|
|
383
|
+
console.log('ā
No potential errors detected.');
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
console.log(`Found ${predictions.length} potential errors:\n`);
|
|
387
|
+
for (const p of predictions) {
|
|
388
|
+
console.log(`[${p.severity}] Line ${p.line}: ${p.message}`);
|
|
389
|
+
console.log(` Fix: ${predictor.getQuickFix(p)}`);
|
|
390
|
+
console.log('');
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
program
|
|
394
|
+
.command('buildcheck')
|
|
395
|
+
.description('Predict build failures (TS, ESLint, tests)')
|
|
396
|
+
.option('-c, --code <code>', 'Code to analyze')
|
|
397
|
+
.action((options) => {
|
|
398
|
+
if (!options.code) {
|
|
399
|
+
console.log('ā Provide --code to analyze');
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
const predictor = new index_1.BuildFailurePredictor();
|
|
403
|
+
const result = predictor.predictAll(options.code);
|
|
404
|
+
const all = [...result.tsErrors, ...result.eslintViolations, ...result.testFailures];
|
|
405
|
+
if (all.length === 0) {
|
|
406
|
+
console.log('ā
No build failures predicted.');
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
console.log(`Predicted ${all.length} build failures:\n`);
|
|
410
|
+
for (const p of all) {
|
|
411
|
+
const auto = p.autoFixable ? ' [AUTO-FIXABLE]' : '';
|
|
412
|
+
console.log(`[${p.type}] Line ${p.line}: ${p.message}${auto}`);
|
|
413
|
+
if (p.fix)
|
|
414
|
+
console.log(` Fix: ${p.fix}`);
|
|
415
|
+
console.log('');
|
|
416
|
+
}
|
|
417
|
+
const stats = predictor.getStats(all);
|
|
418
|
+
console.log(`Summary: ${stats.total} total, ${stats.autoFixable} auto-fixable`);
|
|
419
|
+
});
|
|
420
|
+
program
|
|
421
|
+
.command('mergecheck')
|
|
422
|
+
.description('Predict merge conflicts between branches')
|
|
423
|
+
.option('-a, --diff-a <diff>', 'Diff from branch A')
|
|
424
|
+
.option('-b, --diff-b <diff>', 'Diff from branch B')
|
|
425
|
+
.action((options) => {
|
|
426
|
+
if (!options.diffA || !options.diffB) {
|
|
427
|
+
console.log('ā Provide --diff-a and --diff-b');
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
const predictor = new index_1.MergeConflictPredictor();
|
|
431
|
+
const conflicts = predictor.predictConflicts(options.diffA, options.diffB);
|
|
432
|
+
if (conflicts.length === 0) {
|
|
433
|
+
console.log('ā
No merge conflicts predicted.');
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
console.log(`Predicted ${conflicts.length} merge conflicts:\n`);
|
|
437
|
+
for (const c of conflicts) {
|
|
438
|
+
console.log(`[${c.type}] ${c.file}:${c.line} (confidence: ${c.confidence})`);
|
|
439
|
+
console.log(` ${c.suggestion}`);
|
|
440
|
+
console.log('');
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
program
|
|
444
|
+
.command('scan')
|
|
445
|
+
.description('Scan code for security vulnerabilities')
|
|
446
|
+
.option('-c, --code <code>', 'Code to scan')
|
|
447
|
+
.action((options) => {
|
|
448
|
+
if (!options.code) {
|
|
449
|
+
console.log('ā Provide --code to scan');
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
const predictor = new index_1.SecurityPredictor();
|
|
453
|
+
const predictions = predictor.predict(options.code);
|
|
454
|
+
if (predictions.length === 0) {
|
|
455
|
+
console.log('ā
No security vulnerabilities detected.');
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
console.log(`Found ${predictions.length} security issues:\n`);
|
|
459
|
+
for (const p of predictions) {
|
|
460
|
+
console.log(`[${p.severity}] ${p.type}: Line ${p.line}`);
|
|
461
|
+
console.log(` ${p.message}`);
|
|
462
|
+
console.log(` Fix: ${p.sanitizedVersion}`);
|
|
463
|
+
console.log('');
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
program
|
|
467
|
+
.command('perf')
|
|
468
|
+
.description('Analyze code for performance issues')
|
|
469
|
+
.option('-c, --code <code>', 'Code to analyze')
|
|
470
|
+
.action((options) => {
|
|
471
|
+
if (!options.code) {
|
|
472
|
+
console.log('ā Provide --code to analyze');
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
const predictor = new index_1.PerformancePredictor();
|
|
476
|
+
const predictions = predictor.predict(options.code);
|
|
477
|
+
if (predictions.length === 0) {
|
|
478
|
+
console.log('ā
No performance issues detected.');
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
console.log(`Found ${predictions.length} performance issues:\n`);
|
|
482
|
+
for (const p of predictions) {
|
|
483
|
+
console.log(`[${p.severity}] ${p.type}: Line ${p.line}`);
|
|
484
|
+
console.log(` ${p.message}`);
|
|
485
|
+
console.log(` Fix: ${p.suggestion}`);
|
|
486
|
+
console.log('');
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
program
|
|
490
|
+
.command('snapshot')
|
|
491
|
+
.description('Capture or restore project context')
|
|
492
|
+
.option('-p, --project <id>', 'Project ID')
|
|
493
|
+
.option('-r, --restore', 'Restore last snapshot')
|
|
494
|
+
.action((options) => {
|
|
495
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
496
|
+
const restore = new index_1.ContextRestore(cellDir);
|
|
497
|
+
if (options.restore && options.project) {
|
|
498
|
+
const snapshot = restore.restore(options.project);
|
|
499
|
+
if (!snapshot) {
|
|
500
|
+
console.log('ā No snapshot found.');
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
console.log(restore.getResumePrompt(snapshot));
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
if (options.project) {
|
|
507
|
+
restore.capture(options.project, [], '', 0, [], '', 'main');
|
|
508
|
+
console.log(`ā
Snapshot captured for ${options.project}`);
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
const snapshots = restore.getAllSnapshots();
|
|
512
|
+
console.log(`${snapshots.length} snapshots available:`);
|
|
513
|
+
for (const s of snapshots) {
|
|
514
|
+
console.log(` ${s.projectId} (${s.timestamp})`);
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
program
|
|
518
|
+
.command('sync')
|
|
519
|
+
.description('Sync patterns across projects')
|
|
520
|
+
.option('-s, --source <id>', 'Source project ID')
|
|
521
|
+
.option('-t, --target <id>', 'Target project ID')
|
|
522
|
+
.action((options) => {
|
|
523
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
524
|
+
const store = new index_1.PatternStore(cellDir);
|
|
525
|
+
const sync = new index_1.CrossProjectSync(store, cellDir);
|
|
526
|
+
if (options.source && options.target) {
|
|
527
|
+
const adapted = sync.generateAdaptedPatterns(options.source, options.target);
|
|
528
|
+
console.log(`${adapted.length} patterns compatible with ${options.target}:`);
|
|
529
|
+
for (const a of adapted) {
|
|
530
|
+
console.log(` ${a.original.description} (compatibility: ${a.compatibilityScore})`);
|
|
531
|
+
}
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
const stats = sync.getSyncStats();
|
|
535
|
+
console.log(`Cross-project sync: ${stats.projects} projects, ${stats.totalPatterns} patterns`);
|
|
536
|
+
});
|
|
537
|
+
program
|
|
538
|
+
.command('solutions')
|
|
539
|
+
.description('Search solution index')
|
|
540
|
+
.option('-q, --query <text>', 'Search query')
|
|
541
|
+
.option('-a, --add <title>', 'Add a solution')
|
|
542
|
+
.option('-d, --desc <text>', 'Solution description')
|
|
543
|
+
.option('-p, --project <id>', 'Project ID')
|
|
544
|
+
.option('--stats', 'Show solution index stats')
|
|
545
|
+
.action((options) => {
|
|
546
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
547
|
+
const index = new index_1.SolutionIndex(cellDir);
|
|
548
|
+
if (options.stats) {
|
|
549
|
+
const stats = index.getStats();
|
|
550
|
+
console.log(`Solution index: ${stats.projects} projects, ${stats.totalSolutions} solutions`);
|
|
551
|
+
console.log(`Top tags: ${stats.topTags.join(', ')}`);
|
|
552
|
+
if (index.isColdStart())
|
|
553
|
+
console.log(index.getColdStartMessage());
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
if (options.add && options.desc && options.project) {
|
|
557
|
+
const sol = index.addSolution(options.add, options.desc, [], options.project, [], '');
|
|
558
|
+
console.log(`ā
Solution added: ${sol.id}`);
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
if (options.query) {
|
|
562
|
+
const results = index.search(options.query);
|
|
563
|
+
console.log(`Found ${results.length} solutions for "${options.query}":`);
|
|
564
|
+
for (const s of results) {
|
|
565
|
+
console.log(` š ${s.title} (${s.projectId})`);
|
|
566
|
+
console.log(` ${s.description}`);
|
|
567
|
+
}
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
console.log('Usage: cell solutions --query "auth middleware"');
|
|
571
|
+
console.log(' cell solutions --add "Title" --desc "Description" --project "my-project"');
|
|
572
|
+
console.log(' cell solutions --stats');
|
|
573
|
+
});
|
|
574
|
+
program
|
|
575
|
+
.command('langswitch')
|
|
576
|
+
.description('Get language switch guide')
|
|
577
|
+
.option('-f, --from <lang>', 'Source language')
|
|
578
|
+
.option('-t, --to <lang>', 'Target language')
|
|
579
|
+
.action((options) => {
|
|
580
|
+
const assistant = new index_1.LanguageSwitchAssistant();
|
|
581
|
+
if (options.from && options.to) {
|
|
582
|
+
const guide = assistant.getGuide(options.from, options.to);
|
|
583
|
+
if (!guide) {
|
|
584
|
+
console.log(`ā No guide for ${options.from}ā${options.to}`);
|
|
585
|
+
console.log(`Available: ${assistant.getAvailableTransitions().join(', ')}`);
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
console.log(`\nš ${guide.from} ā ${guide.to} Guide\n`);
|
|
589
|
+
console.log('ā ļø Gotchas:');
|
|
590
|
+
for (const g of guide.gotchas)
|
|
591
|
+
console.log(` ⢠${g}`);
|
|
592
|
+
console.log('\nš” Style Tips:');
|
|
593
|
+
for (const t of guide.styleTips)
|
|
594
|
+
console.log(` ⢠${t}`);
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
console.log('Available transitions:');
|
|
598
|
+
for (const t of assistant.getAvailableTransitions()) {
|
|
599
|
+
console.log(` ${t}`);
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
program
|
|
603
|
+
.command('resume')
|
|
604
|
+
.description('Check for interruption and resume')
|
|
605
|
+
.action(() => {
|
|
606
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
607
|
+
const recovery = new index_1.InterruptionRecovery(cellDir);
|
|
608
|
+
const interruption = recovery.detectInterruption();
|
|
609
|
+
if (interruption) {
|
|
610
|
+
console.log(recovery.getContinuePrompt(interruption));
|
|
611
|
+
console.log(recovery.getSummaryPrompt(interruption));
|
|
612
|
+
console.log(recovery.getRestartPrompt());
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
console.log('ā
No interruption detected. Ready to work.');
|
|
616
|
+
}
|
|
617
|
+
});
|
|
618
|
+
program
|
|
619
|
+
.command('handoff')
|
|
620
|
+
.description('Generate teammate handoff summary')
|
|
621
|
+
.option('-t, --teammate <name>', 'Teammate name')
|
|
622
|
+
.option('-b, --branch <name>', 'Branch name')
|
|
623
|
+
.action((options) => {
|
|
624
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
625
|
+
const detector = new index_1.HandoffDetector(cellDir);
|
|
626
|
+
if (options.teammate && options.branch) {
|
|
627
|
+
const isAbsent = detector.detectAbsence(options.teammate, options.branch);
|
|
628
|
+
if (isAbsent) {
|
|
629
|
+
const summary = detector.generateReturnSummary(options.teammate, options.branch, [], [], [], new Date().toISOString());
|
|
630
|
+
console.log(detector.getReturnPrompt(summary));
|
|
631
|
+
}
|
|
632
|
+
else {
|
|
633
|
+
console.log(`ā
${options.teammate} is active on ${options.branch}.`);
|
|
634
|
+
}
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
console.log('Usage: cell handoff --teammate "alice" --branch "feature/auth"');
|
|
638
|
+
});
|
|
639
|
+
program
|
|
640
|
+
.command('silos')
|
|
641
|
+
.description('Detect knowledge silos')
|
|
642
|
+
.option('-m, --modules <json>', 'Moduleācontributors mapping as JSON')
|
|
643
|
+
.action((options) => {
|
|
644
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
645
|
+
const detector = new index_1.KnowledgeSiloDetector(cellDir);
|
|
646
|
+
if (options.modules) {
|
|
647
|
+
const mapping = JSON.parse(options.modules);
|
|
648
|
+
const reports = detector.analyzeProject(mapping);
|
|
649
|
+
const risks = detector.getTopRisks(reports);
|
|
650
|
+
console.log(`${reports.length} modules analyzed. ${risks.length} at risk:\n`);
|
|
651
|
+
for (const r of risks) {
|
|
652
|
+
console.log(`š“ ${r.module} (risk: ${r.riskScore}, bus factor: ${r.busFactor})`);
|
|
653
|
+
console.log(` ${r.recommendation}`);
|
|
654
|
+
}
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
const saved = detector.loadReport();
|
|
658
|
+
if (saved.length === 0) {
|
|
659
|
+
console.log('No silo reports. Run: cell silos --modules \'{"auth":["alice"],"api":["bob","carol"]}\'');
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
console.log(`${saved.length} modules in saved report.`);
|
|
663
|
+
});
|
|
664
|
+
program
|
|
665
|
+
.command('review')
|
|
666
|
+
.description('Generate PR review summary')
|
|
667
|
+
.option('-t, --title <text>', 'PR title')
|
|
668
|
+
.option('-d, --diff <text>', 'PR diff content')
|
|
669
|
+
.action((options) => {
|
|
670
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
671
|
+
const store = new index_1.PatternStore(cellDir);
|
|
672
|
+
const assistant = new index_1.PRReviewAssistant();
|
|
673
|
+
if (options.title && options.diff) {
|
|
674
|
+
const patterns = store.getAllPatterns();
|
|
675
|
+
const summary = assistant.generateSummary(options.title, options.diff, patterns);
|
|
676
|
+
console.log(`\nš PR Review: ${summary.title}`);
|
|
677
|
+
console.log(` Files: ${summary.filesChanged} | +${summary.linesAdded} -${summary.linesRemoved}`);
|
|
678
|
+
if (summary.potentialBugs.length > 0) {
|
|
679
|
+
console.log(`\nš Potential Bugs (${summary.potentialBugs.length}):`);
|
|
680
|
+
for (const b of summary.potentialBugs)
|
|
681
|
+
console.log(` ⢠${b}`);
|
|
682
|
+
}
|
|
683
|
+
if (summary.patternDeviations.length > 0) {
|
|
684
|
+
console.log(`\nā ļø Pattern Deviations (${summary.patternDeviations.length}):`);
|
|
685
|
+
for (const d of summary.patternDeviations)
|
|
686
|
+
console.log(` ⢠${d}`);
|
|
687
|
+
}
|
|
688
|
+
if (summary.potentialBugs.length === 0 && summary.patternDeviations.length === 0) {
|
|
689
|
+
console.log('\nā
No issues detected.');
|
|
690
|
+
}
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
console.log('Usage: cell review --title "Add auth" --diff "<git diff>"');
|
|
694
|
+
});
|
|
695
|
+
program
|
|
696
|
+
.command('standup')
|
|
697
|
+
.description('Generate daily standup')
|
|
698
|
+
.option('-c, --completed <items>', 'Completed items (comma-separated)')
|
|
699
|
+
.option('-p, --progress <items>', 'In-progress items (comma-separated)')
|
|
700
|
+
.option('-b, --blocked <items>', 'Blocked items (comma-separated)')
|
|
701
|
+
.option('-n, --plan <items>', 'Planned items (comma-separated)')
|
|
702
|
+
.action((options) => {
|
|
703
|
+
const generator = new index_1.StandupGenerator();
|
|
704
|
+
if (options.completed || options.progress || options.plan) {
|
|
705
|
+
const completed = options.completed ? options.completed.split(',') : [];
|
|
706
|
+
const inProgress = options.progress ? options.progress.split(',') : [];
|
|
707
|
+
const blocked = options.blocked ? options.blocked.split(',') : [];
|
|
708
|
+
const plan = options.plan ? options.plan.split(',') : [];
|
|
709
|
+
const entry = generator.generateDaily(completed, inProgress, blocked, plan);
|
|
710
|
+
console.log(generator.formatStandup(entry));
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
const summary = generator.getWeeklySummary();
|
|
714
|
+
console.log(summary);
|
|
715
|
+
});
|
|
716
|
+
program
|
|
717
|
+
.command('offline')
|
|
718
|
+
.description('Check offline queue status')
|
|
719
|
+
.option('--heartbeat', 'Send engine heartbeat')
|
|
720
|
+
.action((options) => {
|
|
721
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
722
|
+
const queue = new index_1.OfflineQueue(cellDir);
|
|
723
|
+
if (options.heartbeat) {
|
|
724
|
+
queue.heartbeat();
|
|
725
|
+
console.log('ā
Heartbeat sent. Engine is ONLINE.');
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
const status = queue.checkEngineHealth();
|
|
729
|
+
console.log(`Engine: ${status.state}`);
|
|
730
|
+
console.log(`Queue size: ${queue.getQueueSize()}`);
|
|
731
|
+
console.log(queue.getDegradedMessage(status));
|
|
732
|
+
});
|
|
733
|
+
program
|
|
734
|
+
.command('deadcode')
|
|
735
|
+
.description('Detect dead code in a file')
|
|
736
|
+
.option('-c, --code <code>', 'Code to analyze')
|
|
737
|
+
.option('-f, --file <name>', 'File name')
|
|
738
|
+
.action((options) => {
|
|
739
|
+
if (!options.code || !options.file) {
|
|
740
|
+
console.log('ā Provide --code and --file');
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
const detector = new index_1.DeadCodeDetector();
|
|
744
|
+
const reports = detector.detectAll(options.code, options.file);
|
|
745
|
+
if (reports.length === 0) {
|
|
746
|
+
console.log('ā
No dead code detected.');
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
console.log(`Found ${reports.length} dead code items:\n`);
|
|
750
|
+
for (const r of reports) {
|
|
751
|
+
console.log(`[${r.type}] ${r.file}:${r.line} ā ${r.name}`);
|
|
752
|
+
console.log(` ${r.suggestion}`);
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
program
|
|
756
|
+
.command('cycles')
|
|
757
|
+
.description('Detect circular dependencies')
|
|
758
|
+
.option('-i, --imports <json>', 'Import edges as JSON array of {from,to}')
|
|
759
|
+
.action((options) => {
|
|
760
|
+
if (!options.imports) {
|
|
761
|
+
console.log('ā Provide --imports as JSON');
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
764
|
+
const detector = new index_1.CircularDependencyDetector();
|
|
765
|
+
const edges = JSON.parse(options.imports);
|
|
766
|
+
const graph = detector.buildGraph(edges);
|
|
767
|
+
const cycles = detector.detectCycles(graph);
|
|
768
|
+
if (cycles.length === 0) {
|
|
769
|
+
console.log('ā
No circular dependencies detected.');
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
console.log(`Found ${cycles.length} circular dependencies:\n`);
|
|
773
|
+
for (const c of cycles) {
|
|
774
|
+
console.log(`š“ Cycle (${c.length} nodes): ${c.cycle.join(' ā ')}`);
|
|
775
|
+
console.log(` Break at: ${c.breakPoint}`);
|
|
776
|
+
}
|
|
777
|
+
const stats = detector.getStats(cycles);
|
|
778
|
+
console.log(`\nStats: ${stats.totalCycles} cycles, max length ${stats.maxLength}, avg ${stats.avgLength}`);
|
|
779
|
+
});
|
|
780
|
+
program
|
|
781
|
+
.command('dupes')
|
|
782
|
+
.description('Detect code duplication')
|
|
783
|
+
.option('-f, --files <json>', 'Files as JSON {filepath: code}')
|
|
784
|
+
.action((options) => {
|
|
785
|
+
if (!options.files) {
|
|
786
|
+
console.log('ā Provide --files as JSON');
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
const detector = new index_1.DuplicationDetector();
|
|
790
|
+
const files = JSON.parse(options.files);
|
|
791
|
+
const groups = detector.detectClones(files);
|
|
792
|
+
if (groups.length === 0) {
|
|
793
|
+
console.log('ā
No code duplication detected.');
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
console.log(`Found ${groups.length} duplication groups:\n`);
|
|
797
|
+
for (const g of groups.slice(0, 5)) {
|
|
798
|
+
console.log(`š Group ${g.id} (${(g.similarity * 100).toFixed(0)}% similar)`);
|
|
799
|
+
console.log(` Files: ${g.files.join(', ')}`);
|
|
800
|
+
console.log(` ${detector.getExtractHelperAction(g)}`);
|
|
801
|
+
}
|
|
802
|
+
const stats = detector.getStats(groups);
|
|
803
|
+
console.log(`\nStats: ${stats.totalGroups} groups across ${stats.totalFiles} files, avg similarity ${stats.avgSimilarity}`);
|
|
804
|
+
});
|
|
805
|
+
program
|
|
806
|
+
.command('complexity')
|
|
807
|
+
.description('Analyze code complexity')
|
|
808
|
+
.option('-c, --code <code>', 'Code to analyze')
|
|
809
|
+
.option('-f, --file <name>', 'File name')
|
|
810
|
+
.action((options) => {
|
|
811
|
+
if (!options.code || !options.file) {
|
|
812
|
+
console.log('ā Provide --code and --file');
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
const analyzer = new index_1.ComplexityAnalyzer();
|
|
816
|
+
const reports = analyzer.analyze(options.code, options.file);
|
|
817
|
+
if (reports.length === 0) {
|
|
818
|
+
console.log('ā
No functions found.');
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
const hotspots = analyzer.getHotspots(reports);
|
|
822
|
+
console.log(`${reports.length} functions analyzed. ${hotspots.length} hotspots:\n`);
|
|
823
|
+
for (const r of hotspots) {
|
|
824
|
+
const icon = r.level === 'high' ? 'š“' : 'š”';
|
|
825
|
+
console.log(`${icon} ${r.function} (complexity: ${r.complexity}, ${r.level})`);
|
|
826
|
+
console.log(` ${r.file}:${r.line}`);
|
|
827
|
+
console.log(` ${r.suggestion}`);
|
|
828
|
+
console.log('');
|
|
829
|
+
}
|
|
830
|
+
const stats = analyzer.getStats(reports);
|
|
831
|
+
console.log(`Stats: ${stats.total} functions, ${stats.high} high, ${stats.medium} medium, ${stats.low} low, avg ${stats.avgComplexity}`);
|
|
832
|
+
});
|
|
833
|
+
program
|
|
834
|
+
.command('deps')
|
|
835
|
+
.description('Check dependency health')
|
|
836
|
+
.option('-d, --deps <json>', 'Dependencies as JSON {name: version}')
|
|
837
|
+
.option('-l, --latest <json>', 'Latest versions as JSON {name: version}')
|
|
838
|
+
.action((options) => {
|
|
839
|
+
if (!options.deps || !options.latest) {
|
|
840
|
+
console.log('ā Provide --deps and --latest as JSON');
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
const checker = new index_1.DependencyHealthChecker();
|
|
844
|
+
const deps = JSON.parse(options.deps);
|
|
845
|
+
const latest = JSON.parse(options.latest);
|
|
846
|
+
const reports = checker.check(deps, latest);
|
|
847
|
+
console.log(`${reports.length} dependencies checked:\n`);
|
|
848
|
+
for (const r of reports) {
|
|
849
|
+
const icons = { up_to_date: 'ā
', minor_behind: 'š”', major_behind: 'š ', deprecated: 'š“' };
|
|
850
|
+
console.log(`${icons[r.status]} ${r.name}: ${r.current} ā ${r.latest} ${r.breakingChanges ? '(BREAKING)' : ''}`);
|
|
851
|
+
}
|
|
852
|
+
console.log(`\n${checker.getFullUpdatePlan(reports)}`);
|
|
853
|
+
const stats = checker.getStats(reports);
|
|
854
|
+
console.log(`Stats: ${stats.total} total, ${stats.outdated} outdated, ${stats.deprecated} deprecated, ${stats.upToDate} up-to-date`);
|
|
855
|
+
});
|
|
856
|
+
program
|
|
857
|
+
.command('abtest')
|
|
858
|
+
.description('Run A/B test')
|
|
859
|
+
.option('-n, --name <name>', 'Test name')
|
|
860
|
+
.option('-c, --control <n>', 'Control group size', '10')
|
|
861
|
+
.option('-e, --experiment <n>', 'Experiment group size', '10')
|
|
862
|
+
.option('-t, --test-id <id>', 'Test ID for recording predictions')
|
|
863
|
+
.option('-p, --prediction <id>', 'Prediction ID')
|
|
864
|
+
.option('-g, --group <group>', 'Group: control or experiment')
|
|
865
|
+
.option('-w, --was-correct', 'Was the prediction correct?')
|
|
866
|
+
.option('--significance', 'Check statistical significance')
|
|
867
|
+
.action((options) => {
|
|
868
|
+
const framework = new index_1.ABTestFramework();
|
|
869
|
+
if (options.name) {
|
|
870
|
+
const test = framework.createTest(options.name, parseInt(options.control), parseInt(options.experiment));
|
|
871
|
+
console.log(`ā
A/B test created: ${test.id}`);
|
|
872
|
+
console.log(` Control: ${test.controlGroup.length}, Experiment: ${test.experimentGroup.length}`);
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
if (options.testId && options.prediction && options.group) {
|
|
876
|
+
framework.recordPrediction(options.testId, options.prediction, options.wasCorrect || false, options.group);
|
|
877
|
+
const stats = framework.getStats(options.testId);
|
|
878
|
+
console.log(`š Test ${options.testId}:`);
|
|
879
|
+
console.log(` Control accuracy: ${stats.controlAccuracy}`);
|
|
880
|
+
console.log(` Experiment accuracy: ${stats.experimentAccuracy}`);
|
|
881
|
+
console.log(` Total predictions: ${stats.totalPredictions}`);
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
if (options.significance && options.testId) {
|
|
885
|
+
const result = framework.computeSignificance(options.testId);
|
|
886
|
+
console.log(`š Significance test for ${options.testId}:`);
|
|
887
|
+
console.log(` p-value: ${result.pValue}`);
|
|
888
|
+
console.log(` Significant: ${result.isSignificant ? 'YES' : 'NO'}`);
|
|
889
|
+
console.log(` Winner: ${result.winner}`);
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
const tests = framework.getAllTests();
|
|
893
|
+
console.log(`${tests.length} A/B tests:`);
|
|
894
|
+
for (const t of tests) {
|
|
895
|
+
console.log(` ${t.id}: ${t.name} (${t.predictions.length} predictions)`);
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
program
|
|
899
|
+
.command('community-live')
|
|
900
|
+
.description('Show live community prior stats')
|
|
901
|
+
.option('--ingest <json>', 'Ingest signals JSON')
|
|
902
|
+
.option('--decay', 'Apply faster decay to synthetic patterns')
|
|
903
|
+
.option('--opt-out <user>', 'Opt out of community contribution')
|
|
904
|
+
.option('--opt-in <user>', 'Opt back into community contribution')
|
|
905
|
+
.action((options) => {
|
|
906
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
907
|
+
const live = new index_1.CommunityLive(cellDir);
|
|
908
|
+
if (options.ingest) {
|
|
909
|
+
const signals = JSON.parse(options.ingest);
|
|
910
|
+
const stats = live.ingestSignals(signals);
|
|
911
|
+
console.log(`š„ Ingested: ${stats.totalIngested} total, ${stats.syntheticReplaced} syntheticālive`);
|
|
912
|
+
console.log(` Remaining synthetic: ${stats.remainingSynthetic}`);
|
|
913
|
+
console.log(` Weekly rate: ${stats.weeklyRate}`);
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
916
|
+
if (options.decay) {
|
|
917
|
+
live.applyFasterDecay();
|
|
918
|
+
console.log('ā
Faster decay applied to synthetic patterns.');
|
|
919
|
+
return;
|
|
920
|
+
}
|
|
921
|
+
if (options.optOut) {
|
|
922
|
+
live.optOut(options.optOut);
|
|
923
|
+
console.log(`ā
${options.optOut} opted out of community contribution.`);
|
|
924
|
+
return;
|
|
925
|
+
}
|
|
926
|
+
if (options.optIn) {
|
|
927
|
+
live.optIn(options.optIn);
|
|
928
|
+
console.log(`ā
${options.optIn} opted back into community contribution.`);
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
const stats = live.getStats();
|
|
932
|
+
console.log(`\nš ${live.getDisplayLabel()}`);
|
|
933
|
+
console.log(` Total ingested: ${stats.totalIngested}`);
|
|
934
|
+
console.log(` Synthetic replaced: ${stats.syntheticReplaced}`);
|
|
935
|
+
console.log(` Remaining synthetic: ${stats.remainingSynthetic}`);
|
|
936
|
+
console.log(` Weekly rate: ${stats.weeklyRate}`);
|
|
937
|
+
});
|
|
938
|
+
program
|
|
939
|
+
.command('community-full')
|
|
940
|
+
.description('Show full community prior dashboard')
|
|
941
|
+
.option('--translate <json>', 'Translate pattern across languages {pattern, from, to}')
|
|
942
|
+
.action((options) => {
|
|
943
|
+
const cellDir = path.join(process.cwd(), index_1.DEFAULT_CONFIG.cellDir);
|
|
944
|
+
const full = new index_1.CommunityFull(cellDir);
|
|
945
|
+
if (options.translate) {
|
|
946
|
+
const { pattern, from, to } = JSON.parse(options.translate);
|
|
947
|
+
const translated = full.translatePattern(pattern, from, to);
|
|
948
|
+
if (translated) {
|
|
949
|
+
console.log(`ā
Translated: ${translated.description} (confidence: ${translated.confidence.mean})`);
|
|
950
|
+
}
|
|
951
|
+
else {
|
|
952
|
+
console.log('ā No cross-language mapping available.');
|
|
953
|
+
}
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
const dashboard = full.getPowerDashboard();
|
|
957
|
+
console.log(`\nš Community Prior Power Dashboard`);
|
|
958
|
+
console.log(`āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā`);
|
|
959
|
+
console.log(` Total patterns: ${dashboard.totalPatterns}`);
|
|
960
|
+
console.log(` Live patterns: ${dashboard.livePatterns}`);
|
|
961
|
+
console.log(` Synthetic patterns: ${dashboard.syntheticPatterns}`);
|
|
962
|
+
console.log(` Avg confidence: ${dashboard.avgConfidence}`);
|
|
963
|
+
console.log(` Calibration: ${dashboard.calibrationPhase}`);
|
|
964
|
+
console.log(` Cross-language maps: ${dashboard.crossLanguageMappings}`);
|
|
965
|
+
console.log(`\n${full.getDisplayLabel()}`);
|
|
966
|
+
const stats = full.getStats();
|
|
967
|
+
console.log(`\n All-real guarantee: ${stats.isAllReal ? 'ā
YES' : 'ā NO'}`);
|
|
968
|
+
});
|
|
969
|
+
program
|
|
970
|
+
.command('enterprise')
|
|
971
|
+
.description('Enterprise features')
|
|
972
|
+
.option('--obfuscate <name>', 'Obfuscate project name')
|
|
973
|
+
.option('--paginate <json>', 'Paginate items {items, page, pageSize}')
|
|
974
|
+
.option('--s3-config <json>', 'Get S3 config {bucket, region}')
|
|
975
|
+
.option('--self-hosted <url>', 'Get self-hosted config')
|
|
976
|
+
.action((options) => {
|
|
977
|
+
const enterprise = new index_1.EnterpriseFeatures();
|
|
978
|
+
if (options.obfuscate) {
|
|
979
|
+
console.log(`Hash: ${enterprise.obfuscateProjectName(options.obfuscate)}`);
|
|
980
|
+
return;
|
|
981
|
+
}
|
|
982
|
+
if (options.paginate) {
|
|
983
|
+
const { items, page, pageSize } = JSON.parse(options.paginate);
|
|
984
|
+
const result = enterprise.paginate(items, page, pageSize);
|
|
985
|
+
console.log(`Page ${result.page}/${result.totalPages} (${result.total} total items):`);
|
|
986
|
+
for (const item of result.items) {
|
|
987
|
+
console.log(` ${JSON.stringify(item)}`);
|
|
988
|
+
}
|
|
989
|
+
return;
|
|
990
|
+
}
|
|
991
|
+
if (options.s3Config) {
|
|
992
|
+
const { bucket, region } = JSON.parse(options.s3Config);
|
|
993
|
+
console.log(JSON.stringify(enterprise.getS3Config(bucket, region), null, 2));
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
if (options.selfHosted) {
|
|
997
|
+
console.log(JSON.stringify(enterprise.getSelfHostedConfig(options.selfHosted), null, 2));
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
console.log('Enterprise features: obfuscate, paginate, s3-config, self-hosted');
|
|
1001
|
+
});
|
|
1002
|
+
program
|
|
1003
|
+
.command('xdomain')
|
|
1004
|
+
.description('Cross-domain projections (RESEARCH)')
|
|
1005
|
+
.option('-f, --from <domain>', 'Source domain')
|
|
1006
|
+
.option('-t, --to <domain>', 'Target domain')
|
|
1007
|
+
.option('--gate', 'Check research gate status')
|
|
1008
|
+
.action((options) => {
|
|
1009
|
+
const { CrossDomainProjections } = require('./core/cross-domain-projections');
|
|
1010
|
+
const projections = new CrossDomainProjections();
|
|
1011
|
+
if (options.gate) {
|
|
1012
|
+
console.log(projections.getResearchGateStatus());
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
if (options.from && options.to) {
|
|
1016
|
+
const proj = projections.getProjection(options.from, options.to);
|
|
1017
|
+
if (!proj) {
|
|
1018
|
+
console.log('ā No projection available.');
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
console.log(`\nš¬ ${proj.sourceDomain} ā ${proj.targetDomain}`);
|
|
1022
|
+
console.log(` Transfer accuracy: ${proj.transferAccuracy}`);
|
|
1023
|
+
console.log(` Confidence: ${proj.confidence}`);
|
|
1024
|
+
console.log(` Passes 70% gate: ${projections.validateTransferAccuracy(proj) ? 'ā
' : 'ā'}`);
|
|
1025
|
+
console.log('\n Concept mappings:');
|
|
1026
|
+
for (const [from, to] of Object.entries(proj.mappedConcepts)) {
|
|
1027
|
+
console.log(` ${from} ā ${to}`);
|
|
1028
|
+
}
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
console.log('Cross-domain projections:');
|
|
1032
|
+
for (const p of projections.getAllProjections()) {
|
|
1033
|
+
console.log(` ${p.sourceDomain} ā ${p.targetDomain} (${p.transferAccuracy})`);
|
|
1034
|
+
}
|
|
1035
|
+
console.log(`\n${projections.getResearchGateStatus()}`);
|
|
1036
|
+
});
|
|
1037
|
+
// āāā DAEMON COMMANDS āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
1038
|
+
const daemonCmd = program.command('daemon').description('Manage Cell Daemon (background service)');
|
|
1039
|
+
daemonCmd
|
|
1040
|
+
.command('start')
|
|
1041
|
+
.description('Start the Cell Daemon in background')
|
|
1042
|
+
.action(async () => {
|
|
1043
|
+
console.log('Starting Cell Daemon...');
|
|
1044
|
+
try {
|
|
1045
|
+
const { startDaemon } = await Promise.resolve().then(() => __importStar(require('./daemon/lifecycle')));
|
|
1046
|
+
const result = await startDaemon();
|
|
1047
|
+
console.log(`ā
Daemon started (PID: ${result.pid}, Port: ${result.port})`);
|
|
1048
|
+
console.log(` Health: http://localhost:${result.port}/health`);
|
|
1049
|
+
}
|
|
1050
|
+
catch (err) {
|
|
1051
|
+
console.error(`ā Failed to start daemon: ${err.message}`);
|
|
1052
|
+
}
|
|
1053
|
+
});
|
|
1054
|
+
daemonCmd
|
|
1055
|
+
.command('stop')
|
|
1056
|
+
.description('Stop the Cell Daemon')
|
|
1057
|
+
.action(async () => {
|
|
1058
|
+
const { stopDaemon } = await Promise.resolve().then(() => __importStar(require('./daemon/lifecycle')));
|
|
1059
|
+
const result = stopDaemon();
|
|
1060
|
+
console.log(result.success ? `ā
${result.message}` : `ā ļø ${result.message}`);
|
|
1061
|
+
});
|
|
1062
|
+
daemonCmd
|
|
1063
|
+
.command('restart')
|
|
1064
|
+
.description('Restart the Cell Daemon')
|
|
1065
|
+
.action(async () => {
|
|
1066
|
+
console.log('Restarting Cell Daemon...');
|
|
1067
|
+
try {
|
|
1068
|
+
const { restartDaemon } = await Promise.resolve().then(() => __importStar(require('./daemon/lifecycle')));
|
|
1069
|
+
const result = await restartDaemon();
|
|
1070
|
+
console.log(`ā
Daemon restarted (PID: ${result.pid}, Port: ${result.port})`);
|
|
1071
|
+
}
|
|
1072
|
+
catch (err) {
|
|
1073
|
+
console.error(`ā Failed to restart daemon: ${err.message}`);
|
|
1074
|
+
}
|
|
1075
|
+
});
|
|
1076
|
+
daemonCmd
|
|
1077
|
+
.command('status')
|
|
1078
|
+
.description('Show daemon status')
|
|
1079
|
+
.action(async () => {
|
|
1080
|
+
const { statusDaemon } = await Promise.resolve().then(() => __importStar(require('./daemon/lifecycle')));
|
|
1081
|
+
const status = await statusDaemon();
|
|
1082
|
+
if (status.running && status.health) {
|
|
1083
|
+
const h = status.health;
|
|
1084
|
+
console.log('ā
Daemon is running');
|
|
1085
|
+
console.log(` PID: ${status.pid} | Port: ${status.port}`);
|
|
1086
|
+
console.log(` Uptime: ${Math.round(h.uptime)}s | Patterns: ${h.patterns} | Signals: ${h.signals}`);
|
|
1087
|
+
console.log(` Modules: ${h.modulesLoaded || 'N/A'} | Memory: ${Math.round(h.memory / 1024 / 1024)}MB`);
|
|
1088
|
+
}
|
|
1089
|
+
else {
|
|
1090
|
+
console.log('ā Daemon is not running');
|
|
1091
|
+
if (status.pid)
|
|
1092
|
+
console.log(` Stale PID found: ${status.pid}`);
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
program
|
|
1096
|
+
.command('cloud')
|
|
1097
|
+
.description('Manage cloud sync')
|
|
1098
|
+
.addCommand(new commander_1.Command('on')
|
|
1099
|
+
.description('Enable cloud sync (anonymous pattern stats only)')
|
|
1100
|
+
.action(() => {
|
|
1101
|
+
const cellDir = path.join(os.homedir(), '.fivo', 'cell');
|
|
1102
|
+
if (!fs.existsSync(cellDir))
|
|
1103
|
+
fs.mkdirSync(cellDir, { recursive: true });
|
|
1104
|
+
const configPath = path.join(cellDir, 'cell-meta.json');
|
|
1105
|
+
let meta = {};
|
|
1106
|
+
if (fs.existsSync(configPath))
|
|
1107
|
+
meta = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
1108
|
+
meta.cloudSyncEnabled = true;
|
|
1109
|
+
fs.writeFileSync(configPath, JSON.stringify(meta, null, 2), 'utf-8');
|
|
1110
|
+
console.log('š Cloud sync: ON');
|
|
1111
|
+
console.log(' Anonymous pattern stats shared. Code NEVER leaves your machine.');
|
|
1112
|
+
console.log(' Turn off: cell cloud off');
|
|
1113
|
+
}))
|
|
1114
|
+
.addCommand(new commander_1.Command('off')
|
|
1115
|
+
.description('Disable cloud sync (fully offline)')
|
|
1116
|
+
.action(() => {
|
|
1117
|
+
const cellDir = path.join(os.homedir(), '.fivo', 'cell');
|
|
1118
|
+
if (!fs.existsSync(cellDir))
|
|
1119
|
+
fs.mkdirSync(cellDir, { recursive: true });
|
|
1120
|
+
const configPath = path.join(cellDir, 'cell-meta.json');
|
|
1121
|
+
let meta = {};
|
|
1122
|
+
if (fs.existsSync(configPath))
|
|
1123
|
+
meta = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
1124
|
+
meta.cloudSyncEnabled = false;
|
|
1125
|
+
fs.writeFileSync(configPath, JSON.stringify(meta, null, 2), 'utf-8');
|
|
1126
|
+
console.log('š Cloud sync: OFF');
|
|
1127
|
+
console.log(' Fully offline. Nothing leaves your machine.');
|
|
1128
|
+
console.log(' Turn on: cell cloud on');
|
|
1129
|
+
}));
|
|
1130
|
+
program.parse(process.argv);
|
|
1131
|
+
//# sourceMappingURL=cli.js.map
|