@hasna/todos 0.9.24 → 0.9.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1429,8 +1429,8 @@ function serveStaticFile(filePath) {
1429
1429
  headers: { "Content-Type": contentType }
1430
1430
  });
1431
1431
  }
1432
- function taskToSummary(task) {
1433
- return {
1432
+ function taskToSummary(task, fields) {
1433
+ const full = {
1434
1434
  id: task.id,
1435
1435
  short_id: task.short_id,
1436
1436
  title: task.title,
@@ -1450,6 +1450,9 @@ function taskToSummary(task) {
1450
1450
  completed_at: task.completed_at,
1451
1451
  due_at: task.due_at
1452
1452
  };
1453
+ if (!fields || fields.length === 0)
1454
+ return full;
1455
+ return Object.fromEntries(fields.map((f) => [f, full[f] ?? null]));
1453
1456
  }
1454
1457
  async function startServer(port, options) {
1455
1458
  const shouldOpen = options?.open ?? true;
@@ -1532,12 +1535,14 @@ Dashboard not found at: ${dashboardDir}`);
1532
1535
  const status = url.searchParams.get("status") || undefined;
1533
1536
  const projectId = url.searchParams.get("project_id") || undefined;
1534
1537
  const limitParam = url.searchParams.get("limit");
1538
+ const fieldsParam = url.searchParams.get("fields");
1539
+ const fields = fieldsParam ? fieldsParam.split(",").map((f) => f.trim()).filter(Boolean) : undefined;
1535
1540
  const tasks = listTasks({
1536
1541
  status,
1537
1542
  project_id: projectId,
1538
1543
  limit: limitParam ? parseInt(limitParam, 10) : undefined
1539
1544
  });
1540
- return json(tasks.map(taskToSummary), 200, port);
1545
+ return json(tasks.map((t) => taskToSummary(t, fields)), 200, port);
1541
1546
  }
1542
1547
  if (path === "/api/tasks" && method === "POST") {
1543
1548
  try {
@@ -1561,7 +1566,7 @@ Dashboard not found at: ${dashboardDir}`);
1561
1566
  const status = url.searchParams.get("status") || undefined;
1562
1567
  const projectId = url.searchParams.get("project_id") || undefined;
1563
1568
  const tasks = listTasks({ status, project_id: projectId, limit: 1e4 });
1564
- const summaries = tasks.map(taskToSummary);
1569
+ const summaries = tasks.map((t) => taskToSummary(t));
1565
1570
  if (format === "csv") {
1566
1571
  const headers = ["id", "short_id", "title", "status", "priority", "project_id", "assigned_to", "agent_id", "created_at", "updated_at", "completed_at", "due_at"];
1567
1572
  const rows = summaries.map((t) => headers.map((h) => {
@@ -1687,8 +1692,8 @@ Dashboard not found at: ${dashboardDir}`);
1687
1692
  const completed = allTasks.filter((t) => t.status === "completed");
1688
1693
  return json({
1689
1694
  agent,
1690
- pending_tasks: pending.map(taskToSummary),
1691
- in_progress_tasks: inProgress.map(taskToSummary),
1695
+ pending_tasks: pending.map((t) => taskToSummary(t)),
1696
+ in_progress_tasks: inProgress.map((t) => taskToSummary(t)),
1692
1697
  stats: {
1693
1698
  total: allTasks.length,
1694
1699
  pending: pending.length,
@@ -1705,7 +1710,7 @@ Dashboard not found at: ${dashboardDir}`);
1705
1710
  const queue = pending.filter((t) => t.assigned_to === agentId || t.agent_id === agentId || !t.assigned_to && !t.locked_by);
1706
1711
  const order = { critical: 0, high: 1, medium: 2, low: 3 };
1707
1712
  queue.sort((a, b) => (order[a.priority] ?? 4) - (order[b.priority] ?? 4) || new Date(a.created_at).getTime() - new Date(b.created_at).getTime());
1708
- return json(queue.map(taskToSummary), 200, port);
1713
+ return json(queue.map((t) => taskToSummary(t)), 200, port);
1709
1714
  }
1710
1715
  if (path === "/api/tasks/claim" && method === "POST") {
1711
1716
  try {
@@ -1921,7 +1926,7 @@ Dashboard not found at: ${dashboardDir}`);
1921
1926
  if (!plan)
1922
1927
  return json({ error: "Plan not found" }, 404, port);
1923
1928
  const tasks = listTasks({ plan_id: id });
1924
- return json({ ...plan, tasks: tasks.map(taskToSummary) }, 200, port);
1929
+ return json({ ...plan, tasks: tasks.map((t) => taskToSummary(t)) }, 200, port);
1925
1930
  }
1926
1931
  if (method === "PATCH") {
1927
1932
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/todos",
3
- "version": "0.9.24",
3
+ "version": "0.9.25",
4
4
  "description": "Universal task management for AI coding agents - CLI + MCP server + interactive TUI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",