🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

botrun-mcli

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

botrun-mcli - npm Package Compare versions

Comparing version
0.2.1
to
0.2.2
+1
-1
package.json
{
"name": "botrun-mcli",
"version": "0.2.1",
"version": "0.2.2",
"description": "Git-backed memory CLI for AI agents",

@@ -5,0 +5,0 @@ "type": "module",

@@ -9,19 +9,44 @@ import { join } from 'node:path';

const result = { synced: [], skipped: [] };
const result = { synced: [], pulled: [], skipped: [] };
for (const [name, scope] of Object.entries(config.scopes)) {
const cloneDir = join(dataDir, name);
let didPull = false;
let didPush = false;
// 1. Always pull remote changes first
try {
const before = await gitExec(['-C', cloneDir, 'rev-parse', 'HEAD']);
await gitExec(['-C', cloneDir, 'pull', '--rebase']);
const after = await gitExec(['-C', cloneDir, 'rev-parse', 'HEAD']);
if (before !== after) didPull = true;
} catch {
// pull may fail if no upstream set; try setting it
try {
const branch = await gitExec(['-C', cloneDir, 'rev-parse', '--abbrev-ref', 'HEAD']);
await gitExec(['-C', cloneDir, 'branch', '--set-upstream-to', `origin/${branch}`, branch]);
const before = await gitExec(['-C', cloneDir, 'rev-parse', 'HEAD']);
await gitExec(['-C', cloneDir, 'pull', '--rebase']);
const after = await gitExec(['-C', cloneDir, 'rev-parse', 'HEAD']);
if (before !== after) didPull = true;
} catch {
// still failed, continue
}
}
// 2. Check for local uncommitted changes and push
const status = await gitExec(['-C', cloneDir, 'status', '--porcelain']);
if (status) {
await gitExec(['-C', cloneDir, 'add', '-A']);
await gitExec(['-C', cloneDir, 'commit', '-m', `bm: update ${name} memories`]);
await gitExec(['-C', cloneDir, 'push']);
didPush = true;
}
if (!status) {
if (didPull || didPush) {
result.synced.push(name);
if (didPull) result.pulled.push(name);
} else {
result.skipped.push(name);
continue;
}
await gitExec(['-C', cloneDir, 'add', '-A']);
await gitExec(['-C', cloneDir, 'commit', '-m', `bm: update ${name} memories`]);
await gitExec(['-C', cloneDir, 'pull', '--rebase']);
await gitExec(['-C', cloneDir, 'push']);
result.synced.push(name);
}

@@ -28,0 +53,0 @@