boxen bordered terminal box: working versions (tested 2026-10-16)
Render a terminal box with boxen using a border style, padding, margin, title and dimmed border, asserting expected text and box drawing characters at a forced width offline.
passed3 passed · 0 failed2026-10-16 15:20 UTC- Status
- passed
- Last passed
- 2026-10-16 15:20 UTC
- Tests
- 3 / 3
- Language
- TypeScript
- Runtime
- node v22.23.3
pinned versions3
boxen@9.0.0@types/node@26.6.5tsx@4.23.15
run it
npm install --no-audit --no-fund --ignore-scripts=false npm test
test environment
node v22.23.3 linux 6.17.0-1022-azure x64 runner: github-actions 38923127324
The code
Exactly the files that passed. Your agent can pull them with get_recipe("boxen-terminal-box") (install), or see them on GitHub.
package.json
{
"name": "boxen-terminal-box",
"private": true,
"type": "module",
"scripts": {
"test": "node --import tsx --test test/*.test.ts"
},
"dependencies": {
"boxen": "9.0.0"
},
"devDependencies": {
"@types/node": "26.6.5",
"tsx": "4.23.15"
}
}
src/box.ts
import boxen from "boxen";
export type BoxOptions = NonNullable<Parameters<typeof boxen>[1]>;
export function renderTerminalBox(text: string, options: BoxOptions = {}): string {
return boxen(text, {
borderStyle: "round",
padding: 1,
margin: 1,
title: "status",
dimBorder: true,
...options,
});
}
test/box.test.ts
import { test } from "node:test";
import assert from "node:assert/strict";
import { renderTerminalBox } from "../src/box.ts";
const stripAnsi = (value: string) => value.replace(/\u001B\[[0-9;]*m/g, "");
test("wraps text with box drawing characters", () => {
const output = stripAnsi(renderTerminalBox("hello world"));
assert.ok(output.includes("hello world"));
assert.ok(output.includes("╭"));
assert.ok(output.includes("╮"));
assert.ok(output.includes("╰"));
assert.ok(output.includes("╯"));
assert.ok(output.includes("─"));
assert.ok(output.includes("│"));
});
test("includes the configured title and dimmed border", () => {
const output = stripAnsi(renderTerminalBox("deploy", { title: "build", dimBorder: true }));
assert.ok(output.includes("build"));
assert.ok(output.includes("deploy"));
});
test("forces the box to a fixed width", () => {
const output = stripAnsi(renderTerminalBox("hi", { width: 24, margin: 0 }));
const lines = output.split("\n").filter((line) => line.length > 0);
assert.ok(lines.length >= 3);
for (const line of lines) {
assert.equal([...line].length, 24, "unexpected width for line: " + JSON.stringify(line));
}
});
Connect to ProvenPin
Add the free MCP server so your agent can pull this recipe and others like it. Same setup as the docs.
terminal
claude mcp add --transport http provenpin https://mcp.provenpin.com/mcp
~/.cursor/mcp.json
{ "mcpServers": { "provenpin": { "url": "https://mcp.provenpin.com/mcp" } } }.vscode/mcp.json
{ "servers": { "provenpin": { "type": "http", "url": "https://mcp.provenpin.com/mcp" } } }~/.codeium/windsurf/mcp_config.json
{ "mcpServers": { "provenpin": { "serverUrl": "https://mcp.provenpin.com/mcp" } } }MCP settings
{ "mcpServers": { "provenpin": { "type": "streamableHttp", "url": "https://mcp.provenpin.com/mcp" } } }Any other MCP client: Streamable HTTP at https://mcp.provenpin.com/mcp. No API key, no signup.