clawvault 2.6.1 → 3.0.0

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 (232) hide show
  1. package/bin/command-registration.test.js +1 -3
  2. package/bin/register-core-commands.js +10 -23
  3. package/bin/register-maintenance-commands.js +3 -20
  4. package/bin/register-query-commands.js +23 -0
  5. package/bin/register-task-commands.js +1 -18
  6. package/bin/register-task-commands.test.js +0 -16
  7. package/bin/register-vault-operations-commands.js +1 -29
  8. package/dist/{chunk-QVMXF7FY.js → chunk-3D6BCTP6.js} +39 -1
  9. package/dist/{chunk-R2MIW5G7.js → chunk-3DHXQHYG.js} +1 -1
  10. package/dist/{chunk-Q2J5YTUF.js → chunk-3NSBOUT3.js} +73 -36
  11. package/dist/chunk-3RG5ZIWI.js +10 -0
  12. package/dist/{chunk-AZYOKJYC.js → chunk-62YTUT6J.js} +2 -2
  13. package/dist/chunk-6U6MK36V.js +205 -0
  14. package/dist/{chunk-4QYGFWRM.js → chunk-7R7O6STJ.js} +4 -4
  15. package/dist/{chunk-VXEOHTSL.js → chunk-C7OK5WKP.js} +4 -4
  16. package/dist/chunk-CMB7UL7C.js +327 -0
  17. package/dist/chunk-DEFFDRVP.js +938 -0
  18. package/dist/{chunk-HIHOUSXS.js → chunk-E7MFQB6D.js} +59 -18
  19. package/dist/{chunk-ME37YNW3.js → chunk-F2JEUD4J.js} +6 -4
  20. package/dist/chunk-GAJV4IGR.js +82 -0
  21. package/dist/chunk-GQSLDZTS.js +560 -0
  22. package/dist/{chunk-4OXMU5S2.js → chunk-GUKMRGM7.js} +1 -1
  23. package/dist/{chunk-T76H47ZS.js → chunk-H34S76MB.js} +6 -6
  24. package/dist/{chunk-R6SXNSFD.js → chunk-JY6FYXIT.js} +10 -5
  25. package/dist/chunk-K234IDRJ.js +1073 -0
  26. package/dist/{chunk-IEVLHNLU.js → chunk-LNJA2UGL.js} +86 -9
  27. package/dist/{chunk-MFAWT5O5.js → chunk-LYHGEHXG.js} +1 -0
  28. package/dist/chunk-MFM6K7PU.js +374 -0
  29. package/dist/{chunk-QWQ3TIKS.js → chunk-N2AXRYLC.js} +1 -1
  30. package/dist/chunk-PAH27GSN.js +108 -0
  31. package/dist/{chunk-OIWVQYQF.js → chunk-QBLMXKF2.js} +1 -1
  32. package/dist/{chunk-FHFUXL6G.js → chunk-QK3UCXWL.js} +2 -2
  33. package/dist/{chunk-3BTHWPMB.js → chunk-SJSFRIYS.js} +1 -1
  34. package/dist/{chunk-4VRIMU4O.js → chunk-U55BGUAU.js} +2 -2
  35. package/dist/{chunk-PBEE567J.js → chunk-VGLOTGAS.js} +1 -1
  36. package/dist/{chunk-F55HGNU4.js → chunk-WAZ3NLWL.js} +47 -0
  37. package/dist/{chunk-KL4NAOMO.js → chunk-WGRQ6HDV.js} +1 -1
  38. package/dist/{chunk-UEOUADMO.js → chunk-YKTA5JOJ.js} +13 -10
  39. package/dist/{chunk-XAVB4GB4.js → chunk-ZVVFWOLW.js} +4 -4
  40. package/dist/cli/index.cjs +10033 -0
  41. package/dist/cli/index.d.cts +5 -0
  42. package/dist/cli/index.js +20 -18
  43. package/dist/commands/archive.cjs +287 -0
  44. package/dist/commands/archive.d.cts +11 -0
  45. package/dist/commands/archive.js +1 -0
  46. package/dist/commands/backlog.cjs +721 -0
  47. package/dist/commands/backlog.d.cts +53 -0
  48. package/dist/commands/backlog.js +3 -2
  49. package/dist/commands/blocked.cjs +204 -0
  50. package/dist/commands/blocked.d.cts +26 -0
  51. package/dist/commands/blocked.js +3 -2
  52. package/dist/commands/checkpoint.cjs +244 -0
  53. package/dist/commands/checkpoint.d.cts +41 -0
  54. package/dist/commands/checkpoint.js +2 -1
  55. package/dist/commands/compat.cjs +369 -0
  56. package/dist/commands/compat.d.cts +28 -0
  57. package/dist/commands/compat.js +2 -1
  58. package/dist/commands/context.cjs +2989 -0
  59. package/dist/commands/context.d.cts +2 -0
  60. package/dist/commands/context.js +5 -4
  61. package/dist/commands/doctor.cjs +3062 -0
  62. package/dist/commands/doctor.d.cts +21 -0
  63. package/dist/commands/doctor.d.ts +6 -1
  64. package/dist/commands/doctor.js +13 -11
  65. package/dist/commands/embed.cjs +232 -0
  66. package/dist/commands/embed.d.cts +17 -0
  67. package/dist/commands/embed.js +5 -2
  68. package/dist/commands/entities.cjs +141 -0
  69. package/dist/commands/entities.d.cts +7 -0
  70. package/dist/commands/entities.js +1 -0
  71. package/dist/commands/graph.cjs +501 -0
  72. package/dist/commands/graph.d.cts +21 -0
  73. package/dist/commands/graph.js +1 -0
  74. package/dist/commands/inject.cjs +1636 -0
  75. package/dist/commands/inject.d.cts +2 -0
  76. package/dist/commands/inject.d.ts +1 -1
  77. package/dist/commands/inject.js +4 -2
  78. package/dist/commands/kanban.cjs +884 -0
  79. package/dist/commands/kanban.d.cts +63 -0
  80. package/dist/commands/kanban.js +4 -3
  81. package/dist/commands/link.cjs +965 -0
  82. package/dist/commands/link.d.cts +11 -0
  83. package/dist/commands/link.js +1 -0
  84. package/dist/commands/migrate-observations.cjs +362 -0
  85. package/dist/commands/migrate-observations.d.cts +19 -0
  86. package/dist/commands/migrate-observations.js +3 -2
  87. package/dist/commands/observe.cjs +4099 -0
  88. package/dist/commands/observe.d.cts +23 -0
  89. package/dist/commands/observe.d.ts +1 -0
  90. package/dist/commands/observe.js +11 -9
  91. package/dist/commands/project.cjs +1341 -0
  92. package/dist/commands/project.d.cts +85 -0
  93. package/dist/commands/project.js +5 -4
  94. package/dist/commands/rebuild.cjs +3136 -0
  95. package/dist/commands/rebuild.d.cts +11 -0
  96. package/dist/commands/rebuild.js +10 -8
  97. package/dist/commands/recover.cjs +361 -0
  98. package/dist/commands/recover.d.cts +38 -0
  99. package/dist/commands/recover.js +3 -2
  100. package/dist/commands/reflect.cjs +1008 -0
  101. package/dist/commands/reflect.d.cts +11 -0
  102. package/dist/commands/reflect.js +6 -4
  103. package/dist/commands/repair-session.cjs +457 -0
  104. package/dist/commands/repair-session.d.cts +38 -0
  105. package/dist/commands/repair-session.js +1 -0
  106. package/dist/commands/replay.cjs +4103 -0
  107. package/dist/commands/replay.d.cts +16 -0
  108. package/dist/commands/replay.js +12 -10
  109. package/dist/commands/session-recap.cjs +353 -0
  110. package/dist/commands/session-recap.d.cts +27 -0
  111. package/dist/commands/session-recap.js +1 -0
  112. package/dist/commands/setup.cjs +1345 -0
  113. package/dist/commands/setup.d.cts +100 -0
  114. package/dist/commands/setup.d.ts +90 -2
  115. package/dist/commands/setup.js +21 -2
  116. package/dist/commands/shell-init.cjs +75 -0
  117. package/dist/commands/shell-init.d.cts +7 -0
  118. package/dist/commands/shell-init.js +2 -0
  119. package/dist/commands/sleep.cjs +6028 -0
  120. package/dist/commands/sleep.d.cts +36 -0
  121. package/dist/commands/sleep.d.ts +1 -1
  122. package/dist/commands/sleep.js +17 -15
  123. package/dist/commands/status.cjs +2736 -0
  124. package/dist/commands/status.d.cts +52 -0
  125. package/dist/commands/status.js +12 -10
  126. package/dist/commands/tailscale.cjs +1532 -0
  127. package/dist/commands/tailscale.d.cts +52 -0
  128. package/dist/commands/tailscale.js +1 -0
  129. package/dist/commands/task.cjs +1236 -0
  130. package/dist/commands/task.d.cts +97 -0
  131. package/dist/commands/task.js +4 -3
  132. package/dist/commands/template.cjs +457 -0
  133. package/dist/commands/template.d.cts +36 -0
  134. package/dist/commands/template.js +2 -1
  135. package/dist/commands/wake.cjs +2626 -0
  136. package/dist/commands/wake.d.cts +22 -0
  137. package/dist/commands/wake.d.ts +1 -1
  138. package/dist/commands/wake.js +10 -9
  139. package/dist/context-BUGaWpyL.d.cts +46 -0
  140. package/dist/index.cjs +14526 -0
  141. package/dist/index.d.cts +858 -0
  142. package/dist/index.d.ts +192 -7
  143. package/dist/index.js +101 -75
  144. package/dist/{inject-x65KXWPk.d.ts → inject-Bzi5E-By.d.cts} +1 -1
  145. package/dist/inject-Bzi5E-By.d.ts +137 -0
  146. package/dist/lib/auto-linker.cjs +176 -0
  147. package/dist/lib/auto-linker.d.cts +26 -0
  148. package/dist/lib/auto-linker.js +1 -0
  149. package/dist/lib/canvas-layout.cjs +136 -0
  150. package/dist/lib/canvas-layout.d.cts +31 -0
  151. package/dist/lib/canvas-layout.d.ts +16 -100
  152. package/dist/lib/canvas-layout.js +78 -20
  153. package/dist/lib/config.cjs +78 -0
  154. package/dist/lib/config.d.cts +11 -0
  155. package/dist/lib/config.js +1 -0
  156. package/dist/lib/entity-index.cjs +84 -0
  157. package/dist/lib/entity-index.d.cts +26 -0
  158. package/dist/lib/entity-index.js +1 -0
  159. package/dist/lib/project-utils.cjs +864 -0
  160. package/dist/lib/project-utils.d.cts +97 -0
  161. package/dist/lib/project-utils.js +4 -3
  162. package/dist/lib/session-repair.cjs +239 -0
  163. package/dist/lib/session-repair.d.cts +110 -0
  164. package/dist/lib/session-repair.js +1 -0
  165. package/dist/lib/session-utils.cjs +209 -0
  166. package/dist/lib/session-utils.d.cts +63 -0
  167. package/dist/lib/session-utils.js +1 -0
  168. package/dist/lib/tailscale.cjs +1183 -0
  169. package/dist/lib/tailscale.d.cts +225 -0
  170. package/dist/lib/tailscale.js +1 -0
  171. package/dist/lib/task-utils.cjs +1137 -0
  172. package/dist/lib/task-utils.d.cts +208 -0
  173. package/dist/lib/task-utils.js +3 -2
  174. package/dist/lib/template-engine.cjs +47 -0
  175. package/dist/lib/template-engine.d.cts +11 -0
  176. package/dist/lib/template-engine.js +1 -0
  177. package/dist/lib/webdav.cjs +568 -0
  178. package/dist/lib/webdav.d.cts +109 -0
  179. package/dist/lib/webdav.js +1 -0
  180. package/dist/plugin/index.cjs +1907 -0
  181. package/dist/plugin/index.d.cts +36 -0
  182. package/dist/plugin/index.d.ts +36 -0
  183. package/dist/plugin/index.js +572 -0
  184. package/dist/plugin/inject.cjs +356 -0
  185. package/dist/plugin/inject.d.cts +54 -0
  186. package/dist/plugin/inject.d.ts +54 -0
  187. package/dist/plugin/inject.js +17 -0
  188. package/dist/plugin/observe.cjs +631 -0
  189. package/dist/plugin/observe.d.cts +39 -0
  190. package/dist/plugin/observe.d.ts +39 -0
  191. package/dist/plugin/observe.js +18 -0
  192. package/dist/plugin/templates.cjs +593 -0
  193. package/dist/plugin/templates.d.cts +52 -0
  194. package/dist/plugin/templates.d.ts +52 -0
  195. package/dist/plugin/templates.js +25 -0
  196. package/dist/plugin/types.cjs +18 -0
  197. package/dist/plugin/types.d.cts +209 -0
  198. package/dist/plugin/types.d.ts +209 -0
  199. package/dist/plugin/types.js +0 -0
  200. package/dist/plugin/vault.cjs +927 -0
  201. package/dist/plugin/vault.d.cts +68 -0
  202. package/dist/plugin/vault.d.ts +68 -0
  203. package/dist/plugin/vault.js +22 -0
  204. package/dist/{types-C74wgGL1.d.ts → types-Y2_Um2Ls.d.cts} +44 -1
  205. package/dist/types-Y2_Um2Ls.d.ts +205 -0
  206. package/hooks/clawvault/handler.js +70 -7
  207. package/hooks/clawvault/handler.test.js +91 -0
  208. package/openclaw.plugin.json +56 -0
  209. package/package.json +17 -7
  210. package/templates/memory-event.md +67 -0
  211. package/templates/party.md +63 -0
  212. package/templates/primitive-registry.yaml +551 -0
  213. package/templates/run.md +68 -0
  214. package/templates/trigger.md +68 -0
  215. package/templates/workspace.md +50 -0
  216. package/dashboard/lib/graph-diff.js +0 -104
  217. package/dashboard/lib/graph-diff.test.js +0 -75
  218. package/dashboard/lib/vault-parser.js +0 -556
  219. package/dashboard/lib/vault-parser.test.js +0 -254
  220. package/dashboard/public/app.js +0 -796
  221. package/dashboard/public/index.html +0 -52
  222. package/dashboard/public/styles.css +0 -221
  223. package/dashboard/server.js +0 -374
  224. package/dist/chunk-MAKNAHAW.js +0 -375
  225. package/dist/chunk-MDIH26GC.js +0 -183
  226. package/dist/chunk-MGDEINGP.js +0 -99
  227. package/dist/chunk-RVYA52PY.js +0 -363
  228. package/dist/chunk-TLGBDTYT.js +0 -33
  229. package/dist/commands/canvas.d.ts +0 -15
  230. package/dist/commands/canvas.js +0 -199
  231. package/dist/commands/sync-bd.d.ts +0 -10
  232. package/dist/commands/sync-bd.js +0 -9
@@ -1,363 +0,0 @@
1
- import {
2
- hasQmd,
3
- withQmdIndexArgs
4
- } from "./chunk-MAKNAHAW.js";
5
- import {
6
- DEFAULT_CATEGORIES
7
- } from "./chunk-2CDEETQN.js";
8
-
9
- // src/commands/setup.ts
10
- import * as fs from "fs";
11
- import * as os from "os";
12
- import * as path from "path";
13
- import { execFileSync } from "child_process";
14
- var CONFIG_FILE = ".clawvault.json";
15
- function resolveVaultTarget(vaultOverride) {
16
- if (vaultOverride) {
17
- const vaultPath = path.resolve(vaultOverride);
18
- return { vaultPath, source: "--vault flag", existed: fs.existsSync(vaultPath) };
19
- }
20
- const envPath = process.env.CLAWVAULT_PATH?.trim();
21
- const home = os.homedir();
22
- if (envPath) {
23
- const vaultPath = path.resolve(envPath);
24
- return { vaultPath, source: "CLAWVAULT_PATH", existed: fs.existsSync(vaultPath) };
25
- }
26
- const candidates = [
27
- { vaultPath: path.join(home, ".openclaw", "workspace", "memory"), source: "OpenClaw default" },
28
- { vaultPath: path.resolve(process.cwd(), "memory"), source: "./memory" },
29
- { vaultPath: path.join(home, "memory"), source: "~/memory" }
30
- ];
31
- for (const candidate of candidates) {
32
- if (fs.existsSync(candidate.vaultPath)) {
33
- return { ...candidate, existed: true };
34
- }
35
- }
36
- const fallback = candidates[0];
37
- return { ...fallback, existed: false };
38
- }
39
- function ensureVaultStructure(vaultPath) {
40
- fs.mkdirSync(vaultPath, { recursive: true });
41
- for (const category of DEFAULT_CATEGORIES) {
42
- fs.mkdirSync(path.join(vaultPath, category), { recursive: true });
43
- }
44
- const configPath = path.join(vaultPath, CONFIG_FILE);
45
- if (fs.existsSync(configPath)) return false;
46
- const now = (/* @__PURE__ */ new Date()).toISOString();
47
- const name = path.basename(vaultPath);
48
- const meta = {
49
- name,
50
- version: "1.0.0",
51
- created: now,
52
- lastUpdated: now,
53
- categories: DEFAULT_CATEGORIES,
54
- documentCount: 0,
55
- qmdCollection: name,
56
- qmdRoot: vaultPath
57
- };
58
- fs.writeFileSync(configPath, JSON.stringify(meta, null, 2));
59
- return true;
60
- }
61
- function writeBases(vaultPath, force) {
62
- const basesFiles = {
63
- "all-tasks.base": `filters:
64
- and:
65
- - file.inFolder("tasks")
66
- - status != "done"
67
- formulas:
68
- age: (now() - file.ctime).days
69
- status_icon: if(status == "blocked", "\u{1F534}", if(status == "in-progress", "\u{1F528}", if(status == "open", "\u26AA", "\u2705")))
70
- views:
71
- - type: table
72
- name: All Active Tasks
73
- groupBy:
74
- property: status
75
- direction: ASC
76
- order:
77
- - formula.status_icon
78
- - file.name
79
- - status
80
- - owner
81
- - project
82
- - priority
83
- - blocked_by
84
- - formula.age
85
- - type: cards
86
- name: Task Board
87
- groupBy:
88
- property: status
89
- direction: ASC
90
- order:
91
- - file.name
92
- - owner
93
- - project
94
- - priority`,
95
- "blocked.base": `filters:
96
- and:
97
- - file.inFolder("tasks")
98
- - status == "blocked"
99
- formulas:
100
- days_blocked: (now() - file.ctime).days
101
- views:
102
- - type: table
103
- name: Blocked Tasks
104
- order:
105
- - file.name
106
- - owner
107
- - project
108
- - blocked_by
109
- - formula.days_blocked
110
- - priority`,
111
- "by-project.base": `filters:
112
- and:
113
- - file.inFolder("tasks")
114
- - status != "done"
115
- formulas:
116
- status_icon: if(status == "blocked", "\u{1F534}", if(status == "in-progress", "\u{1F528}", "\u26AA"))
117
- views:
118
- - type: table
119
- name: By Project
120
- groupBy:
121
- property: project
122
- direction: ASC
123
- order:
124
- - formula.status_icon
125
- - file.name
126
- - status
127
- - owner
128
- - priority
129
- - type: cards
130
- name: Project Cards
131
- groupBy:
132
- property: project
133
- direction: ASC
134
- order:
135
- - file.name
136
- - owner
137
- - status`,
138
- "by-owner.base": `filters:
139
- and:
140
- - file.inFolder("tasks")
141
- - status != "done"
142
- views:
143
- - type: table
144
- name: By Owner
145
- groupBy:
146
- property: owner
147
- direction: ASC
148
- order:
149
- - file.name
150
- - status
151
- - project
152
- - priority`,
153
- "backlog.base": `filters:
154
- and:
155
- - file.inFolder("backlog")
156
- views:
157
- - type: table
158
- name: Backlog
159
- order:
160
- - file.name
161
- - source
162
- - project
163
- - file.ctime`
164
- };
165
- let written = 0;
166
- for (const [filename, content] of Object.entries(basesFiles)) {
167
- const filePath = path.join(vaultPath, filename);
168
- if (force || !fs.existsSync(filePath)) {
169
- fs.writeFileSync(filePath, content);
170
- written++;
171
- }
172
- }
173
- return written;
174
- }
175
- var NEURAL_GRAPH_CSS = `/* ClawVault Graph Colors \u2014 Neural Neural Style */
176
- /* Auto-generated by \`clawvault setup --theme neural\` */
177
-
178
- body.theme-dark .graph-view .graph-view-container { background-color: #0a0a0a; }
179
-
180
- body.theme-dark .graph-view .node.tag-person circle { fill: #00b4d8 !important; }
181
- body.theme-dark .graph-view .node.tag-project circle { fill: #2d6a4f !important; }
182
- body.theme-dark .graph-view .node.tag-decision circle { fill: #e8590c !important; }
183
- body.theme-dark .graph-view .node.tag-lesson circle { fill: #fcc419 !important; }
184
- body.theme-dark .graph-view .node.tag-commitment circle { fill: #e03131 !important; }
185
- body.theme-dark .graph-view .node.tag-task circle { fill: #22b8cf !important; }
186
- body.theme-dark .graph-view .node.tag-observation circle { fill: #7950f2 !important; }
187
- body.theme-dark .graph-view .node.tag-handoff circle { fill: #845ef7 !important; }
188
- body.theme-dark .graph-view .node.tag-daily circle { fill: #495057 !important; }
189
-
190
- body.theme-dark .graph-view .node.is-focused circle {
191
- fill: #e8a430 !important; stroke: #e8a430 !important;
192
- stroke-width: 3px; filter: drop-shadow(0 0 6px #e8a430);
193
- }
194
-
195
- body.theme-dark .graph-view .link { stroke: rgba(45, 200, 120, 0.15) !important; }
196
- body.theme-dark .graph-view .link.is-focused { stroke: rgba(45, 200, 120, 0.6) !important; }
197
- body.theme-dark .graph-view .node text { fill: #c1c2c5 !important; font-size: 0.8em; }
198
- `;
199
- var MINIMAL_GRAPH_CSS = `/* ClawVault Graph Colors \u2014 Minimal */
200
- /* Auto-generated by \`clawvault setup --theme minimal\` */
201
-
202
- body.theme-dark .graph-view .node.tag-person circle { fill: #4a90e8 !important; }
203
- body.theme-dark .graph-view .node.tag-project circle { fill: #4ae85d !important; }
204
- body.theme-dark .graph-view .node.tag-decision circle { fill: #e85d4a !important; }
205
- body.theme-dark .graph-view .node.tag-lesson circle { fill: #9b59b6 !important; }
206
- body.theme-dark .graph-view .node.tag-task circle { fill: #e8a430 !important; }
207
- `;
208
- var NEURAL_COLOR_GROUPS = [
209
- { query: "path:people", color: { a: 1, rgb: 47316 } },
210
- { query: "path:projects", color: { a: 1, rgb: 2976335 } },
211
- { query: "path:decisions", color: { a: 1, rgb: 15227916 } },
212
- { query: "path:lessons", color: { a: 1, rgb: 16565273 } },
213
- { query: "path:tasks", color: { a: 1, rgb: 2275535 } },
214
- { query: "path:commitments", color: { a: 1, rgb: 14680369 } },
215
- { query: "path:backlog", color: { a: 1, rgb: 9806262 } },
216
- { query: "path:inbox", color: { a: 1, rgb: 15964178 } },
217
- { query: "path:handoffs", color: { a: 1, rgb: 8675063 } },
218
- { query: "path:ledger", color: { a: 1, rgb: 7950066 } }
219
- ];
220
- var MINIMAL_COLOR_GROUPS = [
221
- { query: "path:people", color: { a: 1, rgb: 4886760 } },
222
- { query: "path:projects", color: { a: 1, rgb: 4909149 } },
223
- { query: "path:decisions", color: { a: 1, rgb: 15228234 } },
224
- { query: "path:lessons", color: { a: 1, rgb: 10181046 } },
225
- { query: "path:tasks", color: { a: 1, rgb: 15246384 } }
226
- ];
227
- function writeGraphColors(vaultPath, theme, force) {
228
- const obsidianDir = path.join(vaultPath, ".obsidian");
229
- if (!fs.existsSync(obsidianDir)) {
230
- return false;
231
- }
232
- const snippetsDir = path.join(obsidianDir, "snippets");
233
- fs.mkdirSync(snippetsDir, { recursive: true });
234
- const snippetName = "clawvault-graph";
235
- const snippetPath = path.join(snippetsDir, `${snippetName}.css`);
236
- if (!force && fs.existsSync(snippetPath)) {
237
- return false;
238
- }
239
- const css = theme === "neural" ? NEURAL_GRAPH_CSS : MINIMAL_GRAPH_CSS;
240
- fs.writeFileSync(snippetPath, css);
241
- const appearancePath = path.join(obsidianDir, "appearance.json");
242
- let appearance = {};
243
- if (fs.existsSync(appearancePath)) {
244
- try {
245
- appearance = JSON.parse(fs.readFileSync(appearancePath, "utf-8"));
246
- } catch {
247
- }
248
- }
249
- const snippets = appearance.enabledCssSnippets || [];
250
- if (!snippets.includes(snippetName)) {
251
- snippets.push(snippetName);
252
- appearance.enabledCssSnippets = snippets;
253
- fs.writeFileSync(appearancePath, JSON.stringify(appearance, null, 2));
254
- }
255
- const graphPath = path.join(obsidianDir, "graph.json");
256
- let graphConfig = {};
257
- if (fs.existsSync(graphPath)) {
258
- try {
259
- graphConfig = JSON.parse(fs.readFileSync(graphPath, "utf-8"));
260
- } catch {
261
- }
262
- }
263
- graphConfig.colorGroups = theme === "neural" ? NEURAL_COLOR_GROUPS : MINIMAL_COLOR_GROUPS;
264
- if (theme === "neural") {
265
- graphConfig.showTags = false;
266
- graphConfig.showAttachments = false;
267
- graphConfig.nodeSizeMultiplier = 1.2;
268
- graphConfig.lineSizeMultiplier = 0.8;
269
- graphConfig.textFadeMultiplier = 0;
270
- graphConfig.repelStrength = 10;
271
- graphConfig.linkDistance = 250;
272
- graphConfig.centerStrength = 0.5;
273
- }
274
- fs.writeFileSync(graphPath, JSON.stringify(graphConfig, null, 2));
275
- return true;
276
- }
277
- function getQmdConfig(vaultPath) {
278
- const configPath = path.join(vaultPath, CONFIG_FILE);
279
- if (fs.existsSync(configPath)) {
280
- try {
281
- const meta = JSON.parse(fs.readFileSync(configPath, "utf-8"));
282
- return {
283
- collection: meta.qmdCollection || meta.name || path.basename(vaultPath),
284
- root: meta.qmdRoot || vaultPath
285
- };
286
- } catch {
287
- return { collection: path.basename(vaultPath), root: vaultPath };
288
- }
289
- }
290
- return { collection: path.basename(vaultPath), root: vaultPath };
291
- }
292
- async function setupCommand(options = {}) {
293
- const target = resolveVaultTarget(options.vault);
294
- if (target.existed && !fs.statSync(target.vaultPath).isDirectory()) {
295
- throw new Error(`Vault path is not a directory: ${target.vaultPath}`);
296
- }
297
- if (!target.existed) fs.mkdirSync(target.vaultPath, { recursive: true });
298
- console.log(`${target.existed ? "Found" : "Created"} vault path (${target.source}): ${target.vaultPath}`);
299
- const initialized = ensureVaultStructure(target.vaultPath);
300
- console.log(initialized ? "\u2713 Initialized vault structure." : "\u2713 Vault structure already present.");
301
- const force = options.force ?? false;
302
- const theme = options.theme ?? "neural";
303
- const explicitFlags = options.graphColors !== void 0 || options.bases !== void 0 || options.canvas !== void 0;
304
- const doGraphColors = explicitFlags ? options.graphColors !== false : true;
305
- const doBases = explicitFlags ? options.bases !== false : true;
306
- const doCanvas = explicitFlags ? options.canvas !== void 0 && options.canvas !== false : false;
307
- if (doGraphColors && theme !== "none") {
308
- const wrote = writeGraphColors(target.vaultPath, theme, force);
309
- if (wrote) {
310
- console.log(`\u2713 Graph colors configured (${theme} theme)`);
311
- } else {
312
- const obsidianDir = path.join(target.vaultPath, ".obsidian");
313
- if (!fs.existsSync(obsidianDir)) {
314
- console.log("\u2298 No .obsidian directory \u2014 skipping graph colors (not an Obsidian vault)");
315
- } else {
316
- console.log("\u2298 Graph colors already exist (use --force to overwrite)");
317
- }
318
- }
319
- } else if (doGraphColors && theme === "none") {
320
- console.log("\u2298 Graph colors skipped (--theme none)");
321
- }
322
- if (doBases) {
323
- const count = writeBases(target.vaultPath, force);
324
- if (count > 0) {
325
- console.log(`\u2713 Created ${count} Obsidian Bases view${count > 1 ? "s" : ""}`);
326
- } else {
327
- console.log("\u2298 Bases views already exist (use --force to overwrite)");
328
- }
329
- }
330
- if (doCanvas) {
331
- try {
332
- const { canvasCommand } = await import("./commands/canvas.js");
333
- await canvasCommand(target.vaultPath);
334
- } catch (err) {
335
- console.log(`\u26A0 Canvas generation failed: ${err instanceof Error ? err.message : String(err)}`);
336
- }
337
- }
338
- if (hasQmd()) {
339
- const { collection, root } = getQmdConfig(target.vaultPath);
340
- try {
341
- execFileSync("qmd", withQmdIndexArgs(["collection", "add", root, "--name", collection, "--mask", "**/*.md"], options.qmdIndexName), {
342
- stdio: "ignore"
343
- });
344
- console.log(`\u2713 qmd collection ready: ${collection}`);
345
- } catch {
346
- console.log("\u2298 qmd collection already exists.");
347
- }
348
- } else {
349
- console.log("\u2298 qmd not found \u2014 skipping semantic search setup.");
350
- }
351
- console.log("\nTip: add this to your shell config:");
352
- console.log(` export CLAWVAULT_PATH="${target.vaultPath}"`);
353
- console.log("\nCustomize further:");
354
- console.log(" clawvault setup --theme neural # Neural neural graph colors");
355
- console.log(" clawvault setup --theme minimal # Subtle category colors");
356
- console.log(" clawvault setup --canvas # Generate vault status canvas");
357
- console.log(" clawvault setup --no-bases --no-graph-colors # Structure only");
358
- console.log(" clawvault setup --force # Overwrite existing configs");
359
- }
360
-
361
- export {
362
- setupCommand
363
- };
@@ -1,33 +0,0 @@
1
- import {
2
- registerTailscaleCommands
3
- } from "./chunk-THRJVD4L.js";
4
- import {
5
- registerObserveCommand
6
- } from "./chunk-ME37YNW3.js";
7
- import {
8
- registerReflectCommand
9
- } from "./chunk-3BTHWPMB.js";
10
- import {
11
- registerContextCommand
12
- } from "./chunk-XAVB4GB4.js";
13
- import {
14
- registerEmbedCommand
15
- } from "./chunk-4QYGFWRM.js";
16
- import {
17
- registerInjectCommand
18
- } from "./chunk-4VRIMU4O.js";
19
-
20
- // src/cli/index.ts
21
- function registerCliCommands(program) {
22
- registerContextCommand(program);
23
- registerInjectCommand(program);
24
- registerObserveCommand(program);
25
- registerReflectCommand(program);
26
- registerEmbedCommand(program);
27
- registerTailscaleCommands(program);
28
- return program;
29
- }
30
-
31
- export {
32
- registerCliCommands
33
- };
@@ -1,15 +0,0 @@
1
- import { Canvas } from '../lib/canvas-layout.js';
2
-
3
- interface CanvasOptions {
4
- output?: string;
5
- }
6
- /**
7
- * Generate the vault status canvas.
8
- */
9
- declare function generateCanvas(vaultPath: string): Canvas;
10
- /**
11
- * Canvas command handler for CLI.
12
- */
13
- declare function canvasCommand(vaultPath: string, options?: CanvasOptions): Promise<void>;
14
-
15
- export { type CanvasOptions, canvasCommand, generateCanvas };
@@ -1,199 +0,0 @@
1
- import {
2
- CANVAS_COLORS,
3
- LAYOUT,
4
- createGroupWithNodes,
5
- createTextNode,
6
- flattenGroups,
7
- positionGroupsVertically,
8
- truncateText
9
- } from "../chunk-MDIH26GC.js";
10
- import {
11
- loadMemoryGraphIndex
12
- } from "../chunk-ZZA73MFY.js";
13
- import {
14
- listObservationFiles
15
- } from "../chunk-Z2XBWN7A.js";
16
- import {
17
- listTasks
18
- } from "../chunk-QWQ3TIKS.js";
19
- import "../chunk-MFAWT5O5.js";
20
- import "../chunk-7766SIJP.js";
21
-
22
- // src/commands/canvas.ts
23
- import * as fs2 from "fs";
24
- import * as path2 from "path";
25
-
26
- // src/lib/canvas-default-template.ts
27
- import * as fs from "fs";
28
- import * as path from "path";
29
- var STATUS_ORDER = ["in-progress", "open", "blocked", "done"];
30
- var STATUS_LABELS = {
31
- "in-progress": "In Progress",
32
- open: "Open",
33
- blocked: "Blocked",
34
- done: "Done"
35
- };
36
- var STATUS_COLORS = {
37
- "in-progress": CANVAS_COLORS.ORANGE,
38
- open: void 0,
39
- blocked: CANVAS_COLORS.RED,
40
- done: CANVAS_COLORS.GREEN
41
- };
42
- function groupTasksByStatus(tasks) {
43
- const grouped = {
44
- open: [],
45
- "in-progress": [],
46
- blocked: [],
47
- done: []
48
- };
49
- for (const task of tasks) {
50
- grouped[task.frontmatter.status].push(task);
51
- }
52
- return grouped;
53
- }
54
- function readObservationTitle(filePath) {
55
- try {
56
- const content = fs.readFileSync(filePath, "utf-8");
57
- const headingMatch = content.match(/^#\s+(.+)$/m);
58
- if (headingMatch?.[1]) {
59
- return truncateText(headingMatch[1].trim(), 44);
60
- }
61
- const firstBodyLine = content.split(/\r?\n/).map((line) => line.trim()).find((line) => line.length > 0 && line !== "---" && !line.includes(":"));
62
- return firstBodyLine ? truncateText(firstBodyLine, 44) : null;
63
- } catch {
64
- return null;
65
- }
66
- }
67
- function buildTaskStatusGroup(tasks) {
68
- const grouped = groupTasksByStatus(tasks);
69
- const summaryLines = STATUS_ORDER.map((status) => `${STATUS_LABELS[status]}: ${grouped[status].length}`);
70
- const childNodes = [
71
- createTextNode(
72
- 0,
73
- 0,
74
- LAYOUT.DEFAULT_NODE_WIDTH,
75
- LAYOUT.SMALL_NODE_HEIGHT + 24,
76
- `**Tasks by Status**
77
-
78
- Total: ${tasks.length}
79
- ${summaryLines.join("\n")}`
80
- )
81
- ];
82
- for (const status of STATUS_ORDER) {
83
- const bucket = grouped[status];
84
- const lines = bucket.length === 0 ? ["- none"] : bucket.slice(0, 6).map((task) => `- ${truncateText(task.title, 42)}`);
85
- if (bucket.length > 6) {
86
- lines.push(`- ... and ${bucket.length - 6} more`);
87
- }
88
- childNodes.push(
89
- createTextNode(
90
- 0,
91
- 0,
92
- LAYOUT.DEFAULT_NODE_WIDTH,
93
- LAYOUT.SMALL_NODE_HEIGHT + lines.length * 18,
94
- `**${STATUS_LABELS[status]} (${bucket.length})**
95
-
96
- ${lines.join("\n")}`,
97
- STATUS_COLORS[status]
98
- )
99
- );
100
- }
101
- return createGroupWithNodes(
102
- LAYOUT.LEFT_COLUMN_X,
103
- 0,
104
- LAYOUT.LEFT_COLUMN_WIDTH,
105
- "Vault Status",
106
- childNodes,
107
- CANVAS_COLORS.CYAN
108
- );
109
- }
110
- function buildRecentObservationsGroup(vaultPath) {
111
- const observations = listObservationFiles(vaultPath, { includeLegacy: true, includeArchive: false });
112
- const recent = observations.slice(-8).reverse();
113
- const lines = recent.length === 0 ? ["- none"] : recent.map((entry) => {
114
- const title = readObservationTitle(entry.path);
115
- return title ? `- ${entry.date}: ${title}` : `- ${entry.date}`;
116
- });
117
- const text = [
118
- "**Recent Observations**",
119
- "",
120
- `Total days: ${observations.length}`,
121
- "",
122
- ...lines
123
- ].join("\n");
124
- return createGroupWithNodes(
125
- LAYOUT.LEFT_COLUMN_X,
126
- 0,
127
- LAYOUT.LEFT_COLUMN_WIDTH,
128
- "Recent Observations",
129
- [createTextNode(0, 0, LAYOUT.DEFAULT_NODE_WIDTH, LAYOUT.DEFAULT_NODE_HEIGHT + lines.length * 18, text)],
130
- CANVAS_COLORS.CYAN
131
- );
132
- }
133
- function buildGraphStatsGroup(vaultPath) {
134
- const graph = loadMemoryGraphIndex(vaultPath)?.graph;
135
- const textLines = ["**Graph Stats**", ""];
136
- if (!graph) {
137
- textLines.push("Graph index not found.");
138
- textLines.push("Run `clawvault graph --build` to populate it.");
139
- } else {
140
- textLines.push(`Nodes: ${graph.stats.nodeCount}`);
141
- textLines.push(`Edges: ${graph.stats.edgeCount}`);
142
- textLines.push("");
143
- textLines.push("Node types:");
144
- const nodeTypeLines = Object.entries(graph.stats.nodeTypeCounts).sort((left, right) => right[1] - left[1]).slice(0, 6).map(([type, count]) => `- ${type}: ${count}`);
145
- textLines.push(...nodeTypeLines.length > 0 ? nodeTypeLines : ["- none"]);
146
- }
147
- return createGroupWithNodes(
148
- LAYOUT.LEFT_COLUMN_X,
149
- 0,
150
- LAYOUT.LEFT_COLUMN_WIDTH,
151
- "Graph Stats",
152
- [
153
- createTextNode(
154
- 0,
155
- 0,
156
- LAYOUT.DEFAULT_NODE_WIDTH,
157
- LAYOUT.DEFAULT_NODE_HEIGHT + (textLines.length - 1) * 16,
158
- textLines.join("\n")
159
- )
160
- ],
161
- CANVAS_COLORS.PURPLE
162
- );
163
- }
164
- function generateDefaultCanvas(vaultPath) {
165
- const resolvedPath = path.resolve(vaultPath);
166
- const tasks = listTasks(resolvedPath);
167
- const groups = positionGroupsVertically([
168
- buildTaskStatusGroup(tasks),
169
- buildRecentObservationsGroup(resolvedPath),
170
- buildGraphStatsGroup(resolvedPath)
171
- ]);
172
- return {
173
- nodes: flattenGroups(groups),
174
- edges: []
175
- };
176
- }
177
-
178
- // src/lib/canvas-templates.ts
179
- function generateCanvas(vaultPath) {
180
- return generateDefaultCanvas(vaultPath);
181
- }
182
-
183
- // src/commands/canvas.ts
184
- function generateCanvas2(vaultPath) {
185
- return generateCanvas(path2.resolve(vaultPath));
186
- }
187
- async function canvasCommand(vaultPath, options = {}) {
188
- const resolvedPath = path2.resolve(vaultPath);
189
- const outputPath = options.output || path2.join(resolvedPath, "dashboard.canvas");
190
- const canvas = generateCanvas(resolvedPath);
191
- fs2.writeFileSync(outputPath, JSON.stringify(canvas, null, 2));
192
- console.log(`\u2713 Generated canvas: ${outputPath}`);
193
- console.log(` Nodes: ${canvas.nodes.length}`);
194
- console.log(` Edges: ${canvas.edges.length}`);
195
- }
196
- export {
197
- canvasCommand,
198
- generateCanvas2 as generateCanvas
199
- };
@@ -1,10 +0,0 @@
1
- import { Command } from 'commander';
2
-
3
- interface SyncBdCommandOptions {
4
- vaultPath?: string;
5
- dryRun?: boolean;
6
- }
7
- declare function syncBdCommand(options: SyncBdCommandOptions): Promise<void>;
8
- declare function registerSyncBdCommand(program: Command): void;
9
-
10
- export { type SyncBdCommandOptions, registerSyncBdCommand, syncBdCommand };
@@ -1,9 +0,0 @@
1
- import {
2
- registerSyncBdCommand,
3
- syncBdCommand
4
- } from "../chunk-MGDEINGP.js";
5
- import "../chunk-MXSSG3QU.js";
6
- export {
7
- registerSyncBdCommand,
8
- syncBdCommand
9
- };