mirror of
https://github.com/BradGroux/veritas-kanban.git
synced 2026-12-03 19:27:18 +00:00
- Standardize API response envelope and error format (#2) - Add UnauthorizedError, ForbiddenError, BadRequestError, InternalError classes - Add pagination support with sendPaginated() helper - Standardize all 11 route files to use error classes (zero ad-hoc patterns) - Standardize auth middleware error responses - Abstract file storage behind repository interface (#6) - Extend storage interfaces: Activity, Template, StatusHistory, ManagedList, Telemetry - Implement file-based adapters in FileStorageProvider - Add fs-helpers.ts as centralized filesystem access layer - Remove direct fs imports from all 10 service/route files - Complete blocked task status implementation (#32) - Fix MCP tools Zod/JSON schema definitions - Fix MCP active tasks filter - Fix CLI help text and status color formatting Closes #2, closes #6, closes #32
70 lines
1.9 KiB
TypeScript
70 lines
1.9 KiB
TypeScript
import chalk from 'chalk';
|
|
import type { Task } from './types.js';
|
|
|
|
export function formatTask(task: Task, verbose = false): string {
|
|
const statusColors: Record<string, (s: string) => string> = {
|
|
todo: chalk.gray,
|
|
'in-progress': chalk.yellow,
|
|
blocked: chalk.red,
|
|
done: chalk.green,
|
|
};
|
|
|
|
const priorityColors: Record<string, (s: string) => string> = {
|
|
low: chalk.dim,
|
|
medium: chalk.white,
|
|
high: chalk.red,
|
|
};
|
|
|
|
const typeIcons: Record<string, string> = {
|
|
code: '💻',
|
|
research: '🔍',
|
|
content: '📝',
|
|
automation: '⚡',
|
|
};
|
|
|
|
const statusColor = statusColors[task.status] || chalk.white;
|
|
const priorityColor = priorityColors[task.priority] || chalk.white;
|
|
|
|
let line = `${typeIcons[task.type] || '•'} ${chalk.cyan(task.id.slice(-8))} `;
|
|
line += statusColor(`[${task.status}]`) + ' ';
|
|
line += priorityColor(`(${task.priority})`) + ' ';
|
|
line += chalk.bold(task.title);
|
|
|
|
if (task.project) {
|
|
line += chalk.dim(` #${task.project}`);
|
|
}
|
|
|
|
if (verbose) {
|
|
line += '\n';
|
|
if (task.description) {
|
|
line += chalk.dim(
|
|
` ${task.description.slice(0, 80)}${task.description.length > 80 ? '...' : ''}\n`
|
|
);
|
|
}
|
|
if (task.git?.branch) {
|
|
line += chalk.dim(` 🌿 ${task.git.branch}\n`);
|
|
}
|
|
if (task.attempt?.status === 'running') {
|
|
line += chalk.yellow(` 🤖 Agent running (${task.attempt.agent})\n`);
|
|
}
|
|
if (task.review?.decision) {
|
|
const decisionColors: Record<string, (s: string) => string> = {
|
|
approved: chalk.green,
|
|
'changes-requested': chalk.yellow,
|
|
rejected: chalk.red,
|
|
};
|
|
const color = decisionColors[task.review.decision] || chalk.white;
|
|
line += color(` ✓ ${task.review.decision}\n`);
|
|
}
|
|
}
|
|
|
|
return line;
|
|
}
|
|
|
|
export function formatTaskJson(task: Task): string {
|
|
return JSON.stringify(task, null, 2);
|
|
}
|
|
|
|
export function formatTasksJson(tasks: Task[]): string {
|
|
return JSON.stringify(tasks, null, 2);
|
|
}
|