agkan 2.3.0 → 2.5.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/dist/board/server.d.ts +2 -1
- package/dist/board/server.d.ts.map +1 -1
- package/dist/board/server.js +276 -45
- package/dist/board/server.js.map +1 -1
- package/dist/cli/commands/comment/add.d.ts +6 -0
- package/dist/cli/commands/comment/add.d.ts.map +1 -0
- package/dist/cli/commands/comment/add.js +73 -0
- package/dist/cli/commands/comment/add.js.map +1 -0
- package/dist/cli/commands/comment/delete.d.ts +6 -0
- package/dist/cli/commands/comment/delete.d.ts.map +1 -0
- package/dist/cli/commands/comment/delete.js +57 -0
- package/dist/cli/commands/comment/delete.js.map +1 -0
- package/dist/cli/commands/comment/list.d.ts +6 -0
- package/dist/cli/commands/comment/list.d.ts.map +1 -0
- package/dist/cli/commands/comment/list.js +72 -0
- package/dist/cli/commands/comment/list.js.map +1 -0
- package/dist/models/TaskComment.d.ts +21 -0
- package/dist/models/TaskComment.d.ts.map +1 -0
- package/dist/models/TaskComment.js +3 -0
- package/dist/models/TaskComment.js.map +1 -0
- package/dist/services/CommentService.d.ts +48 -0
- package/dist/services/CommentService.d.ts.map +1 -0
- package/dist/services/CommentService.js +120 -0
- package/dist/services/CommentService.js.map +1 -0
- package/package.json +1 -1
package/dist/board/server.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
2
|
import { TaskService } from '../services/TaskService';
|
|
3
3
|
import { TaskTagService } from '../services/TaskTagService';
|
|
4
|
+
import { TagService } from '../services/TagService';
|
|
4
5
|
import { MetadataService } from '../services/MetadataService';
|
|
5
6
|
import { StorageProvider } from '../db/types/storage';
|
|
6
|
-
export declare function createBoardApp(taskService?: TaskService, taskTagService?: TaskTagService, metadataService?: MetadataService, db?: StorageProvider, boardTitle?: string): Hono;
|
|
7
|
+
export declare function createBoardApp(taskService?: TaskService, taskTagService?: TaskTagService, metadataService?: MetadataService, db?: StorageProvider, boardTitle?: string, tagService?: TagService): Hono;
|
|
7
8
|
export declare function startBoardServer(port: number, boardTitle?: string): void;
|
|
8
9
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/board/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAI9D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/board/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAI9D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAq/BtD,wBAAgB,cAAc,CAC5B,WAAW,CAAC,EAAE,WAAW,EACzB,cAAc,CAAC,EAAE,cAAc,EAC/B,eAAe,CAAC,EAAE,eAAe,EACjC,EAAE,CAAC,EAAE,eAAe,EACpB,UAAU,CAAC,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,UAAU,GACtB,IAAI,CAYN;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAMxE"}
|
package/dist/board/server.js
CHANGED
|
@@ -6,6 +6,7 @@ const hono_1 = require("hono");
|
|
|
6
6
|
const node_server_1 = require("@hono/node-server");
|
|
7
7
|
const TaskService_1 = require("../services/TaskService");
|
|
8
8
|
const TaskTagService_1 = require("../services/TaskTagService");
|
|
9
|
+
const TagService_1 = require("../services/TagService");
|
|
9
10
|
const MetadataService_1 = require("../services/MetadataService");
|
|
10
11
|
const models_1 = require("../models");
|
|
11
12
|
const connection_1 = require("../db/connection");
|
|
@@ -58,7 +59,9 @@ const BOARD_STYLES = `
|
|
|
58
59
|
header { background: #1e293b; color: white; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; }
|
|
59
60
|
header h1 { font-size: 18px; font-weight: 700; }
|
|
60
61
|
.board-title { font-size: 14px; font-weight: 400; opacity: 0.75; }
|
|
61
|
-
.board { display: flex;
|
|
62
|
+
.board-container { display: flex; width: 100%; height: calc(100vh - 48px); gap: 0; }
|
|
63
|
+
.board { display: flex; gap: 12px; padding: 16px; overflow-x: auto; flex: 1; align-items: flex-start; min-width: 0; }
|
|
64
|
+
.board.with-panel { padding-right: 0; }
|
|
62
65
|
.column { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; width: 240px; flex-shrink: 0; display: flex; flex-direction: column; border-top: 3px solid transparent; }
|
|
63
66
|
.column-header { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e2e8f0; }
|
|
64
67
|
.column-title { font-size: 13px; font-weight: 700; }
|
|
@@ -101,16 +104,17 @@ const BOARD_STYLES = `
|
|
|
101
104
|
.modal-actions button.primary:hover { background: #2563eb; }
|
|
102
105
|
.toast { position: fixed; bottom: 20px; right: 20px; background: #ef4444; color: white; padding: 10px 16px; border-radius: 6px; font-size: 13px; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
|
|
103
106
|
.toast.show { opacity: 1; }
|
|
104
|
-
.detail-panel { position:
|
|
107
|
+
.detail-panel { position: relative; width: 0; height: calc(100vh - 48px); background: white; box-shadow: none; border-left: 0 solid #e2e8f0; display: flex; flex-direction: column; max-width: 800px; overflow: hidden; transition: width 0.25s ease; }
|
|
105
108
|
.detail-panel-resize-handle { position: absolute; top: 0; left: 0; width: 6px; height: 100%; cursor: col-resize; z-index: 10; background: transparent; }
|
|
106
109
|
.detail-panel-resize-handle:hover, .detail-panel-resize-handle.dragging { background: rgba(59,130,246,0.3); }
|
|
107
|
-
.detail-panel.open {
|
|
108
|
-
.detail-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #e2e8f0; }
|
|
109
|
-
.detail-panel-header h2 { font-size: 16px; font-weight: 700; color: #1e293b; margin: 0; }
|
|
110
|
-
.detail-panel-close { background: none; border: none; font-size: 20px; color: #64748b; cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 4px; }
|
|
110
|
+
.detail-panel.open { width: 400px; min-width: 280px; border-left-width: 1px; }
|
|
111
|
+
.detail-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #e2e8f0; flex-shrink: 0; }
|
|
112
|
+
.detail-panel-header h2 { font-size: 16px; font-weight: 700; color: #1e293b; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
113
|
+
.detail-panel-close { background: none; border: none; font-size: 20px; color: #64748b; cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 4px; flex-shrink: 0; }
|
|
111
114
|
.detail-panel-close:hover { background: #f1f5f9; color: #1e293b; }
|
|
112
|
-
.detail-panel-body { flex: 1; overflow-y: auto; padding: 20px; }
|
|
113
|
-
.detail-field { margin-bottom: 16px; }
|
|
115
|
+
.detail-panel-body { flex: 1; overflow-y: auto; padding: 20px; min-width: 0; display: flex; flex-direction: column; }
|
|
116
|
+
.detail-field { margin-bottom: 16px; word-wrap: break-word; }
|
|
117
|
+
.description-field-wrapper { flex: 1; display: flex; flex-direction: column; min-height: 0; margin-bottom: 0; }
|
|
114
118
|
.detail-field-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: #94a3b8; margin-bottom: 4px; letter-spacing: 0.05em; }
|
|
115
119
|
.detail-field-value { font-size: 13px; color: #1e293b; line-height: 1.5; }
|
|
116
120
|
.detail-field-value.empty { color: #94a3b8; font-style: italic; }
|
|
@@ -120,15 +124,29 @@ const BOARD_STYLES = `
|
|
|
120
124
|
.detail-meta-table td { padding: 4px 0; font-size: 12px; }
|
|
121
125
|
.detail-meta-table td:first-child { color: #64748b; width: 100px; }
|
|
122
126
|
.detail-meta-table td:last-child { color: #1e293b; }
|
|
123
|
-
.detail-panel-footer { padding: 12px 20px; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; }
|
|
127
|
+
.detail-panel-footer { padding: 12px 20px; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; flex-shrink: 0; }
|
|
124
128
|
.detail-panel-footer button { padding: 7px 18px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid #3b82f6; background: #3b82f6; color: white; }
|
|
125
129
|
.detail-panel-footer button:hover { background: #2563eb; border-color: #2563eb; }
|
|
126
130
|
.detail-edit-input { width: 100%; border: 1px solid #e2e8f0; border-radius: 6px; padding: 7px 10px; font-size: 13px; font-family: inherit; background: white; color: #1e293b; }
|
|
127
131
|
.detail-edit-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
|
|
128
132
|
.detail-edit-textarea { width: 100%; border: 1px solid #e2e8f0; border-radius: 6px; padding: 7px 10px; font-size: 13px; font-family: inherit; resize: vertical; min-height: 240px; background: white; color: #1e293b; }
|
|
129
133
|
.detail-edit-textarea:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
|
|
134
|
+
.description-field-wrapper .detail-edit-textarea { flex: 1; resize: none; min-height: 0; }
|
|
130
135
|
.detail-edit-select { width: 100%; border: 1px solid #e2e8f0; border-radius: 6px; padding: 7px 10px; font-size: 13px; font-family: inherit; background: white; color: #1e293b; }
|
|
131
|
-
.detail-edit-select:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
|
|
136
|
+
.detail-edit-select:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
|
|
137
|
+
.tag-select-wrapper { position: relative; }
|
|
138
|
+
.tag-select-control { border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 8px; min-height: 36px; cursor: text; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; background: white; }
|
|
139
|
+
.tag-select-control:focus-within { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
|
|
140
|
+
.tag-pill { background: #e0f2fe; color: #0369a1; font-size: 11px; font-weight: 600; padding: 2px 4px 2px 8px; border-radius: 10px; display: inline-flex; align-items: center; gap: 3px; }
|
|
141
|
+
.tag-pill-remove { background: none; border: none; color: #0369a1; cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; display: inline-flex; align-items: center; border-radius: 50%; }
|
|
142
|
+
.tag-pill-remove:hover { color: #dc2626; background: rgba(220,38,38,0.1); }
|
|
143
|
+
.tag-select-input { border: none; outline: none; font-size: 12px; font-family: inherit; min-width: 80px; flex: 1; background: transparent; padding: 2px 0; color: #1e293b; }
|
|
144
|
+
.tag-select-input::placeholder { color: #94a3b8; }
|
|
145
|
+
.tag-select-dropdown { position: absolute; top: calc(100% + 2px); left: 0; right: 0; background: white; border: 1px solid #e2e8f0; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 100; max-height: 180px; overflow-y: auto; display: none; }
|
|
146
|
+
.tag-select-dropdown.open { display: block; }
|
|
147
|
+
.tag-select-option { padding: 6px 10px; font-size: 12px; cursor: pointer; color: #1e293b; }
|
|
148
|
+
.tag-select-option:hover, .tag-select-option.focused { background: #eff6ff; color: #0369a1; }
|
|
149
|
+
.tag-select-no-options { padding: 6px 10px; font-size: 12px; color: #94a3b8; font-style: italic; }`;
|
|
132
150
|
const BOARD_SCRIPT = `
|
|
133
151
|
let draggedCard = null;
|
|
134
152
|
let sourceBody = null;
|
|
@@ -293,7 +311,11 @@ const BOARD_SCRIPT = `
|
|
|
293
311
|
}
|
|
294
312
|
});
|
|
295
313
|
|
|
296
|
-
// Detail panel
|
|
314
|
+
// Detail panel - create and insert into board-container
|
|
315
|
+
const boardContainer = document.querySelector('.board-container');
|
|
316
|
+
const detailPanelHtml = '<div class="detail-panel" id="detail-panel"><div class="detail-panel-resize-handle" id="detail-panel-resize-handle"></div><div class="detail-panel-header"><h2 id="detail-panel-title">Task Detail</h2><button class="detail-panel-close" id="detail-panel-close" title="Close">×</button></div><div class="detail-panel-body" id="detail-panel-body"></div><div class="detail-panel-footer"><button id="detail-save-btn">Save</button></div></div>';
|
|
317
|
+
boardContainer.insertAdjacentHTML('beforeend', detailPanelHtml);
|
|
318
|
+
|
|
297
319
|
const detailPanel = document.getElementById('detail-panel');
|
|
298
320
|
const detailPanelTitle = document.getElementById('detail-panel-title');
|
|
299
321
|
const detailPanelBody = document.getElementById('detail-panel-body');
|
|
@@ -301,6 +323,7 @@ const BOARD_SCRIPT = `
|
|
|
301
323
|
|
|
302
324
|
function closeDetailPanel() {
|
|
303
325
|
detailPanel.classList.remove('open');
|
|
326
|
+
detailPanel.style.width = '';
|
|
304
327
|
detailTaskId = null;
|
|
305
328
|
}
|
|
306
329
|
|
|
@@ -310,25 +333,27 @@ const BOARD_SCRIPT = `
|
|
|
310
333
|
const resizeHandle = document.getElementById('detail-panel-resize-handle');
|
|
311
334
|
const PANEL_MIN_WIDTH = 280;
|
|
312
335
|
const PANEL_MAX_WIDTH = 800;
|
|
336
|
+
const PANEL_DEFAULT_WIDTH = 400;
|
|
313
337
|
const PANEL_WIDTH_KEY = 'detailPanelWidth';
|
|
314
338
|
|
|
315
339
|
(function initPanelWidth() {
|
|
316
340
|
const saved = localStorage.getItem(PANEL_WIDTH_KEY);
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}
|
|
341
|
+
const targetWidth = (saved && /^\d+$/.test(saved))
|
|
342
|
+
? Math.min(PANEL_MAX_WIDTH, Math.max(PANEL_MIN_WIDTH, parseInt(saved, 10)))
|
|
343
|
+
: PANEL_DEFAULT_WIDTH;
|
|
344
|
+
// Store the width for when panel opens (width is 0 when closed)
|
|
345
|
+
detailPanel.dataset.preferredWidth = String(targetWidth);
|
|
323
346
|
})();
|
|
324
347
|
|
|
325
348
|
resizeHandle.addEventListener('mousedown', function(e) {
|
|
326
349
|
e.preventDefault();
|
|
350
|
+
if (!detailPanel.classList.contains('open')) return;
|
|
327
351
|
const startX = e.clientX;
|
|
328
352
|
const startWidth = detailPanel.offsetWidth;
|
|
329
353
|
resizeHandle.classList.add('dragging');
|
|
330
354
|
document.body.style.userSelect = 'none';
|
|
331
355
|
document.body.style.cursor = 'col-resize';
|
|
356
|
+
detailPanel.style.transition = 'none';
|
|
332
357
|
|
|
333
358
|
function onMouseMove(e) {
|
|
334
359
|
const delta = startX - e.clientX;
|
|
@@ -340,6 +365,7 @@ const BOARD_SCRIPT = `
|
|
|
340
365
|
resizeHandle.classList.remove('dragging');
|
|
341
366
|
document.body.style.userSelect = '';
|
|
342
367
|
document.body.style.cursor = '';
|
|
368
|
+
detailPanel.style.transition = '';
|
|
343
369
|
localStorage.setItem(PANEL_WIDTH_KEY, detailPanel.offsetWidth);
|
|
344
370
|
document.removeEventListener('mousemove', onMouseMove);
|
|
345
371
|
document.removeEventListener('mouseup', onMouseUp);
|
|
@@ -354,6 +380,183 @@ const BOARD_SCRIPT = `
|
|
|
354
380
|
const statusLabels = ${JSON.stringify(STATUS_LABELS)};
|
|
355
381
|
const allPriorities = ${JSON.stringify(models_1.PRIORITIES)};
|
|
356
382
|
|
|
383
|
+
let allAvailableTags = [];
|
|
384
|
+
|
|
385
|
+
async function loadAllTags() {
|
|
386
|
+
try {
|
|
387
|
+
const res = await fetch('/api/tags');
|
|
388
|
+
if (!res.ok) return;
|
|
389
|
+
const data = await res.json();
|
|
390
|
+
allAvailableTags = data.tags || [];
|
|
391
|
+
} catch {
|
|
392
|
+
// Ignore errors loading tags
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function renderTagsSection(currentTags) {
|
|
397
|
+
const container = document.getElementById('detail-tags-container');
|
|
398
|
+
if (!container) return;
|
|
399
|
+
|
|
400
|
+
container.innerHTML = '<div class="tag-select-wrapper"><div class="tag-select-control" id="tag-select-control"></div><div class="tag-select-dropdown" id="tag-select-dropdown"></div></div>';
|
|
401
|
+
|
|
402
|
+
const control = document.getElementById('tag-select-control');
|
|
403
|
+
const dropdown = document.getElementById('tag-select-dropdown');
|
|
404
|
+
let focusedOptionIndex = -1;
|
|
405
|
+
let inputValue = '';
|
|
406
|
+
|
|
407
|
+
function getFilteredTags() {
|
|
408
|
+
const currentTagIds = new Set(currentTags.map(t => t.id));
|
|
409
|
+
const available = allAvailableTags.filter(t => !currentTagIds.has(t.id));
|
|
410
|
+
if (!inputValue.trim()) return available;
|
|
411
|
+
const q = inputValue.toLowerCase();
|
|
412
|
+
return available.filter(t => t.name.toLowerCase().includes(q));
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
const input = document.createElement('input');
|
|
416
|
+
input.className = 'tag-select-input';
|
|
417
|
+
input.type = 'text';
|
|
418
|
+
input.autocomplete = 'off';
|
|
419
|
+
control.appendChild(input);
|
|
420
|
+
|
|
421
|
+
function renderPills() {
|
|
422
|
+
control.querySelectorAll('.tag-pill').forEach(p => p.remove());
|
|
423
|
+
currentTags.forEach(t => {
|
|
424
|
+
const pill = document.createElement('span');
|
|
425
|
+
pill.className = 'tag-pill';
|
|
426
|
+
pill.dataset.tagId = t.id;
|
|
427
|
+
const label = document.createTextNode(t.name);
|
|
428
|
+
const removeBtn = document.createElement('button');
|
|
429
|
+
removeBtn.className = 'tag-pill-remove';
|
|
430
|
+
removeBtn.title = 'Remove tag';
|
|
431
|
+
removeBtn.setAttribute('data-tag-id', t.id);
|
|
432
|
+
removeBtn.innerHTML = '×';
|
|
433
|
+
removeBtn.addEventListener('click', async e => {
|
|
434
|
+
e.stopPropagation();
|
|
435
|
+
try {
|
|
436
|
+
const res = await fetch('/api/tasks/' + detailTaskId + '/tags/' + t.id, { method: 'DELETE' });
|
|
437
|
+
if (!res.ok) throw new Error('Server error');
|
|
438
|
+
const idx = currentTags.findIndex(x => String(x.id) === String(t.id));
|
|
439
|
+
if (idx !== -1) currentTags.splice(idx, 1);
|
|
440
|
+
renderPills();
|
|
441
|
+
renderDropdown();
|
|
442
|
+
} catch {
|
|
443
|
+
showToast('Failed to remove tag');
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
pill.appendChild(label);
|
|
447
|
+
pill.appendChild(removeBtn);
|
|
448
|
+
control.insertBefore(pill, input);
|
|
449
|
+
});
|
|
450
|
+
input.placeholder = currentTags.length === 0 ? 'Add tags...' : '';
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
function renderDropdown() {
|
|
454
|
+
const filtered = getFilteredTags();
|
|
455
|
+
dropdown.innerHTML = '';
|
|
456
|
+
focusedOptionIndex = -1;
|
|
457
|
+
if (filtered.length === 0) {
|
|
458
|
+
const noOpt = document.createElement('div');
|
|
459
|
+
noOpt.className = 'tag-select-no-options';
|
|
460
|
+
noOpt.textContent = inputValue ? 'No matching tags' : 'No tags available';
|
|
461
|
+
dropdown.appendChild(noOpt);
|
|
462
|
+
} else {
|
|
463
|
+
filtered.forEach((t, i) => {
|
|
464
|
+
const opt = document.createElement('div');
|
|
465
|
+
opt.className = 'tag-select-option';
|
|
466
|
+
opt.dataset.tagId = t.id;
|
|
467
|
+
opt.textContent = t.name;
|
|
468
|
+
opt.addEventListener('mouseover', () => setFocusedOption(i));
|
|
469
|
+
opt.addEventListener('mousedown', async e => {
|
|
470
|
+
e.preventDefault();
|
|
471
|
+
await addTag(t.id);
|
|
472
|
+
});
|
|
473
|
+
dropdown.appendChild(opt);
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function setFocusedOption(index) {
|
|
479
|
+
const opts = dropdown.querySelectorAll('.tag-select-option');
|
|
480
|
+
opts.forEach((o, i) => o.classList.toggle('focused', i === index));
|
|
481
|
+
focusedOptionIndex = index;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function openDropdown() {
|
|
485
|
+
renderDropdown();
|
|
486
|
+
dropdown.classList.add('open');
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function closeDropdown() {
|
|
490
|
+
dropdown.classList.remove('open');
|
|
491
|
+
focusedOptionIndex = -1;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
async function addTag(tagId) {
|
|
495
|
+
try {
|
|
496
|
+
const res = await fetch('/api/tasks/' + detailTaskId + '/tags', {
|
|
497
|
+
method: 'POST',
|
|
498
|
+
headers: { 'Content-Type': 'application/json' },
|
|
499
|
+
body: JSON.stringify({ tagId: Number(tagId) })
|
|
500
|
+
});
|
|
501
|
+
if (!res.ok) throw new Error('Server error');
|
|
502
|
+
const tag = allAvailableTags.find(t => String(t.id) === String(tagId));
|
|
503
|
+
if (tag) currentTags.push(tag);
|
|
504
|
+
input.value = '';
|
|
505
|
+
inputValue = '';
|
|
506
|
+
renderPills();
|
|
507
|
+
renderDropdown();
|
|
508
|
+
} catch {
|
|
509
|
+
showToast('Failed to add tag');
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
control.addEventListener('click', () => input.focus());
|
|
514
|
+
|
|
515
|
+
input.addEventListener('focus', () => openDropdown());
|
|
516
|
+
|
|
517
|
+
input.addEventListener('blur', () => setTimeout(() => closeDropdown(), 150));
|
|
518
|
+
|
|
519
|
+
input.addEventListener('input', () => {
|
|
520
|
+
inputValue = input.value;
|
|
521
|
+
renderDropdown();
|
|
522
|
+
if (!dropdown.classList.contains('open')) openDropdown();
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
input.addEventListener('keydown', async e => {
|
|
526
|
+
const filtered = getFilteredTags();
|
|
527
|
+
const opts = dropdown.querySelectorAll('.tag-select-option');
|
|
528
|
+
if (e.key === 'ArrowDown') {
|
|
529
|
+
e.preventDefault();
|
|
530
|
+
setFocusedOption(Math.min(focusedOptionIndex + 1, opts.length - 1));
|
|
531
|
+
} else if (e.key === 'ArrowUp') {
|
|
532
|
+
e.preventDefault();
|
|
533
|
+
setFocusedOption(Math.max(focusedOptionIndex - 1, 0));
|
|
534
|
+
} else if (e.key === 'Enter') {
|
|
535
|
+
e.preventDefault();
|
|
536
|
+
if (focusedOptionIndex >= 0 && filtered[focusedOptionIndex]) {
|
|
537
|
+
await addTag(filtered[focusedOptionIndex].id);
|
|
538
|
+
}
|
|
539
|
+
} else if (e.key === 'Escape') {
|
|
540
|
+
closeDropdown();
|
|
541
|
+
input.blur();
|
|
542
|
+
} else if (e.key === 'Backspace' && input.value === '' && currentTags.length > 0) {
|
|
543
|
+
e.preventDefault();
|
|
544
|
+
const last = currentTags[currentTags.length - 1];
|
|
545
|
+
try {
|
|
546
|
+
const res = await fetch('/api/tasks/' + detailTaskId + '/tags/' + last.id, { method: 'DELETE' });
|
|
547
|
+
if (!res.ok) throw new Error('Server error');
|
|
548
|
+
currentTags.splice(currentTags.length - 1, 1);
|
|
549
|
+
renderPills();
|
|
550
|
+
renderDropdown();
|
|
551
|
+
} catch {
|
|
552
|
+
showToast('Failed to remove tag');
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
renderPills();
|
|
558
|
+
}
|
|
559
|
+
|
|
357
560
|
function renderDetailPanel(data) {
|
|
358
561
|
const task = data.task;
|
|
359
562
|
const tags = data.tags || [];
|
|
@@ -393,21 +596,12 @@ const BOARD_SCRIPT = `
|
|
|
393
596
|
html += '</select>';
|
|
394
597
|
html += '</div>';
|
|
395
598
|
|
|
396
|
-
//
|
|
599
|
+
// Tags (editable)
|
|
397
600
|
html += '<div class="detail-field">';
|
|
398
|
-
html += '<div class="detail-field-label">
|
|
399
|
-
html += '<
|
|
601
|
+
html += '<div class="detail-field-label">Tags</div>';
|
|
602
|
+
html += '<div id="detail-tags-container"></div>';
|
|
400
603
|
html += '</div>';
|
|
401
604
|
|
|
402
|
-
// Tags (read-only)
|
|
403
|
-
if (tags.length > 0) {
|
|
404
|
-
html += '<div class="detail-field">';
|
|
405
|
-
html += '<div class="detail-field-label">Tags</div>';
|
|
406
|
-
html += '<div class="detail-field-value detail-tags">';
|
|
407
|
-
tags.forEach(t => { html += '<span class="tag">' + escapeHtmlClient(t.name) + '</span>'; });
|
|
408
|
-
html += '</div></div>';
|
|
409
|
-
}
|
|
410
|
-
|
|
411
605
|
// Metadata table (read-only, non-priority)
|
|
412
606
|
const otherMeta = metadata.filter(m => m.key !== 'priority');
|
|
413
607
|
if (otherMeta.length > 0) {
|
|
@@ -430,7 +624,16 @@ const BOARD_SCRIPT = `
|
|
|
430
624
|
html += '<div class="detail-field-value">' + escapeHtmlClient(task.updated_at) + '</div>';
|
|
431
625
|
html += '</div>';
|
|
432
626
|
|
|
627
|
+
// Body (editable)
|
|
628
|
+
html += '<div class="detail-field description-field-wrapper">';
|
|
629
|
+
html += '<div class="detail-field-label">Description</div>';
|
|
630
|
+
html += '<textarea id="detail-edit-body" class="detail-edit-textarea">' + escapeHtmlClient(task.body || '') + '</textarea>';
|
|
631
|
+
html += '</div>';
|
|
632
|
+
|
|
433
633
|
detailPanelBody.innerHTML = html;
|
|
634
|
+
|
|
635
|
+
// Render tags section after DOM update
|
|
636
|
+
loadAllTags().then(() => renderTagsSection([...tags]));
|
|
434
637
|
}
|
|
435
638
|
|
|
436
639
|
function escapeHtmlClient(str) {
|
|
@@ -476,7 +679,11 @@ const BOARD_SCRIPT = `
|
|
|
476
679
|
if (!res.ok) throw new Error('Server error');
|
|
477
680
|
const data = await res.json();
|
|
478
681
|
renderDetailPanel(data);
|
|
479
|
-
detailPanel.classList.
|
|
682
|
+
if (!detailPanel.classList.contains('open')) {
|
|
683
|
+
const preferredWidth = detailPanel.dataset.preferredWidth || PANEL_DEFAULT_WIDTH;
|
|
684
|
+
detailPanel.style.width = preferredWidth + 'px';
|
|
685
|
+
detailPanel.classList.add('open');
|
|
686
|
+
}
|
|
480
687
|
} catch {
|
|
481
688
|
showToast('Failed to load task details');
|
|
482
689
|
}
|
|
@@ -518,7 +725,11 @@ const BOARD_SCRIPT = `
|
|
|
518
725
|
if (!res.ok) throw new Error('Server error');
|
|
519
726
|
const data = await res.json();
|
|
520
727
|
renderDetailPanel(data);
|
|
521
|
-
detailPanel.classList.
|
|
728
|
+
if (!detailPanel.classList.contains('open')) {
|
|
729
|
+
const preferredWidth = detailPanel.dataset.preferredWidth || PANEL_DEFAULT_WIDTH;
|
|
730
|
+
detailPanel.style.width = preferredWidth + 'px';
|
|
731
|
+
detailPanel.classList.add('open');
|
|
732
|
+
}
|
|
522
733
|
} catch {
|
|
523
734
|
showToast('Failed to load task details');
|
|
524
735
|
}
|
|
@@ -594,17 +805,6 @@ const BOARD_BODY_STATIC = `
|
|
|
594
805
|
<div class="context-menu" id="context-menu">
|
|
595
806
|
<div class="context-menu-item danger" id="ctx-delete">Delete task</div>
|
|
596
807
|
</div>
|
|
597
|
-
<div class="detail-panel" id="detail-panel">
|
|
598
|
-
<div class="detail-panel-resize-handle" id="detail-panel-resize-handle"></div>
|
|
599
|
-
<div class="detail-panel-header">
|
|
600
|
-
<h2 id="detail-panel-title">Task Detail</h2>
|
|
601
|
-
<button class="detail-panel-close" id="detail-panel-close" title="Close">×</button>
|
|
602
|
-
</div>
|
|
603
|
-
<div class="detail-panel-body" id="detail-panel-body"></div>
|
|
604
|
-
<div class="detail-panel-footer">
|
|
605
|
-
<button id="detail-save-btn">Save</button>
|
|
606
|
-
</div>
|
|
607
|
-
</div>
|
|
608
808
|
<div class="toast" id="toast">Failed to update task</div>
|
|
609
809
|
<script>${BOARD_SCRIPT}
|
|
610
810
|
</script>`;
|
|
@@ -622,7 +822,9 @@ function renderBoard(tasksByStatus, tagMap, boardTitle) {
|
|
|
622
822
|
</head>
|
|
623
823
|
<body>
|
|
624
824
|
<header><h1>agkan board</h1>${titleHtml}</header>
|
|
625
|
-
<div class="board"
|
|
825
|
+
<div class="board-container">
|
|
826
|
+
<div class="board">${columns}</div>${BOARD_BODY_STATIC}
|
|
827
|
+
</div>
|
|
626
828
|
</body>
|
|
627
829
|
</html>`;
|
|
628
830
|
}
|
|
@@ -685,7 +887,7 @@ function getBoardUpdatedAt(database) {
|
|
|
685
887
|
return null;
|
|
686
888
|
return `${baseRow.max_updated_at}|${tagsRow.max_created_at}|${tagsRow.count}`;
|
|
687
889
|
}
|
|
688
|
-
function registerTaskApiRoutes(app, { ts, tts, ms }) {
|
|
890
|
+
function registerTaskApiRoutes(app, { ts, tts, tags, ms }) {
|
|
689
891
|
app.get('/api/tasks', (c) => c.json({ tasks: ts.listTasks({}, 'id', 'asc') }));
|
|
690
892
|
app.post('/api/tasks', async (c) => {
|
|
691
893
|
const body = await c.req.json();
|
|
@@ -726,6 +928,34 @@ function registerTaskApiRoutes(app, { ts, tts, ms }) {
|
|
|
726
928
|
ts.deleteTask(id);
|
|
727
929
|
return c.json({ success: true });
|
|
728
930
|
});
|
|
931
|
+
app.get('/api/tags', (c) => c.json({ tags: tags.listTags() }));
|
|
932
|
+
app.post('/api/tasks/:id/tags', async (c) => {
|
|
933
|
+
const id = Number(c.req.param('id'));
|
|
934
|
+
if (isNaN(id))
|
|
935
|
+
return c.json({ error: 'Invalid task id' }, 400);
|
|
936
|
+
const body = await c.req.json();
|
|
937
|
+
if (body.tagId === undefined || body.tagId === null)
|
|
938
|
+
return c.json({ error: 'tagId is required' }, 400);
|
|
939
|
+
const tagId = Number(body.tagId);
|
|
940
|
+
if (!ts.getTask(id))
|
|
941
|
+
return c.json({ error: 'Task not found' }, 404);
|
|
942
|
+
if (!tags.getTag(tagId))
|
|
943
|
+
return c.json({ error: 'Tag not found' }, 404);
|
|
944
|
+
tts.addTagToTask({ task_id: id, tag_id: tagId });
|
|
945
|
+
return c.json({ success: true }, 201);
|
|
946
|
+
});
|
|
947
|
+
app.delete('/api/tasks/:id/tags/:tagId', (c) => {
|
|
948
|
+
const id = Number(c.req.param('id'));
|
|
949
|
+
if (isNaN(id))
|
|
950
|
+
return c.json({ error: 'Invalid task id' }, 400);
|
|
951
|
+
const tagId = Number(c.req.param('tagId'));
|
|
952
|
+
if (isNaN(tagId))
|
|
953
|
+
return c.json({ error: 'Invalid tag id' }, 400);
|
|
954
|
+
const removed = tts.removeTagFromTask(id, tagId);
|
|
955
|
+
if (!removed)
|
|
956
|
+
return c.json({ error: 'Tag not attached to task' }, 404);
|
|
957
|
+
return c.json({ success: true });
|
|
958
|
+
});
|
|
729
959
|
}
|
|
730
960
|
function buildBoardCardsPayload(tasksByStatus, tagMap) {
|
|
731
961
|
return STATUSES.map((status) => {
|
|
@@ -748,11 +978,12 @@ function registerBoardRoutes(app, services) {
|
|
|
748
978
|
});
|
|
749
979
|
registerTaskApiRoutes(app, services);
|
|
750
980
|
}
|
|
751
|
-
function createBoardApp(taskService, taskTagService, metadataService, db, boardTitle) {
|
|
981
|
+
function createBoardApp(taskService, taskTagService, metadataService, db, boardTitle, tagService) {
|
|
752
982
|
const app = new hono_1.Hono();
|
|
753
983
|
const services = {
|
|
754
984
|
ts: taskService ?? new TaskService_1.TaskService(),
|
|
755
985
|
tts: taskTagService ?? new TaskTagService_1.TaskTagService(),
|
|
986
|
+
tags: tagService ?? new TagService_1.TagService(),
|
|
756
987
|
ms: metadataService ?? new MetadataService_1.MetadataService(),
|
|
757
988
|
database: db ?? (0, connection_1.getDatabase)(),
|
|
758
989
|
boardTitle,
|
package/dist/board/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/board/server.ts"],"names":[],"mappings":";;AA8xBA,wCAiBC;AAED,4CAMC;AAvzBD,+BAA4B;AAC5B,mDAA0C;AAC1C,yD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;QACpC,EAAE,EAAE,eAAe,IAAI,IAAI,iCAAe,EAAE;QAC5C,QAAQ,EAAE,EAAE,IAAI,IAAA,wBAAW,GAAE;QAC7B,UAAU;KACX,CAAC;IACF,mBAAmB,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACnC,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAgB,gBAAgB,CAAC,IAAY,EAAE,UAAmB;IAChE,MAAM,GAAG,GAAG,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IAEnF,IAAA,mBAAK,EAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE;QACrC,OAAO,CAAC,GAAG,CAAC,qCAAqC,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/comment/add.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiE7D"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Comment add command handler
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.setupCommentAddCommand = setupCommentAddCommand;
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const services_1 = require("../../../services");
|
|
12
|
+
const error_handler_1 = require("../../utils/error-handler");
|
|
13
|
+
const output_formatter_1 = require("../../utils/output-formatter");
|
|
14
|
+
const format_1 = require("../../../utils/format");
|
|
15
|
+
function setupCommentAddCommand(program) {
|
|
16
|
+
// Find or create task command
|
|
17
|
+
let taskCommand = program.commands.find((cmd) => cmd.name() === 'task');
|
|
18
|
+
if (!taskCommand) {
|
|
19
|
+
taskCommand = program.command('task').description('Task management commands');
|
|
20
|
+
}
|
|
21
|
+
// Find or create comment command group
|
|
22
|
+
let commentCommand = taskCommand.commands.find((cmd) => cmd.name() === 'comment');
|
|
23
|
+
if (!commentCommand) {
|
|
24
|
+
commentCommand = taskCommand.command('comment').description('Task comment commands');
|
|
25
|
+
}
|
|
26
|
+
commentCommand
|
|
27
|
+
.command('add')
|
|
28
|
+
.argument('<task-id>', 'Task ID')
|
|
29
|
+
.argument('<content>', 'Comment content')
|
|
30
|
+
.description('Add a comment to a task')
|
|
31
|
+
.option('--author <author>', 'Comment author')
|
|
32
|
+
.option('--json', 'Output in JSON format')
|
|
33
|
+
.action(async (taskId, content, options) => {
|
|
34
|
+
const formatter = (0, output_formatter_1.createFormatter)(options);
|
|
35
|
+
try {
|
|
36
|
+
const taskService = new services_1.TaskService();
|
|
37
|
+
const commentService = new services_1.CommentService();
|
|
38
|
+
// Validate task ID
|
|
39
|
+
const parsedTaskId = (0, error_handler_1.validateIdInput)(taskId, 'Task', options);
|
|
40
|
+
// Check if task exists
|
|
41
|
+
const task = taskService.getTask(parsedTaskId);
|
|
42
|
+
if (!task) {
|
|
43
|
+
formatter.error(`Task with ID ${taskId} not found`, () => {
|
|
44
|
+
console.log(chalk_1.default.red(`\nError: Task with ID ${taskId} not found\n`));
|
|
45
|
+
});
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
// Add comment (validation is done in CommentService)
|
|
49
|
+
const comment = commentService.addComment({
|
|
50
|
+
task_id: parsedTaskId,
|
|
51
|
+
content,
|
|
52
|
+
author: options.author,
|
|
53
|
+
});
|
|
54
|
+
formatter.output(() => ({ success: true, data: comment }), () => {
|
|
55
|
+
console.log(chalk_1.default.green(`\n✓ Comment added successfully\n`));
|
|
56
|
+
console.log(`ID: ${comment.id}`);
|
|
57
|
+
if (comment.author) {
|
|
58
|
+
console.log(`Author: ${comment.author}`);
|
|
59
|
+
}
|
|
60
|
+
console.log(`Content: ${comment.content}`);
|
|
61
|
+
console.log(`Created: ${(0, format_1.formatDate)(comment.created_at)}\n`);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
66
|
+
formatter.error(message, () => {
|
|
67
|
+
console.log(chalk_1.default.red(`\nError: ${message}\n`));
|
|
68
|
+
});
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../../src/cli/commands/comment/add.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AASH,wDAiEC;AAvED,kDAA0B;AAC1B,gDAAgE;AAChE,6DAA4D;AAC5D,mEAA+D;AAC/D,kDAAmD;AAEnD,SAAgB,sBAAsB,CAAC,OAAgB;IACrD,8BAA8B;IAC9B,IAAI,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,MAAM,CAAC,CAAC;IACxE,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;IAChF,CAAC;IAED,uCAAuC;IACvC,IAAI,cAAc,GAAG,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,SAAS,CAAC,CAAC;IAClF,IAAI,CAAC,cAAc,EAAE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,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkDhE"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Comment delete command handler
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.setupCommentDeleteCommand = setupCommentDeleteCommand;
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const services_1 = require("../../../services");
|
|
12
|
+
const error_handler_1 = require("../../utils/error-handler");
|
|
13
|
+
const output_formatter_1 = require("../../utils/output-formatter");
|
|
14
|
+
function setupCommentDeleteCommand(program) {
|
|
15
|
+
// Find or create task command
|
|
16
|
+
let taskCommand = program.commands.find((cmd) => cmd.name() === 'task');
|
|
17
|
+
if (!taskCommand) {
|
|
18
|
+
taskCommand = program.command('task').description('Task management commands');
|
|
19
|
+
}
|
|
20
|
+
// Find or create comment command group
|
|
21
|
+
let commentCommand = taskCommand.commands.find((cmd) => cmd.name() === 'comment');
|
|
22
|
+
if (!commentCommand) {
|
|
23
|
+
commentCommand = taskCommand.command('comment').description('Task comment commands');
|
|
24
|
+
}
|
|
25
|
+
commentCommand
|
|
26
|
+
.command('delete')
|
|
27
|
+
.argument('<comment-id>', 'Comment ID')
|
|
28
|
+
.description('Delete a comment')
|
|
29
|
+
.option('--json', 'Output in JSON format')
|
|
30
|
+
.action(async (commentId, options) => {
|
|
31
|
+
const formatter = (0, output_formatter_1.createFormatter)(options);
|
|
32
|
+
try {
|
|
33
|
+
const commentService = new services_1.CommentService();
|
|
34
|
+
// Validate comment ID
|
|
35
|
+
const parsedCommentId = (0, error_handler_1.validateIdInput)(commentId, 'Comment', options);
|
|
36
|
+
// Delete comment
|
|
37
|
+
const deleted = commentService.deleteComment(parsedCommentId);
|
|
38
|
+
if (!deleted) {
|
|
39
|
+
formatter.error(`Comment with ID ${commentId} not found`, () => {
|
|
40
|
+
console.log(chalk_1.default.red(`\nError: Comment with ID ${commentId} not found\n`));
|
|
41
|
+
});
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
formatter.output(() => ({ success: true, message: 'Comment deleted' }), () => {
|
|
45
|
+
console.log(chalk_1.default.green(`\n✓ Comment deleted successfully\n`));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
50
|
+
formatter.error(message, () => {
|
|
51
|
+
console.log(chalk_1.default.red(`\nError: ${message}\n`));
|
|
52
|
+
});
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/cli/commands/comment/delete.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAQH,8DAkDC;AAvDD,kDAA0B;AAC1B,gDAAmD;AACnD,6DAA4D;AAC5D,mEAA+D;AAE/D,SAAgB,yBAAyB,CAAC,OAAgB;IACxD,8BAA8B;IAC9B,IAAI,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,MAAM,CAAC,CAAC;IACxE,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;IAChF,CAAC;IAED,uCAAuC;IACvC,IAAI,cAAc,GAAG,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,SAAS,CAA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KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YACzE,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE;gBAC5B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,YAAY,OAAO,IAAI,CAAC,CAAC,CAAC;YAClD,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/comment/list.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+D9D"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Comment list command handler
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.setupCommentListCommand = setupCommentListCommand;
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const services_1 = require("../../../services");
|
|
12
|
+
const error_handler_1 = require("../../utils/error-handler");
|
|
13
|
+
const output_formatter_1 = require("../../utils/output-formatter");
|
|
14
|
+
const format_1 = require("../../../utils/format");
|
|
15
|
+
function setupCommentListCommand(program) {
|
|
16
|
+
// Find or create task command
|
|
17
|
+
let taskCommand = program.commands.find((cmd) => cmd.name() === 'task');
|
|
18
|
+
if (!taskCommand) {
|
|
19
|
+
taskCommand = program.command('task').description('Task management commands');
|
|
20
|
+
}
|
|
21
|
+
// Find or create comment command group
|
|
22
|
+
let commentCommand = taskCommand.commands.find((cmd) => cmd.name() === 'comment');
|
|
23
|
+
if (!commentCommand) {
|
|
24
|
+
commentCommand = taskCommand.command('comment').description('Task comment commands');
|
|
25
|
+
}
|
|
26
|
+
commentCommand
|
|
27
|
+
.command('list')
|
|
28
|
+
.argument('<task-id>', 'Task ID')
|
|
29
|
+
.description('List all comments for a task')
|
|
30
|
+
.option('--json', 'Output in JSON format')
|
|
31
|
+
.action(async (taskId, options) => {
|
|
32
|
+
const formatter = (0, output_formatter_1.createFormatter)(options);
|
|
33
|
+
try {
|
|
34
|
+
const taskService = new services_1.TaskService();
|
|
35
|
+
const commentService = new services_1.CommentService();
|
|
36
|
+
// Validate task ID
|
|
37
|
+
const parsedTaskId = (0, error_handler_1.validateIdInput)(taskId, 'Task', options);
|
|
38
|
+
// Check if task exists
|
|
39
|
+
const task = taskService.getTask(parsedTaskId);
|
|
40
|
+
if (!task) {
|
|
41
|
+
formatter.error(`Task with ID ${taskId} not found`, () => {
|
|
42
|
+
console.log(chalk_1.default.red(`\nError: Task with ID ${taskId} not found\n`));
|
|
43
|
+
});
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
// List comments
|
|
47
|
+
const comments = commentService.listComments(parsedTaskId);
|
|
48
|
+
formatter.output(() => ({ success: true, data: comments }), () => {
|
|
49
|
+
if (comments.length === 0) {
|
|
50
|
+
console.log(chalk_1.default.yellow(`\nNo comments found for task #${parsedTaskId}\n`));
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
console.log(chalk_1.default.green(`\n✓ Comments for task #${parsedTaskId}\n`));
|
|
54
|
+
comments.forEach((comment) => {
|
|
55
|
+
const author = comment.author ? `[${comment.author}]` : '[anonymous]';
|
|
56
|
+
console.log(`#${comment.id} ${author} ${(0, format_1.formatDate)(comment.created_at)}`);
|
|
57
|
+
console.log(` ${comment.content}`);
|
|
58
|
+
console.log();
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
65
|
+
formatter.error(message, () => {
|
|
66
|
+
console.log(chalk_1.default.red(`\nError: ${message}\n`));
|
|
67
|
+
});
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/cli/commands/comment/list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AASH,0DA+DC;AArED,kDAA0B;AAC1B,gDAAgE;AAChE,6DAA4D;AAC5D,mEAA+D;AAC/D,kDAAmD;AAEnD,SAAgB,uBAAuB,CAAC,OAAgB;IACtD,8BAA8B;IAC9B,IAAI,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,MAAM,CAAC,CAAC;IACxE,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC;IAChF,CAAC;IAED,uCAAuC;IACvC,IAAI,cAAc,GAAG,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,SAAS,CAAC,CAAC;IAClF,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,cAAc,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;IACvF,CAAC;IAED,cAAc;SACX,OAAO,CAAC,MAAM,CAAC;SACf,QAAQ,CAAC,WAAW,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CAAC,KAAK,CAAC,0BAA0B,YAAY,IAAI,CAAC,CAAC,CAAC;oBACrE,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;wBAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC;wBACtE,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,EAAE,IAAI,MAAM,IAAI,IAAA,mBAAU,EAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;wBAC1E,OAAO,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;wBACpC,OAAO,CAAC,GAAG,EAAE,CAAC;oBAChB,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YACzE,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE;gBAC5B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,YAAY,OAAO,IAAI,CAAC,CAAC,CAAC;YAClD,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface TaskComment {
|
|
2
|
+
id: number;
|
|
3
|
+
task_id: number;
|
|
4
|
+
author: string | null;
|
|
5
|
+
content: string;
|
|
6
|
+
created_at: string;
|
|
7
|
+
updated_at: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* TaskComment creation input type
|
|
11
|
+
*
|
|
12
|
+
* Security constraints:
|
|
13
|
+
* - content: max 5000 characters (required)
|
|
14
|
+
* - author: max 100 characters (optional)
|
|
15
|
+
*/
|
|
16
|
+
export interface CreateTaskCommentInput {
|
|
17
|
+
task_id: number;
|
|
18
|
+
author?: string;
|
|
19
|
+
content: string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=TaskComment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskComment.d.ts","sourceRoot":"","sources":["../../src/models/TaskComment.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskComment.js","sourceRoot":"","sources":["../../src/models/TaskComment.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { TaskComment, CreateTaskCommentInput } from '../models';
|
|
2
|
+
import { StorageProvider } from '../db/types/storage';
|
|
3
|
+
/**
|
|
4
|
+
* Comment Service
|
|
5
|
+
* Manages creation, retrieval, and deletion of task comments
|
|
6
|
+
*/
|
|
7
|
+
export declare class CommentService {
|
|
8
|
+
private db;
|
|
9
|
+
constructor(db?: StorageProvider);
|
|
10
|
+
/**
|
|
11
|
+
* Add a comment to a task
|
|
12
|
+
* @param input - Comment creation input
|
|
13
|
+
* @returns Created comment object
|
|
14
|
+
*/
|
|
15
|
+
addComment(input: CreateTaskCommentInput): TaskComment;
|
|
16
|
+
/**
|
|
17
|
+
* Get a comment by ID
|
|
18
|
+
* @param id - Comment ID
|
|
19
|
+
* @returns Comment object or null if not found
|
|
20
|
+
*/
|
|
21
|
+
getComment(id: number): TaskComment | null;
|
|
22
|
+
/**
|
|
23
|
+
* List comments for a task
|
|
24
|
+
* @param taskId - Task ID
|
|
25
|
+
* @returns Array of comment objects ordered by created_at ASC
|
|
26
|
+
*/
|
|
27
|
+
listComments(taskId: number): TaskComment[];
|
|
28
|
+
/**
|
|
29
|
+
* Delete a comment by ID
|
|
30
|
+
* @param id - Comment ID
|
|
31
|
+
* @returns True if deletion succeeded, false if comment not found
|
|
32
|
+
*/
|
|
33
|
+
deleteComment(id: number): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Delete all comments for a task
|
|
36
|
+
* @param taskId - Task ID
|
|
37
|
+
* @returns Number of deleted comments
|
|
38
|
+
*/
|
|
39
|
+
deleteAllComments(taskId: number): number;
|
|
40
|
+
/**
|
|
41
|
+
* Get all comments for multiple tasks at once
|
|
42
|
+
* Avoids the N+1 problem by fetching all comments in a single query
|
|
43
|
+
* @param taskIds - Array of task IDs
|
|
44
|
+
* @returns Map<task_id, TaskComment[]>
|
|
45
|
+
*/
|
|
46
|
+
getCommentsForTasks(taskIds: number[]): Map<number, TaskComment[]>;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=CommentService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommentService.d.ts","sourceRoot":"","sources":["../../src/services/CommentService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,EAAE,CAAkB;gBAEhB,EAAE,CAAC,EAAE,eAAe;IAIhC;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,sBAAsB,GAAG,WAAW;IAoBtD;;;;OAIG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAa1C;;;;OAIG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE;IAc3C;;;;OAIG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAalC;;;;OAIG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAazC;;;;;OAKG;IACH,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC;CA2BnE"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommentService = void 0;
|
|
4
|
+
const connection_1 = require("../db/connection");
|
|
5
|
+
const input_validators_1 = require("../utils/input-validators");
|
|
6
|
+
/**
|
|
7
|
+
* Comment Service
|
|
8
|
+
* Manages creation, retrieval, and deletion of task comments
|
|
9
|
+
*/
|
|
10
|
+
class CommentService {
|
|
11
|
+
constructor(db) {
|
|
12
|
+
this.db = db || (0, connection_1.getDatabase)();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Add a comment to a task
|
|
16
|
+
* @param input - Comment creation input
|
|
17
|
+
* @returns Created comment object
|
|
18
|
+
*/
|
|
19
|
+
addComment(input) {
|
|
20
|
+
const db = this.db;
|
|
21
|
+
const errors = (0, input_validators_1.validateCommentInput)(input);
|
|
22
|
+
if (errors.length > 0) {
|
|
23
|
+
throw new Error(errors[0].message);
|
|
24
|
+
}
|
|
25
|
+
const now = new Date().toISOString();
|
|
26
|
+
const stmt = db.prepare(`
|
|
27
|
+
INSERT INTO task_comments (task_id, author, content, created_at, updated_at)
|
|
28
|
+
VALUES (?, ?, ?, ?, ?)
|
|
29
|
+
`);
|
|
30
|
+
const result = stmt.run(input.task_id, input.author ?? null, input.content, now, now);
|
|
31
|
+
return this.getComment(result.lastInsertRowid);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get a comment by ID
|
|
35
|
+
* @param id - Comment ID
|
|
36
|
+
* @returns Comment object or null if not found
|
|
37
|
+
*/
|
|
38
|
+
getComment(id) {
|
|
39
|
+
const db = this.db;
|
|
40
|
+
const stmt = db.prepare(`
|
|
41
|
+
SELECT * FROM task_comments
|
|
42
|
+
WHERE id = ?
|
|
43
|
+
`);
|
|
44
|
+
const result = stmt.get(id);
|
|
45
|
+
return result ? result : null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* List comments for a task
|
|
49
|
+
* @param taskId - Task ID
|
|
50
|
+
* @returns Array of comment objects ordered by created_at ASC
|
|
51
|
+
*/
|
|
52
|
+
listComments(taskId) {
|
|
53
|
+
const db = this.db;
|
|
54
|
+
const stmt = db.prepare(`
|
|
55
|
+
SELECT * FROM task_comments
|
|
56
|
+
WHERE task_id = ?
|
|
57
|
+
ORDER BY created_at ASC
|
|
58
|
+
`);
|
|
59
|
+
const results = stmt.all(taskId);
|
|
60
|
+
return results;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Delete a comment by ID
|
|
64
|
+
* @param id - Comment ID
|
|
65
|
+
* @returns True if deletion succeeded, false if comment not found
|
|
66
|
+
*/
|
|
67
|
+
deleteComment(id) {
|
|
68
|
+
const db = this.db;
|
|
69
|
+
const stmt = db.prepare(`
|
|
70
|
+
DELETE FROM task_comments
|
|
71
|
+
WHERE id = ?
|
|
72
|
+
`);
|
|
73
|
+
const result = stmt.run(id);
|
|
74
|
+
return result.changes > 0;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Delete all comments for a task
|
|
78
|
+
* @param taskId - Task ID
|
|
79
|
+
* @returns Number of deleted comments
|
|
80
|
+
*/
|
|
81
|
+
deleteAllComments(taskId) {
|
|
82
|
+
const db = this.db;
|
|
83
|
+
const stmt = db.prepare(`
|
|
84
|
+
DELETE FROM task_comments
|
|
85
|
+
WHERE task_id = ?
|
|
86
|
+
`);
|
|
87
|
+
const result = stmt.run(taskId);
|
|
88
|
+
return result.changes;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Get all comments for multiple tasks at once
|
|
92
|
+
* Avoids the N+1 problem by fetching all comments in a single query
|
|
93
|
+
* @param taskIds - Array of task IDs
|
|
94
|
+
* @returns Map<task_id, TaskComment[]>
|
|
95
|
+
*/
|
|
96
|
+
getCommentsForTasks(taskIds) {
|
|
97
|
+
const db = this.db;
|
|
98
|
+
if (taskIds.length === 0) {
|
|
99
|
+
return new Map();
|
|
100
|
+
}
|
|
101
|
+
const placeholders = taskIds.map(() => '?').join(', ');
|
|
102
|
+
const stmt = db.prepare(`
|
|
103
|
+
SELECT * FROM task_comments
|
|
104
|
+
WHERE task_id IN (${placeholders})
|
|
105
|
+
ORDER BY task_id, created_at ASC
|
|
106
|
+
`);
|
|
107
|
+
const results = stmt.all(...taskIds);
|
|
108
|
+
const commentsMap = new Map();
|
|
109
|
+
for (const row of results) {
|
|
110
|
+
const taskId = row.task_id;
|
|
111
|
+
if (!commentsMap.has(taskId)) {
|
|
112
|
+
commentsMap.set(taskId, []);
|
|
113
|
+
}
|
|
114
|
+
commentsMap.get(taskId).push(row);
|
|
115
|
+
}
|
|
116
|
+
return commentsMap;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.CommentService = CommentService;
|
|
120
|
+
//# sourceMappingURL=CommentService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommentService.js","sourceRoot":"","sources":["../../src/services/CommentService.ts"],"names":[],"mappings":";;;AACA,iDAA+C;AAE/C,gEAAiE;AAEjE;;;GAGG;AACH,MAAa,cAAc;IAGzB,YAAY,EAAoB;QAC9B,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,IAAA,wBAAW,GAAE,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,KAA6B;QACtC,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