tty-table 6.0.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -4
- package/dist/browser/tty-table.global.js +379 -3612
- package/dist/browser/tty-table.global.js.map +1 -1
- package/dist/browser.js +183 -352
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +181 -350
- package/dist/browser.mjs.map +1 -1
- package/dist/cli.js +215 -386
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +213 -384
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +183 -352
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +181 -350
- package/dist/index.mjs.map +1 -1
- package/dist/mcp.d.mts +54 -0
- package/dist/mcp.d.ts +54 -0
- package/dist/mcp.js +937 -0
- package/dist/mcp.js.map +1 -0
- package/dist/mcp.mjs +929 -0
- package/dist/mcp.mjs.map +1 -0
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -33,6 +33,61 @@ $ node examples/data/fake-stream.js | tty-table --format json --header examples/
|
|
|
33
33
|
$ tty-table -h
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
### MCP server
|
|
37
|
+
|
|
38
|
+
Expose tty-table to MCP clients (Claude, IDE agents, Cursor, etc.) over stdio.
|
|
39
|
+
|
|
40
|
+
#### Client configuration
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"mcpServers": {
|
|
45
|
+
"tty-table": {
|
|
46
|
+
"command": "npx",
|
|
47
|
+
"args": ["-y", "--package=tty-table", "tty-table-mcp"]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### Tools
|
|
54
|
+
|
|
55
|
+
| Tool | Description |
|
|
56
|
+
|------|-------------|
|
|
57
|
+
| `render_table` | Render data as an ASCII/Unicode terminal table. Accepts `header`, `rows`, and any tty-table `options`; returns the rendered table as text. |
|
|
58
|
+
|
|
59
|
+
**Arguments for `render_table`:**
|
|
60
|
+
|
|
61
|
+
| Name | Type | Required | Description |
|
|
62
|
+
|------|------|----------|-------------|
|
|
63
|
+
| `header` | `(string \| {value, align?, width?})[]` | no | Column definitions |
|
|
64
|
+
| `rows` | `(unknown[] \| Record<string, unknown>)[]` | yes | Row data (arrays of cells, or objects keyed by column name) |
|
|
65
|
+
| `options` | `object` | no | Any tty-table option (e.g. `width`, `borderStyle`, `align`, `compact`) |
|
|
66
|
+
|
|
67
|
+
Example tool call:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"header": [{ "value": "name" }, { "value": "score", "align": "right" }],
|
|
72
|
+
"rows": [["Ada", 100], ["Grace", 98]],
|
|
73
|
+
"options": { "width": 40 }
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Rendered result:
|
|
78
|
+
|
|
79
|
+
```text
|
|
80
|
+
┌───────┬───────┐
|
|
81
|
+
│ name │ score │
|
|
82
|
+
├───────┼───────┤
|
|
83
|
+
│ Ada │ 100 │
|
|
84
|
+
├───────┼───────┤
|
|
85
|
+
│ Grace │ 98 │
|
|
86
|
+
└───────┴───────┘
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
> Additional tools may be added in future releases under the same MCP server.
|
|
90
|
+
|
|
36
91
|
### Browser & Browser Console
|
|
37
92
|
|
|
38
93
|
- View in Chrome or Chromium at [http://localhost:8070/examples/browser-example.html](http://localhost:8070/examples/browser-example.html) using a dockerized apache instance:
|
|
@@ -57,7 +112,7 @@ $ tty-table -h
|
|
|
57
112
|
- ANSI-safe display-width calculation and Unicode-aware wrapping/truncation.
|
|
58
113
|
- Typed column/table options and formatter context.
|
|
59
114
|
- ESM and CommonJS package exports.
|
|
60
|
-
- Modern Node.js LTS baseline (Node 20+).
|
|
115
|
+
- Modern Node.js LTS baseline (Node 22+; raised from 20+ when adopting smartwrap v4).
|
|
61
116
|
- A standalone browser bundle is produced for direct use from a browser console or `<script>` tag.
|
|
62
117
|
- Legacy `Table(header, rows, footer, options)` and `Table(rows, options)` construction remains supported.
|
|
63
118
|
|
|
@@ -65,9 +120,9 @@ $ tty-table -h
|
|
|
65
120
|
|
|
66
121
|
### Node.js
|
|
67
122
|
|
|
68
|
-
**
|
|
123
|
+
**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.
|
|
69
124
|
|
|
70
|
-
The published package provides both ESM and CommonJS entry points for Node.js. The CLI requires Node.js
|
|
125
|
+
The published package provides both ESM and CommonJS entry points for Node.js. The CLI requires Node.js 22+ as well.
|
|
71
126
|
|
|
72
127
|
## API
|
|
73
128
|
|
|
@@ -98,7 +153,9 @@ The compatibility callback signature is still accepted. New integrations should
|
|
|
98
153
|
|
|
99
154
|
### Width semantics
|
|
100
155
|
|
|
101
|
-
Widths are measured in terminal display columns, not JavaScript string length. ANSI escape sequences are ignored for measurement;
|
|
156
|
+
Widths 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.
|
|
157
|
+
|
|
158
|
+
Compared 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.
|
|
102
159
|
|
|
103
160
|
## Development
|
|
104
161
|
|