@alpacachen/dsh-kanban 1.7.0 → 1.8.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.md +41 -21
- package/README.zh.md +40 -20
- package/index.js +101 -60
- package/lib/client.js +235 -45
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -7,14 +7,15 @@
|
|
|
7
7
|
* Responsibilities:
|
|
8
8
|
* - Workspace isolation: boards are keyed by workspaceId, one board per workspace.
|
|
9
9
|
* - Persistence: ctx.fs writes <workspace.path>/.dsh-kanban.json.
|
|
10
|
-
* - Agent tools: ctx.tools.register exposes
|
|
10
|
+
* - Agent tools: ctx.tools.register exposes 16 kanban_* tools.
|
|
11
11
|
* - Browser API: ctx.get('connection') registers the authenticated /api/kanban route.
|
|
12
12
|
*
|
|
13
13
|
* Per-workspace data model (disk files include schemaVersion):
|
|
14
|
-
* schemaVersion:
|
|
14
|
+
* schemaVersion: 4
|
|
15
|
+
* completedColumnId: string | null
|
|
15
16
|
* columns: [{ id, title }]
|
|
16
17
|
* labels: [{ name, color }] // name is the unique key and binds the color
|
|
17
|
-
* cards: [{ id, columnId, title, note, label, priority, createdAt, createdBy,
|
|
18
|
+
* cards: [{ id, columnId, title, note, label, priority, dueDate, createdAt, createdBy,
|
|
18
19
|
* comments: [{ id, content, source, createdAt }] }]
|
|
19
20
|
* activities: [{ id, ts, cardId, type, source, field?, from?, to?, meta? }] // append-only log
|
|
20
21
|
*
|
|
@@ -45,7 +46,7 @@ export const inject = ['tools']
|
|
|
45
46
|
// Back up old files before following the migration chain on first access.
|
|
46
47
|
// ---------------------------------------------------------------------------
|
|
47
48
|
|
|
48
|
-
export const SCHEMA_VERSION =
|
|
49
|
+
export const SCHEMA_VERSION = 4
|
|
49
50
|
export const LEGACY_VERSION = 0
|
|
50
51
|
|
|
51
52
|
// Append-only activity log persisted with the board; drop oldest events above the limit.
|
|
@@ -64,6 +65,15 @@ const isObj = (v) => typeof v === 'object' && v !== null && !Array.isArray(v)
|
|
|
64
65
|
const strField = (v, fb) => (typeof v === 'string' && v ? v : fb)
|
|
65
66
|
const normColor = (v) => (typeof v === 'string' && /^#[0-9a-fA-F]{6}$/.test(v) ? v.toLowerCase() : '#94a3b8')
|
|
66
67
|
|
|
68
|
+
// Calendar dates stay date-only; parsing them as timestamps can shift the day by timezone.
|
|
69
|
+
const isDueDate = (value) => {
|
|
70
|
+
if (typeof value !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(value)) return false
|
|
71
|
+
const [year, month, day] = value.split('-').map(Number)
|
|
72
|
+
if (year < 1 || month < 1 || month > 12 || day < 1) return false
|
|
73
|
+
const leapYear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0)
|
|
74
|
+
return day <= [31, leapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month - 1]
|
|
75
|
+
}
|
|
76
|
+
|
|
67
77
|
// Canonical v1 entity shapes: fill missing defaults without changing valid data.
|
|
68
78
|
const normColumn = (c) =>
|
|
69
79
|
isObj(c) ? { id: strField(c.id, ''), title: strField(c.title, 'Untitled') } : null
|
|
@@ -128,6 +138,13 @@ export const MIGRATIONS = {
|
|
|
128
138
|
activities: pick(src.activities),
|
|
129
139
|
}
|
|
130
140
|
},
|
|
141
|
+
3: (data) => ({
|
|
142
|
+
...data,
|
|
143
|
+
schemaVersion: 4,
|
|
144
|
+
// Existing boards choose completion explicitly; titles and positions are customizable.
|
|
145
|
+
completedColumnId: null,
|
|
146
|
+
cards: Array.isArray(data.cards) ? data.cards.map((card) => isObj(card) ? { ...card, dueDate: null } : card) : data.cards,
|
|
147
|
+
}),
|
|
131
148
|
}
|
|
132
149
|
|
|
133
150
|
/**
|
|
@@ -184,6 +201,10 @@ export function validateBoard(data) {
|
|
|
184
201
|
}
|
|
185
202
|
}
|
|
186
203
|
|
|
204
|
+
if (data.completedColumnId !== null && !columnIds.has(data.completedColumnId)) {
|
|
205
|
+
errors.push('completedColumnId must be null or reference an existing column')
|
|
206
|
+
}
|
|
207
|
+
|
|
187
208
|
const labelNames = new Set()
|
|
188
209
|
if (Array.isArray(data.labels)) {
|
|
189
210
|
for (const l of data.labels) {
|
|
@@ -213,6 +234,7 @@ export function validateBoard(data) {
|
|
|
213
234
|
}
|
|
214
235
|
if (!columnIds.has(c.columnId)) errors.push('card references missing column: ' + c.id)
|
|
215
236
|
if (c.label != null && !labelNames.has(c.label)) errors.push('card references missing label: ' + c.id)
|
|
237
|
+
if (c.dueDate !== null && !isDueDate(c.dueDate)) errors.push('card has invalid due date: ' + c.id)
|
|
216
238
|
if (c.priority != null && !['high', 'medium', 'low'].includes(c.priority)) errors.push('card has invalid priority: ' + c.id)
|
|
217
239
|
for (const comment of c.comments) {
|
|
218
240
|
if (!isObj(comment) || typeof comment.id !== 'string' || !comment.id || typeof comment.content !== 'string' || !comment.content.trim() || comment.content.length > 2000 || !['human', 'agent'].includes(comment.source) || typeof comment.createdAt !== 'string' || !comment.createdAt) {
|
|
@@ -430,6 +452,7 @@ export function apply(ctx) {
|
|
|
430
452
|
const load = (async () => {
|
|
431
453
|
const board = {
|
|
432
454
|
schemaVersion: SCHEMA_VERSION,
|
|
455
|
+
completedColumnId: null,
|
|
433
456
|
columns: [],
|
|
434
457
|
labels: [],
|
|
435
458
|
cards: [],
|
|
@@ -440,12 +463,15 @@ export function apply(ctx) {
|
|
|
440
463
|
const fs = getFs()
|
|
441
464
|
const target = await targetOf(workspace)
|
|
442
465
|
let migrated = false
|
|
466
|
+
let loadedBoard = false
|
|
443
467
|
if (fs && target) {
|
|
444
468
|
try {
|
|
445
469
|
const text = await fs.readText(target)
|
|
446
470
|
const parsed = parseBoardText(text)
|
|
447
471
|
for (const w of parsed.warnings) warn(board, w)
|
|
448
472
|
if (parsed.ok) {
|
|
473
|
+
loadedBoard = true
|
|
474
|
+
board.completedColumnId = parsed.data.completedColumnId
|
|
449
475
|
board.columns = parsed.data.columns
|
|
450
476
|
board.labels = parsed.data.labels
|
|
451
477
|
board.cards = parsed.data.cards
|
|
@@ -486,7 +512,11 @@ export function apply(ctx) {
|
|
|
486
512
|
}
|
|
487
513
|
for (const act of board.activities) bumpSeq(act.id)
|
|
488
514
|
if (board.columns.length === 0) {
|
|
489
|
-
for (const title of DEFAULT_COLUMNS)
|
|
515
|
+
for (const title of DEFAULT_COLUMNS) {
|
|
516
|
+
const column = { id: nextId('c'), title }
|
|
517
|
+
board.columns.push(column)
|
|
518
|
+
if (!loadedBoard && title === 'Done') board.completedColumnId = column.id
|
|
519
|
+
}
|
|
490
520
|
}
|
|
491
521
|
if (board.labels.length === 0) board.labels = DEFAULT_LABELS.map((l) => ({ ...l }))
|
|
492
522
|
boards.set(key, board)
|
|
@@ -518,6 +548,7 @@ export function apply(ctx) {
|
|
|
518
548
|
target,
|
|
519
549
|
JSON.stringify({
|
|
520
550
|
schemaVersion: SCHEMA_VERSION,
|
|
551
|
+
completedColumnId: board.completedColumnId,
|
|
521
552
|
columns: board.columns,
|
|
522
553
|
labels: board.labels,
|
|
523
554
|
cards: board.cards,
|
|
@@ -553,6 +584,7 @@ export function apply(ctx) {
|
|
|
553
584
|
const findLabel = (b, name) => b.labels.find((l) => l.name === name)
|
|
554
585
|
|
|
555
586
|
const cloneBoard = (b) => ({
|
|
587
|
+
completedColumnId: b.completedColumnId,
|
|
556
588
|
columns: b.columns.map((c) => ({ id: c.id, title: c.title })),
|
|
557
589
|
labels: b.labels.map((l) => ({ name: l.name, color: l.color })),
|
|
558
590
|
cards: b.cards.map((c) => ({
|
|
@@ -562,6 +594,7 @@ export function apply(ctx) {
|
|
|
562
594
|
note: c.note ?? '',
|
|
563
595
|
label: c.label ?? null,
|
|
564
596
|
priority: c.priority ?? null,
|
|
597
|
+
dueDate: c.dueDate,
|
|
565
598
|
createdAt: typeof c.createdAt === 'string' ? c.createdAt : null,
|
|
566
599
|
createdBy: typeof c.createdBy === 'string' ? c.createdBy : null,
|
|
567
600
|
comments: Array.isArray(c.comments)
|
|
@@ -576,6 +609,7 @@ export function apply(ctx) {
|
|
|
576
609
|
activities: Array.isArray(b.activities) ? b.activities.map((a) => ({ ...a })) : [],
|
|
577
610
|
})
|
|
578
611
|
const summaryOfClone = (clone) => ({
|
|
612
|
+
completedColumnId: clone.completedColumnId,
|
|
579
613
|
columns: clone.columns.map((c) => ({
|
|
580
614
|
id: c.id,
|
|
581
615
|
title: c.title,
|
|
@@ -588,6 +622,7 @@ export function apply(ctx) {
|
|
|
588
622
|
title: c.title,
|
|
589
623
|
label: c.label ?? null,
|
|
590
624
|
priority: c.priority ?? null,
|
|
625
|
+
dueDate: c.dueDate,
|
|
591
626
|
commentCount: c.comments.length,
|
|
592
627
|
})),
|
|
593
628
|
})
|
|
@@ -624,10 +659,11 @@ export function apply(ctx) {
|
|
|
624
659
|
case 'getCard': {
|
|
625
660
|
const card = cloneBoard(board).cards.find((c) => c.id === str(a.id, ''))
|
|
626
661
|
if (!card) return { warnings: takeWarnings(board), error: 'Card not found: ' + str(a.id, '') }
|
|
627
|
-
return { card, warnings: takeWarnings(board) }
|
|
662
|
+
return { card, completedColumnId: board.completedColumnId, warnings: takeWarnings(board) }
|
|
628
663
|
}
|
|
629
664
|
|
|
630
665
|
case 'addCard': {
|
|
666
|
+
if (a.dueDate !== undefined && a.dueDate !== null && a.dueDate !== '' && !isDueDate(a.dueDate)) return result({ error: 'Due date must be a real calendar date in YYYY-MM-DD format' })
|
|
631
667
|
const col = findColumn(board, str(a.columnId, '')) || board.columns[0]
|
|
632
668
|
if (!col) return result({ error: 'No list available' })
|
|
633
669
|
const label = typeof a.label === 'string' ? clampText(a.label, LABEL_LIMIT, 'Label', board) : undefined
|
|
@@ -639,6 +675,7 @@ export function apply(ctx) {
|
|
|
639
675
|
note: clampText(a.note, NOTE_LIMIT, 'Note', board),
|
|
640
676
|
label,
|
|
641
677
|
priority: normPriority(a.priority),
|
|
678
|
+
dueDate: a.dueDate || null,
|
|
642
679
|
createdAt: new Date().toISOString(),
|
|
643
680
|
createdBy: actor,
|
|
644
681
|
comments: [],
|
|
@@ -653,6 +690,7 @@ export function apply(ctx) {
|
|
|
653
690
|
column: col.title,
|
|
654
691
|
label: card.label ?? null,
|
|
655
692
|
priority: card.priority ?? null,
|
|
693
|
+
dueDate: card.dueDate,
|
|
656
694
|
},
|
|
657
695
|
})
|
|
658
696
|
await save(workspace, session)
|
|
@@ -660,6 +698,7 @@ export function apply(ctx) {
|
|
|
660
698
|
}
|
|
661
699
|
|
|
662
700
|
case 'updateCard': {
|
|
701
|
+
if (a.dueDate !== undefined && a.dueDate !== null && a.dueDate !== '' && !isDueDate(a.dueDate)) return result({ error: 'Due date must be a real calendar date in YYYY-MM-DD format' })
|
|
663
702
|
const card = findCard(board, str(a.id, ''))
|
|
664
703
|
if (card) {
|
|
665
704
|
const nextLabel = typeof a.label === 'string' ? clampText(a.label, LABEL_LIMIT, 'Label', board) : undefined
|
|
@@ -669,16 +708,19 @@ export function apply(ctx) {
|
|
|
669
708
|
note: card.note,
|
|
670
709
|
label: card.label ?? null,
|
|
671
710
|
priority: card.priority ?? null,
|
|
711
|
+
dueDate: card.dueDate,
|
|
672
712
|
}
|
|
673
713
|
if (typeof a.title === 'string') card.title = clampText(a.title, TITLE_LIMIT, 'Title', board) || card.title
|
|
674
714
|
if (typeof a.note === 'string') card.note = clampText(a.note, NOTE_LIMIT, 'Note', board)
|
|
675
715
|
if (typeof a.label === 'string') card.label = nextLabel || undefined
|
|
676
716
|
if (typeof a.priority === 'string') card.priority = normPriority(a.priority)
|
|
717
|
+
if (a.dueDate !== undefined) card.dueDate = a.dueDate || null
|
|
677
718
|
const after = {
|
|
678
719
|
title: card.title,
|
|
679
720
|
note: card.note,
|
|
680
721
|
label: card.label ?? null,
|
|
681
722
|
priority: card.priority ?? null,
|
|
723
|
+
dueDate: card.dueDate,
|
|
682
724
|
}
|
|
683
725
|
if (after.title !== before.title) {
|
|
684
726
|
record(board, { cardId: card.id, type: 'card_title_changed', source: actor, field: 'title', from: before.title, to: after.title })
|
|
@@ -689,6 +731,9 @@ export function apply(ctx) {
|
|
|
689
731
|
if (after.label !== before.label) {
|
|
690
732
|
record(board, { cardId: card.id, type: 'card_label_changed', source: actor, field: 'label', from: before.label, to: after.label })
|
|
691
733
|
}
|
|
734
|
+
if (after.dueDate !== before.dueDate) {
|
|
735
|
+
record(board, { cardId: card.id, type: 'card_due_date_changed', source: actor, field: 'dueDate', from: before.dueDate, to: after.dueDate })
|
|
736
|
+
}
|
|
692
737
|
if (after.priority !== before.priority) {
|
|
693
738
|
record(board, { cardId: card.id, type: 'card_priority_changed', source: actor, field: 'priority', from: before.priority, to: after.priority })
|
|
694
739
|
}
|
|
@@ -770,6 +815,17 @@ export function apply(ctx) {
|
|
|
770
815
|
return col ? result({ message: 'List renamed' }) : result({ error: 'List not found' })
|
|
771
816
|
}
|
|
772
817
|
|
|
818
|
+
case 'setCompletedColumn': {
|
|
819
|
+
if (a.columnId !== null && (typeof a.columnId !== 'string' || !findColumn(board, a.columnId))) return result({ error: 'Completion column must be null or an existing list id' })
|
|
820
|
+
const previousId = board.completedColumnId
|
|
821
|
+
if (previousId !== a.columnId) {
|
|
822
|
+
board.completedColumnId = a.columnId
|
|
823
|
+
record(board, { cardId: null, type: 'board_completed_column_changed', source: actor, field: 'completedColumnId', from: previousId, to: a.columnId, meta: { fromColumn: findColumn(board, previousId)?.title ?? null, toColumn: findColumn(board, a.columnId)?.title ?? null } })
|
|
824
|
+
await save(workspace, session)
|
|
825
|
+
}
|
|
826
|
+
return result({ message: a.columnId === null ? 'Completion column cleared' : 'Completion column updated' })
|
|
827
|
+
}
|
|
828
|
+
|
|
773
829
|
case 'deleteColumn': {
|
|
774
830
|
const id = str(a.id, '')
|
|
775
831
|
if (board.columns.length <= 1) return result({ error: 'At least one list must remain' })
|
|
@@ -777,6 +833,10 @@ export function apply(ctx) {
|
|
|
777
833
|
if (idx < 0) return result({ error: 'List not found' })
|
|
778
834
|
const deleted = board.columns[idx]
|
|
779
835
|
board.columns.splice(idx, 1)
|
|
836
|
+
if (board.completedColumnId === id) {
|
|
837
|
+
board.completedColumnId = null
|
|
838
|
+
record(board, { cardId: null, type: 'board_completed_column_changed', source: actor, field: 'completedColumnId', from: id, to: null, meta: { fromColumn: deleted.title, toColumn: null } })
|
|
839
|
+
}
|
|
780
840
|
const fallback = board.columns[0].id
|
|
781
841
|
for (const card of board.cards) {
|
|
782
842
|
if (card.columnId === id) {
|
|
@@ -903,7 +963,7 @@ export function apply(ctx) {
|
|
|
903
963
|
const registry = getWorkspaceRegistry()
|
|
904
964
|
return registry && typeof registry.get === 'function' ? registry.get(id) : undefined
|
|
905
965
|
}
|
|
906
|
-
const emptyBoardSummary = { columns: [], labels: [], cards: [] }
|
|
966
|
+
const emptyBoardSummary = { completedColumnId: null, columns: [], labels: [], cards: [] }
|
|
907
967
|
|
|
908
968
|
const runTool = async (method, args, exec) => {
|
|
909
969
|
const workspace = await workspaceOfExec(exec)
|
|
@@ -974,50 +1034,15 @@ export function apply(ctx) {
|
|
|
974
1034
|
}
|
|
975
1035
|
}
|
|
976
1036
|
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
path: '/api/kanban',
|
|
985
|
-
methods: ['POST'],
|
|
986
|
-
requestBody: 'streaming',
|
|
987
|
-
fetch: httpHandler,
|
|
988
|
-
})
|
|
989
|
-
routeState.dispose = typeof dispose === 'function' ? dispose : null
|
|
990
|
-
routeState.registered = true
|
|
991
|
-
console.log('dsh-kanban: /api/kanban route registered')
|
|
992
|
-
} catch (err) {
|
|
993
|
-
console.log('dsh-kanban: Route registration failed: ' + ((err && err.message) || err))
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
registerRoute()
|
|
997
|
-
if (!routeState.registered) {
|
|
998
|
-
const timer = ctx.get('timer')
|
|
999
|
-
if (timer) {
|
|
1000
|
-
routeState.timer = timer.interval(() => {
|
|
1001
|
-
routeState.attempts++
|
|
1002
|
-
registerRoute()
|
|
1003
|
-
maybeStartupCheck()
|
|
1004
|
-
if (routeState.registered || routeState.attempts >= 40) {
|
|
1005
|
-
if (routeState.timer) routeState.timer()
|
|
1006
|
-
routeState.timer = null
|
|
1007
|
-
}
|
|
1008
|
-
}, 500)
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1037
|
+
// Connection may arrive after tools during desktop boot; follow its lifecycle.
|
|
1038
|
+
ctx.inject(['connection'], (routeCtx) => routeCtx.connection.fetch.register({
|
|
1039
|
+
path: '/api/kanban',
|
|
1040
|
+
methods: ['POST'],
|
|
1041
|
+
requestBody: 'streaming',
|
|
1042
|
+
fetch: httpHandler,
|
|
1043
|
+
}))
|
|
1011
1044
|
|
|
1012
1045
|
// ---- Startup checks: read each workspace board and back up corrupt files ----
|
|
1013
|
-
const startupState = { done: false }
|
|
1014
|
-
const maybeStartupCheck = () => {
|
|
1015
|
-
if (startupState.done) return
|
|
1016
|
-
const registry = getWorkspaceRegistry()
|
|
1017
|
-
if (!getFs() || !registry || typeof registry.list !== 'function') return
|
|
1018
|
-
startupState.done = true
|
|
1019
|
-
runStartupCheck()
|
|
1020
|
-
}
|
|
1021
1046
|
const runStartupCheck = async () => {
|
|
1022
1047
|
const fs = getFs()
|
|
1023
1048
|
const registry = getWorkspaceRegistry()
|
|
@@ -1079,7 +1104,7 @@ export function apply(ctx) {
|
|
|
1079
1104
|
console.log('dsh-kanban: Startup check failed: ' + ((err && err.message) || err))
|
|
1080
1105
|
}
|
|
1081
1106
|
}
|
|
1082
|
-
|
|
1107
|
+
ctx.inject(['fs', 'workspaceRegistry'], () => { void runStartupCheck() })
|
|
1083
1108
|
|
|
1084
1109
|
// ---- Tool registration ----
|
|
1085
1110
|
const resultSchema = {
|
|
@@ -1102,8 +1127,9 @@ export function apply(ctx) {
|
|
|
1102
1127
|
lines.push(String((value && value.message) || ''))
|
|
1103
1128
|
if (b && Array.isArray(b.columns)) {
|
|
1104
1129
|
lines.push('Board state:')
|
|
1130
|
+
lines.push('Completion column: ' + (b.completedColumnId || 'not set'))
|
|
1105
1131
|
for (const col of b.columns) {
|
|
1106
|
-
lines.push('· ' + col.title + ' (' + col.count + ')')
|
|
1132
|
+
lines.push('· [' + col.id + '] ' + col.title + ' (' + col.count + ')' + (col.id === b.completedColumnId ? ' [completed]' : ''))
|
|
1107
1133
|
}
|
|
1108
1134
|
if (Array.isArray(b.labels) && b.labels.length > 0) {
|
|
1109
1135
|
lines.push('Labels: ' + b.labels.map((l) => l.name).join(' / '))
|
|
@@ -1115,6 +1141,8 @@ export function apply(ctx) {
|
|
|
1115
1141
|
(card.priority ? '[' + card.priority + '] ' : '') +
|
|
1116
1142
|
(card.label ? '[' + card.label + '] ' : '') +
|
|
1117
1143
|
card.title +
|
|
1144
|
+
(card.dueDate ? ' (due ' + card.dueDate + ')' : '') +
|
|
1145
|
+
(card.columnId === b.completedColumnId ? ' [completed]' : '') +
|
|
1118
1146
|
(card.commentCount ? ' (' + card.commentCount + ' comments)' : ''),
|
|
1119
1147
|
)
|
|
1120
1148
|
}
|
|
@@ -1127,7 +1155,7 @@ export function apply(ctx) {
|
|
|
1127
1155
|
const tools = [
|
|
1128
1156
|
{
|
|
1129
1157
|
name: 'kanban_get',
|
|
1130
|
-
description: 'Read the current state of the current project (workspace) kanban board (all lists, labels and
|
|
1158
|
+
description: 'Read the current state of the current project (workspace) kanban board (all lists, labels, cards with dueDate, and completedColumnId). Due dates are local calendar dates, not UTC timestamps; a date becomes overdue the following day. Cards in completedColumnId are finished and excluded from due-today/overdue checks. Resolve relative dates using the user local date and confirm the concrete YYYY-MM-DD date. Call it before planning to understand existing content and avoid duplicate cards.',
|
|
1131
1159
|
parameters: { type: 'object', properties: {} },
|
|
1132
1160
|
output: output(renderBoard),
|
|
1133
1161
|
async execute(args, exec) {
|
|
@@ -1136,7 +1164,7 @@ export function apply(ctx) {
|
|
|
1136
1164
|
},
|
|
1137
1165
|
{
|
|
1138
1166
|
name: 'kanban_get_card',
|
|
1139
|
-
description: "Read one card's full details (title, raw Markdown description in note, label, priority and comments)
|
|
1167
|
+
description: "Read one card's full details (title, raw Markdown description in note, label, priority, dueDate and comments), plus the board completion column ID from the current project (workspace) board by card id. Use kanban_get first to discover card ids; its summary omits note. Read this tool before editing an existing description to preserve its content and Markdown formatting.",
|
|
1140
1168
|
parameters: {
|
|
1141
1169
|
type: 'object',
|
|
1142
1170
|
properties: {
|
|
@@ -1151,6 +1179,7 @@ export function apply(ctx) {
|
|
|
1151
1179
|
ok: { type: 'boolean' },
|
|
1152
1180
|
message: { type: 'string' },
|
|
1153
1181
|
card: { type: 'object' },
|
|
1182
|
+
completedColumnId: { oneOf: [{ type: 'string' }, { type: 'null' }] },
|
|
1154
1183
|
warnings: { type: 'array', items: { type: 'string' } },
|
|
1155
1184
|
},
|
|
1156
1185
|
required: ['ok', 'message'],
|
|
@@ -1167,6 +1196,8 @@ export function apply(ctx) {
|
|
|
1167
1196
|
lines.push('[' + c.id + '] ' + c.title)
|
|
1168
1197
|
if (c.priority) lines.push('Priority: ' + c.priority)
|
|
1169
1198
|
if (c.label) lines.push('Label: ' + c.label)
|
|
1199
|
+
if (c.dueDate) lines.push('Due date: ' + c.dueDate + ' (local calendar date)')
|
|
1200
|
+
lines.push('Completed: ' + (c.columnId === value.completedColumnId ? 'yes' : 'no'))
|
|
1170
1201
|
if (c.note) lines.push('Note: ' + c.note)
|
|
1171
1202
|
if (Array.isArray(c.comments) && c.comments.length > 0) {
|
|
1172
1203
|
lines.push('Comments:')
|
|
@@ -1184,7 +1215,7 @@ export function apply(ctx) {
|
|
|
1184
1215
|
const session = exec && exec.agent && exec.agent.session
|
|
1185
1216
|
const r = await dispatch(workspace, 'getCard', args, 'agent', session)
|
|
1186
1217
|
if (r.error) return { ok: false, message: r.error, warnings: Array.isArray(r.warnings) ? r.warnings : [] }
|
|
1187
|
-
return { ok: true, message: 'Card ' + String(args.id || '') + ' details', card: r.card, warnings: Array.isArray(r.warnings) ? r.warnings : [] }
|
|
1218
|
+
return { ok: true, message: 'Card ' + String(args.id || '') + ' details', card: r.card, completedColumnId: r.completedColumnId, warnings: Array.isArray(r.warnings) ? r.warnings : [] }
|
|
1188
1219
|
},
|
|
1189
1220
|
},
|
|
1190
1221
|
{
|
|
@@ -1214,6 +1245,7 @@ export function apply(ctx) {
|
|
|
1214
1245
|
note: { type: 'string', description: `Task description as raw Markdown source, not HTML: background, acceptance criteria or breakdown details. Supports headings, lists, tables and fenced code blocks; preserve line breaks. Optional; max ${NOTE_LIMIT} chars including Markdown syntax and newlines. Longer input is truncated with a warning.` },
|
|
1215
1246
|
label: { type: 'string', description: `Label name (optional; max ${LABEL_LIMIT} chars): e.g. New Feature, bug, Feedback` },
|
|
1216
1247
|
priority: { type: 'string', enum: ['high', 'medium', 'low'], description: 'Priority (optional): high=P0 / medium=P1 / low=P2' },
|
|
1248
|
+
dueDate: { oneOf: [{ type: 'string' }, { type: 'null' }], description: 'Optional local calendar date in YYYY-MM-DD format, without time or timezone. Resolve relative dates such as Friday using the user local date and confirm the concrete date. Omit to keep unchanged (new cards default to no date); null or empty string clears it. Due today is not overdue until the next local day; completed-column cards are excluded.' },
|
|
1217
1249
|
},
|
|
1218
1250
|
required: ['title'],
|
|
1219
1251
|
},
|
|
@@ -1224,7 +1256,7 @@ export function apply(ctx) {
|
|
|
1224
1256
|
},
|
|
1225
1257
|
{
|
|
1226
1258
|
name: 'kanban_update_card',
|
|
1227
|
-
description: "Update a card's title, Markdown description (note), label or
|
|
1259
|
+
description: "Update a card's title, Markdown description (note), label, priority or dueDate on the board. Read kanban_get_card before editing an existing description; note replaces the whole description, not a patch.",
|
|
1228
1260
|
parameters: {
|
|
1229
1261
|
type: 'object',
|
|
1230
1262
|
properties: {
|
|
@@ -1233,6 +1265,7 @@ export function apply(ctx) {
|
|
|
1233
1265
|
note: { type: 'string', description: `Complete replacement description as raw Markdown source, not HTML; preserve line breaks. Omit to keep the description unchanged; pass an empty string to clear it. Max ${NOTE_LIMIT} chars including Markdown syntax and newlines. Longer input is truncated with a warning.` },
|
|
1234
1266
|
label: { type: 'string', description: `New label name (optional; max ${LABEL_LIMIT} chars); pass empty string to clear` },
|
|
1235
1267
|
priority: { type: 'string', enum: ['high', 'medium', 'low', ''], description: 'New priority (optional): high=P0 / medium=P1 / low=P2; pass empty string to clear' },
|
|
1268
|
+
dueDate: { oneOf: [{ type: 'string' }, { type: 'null' }], description: 'Optional local calendar date in YYYY-MM-DD format, without time or timezone. Resolve relative dates such as Friday using the user local date and confirm the concrete date. Omit to keep unchanged (new cards default to no date); null or empty string clears it. Due today is not overdue until the next local day; completed-column cards are excluded.' },
|
|
1236
1269
|
},
|
|
1237
1270
|
required: ['id'],
|
|
1238
1271
|
},
|
|
@@ -1300,6 +1333,19 @@ export function apply(ctx) {
|
|
|
1300
1333
|
return runTool('renameColumn', args, exec)
|
|
1301
1334
|
},
|
|
1302
1335
|
},
|
|
1336
|
+
{
|
|
1337
|
+
name: 'kanban_set_completed_column',
|
|
1338
|
+
description: 'Choose the one list that means completed for this board by its stable column id, or clear the setting with null. Cards in this list are excluded from due-today and overdue checks. Existing boards require an explicit choice; never infer completion from a list name or position. New boards default to Done.',
|
|
1339
|
+
parameters: {
|
|
1340
|
+
type: 'object',
|
|
1341
|
+
properties: { columnId: { oneOf: [{ type: 'string' }, { type: 'null' }], description: 'Existing list id from kanban_get, or null to clear the completion column' } },
|
|
1342
|
+
required: ['columnId'],
|
|
1343
|
+
},
|
|
1344
|
+
output: output(renderBoard),
|
|
1345
|
+
async execute(args, exec) {
|
|
1346
|
+
return runTool('setCompletedColumn', args, exec)
|
|
1347
|
+
},
|
|
1348
|
+
},
|
|
1303
1349
|
{
|
|
1304
1350
|
name: 'kanban_delete_column',
|
|
1305
1351
|
description: 'Delete a list from the board; its cards are moved into the first list. At least one list must remain.',
|
|
@@ -1423,11 +1469,6 @@ export function apply(ctx) {
|
|
|
1423
1469
|
for (const tool of tools) ctx.tools.register(tool)
|
|
1424
1470
|
|
|
1425
1471
|
return async () => {
|
|
1426
|
-
routeState.disposed = true
|
|
1427
|
-
if (routeState.timer) routeState.timer()
|
|
1428
|
-
routeState.timer = null
|
|
1429
|
-
if (routeState.dispose) await routeState.dispose()
|
|
1430
|
-
routeState.dispose = null
|
|
1431
1472
|
boards.clear()
|
|
1432
1473
|
boardLoads.clear()
|
|
1433
1474
|
workspaceQueues.clear()
|