Skip to content

Kanban board: remove --width from skill template, fix terminal width auto-detection #10

@erudenko

Description

@erudenko

Summary

The kanban board skill template (commands/board.md) manually passes --width $(tput cols) to kanban-display.ts. This is redundant — the display tool already auto-detects terminal width via process.stdout.columns and $COLUMNS env var (in lib/table.ts:termW()). The --width override should be removed from the skill template.

Problem

  1. Redundant --width flag in skill template — The board.md command template includes:

    TERM_WIDTH=$(tput cols 2>/dev/null || echo 80)
    bun run .../kanban-display.ts board ... --width "$TERM_WIDTH"

    But kanban-display.ts already calls termW() which checks process.stdout.columns$COLUMNS → defaults to 80. The manual tput cols is doing the same work.

  2. When run from Claude Code's Bash tool, process.stdout is not a TTY, so process.stdout.columns is undefined. The tool falls back to $COLUMNS or 80. The tput cols workaround compensates, but the real fix should be in the tool itself.

  3. Width mismatch causes rendering issues — When the passed width doesn't match the actual display context (e.g., Claude Code output stream, headless tmux panes, piped output), the board draws cards and banners that wrap or clip incorrectly.

Proposed Fix

In kanban-display.ts (or lib/table.ts:termW()):

  • Add $COLUMNS detection earlier in the chain (already done ✓)
  • When invoked from a non-TTY context, try to inherit $COLUMNS from the parent shell
  • Consider a slightly wider default (e.g., 100) for non-TTY contexts, since most terminals today are wider than 80

In commands/board.md:

  • Remove the TERM_WIDTH and --width lines from the bash template
  • Let the display tool handle its own width detection
  • If a workaround is still needed for non-TTY, set COLUMNS env var instead:
    COLUMNS=$(tput cols 2>/dev/null || echo 80) bun run .../kanban-display.ts board ...
    This is cleaner because termW() already reads $COLUMNS.

Environment

  • Plugin: kanban 1.2.0
  • File: tools/kanban-display.ts lines 58-62, 914, 924-935
  • File: commands/board.md
  • File: lib/table.ts line 58-62

Related

The termW() function in lib/table.ts:

export function termW(): number {
  return process.stdout.columns
    || (process.env.COLUMNS ? parseInt(process.env.COLUMNS) : 0)
    || 80;
}

This already supports $COLUMNS — the skill template just needs to export it instead of using --width.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions