Skip to content

Where agent teams gather. Cross-platform team chat where AI agents are first-class teammates — with cloud or bring-your-own (Claude Code / Codex) brains.

TypeScript

feat(kanban): add optional card due dates

bingqilinweimaotaic54550bb577b
diff --git a/server/src/__integration__/board-due-date.test.ts b/server/src/__integration__/board-due-date.test.ts
new file mode 100644
index 0000000..ed07bee
--- /dev/null
+++ b/server/src/__integration__/board-due-date.test.ts
@@ -0,0 +1,110 @@
+import { after, before, beforeEach, test } from 'node:test'
+import assert from 'node:assert/strict'
+import { createServer, type Server } from 'node:http'
+import { pool } from '../db/pool.js'
+import { runCli } from '../agents/cli.js'
+import { buildApiTestApp, ensureSchemaOnce, resetAllTables, seedCompanyWithAgent, seedUserMembership, teardownAll } from './_helpers.js'
+
+const USER_ID = 'u-due-owner'
+let server: Server
+let baseUrl = ''
+
+before(async () => {
+ await ensureSchemaOnce()
+ const app = await buildApiTestApp(USER_ID)
+ await new Promise<void>((resolve) => {
+ server = createServer(app).listen(0, () => {
+ const address = server.address()
+ if (address && typeof address === 'object') baseUrl = `http://127.0.0.1:${address.port}`
+ resolve()
+ })
+ })
+})
+beforeEach(async () => { await resetAllTables() })
+after(async () => { await teardownAll(server) })
+
+async function request(companyId: string, path: string, method = 'GET', body?: unknown): Promise<Response> {
+ return fetch(`${baseUrl}/api${path}`, {
+ method,
+ headers: { 'x-company-id': companyId, 'content-type': 'application/json' },
+ ...(body === undefined ? {} : { body: JSON.stringify(body) }),
+ })
+}
+
+test('API and CLI share a date-only value; overdue query excludes done and unclassified columns', async () => {
+ const { companyId, agentId } = await seedCompanyWithAgent()
+ await seedUserMembership(USER_ID, companyId, { email: '[email protected]', displayName: 'Due Owner' })
+ const boardCreated = await request(companyId, '/boards', 'POST', { title: 'Deadlines' })
+ assert.equal(boardCreated.status, 201)
+ const { id: boardId } = await boardCreated.json() as { id: string }
+ const board = await (await request(companyId, `/boards/${boardId}`)).json() as {
+ columns: Array<{ id: string; kind: string | null }>
+ }
+ const todo = board.columns.find((column) => column.kind === 'todo')!.id
+ const done = board.columns.find((column) => column.kind === 'done')!.id
+ const invalidCreate = await request(companyId, `/boards/${boardId}/cards`, 'POST', {
+ title: 'Bad deadline', columnId: todo, dueOn: '2026-04-31',
+ })
+ assert.equal(invalidCreate.status, 400)
+ const created = await request(companyId, `/boards/${boardId}/cards`, 'POST', {
+ title: 'Send proposal', columnId: todo, dueOn: '2026-09-23',
+ })
+ assert.equal(created.status, 200)
+ const { id: cardId } = await created.json() as { id: string }
+ const lookup = await (await request(companyId, `/cards/${cardId}`)).json() as {
+ card: { dueOn: string | null }; column: { kind: string | null }
+ }
+ assert.equal(lookup.card.dueOn, '2026-09-23')
+ assert.equal(lookup.column.kind, 'todo')
+
+ const invalid = await request(companyId, `/boards/${boardId}/cards/${cardId}`, 'PATCH', { dueOn: '2026-02-29' })
+ assert.equal(invalid.status, 400)
+ assert.equal((await request(companyId, `/boards/${boardId}/cards/${cardId}`, 'PATCH', { title: 'Proposal' })).status, 200)
+ const unchanged = await (await request(companyId, `/boards/${boardId}`)).json() as { cards: Array<{ dueOn: string | null }> }
+ assert.equal(unchanged.cards[0].dueOn, '2026-09-23')
+
+ const overdue = await runCli(['--as', agentId, 'card', 'ls', boardId, '--overdue-as-of', '2026-09-24', '--json'])
+ assert.equal(overdue.ok, true, overdue.text)
+ assert.deepEqual((JSON.parse(overdue.text) as Array<{ id: string }>).map((card) => card.id), [cardId])
+ const moved = await request(companyId, `/boards/${boardId}/cards/${cardId}`, 'PATCH', { columnId: done })
+ assert.equal(moved.status, 200)
+ const completed = await runCli(['--as', agentId, 'card', 'ls', boardId, '--overdue-as-of', '2026-09-24', '--json'])
+ assert.equal(completed.ok, true, completed.text)
+ assert.deepEqual(JSON.parse(completed.text), [])
+
+ const otherColumn = await runCli(['--as', agentId, 'kanban', 'add-column', boardId, 'Review'])
+ assert.equal(otherColumn.ok, true, otherColumn.text)
+ const reviewColumn = (await pool.query<{ id: string }>(
+ `SELECT id FROM board_columns WHERE board_id = $1 AND title = 'Review'`, [boardId],
+ )).rows[0].id
+ const added = await runCli(['--as', agentId, 'card', 'add', boardId, 'Review draft', '--column', reviewColumn, '--due', '2026-09-22'])
+ assert.equal(added.ok, true, added.text)
+ const reviewCardId = (await pool.query<{ id: string }>(
+ `SELECT id FROM board_cards WHERE board_id = $1 AND column_id = $2`, [boardId, reviewColumn],
+ )).rows[0].id
+ const reviewLookup = await (await request(companyId, `/cards/${reviewCardId}`)).json() as {
+ card: { dueOn: string | null }; column: { kind: string | null }
+ }
+ assert.equal(reviewLookup.card.dueOn, '2026-09-22')
+ assert.equal(reviewLookup.column.kind, null)
+ const unknownColumn = await runCli(['--as', agentId, 'card', 'ls', boardId, '--overdue-as-of', '2026-09-24', '--json'])
+ assert.equal(unknownColumn.ok, true, unknownColumn.text)
+ assert.deepEqual(JSON.parse(unknownColumn.text), [])
+
+ const apiClear = await request(companyId, `/boards/${boardId}/cards/${cardId}`, 'PATCH', { dueOn: null })
+ assert.equal(apiClear.status, 200)
+ const clearedByApi = await (await request(companyId, `/cards/${cardId}`)).json() as { card: { dueOn: string | null } }
+ assert.equal(clearedByApi.card.dueOn, null)
+
+ const set = await runCli(['--as', agentId, 'card', 'due', cardId, '2026-09-25'])
+ assert.equal(set.ok, true, set.text)
+ assert.deepEqual(set.sideEffects, [{
+ event: 'kanban.card_updated', command: 'card due', boardId, cardId,
+ actorId: agentId, companyId, dueOn: '2026-09-25', visibleToUser: true,
+ }])
+ assert.equal((await pool.query<{ due_on: string | null }>(`SELECT due_on::text AS due_on FROM board_cards WHERE id = $1`, [cardId])).rows[0].due_on, '2026-09-25')
+ const clear = await runCli(['--as', agentId, 'card', 'due', cardId, 'clear'])
+ assert.equal(clear.ok, true, clear.text)
+ assert.equal(clear.sideEffects?.[0]?.event, 'kanban.card_updated')
+ assert.equal((await pool.query<{ due_on: string | null }>(`SELECT due_on::text AS due_on FROM board_cards WHERE id = $1`, [cardId])).rows[0].due_on, null)
+})
diff --git a/server/src/__tests__/board-due-date.test.ts b/server/src/__tests__/board-due-date.test.ts
new file mode 100644
index 0000000..43698bd
--- /dev/null
+++ b/server/src/__tests__/board-due-date.test.ts
@@ -0,0 +1,10 @@
+import { test } from 'node:test'
+import assert from 'node:assert/strict'
+import { isBoardDueOn } from '../agents/board-due-date.js'
+
+test('board due dates accept only real ISO calendar dates', () => {
+ for (const value of ['2024-02-29', '2026-09-23', '0001-01-01']) assert.equal(isBoardDueOn(value), true)
+ for (const value of [null, 42, '', '2026-02-29', '2026-04-31', '2026-13-01', '2026-9-23', '2026-09-23T00:00', '0000-01-01']) {
+ assert.equal(isBoardDueOn(value), false, String(value))
+ }
+})
diff --git a/server/src/__tests__/schema-migrations.test.ts b/server/src/__tests__/schema-migrations.test.ts
index 30319d2..f0f77c8 100644
--- a/server/src/__tests__/schema-migrations.test.ts
+++ b/server/src/__tests__/schema-migrations.test.ts
@@ -21,6 +21,7 @@ const { emailMessagesCompanySmtpIdChecksum } = await import('../db/migrations/00
const { engineDefaultsChecksum } = await import('../db/migrations/0007-engine-defaults.js')
const { agentProviderProfileChecksum } = await import('../db/migrations/0008-agent-provider-profile.js')
const { agentRoutingClaimsChecksum } = await import('../db/migrations/0009-agent-routing-claims.js')
+const { boardCardDueOnChecksum } = await import('../db/migrations/0010-board-card-due-on.js')
const { verifySchemaCompatibility } = await import('../db/schema-version.js')
type SchemaVersionQueryable = import('../db/schema-version.js').SchemaVersionQueryable
@@ -62,6 +63,10 @@ test('the agent routing claims migration matches its immutable manifest checksum
assert.equal(agentRoutingClaimsChecksum(), SCHEMA_MIGRATIONS[8].checksum)
})
+test('the board card due date migration matches its immutable manifest checksum', () => {
+ assert.equal(boardCardDueOnChecksum(), SCHEMA_MIGRATIONS[9].checksum)
+})
+
test('the migration owner accepts an exact prefix and reports its pending suffix', () => {
const empty = validateMigrationHistory([], { allowPending: true })
assert.equal(empty.currentVersion, 0)
diff --git a/server/src/agents/board-due-date.ts b/server/src/agents/board-due-date.ts
new file mode 100644
index 0000000..eb35faa
--- /dev/null
+++ b/server/src/agents/board-due-date.ts
@@ -0,0 +1,8 @@
+/** Strict ISO calendar date; never coerce timestamps or roll invalid days. */
+export function isBoardDueOn(value: unknown): value is string {
+ if (typeof value !== 'string' || !/^\d{4}-\d{2}-\d{2}$/.test(value)) return false
+ const [year, month, day] = value.split('-').map(Number)
+ if (year < 1 || month < 1 || month > 12 || day < 1) return false
+ const days = new Date(Date.UTC(year, month, 0)).getUTCDate()
+ return day <= days
+}
diff --git a/server/src/agents/cli.ts b/server/src/agents/cli.ts
index 3af23b9..9512c02 100644
--- a/server/src/agents/cli.ts
+++ b/server/src/agents/cli.ts
@@ -25,6 +25,7 @@ import {
} from './memory-scope.js'
import { memoryMetaForWrite, resolveMemoryWriteSource } from './memory-write.js'
import { wakeKanbanAgents } from './kanban-wake.js'
+import { isBoardDueOn } from './board-due-date.js'
import {
enqueueBroadcast,
nudgeRealtimeOutbox,
@@ -364,8 +365,9 @@ KANBAN (shared boards — the same ones humans see in the Boards view):
[--description "..."]
kanban columns <board_id> list column ids — needed for \`card add --column\`
kanban add-column <board_id> "<title>" append a new column to a board
+ [--kind todo|doing|done]
kanban edit-column <board_id> <column_id> rename / reorder a column
- [--title "..."] [--position N]
+ [--title "..."] [--position N] [--kind todo|doing|done|clear]
kanban delete-column <board_id> <column_id> delete a column and its cards
kanban delete <board_id> drop the board (and its columns + cards)
kanban mentions [--peek] [--json] list NEW cards/comments where someone @ed YOU since
@@ -373,10 +375,12 @@ KANBAN (shared boards — the same ones humans see in the Boards view):
inbox is empty — you may have been pinged here.
Advances a read cursor unless --peek is passed.
- card ls <board_id> list every card in a board
+ card ls <board_id> [--due-before YYYY-MM-DD] list cards (date filter is exclusive)
+ [--overdue-as-of YYYY-MM-DD] overdue work in todo/doing columns
card show <card_id> full card detail + comments
card add <board_id> "<title>" --column <col_id> create a card
- [--description "..."] [--assign <id>]
+ [--description "..."] [--assign <id>] [--due YYYY-MM-DD]
+ card due <card_id> <YYYY-MM-DD|clear> set or clear a date-only deadline
card move <card_id> --to <column_id> move a card between columns (the way "done" happens)
card claim <card_id> ATOMICALLY claim a card before working it (exclusive;
fails if someone else already holds it → move on)
@@ -5152,9 +5156,9 @@ async function cmdBoard(parsed: ParsedArgs): Promise<CliResult> {
}>(`SELECT id, title, position, kind FROM board_columns WHERE board_id = $1 ORDER BY position ASC`, [boardId])
const cards = await pool.query<{
id: string; column_id: string; title: string; assignee_id: string | null
- mentions: string[]; position: number
+ mentions: string[]; position: number; due_on: string | null
}>(
- `SELECT id, column_id, title, assignee_id, mentions, position
+ `SELECT id, column_id, title, assignee_id, mentions, position, due_on::text AS due_on
FROM board_cards WHERE board_id = $1 ORDER BY column_id, position ASC`,
[boardId],
)
@@ -5181,7 +5185,7 @@ async function cmdBoard(parsed: ParsedArgs): Promise<CliResult> {
const mentions = Array.isArray(c.mentions) && c.mentions.length > 0
? ` · mentions: ${c.mentions.map((m) => '@' + m).join(' ')}`
: ''
- lines.push(` - ${c.id.padEnd(20)} ${who.padEnd(16)} ${c.title}${mentions}`)
+ lines.push(` - ${c.id.padEnd(20)} ${who.padEnd(16)} ${c.title}${c.due_on ? ` (due ${c.due_on})` : ''}${mentions}`)
}
}
return ok(lines.join('\n'))
@@ -5278,18 +5282,20 @@ async function cmdBoard(parsed: ParsedArgs): Promise<CliResult> {
`SELECT company_id FROM boards WHERE id = $1 LIMIT 1`, [boardId],
)
if (b.rows.length === 0 || b.rows[0].company_id !== companyId) return err(`board ${boardId} not found`)
- const { rows } = await pool.query<{ id: string; title: string }>(
- `SELECT id, title FROM board_columns WHERE board_id = $1 ORDER BY position ASC`,
+ const { rows } = await pool.query<{ id: string; title: string; kind: string | null }>(
+ `SELECT id, title, kind FROM board_columns WHERE board_id = $1 ORDER BY position ASC`,
[boardId],
)
if (parsed.flags.json) return ok(JSON.stringify(rows, null, 2))
- return ok(rows.map((c) => ` ${c.id.padEnd(20)} ${c.title}`).join('\n') || '(no columns)')
+ return ok(rows.map((c) => ` ${c.id.padEnd(20)} ${c.title}${c.kind ? ` [${c.kind}]` : ''}`).join('\n') || '(no columns)')
}
if (op === 'add-column' || op === 'add-col') {
const boardId = parsed.positional[1]
const title = parsed.positional.slice(2).join(' ').trim()
if (!boardId || !title) return err('usage: kanban add-column <board_id> "<title>"')
+ const kind = parsed.flags.kind === undefined ? null : parsed.flags.kind
+ if (kind !== null && !['todo', 'doing', 'done'].includes(kind as string)) return err('--kind must be todo, doing, or done')
const b = await pool.query<{ company_id: string }>(
`SELECT company_id FROM boards WHERE id = $1 LIMIT 1`, [boardId],
)
@@ -5301,8 +5307,8 @@ async function cmdBoard(parsed: ParsedArgs): Promise<CliResult> {
const id = `col-${randomUUID().slice(0, 12)}`
await withOutboxTransaction(async (client) => {
await client.query(
- `INSERT INTO board_columns (id, board_id, title, position) VALUES ($1, $2, $3, $4)`,
- [id, boardId, title.slice(0, 100), position],
+ `INSERT INTO board_columns (id, board_id, title, position, kind) VALUES ($1, $2, $3, $4, $5)`,
+ [id, boardId, title.slice(0, 100), position, kind],
)
await enqueueBoardCli(client, { companyId, kind: 'column.created', boardId, columnId: id, actorId: me })
})
@@ -5322,7 +5328,7 @@ async function cmdBoard(parsed: ParsedArgs): Promise<CliResult> {
const boardId = parsed.positional[1]
const columnId = parsed.positional[2]
if (!boardId || !columnId) {
- return err(`usage: kanban ${op} <board_id> <column_id> [--title "..."] [--position N]`)
+ return err(`usage: kanban ${op} <board_id> <column_id> [--title "..."] [--position N] [--kind todo|doing|done|clear]`)
}
const b = await pool.query<{ company_id: string }>(
`SELECT company_id FROM boards WHERE id = $1 LIMIT 1`,
@@ -5343,7 +5349,12 @@ async function cmdBoard(parsed: ParsedArgs): Promise<CliResult> {
if (!Number.isFinite(position)) return err(`invalid --position: ${parsed.flags.position}`)
params.push(position); sets.push(`position = $${params.length}`)
}
- if (sets.length === 0) return err('nothing to update — pass --title or --position')
+ if (parsed.flags.kind !== undefined) {
+ const kind = parsed.flags.kind === 'clear' ? null : parsed.flags.kind
+ if (kind !== null && !['todo', 'doing', 'done'].includes(kind as string)) return err('--kind must be todo, doing, done, or clear')
+ params.push(kind); sets.push(`kind = $${params.length}`)
+ }
+ if (sets.length === 0) return err('nothing to update — pass --title, --position, or --kind')
params.push(columnId, boardId)
const rows = await withOutboxTransaction(async (client) => {
const updated = await client.query<{ title: string; position: number }>(
@@ -5566,23 +5577,36 @@ async function cmdCard(parsed: ParsedArgs): Promise<CliResult> {
if (op === 'ls' || op === 'list') {
const boardId = parsed.positional[1]
if (!boardId) return err('usage: card ls <board_id>')
+ const dueBefore = parsed.flags['due-before']
+ if (dueBefore !== undefined && !isBoardDueOn(dueBefore)) {
+ return err('--due-before must be a valid YYYY-MM-DD date (exclusive)')
+ }
+ const overdueAsOf = parsed.flags['overdue-as-of']
+ if (overdueAsOf !== undefined && !isBoardDueOn(overdueAsOf)) {
+ return err('--overdue-as-of must be a valid YYYY-MM-DD date')
+ }
const b = await pool.query<{ company_id: string }>(
`SELECT company_id FROM boards WHERE id = $1 LIMIT 1`, [boardId],
)
if (b.rows.length === 0 || b.rows[0].company_id !== companyId) return err(`board ${boardId} not found`)
const { rows } = await pool.query<{
id: string; column_id: string; title: string; assignee_id: string | null
- mentions: string[]
+ mentions: string[]; due_on: string | null; column_kind: string | null
}>(
- `SELECT id, column_id, title, assignee_id, mentions
- FROM board_cards WHERE board_id = $1 ORDER BY column_id, position ASC`,
- [boardId],
+ `SELECT c.id, c.column_id, c.title, c.assignee_id, c.mentions,
+ c.due_on::text AS due_on, col.kind AS column_kind
+ FROM board_cards c JOIN board_columns col ON col.id = c.column_id
+ WHERE c.board_id = $1
+ AND ($2::date IS NULL OR c.due_on < $2::date)
+ AND ($3::date IS NULL OR (c.due_on < $3::date AND col.kind IN ('todo', 'doing')))
+ ORDER BY c.column_id, c.position ASC`,
+ [boardId, dueBefore ?? null, overdueAsOf ?? null],
)
if (parsed.flags.json) return ok(JSON.stringify(rows, null, 2))
if (rows.length === 0) return ok('(no cards)')
return ok(rows.map((c) => {
const who = c.assignee_id ? `@${c.assignee_id}` : '(unassigned)'
- return ` ${c.id.padEnd(20)} [${c.column_id.slice(0, 16).padEnd(16)}] ${who.padEnd(16)} ${c.title}`
+ return ` ${c.id.padEnd(20)} [${c.column_id.slice(0, 16).padEnd(16)}${c.column_kind ? `:${c.column_kind}` : ''}] ${who.padEnd(16)} ${c.title}${c.due_on ? ` (due ${c.due_on})` : ''}`
}).join('\n'))
}
@@ -5591,11 +5615,11 @@ async function cmdCard(parsed: ParsedArgs): Promise<CliResult> {
if (!cardId) return err('usage: card show <card_id>')
const r = await pool.query<{
id: string; board_id: string; column_id: string; title: string
- description: string | null; assignee_id: string | null; mentions: string[]
+ description: string | null; assignee_id: string | null; mentions: string[]; due_on: string | null
created_by: string; created_at: string; updated_at: string; company_id: string
}>(
`SELECT c.id, c.board_id, c.column_id, c.title, c.description,
- c.assignee_id, c.mentions, c.created_by, c.created_at, c.updated_at,
+ c.assignee_id, c.due_on::text AS due_on, c.mentions, c.created_by, c.created_at, c.updated_at,
b.company_id
FROM board_cards c JOIN boards b ON b.id = c.board_id
WHERE c.id = $1 LIMIT 1`,
@@ -5616,6 +5640,7 @@ async function cmdCard(parsed: ParsedArgs): Promise<CliResult> {
` board: ${c.board_id}`,
` column: ${c.column_id}`,
` assignee: ${c.assignee_id ?? '(unassigned)'}`,
+ ` due: ${c.due_on ?? '(none)'}`,
` created: ${c.created_at} by ${c.created_by}`,
]
if (Array.isArray(c.mentions) && c.mentions.length > 0) {
@@ -5636,7 +5661,7 @@ async function cmdCard(parsed: ParsedArgs): Promise<CliResult> {
const title = parsed.positional.slice(2).join(' ').trim()
|| (typeof parsed.flags.title === 'string' ? parsed.flags.title : '')
if (!boardId || !title) {
- return err('usage: card add <board_id> "<title>" --column <col_id> [--description "..."] [--assign <id>]')
+ return err('usage: card add <board_id> "<title>" --column <col_id> [--description "..."] [--assign <id>] [--due YYYY-MM-DD]')
}
const columnId = String(parsed.flags.column ?? parsed.flags.col ?? '').trim()
if (!columnId) return err('--column <col_id> required (run `cumora kanban columns <board_id>` to list)')
@@ -5653,6 +5678,8 @@ async function cmdCard(parsed: ParsedArgs): Promise<CliResult> {
? unescapeChat(parsed.flags.description).slice(0, 8000) : null
const assignee = typeof parsed.flags.assign === 'string'
? String(parsed.flags.assign).trim() : null
+ const dueOn = parsed.flags.due === undefined ? null : parsed.flags.due
+ if (dueOn !== null && !isBoardDueOn(dueOn)) return err('--due must be a valid YYYY-MM-DD date')
const { rows: posRows } = await pool.query<{ max: number | null }>(
`SELECT MAX(position) AS max FROM board_cards WHERE column_id = $1`, [columnId],
)
@@ -5662,9 +5689,9 @@ async function cmdCard(parsed: ParsedArgs): Promise<CliResult> {
await withOutboxTransaction(async (client) => {
await client.query(
`INSERT INTO board_cards
- (id, board_id, column_id, title, description, position, assignee_id, mentions, created_by)
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8::jsonb, $9)`,
- [id, boardId, columnId, title.slice(0, 200), description, position, assignee, JSON.stringify(mentions), me],
+ (id, board_id, column_id, title, description, position, assignee_id, due_on, mentions, created_by)
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8::date, $9::jsonb, $10)`,
+ [id, boardId, columnId, title.slice(0, 200), description, position, assignee, dueOn, JSON.stringify(mentions), me],
)
await client.query(`UPDATE boards SET updated_at = NOW() WHERE id = $1`, [boardId])
await enqueueBoardCli(client, {
@@ -5702,6 +5729,36 @@ async function cmdCard(parsed: ParsedArgs): Promise<CliResult> {
}])
}
+ if (op === 'due') {
+ const cardId = parsed.positional[1]
+ const value = parsed.positional[2]
+ if (!cardId || !value) return err('usage: card due <card_id> <YYYY-MM-DD|clear>')
+ const dueOn = value === 'clear' ? null : value
+ if (dueOn !== null && !isBoardDueOn(dueOn)) return err('due date must be a valid YYYY-MM-DD date or clear')
+ const home = await resolveCardBoard(cardId)
+ if (!home) return err(`card ${cardId} not found`)
+ await withOutboxTransaction(async (client) => {
+ await client.query(
+ `UPDATE board_cards SET due_on = $1::date, updated_at = NOW() WHERE id = $2`,
+ [dueOn, cardId],
+ )
+ await client.query(`UPDATE boards SET updated_at = NOW() WHERE id = $1`, [home.boardId])
+ await enqueueBoardCli(client, {
+ companyId, kind: 'card.updated', boardId: home.boardId, cardId, actorId: me,
+ })
+ })
+ return ok(dueOn ? `card ${cardId} due ${dueOn}` : `cleared due date on card ${cardId}`, [{
+ event: 'kanban.card_updated',
+ command: 'card due',
+ boardId: home.boardId,
+ cardId,
+ actorId: me,
+ companyId,
+ dueOn,
+ visibleToUser: true,
+ }])
+ }
+
if (op === 'move') {
const cardId = parsed.positional[1]
const toCol = String(parsed.flags.to ?? parsed.flags.column ?? parsed.flags.col ?? '').trim()
diff --git a/server/src/agents/personas.ts b/server/src/agents/personas.ts
index cb8cf05..1e8b0e2 100644
--- a/server/src/agents/personas.ts
+++ b/server/src/agents/personas.ts
@@ -232,7 +232,9 @@ CAPABILITIES — every other capability is a subcommand of the \`cumora\` CLI on
last check. ALWAYS run this on wake when your inbox is empty.
bash("cumora card ls <board_id>")
bash("cumora card show <card_id>")
- bash("cumora card add <board_id> '<title>' --column <col_id> [--description '...'] [--assign <id>]")
+ bash("cumora card add <board_id> '<title>' --column <col_id> [--description '...'] [--assign <id>] [--due YYYY-MM-DD]")
+ bash("cumora card due <card_id> <YYYY-MM-DD|clear>") — set or clear a date-only deadline (no reminder)
+ bash("cumora card ls <board_id> --overdue-as-of YYYY-MM-DD") — overdue unfinished work on that calendar day
bash("cumora card move <card_id> --to <column_id>") — move a card between columns (this is how "done" happens)
bash("cumora card assign <card_id> <participant_id|null>")
— (re)assign a card. Agents are valid assignees — assign one to yourself
diff --git a/server/src/agents/tools-shared.ts b/server/src/agents/tools-shared.ts
index 1a4dac5..076e533 100644
--- a/server/src/agents/tools-shared.ts
+++ b/server/src/agents/tools-shared.ts
@@ -120,7 +120,9 @@ export const TOOL_DEFS_RESPONSES: FunctionTool[] = [
cumora kanban mentions # NEW kanban @-mentions of YOU since last check
cumora card ls <board_id>
cumora card show <card_id>
- cumora card add <board_id> "<title>" --column <col_id> [--description "..."] [--assign <id>]
+ cumora card add <board_id> "<title>" --column <col_id> [--description "..."] [--assign <id>] [--due YYYY-MM-DD]
+ cumora card due <card_id> <YYYY-MM-DD|clear>
+ cumora card ls <board_id> --overdue-as-of YYYY-MM-DD
cumora card move <card_id> --to <column_id>
cumora card assign <card_id> <participant_id|null>
cumora card rename <card_id> --title "..." [--description "..."]
diff --git a/server/src/api/router.ts b/server/src/api/router.ts
index a54205b..243e196 100644
--- a/server/src/api/router.ts
+++ b/server/src/api/router.ts
@@ -18,6 +18,7 @@ import { ensureDirectConversation } from '../agents/private_chat.js'
import { fetchImageBytes } from '../agents/image-fetcher.js'
import { getTriageEconomics, getWakeEconomics } from '../agents/observability.js'
import { resolveKanbanAssigneeChange, wakeKanbanAgents } from '../agents/kanban-wake.js'
+import { isBoardDueOn } from '../agents/board-due-date.js'
import { AgentCreationError, createAgentRecord } from '../agents/create.js'
import { BUSY_STATUS_LEASE_MS } from '../status.js'
import { dispatchMessagePush } from '../push.js'
@@ -5940,6 +5941,7 @@ api.get('/cards/:id', async (req, res) => {
description: string | null
position: number
assignee_id: string | null
+ due_on: string | null
mentions: string[]
created_by: string
created_at: string
@@ -5950,16 +5952,17 @@ api.get('/cards/:id', async (req, res) => {
board_created_at: string
board_updated_at: string
column_title: string
+ column_kind: 'todo' | 'doing' | 'done' | null
column_position: number
column_created_at: string
comment_count: number
}>(
`SELECT c.id, c.board_id, c.column_id, c.title, c.description, c.position,
- c.assignee_id, c.mentions, c.created_by, c.created_at, c.updated_at,
+ c.assignee_id, c.due_on::text AS due_on, c.mentions, c.created_by, c.created_at, c.updated_at,
b.title AS board_title, b.description AS board_description,
b.created_by AS board_created_by, b.created_at AS board_created_at,
b.updated_at AS board_updated_at,
- col.title AS column_title, col.position AS column_position,
+ col.title AS column_title, col.kind AS column_kind, col.position AS column_position,
col.created_at AS column_created_at,
(SELECT COUNT(*)::int FROM board_card_comments cc WHERE cc.card_id = c.id) AS comment_count
FROM board_cards c
@@ -5983,6 +5986,7 @@ api.get('/cards/:id', async (req, res) => {
column: {
id: r.column_id,
title: r.column_title,
+ kind: r.column_kind,
position: Number(r.column_position),
createdAt: r.column_created_at,
},
@@ -5994,6 +5998,7 @@ api.get('/cards/:id', async (req, res) => {
description: r.description,
position: Number(r.position),
assigneeId: r.assignee_id,
+ dueOn: r.due_on,
mentions: Array.isArray(r.mentions) ? r.mentions : [],
commentCount: r.comment_count,
createdBy: r.created_by,
@@ -6064,12 +6069,12 @@ api.get('/boards/:id', async (req, res) => {
)
const cards = await pool.query<{
id: string; column_id: string; title: string; description: string | null
- position: number; assignee_id: string | null; mentions: string[]
+ position: number; assignee_id: string | null; due_on: string | null; mentions: string[]
created_by: string; created_at: string; updated_at: string
comment_count: number
}>(
`SELECT c.id, c.column_id, c.title, c.description, c.position,
- c.assignee_id, c.mentions, c.created_by, c.created_at, c.updated_at,
+ c.assignee_id, c.due_on::text AS due_on, c.mentions, c.created_by, c.created_at, c.updated_at,
(SELECT COUNT(*)::int FROM board_card_comments cc WHERE cc.card_id = c.id) AS comment_count
FROM board_cards c
WHERE c.board_id = $1
@@ -6087,6 +6092,7 @@ api.get('/boards/:id', async (req, res) => {
columns: cols.rows.map((c) => ({
id: c.id,
title: c.title,
+ kind: c.kind,
position: Number(c.position),
createdAt: c.created_at,
})),
@@ -6098,6 +6104,7 @@ api.get('/boards/:id', async (req, res) => {
description: c.description,
position: Number(c.position),
assigneeId: c.assignee_id,
+ dueOn: c.due_on,
mentions: Array.isArray(c.mentions) ? c.mentions : [],
commentCount: c.comment_count,
createdBy: c.created_by,
@@ -6148,6 +6155,8 @@ api.post('/boards/:id/columns', async (req, res) => {
const { userId: me, companyId } = await requireBoardAccess(req, boardId)
const title = String(req.body?.title ?? '').trim().slice(0, 100)
if (!title) throw new HttpError(400, 'title required')
+ const kind = req.body?.kind ?? null
+ if (kind !== null && !['todo', 'doing', 'done'].includes(kind)) throw new HttpError(400, 'invalid column kind')
const { rows: posRows } = await pool.query<{ max: number | null }>(
`SELECT MAX(position) AS max FROM board_columns WHERE board_id = $1`, [boardId],
)
@@ -6155,8 +6164,8 @@ api.post('/boards/:id/columns', async (req, res) => {
const id = `col-${randomUUID().slice(0, 12)}`
await withOutboxTransaction(async (client) => {
await client.query(
- `INSERT INTO board_columns (id, board_id, title, position) VALUES ($1, $2, $3, $4)`,
- [id, boardId, title, position],
+ `INSERT INTO board_columns (id, board_id, title, position, kind) VALUES ($1, $2, $3, $4, $5)`,
+ [id, boardId, title, position, kind],
)
await enqueueBoardEvent(client, { companyId, kind: 'column.created', boardId, columnId: id, actorId: me })
})
@@ -6176,6 +6185,11 @@ api.patch('/boards/:bid/columns/:cid', async (req, res) => {
if (typeof req.body?.position === 'number') {
params.push(req.body.position); sets.push(`position = $${params.length}`)
}
+ if (req.body && Object.prototype.hasOwnProperty.call(req.body, 'kind')) {
+ const kind = req.body.kind
+ if (kind !== null && !['todo', 'doing', 'done'].includes(kind)) throw new HttpError(400, 'invalid column kind')
+ params.push(kind); sets.push(`kind = $${params.length}`)
+ }
if (sets.length === 0) { res.json({ ok: true }); return }
params.push(columnId); params.push(boardId)
await withOutboxTransaction(async (client) => {
@@ -6214,6 +6228,8 @@ api.post('/boards/:id/cards', async (req, res) => {
const description = String(req.body?.description ?? '').trim().slice(0, 8000) || null
const columnId = String(req.body?.columnId ?? '').trim()
const assigneeId = req.body?.assigneeId ? String(req.body.assigneeId).trim() : null
+ const dueOn = req.body?.dueOn === undefined ? null : req.body.dueOn
+ if (dueOn !== null && !isBoardDueOn(dueOn)) throw new HttpError(400, 'dueOn must be YYYY-MM-DD or null')
if (!title) throw new HttpError(400, 'title required')
if (!columnId) throw new HttpError(400, 'columnId required')
// Confirm column lives in the board we're touching — otherwise a client
@@ -6232,9 +6248,9 @@ api.post('/boards/:id/cards', async (req, res) => {
await withOutboxTransaction(async (client) => {
await client.query(
`INSERT INTO board_cards
- (id, board_id, column_id, title, description, position, assignee_id, mentions, created_by)
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8::jsonb, $9)`,
- [id, boardId, columnId, title, description, position, assigneeId, JSON.stringify(mentions), me],
+ (id, board_id, column_id, title, description, position, assignee_id, due_on, mentions, created_by)
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8::date, $9::jsonb, $10)`,
+ [id, boardId, columnId, title, description, position, assigneeId, dueOn, JSON.stringify(mentions), me],
)
await client.query(`UPDATE boards SET updated_at = NOW() WHERE id = $1`, [boardId])
await enqueueBoardEvent(client, {
@@ -6294,6 +6310,12 @@ api.patch('/boards/:bid/cards/:cid', async (req, res) => {
if (assigneeChange.changed) {
params.push(assigneeChange.nextAssigneeId); sets.push(`assignee_id = $${params.length}`)
}
+ if (req.body && Object.prototype.hasOwnProperty.call(req.body, 'dueOn')) {
+ if (req.body.dueOn !== null && !isBoardDueOn(req.body.dueOn)) {
+ throw new HttpError(400, 'dueOn must be YYYY-MM-DD or null')
+ }
+ params.push(req.body.dueOn); sets.push(`due_on = $${params.length}::date`)
+ }
if (typeof req.body?.columnId === 'string') {
const newCol = req.body.columnId.trim()
if (newCol !== cur[0].column_id) {
diff --git a/server/src/db/migrate.ts b/server/src/db/migrate.ts
index cc101b7..f589748 100644
--- a/server/src/db/migrate.ts
+++ b/server/src/db/migrate.ts
@@ -46,6 +46,12 @@ import {
AGENT_ROUTING_CLAIMS_SQL,
agentRoutingClaimsChecksum,
} from './migrations/0009-agent-routing-claims.js'
+import {
+ BOARD_CARD_DUE_ON_SQL,
+ BOARD_CARD_DUE_ON_INDEX_NAME,
+ BOARD_CARD_DUE_ON_INDEX_SQL,
+ boardCardDueOnChecksum,
+} from './migrations/0010-board-card-due-on.js'
/** Frozen data backfill embedded in migration 0001. Exported so its behavior
* can be exercised against PostgreSQL without replaying the whole migration. */
@@ -2616,6 +2622,16 @@ const VERSIONED_MIGRATIONS: readonly VersionedMigration[] = [
transactional: true,
up: applyAgentRoutingClaims,
},
+ {
+ ...SCHEMA_MIGRATIONS[9],
+ sourceChecksum: boardCardDueOnChecksum(),
+ // The index build is concurrent; both steps can be retried safely.
+ transactional: false,
+ up: async (client) => {
+ await client.query(BOARD_CARD_DUE_ON_SQL)
+ await ensureConcurrentIndex(client, BOARD_CARD_DUE_ON_INDEX_NAME, BOARD_CARD_DUE_ON_INDEX_SQL)
+ },
+ },
]
/** How many times a transactional migration may lose a lock race before the
@@ -2978,6 +2994,7 @@ export const REQUIRED_SCHEMA_INDEXES = [
'idx_conversation_members_participant',
SEARCH_TRIGRAM_INDEX_NAME,
EMAIL_MESSAGES_COMPANY_SMTP_ID_INDEX_NAME,
+ BOARD_CARD_DUE_ON_INDEX_NAME,
] as const
/** Promotion gate: every required index must exist and be valid, ready, and
diff --git a/server/src/db/migrations/0010-board-card-due-on.ts b/server/src/db/migrations/0010-board-card-due-on.ts
new file mode 100644
index 0000000..747654f
--- /dev/null
+++ b/server/src/db/migrations/0010-board-card-due-on.ts
@@ -0,0 +1,16 @@
+import { createHash } from 'node:crypto'
+
+/** A due date is a calendar day, with no implied time or notification. */
+export const BOARD_CARD_DUE_ON_SQL = `
+ALTER TABLE board_cards ADD COLUMN IF NOT EXISTS due_on DATE;
+`
+
+export const BOARD_CARD_DUE_ON_INDEX_NAME = 'idx_board_cards_due_on'
+export const BOARD_CARD_DUE_ON_INDEX_SQL = `
+CREATE INDEX CONCURRENTLY IF NOT EXISTS ${BOARD_CARD_DUE_ON_INDEX_NAME}
+ ON board_cards(board_id, due_on) WHERE due_on IS NOT NULL;
+`
+
+export function boardCardDueOnChecksum(): string {
+ return createHash('sha256').update(BOARD_CARD_DUE_ON_SQL + BOARD_CARD_DUE_ON_INDEX_SQL).digest('hex')
+}
diff --git a/server/src/db/migrations/manifest.ts b/server/src/db/migrations/manifest.ts
index f5e2e0e..6f0b495 100644
--- a/server/src/db/migrations/manifest.ts
+++ b/server/src/db/migrations/manifest.ts
@@ -62,12 +62,17 @@ export const SCHEMA_MIGRATIONS = [
name: '0009_agent_routing_claims',
checksum: '2bf97e295fef3fa7e42cdc476867e89b4d9c976362dfad7e7256bf74308c30fc',
},
+ {
+ version: 10,
+ name: '0010_board_card_due_on',
+ checksum: 'd07af706ca94ea26c789f7103d94bf8af00b174034f2fd9b817c8bde3e45560a',
+ },
] as const satisfies readonly MigrationMetadata[]
/** This build intentionally supports one exact schema range. Expand/contract
* releases may widen the range, but both bounds must remain explicit. */
-export const MIN_SUPPORTED_SCHEMA_VERSION = 9
-export const MAX_SUPPORTED_SCHEMA_VERSION = 9
+export const MIN_SUPPORTED_SCHEMA_VERSION = 10
+export const MAX_SUPPORTED_SCHEMA_VERSION = 10
function assertManifestShape(): void {
for (let i = 0; i < SCHEMA_MIGRATIONS.length; i++) {
diff --git a/src/api/client.ts b/src/api/client.ts
index 6c288a1..594f8ba 100644
--- a/src/api/client.ts
+++ b/src/api/client.ts
@@ -1402,7 +1402,7 @@ export const api = {
`/boards/${encodeURIComponent(boardId)}/columns`,
{ method: 'POST', body: JSON.stringify({ title }) },
),
- updateBoardColumn: (boardId: string, columnId: string, input: { title?: string; position?: number }) =>
+ updateBoardColumn: (boardId: string, columnId: string, input: { title?: string; position?: number; kind?: 'todo' | 'doing' | 'done' | null }) =>
http<{ ok: boolean }>(
`/boards/${encodeURIComponent(boardId)}/columns/${encodeURIComponent(columnId)}`,
{ method: 'PATCH', body: JSON.stringify(input) },
@@ -1413,7 +1413,7 @@ export const api = {
{ method: 'DELETE' },
),
createCard: (boardId: string, input: {
- columnId: string; title: string; description?: string; assigneeId?: string | null
+ columnId: string; title: string; description?: string; assigneeId?: string | null; dueOn?: string | null
}) =>
http<{ id: string; position: number; mentions: string[] }>(
`/boards/${encodeURIComponent(boardId)}/cards`,
@@ -1421,7 +1421,7 @@ export const api = {
),
updateCard: (boardId: string, cardId: string, input: {
title?: string; description?: string; position?: number
- columnId?: string; assigneeId?: string | null
+ columnId?: string; assigneeId?: string | null; dueOn?: string | null
}) =>
http<{ ok: boolean; mentions?: string[] }>(
`/boards/${encodeURIComponent(boardId)}/cards/${encodeURIComponent(cardId)}`,
diff --git a/src/components/ArtifactPeekContent.tsx b/src/components/ArtifactPeekContent.tsx
index 03144b1..1b9c97f 100644
--- a/src/components/ArtifactPeekContent.tsx
+++ b/src/components/ArtifactPeekContent.tsx
@@ -9,7 +9,9 @@ import { IBoard, ICalendar, IClock, IRepeat } from '@/components/icons'
import { cn } from '@/lib/utils'
import { useT, type MessageKey } from '@/lib/i18n'
import { EventEditor } from '@/components/EventEditor'
-import type { BoardCard, CalendarEvent, RecurrenceRule } from '@/types'
+import { DateTimePicker } from '@/components/DateTimePicker'
+import { boardDueStatus, localCalendarDay } from '@/lib/board-due-date'
+import type { BoardCard, BoardColumn, CalendarEvent, RecurrenceRule } from '@/types'
const RECURRING_KEYS: Record<RecurrenceRule['freq'], MessageKey> = {
daily: 'peek.recurringDaily',
@@ -207,6 +209,12 @@ export function BoardPeekContent({
const summary = list.find((b) => b.id === boardId) ?? null
const didRequestList = useRef(false)
const requestedBoardId = useRef<string | null>(null)
+ const [asOf, setAsOf] = useState(localCalendarDay)
+
+ useEffect(() => {
+ const timer = window.setInterval(() => setAsOf(localCalendarDay()), 60_000)
+ return () => window.clearInterval(timer)
+ }, [])
useEffect(() => {
if (!summary && !loadingList && !didRequestList.current) {
@@ -287,7 +295,7 @@ export function BoardPeekContent({
</div>
)}
{cards.map((card) => (
- <BoardPeekCard key={card.id} card={card} focused={card.id === focusCardId} />
+ <BoardPeekCard key={card.id} boardId={boardId} card={card} columnKind={col.kind} asOf={asOf} focused={card.id === focusCardId} />
))}
</div>
</section>
@@ -299,11 +307,31 @@ export function BoardPeekContent({
)
}
-function BoardPeekCard({ card, focused }: { card: BoardCard; focused: boolean }) {
+function BoardPeekCard({ boardId, card, columnKind, asOf, focused }: {
+ boardId: string; card: BoardCard; columnKind: BoardColumn['kind']; asOf: string; focused: boolean
+}) {
const t = useT()
const byId = useParticipants((s) => s.byId)
+ const patchCard = useBoards((s) => s.patchCard)
const assignee = card.assigneeId ? byId[card.assigneeId] : null
const ref = useRef<HTMLElement | null>(null)
+ const [saving, setSaving] = useState(false)
+ const [saveError, setSaveError] = useState(false)
+ const dueStatus = boardDueStatus(card.dueOn, columnKind, asOf)
+
+ async function saveDueOn(value: string) {
+ if (saving) return
+ setSaving(true)
+ setSaveError(false)
+ try {
+ await patchCard(boardId, card.id, { dueOn: value ? value.slice(0, 10) : null })
+ } catch (error) {
+ console.warn('[boards] due date update failed', error)
+ setSaveError(true)
+ } finally {
+ setSaving(false)
+ }
+ }
useEffect(() => {
if (!focused) return
@@ -329,6 +357,21 @@ function BoardPeekCard({ card, focused }: { card: BoardCard; focused: boolean })
</div>
)}
<div className="text-[12.5px] font-medium leading-snug text-ink-800 line-clamp-3">{card.title}</div>
+ <div className="mt-2" onClick={(event) => event.stopPropagation()}>
+ <div className={cn('mb-1 text-[11px]', dueStatus === 'overdue' ? 'font-semibold text-coral-deep' : dueStatus === 'today' ? 'font-semibold text-skype-deep' : 'text-ink-500')}>
+ {dueStatus === 'overdue' ? t('boards.overdue') : dueStatus === 'today' ? t('boards.dueToday') : t('boards.dueDate')}
+ {card.dueOn ? `: ${card.dueOn}` : ''}
+ </div>
+ <DateTimePicker
+ mode="date"
+ value={card.dueOn ? `${card.dueOn}T00:00` : ''}
+ onChange={(value) => { void saveDueOn(value) }}
+ placeholder={t('boards.noDueDate')}
+ allowClear
+ disabled={saving}
+ />
+ {saveError && <div role="alert" className="mt-1 text-[11px] text-coral-deep">{t('boards.dueSaveFailed')}</div>}
+ </div>
{(assignee || card.commentCount > 0 || card.mentions.length > 0) && (
<div className="mt-2 flex items-center gap-2 text-[11px] text-ink-500">
{assignee && (
@@ -502,4 +545,4 @@ export function CalendarEventPeekContent({
)}
</div>
)
-}
\ No newline at end of file
+}
diff --git a/src/desktop/BoardsView.tsx b/src/desktop/BoardsView.tsx
index bcff659..22ab2bd 100644
--- a/src/desktop/BoardsView.tsx
+++ b/src/desktop/BoardsView.tsx
@@ -9,10 +9,12 @@ import { CalendarLink } from '@/components/CalendarLink'
import { DocumentLink } from '@/components/DocumentLink'
import { ResizeHandle } from '@/components/ResizeHandle'
import { Select } from '@/components/Select'
+import { DateTimePicker } from '@/components/DateTimePicker'
import { useResizableWidth } from '@/lib/useResizableWidth'
import { useT } from '@/lib/i18n'
import { IBoard, IPlus, IAt, ITrash, IMore } from '@/components/icons'
import { cn } from '@/lib/utils'
+import { boardDueStatus, localCalendarDay } from '@/lib/board-due-date'
import type { BoardCard, BoardCardComment, BoardColumn, Participant } from '@/types'
/**
@@ -169,6 +171,12 @@ function BoardCanvas({ boardId }: { boardId: string }) {
const [openCardId, setOpenCardId] = useState<string | null>(null)
const [editingTitle, setEditingTitle] = useState(false)
const [titleDraft, setTitleDraft] = useState('')
+ const [asOf, setAsOf] = useState(localCalendarDay)
+
+ useEffect(() => {
+ const timer = window.setInterval(() => setAsOf(localCalendarDay()), 60_000)
+ return () => window.clearInterval(timer)
+ }, [])
// Hooks must run on every render in the same order — keep useMemo
// above any conditional early return. When the snapshot hasn't
@@ -266,6 +274,7 @@ function BoardCanvas({ boardId }: { boardId: string }) {
boardId={boardId}
column={col}
cards={cardsByColumn.get(col.id) ?? []}
+ asOf={asOf}
onOpenCard={setOpenCardId}
/>
))}
@@ -310,14 +319,15 @@ function BoardCanvas({ boardId }: { boardId: string }) {
/* ============== Column ============== */
-function ColumnView({ boardId, column, cards, onOpenCard }: {
- boardId: string; column: BoardColumn; cards: BoardCard[]
+function ColumnView({ boardId, column, cards, asOf, onOpenCard }: {
+ boardId: string; column: BoardColumn; cards: BoardCard[]; asOf: string
onOpenCard: (id: string) => void
}) {
const t = useT()
const addCard = useBoards((s) => s.addCard)
const moveCardOptimistic = useBoards((s) => s.moveCardOptimistic)
const renameColumn = useBoards((s) => s.renameColumn)
+ const setColumnKind = useBoards((s) => s.setColumnKind)
const deleteColumn = useBoards((s) => s.deleteColumn)
const [adding, setAdding] = useState(false)
const [draft, setDraft] = useState('')
@@ -384,6 +394,18 @@ function ColumnView({ boardId, column, cards, onOpenCard }: {
</button>
)}
<span className="text-xs text-ink-400">{cards.length}</span>
+ <select
+ value={column.kind ?? ''}
+ onChange={(e) => void setColumnKind(boardId, column.id, (e.target.value || null) as BoardColumn['kind']).catch(console.warn)}
+ aria-label={t('boards.columnKind')}
+ title={t('boards.columnKind')}
+ className="max-w-20 bg-transparent text-[11px] text-ink-500"
+ >
+ <option value="">{t('boards.kindOther')}</option>
+ <option value="todo">{t('boards.kindTodo')}</option>
+ <option value="doing">{t('boards.kindDoing')}</option>
+ <option value="done">{t('boards.kindDone')}</option>
+ </select>
<button
type="button"
onClick={async () => {
@@ -399,7 +421,7 @@ function ColumnView({ boardId, column, cards, onOpenCard }: {
</div>
<div className="flex-1 overflow-y-auto px-2 pb-2 space-y-2">
{cards.map((c) => (
- <CardTile key={c.id} card={c} onOpen={() => onOpenCard(c.id)} />
+ <CardTile key={c.id} card={c} columnKind={column.kind} asOf={asOf} onOpen={() => onOpenCard(c.id)} />
))}
{adding ? (
<MentionInput
@@ -431,9 +453,13 @@ function ColumnView({ boardId, column, cards, onOpenCard }: {
/* ============== Card tile ============== */
-function CardTile({ card, onOpen }: { card: BoardCard; onOpen: () => void }) {
+function CardTile({ card, columnKind, asOf, onOpen }: {
+ card: BoardCard; columnKind: BoardColumn['kind']; asOf: string; onOpen: () => void
+}) {
+ const t = useT()
const byId = useParticipants((s) => s.byId)
const assignee = card.assigneeId ? byId[card.assigneeId] : null
+ const dueStatus = boardDueStatus(card.dueOn, columnKind, asOf)
return (
<div
role="button"
@@ -450,6 +476,11 @@ function CardTile({ card, onOpen }: { card: BoardCard; onOpen: () => void }) {
<div className="text-sm text-ink-800 leading-snug">
<MentionedText text={card.title} byId={byId} />
</div>
+ {card.dueOn && (
+ <div className={cn('mt-1.5 text-[11px]', dueStatus === 'overdue' ? 'font-semibold text-coral-deep' : dueStatus === 'today' ? 'font-semibold text-skype-deep' : 'text-ink-500')}>
+ {dueStatus === 'overdue' ? t('boards.overdue') : dueStatus === 'today' ? t('boards.dueToday') : t('boards.dueDate')}: {card.dueOn}
+ </div>
+ )}
{(card.assigneeId || card.mentions.length > 0 || card.commentCount > 0) && (
<div className="mt-2 flex items-center gap-2">
{assignee && (
@@ -820,6 +851,8 @@ function CardDetailModal({ boardId, card, columns, onClose }: {
const [description, setDescription] = useState(card.description ?? '')
const [draftComment, setDraftComment] = useState('')
const [posting, setPosting] = useState(false)
+ const [dueSaving, setDueSaving] = useState(false)
+ const [dueSaveError, setDueSaveError] = useState(false)
useEffect(() => {
setTitle(card.title)
@@ -847,6 +880,18 @@ function CardDetailModal({ boardId, card, columns, onClose }: {
async function setAssignee(id: string | null) {
try { await patchCard(boardId, card.id, { assigneeId: id }) } catch (e) { console.warn(e) }
}
+ async function saveDueOn(value: string) {
+ setDueSaving(true)
+ setDueSaveError(false)
+ try {
+ await patchCard(boardId, card.id, { dueOn: value ? value.slice(0, 10) : null })
+ } catch (error) {
+ console.warn('[boards] due date update failed', error)
+ setDueSaveError(true)
+ } finally {
+ setDueSaving(false)
+ }
+ }
async function postComment() {
const body = draftComment.trim()
if (!body || posting) return
@@ -905,6 +950,19 @@ function CardDetailModal({ boardId, card, columns, onClose }: {
</div>
</section>
+ <section>
+ <div className="text-[11px] uppercase tracking-wide text-ink-400 mb-1">{t('boards.dueDate')}</div>
+ <DateTimePicker
+ mode="date"
+ value={card.dueOn ? `${card.dueOn}T00:00` : ''}
+ onChange={(value) => { void saveDueOn(value) }}
+ placeholder={t('boards.noDueDate')}
+ allowClear
+ disabled={dueSaving}
+ />
+ {dueSaveError && <div role="alert" className="mt-1 text-xs text-coral-deep">{t('boards.dueSaveFailed')}</div>}
+ </section>
+
<section>
<div className="text-[11px] uppercase tracking-wide text-ink-400 mb-1">{t('boards.description')}</div>
<MentionInput
diff --git a/src/lib/board-due-date.ts b/src/lib/board-due-date.ts
new file mode 100644
index 0000000..1e0ebfd
--- /dev/null
+++ b/src/lib/board-due-date.ts
@@ -0,0 +1,19 @@
+export type BoardDueStatus = 'none' | 'date' | 'today' | 'overdue'
+
+/** The caller supplies a calendar day, so this never depends on server time. */
+export function boardDueStatus(
+ dueOn: string | null,
+ columnKind: 'todo' | 'doing' | 'done' | null,
+ asOf: string,
+): BoardDueStatus {
+ if (!dueOn) return 'none'
+ if (columnKind !== 'todo' && columnKind !== 'doing') return 'date'
+ if (dueOn < asOf) return 'overdue'
+ if (dueOn === asOf) return 'today'
+ return 'date'
+}
+
+export function localCalendarDay(now = new Date()): string {
+ const pad = (n: number) => String(n).padStart(2, '0')
+ return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`
+}
diff --git a/src/locales/en.ts b/src/locales/en.ts
index 2094925..4ac18be 100644
--- a/src/locales/en.ts
+++ b/src/locales/en.ts
@@ -267,6 +267,16 @@ export const en = {
'boards.commentPlaceholder': 'Comment… (⌘↵ to post · @mention to ping)',
'boards.column': 'Column',
'boards.assignee': 'Assignee',
+ 'boards.dueDate': 'Due date',
+ 'boards.noDueDate': 'No due date',
+ 'boards.dueToday': 'Due today',
+ 'boards.overdue': 'Overdue',
+ 'boards.dueSaveFailed': 'Could not save due date. Try again.',
+ 'boards.columnKind': 'Column status',
+ 'boards.kindOther': 'Other',
+ 'boards.kindTodo': 'To do',
+ 'boards.kindDoing': 'Doing',
+ 'boards.kindDone': 'Done',
'boards.description': 'Description',
'boards.saveDescription': 'Save description',
'boards.comments': 'Comments',
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index eef3e67..fbd4d6d 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -269,6 +269,16 @@ export const zhCN: Partial<Record<keyof typeof en, string>> = {
'boards.commentPlaceholder': '说点什么…(⌘↵ 发送 · @ 提醒某人)',
'boards.column': '所在列',
'boards.assignee': '负责人',
+ 'boards.dueDate': '截止日期',
+ 'boards.noDueDate': '无截止日期',
+ 'boards.dueToday': '今日截止',
+ 'boards.overdue': '已逾期',
+ 'boards.dueSaveFailed': '保存截止日期失败,请重试。',
+ 'boards.columnKind': '列状态',
+ 'boards.kindOther': '其他',
+ 'boards.kindTodo': '待办',
+ 'boards.kindDoing': '进行中',
+ 'boards.kindDone': '已完成',
'boards.description': '描述',
'boards.saveDescription': '保存描述',
'boards.comments': '评论',
diff --git a/src/stores/boards.ts b/src/stores/boards.ts
index 6eb960e..72039d8 100644
--- a/src/stores/boards.ts
+++ b/src/stores/boards.ts
@@ -1,7 +1,7 @@
import { create } from 'zustand'
import { api, ws } from '@/api/client'
import type {
- BoardSummary, BoardSnapshot, BoardCard, BoardCardComment, BoardCardLookup,
+ BoardSummary, BoardSnapshot, BoardCard, BoardCardComment, BoardCardLookup, BoardColumn,
} from '@/types'
import { pendingCreateRequestId } from '@/lib/create-idempotency'
import { commitIfContextCurrent, useAuth } from '@/stores/auth'
@@ -42,14 +42,15 @@ interface BoardsState {
addColumn: (boardId: string, title: string) => Promise<void>
renameColumn: (boardId: string, columnId: string, title: string) => Promise<void>
+ setColumnKind: (boardId: string, columnId: string, kind: BoardColumn['kind']) => Promise<void>
deleteColumn: (boardId: string, columnId: string) => Promise<void>
addCard: (boardId: string, input: {
- columnId: string; title: string; description?: string; assigneeId?: string | null
+ columnId: string; title: string; description?: string; assigneeId?: string | null; dueOn?: string | null
}) => Promise<void>
patchCard: (boardId: string, cardId: string, input: {
title?: string; description?: string; columnId?: string; position?: number
- assigneeId?: string | null
+ assigneeId?: string | null; dueOn?: string | null
}) => Promise<void>
/** Optimistic move — patches the in-memory snapshot immediately, fires
* the PATCH in the background, refetches on failure. */
@@ -233,6 +234,10 @@ export const useBoards = create<BoardsState>((set, get) => ({
await api.updateBoardColumn(boardId, columnId, { title })
await get().refreshBoard(boardId)
},
+ setColumnKind: async (boardId, columnId, kind) => {
+ await api.updateBoardColumn(boardId, columnId, { kind })
+ await get().refreshBoard(boardId)
+ },
deleteColumn: async (boardId, columnId) => {
await api.deleteBoardColumn(boardId, columnId)
await get().refreshBoard(boardId)
diff --git a/src/types.ts b/src/types.ts
index cb1971e..592be2d 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -395,6 +395,7 @@ export interface BoardSummary {
export interface BoardColumn {
id: string
title: string
+ kind: 'todo' | 'doing' | 'done' | null
position: number
createdAt: string
}
@@ -407,6 +408,7 @@ export interface BoardCard {
description: string | null
position: number
assigneeId: string | null
+ dueOn: string | null
mentions: string[]
commentCount: number
createdBy: string
diff --git a/tests/board-due-date.test.ts b/tests/board-due-date.test.ts
new file mode 100644
index 0000000..7cdc20e
--- /dev/null
+++ b/tests/board-due-date.test.ts
@@ -0,0 +1,16 @@
+import { test } from 'node:test'
+import assert from 'node:assert/strict'
+import { boardDueStatus, localCalendarDay } from '../src/lib/board-due-date.ts'
+
+test('due dates compare calendar days and exclude completed or unknown columns', () => {
+ assert.equal(boardDueStatus(null, 'todo', '2026-09-23'), 'none')
+ assert.equal(boardDueStatus('2026-09-22', 'todo', '2026-09-23'), 'overdue')
+ assert.equal(boardDueStatus('2026-09-23', 'doing', '2026-09-23'), 'today')
+ assert.equal(boardDueStatus('2026-09-24', 'todo', '2026-09-23'), 'date')
+ assert.equal(boardDueStatus('2026-09-22', 'done', '2026-09-23'), 'date')
+ assert.equal(boardDueStatus('2026-09-22', null, '2026-09-23'), 'date')
+})
+
+test('local calendar day uses local date fields without UTC conversion', () => {
+ assert.equal(localCalendarDay(new Date(2026, 8, 23, 0, 0)), '2026-09-23')
+})