fix: make tag listing table use dynamic column widths to prevent truncation#1264
fix: make tag listing table use dynamic column widths to prevent truncation#1264Crunchyman-ralph merged 2 commits intonextfrom
Conversation
|
WalkthroughReplaces fixed table column widths with dynamic widths computed from 95% of the terminal width, choosing column weight sets depending on whether metadata is shown, applies computed Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
scripts/modules/task-manager/tag-management.js(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
scripts/modules/task-manager/*.js
📄 CodeRabbit inference engine (.cursor/rules/ai_services.mdc)
scripts/modules/task-manager/*.js: Centralize all LLM calls throughgenerateTextServiceorgenerateObjectService.
Do not import or call anything from the oldai-services.js,ai-client-factory.js, orai-client-utils.jsfiles.
Do not initialize AI clients (Anthropic, Perplexity, etc.) directly within core logic (task-manager/) or MCP direct functions.
Do not fetch AI-specific parameters (model ID, max tokens, temp) usingconfig-manager.jsgetters for the AI call. Pass theroleinstead.
Do not implement fallback or retry logic outsideai-services-unified.js.
Do not handle API key resolution outside the service layer (it usesutils.jsinternally).
Determine the appropriaterole(main,research,fallback) in your core logic and pass it to the service.
Pass thesessionobject (received in thecontextparameter, especially from direct function wrappers) to the service call when in MCP context.
UsegenerateTextServiceand implement robust manual JSON parsing (with Zod validation after parsing) when structured output is needed, asgenerateObjectServicehas shown unreliability with some providers/schemas.
Be aware of potential reliability issues withgenerateObjectServiceacross different providers and complex schemas. PrefergenerateTextService+ manual parsing as a more robust alternative for structured data needs.Files in scripts/modules/task-manager/ should each handle a specific action related to task management (e.g., add-task.js, expand-task.js), supporting the tagged task lists system and backward compatibility.
Files:
scripts/modules/task-manager/tag-management.js
scripts/modules/**
📄 CodeRabbit inference engine (.cursor/rules/dev_workflow.mdc)
When using the MCP server, restart it if core logic in
scripts/modulesor MCP tool/direct function definitions change.
Files:
scripts/modules/task-manager/tag-management.js
scripts/modules/task-manager/*
📄 CodeRabbit inference engine (.cursor/rules/tags.mdc)
scripts/modules/task-manager/*: All core functions in scripts/modules/task-manager/ must accept a context parameter and use it to extract projectRoot and tag
All core functions in scripts/modules/task-manager/ must use readJSON(tasksPath, projectRoot, tag) and writeJSON(tasksPath, data, projectRoot, tag)
Files:
scripts/modules/task-manager/tag-management.js
scripts/modules/task-manager/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)
scripts/modules/task-manager/**/*.js: Functions in scripts/modules/task-manager/ that invoke AI services must call the appropriate AI service function (e.g., generateObjectService), passing commandName and outputType in the params object.
Core logic functions in scripts/modules/task-manager/ must return an object that includes aiServiceResponse.telemetryData.
If the core logic function handles CLI output (outputFormat === 'text' or 'cli'), and aiServiceResponse.telemetryData is available, it must call displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli') from scripts/modules/ui.js.Do not call AI-specific getters (like
getMainModelId,getMainMaxTokens) from core logic functions inscripts/modules/task-manager/*; instead, pass theroleto the unified AI service.
Files:
scripts/modules/task-manager/tag-management.js
**/*.js
📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)
**/*.js: Declare and initialize global variables at the top of modules to avoid hoisting issues.
Use proper function declarations to avoid hoisting issues and initialize variables before they are referenced.
Do not reference variables before their declaration in module scope.
Use dynamic imports (import()) to avoid initialization order issues in modules.
Files:
scripts/modules/task-manager/tag-management.js
🧠 Learnings (3)
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Allow filtering tasks by status within the current tag context, handle subtask display in lists, and use consistent table formats.
Applied to files:
scripts/modules/task-manager/tag-management.js
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Use tag resolution functions to maintain backward compatibility, returning legacy format to core functions and not exposing the tagged structure to existing core logic.
Applied to files:
scripts/modules/task-manager/tag-management.js
📚 Learning: 2025-07-18T17:16:32.622Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/ui.mdc:0-0
Timestamp: 2025-07-18T17:16:32.622Z
Learning: Applies to scripts/modules/ui.js : Use cli-table3 for table rendering, include colored bold headers, and set appropriate column widths for readability
Applied to files:
scripts/modules/task-manager/tag-management.js
🧬 Code graph analysis (1)
scripts/modules/task-manager/tag-management.js (1)
scripts/modules/task-manager/add-task.js (1)
table(570-577)
🪛 GitHub Actions: CI
scripts/modules/task-manager/tag-management.js
[error] 622-641: Biome format check detected formatting diffs in the file. The formatter would have reformatted content. Run 'npm run format-check' again after applying fixes (or run the formatter directly, e.g., 'biome format .') to resolve the issue.
🔇 Additional comments (1)
scripts/modules/task-manager/tag-management.js (1)
644-648: Approve dynamic widths and wordWrap implementation. Verified no hardcoded truncation (no.slice/substring) remains intag-management.js; dynamiccolWidthsandwordWrap: trueensure full tag names display.
…cation - Replace hardcoded colWidths with terminal-width-based calculation - Tag Name column now gets 70% width (normal) or 25% width (metadata mode) - Add wordWrap support for better handling of long tag names - Fixes issue where tag names >20 chars were truncated with ellipsis - Users can now see full tag names for use with use-tag command Co-authored-by: Ralph Khreish <Crunchyman-ralph@users.noreply.github.com>
7f9c425 to
10e5591
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
scripts/modules/task-manager/tag-management.js (1)
622-644: Run formatter to fix CI-detected formatting issues.The past review flagged Biome formatting inconsistencies in this code block. Please run the project formatter before merging.
Based on coding guidelines
Run the following command to fix formatting:
#!/bin/bash npm run format
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
scripts/modules/task-manager/tag-management.js(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
scripts/modules/task-manager/*.js
📄 CodeRabbit inference engine (.cursor/rules/ai_services.mdc)
scripts/modules/task-manager/*.js: Centralize all LLM calls throughgenerateTextServiceorgenerateObjectService.
Do not import or call anything from the oldai-services.js,ai-client-factory.js, orai-client-utils.jsfiles.
Do not initialize AI clients (Anthropic, Perplexity, etc.) directly within core logic (task-manager/) or MCP direct functions.
Do not fetch AI-specific parameters (model ID, max tokens, temp) usingconfig-manager.jsgetters for the AI call. Pass theroleinstead.
Do not implement fallback or retry logic outsideai-services-unified.js.
Do not handle API key resolution outside the service layer (it usesutils.jsinternally).
Determine the appropriaterole(main,research,fallback) in your core logic and pass it to the service.
Pass thesessionobject (received in thecontextparameter, especially from direct function wrappers) to the service call when in MCP context.
UsegenerateTextServiceand implement robust manual JSON parsing (with Zod validation after parsing) when structured output is needed, asgenerateObjectServicehas shown unreliability with some providers/schemas.
Be aware of potential reliability issues withgenerateObjectServiceacross different providers and complex schemas. PrefergenerateTextService+ manual parsing as a more robust alternative for structured data needs.Files in scripts/modules/task-manager/ should each handle a specific action related to task management (e.g., add-task.js, expand-task.js), supporting the tagged task lists system and backward compatibility.
Files:
scripts/modules/task-manager/tag-management.js
scripts/modules/**
📄 CodeRabbit inference engine (.cursor/rules/dev_workflow.mdc)
When using the MCP server, restart it if core logic in
scripts/modulesor MCP tool/direct function definitions change.
Files:
scripts/modules/task-manager/tag-management.js
scripts/modules/task-manager/*
📄 CodeRabbit inference engine (.cursor/rules/tags.mdc)
scripts/modules/task-manager/*: All core functions in scripts/modules/task-manager/ must accept a context parameter and use it to extract projectRoot and tag
All core functions in scripts/modules/task-manager/ must use readJSON(tasksPath, projectRoot, tag) and writeJSON(tasksPath, data, projectRoot, tag)
Files:
scripts/modules/task-manager/tag-management.js
scripts/modules/task-manager/**/*.js
📄 CodeRabbit inference engine (.cursor/rules/telemetry.mdc)
scripts/modules/task-manager/**/*.js: Functions in scripts/modules/task-manager/ that invoke AI services must call the appropriate AI service function (e.g., generateObjectService), passing commandName and outputType in the params object.
Core logic functions in scripts/modules/task-manager/ must return an object that includes aiServiceResponse.telemetryData.
If the core logic function handles CLI output (outputFormat === 'text' or 'cli'), and aiServiceResponse.telemetryData is available, it must call displayAiUsageSummary(aiServiceResponse.telemetryData, 'cli') from scripts/modules/ui.js.Do not call AI-specific getters (like
getMainModelId,getMainMaxTokens) from core logic functions inscripts/modules/task-manager/*; instead, pass theroleto the unified AI service.
Files:
scripts/modules/task-manager/tag-management.js
**/*.js
📄 CodeRabbit inference engine (.cursor/rules/tests.mdc)
**/*.js: Declare and initialize global variables at the top of modules to avoid hoisting issues.
Use proper function declarations to avoid hoisting issues and initialize variables before they are referenced.
Do not reference variables before their declaration in module scope.
Use dynamic imports (import()) to avoid initialization order issues in modules.
Files:
scripts/modules/task-manager/tag-management.js
🧠 Learnings (2)
📚 Learning: 2025-07-18T17:14:29.399Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/tasks.mdc:0-0
Timestamp: 2025-07-18T17:14:29.399Z
Learning: Applies to scripts/modules/task-manager.js : Allow filtering tasks by status within the current tag context, handle subtask display in lists, and use consistent table formats.
Applied to files:
scripts/modules/task-manager/tag-management.js
📚 Learning: 2025-07-18T17:16:32.622Z
Learnt from: CR
PR: eyaltoledano/claude-task-master#0
File: .cursor/rules/ui.mdc:0-0
Timestamp: 2025-07-18T17:16:32.622Z
Learning: Applies to scripts/modules/ui.js : Use cli-table3 for table rendering, include colored bold headers, and set appropriate column widths for readability
Applied to files:
scripts/modules/task-manager/tag-management.js
🧬 Code graph analysis (1)
scripts/modules/task-manager/tag-management.js (1)
scripts/modules/task-manager/add-task.js (1)
table(570-577)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test
🔇 Additional comments (1)
scripts/modules/task-manager/tag-management.js (1)
641-645: LGTM! Table configuration meets PR objectives.The computed
colWidthsandwordWrap: truechanges successfully address the truncation issue. Tag names longer than 20 characters will now display fully with word wrapping enabled.
| let colWidths; | ||
| if (showMetadata) { | ||
| // With metadata: Tag Name, Tasks, Completed, Created, Description | ||
| const widths = [0.25, 0.1, 0.12, 0.15, 0.38]; | ||
| colWidths = widths.map((w, i) => | ||
| Math.max(Math.floor(usableWidth * w), i === 0 ? 15 : 8) | ||
| ); | ||
| } else { | ||
| // Without metadata: Tag Name, Tasks, Completed | ||
| const widths = [0.7, 0.15, 0.15]; | ||
| colWidths = widths.map((w, i) => | ||
| Math.max(Math.floor(usableWidth * w), i === 0 ? 20 : 10) | ||
| ); | ||
| } |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Consider redistributing remainder pixels to avoid rounding gaps.
The current implementation uses Math.floor independently on each column, which may leave 1-4 pixels of terminal width unused due to rounding. While this has minimal visual impact, you could add the remainder to the tag name column for perfect width utilization.
Apply this diff if you want to eliminate rounding gaps:
let colWidths;
if (showMetadata) {
// With metadata: Tag Name, Tasks, Completed, Created, Description
const widths = [0.25, 0.1, 0.12, 0.15, 0.38];
colWidths = widths.map((w, i) =>
Math.max(Math.floor(usableWidth * w), i === 0 ? 15 : 8)
);
+ // Add any remainder pixels to the tag name column
+ const remainder = usableWidth - colWidths.reduce((sum, w) => sum + w, 0);
+ colWidths[0] += remainder;
} else {
// Without metadata: Tag Name, Tasks, Completed
const widths = [0.7, 0.15, 0.15];
colWidths = widths.map((w, i) =>
Math.max(Math.floor(usableWidth * w), i === 0 ? 20 : 10)
);
+ // Add any remainder pixels to the tag name column
+ const remainder = usableWidth - colWidths.reduce((sum, w) => sum + w, 0);
+ colWidths[0] += remainder;
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| let colWidths; | |
| if (showMetadata) { | |
| // With metadata: Tag Name, Tasks, Completed, Created, Description | |
| const widths = [0.25, 0.1, 0.12, 0.15, 0.38]; | |
| colWidths = widths.map((w, i) => | |
| Math.max(Math.floor(usableWidth * w), i === 0 ? 15 : 8) | |
| ); | |
| } else { | |
| // Without metadata: Tag Name, Tasks, Completed | |
| const widths = [0.7, 0.15, 0.15]; | |
| colWidths = widths.map((w, i) => | |
| Math.max(Math.floor(usableWidth * w), i === 0 ? 20 : 10) | |
| ); | |
| } | |
| let colWidths; | |
| if (showMetadata) { | |
| // With metadata: Tag Name, Tasks, Completed, Created, Description | |
| const widths = [0.25, 0.1, 0.12, 0.15, 0.38]; | |
| colWidths = widths.map((w, i) => | |
| Math.max(Math.floor(usableWidth * w), i === 0 ? 15 : 8) | |
| ); | |
| // Add any remainder pixels to the tag name column | |
| const remainder = usableWidth - colWidths.reduce((sum, w) => sum + w, 0); | |
| colWidths[0] += remainder; | |
| } else { | |
| // Without metadata: Tag Name, Tasks, Completed | |
| const widths = [0.7, 0.15, 0.15]; | |
| colWidths = widths.map((w, i) => | |
| Math.max(Math.floor(usableWidth * w), i === 0 ? 20 : 10) | |
| ); | |
| // Add any remainder pixels to the tag name column | |
| const remainder = usableWidth - colWidths.reduce((sum, w) => sum + w, 0); | |
| colWidths[0] += remainder; | |
| } |
🤖 Prompt for AI Agents
In scripts/modules/task-manager/tag-management.js around lines 626 to 639, the
column width calculation floors each column independently which can leave a few
unused pixels; compute the floored widths as now, sum them, compute remainder =
usableWidth - sumFloored, and add the remainder to the first (tag name) column
width so total equals usableWidth while still enforcing the current minimums
(15/20 for first column, 8/10 for others); apply this adjustment in both the
showMetadata and the non-metadata branches.
…cation (eyaltoledano#1264) Co-authored-by: Ralph Khreish <Crunchyman-ralph@users.noreply.github.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Fixes #1263
Changes
Testing
Tag names longer than 20 characters should now display fully in the
task-master tagscommand output.Generated with Claude Code
Summary by CodeRabbit