fivocell 4.4.0 → 4.5.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/dist/__tests__/autostart.test.js +7 -2
- package/dist/__tests__/autostart.test.js.map +1 -1
- package/dist/__tests__/handoff-store.test.d.ts +2 -0
- package/dist/__tests__/handoff-store.test.d.ts.map +1 -0
- package/dist/__tests__/handoff-store.test.js +151 -0
- package/dist/__tests__/handoff-store.test.js.map +1 -0
- package/dist/__tests__/memory-archive.test.d.ts +2 -0
- package/dist/__tests__/memory-archive.test.d.ts.map +1 -0
- package/dist/__tests__/memory-archive.test.js +114 -0
- package/dist/__tests__/memory-archive.test.js.map +1 -0
- package/dist/__tests__/memory-event-store.test.d.ts +2 -0
- package/dist/__tests__/memory-event-store.test.d.ts.map +1 -0
- package/dist/__tests__/memory-event-store.test.js +101 -0
- package/dist/__tests__/memory-event-store.test.js.map +1 -0
- package/dist/__tests__/redactor.test.d.ts +2 -0
- package/dist/__tests__/redactor.test.d.ts.map +1 -0
- package/dist/__tests__/redactor.test.js +89 -0
- package/dist/__tests__/redactor.test.js.map +1 -0
- package/dist/__tests__/style-memory.test.d.ts +2 -0
- package/dist/__tests__/style-memory.test.d.ts.map +1 -0
- package/dist/__tests__/style-memory.test.js +134 -0
- package/dist/__tests__/style-memory.test.js.map +1 -0
- package/dist/walls/06-memory/archive/memory-archive.d.ts +20 -0
- package/dist/walls/06-memory/archive/memory-archive.d.ts.map +1 -0
- package/dist/walls/06-memory/archive/memory-archive.js +201 -0
- package/dist/walls/06-memory/archive/memory-archive.js.map +1 -0
- package/dist/walls/06-memory/database/database.d.ts.map +1 -1
- package/dist/walls/06-memory/database/database.js +100 -0
- package/dist/walls/06-memory/database/database.js.map +1 -1
- package/dist/walls/06-memory/handoff/handoff-store.d.ts +31 -0
- package/dist/walls/06-memory/handoff/handoff-store.d.ts.map +1 -0
- package/dist/walls/06-memory/handoff/handoff-store.js +203 -0
- package/dist/walls/06-memory/handoff/handoff-store.js.map +1 -0
- package/dist/walls/06-memory/privacy/redactor.d.ts +14 -0
- package/dist/walls/06-memory/privacy/redactor.d.ts.map +1 -0
- package/dist/walls/06-memory/privacy/redactor.js +110 -0
- package/dist/walls/06-memory/privacy/redactor.js.map +1 -0
- package/dist/walls/06-memory/stores/memory-event-store.d.ts +43 -0
- package/dist/walls/06-memory/stores/memory-event-store.d.ts.map +1 -0
- package/dist/walls/06-memory/stores/memory-event-store.js +139 -0
- package/dist/walls/06-memory/stores/memory-event-store.js.map +1 -0
- package/dist/walls/06-memory/style/style-memory.d.ts +39 -0
- package/dist/walls/06-memory/style/style-memory.d.ts.map +1 -0
- package/dist/walls/06-memory/style/style-memory.js +186 -0
- package/dist/walls/06-memory/style/style-memory.js.map +1 -0
- package/dist/walls/07-runtime/cli/cli.js +291 -0
- package/dist/walls/07-runtime/cli/cli.js.map +1 -1
- package/dist/walls/07-runtime/setup/autostart.d.ts +2 -0
- package/dist/walls/07-runtime/setup/autostart.d.ts.map +1 -1
- package/dist/walls/07-runtime/setup/autostart.js +49 -16
- package/dist/walls/07-runtime/setup/autostart.js.map +1 -1
- package/dist/walls/07-runtime/setup/setup.d.ts.map +1 -1
- package/dist/walls/07-runtime/setup/setup.js +35 -0
- package/dist/walls/07-runtime/setup/setup.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.loadDeveloperStyle = loadDeveloperStyle;
|
|
37
|
+
exports.saveDeveloperStyle = saveDeveloperStyle;
|
|
38
|
+
exports.loadProjectStyle = loadProjectStyle;
|
|
39
|
+
exports.saveProjectStyle = saveProjectStyle;
|
|
40
|
+
exports.loadCommunication = loadCommunication;
|
|
41
|
+
exports.saveCommunication = saveCommunication;
|
|
42
|
+
exports.getStyleProfile = getStyleProfile;
|
|
43
|
+
exports.updateDeveloperPreference = updateDeveloperPreference;
|
|
44
|
+
exports.addVerificationCommand = addVerificationCommand;
|
|
45
|
+
exports.addProductRule = addProductRule;
|
|
46
|
+
exports.addProjectConvention = addProjectConvention;
|
|
47
|
+
exports.initDefaultStyle = initDefaultStyle;
|
|
48
|
+
const fs = __importStar(require("fs"));
|
|
49
|
+
const path = __importStar(require("path"));
|
|
50
|
+
const database_1 = require("../database/database");
|
|
51
|
+
const DEFAULT_DEVELOPER_STYLE = {
|
|
52
|
+
communication: 'Hinglish, simple, direct',
|
|
53
|
+
coding: 'small minimal changes',
|
|
54
|
+
verification: ['npx tsc --noEmit', 'npm test -- --runInBand'],
|
|
55
|
+
privacy: ['never store secrets', 'no browser tracking', 'no keystroke tracking'],
|
|
56
|
+
product_rules: ['OSS/local separate from cloud', 'unlimited memory, filtered context'],
|
|
57
|
+
preferences: {},
|
|
58
|
+
};
|
|
59
|
+
const DEFAULT_PROJECT_STYLE = {
|
|
60
|
+
architecture: 'feature-based walls',
|
|
61
|
+
naming: 'kebab-case files, camelCase functions',
|
|
62
|
+
testing: 'jest with maxWorkers: 1',
|
|
63
|
+
stack: ['TypeScript', 'Node.js', 'SQLite', 'Express'],
|
|
64
|
+
conventions: ['require paths from cli/ use ../../XX-wall/', 'run tsc after every change'],
|
|
65
|
+
entry_points: ['src/index.ts'],
|
|
66
|
+
module_system: 'commonjs',
|
|
67
|
+
};
|
|
68
|
+
function getCellDir(projectDir) {
|
|
69
|
+
return path.join(projectDir, '.cell');
|
|
70
|
+
}
|
|
71
|
+
function getStyleDir(projectDir) {
|
|
72
|
+
return path.join(getCellDir(projectDir), 'memory', 'style');
|
|
73
|
+
}
|
|
74
|
+
function ensureDirs(projectDir) {
|
|
75
|
+
const dir = getStyleDir(projectDir);
|
|
76
|
+
if (!fs.existsSync(dir))
|
|
77
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
78
|
+
}
|
|
79
|
+
function getDeveloperStylePath(projectDir) {
|
|
80
|
+
return path.join(getStyleDir(projectDir), 'developer-style.json');
|
|
81
|
+
}
|
|
82
|
+
function getProjectStylePath(projectDir) {
|
|
83
|
+
return path.join(getStyleDir(projectDir), 'project-style.json');
|
|
84
|
+
}
|
|
85
|
+
function getCommunicationPath(projectDir) {
|
|
86
|
+
return path.join(getStyleDir(projectDir), 'communication.md');
|
|
87
|
+
}
|
|
88
|
+
function loadDeveloperStyle(projectDir) {
|
|
89
|
+
const p = getDeveloperStylePath(projectDir);
|
|
90
|
+
if (!fs.existsSync(p))
|
|
91
|
+
return { ...DEFAULT_DEVELOPER_STYLE, preferences: {} };
|
|
92
|
+
try {
|
|
93
|
+
return JSON.parse(fs.readFileSync(p, 'utf-8'));
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return { ...DEFAULT_DEVELOPER_STYLE, preferences: {} };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function saveDeveloperStyle(projectDir, style) {
|
|
100
|
+
ensureDirs(projectDir);
|
|
101
|
+
fs.writeFileSync(getDeveloperStylePath(projectDir), JSON.stringify(style, null, 2));
|
|
102
|
+
// Also save to SQLite
|
|
103
|
+
const db = (0, database_1.getDb)();
|
|
104
|
+
const project = path.basename(projectDir);
|
|
105
|
+
db.prepare(`
|
|
106
|
+
INSERT OR REPLACE INTO style_profiles (project, profile_type, profile_json, updated_at)
|
|
107
|
+
VALUES (?, 'developer', ?, datetime('now'))
|
|
108
|
+
`).run(project, JSON.stringify(style));
|
|
109
|
+
}
|
|
110
|
+
function loadProjectStyle(projectDir) {
|
|
111
|
+
const p = getProjectStylePath(projectDir);
|
|
112
|
+
if (!fs.existsSync(p))
|
|
113
|
+
return { ...DEFAULT_PROJECT_STYLE };
|
|
114
|
+
try {
|
|
115
|
+
return JSON.parse(fs.readFileSync(p, 'utf-8'));
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return { ...DEFAULT_PROJECT_STYLE };
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function saveProjectStyle(projectDir, style) {
|
|
122
|
+
ensureDirs(projectDir);
|
|
123
|
+
fs.writeFileSync(getProjectStylePath(projectDir), JSON.stringify(style, null, 2));
|
|
124
|
+
const db = (0, database_1.getDb)();
|
|
125
|
+
const project = path.basename(projectDir);
|
|
126
|
+
db.prepare(`
|
|
127
|
+
INSERT OR REPLACE INTO style_profiles (project, profile_type, profile_json, updated_at)
|
|
128
|
+
VALUES (?, 'project', ?, datetime('now'))
|
|
129
|
+
`).run(project, JSON.stringify(style));
|
|
130
|
+
}
|
|
131
|
+
function loadCommunication(projectDir) {
|
|
132
|
+
const p = getCommunicationPath(projectDir);
|
|
133
|
+
if (!fs.existsSync(p))
|
|
134
|
+
return '# Communication Style\n\nHinglish, simple, direct. No over-explanation.';
|
|
135
|
+
return fs.readFileSync(p, 'utf-8');
|
|
136
|
+
}
|
|
137
|
+
function saveCommunication(projectDir, content) {
|
|
138
|
+
ensureDirs(projectDir);
|
|
139
|
+
fs.writeFileSync(getCommunicationPath(projectDir), content);
|
|
140
|
+
}
|
|
141
|
+
function getStyleProfile(projectDir) {
|
|
142
|
+
return {
|
|
143
|
+
project: path.basename(projectDir),
|
|
144
|
+
developer: loadDeveloperStyle(projectDir),
|
|
145
|
+
project_style: loadProjectStyle(projectDir),
|
|
146
|
+
updated_at: new Date().toISOString(),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function updateDeveloperPreference(projectDir, key, value) {
|
|
150
|
+
const style = loadDeveloperStyle(projectDir);
|
|
151
|
+
style.preferences[key] = value;
|
|
152
|
+
saveDeveloperStyle(projectDir, style);
|
|
153
|
+
}
|
|
154
|
+
function addVerificationCommand(projectDir, command) {
|
|
155
|
+
const style = loadDeveloperStyle(projectDir);
|
|
156
|
+
if (!style.verification.includes(command)) {
|
|
157
|
+
style.verification.push(command);
|
|
158
|
+
saveDeveloperStyle(projectDir, style);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function addProductRule(projectDir, rule) {
|
|
162
|
+
const style = loadDeveloperStyle(projectDir);
|
|
163
|
+
if (!style.product_rules.includes(rule)) {
|
|
164
|
+
style.product_rules.push(rule);
|
|
165
|
+
saveDeveloperStyle(projectDir, style);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function addProjectConvention(projectDir, convention) {
|
|
169
|
+
const style = loadProjectStyle(projectDir);
|
|
170
|
+
if (!style.conventions.includes(convention)) {
|
|
171
|
+
style.conventions.push(convention);
|
|
172
|
+
saveProjectStyle(projectDir, style);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function initDefaultStyle(projectDir) {
|
|
176
|
+
if (!fs.existsSync(getDeveloperStylePath(projectDir))) {
|
|
177
|
+
saveDeveloperStyle(projectDir, DEFAULT_DEVELOPER_STYLE);
|
|
178
|
+
}
|
|
179
|
+
if (!fs.existsSync(getProjectStylePath(projectDir))) {
|
|
180
|
+
saveProjectStyle(projectDir, DEFAULT_PROJECT_STYLE);
|
|
181
|
+
}
|
|
182
|
+
if (!fs.existsSync(getCommunicationPath(projectDir))) {
|
|
183
|
+
saveCommunication(projectDir, '# Communication Style\n\nHinglish, simple, direct. No over-explanation.');
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=style-memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-memory.js","sourceRoot":"","sources":["../../../../src/walls/06-memory/style/style-memory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,gDAQC;AAED,gDAWC;AAED,4CAQC;AAED,4CAUC;AAED,8CAIC;AAED,8CAGC;AAED,0CAOC;AAED,8DAIC;AAED,wDAMC;AAED,wCAMC;AAED,oDAMC;AAED,4CAUC;AAtLD,uCAAyB;AACzB,2CAA6B;AAC7B,mDAA6C;AA+B7C,MAAM,uBAAuB,GAAmB;IAC9C,aAAa,EAAE,0BAA0B;IACzC,MAAM,EAAE,uBAAuB;IAC/B,YAAY,EAAE,CAAC,kBAAkB,EAAE,yBAAyB,CAAC;IAC7D,OAAO,EAAE,CAAC,qBAAqB,EAAE,qBAAqB,EAAE,uBAAuB,CAAC;IAChF,aAAa,EAAE,CAAC,+BAA+B,EAAE,oCAAoC,CAAC;IACtF,WAAW,EAAE,EAAE;CAChB,CAAC;AAEF,M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C,EAAE,CAAC,UAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QACtD,kBAAkB,CAAC,UAAU,EAAE,uBAAuB,CAAC,CAAC;IAC1D,CAAC;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QACpD,gBAAgB,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAC;IACtD,CAAC;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QACrD,iBAAiB,CAAC,UAAU,EAAE,yEAAyE,CAAC,CAAC;IAC3G,CAAC;AACH,CAAC"}
|
|
@@ -189,6 +189,12 @@ switch (cmd) {
|
|
|
189
189
|
case 'why':
|
|
190
190
|
doWhy();
|
|
191
191
|
break;
|
|
192
|
+
case 'handoff':
|
|
193
|
+
doHandoff();
|
|
194
|
+
break;
|
|
195
|
+
case 'memory':
|
|
196
|
+
doMemory();
|
|
197
|
+
break;
|
|
192
198
|
case 'repl':
|
|
193
199
|
case '-i':
|
|
194
200
|
case '--interactive':
|
|
@@ -1847,6 +1853,7 @@ function doContext() {
|
|
|
1847
1853
|
let host = '127.0.0.1';
|
|
1848
1854
|
let shortMode = false;
|
|
1849
1855
|
let fullMode = false;
|
|
1856
|
+
let topicQuery = '';
|
|
1850
1857
|
for (let i = 2; i < args.length; i++) {
|
|
1851
1858
|
const a = args[i];
|
|
1852
1859
|
if (a === '--no-live') {
|
|
@@ -1865,6 +1872,12 @@ function doContext() {
|
|
|
1865
1872
|
fullMode = true;
|
|
1866
1873
|
continue;
|
|
1867
1874
|
}
|
|
1875
|
+
if (a === '--topic' && i + 1 < args.length) {
|
|
1876
|
+
topicQuery = args[++i];
|
|
1877
|
+
continue;
|
|
1878
|
+
}
|
|
1879
|
+
if (typeof a === 'string' && a.startsWith('--topic='))
|
|
1880
|
+
topicQuery = a.split('=').slice(1).join('=');
|
|
1868
1881
|
if (typeof a === 'string' && a.startsWith('--port='))
|
|
1869
1882
|
port = parseInt(a.split('=')[1], 10) || null;
|
|
1870
1883
|
if (typeof a === 'string' && a.startsWith('--host='))
|
|
@@ -1987,6 +2000,27 @@ function doContext() {
|
|
|
1987
2000
|
else {
|
|
1988
2001
|
console.log(text);
|
|
1989
2002
|
}
|
|
2003
|
+
// Topic-based context search
|
|
2004
|
+
if (topicQuery) {
|
|
2005
|
+
console.log('');
|
|
2006
|
+
console.log(C.bold(` ── Topic Context: "${topicQuery}" ──`));
|
|
2007
|
+
try {
|
|
2008
|
+
const { searchMemoryEvents } = require('../../06-memory/stores/memory-event-store');
|
|
2009
|
+
const events = searchMemoryEvents(topicQuery, projectArg, 20);
|
|
2010
|
+
if (events.length > 0) {
|
|
2011
|
+
for (const ev of events) {
|
|
2012
|
+
const imp = ev.importance >= 8 ? C.success(`[IMP:${ev.importance}]`) : `[${ev.importance}]`;
|
|
2013
|
+
console.log(` ${imp} ${C.dim(ev.created_at)} ${C.primary(ev.type)}: ${ev.summary}`);
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
else {
|
|
2017
|
+
console.log(C.dim(` No memory events found for "${topicQuery}"`));
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
catch (e) {
|
|
2021
|
+
console.log(C.warn(` Topic search failed: ${e?.message || String(e)}`));
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
1990
2024
|
try {
|
|
1991
2025
|
const { markFirstContext } = require('../setup/cell-state');
|
|
1992
2026
|
markFirstContext();
|
|
@@ -3072,6 +3106,9 @@ function doHelp() {
|
|
|
3072
3106
|
console.log(` ${C.primary('cell evolution [dir] [--stack]')} Project evolution map + stack timeline`);
|
|
3073
3107
|
console.log(` ${C.primary('cell focus [dir]')} Focus report — active/stalled/abandoned projects`);
|
|
3074
3108
|
console.log(` ${C.primary('cell why <topic>')} Search decisions by topic`);
|
|
3109
|
+
console.log(` ${C.primary('cell handoff')} Show/update handoff context`);
|
|
3110
|
+
console.log(` ${C.primary('cell memory')} Search/timeline/compact/verify/export memory`);
|
|
3111
|
+
console.log(` ${C.primary('cell context --topic')} Add topic-based memory search to context`);
|
|
3075
3112
|
console.log(` ${C.primary('cell repl')} Interactive REPL with / completion (or just run \`cell\` in a TTY)`);
|
|
3076
3113
|
console.log(` ${C.primary('cell help')} Show this help`);
|
|
3077
3114
|
console.log();
|
|
@@ -3242,4 +3279,258 @@ function doWhy() {
|
|
|
3242
3279
|
console.log();
|
|
3243
3280
|
}
|
|
3244
3281
|
// test touch 14:40:59
|
|
3282
|
+
// ─── cell handoff — show/update handoff context ──────────────────────────────
|
|
3283
|
+
function doHandoff() {
|
|
3284
|
+
const sub = args[1] || '';
|
|
3285
|
+
const cwd = process.cwd();
|
|
3286
|
+
if (sub === '--update' || sub === '-u') {
|
|
3287
|
+
console.log(C.primary(' Updating handoff...'));
|
|
3288
|
+
try {
|
|
3289
|
+
const { rotateHandoffIfNeeded } = require('../../06-memory/handoff/handoff-store');
|
|
3290
|
+
const rotated = rotateHandoffIfNeeded(cwd);
|
|
3291
|
+
if (rotated) {
|
|
3292
|
+
console.log(C.success(' Handoff rotated (old content moved to monthly history).'));
|
|
3293
|
+
}
|
|
3294
|
+
else {
|
|
3295
|
+
console.log(C.dim(' No rotation needed.'));
|
|
3296
|
+
}
|
|
3297
|
+
console.log(C.success(' Handoff updated.'));
|
|
3298
|
+
}
|
|
3299
|
+
catch (e) {
|
|
3300
|
+
console.log(C.warn(` Update failed: ${e?.message || String(e)}`));
|
|
3301
|
+
}
|
|
3302
|
+
console.log();
|
|
3303
|
+
return;
|
|
3304
|
+
}
|
|
3305
|
+
if (sub === '--current' || sub === '-c' || sub === '') {
|
|
3306
|
+
console.log(C.bold(' ── Current Handoff ──'));
|
|
3307
|
+
try {
|
|
3308
|
+
const { getCurrentHandoff, getHandoffStats } = require('../../06-memory/handoff/handoff-store');
|
|
3309
|
+
const content = getCurrentHandoff(cwd);
|
|
3310
|
+
console.log(content);
|
|
3311
|
+
const stats = getHandoffStats(cwd);
|
|
3312
|
+
console.log(C.dim(`\n Lines: ${stats.currentLines} | History months: ${stats.historyMonths} | DB entries: ${stats.dbEntries} | Needs rotation: ${stats.needsRotation}`));
|
|
3313
|
+
}
|
|
3314
|
+
catch (e) {
|
|
3315
|
+
console.log(C.warn(` Handoff failed: ${e?.message || String(e)}`));
|
|
3316
|
+
}
|
|
3317
|
+
console.log();
|
|
3318
|
+
return;
|
|
3319
|
+
}
|
|
3320
|
+
if (sub === '--history' || sub === '-h') {
|
|
3321
|
+
const month = args[2] || undefined;
|
|
3322
|
+
console.log(C.bold(` ── Handoff History${month ? ` (${month})` : ''} ──`));
|
|
3323
|
+
try {
|
|
3324
|
+
const { getHistoryHandoff } = require('../../06-memory/handoff/handoff-store');
|
|
3325
|
+
console.log(getHistoryHandoff(cwd, month));
|
|
3326
|
+
}
|
|
3327
|
+
catch (e) {
|
|
3328
|
+
console.log(C.warn(` History failed: ${e?.message || String(e)}`));
|
|
3329
|
+
}
|
|
3330
|
+
console.log();
|
|
3331
|
+
return;
|
|
3332
|
+
}
|
|
3333
|
+
if (sub === '--log') {
|
|
3334
|
+
const title = args[2] || 'Untitled';
|
|
3335
|
+
const summary = args[3] || '';
|
|
3336
|
+
if (!summary) {
|
|
3337
|
+
console.log(C.warn(' Usage: cell handoff --log "title" "summary"'));
|
|
3338
|
+
console.log();
|
|
3339
|
+
return;
|
|
3340
|
+
}
|
|
3341
|
+
try {
|
|
3342
|
+
const { saveHandoffEntry } = require('../../06-memory/handoff/handoff-store');
|
|
3343
|
+
const { detectProject } = require('../setup/setup');
|
|
3344
|
+
const project = detectProject(cwd).name;
|
|
3345
|
+
saveHandoffEntry(cwd, {
|
|
3346
|
+
project,
|
|
3347
|
+
title,
|
|
3348
|
+
summary,
|
|
3349
|
+
status: 'done',
|
|
3350
|
+
filesChanged: args.slice(4).filter(a => a.endsWith('.ts') || a.endsWith('.js') || a.endsWith('.json') || a.endsWith('.md')),
|
|
3351
|
+
});
|
|
3352
|
+
console.log(C.success(` Handoff logged: ${title}`));
|
|
3353
|
+
}
|
|
3354
|
+
catch (e) {
|
|
3355
|
+
console.log(C.warn(` Log failed: ${e?.message || String(e)}`));
|
|
3356
|
+
}
|
|
3357
|
+
console.log();
|
|
3358
|
+
return;
|
|
3359
|
+
}
|
|
3360
|
+
console.log(C.bold(' Cell Handoff'));
|
|
3361
|
+
console.log(C.dim(' ─────────'));
|
|
3362
|
+
console.log(C.dim(' cell handoff Show current handoff'));
|
|
3363
|
+
console.log(C.dim(' cell handoff --current Show current handoff'));
|
|
3364
|
+
console.log(C.dim(' cell handoff --history [YYYY-MM] Show monthly history'));
|
|
3365
|
+
console.log(C.dim(' cell handoff --update Rotate if too long'));
|
|
3366
|
+
console.log(C.dim(' cell handoff --log "title" "summary" Log new entry'));
|
|
3367
|
+
console.log();
|
|
3368
|
+
}
|
|
3369
|
+
// ─── cell memory — search/timeline/compact/verify/export ─────────────────────
|
|
3370
|
+
function doMemory() {
|
|
3371
|
+
const sub = args[1] || '';
|
|
3372
|
+
const cwd = process.cwd();
|
|
3373
|
+
if (sub === 'search' || sub === 's') {
|
|
3374
|
+
const query = args[2] || '';
|
|
3375
|
+
if (!query) {
|
|
3376
|
+
console.log(C.warn(' Usage: cell memory search <query>'));
|
|
3377
|
+
console.log();
|
|
3378
|
+
return;
|
|
3379
|
+
}
|
|
3380
|
+
console.log(C.bold(` ── Memory Search: "${query}" ──\n`));
|
|
3381
|
+
try {
|
|
3382
|
+
const { searchMemoryEvents } = require('../../06-memory/stores/memory-event-store');
|
|
3383
|
+
const { detectProject } = require('../setup/setup');
|
|
3384
|
+
const project = detectProject(cwd).name;
|
|
3385
|
+
const events = searchMemoryEvents(query, project, 20);
|
|
3386
|
+
if (events.length === 0) {
|
|
3387
|
+
console.log(C.dim(' No matching memories found.'));
|
|
3388
|
+
}
|
|
3389
|
+
else {
|
|
3390
|
+
for (const ev of events) {
|
|
3391
|
+
const imp = ev.importance >= 8 ? C.success(`[IMP:${ev.importance}]`) : ev.importance >= 5 ? C.primary(`[${ev.importance}]`) : C.dim(`[${ev.importance}]`);
|
|
3392
|
+
console.log(` ${imp} ${C.dim(ev.created_at)} ${C.primary(ev.type)}: ${ev.summary}`);
|
|
3393
|
+
if (ev.topic)
|
|
3394
|
+
console.log(C.dim(` topic: ${ev.topic}`));
|
|
3395
|
+
if (ev.files_json) {
|
|
3396
|
+
try {
|
|
3397
|
+
const files = JSON.parse(ev.files_json);
|
|
3398
|
+
if (files.length > 0)
|
|
3399
|
+
console.log(C.dim(` files: ${files.join(', ')}`));
|
|
3400
|
+
}
|
|
3401
|
+
catch { }
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
console.log(C.dim(`\n ${events.length} result(s) found.`));
|
|
3405
|
+
}
|
|
3406
|
+
}
|
|
3407
|
+
catch (e) {
|
|
3408
|
+
console.log(C.warn(` Search failed: ${e?.message || String(e)}`));
|
|
3409
|
+
}
|
|
3410
|
+
console.log();
|
|
3411
|
+
return;
|
|
3412
|
+
}
|
|
3413
|
+
if (sub === 'timeline' || sub === 't') {
|
|
3414
|
+
const days = parseInt(args[2] || '30', 10);
|
|
3415
|
+
console.log(C.bold(` ── Memory Timeline (${days} days) ──\n`));
|
|
3416
|
+
try {
|
|
3417
|
+
const { getMemoryTimeline } = require('../../06-memory/stores/memory-event-store');
|
|
3418
|
+
const { detectProject } = require('../setup/setup');
|
|
3419
|
+
const project = detectProject(cwd).name;
|
|
3420
|
+
const timeline = getMemoryTimeline(project, days);
|
|
3421
|
+
if (timeline.length === 0) {
|
|
3422
|
+
console.log(C.dim(' No events in this period.'));
|
|
3423
|
+
}
|
|
3424
|
+
else {
|
|
3425
|
+
for (const day of timeline) {
|
|
3426
|
+
const bar = '█'.repeat(Math.min(day.count, 30));
|
|
3427
|
+
console.log(` ${C.dim(day.date)} ${C.primary(bar)} ${day.count} events`);
|
|
3428
|
+
const types = Object.entries(day.types).map(([t, c]) => `${t}:${c}`).join(', ');
|
|
3429
|
+
console.log(C.dim(` ${types}`));
|
|
3430
|
+
}
|
|
3431
|
+
}
|
|
3432
|
+
}
|
|
3433
|
+
catch (e) {
|
|
3434
|
+
console.log(C.warn(` Timeline failed: ${e?.message || String(e)}`));
|
|
3435
|
+
}
|
|
3436
|
+
console.log();
|
|
3437
|
+
return;
|
|
3438
|
+
}
|
|
3439
|
+
if (sub === 'compact' || sub === 'c') {
|
|
3440
|
+
console.log(C.primary(' Compacting memory...'));
|
|
3441
|
+
try {
|
|
3442
|
+
const { rotateHandoffIfNeeded } = require('../../06-memory/handoff/handoff-store');
|
|
3443
|
+
const rotated = rotateHandoffIfNeeded(cwd);
|
|
3444
|
+
if (rotated)
|
|
3445
|
+
console.log(C.success(' Handoff rotated.'));
|
|
3446
|
+
else
|
|
3447
|
+
console.log(C.dim(' No handoff rotation needed.'));
|
|
3448
|
+
const { getMemoryStats } = require('../../06-memory/stores/memory-event-store');
|
|
3449
|
+
const stats = getMemoryStats();
|
|
3450
|
+
console.log(C.success(` Memory events: ${stats.total} | Avg importance: ${stats.avgImportance}`));
|
|
3451
|
+
}
|
|
3452
|
+
catch (e) {
|
|
3453
|
+
console.log(C.warn(` Compact failed: ${e?.message || String(e)}`));
|
|
3454
|
+
}
|
|
3455
|
+
console.log();
|
|
3456
|
+
return;
|
|
3457
|
+
}
|
|
3458
|
+
if (sub === 'verify' || sub === 'v') {
|
|
3459
|
+
console.log(C.bold(' ── Memory Verify ──\n'));
|
|
3460
|
+
try {
|
|
3461
|
+
const { getMemoryStats } = require('../../06-memory/stores/memory-event-store');
|
|
3462
|
+
const stats = getMemoryStats();
|
|
3463
|
+
console.log(` Events: ${C.num(String(stats.total))}`);
|
|
3464
|
+
console.log(` Avg importance: ${stats.avgImportance}`);
|
|
3465
|
+
console.log(` Oldest: ${stats.oldestEvent || 'none'}`);
|
|
3466
|
+
console.log(` Newest: ${stats.newestEvent || 'none'}`);
|
|
3467
|
+
if (Object.keys(stats.byType).length > 0) {
|
|
3468
|
+
console.log(C.dim('\n By type:'));
|
|
3469
|
+
for (const [type, count] of Object.entries(stats.byType).sort((a, b) => b[1] - a[1])) {
|
|
3470
|
+
console.log(` ${type}: ${count}`);
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3473
|
+
const { getHandoffStats } = require('../../06-memory/handoff/handoff-store');
|
|
3474
|
+
const hs = getHandoffStats(cwd);
|
|
3475
|
+
console.log(C.dim('\n Handoff:'));
|
|
3476
|
+
console.log(` Current lines: ${hs.currentLines}`);
|
|
3477
|
+
console.log(` History months: ${hs.historyMonths}`);
|
|
3478
|
+
console.log(` DB entries: ${hs.dbEntries}`);
|
|
3479
|
+
console.log(` Needs rotation: ${hs.needsRotation}`);
|
|
3480
|
+
}
|
|
3481
|
+
catch (e) {
|
|
3482
|
+
console.log(C.warn(` Verify failed: ${e?.message || String(e)}`));
|
|
3483
|
+
}
|
|
3484
|
+
console.log();
|
|
3485
|
+
return;
|
|
3486
|
+
}
|
|
3487
|
+
if (sub === 'export' || sub === 'e') {
|
|
3488
|
+
console.log(C.bold(' ── Memory Export ──\n'));
|
|
3489
|
+
try {
|
|
3490
|
+
const { getMemoryEvents, getMemoryStats } = require('../../06-memory/stores/memory-event-store');
|
|
3491
|
+
const stats = getMemoryStats();
|
|
3492
|
+
const events = getMemoryEvents({ limit: 500 });
|
|
3493
|
+
const exportData = { stats, events, exportedAt: new Date().toISOString() };
|
|
3494
|
+
const exportPath = require('path').join(cwd, '.cell', 'memory', 'export.json');
|
|
3495
|
+
require('fs').writeFileSync(exportPath, JSON.stringify(exportData, null, 2));
|
|
3496
|
+
console.log(C.success(` Exported ${events.length} events to .cell/memory/export.json`));
|
|
3497
|
+
}
|
|
3498
|
+
catch (e) {
|
|
3499
|
+
console.log(C.warn(` Export failed: ${e?.message || String(e)}`));
|
|
3500
|
+
}
|
|
3501
|
+
console.log();
|
|
3502
|
+
return;
|
|
3503
|
+
}
|
|
3504
|
+
if (sub === 'stats') {
|
|
3505
|
+
console.log(C.bold(' ── Memory Stats ──\n'));
|
|
3506
|
+
try {
|
|
3507
|
+
const { getMemoryStats } = require('../../06-memory/stores/memory-event-store');
|
|
3508
|
+
const stats = getMemoryStats();
|
|
3509
|
+
console.log(` Total events: ${C.num(String(stats.total))}`);
|
|
3510
|
+
console.log(` Avg importance: ${stats.avgImportance}`);
|
|
3511
|
+
console.log(` Oldest: ${stats.oldestEvent || 'none'}`);
|
|
3512
|
+
console.log(` Newest: ${stats.newestEvent || 'none'}`);
|
|
3513
|
+
if (Object.keys(stats.byType).length > 0) {
|
|
3514
|
+
console.log(C.dim('\n By type:'));
|
|
3515
|
+
for (const [type, count] of Object.entries(stats.byType).sort((a, b) => b[1] - a[1])) {
|
|
3516
|
+
console.log(` ${type}: ${count}`);
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
}
|
|
3520
|
+
catch (e) {
|
|
3521
|
+
console.log(C.warn(` Stats failed: ${e?.message || String(e)}`));
|
|
3522
|
+
}
|
|
3523
|
+
console.log();
|
|
3524
|
+
return;
|
|
3525
|
+
}
|
|
3526
|
+
console.log(C.bold(' Cell Memory'));
|
|
3527
|
+
console.log(C.dim(' ──────────'));
|
|
3528
|
+
console.log(C.dim(' cell memory search <query> Search memory events'));
|
|
3529
|
+
console.log(C.dim(' cell memory timeline [days] Show activity timeline'));
|
|
3530
|
+
console.log(C.dim(' cell memory compact Compact & rotate'));
|
|
3531
|
+
console.log(C.dim(' cell memory verify Verify memory health'));
|
|
3532
|
+
console.log(C.dim(' cell memory export Export to JSON'));
|
|
3533
|
+
console.log(C.dim(' cell memory stats Show memory stats'));
|
|
3534
|
+
console.log();
|
|
3535
|
+
}
|
|
3245
3536
|
//# sourceMappingURL=cli.js.map
|