clawvault 2.5.4 → 2.6.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 +159 -159
- package/bin/clawvault.js +111 -111
- package/bin/command-registration.test.js +166 -166
- package/bin/command-runtime.js +93 -93
- package/bin/command-runtime.test.js +154 -154
- package/bin/help-contract.test.js +39 -39
- 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 -282
- package/bin/register-project-commands.js +209 -209
- package/bin/register-project-commands.test.js +206 -206
- package/bin/register-query-commands.js +317 -317
- package/bin/register-query-commands.test.js +65 -65
- 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 +75 -72
- package/bin/register-template-commands.test.js +87 -0
- 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-J5EMBUPK.js → chunk-4OXMU5S2.js} +1 -1
- package/dist/{chunk-4IV3R2F5.js → chunk-4TE4JMLA.js} +1 -1
- package/dist/{chunk-5GZFTAL7.js → chunk-AZYOKJYC.js} +128 -42
- package/dist/{chunk-JDLOL2PL.js → chunk-HA5M6KJB.js} +1 -1
- package/dist/{chunk-IZEY5S74.js → chunk-IEVLHNLU.js} +1 -1
- package/dist/{chunk-OSMS7QIG.js → chunk-ME37YNW3.js} +2 -2
- package/dist/chunk-MFAWT5O5.js +301 -0
- package/dist/{chunk-TPDH3JPP.js → chunk-PBEE567J.js} +1 -1
- package/dist/{chunk-S2IG7VNM.js → chunk-Q2J5YTUF.js} +2 -2
- package/dist/{chunk-IOALNTAN.js → chunk-QWQ3TIKS.js} +103 -29
- package/dist/{chunk-YCVDVI5B.js → chunk-R2MIW5G7.js} +1 -1
- package/dist/{chunk-W2HNZC22.js → chunk-UEOUADMO.js} +1 -1
- package/dist/cli/index.js +8 -6
- package/dist/commands/backlog.js +3 -1
- package/dist/commands/blocked.js +3 -1
- package/dist/commands/canvas.js +3 -1
- package/dist/commands/doctor.js +7 -5
- package/dist/commands/kanban.js +4 -2
- package/dist/commands/observe.js +7 -5
- package/dist/commands/project.js +5 -3
- package/dist/commands/rebuild.js +6 -4
- package/dist/commands/replay.js +6 -4
- package/dist/commands/setup.js +1 -1
- package/dist/commands/sleep.js +5 -3
- package/dist/commands/status.js +6 -4
- package/dist/commands/task.js +4 -2
- package/dist/commands/template.d.ts +10 -1
- package/dist/commands/template.js +47 -55
- package/dist/index.js +16 -15
- package/dist/lib/project-utils.js +4 -2
- package/dist/lib/task-utils.d.ts +14 -13
- package/dist/lib/task-utils.js +3 -1
- package/dist/lib/template-engine.d.ts +1 -0
- package/hooks/clawvault/HOOK.md +83 -83
- package/hooks/clawvault/handler.js +816 -816
- package/hooks/clawvault/handler.test.js +263 -263
- package/package.json +94 -94
- package/templates/checkpoint.md +34 -19
- package/templates/daily-note.md +34 -19
- package/templates/daily.md +34 -19
- package/templates/decision.md +39 -17
- package/templates/handoff.md +34 -19
- package/templates/lesson.md +31 -16
- package/templates/person.md +37 -19
- package/templates/project.md +84 -23
- package/templates/task.md +81 -0
- /package/dist/{chunk-AXKYDCNN.js → chunk-RVYA52PY.js} +0 -0
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import { registerTaskCommands } from './register-task-commands.js';
|
|
4
|
-
import { chalkStub, stubResolveVaultPath } from './test-helpers/cli-command-fixtures.js';
|
|
5
|
-
|
|
6
|
-
describe('register-task-commands', () => {
|
|
7
|
-
it('adds enriched task add/list/update options', () => {
|
|
8
|
-
const program = new Command();
|
|
9
|
-
registerTaskCommands(program, {
|
|
10
|
-
chalk: chalkStub,
|
|
11
|
-
resolveVaultPath: stubResolveVaultPath
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const taskCommand = program.commands.find((command) => command.name() === 'task');
|
|
15
|
-
expect(taskCommand).toBeDefined();
|
|
16
|
-
|
|
17
|
-
const addCommand = taskCommand?.commands.find((command) => command.name() === 'add');
|
|
18
|
-
const addFlags = addCommand?.options.map((option) => option.flags) ?? [];
|
|
19
|
-
expect(addFlags).toEqual(expect.arrayContaining([
|
|
20
|
-
'--due <date>',
|
|
21
|
-
'--tags <tags>',
|
|
22
|
-
'--description <description>',
|
|
23
|
-
'--estimate <estimate>',
|
|
24
|
-
'--parent <slug>',
|
|
25
|
-
'--depends-on <slugs>'
|
|
26
|
-
]));
|
|
27
|
-
|
|
28
|
-
const listCommand = taskCommand?.commands.find((command) => command.name() === 'list');
|
|
29
|
-
const listFlags = listCommand?.options.map((option) => option.flags) ?? [];
|
|
30
|
-
expect(listFlags).toEqual(expect.arrayContaining([
|
|
31
|
-
'--due',
|
|
32
|
-
'--tag <tag>',
|
|
33
|
-
'--overdue'
|
|
34
|
-
]));
|
|
35
|
-
|
|
36
|
-
const updateCommand = taskCommand?.commands.find((command) => command.name() === 'update');
|
|
37
|
-
const updateFlags = updateCommand?.options.map((option) => option.flags) ?? [];
|
|
38
|
-
expect(updateFlags).toEqual(expect.arrayContaining([
|
|
39
|
-
'--tags <tags>',
|
|
40
|
-
'--description <description>',
|
|
41
|
-
'--estimate <estimate>',
|
|
42
|
-
'--parent <slug>',
|
|
43
|
-
'--depends-on <slugs>',
|
|
44
|
-
'--clear-due',
|
|
45
|
-
'--clear-tags',
|
|
46
|
-
'--clear-description',
|
|
47
|
-
'--clear-estimate',
|
|
48
|
-
'--clear-parent',
|
|
49
|
-
'--clear-depends-on'
|
|
50
|
-
]));
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('adds simplified canvas flags', () => {
|
|
54
|
-
const program = new Command();
|
|
55
|
-
registerTaskCommands(program, {
|
|
56
|
-
chalk: chalkStub,
|
|
57
|
-
resolveVaultPath: stubResolveVaultPath
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
const canvasCommand = program.commands.find((command) => command.name() === 'canvas');
|
|
61
|
-
expect(canvasCommand).toBeDefined();
|
|
62
|
-
|
|
63
|
-
const optionFlags = canvasCommand?.options.map((option) => option.flags) ?? [];
|
|
64
|
-
expect(optionFlags).toEqual(expect.arrayContaining([
|
|
65
|
-
'-v, --vault <path>',
|
|
66
|
-
'--output <path>'
|
|
67
|
-
]));
|
|
68
|
-
});
|
|
69
|
-
});
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { registerTaskCommands } from './register-task-commands.js';
|
|
4
|
+
import { chalkStub, stubResolveVaultPath } from './test-helpers/cli-command-fixtures.js';
|
|
5
|
+
|
|
6
|
+
describe('register-task-commands', () => {
|
|
7
|
+
it('adds enriched task add/list/update options', () => {
|
|
8
|
+
const program = new Command();
|
|
9
|
+
registerTaskCommands(program, {
|
|
10
|
+
chalk: chalkStub,
|
|
11
|
+
resolveVaultPath: stubResolveVaultPath
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const taskCommand = program.commands.find((command) => command.name() === 'task');
|
|
15
|
+
expect(taskCommand).toBeDefined();
|
|
16
|
+
|
|
17
|
+
const addCommand = taskCommand?.commands.find((command) => command.name() === 'add');
|
|
18
|
+
const addFlags = addCommand?.options.map((option) => option.flags) ?? [];
|
|
19
|
+
expect(addFlags).toEqual(expect.arrayContaining([
|
|
20
|
+
'--due <date>',
|
|
21
|
+
'--tags <tags>',
|
|
22
|
+
'--description <description>',
|
|
23
|
+
'--estimate <estimate>',
|
|
24
|
+
'--parent <slug>',
|
|
25
|
+
'--depends-on <slugs>'
|
|
26
|
+
]));
|
|
27
|
+
|
|
28
|
+
const listCommand = taskCommand?.commands.find((command) => command.name() === 'list');
|
|
29
|
+
const listFlags = listCommand?.options.map((option) => option.flags) ?? [];
|
|
30
|
+
expect(listFlags).toEqual(expect.arrayContaining([
|
|
31
|
+
'--due',
|
|
32
|
+
'--tag <tag>',
|
|
33
|
+
'--overdue'
|
|
34
|
+
]));
|
|
35
|
+
|
|
36
|
+
const updateCommand = taskCommand?.commands.find((command) => command.name() === 'update');
|
|
37
|
+
const updateFlags = updateCommand?.options.map((option) => option.flags) ?? [];
|
|
38
|
+
expect(updateFlags).toEqual(expect.arrayContaining([
|
|
39
|
+
'--tags <tags>',
|
|
40
|
+
'--description <description>',
|
|
41
|
+
'--estimate <estimate>',
|
|
42
|
+
'--parent <slug>',
|
|
43
|
+
'--depends-on <slugs>',
|
|
44
|
+
'--clear-due',
|
|
45
|
+
'--clear-tags',
|
|
46
|
+
'--clear-description',
|
|
47
|
+
'--clear-estimate',
|
|
48
|
+
'--clear-parent',
|
|
49
|
+
'--clear-depends-on'
|
|
50
|
+
]));
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('adds simplified canvas flags', () => {
|
|
54
|
+
const program = new Command();
|
|
55
|
+
registerTaskCommands(program, {
|
|
56
|
+
chalk: chalkStub,
|
|
57
|
+
resolveVaultPath: stubResolveVaultPath
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const canvasCommand = program.commands.find((command) => command.name() === 'canvas');
|
|
61
|
+
expect(canvasCommand).toBeDefined();
|
|
62
|
+
|
|
63
|
+
const optionFlags = canvasCommand?.options.map((option) => option.flags) ?? [];
|
|
64
|
+
expect(optionFlags).toEqual(expect.arrayContaining([
|
|
65
|
+
'-v, --vault <path>',
|
|
66
|
+
'--output <path>'
|
|
67
|
+
]));
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -1,72 +1,75 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Template command registrations split from main CLI entrypoint.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export function registerTemplateCommands(program, { chalk }) {
|
|
6
|
-
const template = program
|
|
7
|
-
.command('template')
|
|
8
|
-
.description('Manage document templates');
|
|
9
|
-
|
|
10
|
-
template
|
|
11
|
-
.command('list')
|
|
12
|
-
.description('List available templates')
|
|
13
|
-
.option('-v, --vault <path>', 'Vault path')
|
|
14
|
-
.action(async (options) => {
|
|
15
|
-
try {
|
|
16
|
-
const {
|
|
17
|
-
const templates =
|
|
18
|
-
if (templates.length === 0) {
|
|
19
|
-
console.log(chalk.yellow('No templates found.'));
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
console.log(chalk.cyan('\n📄 Templates:\n'));
|
|
23
|
-
for (const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.
|
|
38
|
-
.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
console.
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
.
|
|
58
|
-
.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
console.
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Template command registrations split from main CLI entrypoint.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export function registerTemplateCommands(program, { chalk }) {
|
|
6
|
+
const template = program
|
|
7
|
+
.command('template')
|
|
8
|
+
.description('Manage document templates');
|
|
9
|
+
|
|
10
|
+
template
|
|
11
|
+
.command('list')
|
|
12
|
+
.description('List available templates')
|
|
13
|
+
.option('-v, --vault <path>', 'Vault path')
|
|
14
|
+
.action(async (options) => {
|
|
15
|
+
try {
|
|
16
|
+
const { listTemplateDefinitions } = await import('../dist/commands/template.js');
|
|
17
|
+
const templates = listTemplateDefinitions({ vaultPath: options.vault });
|
|
18
|
+
if (templates.length === 0) {
|
|
19
|
+
console.log(chalk.yellow('No templates found.'));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
console.log(chalk.cyan('\n📄 Templates:\n'));
|
|
23
|
+
for (const templateDef of templates) {
|
|
24
|
+
const fieldSummary = templateDef.fields.length > 0
|
|
25
|
+
? ` (${templateDef.fields.join(', ')})`
|
|
26
|
+
: '';
|
|
27
|
+
console.log(`- ${templateDef.name}${fieldSummary}`);
|
|
28
|
+
}
|
|
29
|
+
console.log();
|
|
30
|
+
} catch (err) {
|
|
31
|
+
console.error(chalk.red(`Error: ${err.message}`));
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
template
|
|
37
|
+
.command('create <name>')
|
|
38
|
+
.description('Create a file from a template')
|
|
39
|
+
.option('-t, --title <title>', 'Document title')
|
|
40
|
+
.option('-v, --vault <path>', 'Vault path')
|
|
41
|
+
.action(async (name, options) => {
|
|
42
|
+
try {
|
|
43
|
+
const { createFromTemplate } = await import('../dist/commands/template.js');
|
|
44
|
+
const result = createFromTemplate(name, {
|
|
45
|
+
title: options.title,
|
|
46
|
+
vaultPath: options.vault
|
|
47
|
+
});
|
|
48
|
+
console.log(chalk.green(`✓ Created from template: ${name}`));
|
|
49
|
+
console.log(chalk.dim(` Output: ${result.outputPath}`));
|
|
50
|
+
} catch (err) {
|
|
51
|
+
console.error(chalk.red(`Error: ${err.message}`));
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
template
|
|
57
|
+
.command('add <file>')
|
|
58
|
+
.description('Add a custom template')
|
|
59
|
+
.requiredOption('--name <name>', 'Template name')
|
|
60
|
+
.option('-v, --vault <path>', 'Vault path')
|
|
61
|
+
.action(async (file, options) => {
|
|
62
|
+
try {
|
|
63
|
+
const { addTemplate } = await import('../dist/commands/template.js');
|
|
64
|
+
const result = addTemplate(file, {
|
|
65
|
+
name: options.name,
|
|
66
|
+
vaultPath: options.vault
|
|
67
|
+
});
|
|
68
|
+
console.log(chalk.green(`✓ Template added: ${result.name}`));
|
|
69
|
+
console.log(chalk.dim(` Path: ${result.templatePath}`));
|
|
70
|
+
} catch (err) {
|
|
71
|
+
console.error(chalk.red(`Error: ${err.message}`));
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { registerTemplateCommands } from './register-template-commands.js';
|
|
4
|
+
import { chalkStub } from './test-helpers/cli-command-fixtures.js';
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
listTemplateDefinitionsMock,
|
|
8
|
+
createFromTemplateMock,
|
|
9
|
+
addTemplateMock
|
|
10
|
+
} = vi.hoisted(() => ({
|
|
11
|
+
listTemplateDefinitionsMock: vi.fn(),
|
|
12
|
+
createFromTemplateMock: vi.fn(),
|
|
13
|
+
addTemplateMock: vi.fn()
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
vi.mock('../dist/commands/template.js', () => ({
|
|
17
|
+
listTemplateDefinitions: listTemplateDefinitionsMock,
|
|
18
|
+
createFromTemplate: createFromTemplateMock,
|
|
19
|
+
addTemplate: addTemplateMock
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
function buildProgram() {
|
|
23
|
+
const program = new Command();
|
|
24
|
+
registerTemplateCommands(program, { chalk: chalkStub });
|
|
25
|
+
return program;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function runCommand(args) {
|
|
29
|
+
const program = buildProgram();
|
|
30
|
+
await program.parseAsync(args, { from: 'user' });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
describe('register-template-commands', () => {
|
|
34
|
+
beforeEach(() => {
|
|
35
|
+
vi.clearAllMocks();
|
|
36
|
+
listTemplateDefinitionsMock.mockReturnValue([]);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('registers list/create/add template subcommands', () => {
|
|
40
|
+
const program = buildProgram();
|
|
41
|
+
const templateCommand = program.commands.find((command) => command.name() === 'template');
|
|
42
|
+
expect(templateCommand).toBeDefined();
|
|
43
|
+
expect(templateCommand?.commands.map((command) => command.name())).toEqual(
|
|
44
|
+
expect.arrayContaining(['list', 'create', 'add'])
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('prints template fields in list output', async () => {
|
|
49
|
+
listTemplateDefinitionsMock.mockReturnValue([
|
|
50
|
+
{ name: 'task', fields: ['status', 'owner'] },
|
|
51
|
+
{ name: 'project', fields: ['status', 'client'] }
|
|
52
|
+
]);
|
|
53
|
+
|
|
54
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
55
|
+
try {
|
|
56
|
+
await runCommand(['template', 'list']);
|
|
57
|
+
expect(logSpy).toHaveBeenCalledWith('- task (status, owner)');
|
|
58
|
+
expect(logSpy).toHaveBeenCalledWith('- project (status, client)');
|
|
59
|
+
} finally {
|
|
60
|
+
logSpy.mockRestore();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('dispatches create and add operations to template command handlers', async () => {
|
|
65
|
+
createFromTemplateMock.mockReturnValue({
|
|
66
|
+
outputPath: '/tmp/task.md',
|
|
67
|
+
templatePath: '/templates/task.md',
|
|
68
|
+
variables: { title: 'Task', type: 'task', date: '2026-02-16', datetime: '2026-02-16T00:00:00.000Z' }
|
|
69
|
+
});
|
|
70
|
+
addTemplateMock.mockReturnValue({
|
|
71
|
+
templatePath: '/vault/templates/custom.md',
|
|
72
|
+
name: 'custom'
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
await runCommand(['template', 'create', 'task', '--title', 'Ship It']);
|
|
76
|
+
expect(createFromTemplateMock).toHaveBeenCalledWith('task', {
|
|
77
|
+
title: 'Ship It',
|
|
78
|
+
vaultPath: undefined
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
await runCommand(['template', 'add', 'source.md', '--name', 'custom']);
|
|
82
|
+
expect(addTemplateMock).toHaveBeenCalledWith('source.md', {
|
|
83
|
+
name: 'custom',
|
|
84
|
+
vaultPath: undefined
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
});
|