botrun-mcli
Advanced tools
+1
-1
| { | ||
| "name": "botrun-mcli", | ||
| "version": "0.2.0", | ||
| "version": "0.2.1", | ||
| "description": "Git-backed memory CLI for AI agents", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -16,4 +16,13 @@ import { mkdir, lstat } from 'node:fs/promises'; | ||
| async function hasWorkingTree(dir) { | ||
| try { | ||
| const result = await gitExec(['-C', dir, 'rev-parse', '--is-inside-work-tree']); | ||
| return result === 'true'; | ||
| } catch { | ||
| return false; | ||
| } | ||
| } | ||
| async function cloneOrPull(repo, cloneDir, token, localMode, branch) { | ||
| if (await exists(cloneDir)) { | ||
| if (await exists(cloneDir) && await hasWorkingTree(cloneDir)) { | ||
| await gitExec(['-C', cloneDir, 'pull', '--rebase']); | ||
@@ -23,2 +32,8 @@ return; | ||
| // If directory exists but broken (no working tree), remove and re-clone | ||
| if (await exists(cloneDir)) { | ||
| const { rm } = await import('node:fs/promises'); | ||
| await rm(cloneDir, { recursive: true }); | ||
| } | ||
| let cloneUrl; | ||
@@ -25,0 +40,0 @@ if (localMode) { |
17050
2.66%280
4.87%