total-recall-brain 3.25.2 → 3.25.3
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
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": [
|
|
3
|
+
"CANONICAL: what belongs to ONE brain and is therefore NOT a template.",
|
|
4
|
+
"",
|
|
5
|
+
"Three releases in a row shipped or clobbered a file because this list lived",
|
|
6
|
+
"in several places at once and they drifted:",
|
|
7
|
+
" 3.25.0 skills-registry/index.yaml shipped 562 lines of /Users/<name>/...",
|
|
8
|
+
" naming 16 third-party repos inside the npm tarball",
|
|
9
|
+
" 3.25.2 research-queue.jsonl shipped the developer's queued topics, and",
|
|
10
|
+
" sync-repo would have overwritten one repo's 7 real entries",
|
|
11
|
+
"",
|
|
12
|
+
"A path listed here must never be: published in the package, written into",
|
|
13
|
+
"scaffold/, or overwritten by a template sync. If a file records what THIS",
|
|
14
|
+
"brain has done, seen, or been configured with, it belongs here.",
|
|
15
|
+
"",
|
|
16
|
+
"This is NOT the backup-exclusion list. Some of these (config/,",
|
|
17
|
+
"skills-registry/) are state worth backing up; they simply are not templates.",
|
|
18
|
+
"Backup exclusions live in ensureBrainGitignore and answer a different",
|
|
19
|
+
"question: ephemeral, oversized, or sensitive."
|
|
20
|
+
],
|
|
21
|
+
"dirs": [
|
|
22
|
+
"memory-vault",
|
|
23
|
+
"memory-derived",
|
|
24
|
+
"memory-inbox",
|
|
25
|
+
"sessions",
|
|
26
|
+
"logs",
|
|
27
|
+
"scheduler",
|
|
28
|
+
"config",
|
|
29
|
+
"backups",
|
|
30
|
+
"browser-profile",
|
|
31
|
+
"skills-registry",
|
|
32
|
+
".snapshots",
|
|
33
|
+
".git",
|
|
34
|
+
"node_modules"
|
|
35
|
+
],
|
|
36
|
+
"files": [
|
|
37
|
+
"research-queue.jsonl",
|
|
38
|
+
"daemon.pid",
|
|
39
|
+
".extension-connected",
|
|
40
|
+
"graph.canvas"
|
|
41
|
+
],
|
|
42
|
+
"extensions": [
|
|
43
|
+
".enc",
|
|
44
|
+
".backup",
|
|
45
|
+
".log"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": [
|
|
3
|
+
"CANONICAL: what belongs to ONE brain and is therefore NOT a template.",
|
|
4
|
+
"",
|
|
5
|
+
"Three releases in a row shipped or clobbered a file because this list lived",
|
|
6
|
+
"in several places at once and they drifted:",
|
|
7
|
+
" 3.25.0 skills-registry/index.yaml shipped 562 lines of /Users/<name>/...",
|
|
8
|
+
" naming 16 third-party repos inside the npm tarball",
|
|
9
|
+
" 3.25.2 research-queue.jsonl shipped the developer's queued topics, and",
|
|
10
|
+
" sync-repo would have overwritten one repo's 7 real entries",
|
|
11
|
+
"",
|
|
12
|
+
"A path listed here must never be: published in the package, written into",
|
|
13
|
+
"scaffold/, or overwritten by a template sync. If a file records what THIS",
|
|
14
|
+
"brain has done, seen, or been configured with, it belongs here.",
|
|
15
|
+
"",
|
|
16
|
+
"This is NOT the backup-exclusion list. Some of these (config/,",
|
|
17
|
+
"skills-registry/) are state worth backing up; they simply are not templates.",
|
|
18
|
+
"Backup exclusions live in ensureBrainGitignore and answer a different",
|
|
19
|
+
"question: ephemeral, oversized, or sensitive."
|
|
20
|
+
],
|
|
21
|
+
"dirs": [
|
|
22
|
+
"memory-vault",
|
|
23
|
+
"memory-derived",
|
|
24
|
+
"memory-inbox",
|
|
25
|
+
"sessions",
|
|
26
|
+
"logs",
|
|
27
|
+
"scheduler",
|
|
28
|
+
"config",
|
|
29
|
+
"backups",
|
|
30
|
+
"browser-profile",
|
|
31
|
+
"skills-registry",
|
|
32
|
+
".snapshots",
|
|
33
|
+
".git",
|
|
34
|
+
"node_modules"
|
|
35
|
+
],
|
|
36
|
+
"files": [
|
|
37
|
+
"research-queue.jsonl",
|
|
38
|
+
"daemon.pid",
|
|
39
|
+
".extension-connected",
|
|
40
|
+
"graph.canvas"
|
|
41
|
+
],
|
|
42
|
+
"extensions": [
|
|
43
|
+
".enc",
|
|
44
|
+
".backup",
|
|
45
|
+
".log"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* brain-state — the one answer to "is this file a template, or does it belong
|
|
3
|
+
* to a single brain?"
|
|
4
|
+
*
|
|
5
|
+
* Every consumer of this question used to keep its own list: sync-scaffold had
|
|
6
|
+
* an EXCLUDES array, sync-repo had STATE_DIRS/STATE_FILES, and the scaffold
|
|
7
|
+
* itself had whatever had been copied into it. They drifted, and each drift
|
|
8
|
+
* shipped or destroyed a file:
|
|
9
|
+
*
|
|
10
|
+
* 3.25.0 skills-registry/index.yaml went out in the tarball carrying 562
|
|
11
|
+
* lines of /Users/<name>/... and the names of 16 unrelated repos
|
|
12
|
+
* 3.25.2 research-queue.jsonl went out carrying the developer's queued
|
|
13
|
+
* topics, and a template sync would have replaced one repo's 7 real
|
|
14
|
+
* entries and its 2,462-line skills catalog
|
|
15
|
+
*
|
|
16
|
+
* Adding a path here fixes it everywhere at once, which is the entire point.
|
|
17
|
+
*/
|
|
18
|
+
import fs from 'node:fs';
|
|
19
|
+
import path from 'node:path';
|
|
20
|
+
import { fileURLToPath } from 'node:url';
|
|
21
|
+
|
|
22
|
+
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
export const BRAIN_STATE_MANIFEST = path.join(HERE, 'brain-state.json');
|
|
24
|
+
|
|
25
|
+
function load() {
|
|
26
|
+
const raw = JSON.parse(fs.readFileSync(BRAIN_STATE_MANIFEST, 'utf8'));
|
|
27
|
+
return {
|
|
28
|
+
dirs: new Set(raw.dirs || []),
|
|
29
|
+
files: new Set(raw.files || []),
|
|
30
|
+
extensions: new Set(raw.extensions || []),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const BRAIN_STATE = load();
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Is this path (relative to a brain root) state rather than a template?
|
|
38
|
+
*
|
|
39
|
+
* Matches a state directory at ANY depth — `skills-registry/index.yaml` and
|
|
40
|
+
* `a/b/skills-registry/c.yaml` are both state. Checking only the first segment
|
|
41
|
+
* is how nested state slipped through before.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} relPath e.g. "references/api-reference.md"
|
|
44
|
+
* @returns {boolean}
|
|
45
|
+
*/
|
|
46
|
+
export function isBrainState(relPath) {
|
|
47
|
+
if (!relPath) return false;
|
|
48
|
+
const parts = String(relPath).split(/[\\/]+/).filter(Boolean);
|
|
49
|
+
if (parts.some((seg) => BRAIN_STATE.dirs.has(seg))) return true;
|
|
50
|
+
const base = parts[parts.length - 1];
|
|
51
|
+
if (!base) return false;
|
|
52
|
+
if (BRAIN_STATE.files.has(base)) return true;
|
|
53
|
+
return BRAIN_STATE.extensions.has(path.extname(base));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** rsync-style patterns, for callers that shell out instead of walking. */
|
|
57
|
+
export function rsyncExcludes() {
|
|
58
|
+
return [
|
|
59
|
+
...[...BRAIN_STATE.dirs].map((d) => `${d}/`),
|
|
60
|
+
...BRAIN_STATE.files,
|
|
61
|
+
...[...BRAIN_STATE.extensions].map((e) => `*${e}`),
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Every state path found under a brain/scaffold root. Used by the gate that
|
|
67
|
+
* fails a release when the shipped scaffold carries one.
|
|
68
|
+
*
|
|
69
|
+
* @param {string} root
|
|
70
|
+
* @returns {string[]} paths relative to root
|
|
71
|
+
*/
|
|
72
|
+
export function findBrainState(root) {
|
|
73
|
+
const hits = [];
|
|
74
|
+
if (!fs.existsSync(root)) return hits;
|
|
75
|
+
const walk = (dir) => {
|
|
76
|
+
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
77
|
+
const abs = path.join(dir, e.name);
|
|
78
|
+
const rel = path.relative(root, abs);
|
|
79
|
+
if (isBrainState(rel)) { hits.push(rel); continue; }
|
|
80
|
+
if (e.isDirectory()) walk(abs);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
walk(root);
|
|
84
|
+
return hits.sort();
|
|
85
|
+
}
|