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.
Files changed (82) hide show
  1. package/README.md +159 -159
  2. package/bin/clawvault.js +111 -111
  3. package/bin/command-registration.test.js +166 -166
  4. package/bin/command-runtime.js +93 -93
  5. package/bin/command-runtime.test.js +154 -154
  6. package/bin/help-contract.test.js +39 -39
  7. package/bin/register-config-commands.js +153 -153
  8. package/bin/register-config-route-commands.test.js +121 -121
  9. package/bin/register-core-commands.js +237 -237
  10. package/bin/register-kanban-commands.js +56 -56
  11. package/bin/register-kanban-commands.test.js +83 -83
  12. package/bin/register-maintenance-commands.js +282 -282
  13. package/bin/register-project-commands.js +209 -209
  14. package/bin/register-project-commands.test.js +206 -206
  15. package/bin/register-query-commands.js +317 -317
  16. package/bin/register-query-commands.test.js +65 -65
  17. package/bin/register-resilience-commands.js +182 -182
  18. package/bin/register-resilience-commands.test.js +81 -81
  19. package/bin/register-route-commands.js +114 -114
  20. package/bin/register-session-lifecycle-commands.js +206 -206
  21. package/bin/register-tailscale-commands.js +106 -106
  22. package/bin/register-task-commands.js +348 -348
  23. package/bin/register-task-commands.test.js +69 -69
  24. package/bin/register-template-commands.js +75 -72
  25. package/bin/register-template-commands.test.js +87 -0
  26. package/bin/register-vault-operations-commands.js +300 -300
  27. package/bin/test-helpers/cli-command-fixtures.js +119 -119
  28. package/dashboard/lib/graph-diff.js +104 -104
  29. package/dashboard/lib/graph-diff.test.js +75 -75
  30. package/dashboard/lib/vault-parser.js +556 -556
  31. package/dashboard/lib/vault-parser.test.js +254 -254
  32. package/dashboard/public/app.js +796 -796
  33. package/dashboard/public/index.html +52 -52
  34. package/dashboard/public/styles.css +221 -221
  35. package/dashboard/server.js +374 -374
  36. package/dist/{chunk-J5EMBUPK.js → chunk-4OXMU5S2.js} +1 -1
  37. package/dist/{chunk-4IV3R2F5.js → chunk-4TE4JMLA.js} +1 -1
  38. package/dist/{chunk-5GZFTAL7.js → chunk-AZYOKJYC.js} +128 -42
  39. package/dist/{chunk-JDLOL2PL.js → chunk-HA5M6KJB.js} +1 -1
  40. package/dist/{chunk-IZEY5S74.js → chunk-IEVLHNLU.js} +1 -1
  41. package/dist/{chunk-OSMS7QIG.js → chunk-ME37YNW3.js} +2 -2
  42. package/dist/chunk-MFAWT5O5.js +301 -0
  43. package/dist/{chunk-TPDH3JPP.js → chunk-PBEE567J.js} +1 -1
  44. package/dist/{chunk-S2IG7VNM.js → chunk-Q2J5YTUF.js} +2 -2
  45. package/dist/{chunk-IOALNTAN.js → chunk-QWQ3TIKS.js} +103 -29
  46. package/dist/{chunk-YCVDVI5B.js → chunk-R2MIW5G7.js} +1 -1
  47. package/dist/{chunk-W2HNZC22.js → chunk-UEOUADMO.js} +1 -1
  48. package/dist/cli/index.js +8 -6
  49. package/dist/commands/backlog.js +3 -1
  50. package/dist/commands/blocked.js +3 -1
  51. package/dist/commands/canvas.js +3 -1
  52. package/dist/commands/doctor.js +7 -5
  53. package/dist/commands/kanban.js +4 -2
  54. package/dist/commands/observe.js +7 -5
  55. package/dist/commands/project.js +5 -3
  56. package/dist/commands/rebuild.js +6 -4
  57. package/dist/commands/replay.js +6 -4
  58. package/dist/commands/setup.js +1 -1
  59. package/dist/commands/sleep.js +5 -3
  60. package/dist/commands/status.js +6 -4
  61. package/dist/commands/task.js +4 -2
  62. package/dist/commands/template.d.ts +10 -1
  63. package/dist/commands/template.js +47 -55
  64. package/dist/index.js +16 -15
  65. package/dist/lib/project-utils.js +4 -2
  66. package/dist/lib/task-utils.d.ts +14 -13
  67. package/dist/lib/task-utils.js +3 -1
  68. package/dist/lib/template-engine.d.ts +1 -0
  69. package/hooks/clawvault/HOOK.md +83 -83
  70. package/hooks/clawvault/handler.js +816 -816
  71. package/hooks/clawvault/handler.test.js +263 -263
  72. package/package.json +94 -94
  73. package/templates/checkpoint.md +34 -19
  74. package/templates/daily-note.md +34 -19
  75. package/templates/daily.md +34 -19
  76. package/templates/decision.md +39 -17
  77. package/templates/handoff.md +34 -19
  78. package/templates/lesson.md +31 -16
  79. package/templates/person.md +37 -19
  80. package/templates/project.md +84 -23
  81. package/templates/task.md +81 -0
  82. /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 { listTemplates } = await import('../dist/commands/template.js');
17
- const templates = listTemplates({ 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 name of templates) {
24
- console.log(`- ${name}`);
25
- }
26
- console.log();
27
- } catch (err) {
28
- console.error(chalk.red(`Error: ${err.message}`));
29
- process.exit(1);
30
- }
31
- });
32
-
33
- template
34
- .command('create <name>')
35
- .description('Create a file from a template')
36
- .option('-t, --title <title>', 'Document title')
37
- .option('-v, --vault <path>', 'Vault path')
38
- .action(async (name, options) => {
39
- try {
40
- const { createFromTemplate } = await import('../dist/commands/template.js');
41
- const result = createFromTemplate(name, {
42
- title: options.title,
43
- vaultPath: options.vault
44
- });
45
- console.log(chalk.green(`✓ Created from template: ${name}`));
46
- console.log(chalk.dim(` Output: ${result.outputPath}`));
47
- } catch (err) {
48
- console.error(chalk.red(`Error: ${err.message}`));
49
- process.exit(1);
50
- }
51
- });
52
-
53
- template
54
- .command('add <file>')
55
- .description('Add a custom template')
56
- .requiredOption('--name <name>', 'Template name')
57
- .option('-v, --vault <path>', 'Vault path')
58
- .action(async (file, options) => {
59
- try {
60
- const { addTemplate } = await import('../dist/commands/template.js');
61
- const result = addTemplate(file, {
62
- name: options.name,
63
- vaultPath: options.vault
64
- });
65
- console.log(chalk.green(`✓ Template added: ${result.name}`));
66
- console.log(chalk.dim(` Path: ${result.templatePath}`));
67
- } catch (err) {
68
- console.error(chalk.red(`Error: ${err.message}`));
69
- process.exit(1);
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
+ });