@lumenflow/cli 3.6.6 → 3.6.7

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 (67) hide show
  1. package/dist/init.js +78 -7
  2. package/dist/init.js.map +1 -1
  3. package/dist/initiative-create.js +74 -23
  4. package/dist/initiative-create.js.map +1 -1
  5. package/dist/lane-lock.js +62 -1
  6. package/dist/lane-lock.js.map +1 -1
  7. package/dist/lane-setup.js +102 -28
  8. package/dist/lane-setup.js.map +1 -1
  9. package/dist/lane-status.js +42 -0
  10. package/dist/lane-status.js.map +1 -1
  11. package/dist/lane-validate.js +62 -1
  12. package/dist/lane-validate.js.map +1 -1
  13. package/dist/plan-link.js +25 -2
  14. package/dist/plan-link.js.map +1 -1
  15. package/dist/public-manifest.js +7 -0
  16. package/dist/public-manifest.js.map +1 -1
  17. package/dist/release.js +17 -0
  18. package/dist/release.js.map +1 -1
  19. package/dist/state-doctor-fix.js +12 -11
  20. package/dist/state-doctor-fix.js.map +1 -1
  21. package/dist/state-emit.js +198 -0
  22. package/dist/state-emit.js.map +1 -0
  23. package/dist/wu-claim-state.js +58 -15
  24. package/dist/wu-claim-state.js.map +1 -1
  25. package/dist/wu-claim-worktree.js +3 -3
  26. package/dist/wu-claim-worktree.js.map +1 -1
  27. package/dist/wu-claim.js +19 -1
  28. package/dist/wu-claim.js.map +1 -1
  29. package/dist/wu-create-content.js +2 -4
  30. package/dist/wu-create-content.js.map +1 -1
  31. package/dist/wu-create-validation.js +14 -1
  32. package/dist/wu-create-validation.js.map +1 -1
  33. package/dist/wu-create.js +2 -6
  34. package/dist/wu-create.js.map +1 -1
  35. package/dist/wu-done.js +95 -4
  36. package/dist/wu-done.js.map +1 -1
  37. package/dist/wu-edit-operations.js +36 -5
  38. package/dist/wu-edit-operations.js.map +1 -1
  39. package/dist/wu-recover.js +115 -12
  40. package/dist/wu-recover.js.map +1 -1
  41. package/package.json +9 -8
  42. package/packs/sidekick/.turbo/turbo-build.log +4 -0
  43. package/packs/sidekick/README.md +194 -0
  44. package/packs/sidekick/constants.ts +10 -0
  45. package/packs/sidekick/index.ts +8 -0
  46. package/packs/sidekick/manifest-schema.ts +262 -0
  47. package/packs/sidekick/manifest.ts +333 -0
  48. package/packs/sidekick/manifest.yaml +406 -0
  49. package/packs/sidekick/pack-registration.ts +110 -0
  50. package/packs/sidekick/package.json +55 -0
  51. package/packs/sidekick/tool-impl/channel-tools.ts +226 -0
  52. package/packs/sidekick/tool-impl/index.ts +22 -0
  53. package/packs/sidekick/tool-impl/memory-tools.ts +188 -0
  54. package/packs/sidekick/tool-impl/routine-tools.ts +194 -0
  55. package/packs/sidekick/tool-impl/shared.ts +124 -0
  56. package/packs/sidekick/tool-impl/storage.ts +315 -0
  57. package/packs/sidekick/tool-impl/system-tools.ts +155 -0
  58. package/packs/sidekick/tool-impl/task-tools.ts +278 -0
  59. package/packs/sidekick/tools/channel-tools.ts +53 -0
  60. package/packs/sidekick/tools/index.ts +9 -0
  61. package/packs/sidekick/tools/memory-tools.ts +53 -0
  62. package/packs/sidekick/tools/routine-tools.ts +53 -0
  63. package/packs/sidekick/tools/system-tools.ts +47 -0
  64. package/packs/sidekick/tools/task-tools.ts +61 -0
  65. package/packs/sidekick/tools/types.ts +57 -0
  66. package/packs/sidekick/tsconfig.json +20 -0
  67. package/templates/core/ai/onboarding/starting-prompt.md.template +33 -2
@@ -0,0 +1,278 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
4
+ import { getStoragePort, type TaskPriority, type TaskRecord } from './storage.js';
5
+ import {
6
+ asInteger,
7
+ asNonEmptyString,
8
+ asStringArray,
9
+ buildAuditEvent,
10
+ createId,
11
+ failure,
12
+ isDryRun,
13
+ matchesTags,
14
+ nowIso,
15
+ success,
16
+ toRecord,
17
+ type ToolContextLike,
18
+ type ToolOutput,
19
+ } from './shared.js';
20
+
21
+ // ---------------------------------------------------------------------------
22
+ // Constants
23
+ // ---------------------------------------------------------------------------
24
+
25
+ const TOOL_NAMES = {
26
+ CREATE: 'task:create',
27
+ LIST: 'task:list',
28
+ COMPLETE: 'task:complete',
29
+ SCHEDULE: 'task:schedule',
30
+ } as const;
31
+
32
+ const VALID_PRIORITIES: TaskPriority[] = ['P0', 'P1', 'P2', 'P3'];
33
+ const DEFAULT_PRIORITY: TaskPriority = 'P2';
34
+
35
+ // ---------------------------------------------------------------------------
36
+ // Helpers
37
+ // ---------------------------------------------------------------------------
38
+
39
+ function asPriority(value: unknown): TaskPriority {
40
+ return VALID_PRIORITIES.includes(value as TaskPriority)
41
+ ? (value as TaskPriority)
42
+ : DEFAULT_PRIORITY;
43
+ }
44
+
45
+ // ---------------------------------------------------------------------------
46
+ // task:create
47
+ // ---------------------------------------------------------------------------
48
+
49
+ async function taskCreateTool(input: unknown, context?: ToolContextLike): Promise<ToolOutput> {
50
+ const parsed = toRecord(input);
51
+ const title = asNonEmptyString(parsed.title);
52
+
53
+ if (!title) {
54
+ return failure('INVALID_INPUT', 'title is required.');
55
+ }
56
+
57
+ const task: TaskRecord = {
58
+ id: createId('task'),
59
+ title,
60
+ description: asNonEmptyString(parsed.description) ?? undefined,
61
+ priority: asPriority(parsed.priority),
62
+ status: 'pending',
63
+ tags: asStringArray(parsed.tags),
64
+ due_at: asNonEmptyString(parsed.due_at) ?? undefined,
65
+ created_at: nowIso(),
66
+ updated_at: nowIso(),
67
+ };
68
+
69
+ if (isDryRun(parsed)) {
70
+ return success({ dry_run: true, task: task as unknown as Record<string, unknown> });
71
+ }
72
+
73
+ const storage = getStoragePort();
74
+ await storage.withLock(async () => {
75
+ const tasks = await storage.readStore('tasks');
76
+ tasks.push(task);
77
+ await storage.writeStore('tasks', tasks);
78
+ await storage.appendAudit(
79
+ buildAuditEvent({
80
+ tool: TOOL_NAMES.CREATE,
81
+ op: 'create',
82
+ context,
83
+ ids: [task.id],
84
+ }),
85
+ );
86
+ });
87
+
88
+ return success({ task: task as unknown as Record<string, unknown> });
89
+ }
90
+
91
+ // ---------------------------------------------------------------------------
92
+ // task:list
93
+ // ---------------------------------------------------------------------------
94
+
95
+ async function taskListTool(input: unknown, _context?: ToolContextLike): Promise<ToolOutput> {
96
+ const parsed = toRecord(input);
97
+ const statusFilter = asNonEmptyString(parsed.status);
98
+ const priorityFilter = asNonEmptyString(parsed.priority);
99
+ const tags = asStringArray(parsed.tags);
100
+ const dueBefore = asNonEmptyString(parsed.due_before);
101
+ const limit = asInteger(parsed.limit);
102
+
103
+ const storage = getStoragePort();
104
+ const tasks = await storage.readStore('tasks');
105
+
106
+ const filtered = tasks.filter((task) => {
107
+ if (statusFilter && task.status !== statusFilter) {
108
+ return false;
109
+ }
110
+ if (priorityFilter && task.priority !== priorityFilter) {
111
+ return false;
112
+ }
113
+ if (!matchesTags(tags, task.tags)) {
114
+ return false;
115
+ }
116
+ if (dueBefore && task.due_at) {
117
+ if (Date.parse(task.due_at) >= Date.parse(dueBefore)) {
118
+ return false;
119
+ }
120
+ }
121
+ if (dueBefore && !task.due_at) {
122
+ return false;
123
+ }
124
+ return true;
125
+ });
126
+
127
+ const sorted = filtered.toSorted((a, b) => Date.parse(b.updated_at) - Date.parse(a.updated_at));
128
+
129
+ const items = limit && limit > 0 ? sorted.slice(0, limit) : sorted;
130
+
131
+ return success({
132
+ items: items as unknown as Record<string, unknown>,
133
+ count: items.length,
134
+ });
135
+ }
136
+
137
+ // ---------------------------------------------------------------------------
138
+ // task:complete
139
+ // ---------------------------------------------------------------------------
140
+
141
+ async function taskCompleteTool(input: unknown, context?: ToolContextLike): Promise<ToolOutput> {
142
+ const parsed = toRecord(input);
143
+ const id = asNonEmptyString(parsed.id);
144
+
145
+ if (!id) {
146
+ return failure('INVALID_INPUT', 'id is required.');
147
+ }
148
+
149
+ const storage = getStoragePort();
150
+ const tasks = await storage.readStore('tasks');
151
+ const task = tasks.find((t) => t.id === id);
152
+
153
+ if (!task) {
154
+ return failure('NOT_FOUND', `task ${id} was not found.`);
155
+ }
156
+
157
+ if (isDryRun(parsed)) {
158
+ const preview = { ...task, status: 'done' as const, completed_at: nowIso() };
159
+ return success({
160
+ dry_run: true,
161
+ task: preview as unknown as Record<string, unknown>,
162
+ });
163
+ }
164
+
165
+ await storage.withLock(async () => {
166
+ const latest = await storage.readStore('tasks');
167
+ const target = latest.find((t) => t.id === id);
168
+ if (target) {
169
+ target.status = 'done';
170
+ target.completed_at = nowIso();
171
+ target.updated_at = nowIso();
172
+ if (parsed.note) {
173
+ target.note = asNonEmptyString(parsed.note) ?? undefined;
174
+ }
175
+ await storage.writeStore('tasks', latest);
176
+ await storage.appendAudit(
177
+ buildAuditEvent({
178
+ tool: TOOL_NAMES.COMPLETE,
179
+ op: 'update',
180
+ context,
181
+ ids: [id],
182
+ }),
183
+ );
184
+ }
185
+ });
186
+
187
+ const updated = await storage.readStore('tasks');
188
+ const completedTask = updated.find((t) => t.id === id);
189
+
190
+ return success({ task: completedTask as unknown as Record<string, unknown> });
191
+ }
192
+
193
+ // ---------------------------------------------------------------------------
194
+ // task:schedule
195
+ // ---------------------------------------------------------------------------
196
+
197
+ async function taskScheduleTool(input: unknown, context?: ToolContextLike): Promise<ToolOutput> {
198
+ const parsed = toRecord(input);
199
+ const id = asNonEmptyString(parsed.id);
200
+
201
+ if (!id) {
202
+ return failure('INVALID_INPUT', 'id is required.');
203
+ }
204
+
205
+ const storage = getStoragePort();
206
+ const tasks = await storage.readStore('tasks');
207
+ const task = tasks.find((t) => t.id === id);
208
+
209
+ if (!task) {
210
+ return failure('NOT_FOUND', `task ${id} was not found.`);
211
+ }
212
+
213
+ const dueAt = asNonEmptyString(parsed.due_at);
214
+ const cron = asNonEmptyString(parsed.cron);
215
+
216
+ if (isDryRun(parsed)) {
217
+ const preview = {
218
+ ...task,
219
+ ...(dueAt ? { due_at: dueAt } : {}),
220
+ ...(cron ? { cron } : {}),
221
+ };
222
+ return success({
223
+ dry_run: true,
224
+ task: preview as unknown as Record<string, unknown>,
225
+ });
226
+ }
227
+
228
+ await storage.withLock(async () => {
229
+ const latest = await storage.readStore('tasks');
230
+ const target = latest.find((t) => t.id === id);
231
+ if (target) {
232
+ if (dueAt) {
233
+ target.due_at = dueAt;
234
+ }
235
+ // cron is stored but TaskRecord doesn't have it yet -- extend inline
236
+ if (cron) {
237
+ (target as unknown as Record<string, unknown>).cron = cron;
238
+ }
239
+ target.updated_at = nowIso();
240
+ await storage.writeStore('tasks', latest);
241
+ await storage.appendAudit(
242
+ buildAuditEvent({
243
+ tool: TOOL_NAMES.SCHEDULE,
244
+ op: 'update',
245
+ context,
246
+ ids: [id],
247
+ }),
248
+ );
249
+ }
250
+ });
251
+
252
+ const updated = await storage.readStore('tasks');
253
+ const scheduledTask = updated.find((t) => t.id === id);
254
+
255
+ return success({ task: scheduledTask as unknown as Record<string, unknown> });
256
+ }
257
+
258
+ // ---------------------------------------------------------------------------
259
+ // Router (default export)
260
+ // ---------------------------------------------------------------------------
261
+
262
+ export default async function taskTools(
263
+ input: unknown,
264
+ context?: ToolContextLike,
265
+ ): Promise<ToolOutput> {
266
+ switch (context?.tool_name) {
267
+ case TOOL_NAMES.CREATE:
268
+ return taskCreateTool(input, context);
269
+ case TOOL_NAMES.LIST:
270
+ return taskListTool(input, context);
271
+ case TOOL_NAMES.COMPLETE:
272
+ return taskCompleteTool(input, context);
273
+ case TOOL_NAMES.SCHEDULE:
274
+ return taskScheduleTool(input, context);
275
+ default:
276
+ return failure('UNKNOWN_TOOL', `Unknown task tool: ${context?.tool_name ?? 'unknown'}`);
277
+ }
278
+ }
@@ -0,0 +1,53 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
4
+ import {
5
+ TOOL_PERMISSIONS,
6
+ TOOL_SCOPE_ACCESS,
7
+ TOOL_SCOPE_TYPES,
8
+ createToolDescriptor,
9
+ } from './types.js';
10
+
11
+ const CHANNEL_READ_SCOPE = {
12
+ type: TOOL_SCOPE_TYPES.PATH,
13
+ pattern: '.sidekick/channels/**',
14
+ access: TOOL_SCOPE_ACCESS.READ,
15
+ } as const;
16
+
17
+ const CHANNEL_WRITE_SCOPE = {
18
+ type: TOOL_SCOPE_TYPES.PATH,
19
+ pattern: '.sidekick/channels/**',
20
+ access: TOOL_SCOPE_ACCESS.WRITE,
21
+ } as const;
22
+
23
+ const AUDIT_WRITE_SCOPE = {
24
+ type: TOOL_SCOPE_TYPES.PATH,
25
+ pattern: '.sidekick/audit/**',
26
+ access: TOOL_SCOPE_ACCESS.WRITE,
27
+ } as const;
28
+
29
+ const CHANNEL_TOOLS_ENTRY = 'tool-impl/channel-tools.ts';
30
+
31
+ export const channelConfigureDescriptor = createToolDescriptor({
32
+ name: 'channel:configure',
33
+ permission: TOOL_PERMISSIONS.WRITE,
34
+ required_scopes: [CHANNEL_READ_SCOPE, CHANNEL_WRITE_SCOPE, AUDIT_WRITE_SCOPE],
35
+ entry: CHANNEL_TOOLS_ENTRY,
36
+ description: 'Configure a messaging channel (terminal-only in v0.1).',
37
+ });
38
+
39
+ export const channelSendDescriptor = createToolDescriptor({
40
+ name: 'channel:send',
41
+ permission: TOOL_PERMISSIONS.WRITE,
42
+ required_scopes: [CHANNEL_READ_SCOPE, CHANNEL_WRITE_SCOPE, AUDIT_WRITE_SCOPE],
43
+ entry: CHANNEL_TOOLS_ENTRY,
44
+ description: 'Send a message to a channel. Supports dry_run.',
45
+ });
46
+
47
+ export const channelReceiveDescriptor = createToolDescriptor({
48
+ name: 'channel:receive',
49
+ permission: TOOL_PERMISSIONS.READ,
50
+ required_scopes: [CHANNEL_READ_SCOPE],
51
+ entry: CHANNEL_TOOLS_ENTRY,
52
+ description: 'Receive messages from a channel with optional limit and since filter.',
53
+ });
@@ -0,0 +1,9 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
4
+ export * from './types.js';
5
+ export * from './task-tools.js';
6
+ export * from './memory-tools.js';
7
+ export * from './channel-tools.js';
8
+ export * from './routine-tools.js';
9
+ export * from './system-tools.js';
@@ -0,0 +1,53 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
4
+ import {
5
+ TOOL_PERMISSIONS,
6
+ TOOL_SCOPE_ACCESS,
7
+ TOOL_SCOPE_TYPES,
8
+ createToolDescriptor,
9
+ } from './types.js';
10
+
11
+ const MEMORY_READ_SCOPE = {
12
+ type: TOOL_SCOPE_TYPES.PATH,
13
+ pattern: '.sidekick/memory/**',
14
+ access: TOOL_SCOPE_ACCESS.READ,
15
+ } as const;
16
+
17
+ const MEMORY_WRITE_SCOPE = {
18
+ type: TOOL_SCOPE_TYPES.PATH,
19
+ pattern: '.sidekick/memory/**',
20
+ access: TOOL_SCOPE_ACCESS.WRITE,
21
+ } as const;
22
+
23
+ const AUDIT_WRITE_SCOPE = {
24
+ type: TOOL_SCOPE_TYPES.PATH,
25
+ pattern: '.sidekick/audit/**',
26
+ access: TOOL_SCOPE_ACCESS.WRITE,
27
+ } as const;
28
+
29
+ const MEMORY_TOOLS_ENTRY = 'tool-impl/memory-tools.ts';
30
+
31
+ export const memoryStoreDescriptor = createToolDescriptor({
32
+ name: 'memory:store',
33
+ permission: TOOL_PERMISSIONS.WRITE,
34
+ required_scopes: [MEMORY_READ_SCOPE, MEMORY_WRITE_SCOPE, AUDIT_WRITE_SCOPE],
35
+ entry: MEMORY_TOOLS_ENTRY,
36
+ description: 'Store a typed memory entry (fact, preference, note, snippet) with optional tags.',
37
+ });
38
+
39
+ export const memoryRecallDescriptor = createToolDescriptor({
40
+ name: 'memory:recall',
41
+ permission: TOOL_PERMISSIONS.READ,
42
+ required_scopes: [MEMORY_READ_SCOPE],
43
+ entry: MEMORY_TOOLS_ENTRY,
44
+ description: 'Recall memory entries by substring search and/or tag filter.',
45
+ });
46
+
47
+ export const memoryForgetDescriptor = createToolDescriptor({
48
+ name: 'memory:forget',
49
+ permission: TOOL_PERMISSIONS.WRITE,
50
+ required_scopes: [MEMORY_READ_SCOPE, MEMORY_WRITE_SCOPE, AUDIT_WRITE_SCOPE],
51
+ entry: MEMORY_TOOLS_ENTRY,
52
+ description: 'Remove a memory entry by ID. Supports dry_run.',
53
+ });
@@ -0,0 +1,53 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
4
+ import {
5
+ TOOL_PERMISSIONS,
6
+ TOOL_SCOPE_ACCESS,
7
+ TOOL_SCOPE_TYPES,
8
+ createToolDescriptor,
9
+ } from './types.js';
10
+
11
+ const ROUTINE_READ_SCOPE = {
12
+ type: TOOL_SCOPE_TYPES.PATH,
13
+ pattern: '.sidekick/routines/**',
14
+ access: TOOL_SCOPE_ACCESS.READ,
15
+ } as const;
16
+
17
+ const ROUTINE_WRITE_SCOPE = {
18
+ type: TOOL_SCOPE_TYPES.PATH,
19
+ pattern: '.sidekick/routines/**',
20
+ access: TOOL_SCOPE_ACCESS.WRITE,
21
+ } as const;
22
+
23
+ const AUDIT_WRITE_SCOPE = {
24
+ type: TOOL_SCOPE_TYPES.PATH,
25
+ pattern: '.sidekick/audit/**',
26
+ access: TOOL_SCOPE_ACCESS.WRITE,
27
+ } as const;
28
+
29
+ const ROUTINE_TOOLS_ENTRY = 'tool-impl/routine-tools.ts';
30
+
31
+ export const routineCreateDescriptor = createToolDescriptor({
32
+ name: 'routine:create',
33
+ permission: TOOL_PERMISSIONS.WRITE,
34
+ required_scopes: [ROUTINE_READ_SCOPE, ROUTINE_WRITE_SCOPE, AUDIT_WRITE_SCOPE],
35
+ entry: ROUTINE_TOOLS_ENTRY,
36
+ description: 'Create a named routine with ordered tool+input steps and optional cron.',
37
+ });
38
+
39
+ export const routineListDescriptor = createToolDescriptor({
40
+ name: 'routine:list',
41
+ permission: TOOL_PERMISSIONS.READ,
42
+ required_scopes: [ROUTINE_READ_SCOPE],
43
+ entry: ROUTINE_TOOLS_ENTRY,
44
+ description: 'List routines with optional enabled_only filter.',
45
+ });
46
+
47
+ export const routineRunDescriptor = createToolDescriptor({
48
+ name: 'routine:run',
49
+ permission: TOOL_PERMISSIONS.READ,
50
+ required_scopes: [ROUTINE_READ_SCOPE],
51
+ entry: ROUTINE_TOOLS_ENTRY,
52
+ description: 'Generate an execution plan for a routine (plan-only, does not execute).',
53
+ });
@@ -0,0 +1,47 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
4
+ import {
5
+ TOOL_PERMISSIONS,
6
+ TOOL_SCOPE_ACCESS,
7
+ TOOL_SCOPE_TYPES,
8
+ createToolDescriptor,
9
+ } from './types.js';
10
+
11
+ const SIDEKICK_READ_SCOPE = {
12
+ type: TOOL_SCOPE_TYPES.PATH,
13
+ pattern: '.sidekick/**',
14
+ access: TOOL_SCOPE_ACCESS.READ,
15
+ } as const;
16
+
17
+ const SIDEKICK_WRITE_SCOPE = {
18
+ type: TOOL_SCOPE_TYPES.PATH,
19
+ pattern: '.sidekick/**',
20
+ access: TOOL_SCOPE_ACCESS.WRITE,
21
+ } as const;
22
+
23
+ const SYSTEM_TOOLS_ENTRY = 'tool-impl/system-tools.ts';
24
+
25
+ export const sidekickInitDescriptor = createToolDescriptor({
26
+ name: 'sidekick:init',
27
+ permission: TOOL_PERMISSIONS.WRITE,
28
+ required_scopes: [SIDEKICK_READ_SCOPE, SIDEKICK_WRITE_SCOPE],
29
+ entry: SYSTEM_TOOLS_ENTRY,
30
+ description: 'Initialize .sidekick/ directory structure. Idempotent.',
31
+ });
32
+
33
+ export const sidekickStatusDescriptor = createToolDescriptor({
34
+ name: 'sidekick:status',
35
+ permission: TOOL_PERMISSIONS.READ,
36
+ required_scopes: [SIDEKICK_READ_SCOPE],
37
+ entry: SYSTEM_TOOLS_ENTRY,
38
+ description: 'Show sidekick status: store counts, initialized state, version.',
39
+ });
40
+
41
+ export const sidekickExportDescriptor = createToolDescriptor({
42
+ name: 'sidekick:export',
43
+ permission: TOOL_PERMISSIONS.READ,
44
+ required_scopes: [SIDEKICK_READ_SCOPE],
45
+ entry: SYSTEM_TOOLS_ENTRY,
46
+ description: 'Export all sidekick data as a JSON bundle (read-only, no file write).',
47
+ });
@@ -0,0 +1,61 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
4
+ import {
5
+ TOOL_PERMISSIONS,
6
+ TOOL_SCOPE_ACCESS,
7
+ TOOL_SCOPE_TYPES,
8
+ createToolDescriptor,
9
+ } from './types.js';
10
+
11
+ const SIDEKICK_READ_SCOPE = {
12
+ type: TOOL_SCOPE_TYPES.PATH,
13
+ pattern: '.sidekick/tasks/**',
14
+ access: TOOL_SCOPE_ACCESS.READ,
15
+ } as const;
16
+
17
+ const SIDEKICK_WRITE_SCOPE = {
18
+ type: TOOL_SCOPE_TYPES.PATH,
19
+ pattern: '.sidekick/tasks/**',
20
+ access: TOOL_SCOPE_ACCESS.WRITE,
21
+ } as const;
22
+
23
+ const AUDIT_WRITE_SCOPE = {
24
+ type: TOOL_SCOPE_TYPES.PATH,
25
+ pattern: '.sidekick/audit/**',
26
+ access: TOOL_SCOPE_ACCESS.WRITE,
27
+ } as const;
28
+
29
+ const TASK_TOOLS_ENTRY = 'tool-impl/task-tools.ts';
30
+
31
+ export const taskCreateDescriptor = createToolDescriptor({
32
+ name: 'task:create',
33
+ permission: TOOL_PERMISSIONS.WRITE,
34
+ required_scopes: [SIDEKICK_READ_SCOPE, SIDEKICK_WRITE_SCOPE, AUDIT_WRITE_SCOPE],
35
+ entry: TASK_TOOLS_ENTRY,
36
+ description: 'Create a new task with title, priority, due date, and tags.',
37
+ });
38
+
39
+ export const taskListDescriptor = createToolDescriptor({
40
+ name: 'task:list',
41
+ permission: TOOL_PERMISSIONS.READ,
42
+ required_scopes: [SIDEKICK_READ_SCOPE],
43
+ entry: TASK_TOOLS_ENTRY,
44
+ description: 'List tasks with optional filters: status, priority, tag, due_before.',
45
+ });
46
+
47
+ export const taskCompleteDescriptor = createToolDescriptor({
48
+ name: 'task:complete',
49
+ permission: TOOL_PERMISSIONS.WRITE,
50
+ required_scopes: [SIDEKICK_READ_SCOPE, SIDEKICK_WRITE_SCOPE, AUDIT_WRITE_SCOPE],
51
+ entry: TASK_TOOLS_ENTRY,
52
+ description: 'Mark a task as complete. Supports dry_run.',
53
+ });
54
+
55
+ export const taskScheduleDescriptor = createToolDescriptor({
56
+ name: 'task:schedule',
57
+ permission: TOOL_PERMISSIONS.WRITE,
58
+ required_scopes: [SIDEKICK_READ_SCOPE, SIDEKICK_WRITE_SCOPE, AUDIT_WRITE_SCOPE],
59
+ entry: TASK_TOOLS_ENTRY,
60
+ description: 'Set or update a task due date or cron schedule.',
61
+ });
@@ -0,0 +1,57 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
4
+ import { SIDEKICK_DOMAIN, SIDEKICK_PACK_ID, SIDEKICK_PACK_VERSION } from '../constants.js';
5
+
6
+ export const TOOL_SCOPE_TYPES = {
7
+ PATH: 'path',
8
+ } as const;
9
+
10
+ export const TOOL_SCOPE_ACCESS = {
11
+ READ: 'read',
12
+ WRITE: 'write',
13
+ } as const;
14
+
15
+ export const TOOL_PERMISSIONS = {
16
+ READ: 'read',
17
+ WRITE: 'write',
18
+ ADMIN: 'admin',
19
+ } as const;
20
+
21
+ export type ToolScopeType = (typeof TOOL_SCOPE_TYPES)[keyof typeof TOOL_SCOPE_TYPES];
22
+ export type ToolScopeAccess = (typeof TOOL_SCOPE_ACCESS)[keyof typeof TOOL_SCOPE_ACCESS];
23
+ export type ToolPermission = (typeof TOOL_PERMISSIONS)[keyof typeof TOOL_PERMISSIONS];
24
+
25
+ export interface PathScope {
26
+ type: ToolScopeType;
27
+ pattern: string;
28
+ access: ToolScopeAccess;
29
+ }
30
+
31
+ export interface ToolDescriptor {
32
+ name: string;
33
+ domain: typeof SIDEKICK_DOMAIN;
34
+ version: typeof SIDEKICK_PACK_VERSION;
35
+ permission: ToolPermission;
36
+ required_scopes: PathScope[];
37
+ entry: string;
38
+ description: string;
39
+ pack: typeof SIDEKICK_PACK_ID;
40
+ }
41
+
42
+ export interface ToolDescriptorInput {
43
+ name: ToolDescriptor['name'];
44
+ permission: ToolDescriptor['permission'];
45
+ required_scopes: ToolDescriptor['required_scopes'];
46
+ entry: ToolDescriptor['entry'];
47
+ description: ToolDescriptor['description'];
48
+ }
49
+
50
+ export function createToolDescriptor(input: ToolDescriptorInput): ToolDescriptor {
51
+ return {
52
+ ...input,
53
+ domain: SIDEKICK_DOMAIN,
54
+ version: SIDEKICK_PACK_VERSION,
55
+ pack: SIDEKICK_PACK_ID,
56
+ };
57
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "extends": "../../../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "target": "ES2023",
5
+ "lib": ["ES2023"],
6
+ "outDir": "./dist",
7
+ "rootDir": ".",
8
+ "noEmit": false,
9
+ "declaration": true,
10
+ "strict": true,
11
+ "useUnknownInCatchVariables": false,
12
+ "noUnusedLocals": false,
13
+ "noUnusedParameters": false,
14
+ "allowJs": false,
15
+ "checkJs": false,
16
+ "noEmitOnError": true
17
+ },
18
+ "include": ["*.ts", "tools/**/*.ts", "tool-impl/**/*.ts"],
19
+ "exclude": ["node_modules", "dist", "__tests__"]
20
+ }