total-recall-brain 3.40.6 → 3.40.7
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/package.json +1 -1
- package/src/cli/init.mjs +45 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "total-recall-brain",
|
|
3
|
-
"version": "3.40.
|
|
3
|
+
"version": "3.40.7",
|
|
4
4
|
"description": "The Vibe Coding Brain & Autonomous Software Factory: memory, rules, secrets, and 33 visual plugins automatically managed across all your devices.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/cli/init.mjs
CHANGED
|
@@ -198,6 +198,42 @@ function printHelp() {
|
|
|
198
198
|
`);
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
// ─── Per-brain state exclusions ─────────────────────────────────────────────
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Brain-local runtime state that must never be committed.
|
|
205
|
+
*
|
|
206
|
+
* `config/brain.json` holds a live plaintext PAT, so a repository that tracks
|
|
207
|
+
* it publishes a working credential on every commit. `secrets.enc` is the
|
|
208
|
+
* encrypted store, the `*.pid`/`leader.json` files name local processes, and
|
|
209
|
+
* `keys.jsonl` is the auth ledger. None of it is source: `init` and `brain
|
|
210
|
+
* ensure` rebuild it, and a teammate or CI clone has no business receiving it.
|
|
211
|
+
*
|
|
212
|
+
* Only the PROJECT layer needs this. The global brain lives in `~/.agent`,
|
|
213
|
+
* which is not a repository. Returns the exclusions it added.
|
|
214
|
+
*/
|
|
215
|
+
export function ensureProjectGitignore(projectRoot, { dryRun = false } = {}) {
|
|
216
|
+
const header = '# Total Recall brain state (machine-local: holds a live PAT)';
|
|
217
|
+
const entries = [
|
|
218
|
+
'.agent/skills/total-recall/config/brain.json',
|
|
219
|
+
'.agent/skills/total-recall/config/brain.json.bak-*',
|
|
220
|
+
'.agent/skills/total-recall/config/keys.jsonl',
|
|
221
|
+
'.agent/skills/total-recall/config/secrets.enc',
|
|
222
|
+
'.agent/skills/total-recall/config/secrets.enc.bak-*',
|
|
223
|
+
'.agent/skills/total-recall/config/leader.json',
|
|
224
|
+
'.agent/skills/total-recall/*.pid',
|
|
225
|
+
];
|
|
226
|
+
const file = path.join(projectRoot, '.gitignore');
|
|
227
|
+
let current = '';
|
|
228
|
+
try { current = fs.readFileSync(file, 'utf8'); } catch { /* absent: create it */ }
|
|
229
|
+
const missing = entries.filter(entry => !current.split(/\r?\n/).includes(entry));
|
|
230
|
+
if (!missing.length) return [];
|
|
231
|
+
if (dryRun) return missing;
|
|
232
|
+
const block = `${current && !current.endsWith('\n') ? '\n' : ''}${current ? '\n' : ''}${header}\n${missing.join('\n')}\n`;
|
|
233
|
+
fs.writeFileSync(file, current + block, 'utf8');
|
|
234
|
+
return missing;
|
|
235
|
+
}
|
|
236
|
+
|
|
201
237
|
// ─── Bootstrap token store resolution ───────────────────────────────────────
|
|
202
238
|
|
|
203
239
|
/**
|
|
@@ -967,6 +1003,15 @@ export default async function init(args) {
|
|
|
967
1003
|
fs.writeFileSync(registryPath, JSON.stringify(registry, null, 2));
|
|
968
1004
|
logOk(`Registered project "${projectName}" in global brain registry`);
|
|
969
1005
|
|
|
1006
|
+
// Keep brain state out of git. `brain.json` carries a live PAT, so a
|
|
1007
|
+
// repo that tracks it publishes a working credential on every commit.
|
|
1008
|
+
try {
|
|
1009
|
+
const added = ensureProjectGitignore(cwd, { dryRun: opts.dryRun });
|
|
1010
|
+
if (added.length) logOk(`Excluded ${added.length} brain-state path(s) in .gitignore`);
|
|
1011
|
+
} catch (ignoreErr) {
|
|
1012
|
+
logWarn(`Could not update .gitignore: ${ignoreErr.message}`);
|
|
1013
|
+
}
|
|
1014
|
+
|
|
970
1015
|
// Auto-sync all .md files from the repo into the vault
|
|
971
1016
|
try {
|
|
972
1017
|
const { syncSingleRepo } = await import('../core/repo-sync.mjs');
|