clawvault 2.5.1 → 2.5.3
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 +159 -199
- package/bin/clawvault.js +111 -111
- package/bin/command-registration.test.js +166 -165
- package/bin/command-runtime.js +93 -77
- package/bin/command-runtime.test.js +154 -102
- package/bin/help-contract.test.js +39 -28
- package/bin/register-config-commands.js +153 -153
- package/bin/register-config-route-commands.test.js +121 -121
- package/bin/register-core-commands.js +237 -237
- package/bin/register-kanban-commands.js +56 -56
- package/bin/register-kanban-commands.test.js +83 -83
- package/bin/register-maintenance-commands.js +282 -248
- package/bin/register-project-commands.js +209 -209
- package/bin/register-project-commands.test.js +206 -201
- package/bin/register-query-commands.js +317 -312
- package/bin/register-query-commands.test.js +65 -0
- package/bin/register-resilience-commands.js +182 -182
- package/bin/register-resilience-commands.test.js +81 -81
- package/bin/register-route-commands.js +114 -114
- package/bin/register-session-lifecycle-commands.js +206 -206
- package/bin/register-tailscale-commands.js +106 -106
- package/bin/register-task-commands.js +348 -348
- package/bin/register-task-commands.test.js +69 -69
- package/bin/register-template-commands.js +72 -72
- package/bin/register-vault-operations-commands.js +300 -300
- package/bin/test-helpers/cli-command-fixtures.js +119 -119
- package/dashboard/lib/graph-diff.js +104 -104
- package/dashboard/lib/graph-diff.test.js +75 -75
- package/dashboard/lib/vault-parser.js +556 -556
- package/dashboard/lib/vault-parser.test.js +254 -254
- package/dashboard/public/app.js +796 -796
- package/dashboard/public/index.html +52 -52
- package/dashboard/public/styles.css +221 -221
- package/dashboard/server.js +374 -374
- package/dist/{chunk-G3OQJ2NQ.js → chunk-2YDBJS7M.js} +1 -1
- package/dist/chunk-3FP5BJ42.js +88 -0
- package/dist/{chunk-C3PF7WBA.js → chunk-4IV3R2F5.js} +2 -2
- package/dist/{chunk-7OHQFMJK.js → chunk-AY4PGUVL.js} +5 -4
- package/dist/chunk-FG6RJMCN.js +33 -0
- package/dist/{chunk-WIICLBNF.js → chunk-GFJ3LIIB.js} +1 -1
- package/dist/chunk-IZEY5S74.js +541 -0
- package/dist/chunk-LMEMZGUV.js +332 -0
- package/dist/{chunk-6RQPD7X6.js → chunk-M25QVSJM.js} +4 -3
- package/dist/{chunk-6B3JWM7J.js → chunk-O7XHXF7F.js} +34 -7
- package/dist/chunk-OSMS7QIG.js +406 -0
- package/dist/{chunk-PAYUH64O.js → chunk-QVMXF7FY.js} +11 -1
- package/dist/{chunk-TMZMN7OS.js → chunk-S2IG7VNM.js} +24 -12
- package/dist/{chunk-LMCC5OC7.js → chunk-TPDH3JPP.js} +1 -1
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.js +31 -0
- package/dist/commands/canvas.js +3 -3
- package/dist/commands/compat.js +1 -1
- package/dist/commands/context.js +4 -4
- package/dist/commands/doctor.js +16 -309
- package/dist/commands/embed.d.ts +17 -0
- package/dist/commands/embed.js +10 -0
- package/dist/commands/migrate-observations.js +2 -2
- package/dist/commands/observe.d.ts +1 -0
- package/dist/commands/observe.js +7 -6
- package/dist/commands/rebuild.js +5 -5
- package/dist/commands/reflect.js +3 -3
- package/dist/commands/replay.js +7 -7
- package/dist/commands/setup.d.ts +1 -0
- package/dist/commands/setup.js +2 -2
- package/dist/commands/sleep.d.ts +2 -1
- package/dist/commands/sleep.js +15 -15
- package/dist/commands/status.d.ts +9 -1
- package/dist/commands/status.js +33 -8
- package/dist/commands/wake.d.ts +1 -1
- package/dist/commands/wake.js +6 -6
- package/dist/index.d.ts +82 -5
- package/dist/index.js +127 -105
- package/dist/{types-jjuYN2Xn.d.ts → types-C74wgGL1.d.ts} +2 -0
- package/hooks/clawvault/HOOK.md +83 -74
- package/hooks/clawvault/handler.js +816 -812
- package/hooks/clawvault/handler.test.js +263 -263
- package/package.json +94 -125
- package/templates/checkpoint.md +19 -19
- package/templates/daily-note.md +19 -19
- package/templates/daily.md +19 -19
- package/templates/decision.md +17 -17
- package/templates/handoff.md +19 -19
- package/templates/lesson.md +16 -16
- package/templates/person.md +19 -19
- package/templates/project.md +23 -23
- package/dist/chunk-2RK2AG32.js +0 -743
- package/dist/{chunk-FW465EEA.js → chunk-VXEOHTSL.js} +3 -3
- package/dist/{chunk-KCCHROBR.js → chunk-YOSEUUNB.js} +4 -4
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import { registerConfigCommands } from './register-config-commands.js';
|
|
4
|
-
import { registerRouteCommands } from './register-route-commands.js';
|
|
5
|
-
import { chalkStub } from './test-helpers/cli-command-fixtures.js';
|
|
6
|
-
|
|
7
|
-
const {
|
|
8
|
-
getConfigValueMock,
|
|
9
|
-
setConfigValueMock,
|
|
10
|
-
listConfigMock,
|
|
11
|
-
resetConfigMock,
|
|
12
|
-
addRouteRuleMock,
|
|
13
|
-
listRouteRulesMock,
|
|
14
|
-
removeRouteRuleMock,
|
|
15
|
-
testRouteRuleMock
|
|
16
|
-
} = vi.hoisted(() => ({
|
|
17
|
-
getConfigValueMock: vi.fn(),
|
|
18
|
-
setConfigValueMock: vi.fn(),
|
|
19
|
-
listConfigMock: vi.fn(),
|
|
20
|
-
resetConfigMock: vi.fn(),
|
|
21
|
-
addRouteRuleMock: vi.fn(),
|
|
22
|
-
listRouteRulesMock: vi.fn(),
|
|
23
|
-
removeRouteRuleMock: vi.fn(),
|
|
24
|
-
testRouteRuleMock: vi.fn()
|
|
25
|
-
}));
|
|
26
|
-
|
|
27
|
-
vi.mock('../dist/index.js', () => ({
|
|
28
|
-
SUPPORTED_CONFIG_KEYS: [
|
|
29
|
-
'name',
|
|
30
|
-
'categories',
|
|
31
|
-
'theme',
|
|
32
|
-
'observe.model',
|
|
33
|
-
'observe.provider',
|
|
34
|
-
'observer.compression.provider',
|
|
35
|
-
'observer.compression.model',
|
|
36
|
-
'observer.compression.baseUrl',
|
|
37
|
-
'observer.compression.apiKey',
|
|
38
|
-
'context.maxResults',
|
|
39
|
-
'context.defaultProfile',
|
|
40
|
-
'graph.maxHops',
|
|
41
|
-
'inject.maxResults',
|
|
42
|
-
'inject.useLlm',
|
|
43
|
-
'inject.scope'
|
|
44
|
-
],
|
|
45
|
-
getConfigValue: getConfigValueMock,
|
|
46
|
-
setConfigValue: setConfigValueMock,
|
|
47
|
-
listConfig: listConfigMock,
|
|
48
|
-
resetConfig: resetConfigMock,
|
|
49
|
-
addRouteRule: addRouteRuleMock,
|
|
50
|
-
listRouteRules: listRouteRulesMock,
|
|
51
|
-
removeRouteRule: removeRouteRuleMock,
|
|
52
|
-
testRouteRule: testRouteRuleMock
|
|
53
|
-
}));
|
|
54
|
-
|
|
55
|
-
function buildProgram() {
|
|
56
|
-
const program = new Command();
|
|
57
|
-
const resolveVaultPath = (value) => value ?? '/vault';
|
|
58
|
-
registerConfigCommands(program, { chalk: chalkStub, resolveVaultPath });
|
|
59
|
-
registerRouteCommands(program, { chalk: chalkStub, resolveVaultPath });
|
|
60
|
-
return program;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async function runCommand(args) {
|
|
64
|
-
const program = buildProgram();
|
|
65
|
-
await program.parseAsync(args, { from: 'user' });
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
beforeEach(() => {
|
|
69
|
-
vi.clearAllMocks();
|
|
70
|
-
getConfigValueMock.mockReturnValue('demo-vault');
|
|
71
|
-
setConfigValueMock.mockReturnValue({ value: 'demo-vault' });
|
|
72
|
-
listConfigMock.mockReturnValue({ name: 'demo-vault', context: { maxResults: 5 } });
|
|
73
|
-
resetConfigMock.mockReturnValue(undefined);
|
|
74
|
-
addRouteRuleMock.mockReturnValue({ pattern: 'Pedro', target: 'people/pedro', priority: 1 });
|
|
75
|
-
listRouteRulesMock.mockReturnValue([{ pattern: 'Pedro', target: 'people/pedro', priority: 1 }]);
|
|
76
|
-
removeRouteRuleMock.mockReturnValue(true);
|
|
77
|
-
testRouteRuleMock.mockReturnValue({ pattern: 'Pedro', target: 'people/pedro', priority: 1 });
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
describe('config and route command registrations', () => {
|
|
81
|
-
it('executes config get/set/list subcommands', async () => {
|
|
82
|
-
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
83
|
-
try {
|
|
84
|
-
await runCommand(['config', 'get', 'name']);
|
|
85
|
-
expect(getConfigValueMock).toHaveBeenCalledWith('/vault', 'name');
|
|
86
|
-
|
|
87
|
-
await runCommand(['config', 'set', 'categories', 'people,projects']);
|
|
88
|
-
expect(setConfigValueMock).toHaveBeenCalledWith('/vault', 'categories', 'people,projects');
|
|
89
|
-
|
|
90
|
-
await runCommand(['config', 'list']);
|
|
91
|
-
expect(listConfigMock).toHaveBeenCalledWith('/vault');
|
|
92
|
-
|
|
93
|
-
const output = logSpy.mock.calls.map((call) => call.join(' ')).join('\n');
|
|
94
|
-
expect(output).toContain('context.maxResults');
|
|
95
|
-
} finally {
|
|
96
|
-
logSpy.mockRestore();
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('executes route add/remove/test subcommands', async () => {
|
|
101
|
-
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
102
|
-
try {
|
|
103
|
-
await runCommand(['route', 'add', 'Pedro', 'people/pedro']);
|
|
104
|
-
expect(addRouteRuleMock).toHaveBeenCalledWith('/vault', 'Pedro', 'people/pedro');
|
|
105
|
-
|
|
106
|
-
await runCommand(['route', 'remove', 'Pedro']);
|
|
107
|
-
expect(removeRouteRuleMock).toHaveBeenCalledWith('/vault', 'Pedro');
|
|
108
|
-
|
|
109
|
-
await runCommand(['route', 'test', 'Talked to Pedro']);
|
|
110
|
-
expect(testRouteRuleMock).toHaveBeenCalledWith('/vault', 'Talked to Pedro');
|
|
111
|
-
|
|
112
|
-
await runCommand(['route', 'list']);
|
|
113
|
-
expect(listRouteRulesMock).toHaveBeenCalledWith('/vault');
|
|
114
|
-
|
|
115
|
-
const output = logSpy.mock.calls.map((call) => call.join(' ')).join('\n');
|
|
116
|
-
expect(output).toContain('Route matched');
|
|
117
|
-
} finally {
|
|
118
|
-
logSpy.mockRestore();
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
});
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { registerConfigCommands } from './register-config-commands.js';
|
|
4
|
+
import { registerRouteCommands } from './register-route-commands.js';
|
|
5
|
+
import { chalkStub } from './test-helpers/cli-command-fixtures.js';
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
getConfigValueMock,
|
|
9
|
+
setConfigValueMock,
|
|
10
|
+
listConfigMock,
|
|
11
|
+
resetConfigMock,
|
|
12
|
+
addRouteRuleMock,
|
|
13
|
+
listRouteRulesMock,
|
|
14
|
+
removeRouteRuleMock,
|
|
15
|
+
testRouteRuleMock
|
|
16
|
+
} = vi.hoisted(() => ({
|
|
17
|
+
getConfigValueMock: vi.fn(),
|
|
18
|
+
setConfigValueMock: vi.fn(),
|
|
19
|
+
listConfigMock: vi.fn(),
|
|
20
|
+
resetConfigMock: vi.fn(),
|
|
21
|
+
addRouteRuleMock: vi.fn(),
|
|
22
|
+
listRouteRulesMock: vi.fn(),
|
|
23
|
+
removeRouteRuleMock: vi.fn(),
|
|
24
|
+
testRouteRuleMock: vi.fn()
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
vi.mock('../dist/index.js', () => ({
|
|
28
|
+
SUPPORTED_CONFIG_KEYS: [
|
|
29
|
+
'name',
|
|
30
|
+
'categories',
|
|
31
|
+
'theme',
|
|
32
|
+
'observe.model',
|
|
33
|
+
'observe.provider',
|
|
34
|
+
'observer.compression.provider',
|
|
35
|
+
'observer.compression.model',
|
|
36
|
+
'observer.compression.baseUrl',
|
|
37
|
+
'observer.compression.apiKey',
|
|
38
|
+
'context.maxResults',
|
|
39
|
+
'context.defaultProfile',
|
|
40
|
+
'graph.maxHops',
|
|
41
|
+
'inject.maxResults',
|
|
42
|
+
'inject.useLlm',
|
|
43
|
+
'inject.scope'
|
|
44
|
+
],
|
|
45
|
+
getConfigValue: getConfigValueMock,
|
|
46
|
+
setConfigValue: setConfigValueMock,
|
|
47
|
+
listConfig: listConfigMock,
|
|
48
|
+
resetConfig: resetConfigMock,
|
|
49
|
+
addRouteRule: addRouteRuleMock,
|
|
50
|
+
listRouteRules: listRouteRulesMock,
|
|
51
|
+
removeRouteRule: removeRouteRuleMock,
|
|
52
|
+
testRouteRule: testRouteRuleMock
|
|
53
|
+
}));
|
|
54
|
+
|
|
55
|
+
function buildProgram() {
|
|
56
|
+
const program = new Command();
|
|
57
|
+
const resolveVaultPath = (value) => value ?? '/vault';
|
|
58
|
+
registerConfigCommands(program, { chalk: chalkStub, resolveVaultPath });
|
|
59
|
+
registerRouteCommands(program, { chalk: chalkStub, resolveVaultPath });
|
|
60
|
+
return program;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function runCommand(args) {
|
|
64
|
+
const program = buildProgram();
|
|
65
|
+
await program.parseAsync(args, { from: 'user' });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
beforeEach(() => {
|
|
69
|
+
vi.clearAllMocks();
|
|
70
|
+
getConfigValueMock.mockReturnValue('demo-vault');
|
|
71
|
+
setConfigValueMock.mockReturnValue({ value: 'demo-vault' });
|
|
72
|
+
listConfigMock.mockReturnValue({ name: 'demo-vault', context: { maxResults: 5 } });
|
|
73
|
+
resetConfigMock.mockReturnValue(undefined);
|
|
74
|
+
addRouteRuleMock.mockReturnValue({ pattern: 'Pedro', target: 'people/pedro', priority: 1 });
|
|
75
|
+
listRouteRulesMock.mockReturnValue([{ pattern: 'Pedro', target: 'people/pedro', priority: 1 }]);
|
|
76
|
+
removeRouteRuleMock.mockReturnValue(true);
|
|
77
|
+
testRouteRuleMock.mockReturnValue({ pattern: 'Pedro', target: 'people/pedro', priority: 1 });
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
describe('config and route command registrations', () => {
|
|
81
|
+
it('executes config get/set/list subcommands', async () => {
|
|
82
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
83
|
+
try {
|
|
84
|
+
await runCommand(['config', 'get', 'name']);
|
|
85
|
+
expect(getConfigValueMock).toHaveBeenCalledWith('/vault', 'name');
|
|
86
|
+
|
|
87
|
+
await runCommand(['config', 'set', 'categories', 'people,projects']);
|
|
88
|
+
expect(setConfigValueMock).toHaveBeenCalledWith('/vault', 'categories', 'people,projects');
|
|
89
|
+
|
|
90
|
+
await runCommand(['config', 'list']);
|
|
91
|
+
expect(listConfigMock).toHaveBeenCalledWith('/vault');
|
|
92
|
+
|
|
93
|
+
const output = logSpy.mock.calls.map((call) => call.join(' ')).join('\n');
|
|
94
|
+
expect(output).toContain('context.maxResults');
|
|
95
|
+
} finally {
|
|
96
|
+
logSpy.mockRestore();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('executes route add/remove/test subcommands', async () => {
|
|
101
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
102
|
+
try {
|
|
103
|
+
await runCommand(['route', 'add', 'Pedro', 'people/pedro']);
|
|
104
|
+
expect(addRouteRuleMock).toHaveBeenCalledWith('/vault', 'Pedro', 'people/pedro');
|
|
105
|
+
|
|
106
|
+
await runCommand(['route', 'remove', 'Pedro']);
|
|
107
|
+
expect(removeRouteRuleMock).toHaveBeenCalledWith('/vault', 'Pedro');
|
|
108
|
+
|
|
109
|
+
await runCommand(['route', 'test', 'Talked to Pedro']);
|
|
110
|
+
expect(testRouteRuleMock).toHaveBeenCalledWith('/vault', 'Talked to Pedro');
|
|
111
|
+
|
|
112
|
+
await runCommand(['route', 'list']);
|
|
113
|
+
expect(listRouteRulesMock).toHaveBeenCalledWith('/vault');
|
|
114
|
+
|
|
115
|
+
const output = logSpy.mock.calls.map((call) => call.join(' ')).join('\n');
|
|
116
|
+
expect(output).toContain('Route matched');
|
|
117
|
+
} finally {
|
|
118
|
+
logSpy.mockRestore();
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
});
|