Skip to content

The agent that grows with you

feat(desktop): kanban new-task hotkey — the plugin command pattern

Brooklyn Nicholson81e196f2364b
diff --git a/apps/desktop/src/plugins/kanban/board.tsx b/apps/desktop/src/plugins/kanban/board.tsx
index 1cef71a5d48..a68f3fafdc1 100644
--- a/apps/desktop/src/plugins/kanban/board.tsx
+++ b/apps/desktop/src/plugins/kanban/board.tsx
@@ -81,6 +81,7 @@ import { TaskDrawer } from './drawer'
import { OrchestrationPanel } from './orchestration'
import { columnMeta, type KanbanBoard, type KanbanTask, type TaskEstimate } from './types'
import {
+ $newTaskLane,
ago,
type ArcState,
arcState,
@@ -1078,6 +1079,21 @@ export function KanbanBoardPage() {
const [assignee, setAssignee] = useState('')
const [selected, setSelected] = useState<ReadonlySet<string>>(new Set())
+ // A new-task request raised from outside the page (⌘⌥N, the palette row).
+ // The command navigates here and parks the lane; the page picks it up on
+ // arrival — whether it was already mounted or is mounting for the first
+ // time — then clears it so a later remount can't reopen the dialog.
+ const requestedLane = useValue($newTaskLane)
+
+ useEffect(() => {
+ if (requestedLane === null) {
+ return
+ }
+
+ setAddStatus(requestedLane)
+ $newTaskLane.set(null)
+ }, [requestedLane])
+
const toggleSelect = (id: string) => {
setSelected(prev => {
const next = new Set(prev)
diff --git a/apps/desktop/src/plugins/kanban/i18n.ts b/apps/desktop/src/plugins/kanban/i18n.ts
index 62a5b3261b8..3f8d1d97bb9 100644
--- a/apps/desktop/src/plugins/kanban/i18n.ts
+++ b/apps/desktop/src/plugins/kanban/i18n.ts
@@ -11,6 +11,9 @@ import { useMemo } from 'react'
type KanbanMessages = {
nav: string
openBoard: string
+ /** Command label — shows in the ⌘K palette AND as the keybind panel row,
+ * so it carries the "Kanban: " prefix the palette convention wants. */
+ newTaskCommand: string
countTip: (running: number, ready: number) => string
col: Record<
'archived' | 'blocked' | 'done' | 'ready' | 'review' | 'running' | 'scheduled' | 'todo' | 'triage',
@@ -183,6 +186,7 @@ type KanbanMessages = {
const en: KanbanMessages = {
nav: 'Kanban',
openBoard: 'Kanban: Open board',
+ newTaskCommand: 'Kanban: New task',
countTip: (running, ready) => `Kanban — ${running} running, ${ready} ready`,
col: {
triage: { label: 'Triage', help: 'Raw ideas — a specifier fleshes out the spec.' },
@@ -369,6 +373,7 @@ const en: KanbanMessages = {
const ja: KanbanMessages = {
nav: 'カンバン',
openBoard: 'カンバン: ボードを開く',
+ newTaskCommand: 'カンバン: 新しいタスク',
countTip: (running, ready) => `カンバン — 実行中 ${running}、待機 ${ready}`,
col: {
triage: { label: 'トリアージ', help: '生のアイデア — スペシファイアが仕様に整えます。' },
@@ -555,6 +560,7 @@ const ja: KanbanMessages = {
const zh: KanbanMessages = {
nav: '看板',
openBoard: '看板:打开面板',
+ newTaskCommand: '看板:新建任务',
countTip: (running, ready) => `看板 — 运行中 ${running}、就绪 ${ready}`,
col: {
triage: { label: '分诊', help: '原始想法 — 由细化代理整理出规格。' },
@@ -738,6 +744,7 @@ const zh: KanbanMessages = {
const zhHant: KanbanMessages = {
nav: '看板',
openBoard: '看板:開啟面板',
+ newTaskCommand: '看板:新增任務',
countTip: (running, ready) => `看板 — 執行中 ${running}、就緒 ${ready}`,
col: {
triage: { label: '分類', help: '原始想法 — 由細化代理整理出規格。' },
diff --git a/apps/desktop/src/plugins/kanban/plugin.tsx b/apps/desktop/src/plugins/kanban/plugin.tsx
index 307adf0b432..41eb03df9c5 100644
--- a/apps/desktop/src/plugins/kanban/plugin.tsx
+++ b/apps/desktop/src/plugins/kanban/plugin.tsx
@@ -16,6 +16,8 @@ import {
Codicon,
type HermesPlugin,
host,
+ type KeybindContribution,
+ KEYBINDS_AREA,
PALETTE_AREA,
type PaletteContribution,
type RouteContribution,
@@ -31,7 +33,7 @@ import {
import { $boardSlug, bindApi, boardKey, fetchBoard } from './api'
import { KanbanBoardPage } from './board'
import { KANBAN_LOCALES } from './i18n'
-import { useKanban } from './ui'
+import { $newTaskLane, useKanban } from './ui'
// Live "N running / ready" pill — one glance at fleet activity from anywhere,
// clicks through to the board. Shares the board query (one cache, one poll with
@@ -83,6 +85,23 @@ const plugin: HermesPlugin = {
ctx.i18n.register(KANBAN_LOCALES)
ctx.onDispose(bindApi(ctx.rest, ctx.storage, ctx.socket))
+ // The plugin command pattern: ONE action id (`kanban.newTask`) wired into
+ // two areas — a keybind (dispatch + rebindable panel row) and a palette row
+ // whose `action` field points back at it, so ⌘K shows the live combo. The
+ // handler is route-independent: it navigates to the page and parks the
+ // request in `$newTaskLane`, so the hotkey works from anywhere, not just
+ // while the board happens to be mounted.
+ //
+ // ⌘⌥N / Ctrl+Alt+N: `mod+n` is `session.new` and `mod+shift+n` is
+ // `session.newWindow`, both core built-ins a plugin can't shadow. Adding
+ // Alt keeps the "N for new" mnemonic on a chord core leaves free — it uses
+ // `alt` only for the `mod+alt+1…9` profile slots, never with a letter. That
+ // makes ⌘⌥<letter> the natural namespace for plugin commands.
+ const newTask = () => {
+ $newTaskLane.set('triage')
+ host.navigate('/kanban')
+ }
+
ctx.registerMany([
{
id: 'page',
@@ -111,6 +130,28 @@ const plugin: HermesPlugin = {
keywords: ['kanban', 'board', 'tasks', 'agents'],
run: () => host.navigate('/kanban')
} satisfies PaletteContribution
+ },
+ {
+ id: 'new-task',
+ area: PALETTE_AREA,
+ data: {
+ id: 'kanban.newTask',
+ action: 'kanban.newTask',
+ label: ctx.i18n.t('newTaskCommand'),
+ keywords: ['kanban', 'task', 'new', 'create', 'triage'],
+ run: newTask
+ } satisfies PaletteContribution
+ },
+ {
+ id: 'new-task',
+ area: KEYBINDS_AREA,
+ data: {
+ id: 'kanban.newTask',
+ category: 'view',
+ defaults: ['mod+alt+n'],
+ label: ctx.i18n.t('newTaskCommand'),
+ run: newTask
+ } satisfies KeybindContribution
}
])
}
diff --git a/apps/desktop/src/plugins/kanban/ui.tsx b/apps/desktop/src/plugins/kanban/ui.tsx
index 2b612172631..bc59bb7046a 100644
--- a/apps/desktop/src/plugins/kanban/ui.tsx
+++ b/apps/desktop/src/plugins/kanban/ui.tsx
@@ -2,6 +2,7 @@
* section chrome, and the masked scroller. Pure SDK + tokens. */
import {
+ atom,
coarseElapsed,
Codicon,
DropdownMenu,
@@ -23,6 +24,13 @@ import { columnMeta, type KanbanTask } from './types'
// and chrome from one place (./ui).
export { columnHelp, columnLabel, type KanbanText, lockedReason, useKanban } from './i18n'
+/** One-shot "open the new-task dialog in this lane" request, so a command that
+ * fires from ANYWHERE (keybind, palette) can reach the board page without the
+ * page having to exist yet: the handler navigates and drops the lane here, the
+ * page consumes it on arrival and clears it. Ephemeral by design — never
+ * persisted, so a remount can't reopen a dialog the user already dismissed. */
+export const $newTaskLane = atom<null | string>(null)
+
/** Orchestration knobs (cached app-wide; the settings panel invalidates). */
export function useOrchestration() {
return useQuery({ queryKey: ORCHESTRATION_KEY, queryFn: fetchOrchestration, staleTime: 60_000 }).data