total-recall-brain 3.40.0 → 3.40.2

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.
Files changed (187) hide show
  1. package/README.md +152 -41
  2. package/bin/total-recall.mjs +16 -76
  3. package/docs/reference/cli-reference.md +10 -10
  4. package/extension/background.js +6 -2
  5. package/extension/config.js +8 -0
  6. package/extension/lib/brain-client.js +29 -4
  7. package/extension/options/options.html +1 -0
  8. package/extension/sidepanel/sidepanel.html +1 -0
  9. package/frontend/dist/assets/{index-CvQRdT2j.css → index-AGUes-VG.css} +1 -1
  10. package/frontend/dist/assets/index-Bt5iVPZj.js +5618 -0
  11. package/frontend/dist/index.html +2 -2
  12. package/frontend/src/api/keys.ts +9 -2
  13. package/frontend/src/api/plugins.ts +4 -0
  14. package/frontend/src/components/plugins/card/CardEngine.tsx +2 -1
  15. package/frontend/src/components/plugins/card/card.css +1 -1
  16. package/frontend/src/pages/IntegrationsPage.tsx +315 -8
  17. package/frontend/src/pages/PluginsPage.tsx +532 -87
  18. package/package.json +6 -5
  19. package/scaffold/.agent/skills/meta-harness/references/optimized/original.md +1 -1
  20. package/scaffold/.agent/skills/meta-harness/references/optimized/section-09.md +1 -1
  21. package/scaffold/.agent/skills/total-recall/plugins/auth/package-lock.json +10 -10
  22. package/scaffold/.agent/skills/total-recall/plugins/auth/package.json +1 -6
  23. package/scaffold/.agent/skills/total-recall/plugins/auth/plugin.json +0 -1
  24. package/scaffold/.agent/skills/total-recall/plugins/auth/src/browser-session.mjs +309 -4
  25. package/scaffold/.agent/skills/total-recall/plugins/auth/src/cli-secret.mjs +44 -34
  26. package/scaffold/.agent/skills/total-recall/plugins/auth/src/google-oauth.mjs +6 -4
  27. package/scaffold/.agent/skills/total-recall/plugins/auth/src/provider-catalog.mjs +1 -1
  28. package/scaffold/.agent/skills/total-recall/plugins/auth/src/provider-rotation-recipes.mjs +118 -4
  29. package/scaffold/.agent/skills/total-recall/plugins/auth/src/routes/auth.mjs +2 -2
  30. package/scaffold/.agent/skills/total-recall/plugins/auth/src/secrets-env-export.mjs +3 -3
  31. package/scaffold/.agent/skills/total-recall/plugins/auth/src/secrets-remote-deploy.mjs +1 -1
  32. package/scaffold/.agent/skills/total-recall/plugins/auth/src/secrets-rotate.mjs +24 -6
  33. package/scaffold/.agent/skills/total-recall/plugins/auth/ui/card.js +164 -123
  34. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/README.md +65 -0
  35. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/cli.mjs +76 -0
  36. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/package.json +19 -0
  37. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/plugin.json +290 -0
  38. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/adapters/dsh.mjs +446 -0
  39. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/documentation.mjs +152 -0
  40. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/executor.mjs +71 -0
  41. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/runtime.mjs +36 -0
  42. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/setup.mjs +35 -0
  43. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/src/worker.mjs +175 -0
  44. package/scaffold/.agent/skills/total-recall/plugins/cli-agents/ui/card.js +18 -0
  45. package/scaffold/.agent/skills/total-recall/plugins/code-quality/LICENSE +21 -0
  46. package/scaffold/.agent/skills/total-recall/plugins/code-quality/README.md +84 -0
  47. package/scaffold/.agent/skills/total-recall/plugins/code-quality/cli.mjs +79 -0
  48. package/scaffold/.agent/skills/total-recall/plugins/code-quality/commands/check.mjs +6 -0
  49. package/scaffold/.agent/skills/total-recall/plugins/code-quality/commands/report.mjs +6 -0
  50. package/scaffold/.agent/skills/total-recall/plugins/code-quality/commands/run-core.mjs +27 -0
  51. package/scaffold/.agent/skills/total-recall/plugins/code-quality/commands/snapshot.mjs +163 -0
  52. package/scaffold/.agent/skills/total-recall/plugins/code-quality/core/check.mjs +757 -0
  53. package/scaffold/.agent/skills/total-recall/plugins/code-quality/core/config.schema.json +86 -0
  54. package/scaffold/.agent/skills/total-recall/plugins/code-quality/core/detect.mjs +89 -0
  55. package/scaffold/.agent/skills/total-recall/plugins/code-quality/core/report-data.mjs +145 -0
  56. package/scaffold/.agent/skills/total-recall/plugins/code-quality/core/report.mjs +210 -0
  57. package/scaffold/.agent/skills/total-recall/plugins/code-quality/core/state.mjs +20 -0
  58. package/scaffold/.agent/skills/total-recall/plugins/code-quality/package-lock.json +2869 -0
  59. package/scaffold/.agent/skills/total-recall/plugins/code-quality/package.json +28 -0
  60. package/scaffold/.agent/skills/total-recall/plugins/code-quality/plugin.json +186 -0
  61. package/scaffold/.agent/skills/total-recall/plugins/code-quality/ui/DESIGN.md +18 -0
  62. package/scaffold/.agent/skills/total-recall/plugins/code-quality/ui/card.js +272 -0
  63. package/scaffold/.agent/skills/total-recall/plugins/code-quality/ui/code-quality-report.mjs +129 -0
  64. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/LICENSE +21 -0
  65. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/README.md +73 -0
  66. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/cli.mjs +375 -0
  67. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/examples/commands/echo-tool.mjs +23 -0
  68. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/examples/commands/group.mjs +262 -0
  69. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/examples/commands/project-id.mjs +74 -0
  70. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/package-lock.json +2869 -0
  71. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/package.json +31 -0
  72. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/plugin.json +221 -0
  73. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/schemas/cli_command.schema.json +107 -0
  74. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/skills/composable-cli/SKILL.md +63 -0
  75. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/command.mjs +313 -0
  76. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/compile.mjs +19 -0
  77. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/compose.mjs +144 -0
  78. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/contract.mjs +110 -0
  79. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/library.mjs +23 -0
  80. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/registry.mjs +192 -0
  81. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/resolve.mjs +221 -0
  82. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/risk.mjs +126 -0
  83. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/src/ssss-documents.mjs +29 -0
  84. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/ui/DESIGN.md +18 -0
  85. package/scaffold/.agent/skills/total-recall/plugins/composable-cli/ui/card.js +273 -0
  86. package/scaffold/.agent/skills/total-recall/plugins/embeddings/LICENSE +21 -0
  87. package/scaffold/.agent/skills/total-recall/plugins/embeddings/README.md +20 -0
  88. package/scaffold/.agent/skills/total-recall/plugins/embeddings/cli.mjs +310 -0
  89. package/scaffold/.agent/skills/total-recall/plugins/embeddings/package-lock.json +2826 -0
  90. package/scaffold/.agent/skills/total-recall/plugins/embeddings/package.json +11 -0
  91. package/scaffold/.agent/skills/total-recall/plugins/embeddings/plugin.json +62 -0
  92. package/scaffold/.agent/skills/total-recall/plugins/embeddings/ui/card.js +297 -0
  93. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/LICENSE +21 -0
  94. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/README.md +43 -0
  95. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/cli.mjs +258 -0
  96. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/package-lock.json +4005 -0
  97. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/package.json +20 -0
  98. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/plugin.json +125 -0
  99. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/ui/DESIGN.md +18 -0
  100. package/scaffold/.agent/skills/total-recall/plugins/git-sentinel/ui/card.js +278 -0
  101. package/scaffold/.agent/skills/total-recall/plugins/mesh/README.md +9 -0
  102. package/scaffold/.agent/skills/total-recall/plugins/mesh/cli.mjs +6 -0
  103. package/scaffold/.agent/skills/total-recall/plugins/mesh/package-lock.json +4721 -0
  104. package/scaffold/.agent/skills/total-recall/plugins/mesh/package.json +3 -21
  105. package/scaffold/.agent/skills/total-recall/plugins/mesh/plugin.json +14 -1
  106. package/scaffold/.agent/skills/total-recall/plugins/mesh/src/cli/mesh.mjs +10 -0
  107. package/scaffold/.agent/skills/total-recall/plugins/mesh/src/core/headscale-client.mjs +5 -1
  108. package/scaffold/.agent/skills/total-recall/plugins/mesh/src/core/leader-election.mjs +4 -13
  109. package/scaffold/.agent/skills/total-recall/plugins/mesh/src/core/mesh-access-verify.mjs +22 -0
  110. package/scaffold/.agent/skills/total-recall/plugins/mesh/src/core/mesh-files.mjs +18 -0
  111. package/scaffold/.agent/skills/total-recall/plugins/mesh/src/core/mesh.mjs +2 -0
  112. package/scaffold/.agent/skills/total-recall/plugins/mesh/test-support/memory-root.mjs +14 -0
  113. package/scaffold/.agent/skills/total-recall/plugins/openwiki/LICENSE +21 -0
  114. package/scaffold/.agent/skills/total-recall/plugins/openwiki/README.md +35 -0
  115. package/scaffold/.agent/skills/total-recall/plugins/openwiki/cli.mjs +124 -0
  116. package/scaffold/.agent/skills/total-recall/plugins/openwiki/package-lock.json +4097 -0
  117. package/scaffold/.agent/skills/total-recall/plugins/openwiki/package.json +12 -0
  118. package/scaffold/.agent/skills/total-recall/plugins/openwiki/plugin.json +165 -0
  119. package/scaffold/.agent/skills/total-recall/plugins/openwiki/src/ingest.mjs +127 -0
  120. package/scaffold/.agent/skills/total-recall/plugins/openwiki/ui/DESIGN.md +18 -0
  121. package/scaffold/.agent/skills/total-recall/plugins/openwiki/ui/card.js +279 -0
  122. package/scaffold/.agent/skills/total-recall/plugins/openwiki/ui/panel.js +539 -0
  123. package/scaffold/.agent/skills/total-recall/plugins/security/LICENSE +21 -0
  124. package/scaffold/.agent/skills/total-recall/plugins/security/README.md +67 -0
  125. package/scaffold/.agent/skills/total-recall/plugins/security/cli.mjs +932 -0
  126. package/scaffold/.agent/skills/total-recall/plugins/security/package-lock.json +3256 -0
  127. package/scaffold/.agent/skills/total-recall/plugins/security/package.json +25 -0
  128. package/scaffold/.agent/skills/total-recall/plugins/security/plugin.json +297 -0
  129. package/scaffold/.agent/skills/total-recall/plugins/security/scripts/build-ui.mjs +4 -0
  130. package/scaffold/.agent/skills/total-recall/plugins/security/skills/security/SKILL.md +37 -0
  131. package/scaffold/.agent/skills/total-recall/plugins/security/src/android.mjs +21 -0
  132. package/scaffold/.agent/skills/total-recall/plugins/security/src/devices.mjs +94 -0
  133. package/scaffold/.agent/skills/total-recall/plugins/security/src/machines.mjs +164 -0
  134. package/scaffold/.agent/skills/total-recall/plugins/security/src/scanner.mjs +41 -0
  135. package/scaffold/.agent/skills/total-recall/plugins/security/src/windows.mjs +42 -0
  136. package/scaffold/.agent/skills/total-recall/plugins/security/ui/DESIGN.md +18 -0
  137. package/scaffold/.agent/skills/total-recall/plugins/security/ui/card.js +95 -0
  138. package/scaffold/.agent/skills/total-recall/plugins/security/ui/panel.js +98 -0
  139. package/scaffold/.agent/skills/total-recall/references/auth.md +1 -1
  140. package/src/cli/backup.mjs +71 -3
  141. package/src/cli/brief.mjs +33 -9
  142. package/src/cli/command.mjs +2 -7
  143. package/src/cli/config.mjs +1 -0
  144. package/src/cli/connect.mjs +5 -0
  145. package/src/cli/context.mjs +2 -1
  146. package/src/cli/daemon.mjs +36 -1
  147. package/src/cli/doctor.mjs +6 -0
  148. package/src/cli/harness.mjs +3 -0
  149. package/src/cli/help.mjs +26 -0
  150. package/src/cli/init.mjs +4 -4
  151. package/src/cli/memory-entry.mjs +1 -0
  152. package/src/cli/memory-init.mjs +2 -0
  153. package/src/cli/plugin/index.mjs +11 -0
  154. package/src/cli/plugin/install.mjs +2 -1
  155. package/src/cli/rebuild.mjs +3 -1
  156. package/src/cli/startup.mjs +2 -1
  157. package/src/cli/update.mjs +19 -0
  158. package/src/core/automatic-brain-updates.mjs +67 -0
  159. package/src/core/brain-updates.mjs +21 -2
  160. package/src/core/cli-commands.mjs +71 -0
  161. package/src/core/cli-maintenance.mjs +45 -0
  162. package/src/core/cli-quick-reference.mjs +20 -0
  163. package/src/core/cli-semantic-index.mjs +722 -0
  164. package/src/core/context-compiler.mjs +27 -1
  165. package/src/core/crons.mjs +2 -13
  166. package/src/core/daemon-control.mjs +6 -4
  167. package/src/core/daemon-loop.mjs +12 -8
  168. package/src/core/default-plugins.mjs +5 -0
  169. package/src/core/global-brain-updates.mjs +39 -0
  170. package/src/core/mesh-brain-updates.mjs +30 -0
  171. package/src/core/meta-harness.mjs +108 -0
  172. package/src/core/plugin-dependencies.mjs +2 -1
  173. package/src/core/plugin-loader.mjs +2 -1
  174. package/src/core/plugin-runner.mjs +12 -4
  175. package/src/core/plugin-setup.mjs +20 -0
  176. package/src/core/plugin-store.mjs +22 -4
  177. package/src/core/plugin-tasks.mjs +1 -1
  178. package/src/core/project-brain.mjs +2 -0
  179. package/src/core/project-status.mjs +64 -0
  180. package/src/core/required-plugins.mjs +46 -0
  181. package/src/core/scaffold-plugins.mjs +17 -3
  182. package/src/core/source-brain-updates.mjs +47 -0
  183. package/src/core/startup-health.mjs +5 -3
  184. package/src/core/surface.mjs +44 -10
  185. package/src/server/routes/extension.mjs +53 -8
  186. package/templates/onboarding-interview.md +1 -1
  187. package/frontend/dist/assets/index-SOVUlZqm.js +0 -5596
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "tr-plugin-openwiki",
3
+ "version": "0.1.1",
4
+ "private": true,
5
+ "type": "module",
6
+ "description": "Multi-repo knowledge graph and documentation wiki engine for Total Recall",
7
+ "scripts": {
8
+ "test": "node --test test/*.test.mjs"
9
+ },
10
+ "dependencies": {},
11
+ "license": "MIT"
12
+ }
@@ -0,0 +1,165 @@
1
+ {
2
+ "$schema": "https://github.com/gregiteen/total-recall/blob/main/metadata.plugin.schema.json",
3
+ "id": "openwiki",
4
+ "name": "OpenWiki",
5
+ "version": "0.1.1",
6
+ "description": "Multi-repo knowledge graph and documentation wiki engine for Total Recall.",
7
+ "license": "MIT",
8
+ "branding": {
9
+ "name": "OpenWiki",
10
+ "color": "#b45309",
11
+ "badge": "Knowledge Graph",
12
+ "font": "newsreader"
13
+ },
14
+ "card_face": {
15
+ "skin": "winamp-classic",
16
+ "theme": "vibrant",
17
+ "headline": "OpenWiki Control Deck",
18
+ "quick_actions": [
19
+ {
20
+ "subcommand": "status",
21
+ "label": "STATUS"
22
+ },
23
+ {
24
+ "subcommand": "hubs",
25
+ "label": "HUBS"
26
+ },
27
+ {
28
+ "subcommand": "ingest",
29
+ "label": "INGEST"
30
+ },
31
+ {
32
+ "subcommand": "probe",
33
+ "label": "200 PROBE"
34
+ }
35
+ ],
36
+ "touch_layout": "comfortable",
37
+ "interactive": true
38
+ },
39
+ "ssss_schemas": {
40
+ "categories": [
41
+ {
42
+ "name": "openwiki-hubs",
43
+ "description": "Multi-repo openwiki documentation and knowledge graph hubs",
44
+ "node_type": "memory"
45
+ },
46
+ {
47
+ "name": "openwiki-articles",
48
+ "description": "Ingested openwiki documentation pages and architecture summaries",
49
+ "node_type": "memory"
50
+ }
51
+ ]
52
+ },
53
+ "deploy": {
54
+ "targets": [
55
+ "ssss-app",
56
+ "nextjs",
57
+ "react",
58
+ "flask"
59
+ ],
60
+ "required_ssss_version": ">=0.9.3",
61
+ "access_grants": [
62
+ "auth:session:verify",
63
+ "ssss:vault:read",
64
+ "ssss:vault:write",
65
+ "ssss:events:append"
66
+ ]
67
+ },
68
+ "cli": {
69
+ "command": "openwiki",
70
+ "handler": "./cli.mjs",
71
+ "subcommands": [
72
+ {
73
+ "name": "status",
74
+ "description": "Show which OpenWiki subcommands are implemented",
75
+ "effect": "read"
76
+ },
77
+ {
78
+ "name": "hubs",
79
+ "description": "List indexed OpenWiki hubs and page counts",
80
+ "effect": "read"
81
+ },
82
+ {
83
+ "name": "ingest",
84
+ "description": "Ingest markdown documentation into the semantic knowledge graph",
85
+ "timeout_ms": 600000,
86
+ "effect": "write"
87
+ },
88
+ {
89
+ "name": "probe",
90
+ "description": "Run HTTP 200 health verification probe",
91
+ "effect": "read"
92
+ }
93
+ ]
94
+ },
95
+ "ui": {
96
+ "design_tokens": "ui/DESIGN.md",
97
+ "elements": [
98
+ {
99
+ "id": "panel",
100
+ "kind": "panel",
101
+ "tag": "openwiki-panel",
102
+ "module": "ui/panel.js",
103
+ "description": "OpenWiki panel",
104
+ "events": [
105
+ "save-token"
106
+ ],
107
+ "tokens": [
108
+ "color-text",
109
+ "color-surface",
110
+ "color-border",
111
+ "spacing-md",
112
+ "radius-md"
113
+ ],
114
+ "optional_tokens": []
115
+ },
116
+ {
117
+ "id": "card",
118
+ "kind": "card",
119
+ "tag": "tr-openwiki-card",
120
+ "module": "ui/card.js",
121
+ "description": "Knowledge Graph Card Face"
122
+ }
123
+ ]
124
+ },
125
+ "auth": {
126
+ "plugin": "auth",
127
+ "methods": [
128
+ "passkey",
129
+ "google-oauth2"
130
+ ],
131
+ "session_verification": true
132
+ },
133
+ "status": {
134
+ "command": "status",
135
+ "refresh_seconds": 300
136
+ },
137
+ "card_layout": {
138
+ "template": "dashboard",
139
+ "regions": [
140
+ {
141
+ "widget": "status",
142
+ "title": "Status"
143
+ },
144
+ {
145
+ "widget": "live",
146
+ "title": "Live view"
147
+ },
148
+ {
149
+ "widget": "list",
150
+ "title": "Details",
151
+ "source": {
152
+ "command": "hubs"
153
+ }
154
+ },
155
+ {
156
+ "widget": "actions",
157
+ "title": "Commands"
158
+ },
159
+ {
160
+ "widget": "activity",
161
+ "title": "Recent activity"
162
+ }
163
+ ]
164
+ }
165
+ }
@@ -0,0 +1,127 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { spawnSync } from 'node:child_process';
4
+
5
+ const TR_BIN = process.env.TOTAL_RECALL_BIN || 'total-recall';
6
+
7
+ function printHelp() {
8
+ console.log(`
9
+ Usage:
10
+ total-recall openwiki ingest <openwiki-path> [options]
11
+
12
+ Options:
13
+ --dry-run Preview import without writing
14
+ --global Target the global brain
15
+ --project Target the project brain (default)
16
+ --help, -h Show this help
17
+ `);
18
+ }
19
+
20
+ export async function runOpenWikiIngest(args = []) {
21
+ let openwikiPath = null;
22
+ let dryRun = false;
23
+ let layerFlag = '--project';
24
+ let help = false;
25
+
26
+ for (let i = 0; i < args.length; i++) {
27
+ const arg = args[i];
28
+ switch (arg) {
29
+ case '--dry-run': dryRun = true; break;
30
+ case '--global': layerFlag = '--global'; break;
31
+ case '--project': layerFlag = '--project'; break;
32
+ case '--help': case '-h': help = true; break;
33
+ default:
34
+ if (!arg.startsWith('-') && !openwikiPath) {
35
+ openwikiPath = arg;
36
+ }
37
+ }
38
+ }
39
+
40
+ if (help || !openwikiPath) {
41
+ printHelp();
42
+ return { ok: true, imported: 0, errors: 0 };
43
+ }
44
+
45
+ if (openwikiPath && !fs.existsSync(openwikiPath)) {
46
+ console.error(`Error: OpenWiki directory not found at ${openwikiPath}`);
47
+ process.exitCode = 1;
48
+ return { ok: false, error: `Directory not found: ${openwikiPath}` };
49
+ }
50
+
51
+ console.log(`\n Importing OpenWiki from: ${openwikiPath}`);
52
+ console.log(` Target Brain: ${layerFlag.replace('--', '')}`);
53
+ if (dryRun) console.log(' DRY RUN: No actual writes will be committed.\n');
54
+
55
+ const mdFiles = [];
56
+ function scanDir(dir) {
57
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
58
+ for (const entry of entries) {
59
+ if (entry.name === 'node_modules' || entry.name === '.git' || entry.name === '.agent') continue;
60
+ const fullPath = path.join(dir, entry.name);
61
+ if (entry.isDirectory()) {
62
+ scanDir(fullPath);
63
+ } else if (entry.isFile() && entry.name.endsWith('.md')) {
64
+ mdFiles.push(fullPath);
65
+ }
66
+ }
67
+ }
68
+
69
+ scanDir(openwikiPath);
70
+
71
+ let imported = 0;
72
+ let errors = 0;
73
+
74
+ for (const file of mdFiles) {
75
+ try {
76
+ const content = fs.readFileSync(file, 'utf8');
77
+ let title = path.basename(file, '.md').replace(/[-_]/g, ' ');
78
+ const titleMatch = content.match(/^#\s+(.+)$/m);
79
+ if (titleMatch) {
80
+ title = titleMatch[1].trim();
81
+ }
82
+
83
+ const relPath = path.relative(openwikiPath, file);
84
+ const slugBase = relPath.replace(/\.md$/, '').replace(/[^a-zA-Z0-9]+/g, '-').replace(/(^-|-$)/g, '');
85
+ const slug = 'openwiki-' + slugBase.toLowerCase();
86
+
87
+ if (dryRun) {
88
+ console.log(` [DRY RUN] Would import: ${slug} ("${title}")`);
89
+ imported++;
90
+ continue;
91
+ }
92
+
93
+ const cliArgs = [
94
+ 'remember', 'fact',
95
+ content,
96
+ '--title', title,
97
+ '--slug', slug,
98
+ '--tags', 'openwiki,architecture,documentation',
99
+ layerFlag
100
+ ];
101
+
102
+ const result = spawnSync(TR_BIN, cliArgs, { encoding: 'utf8' });
103
+ if (result.status === 0) {
104
+ console.log(` Imported: ${slug}`);
105
+ imported++;
106
+ } else {
107
+ console.error(` Error importing ${slug}: ${result.stderr}`);
108
+ errors++;
109
+ }
110
+ } catch (err) {
111
+ console.error(` Exception on ${file}: ${err.message}`);
112
+ errors++;
113
+ }
114
+ }
115
+
116
+ console.log(`\n Import Summary:`);
117
+ console.log(` Imported: ${imported} files`);
118
+ console.log(` Errors: ${errors} files`);
119
+
120
+ if (!dryRun && imported > 0) {
121
+ console.log(`\n OpenWiki knowledge graph successfully indexed into Total Recall.`);
122
+ }
123
+
124
+ return { ok: errors === 0, imported, errors };
125
+ }
126
+
127
+ export default runOpenWikiIngest;
@@ -0,0 +1,18 @@
1
+ # DESIGN.md — Brain Dump
2
+
3
+ ```yaml
4
+ tokens:
5
+ brand-name: "Brain Dump"
6
+ wordmark: "[BRAIN//DUMP]"
7
+ color-primary: "#3b82f6"
8
+ color-background: "#0f172a"
9
+ color-accent: "#facc15"
10
+ badge: "Knowledge Graph"
11
+ font-mono: "'JetBrains Mono', 'Fira Code', monospace"
12
+ border-radius: "8px"
13
+ ```
14
+
15
+ ## Brand & Typographic Wordmark
16
+ - **Name**: Brain Dump
17
+ - **Wordmark Logo**: `[BRAIN//DUMP]` (custom typographic badge, no generic icons)
18
+ - **Palette**: Primary `#3b82f6`, Surface `#0f172a`, Accent `#facc15`.
@@ -0,0 +1,279 @@
1
+ /**
2
+ * OpenWiki — Multi-Repo Knowledge Graph & Documentation Wiki
3
+ * Bespoke Animated Web Component Card Face with Live Knowledge Graph Constellation.
4
+ *
5
+ * Zero emojis, authentic commercial brand identity, touch-first ergonomics (>=44px).
6
+ */
7
+
8
+ export class OpenWikiCard extends HTMLElement {
9
+ constructor() {
10
+ super();
11
+ this.status = 'Ready';
12
+ this.executing = false;
13
+ }
14
+
15
+ connectedCallback() {
16
+ this.attachShadow({ mode: 'open' });
17
+ this.render();
18
+ this.initConstellationAnimation();
19
+ }
20
+
21
+ async execute(action, args = []) {
22
+ const out = this.shadowRoot.querySelector('#card-out');
23
+ const badge = this.shadowRoot.querySelector('#status-badge');
24
+ if (out) out.textContent = `[OPENWIKI] Querying ${action.toUpperCase()}...`;
25
+ if (badge) badge.textContent = 'INDEXING';
26
+ this.executing = true;
27
+
28
+ try {
29
+ const res = await this.host?.run(action, args);
30
+ let text = '';
31
+ if (typeof res === 'object') {
32
+ text = res.output || JSON.stringify(res, null, 2);
33
+ } else {
34
+ text = String(res || 'Execution completed without output.');
35
+ }
36
+ if (out) out.textContent = text.trim();
37
+ if (badge) badge.textContent = 'SYNCHRONIZED';
38
+ } catch (err) {
39
+ if (out) out.textContent = `[WIKI ERROR] ${err.message}`;
40
+ if (badge) badge.textContent = 'ERROR';
41
+ } finally {
42
+ this.executing = false;
43
+ }
44
+ }
45
+
46
+ initConstellationAnimation() {
47
+ const canvas = this.shadowRoot.querySelector('#wiki-canvas');
48
+ if (!canvas) return;
49
+ const ctx = canvas.getContext('2d');
50
+ if (!ctx) return;
51
+
52
+ const stars = [
53
+ { x: 50, y: 30, vx: 0.2, vy: 0.15 },
54
+ { x: 120, y: 18, vx: -0.15, vy: 0.2 },
55
+ { x: 170, y: 48, vx: 0.18, vy: -0.22 },
56
+ { x: 230, y: 22, vx: -0.2, vy: -0.1 },
57
+ { x: 290, y: 40, vx: 0.15, vy: 0.25 },
58
+ { x: 80, y: 50, vx: -0.1, vy: -0.18 }
59
+ ];
60
+
61
+ const draw = () => {
62
+ if (!this.isConnected) return;
63
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
64
+
65
+ const w = canvas.width;
66
+ const h = canvas.height;
67
+
68
+ // Update positions
69
+ for (const s of stars) {
70
+ const mult = this.executing ? 2.5 : 1;
71
+ s.x += s.vx * mult;
72
+ s.y += s.vy * mult;
73
+ if (s.x < 15 || s.x > w - 15) s.vx *= -1;
74
+ if (s.y < 12 || s.y > h - 12) s.vy *= -1;
75
+ }
76
+
77
+ // Constellation graph links
78
+ ctx.strokeStyle = 'rgba(217, 119, 6, 0.22)';
79
+ ctx.lineWidth = 1;
80
+ for (let i = 0; i < stars.length; i++) {
81
+ for (let j = i + 1; j < stars.length; j++) {
82
+ const dx = stars[i].x - stars[j].x;
83
+ const dy = stars[i].y - stars[j].y;
84
+ const dist = Math.sqrt(dx * dx + dy * dy);
85
+ if (dist < 85) {
86
+ ctx.beginPath();
87
+ ctx.moveTo(stars[i].x, stars[i].y);
88
+ ctx.lineTo(stars[j].x, stars[j].y);
89
+ ctx.stroke();
90
+ }
91
+ }
92
+ }
93
+
94
+ // Constellation nodes
95
+ for (const s of stars) {
96
+ ctx.fillStyle = this.executing ? '#fde047' : '#d97706';
97
+ ctx.shadowColor = '#f59e0b';
98
+ ctx.shadowBlur = this.executing ? 8 : 4;
99
+ ctx.beginPath();
100
+ ctx.arc(s.x, s.y, 3, 0, Math.PI * 2);
101
+ ctx.fill();
102
+ ctx.shadowBlur = 0;
103
+ }
104
+
105
+ requestAnimationFrame(draw);
106
+ };
107
+
108
+ requestAnimationFrame(draw);
109
+ }
110
+
111
+ render() {
112
+ this.shadowRoot.innerHTML = `
113
+ <style>
114
+ :host {
115
+ display: block;
116
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
117
+ background: #130f06;
118
+ color: #fef3c7;
119
+ border-radius: 8px;
120
+ border: 1px solid rgba(217, 119, 6, 0.35);
121
+ box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
122
+ padding: 18px;
123
+ box-sizing: border-box;
124
+ overflow: hidden;
125
+ }
126
+ .header {
127
+ display: flex;
128
+ justify-content: space-between;
129
+ align-items: flex-start;
130
+ margin-bottom: 14px;
131
+ }
132
+ .brand-meta {
133
+ display: flex;
134
+ flex-direction: column;
135
+ gap: 2px;
136
+ }
137
+ .title {
138
+ font-size: 16px;
139
+ font-weight: 700;
140
+ letter-spacing: 0.04em;
141
+ text-transform: uppercase;
142
+ color: #fde68a;
143
+ margin: 0;
144
+ }
145
+ .subtitle {
146
+ font-size: 11px;
147
+ color: #d97706;
148
+ letter-spacing: 0.02em;
149
+ margin: 0;
150
+ }
151
+ .badge {
152
+ display: inline-flex;
153
+ align-items: center;
154
+ justify-content: center;
155
+ font-size: 10px;
156
+ font-weight: 700;
157
+ letter-spacing: 0.08em;
158
+ text-transform: uppercase;
159
+ color: #f59e0b;
160
+ background: rgba(217, 119, 6, 0.12);
161
+ border: 1px solid rgba(217, 119, 6, 0.3);
162
+ border-radius: 4px;
163
+ padding: 4px 8px;
164
+ }
165
+ .visual-display {
166
+ position: relative;
167
+ background: #080602;
168
+ border: 1px solid rgba(217, 119, 6, 0.2);
169
+ border-radius: 6px;
170
+ margin-bottom: 14px;
171
+ overflow: hidden;
172
+ }
173
+ canvas {
174
+ display: block;
175
+ width: 100%;
176
+ height: 64px;
177
+ }
178
+ .telemetry-row {
179
+ display: flex;
180
+ justify-content: space-between;
181
+ padding: 6px 10px;
182
+ background: rgba(255, 255, 255, 0.03);
183
+ border-top: 1px solid rgba(217, 119, 6, 0.15);
184
+ font-family: monospace;
185
+ font-size: 11px;
186
+ color: #fcd34d;
187
+ }
188
+ .actions-grid {
189
+ display: grid;
190
+ grid-template-columns: repeat(3, 1fr);
191
+ gap: 8px;
192
+ margin-bottom: 12px;
193
+ }
194
+ .touch-btn {
195
+ min-height: 44px;
196
+ min-width: 44px;
197
+ display: inline-flex;
198
+ align-items: center;
199
+ justify-content: center;
200
+ background: rgba(217, 119, 6, 0.08);
201
+ border: 1px solid rgba(217, 119, 6, 0.25);
202
+ color: #fde68a;
203
+ font-size: 11px;
204
+ font-weight: 600;
205
+ letter-spacing: 0.04em;
206
+ text-transform: uppercase;
207
+ border-radius: 6px;
208
+ cursor: pointer;
209
+ transition: background 0.15s ease, border-color 0.15s ease;
210
+ padding: 6px 8px;
211
+ text-align: center;
212
+ }
213
+ .touch-btn:hover {
214
+ background: rgba(217, 119, 6, 0.18);
215
+ border-color: rgba(217, 119, 6, 0.5);
216
+ }
217
+ .touch-btn:active {
218
+ transform: translateY(1px);
219
+ }
220
+ .output-box {
221
+ background: #030201;
222
+ border: 1px solid rgba(217, 119, 6, 0.2);
223
+ border-radius: 6px;
224
+ padding: 8px 10px;
225
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
226
+ font-size: 11px;
227
+ line-height: 1.45;
228
+ color: #f59e0b;
229
+ min-height: 48px;
230
+ max-height: 85px;
231
+ overflow-y: auto;
232
+ white-space: pre-wrap;
233
+ word-break: break-word;
234
+ }
235
+ </style>
236
+
237
+ <div class="header">
238
+ <div class="brand-meta">
239
+ <h2 class="title">OpenWiki</h2>
240
+ <p class="subtitle">Multi-Repo Knowledge Graph & Documentation Wiki</p>
241
+ </div>
242
+ <div id="status-badge" class="badge">READY</div>
243
+ </div>
244
+
245
+ <div class="visual-display">
246
+ <canvas id="wiki-canvas" width="340" height="64"></canvas>
247
+ <div class="telemetry-row">
248
+ <span>Graph: Multi-Repo</span>
249
+ <span>Index: Real-Time</span>
250
+ </div>
251
+ </div>
252
+
253
+ <div class="actions-grid">
254
+ <button id="btn-status" class="touch-btn" type="button">Status</button>
255
+ <button id="btn-hubs" class="touch-btn" type="button">Indexed Hubs</button>
256
+ <button id="btn-ingest" class="touch-btn" type="button">Ingest</button>
257
+ </div>
258
+
259
+ <div id="card-out" class="output-box">Knowledge graph index operational. Ready for cross-repo documentation queries.</div>
260
+ `;
261
+
262
+ this.shadowRoot.querySelector('#btn-status')?.addEventListener('click', () => {
263
+ this.execute('status');
264
+ });
265
+ this.shadowRoot.querySelector('#btn-hubs')?.addEventListener('click', () => {
266
+ this.execute('hubs');
267
+ });
268
+ this.shadowRoot.querySelector('#btn-ingest')?.addEventListener('click', () => {
269
+ this.execute('ingest');
270
+ });
271
+ }
272
+ }
273
+
274
+ if (!customElements.get('tr-openwiki-card')) {
275
+ customElements.define('tr-openwiki-card', OpenWikiCard);
276
+ }
277
+ if (!customElements.get('openwiki-card')) {
278
+ customElements.define('openwiki-card', OpenWikiCard);
279
+ }