π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π¨ chore(cli): register task command and add kanban board view (#13511)
Arvin Xudd7819b1be2d
diff --git a/apps/cli/man/man1/lh.1 b/apps/cli/man/man1/lh.1index 1d705ad9afc..a91439fdd26 100644--- a/apps/cli/man/man1/lh.1+++ b/apps/cli/man/man1/lh.1@@ -1,6 +1,6 @@.\" Code generated by `npm run man:generate`; DO NOT EDIT..\" Manual command details come from the Commander command tree.-.TH LH 1 "" "@lobehub/cli 0.0.1\-canary.14" "User Commands"+.TH LH 1 "" "@lobehub/cli 0.0.1\-canary.15" "User Commands".SH NAMElh \- LobeHub CLI \- manage and connect to LobeHub services.SH SYNOPSIS@@ -83,6 +83,9 @@ Manage agent skills.B session\-groupManage agent session groups.TP+.B task+Manage agent tasks+.TP.B threadManage message threads.TPdiff --git a/apps/cli/package.json b/apps/cli/package.jsonindex e0e121447ac..8f754b13e4f 100644--- a/apps/cli/package.json+++ b/apps/cli/package.json@@ -1,6 +1,6 @@{"name": "@lobehub/cli",- "version": "0.0.1-canary.14",+ "version": "0.0.1-canary.15","type": "module","bin": {"lh": "./dist/index.js",diff --git a/apps/cli/src/commands/task/index.ts b/apps/cli/src/commands/task/index.tsindex f22103d8f45..e5aa7866c1c 100644--- a/apps/cli/src/commands/task/index.ts+++ b/apps/cli/src/commands/task/index.ts@@ -2,10 +2,12 @@ import type { Command } from 'commander';import pc from 'picocolors';import { getTrpcClient } from '../../api/client';+import type { KanbanColumn } from '../../utils/format';import {confirm,displayWidth,outputJson,+ printKanban,printTable,timeAgo,truncate,@@ -37,10 +39,12 @@ export function registerTaskCommand(program: Command) {.option('-L, --limit <n>', 'Page size', '50').option('--offset <n>', 'Offset', '0').option('--tree', 'Display as tree structure')+ .option('--board', 'Display as kanban board grouped by status').option('--json [fields]', 'Output JSON').action(async (options: {agent?: string;+ board?: boolean;json?: string | boolean;limit?: string;offset?: string;@@ -59,8 +63,8 @@ export function registerTaskCommand(program: Command) {if (options.limit) input.limit = Number.parseInt(options.limit, 10);if (options.offset) input.offset = Number.parseInt(options.offset, 10);- // For tree mode, fetch all tasks (no pagination limit)- if (options.tree) {+ // For tree/board mode, fetch all tasks (no pagination limit)+ if (options.tree || options.board) {input.limit = 100;delete input.offset;}@@ -77,6 +81,58 @@ export function registerTaskCommand(program: Command) {return;}+ if (options.board) {+ // Kanban board grouped by status+ const statusOrder = [+ 'backlog',+ 'blocked',+ 'running',+ 'paused',+ 'completed',+ 'failed',+ 'timeout',+ 'canceled',+ ];++ const statusColors: Record<string, (s: string) => string> = {+ backlog: pc.dim,+ blocked: pc.red,+ canceled: pc.dim,+ completed: pc.green,+ failed: pc.red,+ paused: pc.yellow,+ running: pc.blue,+ timeout: pc.red,+ };++ // Group tasks by status+ const grouped = new Map<string, any[]>();+ for (const t of result.data) {+ const status = t.status || 'backlog';+ const list = grouped.get(status) || [];+ list.push(t);+ grouped.set(status, list);+ }++ const kanbanColumns: KanbanColumn[] = statusOrder+ .filter((s) => grouped.has(s))+ .map((status) => ({+ color: statusColors[status],+ items: grouped.get(status)!.map((t: any) => ({+ badge: pc.dim(t.identifier),+ meta: t.assigneeAgentId ? `agent: ${t.assigneeAgentId}` : undefined,+ title: t.name || t.instruction,+ })),+ title: status.toUpperCase(),+ }));++ console.log();+ printKanban(kanbanColumns);+ console.log();+ log.info(`Total: ${result.total}`);+ return;+ }+if (options.tree) {// Build tree displayconst taskMap = new Map<string, any>();diff --git a/apps/cli/src/program.ts b/apps/cli/src/program.tsindex 06ce62cf62d..004ca90dd9c 100644--- a/apps/cli/src/program.ts+++ b/apps/cli/src/program.ts@@ -27,6 +27,7 @@ import { registerSearchCommand } from './commands/search';import { registerSessionGroupCommand } from './commands/session-group';import { registerSkillCommand } from './commands/skill';import { registerStatusCommand } from './commands/status';+import { registerTaskCommand } from './commands/task';import { registerThreadCommand } from './commands/thread';import { registerTopicCommand } from './commands/topic';import { registerUserCommand } from './commands/user';@@ -61,6 +62,7 @@ export function createProgram() {registerFileCommand(program);registerSkillCommand(program);registerSessionGroupCommand(program);+ registerTaskCommand(program);registerThreadCommand(program);registerTopicCommand(program);registerMessageCommand(program);diff --git a/apps/cli/src/utils/format.ts b/apps/cli/src/utils/format.tsindex 394c6a09f98..43e5e55b79a 100644--- a/apps/cli/src/utils/format.ts+++ b/apps/cli/src/utils/format.ts@@ -387,6 +387,102 @@ export function printCalendarHeatmap(console.log();}+// ββ Kanban Board βββββββββββββββββββββββββββββββββββββ++export interface KanbanColumn {+ color?: (s: string) => string;+ items: KanbanCard[];+ title: string;+}++export interface KanbanCard {+ badge?: string;+ meta?: string;+ title: string;+}++/**+ * Render a kanban board with side-by-side columns.+ * Adapts column width to terminal width automatically.+ */+export function printKanban(columns: KanbanColumn[]) {+ // Filter out empty columns+ const cols = columns.filter((c) => c.items.length > 0);+ if (cols.length === 0) return;++ const termWidth = process.stdout.columns || 100;+ // Each column gets equal width, with 1-char gap between+ const colWidth = Math.max(20, Math.floor((termWidth - (cols.length - 1)) / cols.length));+ const innerWidth = colWidth - 4; // 2 chars border + 2 padding++ const maxRows = Math.max(...cols.map((c) => c.items.length));++ // ββ Header ββ+ const topBorder = cols+ .map((c) => {+ const titleStr = ` ${c.title} (${c.items.length}) `;+ const color = c.color || pc.white;+ const remaining = colWidth - 2 - displayWidth(titleStr);+ const left = Math.floor(remaining / 2);+ const right = remaining - left;+ return color(+ 'β' + 'β'.repeat(Math.max(0, left)) + titleStr + 'β'.repeat(Math.max(0, right)) + 'β',+ );+ })+ .join(' ');+ console.log(topBorder);++ // ββ Rows ββ+ for (let row = 0; row < maxRows; row++) {+ const line = cols+ .map((c) => {+ const color = c.color || pc.white;+ const item = c.items[row];+ if (!item) {+ return color('β') + ' '.repeat(colWidth - 2) + color('β');+ }++ const badge = item.badge ? item.badge + ' ' : '';+ const badgeWidth = displayWidth(badge);+ const titleMaxWidth = innerWidth - badgeWidth;+ const title = truncate(item.title, titleMaxWidth);+ const titleWidth = displayWidth(title);+ const pad = ' '.repeat(Math.max(0, colWidth - 2 - badgeWidth - titleWidth - 2));+ return color('β') + ' ' + badge + title + pad + ' ' + color('β');+ })+ .join(' ');+ console.log(line);++ // Print meta line if any card in this row has meta+ const hasMeta = cols.some((c) => c.items[row]?.meta);+ if (hasMeta) {+ const metaLine = cols+ .map((c) => {+ const color = c.color || pc.white;+ const item = c.items[row];+ if (!item?.meta) {+ return color('β') + ' '.repeat(colWidth - 2) + color('β');+ }+ const meta = truncate(item.meta, innerWidth);+ const metaWidth = displayWidth(meta);+ const pad = ' '.repeat(Math.max(0, colWidth - 2 - metaWidth - 2));+ return color('β') + ' ' + pc.dim(meta) + pad + ' ' + color('β');+ })+ .join(' ');+ console.log(metaLine);+ }+ }++ // ββ Bottom border ββ+ const bottomBorder = cols+ .map((c) => {+ const color = c.color || pc.white;+ return color('β' + 'β'.repeat(colWidth - 2) + 'β');+ })+ .join(' ');+ console.log(bottomBorder);+}+export function confirm(message: string): Promise<boolean> {const rl = createInterface({ input: process.stdin, output: process.stderr });return new Promise((resolve) => {