Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(kanban): card priority (low/medium/high/urgent) with chips and activity events

enes25b9969c7bf9
diff --git a/src/renderer/components/kanban/BoardLogPanel.tsx b/src/renderer/components/kanban/BoardLogPanel.tsx
index 5e0b35bb6..e23617046 100644
--- a/src/renderer/components/kanban/BoardLogPanel.tsx
+++ b/src/renderer/components/kanban/BoardLogPanel.tsx
@@ -35,6 +35,10 @@ function eventLine(name: string, e: BoardLogEvent): string {
return `${name} set the due date → ${e.to ? formatStamp(Date.parse(e.to)) : ''}`.trimEnd()
case 'due-cleared':
return `${name} removed the due date`
+ case 'priority-set':
+ return `${name} set priority → ${e.to ?? ''}`.trimEnd()
+ case 'priority-cleared':
+ return `${name} removed the priority`
default:
// A newer peer may write event types this build doesn't know — show them neutrally.
return `${name} updated this card`
diff --git a/src/renderer/components/kanban/CardMetaBar.tsx b/src/renderer/components/kanban/CardMetaBar.tsx
index 10a2aafeb..765c54f22 100644
--- a/src/renderer/components/kanban/CardMetaBar.tsx
+++ b/src/renderer/components/kanban/CardMetaBar.tsx
@@ -1,12 +1,19 @@
import { useMemo, useState } from 'react'
-import type { BoardLogAuthor, ProjectKanban } from '@shared/types'
-import { cardMeta, setCardDue, toggleAssignee } from '../../lib/kanban'
+import type { BoardLogAuthor, KanbanPriority, ProjectKanban } from '@shared/types'
+import { cardMeta, setCardDue, setCardPriority, toggleAssignee } from '../../lib/kanban'
import { loadIdentity, selectOthers, usePresence } from '../../state/presence'
import { useBoardLog } from '../../state/boardLog'
import { useProjects } from '../../state/projects'
const initialOf = (name: string): string => (name.trim()[0] ?? '?').toUpperCase()
+export const PRIORITIES: Array<{ id: KanbanPriority; label: string; color: string }> = [
+ { id: 'low', label: 'Low', color: '#8e8e93' },
+ { id: 'medium', label: 'Medium', color: '#ffd60a' },
+ { id: 'high', label: 'High', color: '#ff9f0a' },
+ { id: 'urgent', label: 'Urgent', color: '#ff453a' }
+]
+
/** Local-wallclock value for a datetime-local input (its value is timezone-less). */
function toLocalInput(ts: number): string {
const d = new Date(ts)
@@ -44,6 +51,7 @@ export function CardMetaBar({ nodeId, board, onChange }: CardMetaBarProps) {
const assignees = meta?.assignees ?? []
const due = meta?.dueAt
const overdue = due !== undefined && due < Date.now()
+ const priority = meta?.priority
return (
<div className="kanban-meta">
@@ -111,6 +119,22 @@ export function CardMetaBar({ nodeId, board, onChange }: CardMetaBarProps) {
)}
</div>
</div>
+ <div className="kanban-meta__group">
+ <span className="kanban-meta__label">Priority</span>
+ <div className="kanban-meta__row">
+ {PRIORITIES.map((pr) => (
+ <button
+ key={pr.id}
+ className={`kanban-prio${priority === pr.id ? ' kanban-prio--on' : ''}`}
+ style={priority === pr.id ? { background: `${pr.color}2e`, borderColor: pr.color, color: pr.color } : undefined}
+ title={priority === pr.id ? `${pr.label} — click to clear` : pr.label}
+ onClick={() => onChange(setCardPriority(board, nodeId, priority === pr.id ? null : pr.id))}
+ >
+ {pr.label}
+ </button>
+ ))}
+ </div>
+ </div>
</div>
)
}
diff --git a/src/renderer/components/kanban/SessionCard.tsx b/src/renderer/components/kanban/SessionCard.tsx
index cf79f7c36..71c434dc6 100644
--- a/src/renderer/components/kanban/SessionCard.tsx
+++ b/src/renderer/components/kanban/SessionCard.tsx
@@ -1,5 +1,5 @@
import { useState } from 'react'
-import type { KanbanCardMeta } from '@shared/types'
+import type { KanbanCardMeta, KanbanPriority } from '@shared/types'
import type { AgentNodeStatus } from '../../state/agentStatus'
import { ContextMeter } from '../ContextMeter'
import type { KanbanSession } from './KanbanView'
@@ -29,6 +29,13 @@ export function SessionCard({ session, status, meta, onOpen, onDragStart, onDrag
const assignees = meta?.assignees ?? []
const due = meta?.dueAt
const overdue = due !== undefined && due < Date.now()
+ const priority = meta?.priority
+ const PRIO_COLOR: Record<KanbanPriority, string> = {
+ low: '#8e8e93',
+ medium: '#ffd60a',
+ high: '#ff9f0a',
+ urgent: '#ff453a'
+ }
const hasDetail = !!status?.sessionId || !!status?.session || stickyPreview.includes('\n')
return (
<div
@@ -60,8 +67,16 @@ export function SessionCard({ session, status, meta, onOpen, onDragStart, onDrag
{badge === 'needs' && <span className="kanban-badge kanban-badge--needs">NEEDS YOU</span>}
{status?.unread && <span className="kanban-card__unread" />}
</div>
- {(assignees.length > 0 || due !== undefined) && (
+ {(assignees.length > 0 || due !== undefined || priority !== undefined) && (
<div className="kanban-card__metarow">
+ {priority !== undefined && PRIO_COLOR[priority] && (
+ <span
+ className="kanban-due kanban-prio-chip"
+ style={{ background: `${PRIO_COLOR[priority]}26`, color: PRIO_COLOR[priority] }}
+ >
+ {priority.toUpperCase()}
+ </span>
+ )}
{due !== undefined && (
<span className={`kanban-due${overdue ? ' kanban-due--overdue' : ''}`}>
{new Date(due).toLocaleDateString(undefined, { day: 'numeric', month: 'short' })}
diff --git a/src/renderer/lib/boardLogDiff.test.ts b/src/renderer/lib/boardLogDiff.test.ts
index b84972d52..3e5ef8cf1 100644
--- a/src/renderer/lib/boardLogDiff.test.ts
+++ b/src/renderer/lib/boardLogDiff.test.ts
@@ -134,3 +134,21 @@ describe('card meta events', () => {
expect(boardLogEvents(withMeta, withMeta, titles)).toEqual([])
})
})
+
+describe('priority events', () => {
+ const titles = (id: string) => 'card ' + id
+ const base = () => board([col('c1', 'To Do')], [])
+ it('set / changed / cleared', () => {
+ const hi = { ...base(), meta: [{ nodeId: 'n1', priority: 'high' as const }] }
+ expect(boardLogEvents(base(), hi, titles)).toEqual([
+ { nodeId: 'n1', event: { type: 'priority-set', to: 'high' } }
+ ])
+ const ur = { ...base(), meta: [{ nodeId: 'n1', priority: 'urgent' as const }] }
+ expect(boardLogEvents(hi, ur, titles)).toEqual([
+ { nodeId: 'n1', event: { type: 'priority-set', to: 'urgent' } }
+ ])
+ expect(boardLogEvents(ur, base(), titles)).toEqual([
+ { nodeId: 'n1', event: { type: 'priority-cleared' } }
+ ])
+ })
+})
diff --git a/src/renderer/lib/boardLogDiff.ts b/src/renderer/lib/boardLogDiff.ts
index 09a83e0db..1c5377ae1 100644
--- a/src/renderer/lib/boardLogDiff.ts
+++ b/src/renderer/lib/boardLogDiff.ts
@@ -94,6 +94,12 @@ export function boardLogEvents(
if (nd !== undefined) out.push({ nodeId, event: { type: 'due-set', to: new Date(nd).toISOString() } })
else out.push({ nodeId, event: { type: 'due-cleared' } })
}
+ const pp = pm?.priority
+ const np = nm?.priority
+ if (pp !== np) {
+ if (np !== undefined) out.push({ nodeId, event: { type: 'priority-set', to: np } })
+ else out.push({ nodeId, event: { type: 'priority-cleared' } })
+ }
}
return out
diff --git a/src/renderer/lib/kanban.test.ts b/src/renderer/lib/kanban.test.ts
index e1ce2972d..2e9c1a454 100644
--- a/src/renderer/lib/kanban.test.ts
+++ b/src/renderer/lib/kanban.test.ts
@@ -3,7 +3,7 @@ import type { ProjectKanban } from '@shared/types'
import {
addColumn, assignNode, assignedTo, defaultKanban, deleteColumn, moveColumn,
cardMeta, columnForNode, nextColumnColor, pruneAssignments, recolorColumn, renameColumn,
- setCardDue, toggleAssignee, unassigned
+ setCardDue, setCardPriority, toggleAssignee, unassigned
} from './kanban'
const board = (): ProjectKanban => ({
@@ -135,3 +135,21 @@ describe('card meta', () => {
expect(pruneAssignments(same, ['n1', 'n2', 'n3'])).toBe(same)
})
})
+
+describe('card priority', () => {
+ const enes = { name: 'enes', color: '#0a84ff' }
+ it('setCardPriority sets, changes and clears; clearing the only field drops the entry', () => {
+ const k1 = setCardPriority(board(), 'n1', 'high')
+ expect(cardMeta(k1, 'n1')?.priority).toBe('high')
+ const k2 = setCardPriority(k1, 'n1', 'urgent')
+ expect(cardMeta(k2, 'n1')?.priority).toBe('urgent')
+ expect(cardMeta(setCardPriority(k2, 'n1', null), 'n1')).toBeUndefined()
+ })
+ it('priority survives assignee/due edits (and vice versa)', () => {
+ const k = setCardDue(toggleAssignee(setCardPriority(board(), 'n1', 'low'), 'n1', enes), 'n1', 9)
+ expect(cardMeta(k, 'n1')).toMatchObject({ priority: 'low', dueAt: 9, assignees: [enes] })
+ const cleared = setCardDue(k, 'n1', null)
+ expect(cardMeta(cleared, 'n1')).toMatchObject({ priority: 'low', assignees: [enes] })
+ expect(cardMeta(cleared, 'n1')?.dueAt).toBeUndefined()
+ })
+})
diff --git a/src/renderer/lib/kanban.ts b/src/renderer/lib/kanban.ts
index 8d0c6458b..e667a9ba7 100644
--- a/src/renderer/lib/kanban.ts
+++ b/src/renderer/lib/kanban.ts
@@ -1,4 +1,4 @@
-import type { BoardLogAuthor, KanbanAssignment, KanbanCardMeta, KanbanColumn, ProjectKanban } from '@shared/types'
+import type { BoardLogAuthor, KanbanAssignment, KanbanCardMeta, KanbanColumn, KanbanPriority, ProjectKanban } from '@shared/types'
import { NODE_COLORS } from '../state/workspace'
// Pure kanban board transforms — the ONLY place board structure changes. The UI computes
@@ -148,7 +148,9 @@ function withCardMeta(
next: Omit<KanbanCardMeta, 'nodeId'> | null
): ProjectKanban {
const rest = metaList(k).filter((m) => m && m.nodeId !== nodeId)
- const keep = next && ((next.assignees?.length ?? 0) > 0 || next.dueAt !== undefined)
+ const keep =
+ next &&
+ ((next.assignees?.length ?? 0) > 0 || next.dueAt !== undefined || next.priority !== undefined)
const meta = keep ? [...rest, { nodeId, ...next }] : rest
const { meta: _m, ...bare } = k
return meta.length ? { ...bare, meta } : bare
@@ -166,7 +168,7 @@ export function toggleAssignee(
const assignees = had
? (cur?.assignees ?? []).filter((a) => a.name !== person.name)
: [...(cur?.assignees ?? []), person]
- return withCardMeta(k, nodeId, { assignees, dueAt: cur?.dueAt })
+ return withCardMeta(k, nodeId, { assignees, dueAt: cur?.dueAt, priority: cur?.priority })
}
/** Sets (or clears, with null) the card's due timestamp. */
@@ -174,6 +176,21 @@ export function setCardDue(k: ProjectKanban, nodeId: string, dueAt: number | nul
const cur = cardMeta(k, nodeId)
return withCardMeta(k, nodeId, {
assignees: cur?.assignees,
+ priority: cur?.priority,
...(dueAt === null ? {} : { dueAt })
})
}
+
+/** Sets (or clears, with null) the card's priority. */
+export function setCardPriority(
+ k: ProjectKanban,
+ nodeId: string,
+ priority: KanbanPriority | null
+): ProjectKanban {
+ const cur = cardMeta(k, nodeId)
+ return withCardMeta(k, nodeId, {
+ assignees: cur?.assignees,
+ dueAt: cur?.dueAt,
+ ...(priority === null ? {} : { priority })
+ })
+}
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index f6fee80c0..0e251ecf8 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -7084,3 +7084,22 @@ body,
.board-log__event .board-log__time {
margin-left: 6px;
}
+
+.kanban-prio {
+ background: rgba(255, 255, 255, 0.05);
+ border: 1px solid rgba(255, 255, 255, 0.15);
+ border-radius: 6px;
+ color: rgba(255, 255, 255, 0.65);
+ font-size: 11.5px;
+ font-weight: 600;
+ padding: 3px 9px;
+ cursor: pointer;
+ transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
+}
+.kanban-prio:hover {
+ border-color: rgba(255, 255, 255, 0.35);
+ color: #fff;
+}
+.kanban-prio-chip {
+ letter-spacing: 0.04em;
+}
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 73730d2af..8acf2cd45 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -214,11 +214,15 @@ export interface KanbanAssignment {
/** Trello-style per-card metadata. Lives beside the assignments (not on the node) so it rides
* the same git/mirror machinery; absent entries mean "no metadata". Assignee identity is the
* presence identity — the same {name, color} the board log attributes comments to. */
+export type KanbanPriority = 'low' | 'medium' | 'high' | 'urgent'
+
export interface KanbanCardMeta {
nodeId: string
assignees?: BoardLogAuthor[]
/** Due timestamp (ms). Absent = no due date. */
dueAt?: number
+ /** Absent = no priority. */
+ priority?: KanbanPriority
}
export interface ProjectKanban {
@@ -247,6 +251,8 @@ export interface BoardLogEvent {
| 'member-unassigned'
| 'due-set'
| 'due-cleared'
+ | 'priority-set'
+ | 'priority-cleared'
from?: string
to?: string
/** Column title for column-added/deleted; card title for card-created. */