brain-memory 0.1.0-beta.1 → 0.1.0-beta.10

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.
@@ -0,0 +1,185 @@
1
+ /**
2
+ * Brain Memory — Export / Import
3
+ *
4
+ * Single-file encrypted export/import for portable memory transfers.
5
+ * Pack all ~/.brain/ files into one JSON blob, optionally AES-256-GCM encrypt,
6
+ * and write a single .brain-export file. Import reverses the process.
7
+ *
8
+ * Zero external dependencies — uses only Node.js built-in fs and crypto.
9
+ */
10
+
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+ const { encrypt, decrypt } = require('./crypto');
14
+
15
+ // Directories inside ~/.brain/ to skip during export
16
+ const EXCLUDED = new Set(['.sync', '.DS_Store']);
17
+
18
+ /**
19
+ * Export the entire ~/.brain/ directory to a single file.
20
+ *
21
+ * @param {string} brainDir - Absolute path to ~/.brain/
22
+ * @param {string} outputPath - Destination file path
23
+ * @param {string|null} [passphrase] - If provided, encrypt the export
24
+ * @returns {{ fileCount: number, outputPath: string }}
25
+ */
26
+ function exportBrain(brainDir, outputPath, passphrase) {
27
+ if (!fs.existsSync(brainDir)) {
28
+ throw new Error('~/.brain/ directory not found. Run /brain:init first.');
29
+ }
30
+
31
+ const files = {};
32
+ collectFiles(brainDir, brainDir, files);
33
+
34
+ const payload = JSON.stringify({ version: 1, exportedAt: new Date().toISOString(), files });
35
+
36
+ if (passphrase) {
37
+ const encrypted = encrypt(payload, passphrase);
38
+ fs.writeFileSync(outputPath, encrypted);
39
+ } else {
40
+ fs.writeFileSync(outputPath, payload, 'utf8');
41
+ }
42
+
43
+ return { fileCount: Object.keys(files).length, outputPath };
44
+ }
45
+
46
+ /**
47
+ * Recursively collect all files from brainDir into a flat { relativePath: content } map.
48
+ *
49
+ * @param {string} dir - Current directory to scan
50
+ * @param {string} brainDir - Root ~/.brain/ directory
51
+ * @param {Object} files - Accumulator object
52
+ */
53
+ function collectFiles(dir, brainDir, files) {
54
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
55
+ for (const entry of entries) {
56
+ const rel = path.relative(brainDir, path.join(dir, entry.name));
57
+ const topLevel = rel.split(path.sep)[0];
58
+ if (EXCLUDED.has(topLevel)) continue;
59
+
60
+ const fullPath = path.join(dir, entry.name);
61
+ if (entry.isDirectory()) {
62
+ collectFiles(fullPath, brainDir, files);
63
+ } else {
64
+ // Normalize path separators to forward slash for portability
65
+ const key = rel.split(path.sep).join('/');
66
+ files[key] = fs.readFileSync(fullPath, 'utf8');
67
+ }
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Import memories from a .brain-export file into ~/.brain/.
73
+ *
74
+ * @param {string} inputPath - Path to the export file
75
+ * @param {string} brainDir - Absolute path to ~/.brain/
76
+ * @param {string|null} [passphrase] - Decryption passphrase (if the export is encrypted)
77
+ * @param {Object} [options]
78
+ * @param {string} [options.mode='overwrite'] - 'overwrite' replaces all files; 'merge' only imports newer files
79
+ * @returns {{ fileCount: number, skipped: number }}
80
+ */
81
+ function importBrain(inputPath, brainDir, passphrase, options = {}) {
82
+ const mode = options.mode || 'overwrite';
83
+
84
+ if (!fs.existsSync(inputPath)) {
85
+ throw new Error(`Export file not found: ${inputPath}`);
86
+ }
87
+
88
+ const raw = fs.readFileSync(inputPath);
89
+ let payload;
90
+
91
+ if (passphrase) {
92
+ try {
93
+ payload = JSON.parse(decrypt(raw, passphrase));
94
+ } catch (err) {
95
+ if (err.message.includes('Unsupported state') || err.message.includes('unable to authenticate') || err.message.includes('Invalid encrypted data')) {
96
+ throw new Error('Decryption failed — wrong passphrase or corrupted file.');
97
+ }
98
+ throw err;
99
+ }
100
+ } else {
101
+ try {
102
+ payload = JSON.parse(raw.toString('utf8'));
103
+ } catch {
104
+ throw new Error('Invalid export file. If the file is encrypted, provide a passphrase.');
105
+ }
106
+ }
107
+
108
+ if (!payload || !payload.files || typeof payload.files !== 'object') {
109
+ throw new Error('Invalid export format: missing files object.');
110
+ }
111
+
112
+ fs.mkdirSync(brainDir, { recursive: true });
113
+
114
+ let imported = 0;
115
+ let skipped = 0;
116
+
117
+ for (const [relPath, content] of Object.entries(payload.files)) {
118
+ // Convert forward-slash paths to OS-native
119
+ const nativePath = relPath.split('/').join(path.sep);
120
+ const destPath = path.join(brainDir, nativePath);
121
+
122
+ if (mode === 'merge' && fs.existsSync(destPath)) {
123
+ // In merge mode, only import if the export's file is newer
124
+ // We compare exportedAt vs local file mtime
125
+ const localMtime = fs.statSync(destPath).mtime;
126
+ const exportDate = new Date(payload.exportedAt);
127
+ if (exportDate <= localMtime) {
128
+ skipped++;
129
+ continue;
130
+ }
131
+ }
132
+
133
+ fs.mkdirSync(path.dirname(destPath), { recursive: true });
134
+ fs.writeFileSync(destPath, content, 'utf8');
135
+ imported++;
136
+ }
137
+
138
+ return { fileCount: imported, skipped };
139
+ }
140
+
141
+ /**
142
+ * Preview what an import would do without writing any files.
143
+ *
144
+ * @param {string} inputPath - Path to the export file
145
+ * @param {string} brainDir - Absolute path to ~/.brain/
146
+ * @param {string|null} [passphrase] - Decryption passphrase
147
+ * @returns {{ totalFiles: number, newFiles: string[], existingFiles: string[], exportedAt: string }}
148
+ */
149
+ function previewImport(inputPath, brainDir, passphrase) {
150
+ const raw = fs.readFileSync(inputPath);
151
+ let payload;
152
+
153
+ if (passphrase) {
154
+ payload = JSON.parse(decrypt(raw, passphrase));
155
+ } else {
156
+ payload = JSON.parse(raw.toString('utf8'));
157
+ }
158
+
159
+ const files = Object.keys(payload.files);
160
+ const newFiles = [];
161
+ const existingFiles = [];
162
+
163
+ for (const relPath of files) {
164
+ const nativePath = relPath.split('/').join(path.sep);
165
+ const destPath = path.join(brainDir, nativePath);
166
+ if (fs.existsSync(destPath)) {
167
+ existingFiles.push(relPath);
168
+ } else {
169
+ newFiles.push(relPath);
170
+ }
171
+ }
172
+
173
+ return {
174
+ totalFiles: files.length,
175
+ newFiles,
176
+ existingFiles,
177
+ exportedAt: payload.exportedAt,
178
+ };
179
+ }
180
+
181
+ module.exports = {
182
+ exportBrain,
183
+ importBrain,
184
+ previewImport,
185
+ };
@@ -0,0 +1,444 @@
1
+ /**
2
+ * Brain Memory — Git Sync Engine
3
+ *
4
+ * Push/pull ~/.brain/ memories via any Git remote (GitHub, GitLab, Codeberg, etc.).
5
+ * A hidden git repo lives at ~/.brain/.sync/repo/ — the project's own git history
6
+ * is never touched.
7
+ *
8
+ * Zero external dependencies — uses child_process.execFileSync to call the git binary.
9
+ */
10
+
11
+ const { execFileSync } = require('child_process');
12
+ const fs = require('fs');
13
+ const path = require('path');
14
+ const { encrypt, decrypt } = require('./crypto');
15
+
16
+ const SYNC_DIR = '.sync';
17
+ const REPO_DIR = 'repo';
18
+ const CONFIG_FILE = 'config.json';
19
+
20
+ // Files/dirs inside ~/.brain/ that should NOT be synced
21
+ const EXCLUDED = new Set(['.sync', '.DS_Store']);
22
+
23
+ /**
24
+ * Check whether `git` is available on PATH.
25
+ *
26
+ * @returns {boolean}
27
+ */
28
+ function checkGitAvailable() {
29
+ try {
30
+ execFileSync('git', ['--version'], { stdio: 'pipe' });
31
+ return true;
32
+ } catch {
33
+ return false;
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Run a git command inside the sync repo.
39
+ *
40
+ * @param {string} repoDir - Absolute path to ~/.brain/.sync/repo/
41
+ * @param {string[]} args - Git arguments
42
+ * @param {Object} [opts] - Extra execFileSync options
43
+ * @returns {string} stdout (trimmed)
44
+ */
45
+ function git(repoDir, args, opts = {}) {
46
+ // Explicitly set GIT_DIR and GIT_WORK_TREE to prevent git from walking up
47
+ // the directory tree and finding the parent project's .git directory.
48
+ // Without this, if ~/.brain/.sync/repo/.git doesn't exist yet (first push or
49
+ // failed init), git operations would silently affect the parent project repo.
50
+ const env = {
51
+ ...process.env,
52
+ GIT_DIR: path.join(repoDir, '.git'),
53
+ GIT_WORK_TREE: repoDir,
54
+ };
55
+ return execFileSync('git', args, {
56
+ cwd: repoDir,
57
+ stdio: 'pipe',
58
+ encoding: 'utf8',
59
+ env,
60
+ ...opts,
61
+ }).trim();
62
+ }
63
+
64
+ /**
65
+ * Resolve paths for sync infrastructure.
66
+ *
67
+ * @param {string} brainDir - Absolute path to ~/.brain/
68
+ * @returns {{ syncDir: string, repoDir: string, configPath: string }}
69
+ */
70
+ function resolvePaths(brainDir) {
71
+ const syncDir = path.join(brainDir, SYNC_DIR);
72
+ const repoDir = path.join(syncDir, REPO_DIR);
73
+ const configPath = path.join(syncDir, CONFIG_FILE);
74
+ return { syncDir, repoDir, configPath };
75
+ }
76
+
77
+ /**
78
+ * Initialize a git repo inside ~/.brain/.sync/repo/.
79
+ *
80
+ * @param {string} brainDir - Absolute path to ~/.brain/
81
+ * @returns {{ repoDir: string }} Created repo path
82
+ */
83
+ function initSyncRepo(brainDir) {
84
+ const { repoDir } = resolvePaths(brainDir);
85
+ fs.mkdirSync(repoDir, { recursive: true });
86
+
87
+ git(repoDir, ['init', '-b', 'main']);
88
+ git(repoDir, ['config', 'user.email', 'brain-memory@local']);
89
+ git(repoDir, ['config', 'user.name', 'Brain Memory']);
90
+
91
+ return { repoDir };
92
+ }
93
+
94
+ /**
95
+ * Configure (or update) the remote URL for the sync repo.
96
+ *
97
+ * @param {string} brainDir - Absolute path to ~/.brain/
98
+ * @param {string} remoteUrl - Git remote URL (SSH or HTTPS)
99
+ */
100
+ function configureRemote(brainDir, remoteUrl) {
101
+ const { repoDir } = resolvePaths(brainDir);
102
+
103
+ try {
104
+ git(repoDir, ['remote', 'get-url', 'origin']);
105
+ // Remote exists — update it
106
+ git(repoDir, ['remote', 'set-url', 'origin', remoteUrl]);
107
+ } catch {
108
+ // Remote doesn't exist — add it
109
+ git(repoDir, ['remote', 'add', 'origin', remoteUrl]);
110
+ }
111
+ }
112
+
113
+ /**
114
+ * Copy ~/.brain/ files into the sync repo, excluding .sync/.
115
+ * If encryption is enabled, files are encrypted before writing.
116
+ *
117
+ * @param {string} brainDir - Absolute path to ~/.brain/
118
+ * @param {string} repoDir - Absolute path to ~/.brain/.sync/repo/
119
+ * @param {string|null} passphrase - Encryption passphrase or null
120
+ */
121
+ function copyBrainToRepo(brainDir, repoDir, passphrase) {
122
+ // Clean existing tracked files in repo (except .git)
123
+ const entries = fs.readdirSync(repoDir);
124
+ for (const entry of entries) {
125
+ if (entry === '.git') continue;
126
+ fs.rmSync(path.join(repoDir, entry), { recursive: true, force: true });
127
+ }
128
+
129
+ // Recursively copy ~/.brain/ → repo/
130
+ copyDir(brainDir, repoDir, brainDir, passphrase);
131
+ }
132
+
133
+ /**
134
+ * Recursively copy a directory, excluding EXCLUDED entries.
135
+ *
136
+ * @param {string} srcDir - Source directory
137
+ * @param {string} destDir - Destination directory
138
+ * @param {string} brainDir - Root brain dir (for relative path calculation)
139
+ * @param {string|null} passphrase - Encryption passphrase or null
140
+ */
141
+ function copyDir(srcDir, destDir, brainDir, passphrase) {
142
+ const entries = fs.readdirSync(srcDir, { withFileTypes: true });
143
+ for (const entry of entries) {
144
+ const rel = path.relative(brainDir, path.join(srcDir, entry.name));
145
+ const topLevel = rel.split(path.sep)[0];
146
+ if (EXCLUDED.has(topLevel)) continue;
147
+
148
+ const srcPath = path.join(srcDir, entry.name);
149
+ const destPath = path.join(destDir, entry.name);
150
+
151
+ if (entry.isDirectory()) {
152
+ fs.mkdirSync(destPath, { recursive: true });
153
+ copyDir(srcPath, destPath, brainDir, passphrase);
154
+ } else {
155
+ const content = fs.readFileSync(srcPath);
156
+ if (passphrase) {
157
+ fs.writeFileSync(destPath, encrypt(content.toString('utf8'), passphrase));
158
+ } else {
159
+ fs.writeFileSync(destPath, content);
160
+ }
161
+ }
162
+ }
163
+ }
164
+
165
+ /**
166
+ * Copy files from the sync repo back into ~/.brain/.
167
+ * If encryption is enabled, files are decrypted after reading.
168
+ *
169
+ * @param {string} repoDir - Absolute path to ~/.brain/.sync/repo/
170
+ * @param {string} brainDir - Absolute path to ~/.brain/
171
+ * @param {string|null} passphrase - Decryption passphrase or null
172
+ */
173
+ function copyRepoToBrain(repoDir, brainDir, passphrase) {
174
+ copyRepoDir(repoDir, brainDir, repoDir, passphrase);
175
+ }
176
+
177
+ /**
178
+ * Recursively copy repo files back to brain.
179
+ */
180
+ function copyRepoDir(srcDir, destDir, repoDir, passphrase) {
181
+ const entries = fs.readdirSync(srcDir, { withFileTypes: true });
182
+ for (const entry of entries) {
183
+ if (entry.name === '.git') continue;
184
+
185
+ const srcPath = path.join(srcDir, entry.name);
186
+ const destPath = path.join(destDir, entry.name);
187
+
188
+ if (entry.isDirectory()) {
189
+ fs.mkdirSync(destPath, { recursive: true });
190
+ copyRepoDir(srcPath, destPath, repoDir, passphrase);
191
+ } else {
192
+ const content = fs.readFileSync(srcPath);
193
+ if (passphrase) {
194
+ fs.writeFileSync(destPath, decrypt(content, passphrase));
195
+ } else {
196
+ fs.writeFileSync(destPath, content);
197
+ }
198
+ }
199
+ }
200
+ }
201
+
202
+ /**
203
+ * Get a summary of local vs remote sync status.
204
+ *
205
+ * @param {string} brainDir - Absolute path to ~/.brain/
206
+ * @returns {{ configured: boolean, remote: string|null, branch: string|null, ahead: number, behind: number, lastPush: string|null }}
207
+ */
208
+ function getStatus(brainDir) {
209
+ const { repoDir, configPath } = resolvePaths(brainDir);
210
+ const config = readConfig(configPath);
211
+
212
+ if (!config) {
213
+ return { configured: false, remote: null, branch: null, ahead: 0, behind: 0, lastPush: null };
214
+ }
215
+
216
+ let ahead = 0;
217
+ let behind = 0;
218
+
219
+ if (fs.existsSync(path.join(repoDir, '.git'))) {
220
+ try {
221
+ git(repoDir, ['fetch', 'origin'], { timeout: 15000 });
222
+ } catch {
223
+ // Offline or remote not reachable — use cached state
224
+ }
225
+
226
+ try {
227
+ const counts = git(repoDir, ['rev-list', '--left-right', '--count', 'main...origin/main']);
228
+ const parts = counts.split(/\s+/);
229
+ ahead = parseInt(parts[0], 10) || 0;
230
+ behind = parseInt(parts[1], 10) || 0;
231
+ } catch {
232
+ // No remote tracking yet (first push not done)
233
+ }
234
+ }
235
+
236
+ return {
237
+ configured: true,
238
+ remote: config.remote || null,
239
+ branch: config.branch || 'main',
240
+ ahead,
241
+ behind,
242
+ lastPush: config.lastPush || null,
243
+ };
244
+ }
245
+
246
+ /**
247
+ * Push ~/.brain/ contents to the remote.
248
+ *
249
+ * @param {string} brainDir - Absolute path to ~/.brain/
250
+ * @param {string} [message] - Commit message (defaults to timestamp)
251
+ * @param {string} [passphrase] - Encryption passphrase (if configured)
252
+ * @returns {{ committed: boolean, pushed: boolean, message: string }}
253
+ */
254
+ function push(brainDir, message, passphrase) {
255
+ const { repoDir, configPath } = resolvePaths(brainDir);
256
+ const config = readConfig(configPath);
257
+ if (!config) throw new Error('Sync not configured. Run /brain:sync setup first.');
258
+
259
+ const pass = config.encrypt ? passphrase : null;
260
+ if (config.encrypt && !passphrase) {
261
+ throw new Error('Encryption is enabled but no passphrase provided.');
262
+ }
263
+
264
+ // Ensure repo exists
265
+ if (!fs.existsSync(path.join(repoDir, '.git'))) {
266
+ initSyncRepo(brainDir);
267
+ if (config.remote) configureRemote(brainDir, config.remote);
268
+ }
269
+
270
+ // Copy brain files into repo
271
+ copyBrainToRepo(brainDir, repoDir, pass);
272
+
273
+ // Stage all changes
274
+ git(repoDir, ['add', '-A']);
275
+
276
+ // Check if there's anything to commit
277
+ const status = git(repoDir, ['status', '--porcelain']);
278
+ if (!status) {
279
+ return { committed: false, pushed: false, message: 'Nothing to push — no changes.' };
280
+ }
281
+
282
+ // Commit
283
+ const commitMsg = message || `brain sync ${new Date().toISOString()}`;
284
+ git(repoDir, ['commit', '-m', commitMsg]);
285
+
286
+ // Push
287
+ let pushed = false;
288
+ if (config.remote) {
289
+ try {
290
+ git(repoDir, ['push', '-u', 'origin', 'main'], { timeout: 30000 });
291
+ pushed = true;
292
+ } catch (err) {
293
+ return { committed: true, pushed: false, message: `Committed locally but push failed: ${err.message}` };
294
+ }
295
+ }
296
+
297
+ // Update lastPush
298
+ config.lastPush = new Date().toISOString();
299
+ writeConfig(configPath, config);
300
+
301
+ return { committed: true, pushed, message: `Pushed successfully at ${config.lastPush}` };
302
+ }
303
+
304
+ /**
305
+ * Pull remote changes into ~/.brain/.
306
+ *
307
+ * @param {string} brainDir - Absolute path to ~/.brain/
308
+ * @param {string} [passphrase] - Decryption passphrase (if configured)
309
+ * @returns {{ pulled: boolean, message: string }}
310
+ */
311
+ function pull(brainDir, passphrase) {
312
+ const { repoDir, configPath } = resolvePaths(brainDir);
313
+ const config = readConfig(configPath);
314
+ if (!config) throw new Error('Sync not configured. Run /brain:sync setup first.');
315
+
316
+ const pass = config.encrypt ? passphrase : null;
317
+ if (config.encrypt && !passphrase) {
318
+ throw new Error('Encryption is enabled but no passphrase provided.');
319
+ }
320
+
321
+ if (!fs.existsSync(path.join(repoDir, '.git'))) {
322
+ initSyncRepo(brainDir);
323
+ if (config.remote) configureRemote(brainDir, config.remote);
324
+ }
325
+
326
+ // Try fast-forward pull first
327
+ let pulled = false;
328
+ let hasConflicts = false;
329
+ let conflictFiles = [];
330
+
331
+ try {
332
+ git(repoDir, ['pull', 'origin', 'main', '--ff-only'], { timeout: 30000 });
333
+ pulled = true;
334
+ } catch (err) {
335
+ // Fast-forward failed — try fetch + merge
336
+ try {
337
+ git(repoDir, ['fetch', 'origin'], { timeout: 15000 });
338
+ } catch {
339
+ return { pulled: false, hasConflicts: false, message: 'Remote is unreachable.' };
340
+ }
341
+
342
+ try {
343
+ git(repoDir, ['merge', 'origin/main']);
344
+ pulled = true;
345
+ } catch {
346
+ // Check for unmerged paths
347
+ try {
348
+ const status = git(repoDir, ['status', '--porcelain']);
349
+ conflictFiles = status
350
+ .split('\n')
351
+ .filter((line) => line.startsWith('U') || line.startsWith('AA') || line.startsWith('DD'))
352
+ .map((line) => line.slice(3));
353
+ hasConflicts = conflictFiles.length > 0;
354
+ } catch { /* ignore status errors */ }
355
+
356
+ // Abort the failed merge to leave repo clean
357
+ try {
358
+ git(repoDir, ['merge', '--abort']);
359
+ } catch { /* ignore if nothing to abort */ }
360
+
361
+ if (hasConflicts) {
362
+ return {
363
+ pulled: false,
364
+ hasConflicts: true,
365
+ conflictFiles,
366
+ message: `Merge conflict in ${conflictFiles.length} file(s). Push your local changes first or manually resolve.`,
367
+ };
368
+ }
369
+
370
+ return { pulled: false, hasConflicts: false, message: 'Remote has no commits yet or merge failed.' };
371
+ }
372
+ }
373
+
374
+ // Copy repo files back to brain
375
+ copyRepoToBrain(repoDir, brainDir, pass);
376
+
377
+ // Update config
378
+ config.lastPull = new Date().toISOString();
379
+ writeConfig(configPath, config);
380
+
381
+ return { pulled: true, hasConflicts: false, message: `Pulled successfully at ${config.lastPull}` };
382
+ }
383
+
384
+ /**
385
+ * Read sync config from ~/.brain/.sync/config.json.
386
+ *
387
+ * @param {string} configPath - Absolute path to config.json
388
+ * @returns {Object|null}
389
+ */
390
+ function readConfig(configPath) {
391
+ try {
392
+ return JSON.parse(fs.readFileSync(configPath, 'utf8'));
393
+ } catch {
394
+ return null;
395
+ }
396
+ }
397
+
398
+ /**
399
+ * Write sync config to ~/.brain/.sync/config.json.
400
+ *
401
+ * @param {string} configPath - Absolute path to config.json
402
+ * @param {Object} config
403
+ */
404
+ function writeConfig(configPath, config) {
405
+ fs.mkdirSync(path.dirname(configPath), { recursive: true });
406
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
407
+ }
408
+
409
+ /**
410
+ * Read the sync config for a brain directory.
411
+ *
412
+ * @param {string} brainDir - Absolute path to ~/.brain/
413
+ * @returns {Object|null}
414
+ */
415
+ function getSyncConfig(brainDir) {
416
+ const { configPath } = resolvePaths(brainDir);
417
+ return readConfig(configPath);
418
+ }
419
+
420
+ /**
421
+ * Write the sync config for a brain directory.
422
+ *
423
+ * @param {string} brainDir - Absolute path to ~/.brain/
424
+ * @param {Object} config
425
+ */
426
+ function writeSyncConfig(brainDir, config) {
427
+ const { configPath } = resolvePaths(brainDir);
428
+ writeConfig(configPath, config);
429
+ }
430
+
431
+ module.exports = {
432
+ checkGitAvailable,
433
+ initSyncRepo,
434
+ configureRemote,
435
+ getStatus,
436
+ push,
437
+ pull,
438
+ getSyncConfig,
439
+ writeSyncConfig,
440
+ // Internal — exported for testing
441
+ copyBrainToRepo,
442
+ copyRepoToBrain,
443
+ resolvePaths,
444
+ };