@lewishowles/cli-style 0.13.0 → 0.14.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/CHANGELOG.md +16 -0
- package/README.md +66 -10
- package/adapters/python/cli_style/__init__.py +73 -0
- package/adapters/python/cli_style/_wrappers.py +503 -0
- package/adapters/python/cli_style/core.py +136 -0
- package/adapters/python/pyproject.toml +15 -0
- package/adapters/swift/Package.swift +16 -0
- package/adapters/swift/Sources/CliStyle/CliStyle.swift +223 -0
- package/adapters/swift/Sources/CliStyle/Wrappers.swift +582 -0
- package/package.json +4 -2
- package/scripts/build-binary.sh +15 -3
- package/scripts/generate-adapters.js +413 -0
- package/scripts/package-binary.sh +4 -1
- package/src/catalogue/renderer-catalogue.js +958 -52
- package/src/cli/adapter-path-command.js +3 -3
- package/src/cli/render-command.js +6 -0
- package/src/gallery/render-gallery.js +40 -0
- package/src/index.js +3 -0
- package/src/patterns/audit-finding.js +4 -4
- package/src/patterns/command-result.js +2 -2
- package/src/patterns/diagnostic-report.js +6 -3
- package/src/patterns/helpers.js +11 -4
- package/src/patterns/next-step-block.js +2 -4
- package/src/patterns/task-summary.js +4 -4
- package/src/primitives/bullet-list.js +150 -0
- package/src/theme/bullets.js +41 -0
- package/adapters/python/cli_style.py +0 -428
- package/adapters/swift/CliStyle.swift +0 -482
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.14.0 - 2026-09-20
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added a `bulletList()` renderer (`bullet-list` for `cli-style render`) for simple bulleted lists. Section lists in the patterns layer now render through it, with unchanged output.
|
|
10
|
+
- Added a `bullet_list` wrapper to the Python adapter.
|
|
11
|
+
- The renderer catalogue now describes each renderer's parameters with their types, and the full input contract each renderer accepts, so adapters and agents can work out how to call a renderer without reading the source.
|
|
12
|
+
- The Python adapter's wrappers are now generated from the renderer catalogue, so they stay in step with the renderers they wrap.
|
|
13
|
+
- The Swift adapter now ships as a Swift package with generated wrappers, exposing a `CliStyle` product.
|
|
14
|
+
- The Bash, Python, and Swift adapters now fall back to plain text when the `cli-style` binary is not on `PATH`, instead of failing.
|
|
15
|
+
- `bun run check:adapters` now fails when the generated adapter wrappers are out of date with the renderer catalogue.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- The published package now includes the Python and Swift adapter packages, which were missing from the build.
|
|
20
|
+
|
|
5
21
|
## 0.13.0 - 2026-09-05
|
|
6
22
|
|
|
7
23
|
### Added
|
package/README.md
CHANGED
|
@@ -17,7 +17,21 @@ JavaScript projects can install the package directly:
|
|
|
17
17
|
bun add @lewishowles/cli-style
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Python projects can install the adapter from a local path with `uv`:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
uv add --editable ../cli-style/adapters/python
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
They can also install it from this repository:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
uv add "cli-style @ git+https://github.com/lewishowles/cli-style.git#subdirectory=adapters/python"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Swift projects can add `adapters/swift` as a local package dependency and use its `CliStyle` product.
|
|
33
|
+
|
|
34
|
+
The Bash, Python, and Swift adapters all call the `cli-style` binary. If your project already uses Node or Bun, add this package as a dev dependency and use its binary. Otherwise, put the standalone binary on `PATH`:
|
|
21
35
|
|
|
22
36
|
```bash
|
|
23
37
|
export PATH="/path/to/cli-style/bin:$PATH"
|
|
@@ -139,11 +153,7 @@ JSON
|
|
|
139
153
|
|
|
140
154
|
### Python
|
|
141
155
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
export PYTHONPATH="$(cli-style adapter-path python):$PYTHONPATH"
|
|
146
|
-
```
|
|
156
|
+
Install the package as described in [Install](#install), then import the generic `render()` helper or convenience functions:
|
|
147
157
|
|
|
148
158
|
```python
|
|
149
159
|
from cli_style import status, row, span, hint, divider
|
|
@@ -179,11 +189,23 @@ print(output)
|
|
|
179
189
|
|
|
180
190
|
### Swift
|
|
181
191
|
|
|
182
|
-
Add
|
|
192
|
+
Add `adapters/swift` as a local Swift package dependency, then add its `CliStyle` product to your target. Use the `CliStyle` enum for convenience functions or the generic `render` method:
|
|
183
193
|
|
|
184
194
|
```bash
|
|
185
195
|
cli-style adapter-path swift
|
|
186
|
-
# Returns the path to
|
|
196
|
+
# Returns the path to the adapters/swift package directory
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
```swift
|
|
200
|
+
dependencies: [
|
|
201
|
+
.package(path: "../cli-style/adapters/swift"),
|
|
202
|
+
],
|
|
203
|
+
targets: [
|
|
204
|
+
.target(
|
|
205
|
+
name: "YourTarget",
|
|
206
|
+
dependencies: [.product(name: "CliStyle", package: "CliStyle")]
|
|
207
|
+
),
|
|
208
|
+
]
|
|
187
209
|
```
|
|
188
210
|
|
|
189
211
|
```swift
|
|
@@ -227,7 +249,8 @@ Renderer names are stable for `cli-style render`, `cli_style_render`, and Python
|
|
|
227
249
|
| --------------------- | ------------------------------------- | ------------------------------------ | ---------------------------------- | -------------------------------------- | --------------------------------------------------------------- |
|
|
228
250
|
| `status` | `status(resultType, detail, options)` | `cli_style_status type label detail` | `status(type, label, detail)` | `CliStyle.status(type, label, detail)` | Result line with symbol, label, and detail. |
|
|
229
251
|
| `row` | `row(label, value, options)` | `cli_style_row label value [result]` | `row(label, value, result)` | `CliStyle.row(label, value, result)` | Aligned label/value row, optionally marked with a result state. |
|
|
230
|
-
| `row-group` | `rowGroup(options)` | Use `cli_style_render` |
|
|
252
|
+
| `row-group` | `rowGroup(options)` | Use `cli_style_render` | `row_group(rows)` | Use `CliStyle.render` | Auto-aligned group of labelled value rows. |
|
|
253
|
+
| `bullet-list` | `bulletList(items, options)` | Use `cli_style_render` | `bullet_list(items)` | Use `CliStyle.render` | Wrapped flat or nested bullet items. |
|
|
231
254
|
| `span` | `span(value, tone, options)` | `cli_style_span value [tone]` | `span(value, tone)` | `CliStyle.span(value, tone)` | Inline colour or weight for a word, command, file, or value. |
|
|
232
255
|
| `hint` | `hint(message, options)` | `cli_style_hint message` | `hint(message)` | `CliStyle.hint(message)` | Informational hint line. |
|
|
233
256
|
| `divider` | `divider(options)` | `cli_style_divider label` | `divider(label)` | `CliStyle.divider(label)` | Section divider with an optional label. |
|
|
@@ -238,7 +261,7 @@ Renderer names are stable for `cli-style render`, `cli_style_render`, and Python
|
|
|
238
261
|
| `next-step-block` | `nextStepBlock(options)` | `cli_style_next_step_block ...` | `next_step_block(...)` | `CliStyle.nextStepBlock(...)` | Next-step guidance with command and alternative. |
|
|
239
262
|
| `chip` | `chip(label, tone, options)` | Use `cli_style_render` | Use `render("chip", ...)` | Use `CliStyle.render` | Compact labelled state. |
|
|
240
263
|
| `panel` | `panel(options)` | Use `cli_style_render` | Use `render("panel", ...)` | Use `CliStyle.render` | Framed content block for grouped output. |
|
|
241
|
-
| `table` | `table(options)` | Use `cli_style_render` |
|
|
264
|
+
| `table` | `table(options)` | Use `cli_style_render` | `table(columns, rows)` | Use `CliStyle.render` | Tabular records with narrow-width fallback. |
|
|
242
265
|
| `progress-bar` | `progressBar(options)` | Use `cli_style_render` | Use `render("progress-bar", ...)` | Use `CliStyle.render` | Single progress value with numeric text. |
|
|
243
266
|
| `bar-chart` | `barChart(options)` | Use `cli_style_render` | Use `render("bar-chart", ...)` | Use `CliStyle.render` | Multi-row bar chart. |
|
|
244
267
|
| `sparkline` | `sparkline(options)` | Use `cli_style_render` | Use `render("sparkline", ...)` | Use `CliStyle.render` | Compact trend with latest, minimum, and maximum values. |
|
|
@@ -306,6 +329,29 @@ Use these shapes with `cli-style render`, `cli_style_render`, or Python `render(
|
|
|
306
329
|
- `labelWidth`: optional minimum width for every label
|
|
307
330
|
- Per-row fields match `row`, including `label`, `value`, `result`, `labelColour`, `valueColour`, and `separator`
|
|
308
331
|
|
|
332
|
+
### `bullet-list`
|
|
333
|
+
|
|
334
|
+
Pass strings for flat lists, or objects with `text` and an optional nested `items` array. Text wraps to the available width and continuation lines align with the item text:
|
|
335
|
+
|
|
336
|
+
```js
|
|
337
|
+
bulletList(
|
|
338
|
+
[
|
|
339
|
+
"Install dependencies",
|
|
340
|
+
{
|
|
341
|
+
text: "Run checks",
|
|
342
|
+
items: ["Review failures", "Repeat the focused check"],
|
|
343
|
+
},
|
|
344
|
+
],
|
|
345
|
+
{ width: 48 },
|
|
346
|
+
);
|
|
347
|
+
// • Install dependencies
|
|
348
|
+
// • Run checks
|
|
349
|
+
// ◦ Review failures
|
|
350
|
+
// ◦ Repeat the focused check
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
Use `profile: "agent"` for Markdown-compatible `-` bullets, or `unicode: false` for `*` bullets.
|
|
354
|
+
|
|
309
355
|
### `span`
|
|
310
356
|
|
|
311
357
|
```json
|
|
@@ -721,3 +767,13 @@ cli-style gallery --dark --section primitives
|
|
|
721
767
|
```
|
|
722
768
|
|
|
723
769
|
Use `--interactive` to select a section or fixture with `fzf` when it is installed.
|
|
770
|
+
|
|
771
|
+
## Generated adapter wrappers
|
|
772
|
+
|
|
773
|
+
Named wrapper functions in the Python and Swift adapters are generated from `src/catalogue/renderer-catalogue.js` by `bun run generate:adapters`. Do not edit `adapters/python/cli_style/_wrappers.py` or `adapters/swift/Sources/CliStyle/Wrappers.swift` by hand. After changing the catalogue, run:
|
|
774
|
+
|
|
775
|
+
```bash
|
|
776
|
+
bun run generate:adapters
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
`bun run check` runs `check:adapters`, which fails when the committed wrappers are stale.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""Public Python API for the cli-style adapter."""
|
|
2
|
+
|
|
3
|
+
from ._wrappers import (
|
|
4
|
+
agent_transcript,
|
|
5
|
+
audit_finding,
|
|
6
|
+
bar_chart,
|
|
7
|
+
bullet_list,
|
|
8
|
+
chip,
|
|
9
|
+
command_result,
|
|
10
|
+
compact_data_table,
|
|
11
|
+
confirmation_result,
|
|
12
|
+
diagnostic_report,
|
|
13
|
+
diff_block,
|
|
14
|
+
divider,
|
|
15
|
+
empty_state,
|
|
16
|
+
error_block,
|
|
17
|
+
hint,
|
|
18
|
+
labelled_line,
|
|
19
|
+
next_step_block,
|
|
20
|
+
panel,
|
|
21
|
+
progress_bar,
|
|
22
|
+
row,
|
|
23
|
+
row_group,
|
|
24
|
+
sparkline,
|
|
25
|
+
span,
|
|
26
|
+
status,
|
|
27
|
+
step,
|
|
28
|
+
step_progress,
|
|
29
|
+
table,
|
|
30
|
+
task_summary,
|
|
31
|
+
)
|
|
32
|
+
from .core import (
|
|
33
|
+
CliStyleError,
|
|
34
|
+
CliStyleNotFoundError,
|
|
35
|
+
CliStyleRenderError,
|
|
36
|
+
render,
|
|
37
|
+
resolve_binary,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
"CliStyleError",
|
|
42
|
+
"CliStyleNotFoundError",
|
|
43
|
+
"CliStyleRenderError",
|
|
44
|
+
"agent_transcript",
|
|
45
|
+
"audit_finding",
|
|
46
|
+
"bar_chart",
|
|
47
|
+
"bullet_list",
|
|
48
|
+
"chip",
|
|
49
|
+
"command_result",
|
|
50
|
+
"compact_data_table",
|
|
51
|
+
"confirmation_result",
|
|
52
|
+
"diagnostic_report",
|
|
53
|
+
"diff_block",
|
|
54
|
+
"divider",
|
|
55
|
+
"empty_state",
|
|
56
|
+
"error_block",
|
|
57
|
+
"hint",
|
|
58
|
+
"labelled_line",
|
|
59
|
+
"next_step_block",
|
|
60
|
+
"panel",
|
|
61
|
+
"progress_bar",
|
|
62
|
+
"render",
|
|
63
|
+
"resolve_binary",
|
|
64
|
+
"row",
|
|
65
|
+
"row_group",
|
|
66
|
+
"sparkline",
|
|
67
|
+
"span",
|
|
68
|
+
"status",
|
|
69
|
+
"step",
|
|
70
|
+
"step_progress",
|
|
71
|
+
"table",
|
|
72
|
+
"task_summary",
|
|
73
|
+
]
|