@hasna/todos 0.1.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/LICENSE +190 -0
- package/dist/cli/index.js +8670 -0
- package/dist/index.d.ts +236 -0
- package/dist/index.js +711 -0
- package/dist/mcp/index.js +4882 -0
- package/package.json +57 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// Task statuses
|
|
2
|
+
export const TASK_STATUSES = [
|
|
3
|
+
"pending",
|
|
4
|
+
"in_progress",
|
|
5
|
+
"completed",
|
|
6
|
+
"failed",
|
|
7
|
+
"cancelled",
|
|
8
|
+
] as const;
|
|
9
|
+
export type TaskStatus = (typeof TASK_STATUSES)[number];
|
|
10
|
+
|
|
11
|
+
// Task priorities
|
|
12
|
+
export const TASK_PRIORITIES = [
|
|
13
|
+
"low",
|
|
14
|
+
"medium",
|
|
15
|
+
"high",
|
|
16
|
+
"critical",
|
|
17
|
+
] as const;
|
|
18
|
+
export type TaskPriority = (typeof TASK_PRIORITIES)[number];
|
|
19
|
+
|
|
20
|
+
// Project
|
|
21
|
+
export interface Project {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
path: string;
|
|
25
|
+
description: string | null;
|
|
26
|
+
created_at: string;
|
|
27
|
+
updated_at: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CreateProjectInput {
|
|
31
|
+
name: string;
|
|
32
|
+
path: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Task
|
|
37
|
+
export interface Task {
|
|
38
|
+
id: string;
|
|
39
|
+
project_id: string | null;
|
|
40
|
+
parent_id: string | null;
|
|
41
|
+
title: string;
|
|
42
|
+
description: string | null;
|
|
43
|
+
status: TaskStatus;
|
|
44
|
+
priority: TaskPriority;
|
|
45
|
+
agent_id: string | null;
|
|
46
|
+
assigned_to: string | null;
|
|
47
|
+
session_id: string | null;
|
|
48
|
+
working_dir: string | null;
|
|
49
|
+
tags: string[]; // stored as JSON in DB
|
|
50
|
+
metadata: Record<string, unknown>; // stored as JSON in DB
|
|
51
|
+
version: number;
|
|
52
|
+
locked_by: string | null;
|
|
53
|
+
locked_at: string | null;
|
|
54
|
+
created_at: string;
|
|
55
|
+
updated_at: string;
|
|
56
|
+
completed_at: string | null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Task with relations loaded
|
|
60
|
+
export interface TaskWithRelations extends Task {
|
|
61
|
+
subtasks: Task[];
|
|
62
|
+
dependencies: Task[];
|
|
63
|
+
blocked_by: Task[];
|
|
64
|
+
comments: TaskComment[];
|
|
65
|
+
parent: Task | null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface CreateTaskInput {
|
|
69
|
+
title: string;
|
|
70
|
+
description?: string;
|
|
71
|
+
project_id?: string;
|
|
72
|
+
parent_id?: string;
|
|
73
|
+
status?: TaskStatus;
|
|
74
|
+
priority?: TaskPriority;
|
|
75
|
+
agent_id?: string;
|
|
76
|
+
assigned_to?: string;
|
|
77
|
+
session_id?: string;
|
|
78
|
+
working_dir?: string;
|
|
79
|
+
tags?: string[];
|
|
80
|
+
metadata?: Record<string, unknown>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface UpdateTaskInput {
|
|
84
|
+
title?: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
status?: TaskStatus;
|
|
87
|
+
priority?: TaskPriority;
|
|
88
|
+
assigned_to?: string;
|
|
89
|
+
tags?: string[];
|
|
90
|
+
metadata?: Record<string, unknown>;
|
|
91
|
+
version: number; // required for optimistic locking
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface TaskFilter {
|
|
95
|
+
project_id?: string;
|
|
96
|
+
parent_id?: string | null;
|
|
97
|
+
status?: TaskStatus | TaskStatus[];
|
|
98
|
+
priority?: TaskPriority | TaskPriority[];
|
|
99
|
+
assigned_to?: string;
|
|
100
|
+
agent_id?: string;
|
|
101
|
+
session_id?: string;
|
|
102
|
+
tags?: string[];
|
|
103
|
+
include_subtasks?: boolean;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Task dependency
|
|
107
|
+
export interface TaskDependency {
|
|
108
|
+
task_id: string;
|
|
109
|
+
depends_on: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Task comment
|
|
113
|
+
export interface TaskComment {
|
|
114
|
+
id: string;
|
|
115
|
+
task_id: string;
|
|
116
|
+
agent_id: string | null;
|
|
117
|
+
session_id: string | null;
|
|
118
|
+
content: string;
|
|
119
|
+
created_at: string;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface CreateCommentInput {
|
|
123
|
+
task_id: string;
|
|
124
|
+
content: string;
|
|
125
|
+
agent_id?: string;
|
|
126
|
+
session_id?: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Session
|
|
130
|
+
export interface Session {
|
|
131
|
+
id: string;
|
|
132
|
+
agent_id: string | null;
|
|
133
|
+
project_id: string | null;
|
|
134
|
+
working_dir: string | null;
|
|
135
|
+
started_at: string;
|
|
136
|
+
last_activity: string;
|
|
137
|
+
metadata: Record<string, unknown>;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface CreateSessionInput {
|
|
141
|
+
agent_id?: string;
|
|
142
|
+
project_id?: string;
|
|
143
|
+
working_dir?: string;
|
|
144
|
+
metadata?: Record<string, unknown>;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// DB row types (raw from SQLite - JSON fields are strings)
|
|
148
|
+
export interface TaskRow {
|
|
149
|
+
id: string;
|
|
150
|
+
project_id: string | null;
|
|
151
|
+
parent_id: string | null;
|
|
152
|
+
title: string;
|
|
153
|
+
description: string | null;
|
|
154
|
+
status: string;
|
|
155
|
+
priority: string;
|
|
156
|
+
agent_id: string | null;
|
|
157
|
+
assigned_to: string | null;
|
|
158
|
+
session_id: string | null;
|
|
159
|
+
working_dir: string | null;
|
|
160
|
+
tags: string | null;
|
|
161
|
+
metadata: string | null;
|
|
162
|
+
version: number;
|
|
163
|
+
locked_by: string | null;
|
|
164
|
+
locked_at: string | null;
|
|
165
|
+
created_at: string;
|
|
166
|
+
updated_at: string;
|
|
167
|
+
completed_at: string | null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface SessionRow {
|
|
171
|
+
id: string;
|
|
172
|
+
agent_id: string | null;
|
|
173
|
+
project_id: string | null;
|
|
174
|
+
working_dir: string | null;
|
|
175
|
+
started_at: string;
|
|
176
|
+
last_activity: string;
|
|
177
|
+
metadata: string | null;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Locking
|
|
181
|
+
export interface LockResult {
|
|
182
|
+
success: boolean;
|
|
183
|
+
locked_by?: string;
|
|
184
|
+
locked_at?: string;
|
|
185
|
+
error?: string;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Version conflict error
|
|
189
|
+
export class VersionConflictError extends Error {
|
|
190
|
+
constructor(
|
|
191
|
+
public taskId: string,
|
|
192
|
+
public expectedVersion: number,
|
|
193
|
+
public actualVersion: number,
|
|
194
|
+
) {
|
|
195
|
+
super(
|
|
196
|
+
`Version conflict for task ${taskId}: expected ${expectedVersion}, got ${actualVersion}`,
|
|
197
|
+
);
|
|
198
|
+
this.name = "VersionConflictError";
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export class TaskNotFoundError extends Error {
|
|
203
|
+
constructor(public taskId: string) {
|
|
204
|
+
super(`Task not found: ${taskId}`);
|
|
205
|
+
this.name = "TaskNotFoundError";
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export class ProjectNotFoundError extends Error {
|
|
210
|
+
constructor(public projectId: string) {
|
|
211
|
+
super(`Project not found: ${projectId}`);
|
|
212
|
+
this.name = "ProjectNotFoundError";
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export class LockError extends Error {
|
|
217
|
+
constructor(
|
|
218
|
+
public taskId: string,
|
|
219
|
+
public lockedBy: string,
|
|
220
|
+
) {
|
|
221
|
+
super(`Task ${taskId} is locked by ${lockedBy}`);
|
|
222
|
+
this.name = "LockError";
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export class DependencyCycleError extends Error {
|
|
227
|
+
constructor(
|
|
228
|
+
public taskId: string,
|
|
229
|
+
public dependsOn: string,
|
|
230
|
+
) {
|
|
231
|
+
super(
|
|
232
|
+
`Adding dependency ${taskId} -> ${dependsOn} would create a cycle`,
|
|
233
|
+
);
|
|
234
|
+
this.name = "DependencyCycleError";
|
|
235
|
+
}
|
|
236
|
+
}
|