fivocell 5.2.0 → 5.3.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.
@@ -204,6 +204,9 @@ switch (cmd) {
204
204
  case 'ci':
205
205
  doCI();
206
206
  break;
207
+ case 'sync':
208
+ doSync();
209
+ break;
207
210
  case 'cross-project':
208
211
  doCrossProject();
209
212
  break;
@@ -4104,6 +4107,45 @@ function doMemory() {
4104
4107
  console.log();
4105
4108
  return;
4106
4109
  }
4110
+ if (sub === 'export') {
4111
+ console.log(C.bold(' ── Memory Export ──\n'));
4112
+ try {
4113
+ const { exportMemory } = require('../../06-memory/stores/sync-engine');
4114
+ const { detectProject } = require('../setup/setup');
4115
+ const project = detectProject(cwd).name;
4116
+ const payload = exportMemory(project);
4117
+ const outPath = args[2] || `fivo-memory-${project}-${Date.now()}.json`;
4118
+ require('fs').writeFileSync(outPath, JSON.stringify(payload, null, 2));
4119
+ console.log(C.success(` Exported ${payload.eventCount} events → ${outPath}`));
4120
+ }
4121
+ catch (e) {
4122
+ console.log(C.warn(` Export failed: ${e?.message || String(e)}`));
4123
+ }
4124
+ console.log();
4125
+ return;
4126
+ }
4127
+ if (sub === 'import') {
4128
+ console.log(C.bold(' ── Memory Import ──\n'));
4129
+ try {
4130
+ const srcPath = args[2] || '';
4131
+ if (!srcPath) {
4132
+ console.log(C.warn(' Usage: cell memory import <file.json>'));
4133
+ console.log();
4134
+ return;
4135
+ }
4136
+ const payload = JSON.parse(require('fs').readFileSync(srcPath, 'utf-8'));
4137
+ const { importMemory } = require('../../06-memory/stores/sync-engine');
4138
+ const { detectProject } = require('../setup/setup');
4139
+ const project = detectProject(cwd).name;
4140
+ const result = importMemory(payload, project);
4141
+ console.log(C.success(` Added: ${result.added}, Skipped: ${result.skipped}, Errors: ${result.errors.length}`));
4142
+ }
4143
+ catch (e) {
4144
+ console.log(C.warn(` Import failed: ${e?.message || String(e)}`));
4145
+ }
4146
+ console.log();
4147
+ return;
4148
+ }
4107
4149
  console.log(C.bold(' Cell Memory'));
4108
4150
  console.log(C.dim(' ──────────'));
4109
4151
  console.log(C.dim(' cell memory search <query> Search memory events'));
@@ -4130,6 +4172,8 @@ function doMemory() {
4130
4172
  console.log(C.dim(' cell memory compress [mode] Compress context'));
4131
4173
  console.log(C.dim(' cell memory export Export to JSON'));
4132
4174
  console.log(C.dim(' cell memory stats Show memory stats'));
4175
+ console.log(C.dim(' cell memory export Export memory archive'));
4176
+ console.log(C.dim(' cell memory import Import memory archive'));
4133
4177
  console.log();
4134
4178
  }
4135
4179
  function doCI() {
@@ -4303,4 +4347,69 @@ function doCI() {
4303
4347
  console.log(C.dim(' --coverage N Coverage percentage'));
4304
4348
  console.log();
4305
4349
  }
4350
+ function doSync() {
4351
+ const sub = args[1] || '';
4352
+ const cwd = process.cwd();
4353
+ if (sub === 'status' || sub === 'st') {
4354
+ console.log(C.bold(' ── Sync Status ──\n'));
4355
+ try {
4356
+ const { getSyncStatus } = require('../../06-memory/stores/sync-engine');
4357
+ const { detectProject } = require('../setup/setup');
4358
+ const project = detectProject(cwd).name;
4359
+ const status = getSyncStatus(project);
4360
+ console.log(` Last sync: ${status.lastSyncAt ? C.dim(status.lastSyncAt) : C.warn('never')}`);
4361
+ console.log(` Pending up: ${status.pendingUpload > 0 ? C.warn(status.pendingUpload) : C.success(status.pendingUpload)}`);
4362
+ console.log(` Conflicts: ${status.conflicts > 0 ? C.warn(status.conflicts) : C.success(status.conflicts)}`);
4363
+ }
4364
+ catch (e) {
4365
+ console.log(C.warn(` Sync status failed: ${e?.message || String(e)}`));
4366
+ }
4367
+ console.log();
4368
+ return;
4369
+ }
4370
+ if (sub === 'diff') {
4371
+ console.log(C.bold(' ── Sync Diff ──\n'));
4372
+ try {
4373
+ const { getSyncStatus } = require('../../06-memory/stores/sync-engine');
4374
+ const { detectProject } = require('../setup/setup');
4375
+ const project = detectProject(cwd).name;
4376
+ const status = getSyncStatus(project);
4377
+ const localOnly = status.pendingUpload;
4378
+ console.log(` Local-only events: ${localOnly > 0 ? C.warn(localOnly) : C.success(localOnly)}`);
4379
+ console.log(C.dim(' To diff against a remote file, use:'));
4380
+ console.log(C.dim(' cell memory export → creates export file'));
4381
+ console.log(C.dim(' then compare manually or use API.'));
4382
+ }
4383
+ catch (e) {
4384
+ console.log(C.warn(` Diff failed: ${e?.message || String(e)}`));
4385
+ }
4386
+ console.log();
4387
+ return;
4388
+ }
4389
+ if (sub === 'snapshot') {
4390
+ console.log(C.bold(' ── Sync Snapshot ──\n'));
4391
+ try {
4392
+ const { saveSyncSnapshot } = require('../../06-memory/stores/sync-engine');
4393
+ const { detectProject } = require('../setup/setup');
4394
+ const project = detectProject(cwd).name;
4395
+ saveSyncSnapshot(project);
4396
+ console.log(C.success(' Snapshot saved'));
4397
+ }
4398
+ catch (e) {
4399
+ console.log(C.warn(` Snapshot failed: ${e?.message || String(e)}`));
4400
+ }
4401
+ console.log();
4402
+ return;
4403
+ }
4404
+ console.log(C.bold(' Cell Sync'));
4405
+ console.log(C.dim(' ─────────'));
4406
+ console.log(C.dim(' cell sync status Show sync status'));
4407
+ console.log(C.dim(' cell sync diff Show pending changes'));
4408
+ console.log(C.dim(' cell sync snapshot Save a sync snapshot'));
4409
+ console.log(C.dim(''));
4410
+ console.log(C.dim(' Also available via memory subcommands:'));
4411
+ console.log(C.dim(' cell memory export Export memory archive'));
4412
+ console.log(C.dim(' cell memory import Import memory archive'));
4413
+ console.log();
4414
+ }
4306
4415
  //# sourceMappingURL=cli.js.map