CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-wrap-ansi

tessl install tessl/npm-wrap-ansi@9.0.0

Wordwrap a string with ANSI escape codes

Agent Success

Agent success rate when using this tile

100%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.04x

Baseline

Agent success rate without this tile

96%

task.mdevals/scenario-3/

Rich Terminal Message Formatter

A terminal message formatting utility that wraps and displays mixed content including styled text, emoji, and clickable hyperlinks to fit within specified column widths.

Capabilities

Format status messages with mixed content

  • Given a message containing plain text, ANSI color codes, emoji, and hyperlinks, wrapping it to 50 columns preserves all formatting and clickability @test
  • When wrapping a colored hyperlink containing emoji at 40 columns, the link remains clickable across line breaks @test

Handle complex styling combinations

  • Given text with nested ANSI styling (bold red text with underline) and emoji, wrapping to 35 columns maintains all style attributes @test
  • When a styled hyperlink wraps across multiple lines at 45 columns, both the styling and link functionality are preserved on each line @test

Implementation

@generates

API

/**
 * Formats a terminal message by wrapping it to a specified column width
 * while preserving ANSI codes, emoji, and hyperlinks.
 *
 * @param {string} message - The message to format (may contain ANSI codes, emoji, hyperlinks)
 * @param {number} columns - The maximum column width for wrapping
 * @returns {string} The formatted message with preserved styling and functionality
 */
function formatMessage(message, columns) {
  // IMPLEMENTATION HERE
}

module.exports = { formatMessage };

Dependencies { .dependencies }

wrap-ansi { .dependency }

Provides text wrapping with ANSI escape code support.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/wrap-ansi@9.0.x
tile.json