{"name":"tty-table","version":"7.0.0","keywords":["table","cli-table","terminal table","console table","ascii table"],"author":{"name":"Tecfu"},"license":"MIT","_id":"tty-table@7.0.0","maintainers":[{"name":"tecfu","email":"help@tecfu.com"}],"homepage":"https://github.com/tecfu/tty-table","bugs":{"url":"https://github.com/tecfu/tty-table/issues"},"bin":{"tty-table":"adapters/terminal-adapter.js","tty-table-mcp":"dist/mcp.js"},"dist":{"shasum":"eb7b080c7276472f0743259803d0c5a987c9eb64","tarball":"http://registry-npm.ywwl.com/tty-table/download/tty-table-7.0.0.tgz","fileCount":34,"integrity":"sha512-EC62dGKWusWVAbD/F1bH79IcYWEas2WenEJkImpjVLd3iw1q1kiY4JbnfRfxEgMmqJ7bQPuzl+/LfjlyDv0a0A==","signatures":[{"sig":"MEQCIE7JpB/roocPETDVPj8x8a+qN7ZqaLsF1bKzXSSzS2MlAiAIOLkBzuTwdKIIsUlsyuSaGXT+4CBm6Cnrn8M6UH+F4A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQCw0euapbohXxk7Xrr8bABDiTGvin6NtHbypYA+rNdGUgIhAJ4ZKigz3PlH0D6tLvKAFZuLqNm5mfGlnt2PkNfWltJ2","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":850440,"size":191198,"noattachment":false,"key":"/tty-table/-/tty-table-7.0.0.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","browser":"dist/browser/tty-table.global.js","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"b68d2ba9eb243241f2c3e64f5075114326827779","scripts":{"lint":"eslint .","test":"npx mocha","build":"tsup && tsup --config tsup.browser.config.ts","lint:fix":"eslint . --fix","test:unit":"vitest run","typecheck":"tsc --noEmit","save-tests":"node npm_scripts/run-examples.js save","test:watch":"vitest","view-examples":"node npm_scripts/run-examples.js view","prepublishOnly":"npm run typecheck && npm run build && npm test && npm run test:unit"},"_npmUser":{"name":"tecfu","email":"help@tecfu.com"},"repository":{"url":"git+https://github.com/tecfu/tty-table.git","type":"git"},"_npmVersion":"11.19.0","description":"Typed terminal table renderer for Node.js and browsers","directories":{},"_nodeVersion":"26.8.1","dependencies":{"csv":"^6.3.11","zod":"^4.6.5","chalk":"^4.1.2","kleur":"^4.1.5","yargs":"^17.7.2","breakword":"^2.1.0","smartwrap":"^4.0.0","strip-ansi":"^6.0.1","@modelcontextprotocol/sdk":"^1.30.0"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.5.0","glob":"^13.0.6","tsup":"^8.5.0","mocha":"^12.0.0","eslint":"^9.30.0","vitest":"^4.1.11","commander":"^4.1.1","@eslint/js":"^9.30.0","typescript":"^5.8.3","@types/node":"^22.15.0","@types/yargs":"^17.0.33","typescript-eslint":"^8.35.0"},"defaultTestColumns":90,"_npmOperationalInternal":{"tmp":"tmp/tty-table_7.0.0_1789947308513_0.9390246273840188","host":"s3://npm-registry-packages-npm-production"},"readme":"# tty-table\n\nA TypeScript-first terminal table renderer with a compatibility-oriented factory API.\n\n## [Examples](examples/)\n\n[See here for complete example list](examples/)\n\n\nTo view all example output:\n\n```sh\n$ git clone https://github.com/tecfu/tty-table && cd tty-table && npm i\n$ npm run view-examples\n```\n\n### Terminal (Static)\n\n[examples/styles-and-formatting.js](examples/styles-and-formatting.js)\n\n![Static](https://cloud.githubusercontent.com/assets/7478359/15691679/07142030-273f-11e6-8f1e-25728d558a2d.png \"Static Example\") \n\n### Terminal (Streaming)\n\n```\n$ node examples/data/fake-stream.js | tty-table --format json --header examples/config/header.js\n```\n\n![Streaming](https://user-images.githubusercontent.com/7478359/51738817-47c25700-204d-11e9-9df1-04e478331658.gif \"tty-table streaming example\") \n\n- See the built-in help for the terminal version of tty-table with: \n```\n$ tty-table -h\n```\n\n### MCP server\n\nExpose tty-table to MCP clients (Claude, IDE agents, Cursor, etc.) over stdio.\n\n#### Client configuration\n\n```json\n{\n  \"mcpServers\": {\n    \"tty-table\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"--package=tty-table\", \"tty-table-mcp\"]\n    }\n  }\n}\n```\n\n#### Tools\n\n| Tool | Description |\n|------|-------------|\n| `render_table` | Render data as an ASCII/Unicode terminal table. Accepts `header`, `rows`, and any tty-table `options`; returns the rendered table as text. |\n\n**Arguments for `render_table`:**\n\n| Name | Type | Required | Description |\n|------|------|----------|-------------|\n| `header` | `(string \\| {value, align?, width?})[]` | no | Column definitions |\n| `rows` | `(unknown[] \\| Record<string, unknown>)[]` | yes | Row data (arrays of cells, or objects keyed by column name) |\n| `options` | `object` | no | Any tty-table option (e.g. `width`, `borderStyle`, `align`, `compact`) |\n\nExample tool call:\n\n```json\n{\n  \"header\": [{ \"value\": \"name\" }, { \"value\": \"score\", \"align\": \"right\" }],\n  \"rows\": [[\"Ada\", 100], [\"Grace\", 98]],\n  \"options\": { \"width\": 40 }\n}\n```\n\nRendered result:\n\n```text\n  ┌───────┬───────┐\n  │ name  │ score │\n  ├───────┼───────┤\n  │  Ada  │   100 │\n  ├───────┼───────┤\n  │ Grace │    98 │\n  └───────┴───────┘\n```\n\n> Additional tools may be added in future releases under the same MCP server.\n\n### Browser & Browser Console\n\nThe published package ships a standalone IIFE bundle that exposes a `TtyTable` global. Load it directly from a CDN — no install or build step required:\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/tty-table@7/dist/browser/tty-table.global.js\"></script>\n<script>\n  const Table = TtyTable.default\n  console.log(Table([{ value: \"name\" }, { value: \"score\" }], [[\"Ada\", 100]], null).render())\n</script>\n```\n\n- Try it online before installing: [live example on JSFiddle](https://jsfiddle.net/u9dqv14j/)\n- View the full example locally in Chrome or Chromium by opening [examples/browser-example.html](examples/browser-example.html) (e.g. served with `npx serve .` or any static file server).\n- [source: examples/browser-example.html](examples/browser-example.html)\n\n![Browser Console Example](https://user-images.githubusercontent.com/7478359/74614563-cbcaff00-50e6-11ea-9101-5457497696b8.jpg \"tty-table in the browser console\") \n\n<br/>\n<br/>\n\n## Compatibility\n\n### Node.js\n\n**Current releases require Node.js 22 or newer.** This is a breaking change from the Node 20 baseline used by early v6 releases (and from the v5 line, which supported older Node.js releases). The floor was raised to match `smartwrap@4` / `breakword@2.1.0`. If your application must remain on Node 20, stay on a prior tty-table release until you can upgrade.\n\nThe published package provides both ESM and CommonJS entry points for Node.js. The CLI requires Node.js 22+ as well.\n\n## API\n\n```ts\nimport Table from \"tty-table\"\n\nconst table = Table(\n  [{ value: \"name\" }, { value: \"score\", align: \"right\" }],\n  [\n    { name: \"Ada\", score: 100 },\n    { name: \"Grace\", score: 98 }\n  ],\n  { borderStyle: \"solid\" }\n)\n\nconsole.log(table.render())\n```\n\nLegacy `Table(header, rows, footer, options)` and `Table(rows, options)` construction remains supported.\n\n### Formatter context\n\nNew code can use the explicit context form:\n\n```ts\nconst formatter = (value: unknown) => String(value).toUpperCase()\n```\n\nThe compatibility callback signature is still accepted. New integrations should prefer a formatter that accepts the documented context object and avoid relying on dynamic `this` mutation.\n\n### Width semantics\n\nWidths are measured in terminal display columns, not JavaScript string length. ANSI escape sequences are ignored for measurement; Unicode code points are counted using [`breakword.width()`](https://github.com/tecfu/breakword) (Unicode 18.0.0 East Asian Width + UAX #51 Emoji_Presentation). Wrapping and truncation operate on the same display-width semantics.\n\nCompared with older releases that used `wcwidth`, some symbols that were previously treated as 1 cell are now 2 cells (for example `⚡` U+26A1). Tables containing those characters may reflow slightly; measurement is now aligned with the same library used for wrapping.\n\n## Development\n\n```sh\nnpm install\nnpm run typecheck\nnpm run build\nnpm test\nnpm run test:unit\nnpm run lint\n```\n","publish_time":1789947308599,"_cnpm_publish_time":1789947308599,"dist-tags":{"latest":"7.2.1"}}