clawvault 2.6.0 → 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-K3CDT7IH.js → chunk-E7MFQB6D.js} +61 -20
  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-YOSEUUNB.js → chunk-H34S76MB.js} +6 -6
  24. package/dist/{chunk-4TE4JMLA.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-2YDBJS7M.js → chunk-SJSFRIYS.js} +1 -1
  34. package/dist/{chunk-GSD4ALSI.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 +12 -11
  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-HA5M6KJB.js +0 -33
  225. package/dist/chunk-MAKNAHAW.js +0 -375
  226. package/dist/chunk-MDIH26GC.js +0 -183
  227. package/dist/chunk-MGDEINGP.js +0 -99
  228. package/dist/chunk-RVYA52PY.js +0 -363
  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
@@ -0,0 +1,21 @@
1
+ type DoctorStatus = 'ok' | 'warn' | 'error';
2
+ interface DoctorCheck {
3
+ label: string;
4
+ status: DoctorStatus;
5
+ detail?: string;
6
+ hint?: string;
7
+ }
8
+ interface DoctorReport {
9
+ vaultPath?: string;
10
+ qmdCollection?: string;
11
+ qmdRoot?: string;
12
+ checks: DoctorCheck[];
13
+ warnings: number;
14
+ errors: number;
15
+ }
16
+ declare function doctor(options?: string | {
17
+ vaultPath?: string;
18
+ fix?: boolean;
19
+ }): Promise<DoctorReport>;
20
+
21
+ export { type DoctorCheck, type DoctorReport, type DoctorStatus, doctor };
@@ -7,10 +7,15 @@ interface DoctorCheck {
7
7
  }
8
8
  interface DoctorReport {
9
9
  vaultPath?: string;
10
+ qmdCollection?: string;
11
+ qmdRoot?: string;
10
12
  checks: DoctorCheck[];
11
13
  warnings: number;
12
14
  errors: number;
13
15
  }
14
- declare function doctor(vaultPath?: string): Promise<DoctorReport>;
16
+ declare function doctor(options?: string | {
17
+ vaultPath?: string;
18
+ fix?: boolean;
19
+ }): Promise<DoctorReport>;
15
20
 
16
21
  export { type DoctorCheck, type DoctorReport, type DoctorStatus, doctor };
@@ -1,24 +1,26 @@
1
1
  import {
2
2
  doctor
3
- } from "../chunk-UEOUADMO.js";
3
+ } from "../chunk-YKTA5JOJ.js";
4
4
  import "../chunk-7ZRP733D.js";
5
5
  import "../chunk-4VQTUVH7.js";
6
6
  import "../chunk-J7ZWCI2C.js";
7
- import "../chunk-IEVLHNLU.js";
7
+ import "../chunk-LNJA2UGL.js";
8
+ import "../chunk-3NSBOUT3.js";
9
+ import "../chunk-62YTUT6J.js";
8
10
  import "../chunk-HRLWZGMA.js";
9
- import "../chunk-Q2J5YTUF.js";
10
- import "../chunk-AZYOKJYC.js";
11
- import "../chunk-KL4NAOMO.js";
12
- import "../chunk-FHFUXL6G.js";
13
- import "../chunk-MAKNAHAW.js";
14
11
  import "../chunk-ITPEXLHA.js";
12
+ import "../chunk-PAH27GSN.js";
13
+ import "../chunk-N2AXRYLC.js";
14
+ import "../chunk-LYHGEHXG.js";
15
+ import "../chunk-7766SIJP.js";
16
+ import "../chunk-3D6BCTP6.js";
17
+ import "../chunk-WGRQ6HDV.js";
18
+ import "../chunk-K234IDRJ.js";
15
19
  import "../chunk-2CDEETQN.js";
16
20
  import "../chunk-ZZA73MFY.js";
21
+ import "../chunk-QK3UCXWL.js";
17
22
  import "../chunk-Z2XBWN7A.js";
18
- import "../chunk-QWQ3TIKS.js";
19
- import "../chunk-MFAWT5O5.js";
20
- import "../chunk-7766SIJP.js";
21
- import "../chunk-QVMXF7FY.js";
23
+ import "../chunk-3RG5ZIWI.js";
22
24
  export {
23
25
  doctor
24
26
  };
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/commands/embed.ts
31
+ var embed_exports = {};
32
+ __export(embed_exports, {
33
+ embedCommand: () => embedCommand,
34
+ registerEmbedCommand: () => registerEmbedCommand
35
+ });
36
+ module.exports = __toCommonJS(embed_exports);
37
+
38
+ // src/lib/config.ts
39
+ var fs = __toESM(require("fs"), 1);
40
+ var path = __toESM(require("path"), 1);
41
+ function findNearestVaultPath(startPath = process.cwd()) {
42
+ let current = path.resolve(startPath);
43
+ while (true) {
44
+ if (fs.existsSync(path.join(current, ".clawvault.json"))) {
45
+ return current;
46
+ }
47
+ const parent = path.dirname(current);
48
+ if (parent === current) {
49
+ return null;
50
+ }
51
+ current = parent;
52
+ }
53
+ }
54
+ function resolveVaultPath(options = {}) {
55
+ if (options.explicitPath) {
56
+ return path.resolve(options.explicitPath);
57
+ }
58
+ if (process.env.CLAWVAULT_PATH) {
59
+ return path.resolve(process.env.CLAWVAULT_PATH);
60
+ }
61
+ const discovered = findNearestVaultPath(options.cwd ?? process.cwd());
62
+ if (discovered) {
63
+ return discovered;
64
+ }
65
+ throw new Error("No vault path found. Set CLAWVAULT_PATH, use --vault, or run inside a vault.");
66
+ }
67
+
68
+ // src/lib/search.ts
69
+ var import_child_process = require("child_process");
70
+ var QMD_INSTALL_COMMAND = "bun install -g github:tobi/qmd";
71
+ var QMD_NOT_INSTALLED_MESSAGE = `ClawVault requires qmd. Install: ${QMD_INSTALL_COMMAND}`;
72
+ var QMD_INDEX_ENV_VAR = "CLAWVAULT_QMD_INDEX";
73
+ var QmdUnavailableError = class extends Error {
74
+ constructor(message = QMD_NOT_INSTALLED_MESSAGE) {
75
+ super(message);
76
+ this.name = "QmdUnavailableError";
77
+ }
78
+ };
79
+ function resolveQmdIndexName(indexName) {
80
+ const explicit = indexName?.trim();
81
+ if (explicit) {
82
+ return explicit;
83
+ }
84
+ const fromEnv = process.env[QMD_INDEX_ENV_VAR]?.trim();
85
+ return fromEnv || void 0;
86
+ }
87
+ function withQmdIndexArgs(args, indexName) {
88
+ if (args.includes("--index")) {
89
+ return [...args];
90
+ }
91
+ const resolvedIndexName = resolveQmdIndexName(indexName);
92
+ if (!resolvedIndexName) {
93
+ return [...args];
94
+ }
95
+ return ["--index", resolvedIndexName, ...args];
96
+ }
97
+ function ensureQmdAvailable() {
98
+ if (!hasQmd()) {
99
+ throw new QmdUnavailableError();
100
+ }
101
+ }
102
+ function hasQmd() {
103
+ const result = (0, import_child_process.spawnSync)("qmd", ["--version"], { stdio: "ignore" });
104
+ return !result.error;
105
+ }
106
+ function qmdEmbed(collection, indexName) {
107
+ ensureQmdAvailable();
108
+ const args = ["embed"];
109
+ if (collection) {
110
+ args.push("-c", collection);
111
+ }
112
+ (0, import_child_process.execFileSync)("qmd", withQmdIndexArgs(args, indexName), { stdio: "inherit" });
113
+ }
114
+ var MONTH_NAMES = {
115
+ january: 1,
116
+ february: 2,
117
+ march: 3,
118
+ april: 4,
119
+ may: 5,
120
+ june: 6,
121
+ july: 7,
122
+ august: 8,
123
+ september: 9,
124
+ october: 10,
125
+ november: 11,
126
+ december: 12,
127
+ jan: 1,
128
+ feb: 2,
129
+ mar: 3,
130
+ apr: 4,
131
+ jun: 6,
132
+ jul: 7,
133
+ aug: 8,
134
+ sep: 9,
135
+ sept: 9,
136
+ oct: 10,
137
+ nov: 11,
138
+ dec: 12
139
+ };
140
+ var MONTH_RE_PART = Object.keys(MONTH_NAMES).join("|");
141
+ var DATE_MONTH_DAY_YEAR_RE = new RegExp(
142
+ `\\b(${MONTH_RE_PART})\\s+(\\d{1,2})(?:st|nd|rd|th)?,?\\s*(\\d{4})\\b`,
143
+ "gi"
144
+ );
145
+ var DATE_DAY_MONTH_YEAR_RE = new RegExp(
146
+ `\\b(\\d{1,2})(?:st|nd|rd|th)?\\s+(${MONTH_RE_PART}),?\\s*(\\d{4})\\b`,
147
+ "gi"
148
+ );
149
+ var DATE_MONTH_DAY_RE = new RegExp(
150
+ `\\b(${MONTH_RE_PART})\\s+(\\d{1,2})(?:st|nd|rd|th)?\\b`,
151
+ "gi"
152
+ );
153
+
154
+ // src/lib/vault-qmd-config.ts
155
+ var fs2 = __toESM(require("fs"), 1);
156
+ var path2 = __toESM(require("path"), 1);
157
+ var CONFIG_FILE = ".clawvault.json";
158
+ function readTrimmedString(value) {
159
+ if (typeof value !== "string") return void 0;
160
+ const trimmed = value.trim();
161
+ return trimmed.length > 0 ? trimmed : void 0;
162
+ }
163
+ function loadVaultQmdConfig(vaultPath) {
164
+ const resolvedVaultPath = path2.resolve(vaultPath);
165
+ const fallbackName = path2.basename(resolvedVaultPath);
166
+ const fallbackRoot = resolvedVaultPath;
167
+ const configPath = path2.join(resolvedVaultPath, CONFIG_FILE);
168
+ if (!fs2.existsSync(configPath)) {
169
+ return {
170
+ vaultPath: resolvedVaultPath,
171
+ qmdCollection: fallbackName,
172
+ qmdRoot: fallbackRoot
173
+ };
174
+ }
175
+ try {
176
+ const raw = JSON.parse(fs2.readFileSync(configPath, "utf-8"));
177
+ const configuredName = readTrimmedString(raw.name) ?? fallbackName;
178
+ const qmdCollection = readTrimmedString(raw.qmdCollection) ?? configuredName;
179
+ const rawRoot = readTrimmedString(raw.qmdRoot) ?? fallbackRoot;
180
+ const qmdRoot = path2.isAbsolute(rawRoot) ? path2.resolve(rawRoot) : path2.resolve(resolvedVaultPath, rawRoot);
181
+ return {
182
+ vaultPath: resolvedVaultPath,
183
+ qmdCollection,
184
+ qmdRoot
185
+ };
186
+ } catch {
187
+ return {
188
+ vaultPath: resolvedVaultPath,
189
+ qmdCollection: fallbackName,
190
+ qmdRoot: fallbackRoot
191
+ };
192
+ }
193
+ }
194
+
195
+ // src/commands/embed.ts
196
+ async function embedCommand(options = {}) {
197
+ if (!hasQmd()) {
198
+ throw new QmdUnavailableError();
199
+ }
200
+ const vaultPath = resolveVaultPath({ explicitPath: options.vaultPath });
201
+ const qmdConfig = loadVaultQmdConfig(vaultPath);
202
+ const startedAt = (/* @__PURE__ */ new Date()).toISOString();
203
+ if (!options.quiet) {
204
+ console.log(
205
+ `Embedding pending documents for collection "${qmdConfig.qmdCollection}" (root: ${qmdConfig.qmdRoot})...`
206
+ );
207
+ }
208
+ qmdEmbed(qmdConfig.qmdCollection);
209
+ const finishedAt = (/* @__PURE__ */ new Date()).toISOString();
210
+ if (!options.quiet) {
211
+ console.log(`\u2713 Embedding complete for "${qmdConfig.qmdCollection}"`);
212
+ }
213
+ return {
214
+ vaultPath,
215
+ qmdCollection: qmdConfig.qmdCollection,
216
+ qmdRoot: qmdConfig.qmdRoot,
217
+ startedAt,
218
+ finishedAt
219
+ };
220
+ }
221
+ function registerEmbedCommand(program) {
222
+ program.command("embed").description("Run qmd embedding for pending vault documents").option("-v, --vault <path>", "Vault path").action(async (rawOptions) => {
223
+ await embedCommand({
224
+ vaultPath: rawOptions.vault
225
+ });
226
+ });
227
+ }
228
+ // Annotate the CommonJS export names for ESM import in node:
229
+ 0 && (module.exports = {
230
+ embedCommand,
231
+ registerEmbedCommand
232
+ });
@@ -0,0 +1,17 @@
1
+ import { Command } from 'commander';
2
+
3
+ interface EmbedCommandOptions {
4
+ vaultPath?: string;
5
+ quiet?: boolean;
6
+ }
7
+ interface EmbedCommandResult {
8
+ vaultPath: string;
9
+ qmdCollection: string;
10
+ qmdRoot: string;
11
+ startedAt: string;
12
+ finishedAt: string;
13
+ }
14
+ declare function embedCommand(options?: EmbedCommandOptions): Promise<EmbedCommandResult>;
15
+ declare function registerEmbedCommand(program: Command): void;
16
+
17
+ export { type EmbedCommandOptions, type EmbedCommandResult, embedCommand, registerEmbedCommand };
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  embedCommand,
3
3
  registerEmbedCommand
4
- } from "../chunk-4QYGFWRM.js";
5
- import "../chunk-MAKNAHAW.js";
4
+ } from "../chunk-7R7O6STJ.js";
6
5
  import "../chunk-MXSSG3QU.js";
6
+ import "../chunk-K234IDRJ.js";
7
+ import "../chunk-QK3UCXWL.js";
8
+ import "../chunk-Z2XBWN7A.js";
9
+ import "../chunk-3RG5ZIWI.js";
7
10
  export {
8
11
  embedCommand,
9
12
  registerEmbedCommand
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/commands/entities.ts
31
+ var entities_exports = {};
32
+ __export(entities_exports, {
33
+ entitiesCommand: () => entitiesCommand
34
+ });
35
+ module.exports = __toCommonJS(entities_exports);
36
+
37
+ // src/lib/entity-index.ts
38
+ var fs = __toESM(require("fs"), 1);
39
+ var path = __toESM(require("path"), 1);
40
+ var import_gray_matter = __toESM(require("gray-matter"), 1);
41
+ function buildEntityIndex(vaultPath) {
42
+ const entries = /* @__PURE__ */ new Map();
43
+ const byPath = /* @__PURE__ */ new Map();
44
+ const entityFolders = ["people", "projects", "agents", "lessons", "decisions", "commitments"];
45
+ for (const folder of entityFolders) {
46
+ const folderPath = path.join(vaultPath, folder);
47
+ if (!fs.existsSync(folderPath)) continue;
48
+ const files = fs.readdirSync(folderPath).filter((f) => f.endsWith(".md"));
49
+ for (const file of files) {
50
+ const filePath = path.join(folderPath, file);
51
+ const content = fs.readFileSync(filePath, "utf-8");
52
+ const { data: frontmatter } = (0, import_gray_matter.default)(content);
53
+ const relativePath = `${folder}/${file.replace(".md", "")}`;
54
+ const baseName = file.replace(".md", "");
55
+ const aliases = [baseName];
56
+ if (frontmatter.title && frontmatter.title.toLowerCase() !== baseName.toLowerCase()) {
57
+ aliases.push(frontmatter.title);
58
+ }
59
+ if (Array.isArray(frontmatter.aliases)) {
60
+ aliases.push(...frontmatter.aliases);
61
+ }
62
+ for (const alias of aliases) {
63
+ const key = alias.toLowerCase();
64
+ if (!entries.has(key)) {
65
+ entries.set(key, relativePath);
66
+ }
67
+ }
68
+ byPath.set(relativePath, { path: relativePath, aliases });
69
+ }
70
+ }
71
+ return { entries, byPath };
72
+ }
73
+
74
+ // src/lib/config.ts
75
+ var fs2 = __toESM(require("fs"), 1);
76
+ var path2 = __toESM(require("path"), 1);
77
+ function findNearestVaultPath(startPath = process.cwd()) {
78
+ let current = path2.resolve(startPath);
79
+ while (true) {
80
+ if (fs2.existsSync(path2.join(current, ".clawvault.json"))) {
81
+ return current;
82
+ }
83
+ const parent = path2.dirname(current);
84
+ if (parent === current) {
85
+ return null;
86
+ }
87
+ current = parent;
88
+ }
89
+ }
90
+ function resolveVaultPath(options = {}) {
91
+ if (options.explicitPath) {
92
+ return path2.resolve(options.explicitPath);
93
+ }
94
+ if (process.env.CLAWVAULT_PATH) {
95
+ return path2.resolve(process.env.CLAWVAULT_PATH);
96
+ }
97
+ const discovered = findNearestVaultPath(options.cwd ?? process.cwd());
98
+ if (discovered) {
99
+ return discovered;
100
+ }
101
+ throw new Error("No vault path found. Set CLAWVAULT_PATH, use --vault, or run inside a vault.");
102
+ }
103
+
104
+ // src/commands/entities.ts
105
+ async function entitiesCommand(options) {
106
+ const vaultPath = resolveVaultPath({ explicitPath: options.vaultPath });
107
+ const index = buildEntityIndex(vaultPath);
108
+ if (options.json) {
109
+ const output = {};
110
+ for (const [path3, entry] of index.byPath) {
111
+ output[path3] = entry.aliases;
112
+ }
113
+ console.log(JSON.stringify(output, null, 2));
114
+ return;
115
+ }
116
+ const byFolder = {};
117
+ for (const [path3, entry] of index.byPath) {
118
+ const folder = path3.split("/")[0];
119
+ if (!byFolder[folder]) byFolder[folder] = [];
120
+ byFolder[folder].push({ path: path3, aliases: entry.aliases });
121
+ }
122
+ console.log("\u{1F4DA} Linkable Entities\n");
123
+ for (const [folder, entities] of Object.entries(byFolder)) {
124
+ console.log(`## ${folder}/`);
125
+ for (const entity of entities) {
126
+ const name = entity.path.split("/")[1];
127
+ const otherAliases = entity.aliases.filter((a) => a.toLowerCase() !== name.toLowerCase());
128
+ if (otherAliases.length > 0) {
129
+ console.log(` - ${name} (${otherAliases.join(", ")})`);
130
+ } else {
131
+ console.log(` - ${name}`);
132
+ }
133
+ }
134
+ console.log();
135
+ }
136
+ console.log(`Total: ${index.byPath.size} entities, ${index.entries.size} linkable aliases`);
137
+ }
138
+ // Annotate the CommonJS export names for ESM import in node:
139
+ 0 && (module.exports = {
140
+ entitiesCommand
141
+ });
@@ -0,0 +1,7 @@
1
+ interface EntitiesOptions {
2
+ json?: boolean;
3
+ vaultPath?: string;
4
+ }
5
+ declare function entitiesCommand(options: EntitiesOptions): Promise<void>;
6
+
7
+ export { entitiesCommand };
@@ -4,6 +4,7 @@ import {
4
4
  import {
5
5
  resolveVaultPath
6
6
  } from "../chunk-MXSSG3QU.js";
7
+ import "../chunk-3RG5ZIWI.js";
7
8
 
8
9
  // src/commands/entities.ts
9
10
  async function entitiesCommand(options) {