clawvault 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin/register-workgraph-commands.js +1 -918
- package/dist/{chunk-P62WHA27.js → chunk-42MXU7A6.js} +47 -58
- package/dist/{chunk-23YDQ3QU.js → chunk-4ITRXIVT.js} +3 -3
- package/dist/{chunk-7YZWHM36.js → chunk-4VQTUVH7.js} +26 -52
- package/dist/{chunk-EK6S23ZB.js → chunk-5PJ4STIC.js} +5 -9
- package/dist/{chunk-4PY655YM.js → chunk-AZYOKJYC.js} +1 -13
- package/dist/{chunk-PBACDKKP.js → chunk-ECRZL5XR.js} +6 -22
- package/dist/{chunk-VSL7KY3M.js → chunk-ERNE2FZ5.js} +3 -3
- package/dist/{chunk-QSHD36LH.js → chunk-FAKNOB7Y.js} +1 -1
- package/dist/{chunk-QVEERJSP.js → chunk-HR4KN6S2.js} +3 -3
- package/dist/{chunk-QSRRMEYM.js → chunk-IIOU45CK.js} +1 -1
- package/dist/{chunk-33VSQP4J.js → chunk-IJBFGPCS.js} +5 -9
- package/dist/{chunk-4BQTQMJP.js → chunk-K7PNYS45.js} +1 -1
- package/dist/{chunk-ESVS6K2B.js → chunk-MNPUYCHQ.js} +1 -1
- package/dist/{chunk-MM6QGW3P.js → chunk-NTOPJI7W.js} +1 -1
- package/dist/{chunk-MW5C6ZQA.js → chunk-P5EPF6MB.js} +13 -110
- package/dist/{chunk-U4O6C46S.js → chunk-PG56HX5T.js} +1 -1
- package/dist/{chunk-ESFLMDRB.js → chunk-PI4WMLMG.js} +3 -3
- package/dist/{chunk-BUEW6IIK.js → chunk-QMHPQYUV.js} +2 -3
- package/dist/{chunk-GAOWA7GR.js → chunk-QPDDIHXE.js} +10 -10
- package/dist/{chunk-SLXOR3CC.js → chunk-S5OJEGFG.js} +1 -1
- package/dist/{chunk-2ZDO52B4.js → chunk-U67V476Y.js} +1 -18
- package/dist/{chunk-STCQGCEQ.js → chunk-UCQAOZHW.js} +2 -2
- package/dist/chunk-WIOLLGAD.js +190 -0
- package/dist/{chunk-ZN54U2OZ.js → chunk-WJVWINEM.js} +4 -53
- package/dist/{chunk-77Q5CSPJ.js → chunk-Y3TIJEBP.js} +3 -92
- package/dist/{chunk-CLJTREDS.js → chunk-YDWHS4LJ.js} +9 -29
- package/dist/{chunk-W4SPAEE7.js → chunk-YNIPYN4F.js} +2 -2
- package/dist/{chunk-NCKFNBHJ.js → chunk-YXQCA6B7.js} +2 -33
- package/dist/{chunk-33DOSHTA.js → chunk-ZZA73MFY.js} +36 -176
- package/dist/cli/index.js +17 -23
- package/dist/commands/archive.js +1 -1
- package/dist/commands/backlog.js +1 -1
- package/dist/commands/blocked.js +1 -1
- package/dist/commands/canvas.js +2 -2
- package/dist/commands/checkpoint.js +1 -1
- package/dist/commands/compat.js +1 -1
- package/dist/commands/context.js +6 -6
- package/dist/commands/doctor.js +12 -12
- package/dist/commands/embed.js +4 -4
- package/dist/commands/entities.js +1 -1
- package/dist/commands/graph.js +3 -3
- package/dist/commands/inject.js +4 -4
- package/dist/commands/kanban.js +1 -1
- package/dist/commands/link.js +4 -4
- package/dist/commands/migrate-observations.js +1 -1
- package/dist/commands/observe.js +7 -7
- package/dist/commands/project.js +2 -2
- package/dist/commands/rebuild-embeddings.js +2 -2
- package/dist/commands/rebuild.js +5 -5
- package/dist/commands/recover.js +1 -1
- package/dist/commands/reflect.js +4 -4
- package/dist/commands/repair-session.js +1 -1
- package/dist/commands/replay.js +6 -6
- package/dist/commands/session-recap.js +1 -1
- package/dist/commands/setup.js +3 -3
- package/dist/commands/shell-init.js +1 -1
- package/dist/commands/sleep.js +10 -10
- package/dist/commands/status.js +13 -25
- package/dist/commands/sync-bd.js +1 -1
- package/dist/commands/tailscale.js +1 -1
- package/dist/commands/task.js +1 -1
- package/dist/commands/template.js +1 -1
- package/dist/commands/wake.js +5 -5
- package/dist/index.d.ts +0 -7
- package/dist/index.js +32 -38
- package/dist/lib/auto-linker.js +2 -2
- package/dist/lib/canvas-layout.js +1 -1
- package/dist/lib/config.js +1 -1
- package/dist/lib/entity-index.js +1 -1
- package/dist/lib/project-utils.js +2 -2
- package/dist/lib/session-repair.js +1 -1
- package/dist/lib/session-utils.js +1 -1
- package/dist/lib/tailscale.js +1 -1
- package/dist/lib/task-utils.js +1 -1
- package/dist/lib/template-engine.js +1 -1
- package/dist/lib/webdav.js +1 -1
- package/dist/plugin/index.d.ts +352 -0
- package/dist/plugin/index.js +4264 -0
- package/dist/workgraph/index.js +5 -5
- package/dist/workgraph/ledger.js +2 -2
- package/dist/workgraph/registry.js +2 -2
- package/dist/workgraph/store.js +4 -4
- package/dist/workgraph/thread.js +5 -5
- package/dist/workgraph/types.js +1 -1
- package/hooks/clawvault/HOOK.md +3 -3
- package/hooks/clawvault/handler.js +0 -2
- package/openclaw.plugin.json +201 -23
- package/package.json +7 -10
- package/dist/chunk-6FH3IULF.js +0 -352
- package/dist/chunk-GGA32J2R.js +0 -784
- package/dist/commands/workgraph.d.ts +0 -124
- package/dist/commands/workgraph.js +0 -38
- package/dist/onnxruntime_binding-5QEF3SUC.node +0 -0
- package/dist/onnxruntime_binding-BKPKNEGC.node +0 -0
- package/dist/onnxruntime_binding-FMOXGIUT.node +0 -0
- package/dist/onnxruntime_binding-OI2KMXC5.node +0 -0
- package/dist/onnxruntime_binding-UX44MLAZ.node +0 -0
- package/dist/onnxruntime_binding-Y2W7N7WY.node +0 -0
- package/dist/openclaw-plugin.d.ts +0 -8
- package/dist/openclaw-plugin.js +0 -14
- package/dist/transformers.node-A2ZRORSQ.js +0 -46775
|
@@ -14,7 +14,7 @@ function findProtectedRanges(content) {
|
|
|
14
14
|
while ((match = codeBlockRegex.exec(content)) !== null) {
|
|
15
15
|
ranges.push({ start: match.index, end: match.index + match[0].length });
|
|
16
16
|
}
|
|
17
|
-
const inlineCodeRegex =
|
|
17
|
+
const inlineCodeRegex = /`[^`]+`/g;
|
|
18
18
|
while ((match = inlineCodeRegex.exec(content)) !== null) {
|
|
19
19
|
ranges.push({ start: match.index, end: match.index + match[0].length });
|
|
20
20
|
}
|
|
@@ -26,51 +26,10 @@ function findProtectedRanges(content) {
|
|
|
26
26
|
while ((match = urlRegex.exec(content)) !== null) {
|
|
27
27
|
ranges.push({ start: match.index, end: match.index + match[0].length });
|
|
28
28
|
}
|
|
29
|
-
const filePathRegex = /(?:^|[\s([{"'])((?:~|\/)[^\s`<>\])}"']+|[A-Za-z]:\\[^\s`<>\])}"']+)/g;
|
|
30
|
-
while ((match = filePathRegex.exec(content)) !== null) {
|
|
31
|
-
const fullMatch = match[0];
|
|
32
|
-
const pathValue = match[1];
|
|
33
|
-
const start = match.index + fullMatch.indexOf(pathValue);
|
|
34
|
-
ranges.push({ start, end: start + pathValue.length });
|
|
35
|
-
}
|
|
36
29
|
return ranges;
|
|
37
30
|
}
|
|
38
|
-
function
|
|
39
|
-
return ranges.some((
|
|
40
|
-
}
|
|
41
|
-
function createAliasRegex(alias) {
|
|
42
|
-
const escapedAlias = alias.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
43
|
-
return new RegExp(`\\b${escapedAlias}\\b`, "gi");
|
|
44
|
-
}
|
|
45
|
-
function formatWikiLink(path, originalText) {
|
|
46
|
-
return originalText.toLowerCase() === path.split("/").pop()?.toLowerCase() ? `[[${path}]]` : `[[${path}|${originalText}]]`;
|
|
47
|
-
}
|
|
48
|
-
function planLinks(content, index, protectedRanges) {
|
|
49
|
-
const sortedAliases = getSortedAliases(index);
|
|
50
|
-
const linkedEntities = /* @__PURE__ */ new Set();
|
|
51
|
-
const claimedRanges = [];
|
|
52
|
-
const plannedLinks = [];
|
|
53
|
-
for (const { alias, path } of sortedAliases) {
|
|
54
|
-
if (linkedEntities.has(path)) continue;
|
|
55
|
-
const regex = createAliasRegex(alias);
|
|
56
|
-
let match;
|
|
57
|
-
while ((match = regex.exec(content)) !== null) {
|
|
58
|
-
const start = match.index;
|
|
59
|
-
const end = start + match[0].length;
|
|
60
|
-
if (isProtectedRange(start, end, protectedRanges)) continue;
|
|
61
|
-
if (isProtectedRange(start, end, claimedRanges)) continue;
|
|
62
|
-
plannedLinks.push({
|
|
63
|
-
start,
|
|
64
|
-
end,
|
|
65
|
-
originalText: match[0],
|
|
66
|
-
path
|
|
67
|
-
});
|
|
68
|
-
claimedRanges.push({ start, end });
|
|
69
|
-
linkedEntities.add(path);
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return plannedLinks;
|
|
31
|
+
function isProtected(pos, ranges) {
|
|
32
|
+
return ranges.some((r) => pos >= r.start && pos < r.end);
|
|
74
33
|
}
|
|
75
34
|
function createLineLookup(content) {
|
|
76
35
|
const lines = content.split("\n");
|
|
@@ -89,24 +48,56 @@ function createLineLookup(content) {
|
|
|
89
48
|
}
|
|
90
49
|
function autoLink(content, index) {
|
|
91
50
|
const protectedRanges = findProtectedRanges(content);
|
|
92
|
-
const
|
|
51
|
+
const sortedAliases = getSortedAliases(index);
|
|
52
|
+
const linkedEntities = /* @__PURE__ */ new Set();
|
|
93
53
|
let result = content;
|
|
94
|
-
|
|
95
|
-
for (const
|
|
96
|
-
|
|
97
|
-
|
|
54
|
+
let offset = 0;
|
|
55
|
+
for (const { alias, path } of sortedAliases) {
|
|
56
|
+
if (linkedEntities.has(path)) continue;
|
|
57
|
+
const escapedAlias = alias.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
58
|
+
const regex = new RegExp(`\\b${escapedAlias}\\b`, "gi");
|
|
59
|
+
let match;
|
|
60
|
+
while ((match = regex.exec(content)) !== null) {
|
|
61
|
+
const originalPos = match.index;
|
|
62
|
+
const adjustedPos = originalPos + offset;
|
|
63
|
+
if (isProtected(originalPos, protectedRanges)) continue;
|
|
64
|
+
const beforeMatch = result.substring(0, adjustedPos);
|
|
65
|
+
const openBrackets = (beforeMatch.match(/\[\[/g) || []).length;
|
|
66
|
+
const closeBrackets = (beforeMatch.match(/\]\]/g) || []).length;
|
|
67
|
+
if (openBrackets > closeBrackets) continue;
|
|
68
|
+
const originalText = match[0];
|
|
69
|
+
const replacement = originalText.toLowerCase() === path.split("/").pop()?.toLowerCase() ? `[[${path}]]` : `[[${path}|${originalText}]]`;
|
|
70
|
+
result = result.substring(0, adjustedPos) + replacement + result.substring(adjustedPos + originalText.length);
|
|
71
|
+
offset += replacement.length - originalText.length;
|
|
72
|
+
linkedEntities.add(path);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
98
75
|
}
|
|
99
76
|
return result;
|
|
100
77
|
}
|
|
101
78
|
function dryRunLink(content, index) {
|
|
102
79
|
const protectedRanges = findProtectedRanges(content);
|
|
103
|
-
const
|
|
80
|
+
const sortedAliases = getSortedAliases(index);
|
|
81
|
+
const linkedEntities = /* @__PURE__ */ new Set();
|
|
82
|
+
const matches = [];
|
|
104
83
|
const getLineNumber = createLineLookup(content);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
84
|
+
for (const { alias, path } of sortedAliases) {
|
|
85
|
+
if (linkedEntities.has(path)) continue;
|
|
86
|
+
const escapedAlias = alias.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
87
|
+
const regex = new RegExp(`\\b${escapedAlias}\\b`, "gi");
|
|
88
|
+
let match;
|
|
89
|
+
while ((match = regex.exec(content)) !== null) {
|
|
90
|
+
if (isProtected(match.index, protectedRanges)) continue;
|
|
91
|
+
matches.push({
|
|
92
|
+
alias: match[0],
|
|
93
|
+
path,
|
|
94
|
+
line: getLineNumber(match.index)
|
|
95
|
+
});
|
|
96
|
+
linkedEntities.add(path);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return matches;
|
|
110
101
|
}
|
|
111
102
|
function findUnlinkedMentions(content, index) {
|
|
112
103
|
const protectedRanges = findProtectedRanges(content);
|
|
@@ -120,9 +111,7 @@ function findUnlinkedMentions(content, index) {
|
|
|
120
111
|
const regex = new RegExp(`\\b${escapedAlias}\\b`, "gi");
|
|
121
112
|
let match;
|
|
122
113
|
while ((match = regex.exec(content)) !== null) {
|
|
123
|
-
|
|
124
|
-
const end = start + match[0].length;
|
|
125
|
-
if (isProtectedRange(start, end, protectedRanges)) continue;
|
|
114
|
+
if (isProtected(match.index, protectedRanges)) continue;
|
|
126
115
|
matches.push({
|
|
127
116
|
alias: match[0],
|
|
128
117
|
path,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseSessionFile
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-P5EPF6MB.js";
|
|
4
4
|
import {
|
|
5
5
|
observeActiveSessions
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PI4WMLMG.js";
|
|
7
7
|
import {
|
|
8
8
|
Observer
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Y3TIJEBP.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveVaultPath
|
|
12
12
|
} from "./chunk-GNJL4YGR.js";
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildEntityIndex
|
|
3
3
|
} from "./chunk-J7ZWCI2C.js";
|
|
4
|
-
import {
|
|
5
|
-
extractRawWikiLinks,
|
|
6
|
-
normalizeWikiLinkTarget
|
|
7
|
-
} from "./chunk-33DOSHTA.js";
|
|
8
4
|
|
|
9
5
|
// src/lib/backlinks.ts
|
|
10
6
|
import * as fs from "fs";
|
|
11
7
|
import * as path from "path";
|
|
12
8
|
var CLAWVAULT_DIR = ".clawvault";
|
|
13
9
|
var BACKLINKS_FILE = "backlinks.json";
|
|
10
|
+
var WIKI_LINK_REGEX = /\[\[([^\]]+)\]\]/g;
|
|
14
11
|
function ensureClawvaultDir(vaultPath) {
|
|
15
12
|
const dir = path.join(vaultPath, CLAWVAULT_DIR);
|
|
16
13
|
if (!fs.existsSync(dir)) {
|
|
@@ -23,47 +20,29 @@ function toVaultId(vaultPath, filePath) {
|
|
|
23
20
|
return relative2.split(path.sep).join("/");
|
|
24
21
|
}
|
|
25
22
|
function normalizeLinkTarget(raw) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!normalized) return "";
|
|
31
|
-
const resolved = path.posix.normalize(normalized).replace(/^\/+/, "");
|
|
32
|
-
if (!resolved || resolved === "." || resolved.startsWith("../")) {
|
|
33
|
-
return "";
|
|
23
|
+
let target = raw.trim();
|
|
24
|
+
if (!target) return "";
|
|
25
|
+
if (target.startsWith("[[") && target.endsWith("]]")) {
|
|
26
|
+
target = target.slice(2, -2);
|
|
34
27
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const candidates = [];
|
|
39
|
-
const sourceDir = path.posix.dirname(sourceId);
|
|
40
|
-
const hasSourceDir = sourceDir !== ".";
|
|
41
|
-
const isRelativeTarget = target.startsWith("./") || target.startsWith("../");
|
|
42
|
-
const addCandidate = (candidate) => {
|
|
43
|
-
const normalized = normalizeLookupCandidate(candidate);
|
|
44
|
-
if (!normalized || candidates.includes(normalized)) return;
|
|
45
|
-
candidates.push(normalized);
|
|
46
|
-
};
|
|
47
|
-
if (isRelativeTarget) {
|
|
48
|
-
if (hasSourceDir) {
|
|
49
|
-
addCandidate(path.posix.join(sourceDir, target));
|
|
50
|
-
} else {
|
|
51
|
-
addCandidate(target);
|
|
52
|
-
}
|
|
53
|
-
if (target.startsWith("./")) {
|
|
54
|
-
addCandidate(target.slice(2));
|
|
55
|
-
}
|
|
56
|
-
return candidates;
|
|
28
|
+
const pipeIndex = target.indexOf("|");
|
|
29
|
+
if (pipeIndex !== -1) {
|
|
30
|
+
target = target.slice(0, pipeIndex);
|
|
57
31
|
}
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
32
|
+
if (target.startsWith("#")) return "";
|
|
33
|
+
const hashIndex = target.indexOf("#");
|
|
34
|
+
if (hashIndex !== -1) {
|
|
35
|
+
target = target.slice(0, hashIndex);
|
|
36
|
+
}
|
|
37
|
+
target = target.trim();
|
|
38
|
+
if (!target) return "";
|
|
39
|
+
if (target.endsWith(".md")) {
|
|
40
|
+
target = target.slice(0, -3);
|
|
41
|
+
}
|
|
42
|
+
if (target.startsWith("/")) {
|
|
43
|
+
target = target.slice(1);
|
|
64
44
|
}
|
|
65
|
-
|
|
66
|
-
return candidates;
|
|
45
|
+
return target.replace(/\\/g, "/");
|
|
67
46
|
}
|
|
68
47
|
function listMarkdownFiles(vaultPath) {
|
|
69
48
|
const files = [];
|
|
@@ -96,16 +75,11 @@ function buildKnownIds(vaultPath, files) {
|
|
|
96
75
|
}
|
|
97
76
|
return { ids, idsLower };
|
|
98
77
|
}
|
|
99
|
-
function resolveTarget(target,
|
|
78
|
+
function resolveTarget(target, known, entityIndex) {
|
|
100
79
|
if (!target) return null;
|
|
101
|
-
|
|
102
|
-
if (known.ids.has(candidate)) return candidate;
|
|
103
|
-
const lowerCandidate = candidate.toLowerCase();
|
|
104
|
-
if (known.idsLower.has(lowerCandidate)) {
|
|
105
|
-
return known.idsLower.get(lowerCandidate);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
80
|
+
if (known.ids.has(target)) return target;
|
|
108
81
|
const lower = target.toLowerCase();
|
|
82
|
+
if (known.idsLower.has(lower)) return known.idsLower.get(lower);
|
|
109
83
|
if (entityIndex?.entries.has(lower)) return entityIndex.entries.get(lower);
|
|
110
84
|
return null;
|
|
111
85
|
}
|
|
@@ -119,12 +93,12 @@ function scanVaultLinks(vaultPath, options = {}) {
|
|
|
119
93
|
for (const file of files) {
|
|
120
94
|
const sourceId = toVaultId(vaultPath, file);
|
|
121
95
|
const content = fs.readFileSync(file, "utf-8");
|
|
122
|
-
const matches =
|
|
96
|
+
const matches = content.match(WIKI_LINK_REGEX) || [];
|
|
123
97
|
linkCount += matches.length;
|
|
124
98
|
for (const match of matches) {
|
|
125
99
|
const target = normalizeLinkTarget(match);
|
|
126
100
|
if (!target) continue;
|
|
127
|
-
const resolved = resolveTarget(target,
|
|
101
|
+
const resolved = resolveTarget(target, known, entityIndex);
|
|
128
102
|
if (!resolved) {
|
|
129
103
|
orphans.push({ source: sourceId, target });
|
|
130
104
|
continue;
|
|
@@ -165,18 +165,14 @@ function execQmd(args, indexName) {
|
|
|
165
165
|
const result = execFileSync("qmd", finalArgs, {
|
|
166
166
|
encoding: "utf-8",
|
|
167
167
|
stdio: ["ignore", "pipe", "pipe"],
|
|
168
|
-
maxBuffer: 10 * 1024 * 1024
|
|
168
|
+
maxBuffer: 10 * 1024 * 1024
|
|
169
169
|
// 10MB
|
|
170
|
-
shell: process.platform === "win32"
|
|
171
170
|
});
|
|
172
171
|
return parseQmdOutput(result);
|
|
173
172
|
} catch (err) {
|
|
174
173
|
if (err?.code === "ENOENT") {
|
|
175
174
|
throw new QmdUnavailableError("NOT_INSTALLED");
|
|
176
175
|
}
|
|
177
|
-
if (err?.status === 1 && err?.stdout) {
|
|
178
|
-
return parseQmdOutput(err.stdout);
|
|
179
|
-
}
|
|
180
176
|
const output = [err?.stdout, err?.stderr].filter(Boolean).join("\n");
|
|
181
177
|
const detectedError = detectQmdError(output, finalArgs);
|
|
182
178
|
if (detectedError) {
|
|
@@ -196,8 +192,8 @@ function execQmd(args, indexName) {
|
|
|
196
192
|
}
|
|
197
193
|
}
|
|
198
194
|
function hasQmd() {
|
|
199
|
-
const result = spawnSync("qmd", ["--version"], { stdio: "ignore"
|
|
200
|
-
return !result.error
|
|
195
|
+
const result = spawnSync("qmd", ["--version"], { stdio: "ignore" });
|
|
196
|
+
return !result.error;
|
|
201
197
|
}
|
|
202
198
|
function qmdUpdate(collection, indexName) {
|
|
203
199
|
ensureQmdAvailable();
|
|
@@ -205,7 +201,7 @@ function qmdUpdate(collection, indexName) {
|
|
|
205
201
|
if (collection) {
|
|
206
202
|
args.push("-c", collection);
|
|
207
203
|
}
|
|
208
|
-
execFileSync("qmd", withQmdIndexArgs(args, indexName), { stdio: "inherit"
|
|
204
|
+
execFileSync("qmd", withQmdIndexArgs(args, indexName), { stdio: "inherit" });
|
|
209
205
|
}
|
|
210
206
|
function qmdEmbed(collection, indexName) {
|
|
211
207
|
ensureQmdAvailable();
|
|
@@ -213,7 +209,7 @@ function qmdEmbed(collection, indexName) {
|
|
|
213
209
|
if (collection) {
|
|
214
210
|
args.push("-c", collection);
|
|
215
211
|
}
|
|
216
|
-
execFileSync("qmd", withQmdIndexArgs(args, indexName), { stdio: "inherit"
|
|
212
|
+
execFileSync("qmd", withQmdIndexArgs(args, indexName), { stdio: "inherit" });
|
|
217
213
|
}
|
|
218
214
|
var SearchEngine = class {
|
|
219
215
|
documents = /* @__PURE__ */ new Map();
|
|
@@ -18,18 +18,6 @@ function extractTitle(content) {
|
|
|
18
18
|
function isDateSlug(slug) {
|
|
19
19
|
return /^\d{4}-\d{2}-\d{2}$/.test(slug);
|
|
20
20
|
}
|
|
21
|
-
function buildProjectSlug(title) {
|
|
22
|
-
const direct = slugify(title);
|
|
23
|
-
if (direct) {
|
|
24
|
-
return direct;
|
|
25
|
-
}
|
|
26
|
-
let hash = 0;
|
|
27
|
-
for (const char of title) {
|
|
28
|
-
hash = (hash << 5) - hash + char.charCodeAt(0);
|
|
29
|
-
hash |= 0;
|
|
30
|
-
}
|
|
31
|
-
return `project-${Math.abs(hash).toString(36)}`;
|
|
32
|
-
}
|
|
33
21
|
function normalizeStringArray(value) {
|
|
34
22
|
return value.map((item) => item.trim()).filter(Boolean);
|
|
35
23
|
}
|
|
@@ -254,7 +242,7 @@ function readProject(vaultPath, slug) {
|
|
|
254
242
|
}
|
|
255
243
|
function createProject(vaultPath, title, options = {}) {
|
|
256
244
|
ensureProjectsDir(vaultPath);
|
|
257
|
-
const slug =
|
|
245
|
+
const slug = slugify(title);
|
|
258
246
|
const projectPath = getProjectPath(vaultPath, slug);
|
|
259
247
|
if (fs.existsSync(projectPath)) {
|
|
260
248
|
throw new Error(`Project already exists: ${slug}`);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
loadVaultQmdConfig
|
|
3
|
-
|
|
4
|
-
runCrashSafeQmdEmbed
|
|
5
|
-
} from "./chunk-6FH3IULF.js";
|
|
2
|
+
loadVaultQmdConfig
|
|
3
|
+
} from "./chunk-WIOLLGAD.js";
|
|
6
4
|
import {
|
|
7
5
|
QmdUnavailableError,
|
|
8
|
-
hasQmd
|
|
9
|
-
|
|
6
|
+
hasQmd,
|
|
7
|
+
qmdEmbed
|
|
8
|
+
} from "./chunk-5PJ4STIC.js";
|
|
10
9
|
import {
|
|
11
10
|
resolveVaultPath
|
|
12
11
|
} from "./chunk-GNJL4YGR.js";
|
|
@@ -19,27 +18,12 @@ async function embedCommand(options = {}) {
|
|
|
19
18
|
const vaultPath = resolveVaultPath({ explicitPath: options.vaultPath });
|
|
20
19
|
const qmdConfig = loadVaultQmdConfig(vaultPath);
|
|
21
20
|
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
22
|
-
const recovery = recoverQmdEmbeddingIfNeeded({
|
|
23
|
-
vaultPath,
|
|
24
|
-
collection: qmdConfig.qmdCollection,
|
|
25
|
-
rootPath: qmdConfig.qmdRoot,
|
|
26
|
-
mode: "marker-or-empty",
|
|
27
|
-
onLog: options.quiet ? void 0 : (message) => console.log(message)
|
|
28
|
-
});
|
|
29
|
-
if (!options.quiet && recovery.recovered) {
|
|
30
|
-
const reasonLabel = recovery.reason === "interrupted_wal" ? "interrupted run" : "empty vector state";
|
|
31
|
-
console.log(`\u2713 Automatic qmd recovery completed (${reasonLabel}).`);
|
|
32
|
-
}
|
|
33
21
|
if (!options.quiet) {
|
|
34
22
|
console.log(
|
|
35
23
|
`Embedding pending documents for collection "${qmdConfig.qmdCollection}" (root: ${qmdConfig.qmdRoot})...`
|
|
36
24
|
);
|
|
37
25
|
}
|
|
38
|
-
|
|
39
|
-
vaultPath,
|
|
40
|
-
collection: qmdConfig.qmdCollection,
|
|
41
|
-
rootPath: qmdConfig.qmdRoot
|
|
42
|
-
});
|
|
26
|
+
qmdEmbed(qmdConfig.qmdCollection);
|
|
43
27
|
const finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
44
28
|
if (!options.quiet) {
|
|
45
29
|
console.log(`\u2713 Embedding complete for "${qmdConfig.qmdCollection}"`);
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
create,
|
|
3
3
|
read,
|
|
4
4
|
update
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HR4KN6S2.js";
|
|
6
6
|
import {
|
|
7
7
|
append,
|
|
8
8
|
currentOwner
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-K7PNYS45.js";
|
|
10
10
|
import {
|
|
11
11
|
THREAD_STATUS_TRANSITIONS
|
|
12
12
|
} from "./chunk-WMGIIABP.js";
|
|
13
13
|
import {
|
|
14
14
|
__export
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-U67V476Y.js";
|
|
16
16
|
|
|
17
17
|
// src/workgraph/thread.ts
|
|
18
18
|
var thread_exports = {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
append
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-K7PNYS45.js";
|
|
4
4
|
import {
|
|
5
5
|
getType,
|
|
6
6
|
loadRegistry
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NTOPJI7W.js";
|
|
8
8
|
import {
|
|
9
9
|
__export
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-U67V476Y.js";
|
|
11
11
|
|
|
12
12
|
// src/workgraph/store.ts
|
|
13
13
|
var store_exports = {};
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registerTailscaleCommands
|
|
3
3
|
} from "./chunk-Y6VJKXGL.js";
|
|
4
|
-
import {
|
|
5
|
-
registerWorkgraphCommands
|
|
6
|
-
} from "./chunk-GGA32J2R.js";
|
|
7
4
|
import {
|
|
8
5
|
registerObserveCommand
|
|
9
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4ITRXIVT.js";
|
|
10
7
|
import {
|
|
11
8
|
registerReflectCommand
|
|
12
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-S5OJEGFG.js";
|
|
13
10
|
import {
|
|
14
11
|
registerContextCommand
|
|
15
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WJVWINEM.js";
|
|
16
13
|
import {
|
|
17
14
|
registerEmbedCommand
|
|
18
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ECRZL5XR.js";
|
|
19
16
|
import {
|
|
20
17
|
registerInjectCommand
|
|
21
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-YNIPYN4F.js";
|
|
22
19
|
|
|
23
20
|
// src/cli/index.ts
|
|
24
21
|
function registerCliCommands(program) {
|
|
@@ -28,7 +25,6 @@ function registerCliCommands(program) {
|
|
|
28
25
|
registerReflectCommand(program);
|
|
29
26
|
registerEmbedCommand(program);
|
|
30
27
|
registerTailscaleCommands(program);
|
|
31
|
-
registerWorkgraphCommands(program);
|
|
32
28
|
return program;
|
|
33
29
|
}
|
|
34
30
|
|