Skip to content

An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others.

fix: Tweak table column widths. Will probably make them dynamicalyl adjust based on the longest string in the column. But that's an overoptimization for now.

Eyal Toledano5b0552fc2057
diff --git a/scripts/modules/task-manager.js b/scripts/modules/task-manager.js
index 5c779731..97bb73b5 100644
--- a/scripts/modules/task-manager.js
+++ b/scripts/modules/task-manager.js
@@ -835,14 +835,33 @@ function listTasks(tasksPath, statusFilter, withSubtasks = false) {
}
// COMPLETELY REVISED TABLE APPROACH
- // Define fixed column widths based on terminal size
- const idWidth = 10;
- const statusWidth = 20;
- const priorityWidth = 10;
- const depsWidth = 25;
-
- // Calculate title width from available space
- const titleWidth = terminalWidth - idWidth - statusWidth - priorityWidth - depsWidth - 10; // 10 for borders and padding
+ // Define percentage-based column widths and calculate actual widths
+ // Adjust percentages based on content type and user requirements
+
+ // Adjust ID width if showing subtasks (subtask IDs are longer: e.g., "1.2")
+ const idWidthPct = withSubtasks ? 10 : 7;
+
+ // Calculate max status length to accommodate "in-progress"
+ const statusWidthPct = 15;
+
+ // Increase priority column width as requested
+ const priorityWidthPct = 12;
+
+ // Make dependencies column smaller as requested (-20%)
+ const depsWidthPct = 20;
+
+ // Calculate title/description width as remaining space (+20% from dependencies reduction)
+ const titleWidthPct = 100 - idWidthPct - statusWidthPct - priorityWidthPct - depsWidthPct;
+
+ // Allow 10 characters for borders and padding
+ const availableWidth = terminalWidth - 10;
+
+ // Calculate actual column widths based on percentages
+ const idWidth = Math.floor(availableWidth * (idWidthPct / 100));
+ const statusWidth = Math.floor(availableWidth * (statusWidthPct / 100));
+ const priorityWidth = Math.floor(availableWidth * (priorityWidthPct / 100));
+ const depsWidth = Math.floor(availableWidth * (depsWidthPct / 100));
+ const titleWidth = Math.floor(availableWidth * (titleWidthPct / 100));
// Create a table with correct borders and spacing
const table = new Table({
diff --git a/scripts/modules/ui.js b/scripts/modules/ui.js
index e6717bc0..62a32ef8 100644
--- a/scripts/modules/ui.js
+++ b/scripts/modules/ui.js
@@ -510,6 +510,21 @@ async function displayNextTask(tasksPath) {
{ padding: { top: 0, bottom: 0, left: 1, right: 1 }, margin: { top: 1, bottom: 0 }, borderColor: 'magenta', borderStyle: 'round' }
));
+ // Calculate available width for the subtask table
+ const availableWidth = process.stdout.columns - 10 || 100; // Default to 100 if can't detect
+
+ // Define percentage-based column widths
+ const idWidthPct = 8;
+ const statusWidthPct = 15;
+ const depsWidthPct = 25;
+ const titleWidthPct = 100 - idWidthPct - statusWidthPct - depsWidthPct;
+
+ // Calculate actual column widths
+ const idWidth = Math.floor(availableWidth * (idWidthPct / 100));
+ const statusWidth = Math.floor(availableWidth * (statusWidthPct / 100));
+ const depsWidth = Math.floor(availableWidth * (depsWidthPct / 100));
+ const titleWidth = Math.floor(availableWidth * (titleWidthPct / 100));
+
// Create a table for subtasks with improved handling
const subtaskTable = new Table({
head: [
@@ -518,7 +533,7 @@ async function displayNextTask(tasksPath) {
chalk.magenta.bold('Title'),
chalk.magenta.bold('Deps')
],
- colWidths: [6, 12, Math.min(50, process.stdout.columns - 65 || 30), 30],
+ colWidths: [idWidth, statusWidth, titleWidth, depsWidth],
style: {
head: [],
border: [],
@@ -741,6 +756,21 @@ async function displayTaskById(tasksPath, taskId) {
{ padding: { top: 0, bottom: 0, left: 1, right: 1 }, margin: { top: 1, bottom: 0 }, borderColor: 'magenta', borderStyle: 'round' }
));
+ // Calculate available width for the subtask table
+ const availableWidth = process.stdout.columns - 10 || 100; // Default to 100 if can't detect
+
+ // Define percentage-based column widths
+ const idWidthPct = 8;
+ const statusWidthPct = 15;
+ const depsWidthPct = 25;
+ const titleWidthPct = 100 - idWidthPct - statusWidthPct - depsWidthPct;
+
+ // Calculate actual column widths
+ const idWidth = Math.floor(availableWidth * (idWidthPct / 100));
+ const statusWidth = Math.floor(availableWidth * (statusWidthPct / 100));
+ const depsWidth = Math.floor(availableWidth * (depsWidthPct / 100));
+ const titleWidth = Math.floor(availableWidth * (titleWidthPct / 100));
+
// Create a table for subtasks with improved handling
const subtaskTable = new Table({
head: [
@@ -749,7 +779,7 @@ async function displayTaskById(tasksPath, taskId) {
chalk.magenta.bold('Title'),
chalk.magenta.bold('Deps')
],
- colWidths: [10, 15, Math.min(50, process.stdout.columns - 40 || 30), 20],
+ colWidths: [idWidth, statusWidth, titleWidth, depsWidth],
style: {
head: [],
border: [],