agkan 2.14.3 → 2.15.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.ja.md +13 -13
- package/README.md +13 -13
- package/dist/board/boardFavicon.d.ts +2 -0
- package/dist/board/boardFavicon.d.ts.map +1 -0
- package/dist/board/boardFavicon.js +5 -0
- package/dist/board/boardFavicon.js.map +1 -0
- package/dist/board/boardRenderer.d.ts +22 -6
- package/dist/board/boardRenderer.d.ts.map +1 -1
- package/dist/board/boardRenderer.js +40 -24
- package/dist/board/boardRenderer.js.map +1 -1
- package/dist/board/boardRoutes.d.ts +2 -2
- package/dist/board/boardRoutes.d.ts.map +1 -1
- package/dist/board/boardRoutes.js +18 -3
- package/dist/board/boardRoutes.js.map +1 -1
- package/dist/board/boardStyles.d.ts +1 -1
- package/dist/board/boardStyles.d.ts.map +1 -1
- package/dist/board/boardStyles.js +14 -6
- package/dist/board/boardStyles.js.map +1 -1
- package/dist/board/client/board.js +369 -13
- package/dist/board/server.d.ts +2 -2
- package/dist/board/server.d.ts.map +1 -1
- package/dist/board/server.js +5 -5
- package/dist/board/server.js.map +1 -1
- package/dist/cli/commands/agent-guide.d.ts.map +1 -1
- package/dist/cli/commands/agent-guide.js +6 -0
- package/dist/cli/commands/agent-guide.js.map +1 -1
- package/dist/cli/commands/board.d.ts.map +1 -1
- package/dist/cli/commands/board.js +202 -15
- package/dist/cli/commands/board.js.map +1 -1
- package/dist/cli/commands/ps.d.ts +7 -0
- package/dist/cli/commands/ps.d.ts.map +1 -0
- package/dist/cli/commands/ps.js +83 -0
- package/dist/cli/commands/ps.js.map +1 -0
- package/dist/cli/commands/task/add.js +1 -1
- package/dist/cli/commands/task/add.js.map +1 -1
- package/dist/cli/commands/task/copy.d.ts +6 -0
- package/dist/cli/commands/task/copy.d.ts.map +1 -0
- package/dist/cli/commands/task/copy.js +118 -0
- package/dist/cli/commands/task/copy.js.map +1 -0
- package/dist/cli/commands/task/list.d.ts.map +1 -1
- package/dist/cli/commands/task/list.js +37 -17
- package/dist/cli/commands/task/list.js.map +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/board-daemon.d.ts +7 -0
- package/dist/cli/utils/board-daemon.d.ts.map +1 -0
- package/dist/cli/utils/board-daemon.js +77 -0
- package/dist/cli/utils/board-daemon.js.map +1 -0
- package/dist/db/adapters/sqlite-storage-backend.d.ts +26 -0
- package/dist/db/adapters/sqlite-storage-backend.d.ts.map +1 -0
- package/dist/db/adapters/sqlite-storage-backend.js +447 -0
- package/dist/db/adapters/sqlite-storage-backend.js.map +1 -0
- package/dist/db/connection.d.ts +14 -0
- package/dist/db/connection.d.ts.map +1 -1
- package/dist/db/connection.js +28 -2
- package/dist/db/connection.js.map +1 -1
- package/dist/db/migrations/20260328000000_initial_schema.d.ts +3 -0
- package/dist/db/migrations/20260328000000_initial_schema.d.ts.map +1 -0
- package/dist/db/migrations/20260328000000_initial_schema.js +218 -0
- package/dist/db/migrations/20260328000000_initial_schema.js.map +1 -0
- package/dist/db/migrations/20260329000000_add_session_id_to_task_run_logs.d.ts +3 -0
- package/dist/db/migrations/20260329000000_add_session_id_to_task_run_logs.d.ts.map +1 -0
- package/dist/db/migrations/20260329000000_add_session_id_to_task_run_logs.js +7 -0
- package/dist/db/migrations/20260329000000_add_session_id_to_task_run_logs.js.map +1 -0
- package/dist/db/migrations/index.d.ts +4 -0
- package/dist/db/migrations/index.d.ts.map +1 -0
- package/dist/db/migrations/index.js +18 -0
- package/dist/db/migrations/index.js.map +1 -0
- package/dist/db/migrations/types.d.ts +17 -0
- package/dist/db/migrations/types.d.ts.map +1 -0
- package/dist/{board/client → db/migrations}/types.js +0 -1
- package/dist/db/migrations/types.js.map +1 -0
- package/dist/db/reset.d.ts.map +1 -1
- package/dist/db/reset.js +8 -3
- package/dist/db/reset.js.map +1 -1
- package/dist/db/schema.d.ts +4 -4
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +22 -207
- package/dist/db/schema.js.map +1 -1
- package/dist/db/types/repository.d.ts +192 -0
- package/dist/db/types/repository.d.ts.map +1 -0
- package/dist/db/types/repository.js +15 -0
- package/dist/db/types/repository.js.map +1 -0
- package/dist/models/Attachment.d.ts +25 -0
- package/dist/models/Attachment.d.ts.map +1 -0
- package/dist/models/Attachment.js +7 -0
- package/dist/models/Attachment.js.map +1 -0
- package/dist/services/AttachmentService.d.ts +62 -0
- package/dist/services/AttachmentService.d.ts.map +1 -0
- package/dist/services/AttachmentService.js +95 -0
- package/dist/services/AttachmentService.js.map +1 -0
- package/dist/services/ClaudeProcessService.d.ts +100 -0
- package/dist/services/ClaudeProcessService.d.ts.map +1 -0
- package/dist/services/ClaudeProcessService.js +278 -0
- package/dist/services/ClaudeProcessService.js.map +1 -0
- package/dist/services/CommentService.d.ts +3 -3
- package/dist/services/CommentService.d.ts.map +1 -1
- package/dist/services/CommentService.js +10 -70
- package/dist/services/CommentService.js.map +1 -1
- package/dist/services/ExportImportService.d.ts +3 -3
- package/dist/services/ExportImportService.d.ts.map +1 -1
- package/dist/services/ExportImportService.js +12 -16
- package/dist/services/ExportImportService.js.map +1 -1
- package/dist/services/MetadataService.d.ts +3 -3
- package/dist/services/MetadataService.d.ts.map +1 -1
- package/dist/services/MetadataService.js +9 -69
- package/dist/services/MetadataService.js.map +1 -1
- package/dist/services/TagService.d.ts +3 -3
- package/dist/services/TagService.d.ts.map +1 -1
- package/dist/services/TagService.js +9 -35
- package/dist/services/TagService.js.map +1 -1
- package/dist/services/TaskBlockService.d.ts +3 -3
- package/dist/services/TaskBlockService.d.ts.map +1 -1
- package/dist/services/TaskBlockService.js +9 -36
- package/dist/services/TaskBlockService.js.map +1 -1
- package/dist/services/TaskService.d.ts +3 -23
- package/dist/services/TaskService.d.ts.map +1 -1
- package/dist/services/TaskService.js +34 -186
- package/dist/services/TaskService.js.map +1 -1
- package/dist/services/TaskTagService.d.ts +3 -3
- package/dist/services/TaskTagService.d.ts.map +1 -1
- package/dist/services/TaskTagService.js +19 -83
- package/dist/services/TaskTagService.js.map +1 -1
- package/dist/utils/logger.d.ts +7 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +18 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +12 -5
- package/dist/board/boardScript.d.ts +0 -2
- package/dist/board/boardScript.d.ts.map +0 -1
- package/dist/board/boardScript.js +0 -1202
- package/dist/board/boardScript.js.map +0 -1
- package/dist/board/client/addTaskModal.d.ts +0 -2
- package/dist/board/client/addTaskModal.d.ts.map +0 -1
- package/dist/board/client/addTaskModal.js +0 -64
- package/dist/board/client/addTaskModal.js.map +0 -1
- package/dist/board/client/autoScroll.d.ts +0 -4
- package/dist/board/client/autoScroll.d.ts.map +0 -1
- package/dist/board/client/autoScroll.js +0 -59
- package/dist/board/client/autoScroll.js.map +0 -1
- package/dist/board/client/boardPolling.d.ts +0 -15
- package/dist/board/client/boardPolling.d.ts.map +0 -1
- package/dist/board/client/boardPolling.js +0 -144
- package/dist/board/client/boardPolling.js.map +0 -1
- package/dist/board/client/burgerMenu.d.ts +0 -2
- package/dist/board/client/burgerMenu.d.ts.map +0 -1
- package/dist/board/client/burgerMenu.js +0 -80
- package/dist/board/client/burgerMenu.js.map +0 -1
- package/dist/board/client/contextMenu.d.ts +0 -2
- package/dist/board/client/contextMenu.d.ts.map +0 -1
- package/dist/board/client/contextMenu.js +0 -52
- package/dist/board/client/contextMenu.js.map +0 -1
- package/dist/board/client/detailPanel.d.ts +0 -8
- package/dist/board/client/detailPanel.d.ts.map +0 -1
- package/dist/board/client/detailPanel.js +0 -565
- package/dist/board/client/detailPanel.js.map +0 -1
- package/dist/board/client/dragDrop.d.ts +0 -6
- package/dist/board/client/dragDrop.d.ts.map +0 -1
- package/dist/board/client/dragDrop.js +0 -82
- package/dist/board/client/dragDrop.js.map +0 -1
- package/dist/board/client/filters.d.ts +0 -6
- package/dist/board/client/filters.d.ts.map +0 -1
- package/dist/board/client/filters.js +0 -167
- package/dist/board/client/filters.js.map +0 -1
- package/dist/board/client/main.d.ts +0 -2
- package/dist/board/client/main.d.ts.map +0 -1
- package/dist/board/client/main.js +0 -20
- package/dist/board/client/main.js.map +0 -1
- package/dist/board/client/tags.d.ts +0 -6
- package/dist/board/client/tags.d.ts.map +0 -1
- package/dist/board/client/tags.js +0 -198
- package/dist/board/client/tags.js.map +0 -1
- package/dist/board/client/types.d.ts +0 -48
- package/dist/board/client/types.d.ts.map +0 -1
- package/dist/board/client/types.js.map +0 -1
- package/dist/board/client/utils.d.ts +0 -4
- package/dist/board/client/utils.d.ts.map +0 -1
- package/dist/board/client/utils.js +0 -44
- package/dist/board/client/utils.js.map +0 -1
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repository Interface Definitions
|
|
3
|
+
*
|
|
4
|
+
* Defines entity-specific repository interfaces as part of the Repository pattern.
|
|
5
|
+
* Each repository encapsulates data access logic for a specific entity.
|
|
6
|
+
* StorageBackend is the collection of all repositories.
|
|
7
|
+
*
|
|
8
|
+
* ## Design Pattern: Repository Pattern
|
|
9
|
+
* - Thin repositories: data access / SQL only
|
|
10
|
+
* - Business logic remains in the service layer
|
|
11
|
+
* - Sync implementation (async can be reconsidered when non-SQL backends are added)
|
|
12
|
+
*/
|
|
13
|
+
import type { Task, CreateTaskInput, UpdateTaskInput, TaskStatus, Tag, CreateTagInput, UpdateTagInput, TaskBlock, CreateTaskBlockInput, TaskTag, CreateTaskTagInput, TaskMetadata, CreateTaskMetadataInput, TaskComment, CreateTaskCommentInput } from '../../models';
|
|
14
|
+
import type { Priority } from '../../models/Priority';
|
|
15
|
+
/** Filter options for task listing */
|
|
16
|
+
export interface TaskFilter {
|
|
17
|
+
status?: TaskStatus | TaskStatus[];
|
|
18
|
+
author?: string;
|
|
19
|
+
assignees?: string;
|
|
20
|
+
tagIds?: number[];
|
|
21
|
+
priority?: Priority | Priority[];
|
|
22
|
+
search?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Sort options for task listing */
|
|
25
|
+
export interface TaskSortOptions {
|
|
26
|
+
field: 'id' | 'title' | 'status' | 'created_at' | 'updated_at' | 'priority';
|
|
27
|
+
order: 'asc' | 'desc';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Repository for Task entity data access
|
|
31
|
+
*/
|
|
32
|
+
export interface TaskRepository {
|
|
33
|
+
/** Find a task by its ID */
|
|
34
|
+
findById(id: number): Task | null;
|
|
35
|
+
/** Find all tasks matching the filter, with optional sort */
|
|
36
|
+
findAll(filter?: TaskFilter, sort?: TaskSortOptions): Task[];
|
|
37
|
+
/** Create a new task */
|
|
38
|
+
create(input: CreateTaskInput & {
|
|
39
|
+
status: TaskStatus;
|
|
40
|
+
created_at: string;
|
|
41
|
+
updated_at: string;
|
|
42
|
+
}): Task;
|
|
43
|
+
/** Update fields of an existing task */
|
|
44
|
+
update(id: number, input: Partial<UpdateTaskInput & {
|
|
45
|
+
updated_at: string;
|
|
46
|
+
}>): Task | null;
|
|
47
|
+
/** Delete a task by ID */
|
|
48
|
+
delete(id: number): boolean;
|
|
49
|
+
/** Find direct child tasks */
|
|
50
|
+
findChildren(parentId: number): Task[];
|
|
51
|
+
/** Count tasks grouped by status */
|
|
52
|
+
countByStatus(): Record<TaskStatus, number>;
|
|
53
|
+
/** Find tasks updated before a given date with specific statuses */
|
|
54
|
+
findForPurge(beforeDate: string, statuses: TaskStatus[]): Task[];
|
|
55
|
+
/** Delete multiple tasks by IDs */
|
|
56
|
+
deleteMany(ids: number[]): number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Repository for Tag entity data access
|
|
60
|
+
*/
|
|
61
|
+
export interface TagRepository {
|
|
62
|
+
/** Find a tag by its ID */
|
|
63
|
+
findById(id: number): Tag | null;
|
|
64
|
+
/** Find a tag by its name */
|
|
65
|
+
findByName(name: string): Tag | null;
|
|
66
|
+
/** Find all tags */
|
|
67
|
+
findAll(): Tag[];
|
|
68
|
+
/** Create a new tag */
|
|
69
|
+
create(input: CreateTagInput & {
|
|
70
|
+
created_at: string;
|
|
71
|
+
}): Tag;
|
|
72
|
+
/** Update a tag */
|
|
73
|
+
update(id: number, input: UpdateTagInput): Tag | null;
|
|
74
|
+
/** Delete a tag by ID */
|
|
75
|
+
delete(id: number): boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Repository for TaskBlock (blocking relationships) data access
|
|
79
|
+
*/
|
|
80
|
+
export interface TaskBlockRepository {
|
|
81
|
+
/** Create a new block relationship */
|
|
82
|
+
create(input: CreateTaskBlockInput & {
|
|
83
|
+
created_at: string;
|
|
84
|
+
}): TaskBlock;
|
|
85
|
+
/** Remove a block relationship */
|
|
86
|
+
delete(blockerId: number, blockedId: number): boolean;
|
|
87
|
+
/** Get all task IDs blocked by a given task */
|
|
88
|
+
findBlockedTaskIds(blockerId: number): number[];
|
|
89
|
+
/** Get all task IDs that block a given task */
|
|
90
|
+
findBlockerTaskIds(blockedId: number): number[];
|
|
91
|
+
/** Get all block relationships */
|
|
92
|
+
findAll(): Array<{
|
|
93
|
+
blocker_task_id: number;
|
|
94
|
+
blocked_task_id: number;
|
|
95
|
+
}>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Repository for TaskTag (task-tag associations) data access
|
|
99
|
+
*/
|
|
100
|
+
export interface TaskTagRepository {
|
|
101
|
+
/** Create a task-tag association */
|
|
102
|
+
create(input: CreateTaskTagInput & {
|
|
103
|
+
created_at: string;
|
|
104
|
+
}): TaskTag;
|
|
105
|
+
/** Remove a task-tag association */
|
|
106
|
+
delete(taskId: number, tagId: number): boolean;
|
|
107
|
+
/** Check if a task has a specific tag */
|
|
108
|
+
exists(taskId: number, tagId: number): boolean;
|
|
109
|
+
/** Get tag IDs for a task */
|
|
110
|
+
findTagIdsByTaskId(taskId: number): number[];
|
|
111
|
+
/** Get tags for a task */
|
|
112
|
+
findTagsByTaskId(taskId: number): Tag[];
|
|
113
|
+
/** Get task IDs for a tag */
|
|
114
|
+
findTaskIdsByTagId(tagId: number): number[];
|
|
115
|
+
/** Get tasks for a tag */
|
|
116
|
+
findTasksByTagId(tagId: number): Task[];
|
|
117
|
+
/** Get all task tags as a map (task_id -> Tag[]) */
|
|
118
|
+
findAllGroupedByTaskId(): Map<number, Tag[]>;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Repository for TaskMetadata data access
|
|
122
|
+
*/
|
|
123
|
+
export interface MetadataRepository {
|
|
124
|
+
/** Set metadata for a task (create or update) */
|
|
125
|
+
set(input: CreateTaskMetadataInput & {
|
|
126
|
+
created_at: string;
|
|
127
|
+
updated_at: string;
|
|
128
|
+
}): TaskMetadata;
|
|
129
|
+
/** Get metadata by task ID and key */
|
|
130
|
+
findByKey(taskId: number, key: string): TaskMetadata | null;
|
|
131
|
+
/** List all metadata for a task */
|
|
132
|
+
findByTaskId(taskId: number): TaskMetadata[];
|
|
133
|
+
/** Delete metadata by task ID and key */
|
|
134
|
+
delete(taskId: number, key: string): boolean;
|
|
135
|
+
/** Delete all metadata for a task */
|
|
136
|
+
deleteAllForTask(taskId: number): number;
|
|
137
|
+
/** Get all metadata grouped by task ID */
|
|
138
|
+
findAllGroupedByTaskId(): Map<number, TaskMetadata[]>;
|
|
139
|
+
/** Update an existing metadata entry */
|
|
140
|
+
update(taskId: number, key: string, value: string, updatedAt: string): TaskMetadata | null;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Repository for TaskComment data access
|
|
144
|
+
*/
|
|
145
|
+
export interface CommentRepository {
|
|
146
|
+
/** Create a new comment */
|
|
147
|
+
create(input: CreateTaskCommentInput & {
|
|
148
|
+
created_at: string;
|
|
149
|
+
updated_at: string;
|
|
150
|
+
}): TaskComment;
|
|
151
|
+
/** Find a comment by ID */
|
|
152
|
+
findById(id: number): TaskComment | null;
|
|
153
|
+
/** List comments for a task */
|
|
154
|
+
findByTaskId(taskId: number): TaskComment[];
|
|
155
|
+
/** Delete a comment by ID */
|
|
156
|
+
delete(id: number): boolean;
|
|
157
|
+
/** Delete all comments for a task */
|
|
158
|
+
deleteAllForTask(taskId: number): number;
|
|
159
|
+
/** Update comment content */
|
|
160
|
+
update(id: number, content: string, updatedAt: string): TaskComment | null;
|
|
161
|
+
/** Get all comments for multiple tasks */
|
|
162
|
+
findByTaskIds(taskIds: number[]): Map<number, TaskComment[]>;
|
|
163
|
+
/** Update comment timestamps (used during import) */
|
|
164
|
+
updateTimestamps(id: number, createdAt: string, updatedAt: string): void;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* StorageBackend - collection of all entity repositories
|
|
168
|
+
*
|
|
169
|
+
* This is the main interface that replaces StorageProvider for use in services.
|
|
170
|
+
* Each service receives the specific repository it needs via constructor injection.
|
|
171
|
+
*/
|
|
172
|
+
export interface StorageBackend {
|
|
173
|
+
tasks: TaskRepository;
|
|
174
|
+
tags: TagRepository;
|
|
175
|
+
blocks: TaskBlockRepository;
|
|
176
|
+
taskTags: TaskTagRepository;
|
|
177
|
+
metadata: MetadataRepository;
|
|
178
|
+
comments: CommentRepository;
|
|
179
|
+
/** Execute a function within a database transaction */
|
|
180
|
+
transaction<T>(fn: () => T): T;
|
|
181
|
+
/** Update task timestamps directly (used during import) */
|
|
182
|
+
updateTaskTimestamps(id: number, createdAt: string, updatedAt: string): void;
|
|
183
|
+
/**
|
|
184
|
+
* Get a signature representing the latest update across tasks, metadata, and task_tags.
|
|
185
|
+
* Used by the board to detect data changes for polling.
|
|
186
|
+
* Returns null if there is no data yet.
|
|
187
|
+
*/
|
|
188
|
+
getBoardUpdatedAtSignature(): string | null;
|
|
189
|
+
/** Close the storage connection */
|
|
190
|
+
close(): void;
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../src/db/types/repository.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;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GAAG,IAAI,CAAC;IAC3E,0CAA0C;IAC1C,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;IAC7D,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1E;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,cAAc,CAAC;IACtB,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,uDAAuD;IACvD,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAC/B,2DAA2D;IAC3D,oBAAoB,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7E;;;;OAIG;IACH,0BAA0B,IAAI,MAAM,GAAG,IAAI,CAAC;IAC5C,mCAAmC;IACnC,KAAK,IAAI,IAAI,CAAC;CACf"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Repository Interface Definitions
|
|
4
|
+
*
|
|
5
|
+
* Defines entity-specific repository interfaces as part of the Repository pattern.
|
|
6
|
+
* Each repository encapsulates data access logic for a specific entity.
|
|
7
|
+
* StorageBackend is the collection of all repositories.
|
|
8
|
+
*
|
|
9
|
+
* ## Design Pattern: Repository Pattern
|
|
10
|
+
* - Thin repositories: data access / SQL only
|
|
11
|
+
* - Business logic remains in the service layer
|
|
12
|
+
* - Sync implementation (async can be reconsidered when non-SQL backends are added)
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
//# sourceMappingURL=repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../src/db/types/repository.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attachment model
|
|
3
|
+
* Type definitions for attachments
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Complete attachment type definition
|
|
7
|
+
* Represents an attachment retrieved from the database
|
|
8
|
+
*/
|
|
9
|
+
export interface Attachment {
|
|
10
|
+
id: number;
|
|
11
|
+
task_id: number;
|
|
12
|
+
file_name: string;
|
|
13
|
+
file_path: string;
|
|
14
|
+
created_at: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Attachment creation input type
|
|
18
|
+
* Excludes id and created_at as they are auto-generated
|
|
19
|
+
*/
|
|
20
|
+
export interface CreateAttachmentInput {
|
|
21
|
+
task_id: number;
|
|
22
|
+
file_name: string;
|
|
23
|
+
file_path: string;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=Attachment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Attachment.d.ts","sourceRoot":"","sources":["../../src/models/Attachment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Attachment.js","sourceRoot":"","sources":["../../src/models/Attachment.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Attachment, CreateAttachmentInput } from '../models';
|
|
2
|
+
import Database from 'better-sqlite3';
|
|
3
|
+
/**
|
|
4
|
+
* Attachment Service
|
|
5
|
+
* Provides management of attachment records
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* **Future Feature**: This service is fully implemented but CLI commands are not yet available.
|
|
9
|
+
* See docs/planned-features.md for implementation timeline and planned CLI interface.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const service = new AttachmentService();
|
|
14
|
+
* const attachment = service.createAttachment({
|
|
15
|
+
* task_id: 1,
|
|
16
|
+
* file_name: 'design.pdf',
|
|
17
|
+
* file_path: '/path/to/design.pdf'
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class AttachmentService {
|
|
22
|
+
private db;
|
|
23
|
+
constructor(db?: Database.Database);
|
|
24
|
+
/**
|
|
25
|
+
* Create a new attachment record
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* **Future Feature**: CLI command not yet implemented.
|
|
29
|
+
* Planned command: `agkan task attach add <task-id> <file-path>`
|
|
30
|
+
*
|
|
31
|
+
* @param input - Attachment creation input
|
|
32
|
+
* @returns Created attachment record
|
|
33
|
+
* @throws Will throw if task_id does not exist (foreign key constraint)
|
|
34
|
+
*/
|
|
35
|
+
createAttachment(input: CreateAttachmentInput): Attachment;
|
|
36
|
+
/**
|
|
37
|
+
* Get attachments for a specific task
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* **Future Feature**: CLI command not yet implemented.
|
|
41
|
+
* Planned command: `agkan task attach list <task-id>`
|
|
42
|
+
*
|
|
43
|
+
* @param taskId - Task ID
|
|
44
|
+
* @returns Array of attachments ordered by creation date (newest first)
|
|
45
|
+
*/
|
|
46
|
+
getAttachmentsByTaskId(taskId: number): Attachment[];
|
|
47
|
+
/**
|
|
48
|
+
* Delete an attachment record
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* **Future Feature**: CLI command not yet implemented.
|
|
52
|
+
* Planned command: `agkan task attach delete <attachment-id>`
|
|
53
|
+
*
|
|
54
|
+
* @param id - Attachment ID
|
|
55
|
+
* @returns True if deletion succeeded, false if not found
|
|
56
|
+
*
|
|
57
|
+
* @todo Implement file deletion from filesystem
|
|
58
|
+
* @todo Add --keep-file option to CLI command
|
|
59
|
+
*/
|
|
60
|
+
deleteAttachment(id: number): boolean;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=AttachmentService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentService.d.ts","sourceRoot":"","sources":["../../src/services/AttachmentService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAE9D,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,EAAE,CAAoB;gBAElB,EAAE,CAAC,EAAE,QAAQ,CAAC,QAAQ;IAIlC;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,UAAU;IAoB1D;;;;;;;;;OASG;IACH,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,EAAE;IAOpD;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;CAetC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AttachmentService = void 0;
|
|
4
|
+
const connection_1 = require("../db/connection");
|
|
5
|
+
/**
|
|
6
|
+
* Attachment Service
|
|
7
|
+
* Provides management of attachment records
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* **Future Feature**: This service is fully implemented but CLI commands are not yet available.
|
|
11
|
+
* See docs/planned-features.md for implementation timeline and planned CLI interface.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const service = new AttachmentService();
|
|
16
|
+
* const attachment = service.createAttachment({
|
|
17
|
+
* task_id: 1,
|
|
18
|
+
* file_name: 'design.pdf',
|
|
19
|
+
* file_path: '/path/to/design.pdf'
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
class AttachmentService {
|
|
24
|
+
constructor(db) {
|
|
25
|
+
this.db = db || (0, connection_1.getDatabase)();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Create a new attachment record
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* **Future Feature**: CLI command not yet implemented.
|
|
32
|
+
* Planned command: `agkan task attach add <task-id> <file-path>`
|
|
33
|
+
*
|
|
34
|
+
* @param input - Attachment creation input
|
|
35
|
+
* @returns Created attachment record
|
|
36
|
+
* @throws Will throw if task_id does not exist (foreign key constraint)
|
|
37
|
+
*/
|
|
38
|
+
createAttachment(input) {
|
|
39
|
+
const db = this.db;
|
|
40
|
+
const now = new Date().toISOString();
|
|
41
|
+
const stmt = db.prepare(`
|
|
42
|
+
INSERT INTO attachments (task_id, file_name, file_path, created_at)
|
|
43
|
+
VALUES (?, ?, ?, ?)
|
|
44
|
+
`);
|
|
45
|
+
const result = stmt.run(input.task_id, input.file_name, input.file_path, now);
|
|
46
|
+
return {
|
|
47
|
+
id: result.lastInsertRowid,
|
|
48
|
+
task_id: input.task_id,
|
|
49
|
+
file_name: input.file_name,
|
|
50
|
+
file_path: input.file_path,
|
|
51
|
+
created_at: now,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get attachments for a specific task
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* **Future Feature**: CLI command not yet implemented.
|
|
59
|
+
* Planned command: `agkan task attach list <task-id>`
|
|
60
|
+
*
|
|
61
|
+
* @param taskId - Task ID
|
|
62
|
+
* @returns Array of attachments ordered by creation date (newest first)
|
|
63
|
+
*/
|
|
64
|
+
getAttachmentsByTaskId(taskId) {
|
|
65
|
+
const db = this.db;
|
|
66
|
+
const stmt = db.prepare('SELECT * FROM attachments WHERE task_id = ? ORDER BY created_at DESC');
|
|
67
|
+
return stmt.all(taskId);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Delete an attachment record
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* **Future Feature**: CLI command not yet implemented.
|
|
74
|
+
* Planned command: `agkan task attach delete <attachment-id>`
|
|
75
|
+
*
|
|
76
|
+
* @param id - Attachment ID
|
|
77
|
+
* @returns True if deletion succeeded, false if not found
|
|
78
|
+
*
|
|
79
|
+
* @todo Implement file deletion from filesystem
|
|
80
|
+
* @todo Add --keep-file option to CLI command
|
|
81
|
+
*/
|
|
82
|
+
deleteAttachment(id) {
|
|
83
|
+
const db = this.db;
|
|
84
|
+
const stmt = db.prepare('SELECT * FROM attachments WHERE id = ?');
|
|
85
|
+
const attachment = stmt.get(id);
|
|
86
|
+
if (!attachment) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const deleteStmt = db.prepare('DELETE FROM attachments WHERE id = ?');
|
|
90
|
+
deleteStmt.run(id);
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.AttachmentService = AttachmentService;
|
|
95
|
+
//# sourceMappingURL=AttachmentService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentService.js","sourceRoot":"","sources":["../../src/services/AttachmentService.ts"],"names":[],"mappings":";;;AACA,iDAA+C;AAG/C;;;;;;;;;;;;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CAAC;QACf,CAAC;QAED,MAAM,UAAU,GAAG,EAAE,CAAC,OAAO,CAAC,sCAAsC,CAAC,CAAC;QACtE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAEnB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAnFD,8CAmFC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { StorageBackend } from '../db/types/repository';
|
|
2
|
+
export type ClaudeStreamEvent = {
|
|
3
|
+
type: 'system';
|
|
4
|
+
subtype: string;
|
|
5
|
+
session_id?: string;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'assistant';
|
|
9
|
+
message: {
|
|
10
|
+
content: Array<{
|
|
11
|
+
type: 'text';
|
|
12
|
+
text: string;
|
|
13
|
+
} | {
|
|
14
|
+
type: 'tool_use';
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
input: Record<string, unknown>;
|
|
18
|
+
}>;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
};
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'result';
|
|
24
|
+
subtype: string;
|
|
25
|
+
result?: string;
|
|
26
|
+
duration_ms?: number;
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
} | {
|
|
29
|
+
type: string;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
export type OutputEvent = {
|
|
33
|
+
kind: 'text';
|
|
34
|
+
text: string;
|
|
35
|
+
} | {
|
|
36
|
+
kind: 'tool_use';
|
|
37
|
+
name: string;
|
|
38
|
+
input: Record<string, unknown>;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'done';
|
|
41
|
+
exitCode: number;
|
|
42
|
+
} | {
|
|
43
|
+
kind: 'error';
|
|
44
|
+
message: string;
|
|
45
|
+
};
|
|
46
|
+
export type SubscribeCallback = (event: OutputEvent) => void;
|
|
47
|
+
export interface RunLog {
|
|
48
|
+
id: number;
|
|
49
|
+
task_id: number;
|
|
50
|
+
started_at: string;
|
|
51
|
+
finished_at: string | null;
|
|
52
|
+
exit_code: number | null;
|
|
53
|
+
session_id: string | null;
|
|
54
|
+
events: OutputEvent[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* ClaudeProcessService
|
|
58
|
+
* Manages claude CLI processes running in stream-json mode.
|
|
59
|
+
* Keyed by taskId, supports start/stop/subscribe/list operations.
|
|
60
|
+
*/
|
|
61
|
+
export declare class ClaudeProcessService {
|
|
62
|
+
private processes;
|
|
63
|
+
private db;
|
|
64
|
+
constructor(db?: StorageBackend | null);
|
|
65
|
+
/**
|
|
66
|
+
* Start a claude process for the given taskId and prompt.
|
|
67
|
+
* Prevents duplicate processes for the same taskId.
|
|
68
|
+
*/
|
|
69
|
+
startProcess(taskId: number, prompt: string, command?: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* Stop the process for the given taskId.
|
|
72
|
+
* Returns true if the process was found and signalled, false otherwise.
|
|
73
|
+
*/
|
|
74
|
+
stopProcess(taskId: number): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* List all currently running tasks with their command type.
|
|
77
|
+
*/
|
|
78
|
+
listRunningTasks(): {
|
|
79
|
+
taskId: number;
|
|
80
|
+
command: string;
|
|
81
|
+
}[];
|
|
82
|
+
/**
|
|
83
|
+
* Subscribe to output events for a given taskId.
|
|
84
|
+
* If process is running: replay past events and subscribe to future events.
|
|
85
|
+
* If no process but DB available: replay last saved log from DB.
|
|
86
|
+
* Returns an unsubscribe function.
|
|
87
|
+
*/
|
|
88
|
+
subscribeOutput(taskId: number, callback: SubscribeCallback): () => void;
|
|
89
|
+
/**
|
|
90
|
+
* Get the buffered output events for a taskId.
|
|
91
|
+
* Useful for late subscribers who missed earlier events.
|
|
92
|
+
*/
|
|
93
|
+
getOutputBuffer(taskId: number): ClaudeStreamEvent[];
|
|
94
|
+
/**
|
|
95
|
+
* Get saved run logs for a task from DB (most recent first, up to 5).
|
|
96
|
+
*/
|
|
97
|
+
getRunLogs(taskId: number): RunLog[];
|
|
98
|
+
private _notifySubscribers;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=ClaudeProcessService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClaudeProcessService.d.ts","sourceRoot":"","sources":["../../src/services/ClaudeProcessService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAkB7D,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GAChF;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE;QACP,OAAO,EAAE,KAAK,CACV;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,GAC9B;YAAE,IAAI,EAAE,UAAU,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SAAE,CACjF,CAAC;QACF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GAClG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAE7C,MA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