clawvault 1.11.2 → 2.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.
- package/README.md +135 -1
- package/bin/clawvault.js +51 -1252
- package/bin/command-registration.test.js +148 -0
- package/bin/command-runtime.js +42 -0
- package/bin/command-runtime.test.js +102 -0
- package/bin/help-contract.test.js +23 -0
- package/bin/register-core-commands.js +139 -0
- package/bin/register-maintenance-commands.js +137 -0
- package/bin/register-query-commands.js +225 -0
- package/bin/register-resilience-commands.js +147 -0
- package/bin/register-session-lifecycle-commands.js +204 -0
- package/bin/register-template-commands.js +72 -0
- package/bin/register-vault-operations-commands.js +295 -0
- package/bin/test-helpers/cli-command-fixtures.js +94 -0
- package/dashboard/lib/graph-diff.js +3 -1
- package/dashboard/lib/graph-diff.test.js +19 -0
- package/dashboard/lib/vault-parser.js +330 -26
- package/dashboard/lib/vault-parser.test.js +191 -11
- package/dashboard/public/app.js +22 -9
- package/dist/chunk-MXSSG3QU.js +42 -0
- package/dist/chunk-O5V7SD5C.js +398 -0
- package/dist/chunk-PAYUH64O.js +284 -0
- package/dist/{chunk-3HFB7EMU.js → chunk-QFBKWDYR.js} +12 -0
- package/dist/{chunk-UBRYOIII.js → chunk-TBVI4N53.js} +210 -21
- package/dist/chunk-TXO34J3O.js +56 -0
- package/dist/commands/compat.d.ts +28 -0
- package/dist/commands/compat.js +10 -0
- package/dist/commands/context.d.ts +2 -33
- package/dist/commands/context.js +3 -2
- package/dist/commands/doctor.js +61 -3
- package/dist/commands/entities.d.ts +1 -0
- package/dist/commands/entities.js +4 -4
- package/dist/commands/graph.d.ts +21 -0
- package/dist/commands/graph.js +10 -0
- package/dist/commands/link.d.ts +1 -0
- package/dist/commands/link.js +14 -5
- package/dist/commands/sleep.js +7 -6
- package/dist/commands/status.d.ts +6 -0
- package/dist/commands/status.js +63 -3
- package/dist/commands/wake.js +5 -4
- package/dist/context-COo8oq1k.d.ts +45 -0
- package/dist/index.d.ts +63 -2
- package/dist/index.js +53 -15
- package/dist/lib/config.d.ts +6 -1
- package/dist/lib/config.js +7 -3
- package/hooks/clawvault/HOOK.md +6 -1
- package/hooks/clawvault/handler.js +44 -3
- package/hooks/clawvault/handler.test.js +161 -0
- package/package.json +34 -2
- package/dashboard/public/graph.js +0 -376
- package/dashboard/public/style.css +0 -154
- package/dist/chunk-4KDZZW4X.js +0 -13
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildOrUpdateMemoryGraphIndex,
|
|
3
|
+
loadMemoryGraphIndex
|
|
4
|
+
} from "./chunk-O5V7SD5C.js";
|
|
5
|
+
import {
|
|
6
|
+
resolveVaultPath
|
|
7
|
+
} from "./chunk-MXSSG3QU.js";
|
|
8
|
+
|
|
9
|
+
// src/commands/graph.ts
|
|
10
|
+
function formatGraphSummary(summary) {
|
|
11
|
+
const lines = [];
|
|
12
|
+
lines.push("Memory Graph Summary");
|
|
13
|
+
lines.push("-".repeat(34));
|
|
14
|
+
lines.push(`Schema version: ${summary.schemaVersion}`);
|
|
15
|
+
lines.push(`Generated at: ${summary.generatedAt}`);
|
|
16
|
+
lines.push(`Files indexed: ${summary.fileCount}`);
|
|
17
|
+
lines.push(`Nodes: ${summary.nodeCount}`);
|
|
18
|
+
lines.push(`Edges: ${summary.edgeCount}`);
|
|
19
|
+
lines.push("");
|
|
20
|
+
lines.push("Node types:");
|
|
21
|
+
for (const [type, count] of Object.entries(summary.nodeTypeCounts).sort((a, b) => a[0].localeCompare(b[0]))) {
|
|
22
|
+
lines.push(` - ${type}: ${count}`);
|
|
23
|
+
}
|
|
24
|
+
lines.push("");
|
|
25
|
+
lines.push("Edge types:");
|
|
26
|
+
for (const [type, count] of Object.entries(summary.edgeTypeCounts).sort((a, b) => a[0].localeCompare(b[0]))) {
|
|
27
|
+
lines.push(` - ${type}: ${count}`);
|
|
28
|
+
}
|
|
29
|
+
return lines.join("\n");
|
|
30
|
+
}
|
|
31
|
+
async function graphSummary(options = {}) {
|
|
32
|
+
const vaultPath = resolveVaultPath({ explicitPath: options.vaultPath });
|
|
33
|
+
const index = options.refresh ? await buildOrUpdateMemoryGraphIndex(vaultPath) : loadMemoryGraphIndex(vaultPath) ?? await buildOrUpdateMemoryGraphIndex(vaultPath);
|
|
34
|
+
return {
|
|
35
|
+
schemaVersion: index.schemaVersion,
|
|
36
|
+
generatedAt: index.generatedAt,
|
|
37
|
+
nodeCount: index.graph.stats.nodeCount,
|
|
38
|
+
edgeCount: index.graph.stats.edgeCount,
|
|
39
|
+
nodeTypeCounts: index.graph.stats.nodeTypeCounts,
|
|
40
|
+
edgeTypeCounts: index.graph.stats.edgeTypeCounts,
|
|
41
|
+
fileCount: Object.keys(index.files).length
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
async function graphCommand(options = {}) {
|
|
45
|
+
const summary = await graphSummary(options);
|
|
46
|
+
if (options.json) {
|
|
47
|
+
console.log(JSON.stringify(summary, null, 2));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
console.log(formatGraphSummary(summary));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
graphSummary,
|
|
55
|
+
graphCommand
|
|
56
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type CompatStatus = 'ok' | 'warn' | 'error';
|
|
2
|
+
interface CompatCheck {
|
|
3
|
+
label: string;
|
|
4
|
+
status: CompatStatus;
|
|
5
|
+
detail?: string;
|
|
6
|
+
hint?: string;
|
|
7
|
+
}
|
|
8
|
+
interface CompatReport {
|
|
9
|
+
generatedAt: string;
|
|
10
|
+
checks: CompatCheck[];
|
|
11
|
+
warnings: number;
|
|
12
|
+
errors: number;
|
|
13
|
+
}
|
|
14
|
+
interface CompatOptions {
|
|
15
|
+
baseDir?: string;
|
|
16
|
+
}
|
|
17
|
+
interface CompatCommandOptions {
|
|
18
|
+
json?: boolean;
|
|
19
|
+
strict?: boolean;
|
|
20
|
+
baseDir?: string;
|
|
21
|
+
}
|
|
22
|
+
declare function checkOpenClawCompatibility(options?: CompatOptions): CompatReport;
|
|
23
|
+
declare function compatibilityExitCode(report: CompatReport, options?: {
|
|
24
|
+
strict?: boolean;
|
|
25
|
+
}): number;
|
|
26
|
+
declare function compatCommand(options?: CompatCommandOptions): Promise<CompatReport>;
|
|
27
|
+
|
|
28
|
+
export { type CompatCheck, type CompatCommandOptions, type CompatReport, type CompatStatus, checkOpenClawCompatibility, compatCommand, compatibilityExitCode };
|
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
type ContextFormat = 'markdown' | 'json';
|
|
4
|
-
interface ContextOptions {
|
|
5
|
-
vaultPath: string;
|
|
6
|
-
limit?: number;
|
|
7
|
-
format?: ContextFormat;
|
|
8
|
-
recent?: boolean;
|
|
9
|
-
includeObservations?: boolean;
|
|
10
|
-
budget?: number;
|
|
11
|
-
}
|
|
12
|
-
interface ContextEntry {
|
|
13
|
-
title: string;
|
|
14
|
-
path: string;
|
|
15
|
-
category: string;
|
|
16
|
-
score: number;
|
|
17
|
-
snippet: string;
|
|
18
|
-
modified: string;
|
|
19
|
-
age: string;
|
|
20
|
-
source: 'observation' | 'daily-note' | 'search';
|
|
21
|
-
}
|
|
22
|
-
interface ContextResult {
|
|
23
|
-
task: string;
|
|
24
|
-
generated: string;
|
|
25
|
-
context: ContextEntry[];
|
|
26
|
-
markdown: string;
|
|
27
|
-
}
|
|
28
|
-
declare function formatContextMarkdown(task: string, entries: ContextEntry[]): string;
|
|
29
|
-
declare function buildContext(task: string, options: ContextOptions): Promise<ContextResult>;
|
|
30
|
-
declare function contextCommand(task: string, options: ContextOptions): Promise<void>;
|
|
31
|
-
declare function registerContextCommand(program: Command): void;
|
|
32
|
-
|
|
33
|
-
export { type ContextEntry, type ContextFormat, type ContextOptions, type ContextResult, buildContext, contextCommand, formatContextMarkdown, registerContextCommand };
|
|
1
|
+
import 'commander';
|
|
2
|
+
export { C as ContextEntry, a as ContextFormat, b as ContextOptions, c as ContextProfile, e as ContextProfileOption, f as ContextResult, g as buildContext, h as contextCommand, i as formatContextMarkdown, r as registerContextCommand } from '../context-COo8oq1k.js';
|
package/dist/commands/context.js
CHANGED
|
@@ -3,9 +3,10 @@ import {
|
|
|
3
3
|
contextCommand,
|
|
4
4
|
formatContextMarkdown,
|
|
5
5
|
registerContextCommand
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-TBVI4N53.js";
|
|
7
|
+
import "../chunk-QFBKWDYR.js";
|
|
8
8
|
import "../chunk-MIIXBNO3.js";
|
|
9
|
+
import "../chunk-O5V7SD5C.js";
|
|
9
10
|
export {
|
|
10
11
|
buildContext,
|
|
11
12
|
contextCommand,
|
package/dist/commands/doctor.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatAge
|
|
3
|
+
} from "../chunk-7ZRP733D.js";
|
|
4
|
+
import {
|
|
5
|
+
checkOpenClawCompatibility
|
|
6
|
+
} from "../chunk-PAYUH64O.js";
|
|
1
7
|
import {
|
|
2
8
|
ClawVault,
|
|
3
9
|
findVault
|
|
4
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-QFBKWDYR.js";
|
|
5
11
|
import {
|
|
6
12
|
hasQmd
|
|
7
13
|
} from "../chunk-MIIXBNO3.js";
|
|
@@ -10,8 +16,8 @@ import {
|
|
|
10
16
|
} from "../chunk-4VQTUVH7.js";
|
|
11
17
|
import "../chunk-J7ZWCI2C.js";
|
|
12
18
|
import {
|
|
13
|
-
|
|
14
|
-
} from "../chunk-
|
|
19
|
+
loadMemoryGraphIndex
|
|
20
|
+
} from "../chunk-O5V7SD5C.js";
|
|
15
21
|
|
|
16
22
|
// src/commands/doctor.ts
|
|
17
23
|
import * as fs from "fs";
|
|
@@ -85,6 +91,29 @@ async function doctor(vaultPath) {
|
|
|
85
91
|
const checks = [];
|
|
86
92
|
let warnings = 0;
|
|
87
93
|
let errors = 0;
|
|
94
|
+
const compatReport = checkOpenClawCompatibility();
|
|
95
|
+
if (compatReport.errors > 0) {
|
|
96
|
+
checks.push({
|
|
97
|
+
label: "OpenClaw compatibility",
|
|
98
|
+
status: "error",
|
|
99
|
+
detail: `${compatReport.errors} error(s), ${compatReport.warnings} warning(s)`,
|
|
100
|
+
hint: "Run `clawvault compat` for full compatibility diagnostics."
|
|
101
|
+
});
|
|
102
|
+
errors++;
|
|
103
|
+
} else if (compatReport.warnings > 0) {
|
|
104
|
+
checks.push({
|
|
105
|
+
label: "OpenClaw compatibility",
|
|
106
|
+
status: "warn",
|
|
107
|
+
detail: `${compatReport.warnings} warning(s)`,
|
|
108
|
+
hint: "Run `clawvault compat` for full compatibility diagnostics."
|
|
109
|
+
});
|
|
110
|
+
warnings++;
|
|
111
|
+
} else {
|
|
112
|
+
checks.push({
|
|
113
|
+
label: "OpenClaw compatibility",
|
|
114
|
+
status: "ok"
|
|
115
|
+
});
|
|
116
|
+
}
|
|
88
117
|
if (hasQmd()) {
|
|
89
118
|
checks.push({ label: "qmd installed", status: "ok" });
|
|
90
119
|
} else {
|
|
@@ -143,6 +172,35 @@ async function doctor(vaultPath) {
|
|
|
143
172
|
}
|
|
144
173
|
const latestDoc = documents.slice().sort((a, b) => b.modified.getTime() - a.modified.getTime())[0];
|
|
145
174
|
const latestDocAge = latestDoc ? daysSince(latestDoc.modified) : null;
|
|
175
|
+
const graphIndex = loadMemoryGraphIndex(vault.getPath());
|
|
176
|
+
if (!graphIndex) {
|
|
177
|
+
checks.push({
|
|
178
|
+
label: "memory graph index",
|
|
179
|
+
status: "warn",
|
|
180
|
+
detail: "No graph index found",
|
|
181
|
+
hint: "Run `clawvault graph --refresh` to build .clawvault/graph-index.json."
|
|
182
|
+
});
|
|
183
|
+
warnings++;
|
|
184
|
+
} else {
|
|
185
|
+
const generatedAt = new Date(graphIndex.generatedAt);
|
|
186
|
+
const generatedAge = describeAge(generatedAt);
|
|
187
|
+
const latestDocIsNewer = latestDoc ? latestDoc.modified.getTime() > generatedAt.getTime() + 1e3 : false;
|
|
188
|
+
if (latestDocIsNewer) {
|
|
189
|
+
checks.push({
|
|
190
|
+
label: "memory graph index",
|
|
191
|
+
status: "warn",
|
|
192
|
+
detail: `Stale graph index (generated ${generatedAge} ago)`,
|
|
193
|
+
hint: "Run `clawvault graph --refresh` to resync index."
|
|
194
|
+
});
|
|
195
|
+
warnings++;
|
|
196
|
+
} else {
|
|
197
|
+
checks.push({
|
|
198
|
+
label: "memory graph index",
|
|
199
|
+
status: "ok",
|
|
200
|
+
detail: `${graphIndex.graph.stats.nodeCount} nodes, ${graphIndex.graph.stats.edgeCount} edges`
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
146
204
|
let lastHandoffAge = null;
|
|
147
205
|
if (handoffs.length === 0) {
|
|
148
206
|
checks.push({
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getVaultPath
|
|
3
|
-
} from "../chunk-4KDZZW4X.js";
|
|
4
1
|
import {
|
|
5
2
|
buildEntityIndex
|
|
6
3
|
} from "../chunk-J7ZWCI2C.js";
|
|
4
|
+
import {
|
|
5
|
+
resolveVaultPath
|
|
6
|
+
} from "../chunk-MXSSG3QU.js";
|
|
7
7
|
|
|
8
8
|
// src/commands/entities.ts
|
|
9
9
|
async function entitiesCommand(options) {
|
|
10
|
-
const vaultPath =
|
|
10
|
+
const vaultPath = resolveVaultPath({ explicitPath: options.vaultPath });
|
|
11
11
|
const index = buildEntityIndex(vaultPath);
|
|
12
12
|
if (options.json) {
|
|
13
13
|
const output = {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface GraphSummary {
|
|
2
|
+
schemaVersion: number;
|
|
3
|
+
generatedAt: string;
|
|
4
|
+
nodeCount: number;
|
|
5
|
+
edgeCount: number;
|
|
6
|
+
nodeTypeCounts: Record<string, number>;
|
|
7
|
+
edgeTypeCounts: Record<string, number>;
|
|
8
|
+
fileCount: number;
|
|
9
|
+
}
|
|
10
|
+
declare function graphSummary(options?: {
|
|
11
|
+
vaultPath?: string;
|
|
12
|
+
refresh?: boolean;
|
|
13
|
+
json?: boolean;
|
|
14
|
+
}): Promise<GraphSummary>;
|
|
15
|
+
declare function graphCommand(options?: {
|
|
16
|
+
vaultPath?: string;
|
|
17
|
+
refresh?: boolean;
|
|
18
|
+
json?: boolean;
|
|
19
|
+
}): Promise<void>;
|
|
20
|
+
|
|
21
|
+
export { type GraphSummary, graphCommand, graphSummary };
|
package/dist/commands/link.d.ts
CHANGED
package/dist/commands/link.js
CHANGED
|
@@ -8,18 +8,21 @@ import {
|
|
|
8
8
|
rebuildBacklinksIndex,
|
|
9
9
|
scanVaultLinks
|
|
10
10
|
} from "../chunk-4VQTUVH7.js";
|
|
11
|
-
import {
|
|
12
|
-
getVaultPath
|
|
13
|
-
} from "../chunk-4KDZZW4X.js";
|
|
14
11
|
import {
|
|
15
12
|
buildEntityIndex
|
|
16
13
|
} from "../chunk-J7ZWCI2C.js";
|
|
14
|
+
import {
|
|
15
|
+
buildOrUpdateMemoryGraphIndex
|
|
16
|
+
} from "../chunk-O5V7SD5C.js";
|
|
17
|
+
import {
|
|
18
|
+
resolveVaultPath
|
|
19
|
+
} from "../chunk-MXSSG3QU.js";
|
|
17
20
|
|
|
18
21
|
// src/commands/link.ts
|
|
19
22
|
import * as fs from "fs";
|
|
20
23
|
import * as path from "path";
|
|
21
24
|
async function linkCommand(file, options) {
|
|
22
|
-
const vaultPath =
|
|
25
|
+
const vaultPath = resolveVaultPath({ explicitPath: options.vaultPath });
|
|
23
26
|
const index = buildEntityIndex(vaultPath);
|
|
24
27
|
const suggestionIndex = filterIndex(index, /* @__PURE__ */ new Set(["people", "projects", "decisions"]));
|
|
25
28
|
const modeCount = [options.backlinks ? 1 : 0, options.orphans ? 1 : 0, options.rebuild ? 1 : 0].reduce((sum, value) => sum + value, 0);
|
|
@@ -74,6 +77,9 @@ async function linkCommand(file, options) {
|
|
|
74
77
|
}
|
|
75
78
|
if (options.all) {
|
|
76
79
|
await linkAllFiles(vaultPath, index, suggestionIndex, options.dryRun);
|
|
80
|
+
if (!options.dryRun) {
|
|
81
|
+
await buildOrUpdateMemoryGraphIndex(vaultPath);
|
|
82
|
+
}
|
|
77
83
|
return;
|
|
78
84
|
}
|
|
79
85
|
if (!file) {
|
|
@@ -85,7 +91,10 @@ async function linkCommand(file, options) {
|
|
|
85
91
|
console.error(`Error: File not found: ${filePath}`);
|
|
86
92
|
process.exit(1);
|
|
87
93
|
}
|
|
88
|
-
await linkFile(filePath, index, suggestionIndex, options.dryRun);
|
|
94
|
+
const linked = await linkFile(filePath, index, suggestionIndex, options.dryRun);
|
|
95
|
+
if (!options.dryRun && linked > 0) {
|
|
96
|
+
await buildOrUpdateMemoryGraphIndex(vaultPath);
|
|
97
|
+
}
|
|
89
98
|
}
|
|
90
99
|
function filterIndex(index, categories) {
|
|
91
100
|
const entries = /* @__PURE__ */ new Map();
|
package/dist/commands/sleep.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ClawVault
|
|
3
|
-
} from "../chunk-3HFB7EMU.js";
|
|
4
|
-
import {
|
|
5
|
-
qmdUpdate
|
|
6
|
-
} from "../chunk-MIIXBNO3.js";
|
|
7
1
|
import {
|
|
8
2
|
Observer,
|
|
9
3
|
parseSessionFile
|
|
@@ -11,6 +5,13 @@ import {
|
|
|
11
5
|
import {
|
|
12
6
|
clearDirtyFlag
|
|
13
7
|
} from "../chunk-MZZJLQNQ.js";
|
|
8
|
+
import {
|
|
9
|
+
ClawVault
|
|
10
|
+
} from "../chunk-QFBKWDYR.js";
|
|
11
|
+
import {
|
|
12
|
+
qmdUpdate
|
|
13
|
+
} from "../chunk-MIIXBNO3.js";
|
|
14
|
+
import "../chunk-O5V7SD5C.js";
|
|
14
15
|
|
|
15
16
|
// src/commands/sleep.ts
|
|
16
17
|
import * as fs from "fs";
|
|
@@ -17,6 +17,12 @@ interface VaultStatus {
|
|
|
17
17
|
indexStatus: 'present' | 'missing' | 'root-mismatch';
|
|
18
18
|
error?: string;
|
|
19
19
|
};
|
|
20
|
+
graph: {
|
|
21
|
+
indexStatus: 'present' | 'missing' | 'stale';
|
|
22
|
+
generatedAt?: string;
|
|
23
|
+
nodeCount?: number;
|
|
24
|
+
edgeCount?: number;
|
|
25
|
+
};
|
|
20
26
|
git?: {
|
|
21
27
|
repoRoot: string;
|
|
22
28
|
clean: boolean;
|
package/dist/commands/status.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatAge
|
|
3
|
+
} from "../chunk-7ZRP733D.js";
|
|
1
4
|
import {
|
|
2
5
|
ClawVault
|
|
3
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-QFBKWDYR.js";
|
|
4
7
|
import {
|
|
5
8
|
QmdUnavailableError,
|
|
6
9
|
hasQmd
|
|
@@ -10,8 +13,8 @@ import {
|
|
|
10
13
|
} from "../chunk-4VQTUVH7.js";
|
|
11
14
|
import "../chunk-J7ZWCI2C.js";
|
|
12
15
|
import {
|
|
13
|
-
|
|
14
|
-
} from "../chunk-
|
|
16
|
+
loadMemoryGraphIndex
|
|
17
|
+
} from "../chunk-O5V7SD5C.js";
|
|
15
18
|
|
|
16
19
|
// src/commands/status.ts
|
|
17
20
|
import * as fs from "fs";
|
|
@@ -38,6 +41,31 @@ function getGitStatus(repoRoot) {
|
|
|
38
41
|
const lines = output.split("\n").filter(Boolean);
|
|
39
42
|
return { clean: lines.length === 0, dirtyCount: lines.length };
|
|
40
43
|
}
|
|
44
|
+
function getLatestVaultMarkdownMtime(vaultPath) {
|
|
45
|
+
const skipDirs = /* @__PURE__ */ new Set([".git", ".obsidian", ".trash", "node_modules", ".clawvault"]);
|
|
46
|
+
let latest = null;
|
|
47
|
+
function walk(currentPath) {
|
|
48
|
+
const entries = fs.readdirSync(currentPath, { withFileTypes: true });
|
|
49
|
+
for (const entry of entries) {
|
|
50
|
+
const absolute = path.join(currentPath, entry.name);
|
|
51
|
+
if (entry.isDirectory()) {
|
|
52
|
+
if (!skipDirs.has(entry.name)) {
|
|
53
|
+
walk(absolute);
|
|
54
|
+
}
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (!entry.isFile() || !entry.name.endsWith(".md")) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const mtime = fs.statSync(absolute).mtime;
|
|
61
|
+
if (!latest || mtime.getTime() > latest.getTime()) {
|
|
62
|
+
latest = mtime;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
walk(vaultPath);
|
|
67
|
+
return latest;
|
|
68
|
+
}
|
|
41
69
|
function parseQmdCollectionsText(raw) {
|
|
42
70
|
const names = [];
|
|
43
71
|
const regex = /^(\S+)\s+\(qmd:\/\/\1\/\)/gm;
|
|
@@ -122,6 +150,26 @@ async function getStatus(vaultPath) {
|
|
|
122
150
|
issues.push(`Git status error: ${err?.message || "unknown error"}`);
|
|
123
151
|
}
|
|
124
152
|
}
|
|
153
|
+
const graphIndex = loadMemoryGraphIndex(vault.getPath());
|
|
154
|
+
let graphStatus = {
|
|
155
|
+
indexStatus: "missing"
|
|
156
|
+
};
|
|
157
|
+
if (!graphIndex) {
|
|
158
|
+
issues.push("Memory graph index missing");
|
|
159
|
+
} else {
|
|
160
|
+
const generatedAt = graphIndex.generatedAt;
|
|
161
|
+
const latestDocMtime = getLatestVaultMarkdownMtime(vault.getPath());
|
|
162
|
+
const isStale = latestDocMtime ? latestDocMtime.getTime() > new Date(generatedAt).getTime() + 1e3 : false;
|
|
163
|
+
graphStatus = {
|
|
164
|
+
indexStatus: isStale ? "stale" : "present",
|
|
165
|
+
generatedAt,
|
|
166
|
+
nodeCount: graphIndex.graph.stats.nodeCount,
|
|
167
|
+
edgeCount: graphIndex.graph.stats.edgeCount
|
|
168
|
+
};
|
|
169
|
+
if (isStale) {
|
|
170
|
+
issues.push("Memory graph index stale");
|
|
171
|
+
}
|
|
172
|
+
}
|
|
125
173
|
return {
|
|
126
174
|
vaultName: vault.getName(),
|
|
127
175
|
vaultPath: vault.getPath(),
|
|
@@ -134,6 +182,7 @@ async function getStatus(vaultPath) {
|
|
|
134
182
|
indexStatus: qmdIndexStatus,
|
|
135
183
|
error: qmdError
|
|
136
184
|
},
|
|
185
|
+
graph: graphStatus,
|
|
137
186
|
git: gitStatus,
|
|
138
187
|
links: {
|
|
139
188
|
total: linkScan.linkCount,
|
|
@@ -197,6 +246,17 @@ function formatStatus(status) {
|
|
|
197
246
|
output += ` - Repo: ${status.git.repoRoot}
|
|
198
247
|
`;
|
|
199
248
|
output += ` - Status: ${status.git.clean ? "clean" : "dirty"} (${status.git.dirtyCount} change(s))
|
|
249
|
+
`;
|
|
250
|
+
}
|
|
251
|
+
output += "\nGraph:\n";
|
|
252
|
+
output += ` - Index: ${status.graph.indexStatus}
|
|
253
|
+
`;
|
|
254
|
+
if (status.graph.generatedAt) {
|
|
255
|
+
output += ` - Generated: ${status.graph.generatedAt}
|
|
256
|
+
`;
|
|
257
|
+
}
|
|
258
|
+
if (status.graph.nodeCount !== void 0 && status.graph.edgeCount !== void 0) {
|
|
259
|
+
output += ` - Size: ${status.graph.nodeCount} nodes, ${status.graph.edgeCount} edges
|
|
200
260
|
`;
|
|
201
261
|
}
|
|
202
262
|
output += "\nLinks:\n";
|
package/dist/commands/wake.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ClawVault
|
|
3
|
-
} from "../chunk-3HFB7EMU.js";
|
|
4
|
-
import "../chunk-MIIXBNO3.js";
|
|
5
1
|
import {
|
|
6
2
|
recover
|
|
7
3
|
} from "../chunk-MILVYUPK.js";
|
|
@@ -9,6 +5,11 @@ import {
|
|
|
9
5
|
clearDirtyFlag
|
|
10
6
|
} from "../chunk-MZZJLQNQ.js";
|
|
11
7
|
import "../chunk-7ZRP733D.js";
|
|
8
|
+
import {
|
|
9
|
+
ClawVault
|
|
10
|
+
} from "../chunk-QFBKWDYR.js";
|
|
11
|
+
import "../chunk-MIIXBNO3.js";
|
|
12
|
+
import "../chunk-O5V7SD5C.js";
|
|
12
13
|
|
|
13
14
|
// src/commands/wake.ts
|
|
14
15
|
import * as fs from "fs";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
|
|
3
|
+
type ResolvedContextProfile = 'default' | 'planning' | 'incident' | 'handoff';
|
|
4
|
+
type ContextProfileInput = ResolvedContextProfile | 'auto';
|
|
5
|
+
declare function inferContextProfile(task: string): ResolvedContextProfile;
|
|
6
|
+
declare function normalizeContextProfileInput(profile: string | undefined): ContextProfileInput;
|
|
7
|
+
declare function resolveContextProfile(profile: ContextProfileInput | undefined, task: string): ResolvedContextProfile;
|
|
8
|
+
|
|
9
|
+
type ContextFormat = 'markdown' | 'json';
|
|
10
|
+
type ContextProfile = ResolvedContextProfile;
|
|
11
|
+
type ContextProfileOption = ContextProfile | 'auto';
|
|
12
|
+
interface ContextOptions {
|
|
13
|
+
vaultPath: string;
|
|
14
|
+
limit?: number;
|
|
15
|
+
format?: ContextFormat;
|
|
16
|
+
recent?: boolean;
|
|
17
|
+
includeObservations?: boolean;
|
|
18
|
+
budget?: number;
|
|
19
|
+
profile?: ContextProfileOption;
|
|
20
|
+
}
|
|
21
|
+
interface ContextEntry {
|
|
22
|
+
title: string;
|
|
23
|
+
path: string;
|
|
24
|
+
category: string;
|
|
25
|
+
score: number;
|
|
26
|
+
snippet: string;
|
|
27
|
+
modified: string;
|
|
28
|
+
age: string;
|
|
29
|
+
source: 'observation' | 'daily-note' | 'search' | 'graph';
|
|
30
|
+
signals?: string[];
|
|
31
|
+
rationale?: string;
|
|
32
|
+
}
|
|
33
|
+
interface ContextResult {
|
|
34
|
+
task: string;
|
|
35
|
+
profile: ContextProfile;
|
|
36
|
+
generated: string;
|
|
37
|
+
context: ContextEntry[];
|
|
38
|
+
markdown: string;
|
|
39
|
+
}
|
|
40
|
+
declare function formatContextMarkdown(task: string, entries: ContextEntry[]): string;
|
|
41
|
+
declare function buildContext(task: string, options: ContextOptions): Promise<ContextResult>;
|
|
42
|
+
declare function contextCommand(task: string, options: ContextOptions): Promise<void>;
|
|
43
|
+
declare function registerContextCommand(program: Command): void;
|
|
44
|
+
|
|
45
|
+
export { type ContextEntry as C, type ResolvedContextProfile as R, type ContextFormat as a, type ContextOptions as b, type ContextProfile as c, type ContextProfileInput as d, type ContextProfileOption as e, type ContextResult as f, buildContext as g, contextCommand as h, formatContextMarkdown as i, inferContextProfile as j, resolveContextProfile as k, normalizeContextProfileInput as n, registerContextCommand as r };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,12 @@ import { Command } from 'commander';
|
|
|
2
2
|
import { V as VaultConfig, S as StoreOptions, D as Document, a as SearchOptions, b as SearchResult, c as SyncOptions, d as SyncResult, C as Category, M as MemoryType, H as HandoffDocument, e as SessionRecap } from './types-DMU3SuAV.js';
|
|
3
3
|
export { f as DEFAULT_CATEGORIES, g as DEFAULT_CONFIG, h as MEMORY_TYPES, T as TYPE_TO_CATEGORY, i as VaultMeta } from './types-DMU3SuAV.js';
|
|
4
4
|
export { setupCommand } from './commands/setup.js';
|
|
5
|
-
export {
|
|
5
|
+
export { CompatCheck, CompatCommandOptions, CompatReport, CompatStatus, checkOpenClawCompatibility, compatCommand, compatibilityExitCode } from './commands/compat.js';
|
|
6
|
+
export { GraphSummary, graphCommand, graphSummary } from './commands/graph.js';
|
|
7
|
+
export { C as ContextEntry, a as ContextFormat, b as ContextOptions, c as ContextProfile, d as ContextProfileInput, e as ContextProfileOption, f as ContextResult, R as ResolvedContextProfile, g as buildContext, h as contextCommand, i as formatContextMarkdown, j as inferContextProfile, n as normalizeContextProfileInput, r as registerContextCommand, k as resolveContextProfile } from './context-COo8oq1k.js';
|
|
6
8
|
export { ObserveCommandOptions, observeCommand, registerObserveCommand } from './commands/observe.js';
|
|
7
9
|
export { SessionRecapFormat, SessionRecapOptions, SessionRecapResult, SessionTurn, buildSessionRecap, formatSessionRecapMarkdown, sessionRecapCommand } from './commands/session-recap.js';
|
|
10
|
+
export { findNearestVaultPath, getVaultPath, resolveVaultPath } from './lib/config.js';
|
|
8
11
|
export { TemplateVariables, buildTemplateVariables, renderTemplate } from './lib/template-engine.js';
|
|
9
12
|
|
|
10
13
|
/**
|
|
@@ -135,6 +138,7 @@ declare class ClawVault {
|
|
|
135
138
|
private slugify;
|
|
136
139
|
private saveIndex;
|
|
137
140
|
private createTemplates;
|
|
141
|
+
private syncMemoryGraphIndex;
|
|
138
142
|
private generateReadme;
|
|
139
143
|
private getCategoryDescription;
|
|
140
144
|
}
|
|
@@ -263,6 +267,63 @@ declare function extractWikiLinks(content: string): string[];
|
|
|
263
267
|
*/
|
|
264
268
|
declare function extractTags(content: string): string[];
|
|
265
269
|
|
|
270
|
+
declare const MEMORY_GRAPH_SCHEMA_VERSION = 1;
|
|
271
|
+
type NodeCategory = 'note' | 'daily' | 'observation' | 'handoff' | 'decision' | 'lesson' | 'project' | 'person' | 'commitment' | 'tag' | 'unresolved';
|
|
272
|
+
type MemoryGraphNodeType = NodeCategory;
|
|
273
|
+
type MemoryGraphEdgeType = 'wiki_link' | 'tag' | 'frontmatter_relation';
|
|
274
|
+
interface MemoryGraphNode {
|
|
275
|
+
id: string;
|
|
276
|
+
title: string;
|
|
277
|
+
type: MemoryGraphNodeType;
|
|
278
|
+
category: string;
|
|
279
|
+
path: string | null;
|
|
280
|
+
tags: string[];
|
|
281
|
+
missing: boolean;
|
|
282
|
+
degree: number;
|
|
283
|
+
modifiedAt: string | null;
|
|
284
|
+
}
|
|
285
|
+
interface MemoryGraphEdge {
|
|
286
|
+
id: string;
|
|
287
|
+
source: string;
|
|
288
|
+
target: string;
|
|
289
|
+
type: MemoryGraphEdgeType;
|
|
290
|
+
label?: string;
|
|
291
|
+
}
|
|
292
|
+
interface MemoryGraphStats {
|
|
293
|
+
generatedAt: string;
|
|
294
|
+
nodeCount: number;
|
|
295
|
+
edgeCount: number;
|
|
296
|
+
nodeTypeCounts: Record<string, number>;
|
|
297
|
+
edgeTypeCounts: Record<string, number>;
|
|
298
|
+
}
|
|
299
|
+
interface MemoryGraph {
|
|
300
|
+
schemaVersion: number;
|
|
301
|
+
nodes: MemoryGraphNode[];
|
|
302
|
+
edges: MemoryGraphEdge[];
|
|
303
|
+
stats: MemoryGraphStats;
|
|
304
|
+
}
|
|
305
|
+
interface MemoryGraphFileFragment {
|
|
306
|
+
relativePath: string;
|
|
307
|
+
mtimeMs: number;
|
|
308
|
+
nodes: MemoryGraphNode[];
|
|
309
|
+
edges: MemoryGraphEdge[];
|
|
310
|
+
}
|
|
311
|
+
interface MemoryGraphIndex {
|
|
312
|
+
schemaVersion: number;
|
|
313
|
+
vaultPath: string;
|
|
314
|
+
generatedAt: string;
|
|
315
|
+
files: Record<string, MemoryGraphFileFragment>;
|
|
316
|
+
graph: MemoryGraph;
|
|
317
|
+
}
|
|
318
|
+
interface BuildGraphIndexOptions {
|
|
319
|
+
forceFull?: boolean;
|
|
320
|
+
}
|
|
321
|
+
declare function loadMemoryGraphIndex(vaultPath: string): MemoryGraphIndex | null;
|
|
322
|
+
declare function buildOrUpdateMemoryGraphIndex(vaultPathInput: string, options?: BuildGraphIndexOptions): Promise<MemoryGraphIndex>;
|
|
323
|
+
declare function getMemoryGraph(vaultPath: string, options?: {
|
|
324
|
+
refresh?: boolean;
|
|
325
|
+
}): Promise<MemoryGraph>;
|
|
326
|
+
|
|
266
327
|
interface ObserverCompressor {
|
|
267
328
|
compress(messages: string[], existingObservations: string): Promise<string>;
|
|
268
329
|
}
|
|
@@ -425,4 +486,4 @@ declare function parseSessionFile(filePath: string): string[];
|
|
|
425
486
|
declare const VERSION: string;
|
|
426
487
|
declare function registerCommanderCommands(program: Command): Command;
|
|
427
488
|
|
|
428
|
-
export { Category, ClawVault, Compressor, type CompressorOptions, Document, HandoffDocument, MemoryType, Observer, type ObserverCompressor, type ObserverOptions, type ObserverReflector, QMD_INSTALL_COMMAND, QMD_INSTALL_URL, QmdUnavailableError, Reflector, type ReflectorOptions, SearchEngine, SearchOptions, SearchResult, SessionRecap, SessionWatcher, type SessionWatcherOptions, StoreOptions, SyncOptions, SyncResult, VERSION, VaultConfig, createVault, extractTags, extractWikiLinks, findVault, hasQmd, parseSessionFile, qmdEmbed, qmdUpdate, registerCommanderCommands };
|
|
489
|
+
export { Category, ClawVault, Compressor, type CompressorOptions, Document, HandoffDocument, MEMORY_GRAPH_SCHEMA_VERSION, type MemoryGraph, type MemoryGraphEdge, type MemoryGraphEdgeType, type MemoryGraphIndex, type MemoryGraphNode, type MemoryGraphNodeType, type MemoryGraphStats, MemoryType, Observer, type ObserverCompressor, type ObserverOptions, type ObserverReflector, QMD_INSTALL_COMMAND, QMD_INSTALL_URL, QmdUnavailableError, Reflector, type ReflectorOptions, SearchEngine, SearchOptions, SearchResult, SessionRecap, SessionWatcher, type SessionWatcherOptions, StoreOptions, SyncOptions, SyncResult, VERSION, VaultConfig, buildOrUpdateMemoryGraphIndex, createVault, extractTags, extractWikiLinks, findVault, getMemoryGraph, hasQmd, loadMemoryGraphIndex, parseSessionFile, qmdEmbed, qmdUpdate, registerCommanderCommands };
|