fivocell 4.4.1 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/context-ranker.test.d.ts +2 -0
- package/dist/__tests__/context-ranker.test.d.ts.map +1 -0
- package/dist/__tests__/context-ranker.test.js +61 -0
- package/dist/__tests__/context-ranker.test.js.map +1 -0
- 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-compact.test.d.ts +2 -0
- package/dist/__tests__/memory-compact.test.d.ts.map +1 -0
- package/dist/__tests__/memory-compact.test.js +43 -0
- package/dist/__tests__/memory-compact.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/__tests__/summary-generator.test.d.ts +2 -0
- package/dist/__tests__/summary-generator.test.d.ts.map +1 -0
- package/dist/__tests__/summary-generator.test.js +53 -0
- package/dist/__tests__/summary-generator.test.js.map +1 -0
- package/dist/walls/01-context/context/prompt-builder.d.ts +7 -0
- package/dist/walls/01-context/context/prompt-builder.d.ts.map +1 -1
- package/dist/walls/01-context/context/prompt-builder.js +29 -0
- package/dist/walls/01-context/context/prompt-builder.js.map +1 -1
- 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/archive/memory-compact.d.ts +17 -0
- package/dist/walls/06-memory/archive/memory-compact.d.ts.map +1 -0
- package/dist/walls/06-memory/archive/memory-compact.js +128 -0
- package/dist/walls/06-memory/archive/memory-compact.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/context-ranker.d.ts +21 -0
- package/dist/walls/06-memory/stores/context-ranker.d.ts.map +1 -0
- package/dist/walls/06-memory/stores/context-ranker.js +84 -0
- package/dist/walls/06-memory/stores/context-ranker.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/stores/summary-generator.d.ts +16 -0
- package/dist/walls/06-memory/stores/summary-generator.d.ts.map +1 -0
- package/dist/walls/06-memory/stores/summary-generator.js +151 -0
- package/dist/walls/06-memory/stores/summary-generator.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 +350 -0
- package/dist/walls/07-runtime/cli/cli.js.map +1 -1
- package/dist/walls/07-runtime/daemon/server.d.ts.map +1 -1
- package/dist/walls/07-runtime/daemon/server.js +99 -0
- package/dist/walls/07-runtime/daemon/server.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/dist/walls/07-runtime/watcher/live-watcher.d.ts.map +1 -1
- package/dist/walls/07-runtime/watcher/live-watcher.js +32 -0
- package/dist/walls/07-runtime/watcher/live-watcher.js.map +1 -1
- package/package.json +1 -1
|
@@ -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,317 @@ 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
|
+
if (sub === 'health') {
|
|
3527
|
+
console.log(C.bold(' ── Memory Health ──\n'));
|
|
3528
|
+
try {
|
|
3529
|
+
const { getMemoryHealth } = require('../../06-memory/archive/memory-compact');
|
|
3530
|
+
const h = getMemoryHealth(cwd);
|
|
3531
|
+
console.log(` Events: ${C.num(String(h.eventCount))}`);
|
|
3532
|
+
console.log(` Archive chunks: ${h.archiveChunks}`);
|
|
3533
|
+
console.log(` Handoff lines: ${h.handoffLines}`);
|
|
3534
|
+
console.log(` Avg importance: ${h.avgImportance}`);
|
|
3535
|
+
console.log(` Oldest: ${h.oldestEvent || 'none'}`);
|
|
3536
|
+
console.log(` Newest: ${h.newestEvent || 'none'}`);
|
|
3537
|
+
}
|
|
3538
|
+
catch (e) {
|
|
3539
|
+
console.log(C.warn(` Health check failed: ${e?.message || String(e)}`));
|
|
3540
|
+
}
|
|
3541
|
+
console.log();
|
|
3542
|
+
return;
|
|
3543
|
+
}
|
|
3544
|
+
if (sub === 'summary' || sub === 'sum') {
|
|
3545
|
+
const period = args[2] || 'daily';
|
|
3546
|
+
console.log(C.bold(` ── Memory Summary (${period}) ──\n`));
|
|
3547
|
+
try {
|
|
3548
|
+
const { generateDailySummary, generateWeeklySummary } = require('../../06-memory/stores/summary-generator');
|
|
3549
|
+
const { detectProject } = require('../setup/setup');
|
|
3550
|
+
const project = detectProject(cwd).name;
|
|
3551
|
+
const summary = period === 'weekly'
|
|
3552
|
+
? generateWeeklySummary(project, cwd)
|
|
3553
|
+
: generateDailySummary(project);
|
|
3554
|
+
console.log(` Date: ${summary.date}`);
|
|
3555
|
+
console.log(` Project: ${summary.project}`);
|
|
3556
|
+
console.log(` Total events: ${summary.totalEvents}`);
|
|
3557
|
+
console.log(` Avg importance: ${summary.importance}`);
|
|
3558
|
+
if (summary.topTopics.length > 0)
|
|
3559
|
+
console.log(` Top topics: ${summary.topTopics.join(', ')}`);
|
|
3560
|
+
if (summary.keyDecisions.length > 0) {
|
|
3561
|
+
console.log(C.dim('\n Key decisions:'));
|
|
3562
|
+
for (const d of summary.keyDecisions.slice(0, 5))
|
|
3563
|
+
console.log(` ${C.primary('→')} ${d}`);
|
|
3564
|
+
}
|
|
3565
|
+
if (summary.errors.length > 0) {
|
|
3566
|
+
console.log(C.dim('\n Errors:'));
|
|
3567
|
+
for (const e of summary.errors.slice(0, 5))
|
|
3568
|
+
console.log(` ${C.warn('✗')} ${e}`);
|
|
3569
|
+
}
|
|
3570
|
+
if (Object.keys(summary.byType).length > 0) {
|
|
3571
|
+
console.log(C.dim('\n By type:'));
|
|
3572
|
+
for (const [type, count] of Object.entries(summary.byType).sort((a, b) => b[1] - a[1])) {
|
|
3573
|
+
console.log(` ${type}: ${count}`);
|
|
3574
|
+
}
|
|
3575
|
+
}
|
|
3576
|
+
}
|
|
3577
|
+
catch (e) {
|
|
3578
|
+
console.log(C.warn(` Summary failed: ${e?.message || String(e)}`));
|
|
3579
|
+
}
|
|
3580
|
+
console.log();
|
|
3581
|
+
return;
|
|
3582
|
+
}
|
|
3583
|
+
console.log(C.bold(' Cell Memory'));
|
|
3584
|
+
console.log(C.dim(' ──────────'));
|
|
3585
|
+
console.log(C.dim(' cell memory search <query> Search memory events'));
|
|
3586
|
+
console.log(C.dim(' cell memory timeline [days] Show activity timeline'));
|
|
3587
|
+
console.log(C.dim(' cell memory compact Compact & rotate'));
|
|
3588
|
+
console.log(C.dim(' cell memory verify Verify memory health'));
|
|
3589
|
+
console.log(C.dim(' cell memory health Full memory health check'));
|
|
3590
|
+
console.log(C.dim(' cell memory summary [daily|weekly] Generate summary'));
|
|
3591
|
+
console.log(C.dim(' cell memory export Export to JSON'));
|
|
3592
|
+
console.log(C.dim(' cell memory stats Show memory stats'));
|
|
3593
|
+
console.log();
|
|
3594
|
+
}
|
|
3245
3595
|
//# sourceMappingURL=cli.js.map
|