tessl install tessl/npm-wrap-ansi@9.0.0Wordwrap 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%
Build a command-line utility that formats text output for terminal display with configurable column widths.
Create a text formatting utility that accepts terminal output (which may include colored text) and reformats it to fit within a specified column width. The utility should handle both plain text and styled terminal output correctly.
Your solution must:
The utility should accept:
Return the reformatted text as a string with:
@generates
/**
* Formats text to fit within specified column width
* @param {string} text - Input text (may contain ANSI codes)
* @param {number} columns - Target column width
* @returns {string} Formatted text with line breaks
*/
function formatText(text, columns) {
// Implementation here
}
module.exports = { formatText };Provides text wrapping with ANSI escape code support.