@lewishowles/cli-style 0.13.0 → 0.15.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 CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.15.0 - 2026-09-20
6
+
7
+ ### Added
8
+
9
+ - The Python adapter is published to PyPI as `lewishowles-cli-style`, so Python projects can install it with `pip install lewishowles-cli-style` instead of from a local path or this repository. The name it is imported under is unchanged: `import cli_style`.
10
+ - `bun run check:adapters` now fails when `package.json` and the Python package declare different versions, or when the Python package's copy of the licence differs from the one at the repository root.
11
+ - Releasing a tag whose version does not match `package.json` now fails before anything is published.
12
+
13
+ ## 0.14.0 - 2026-09-20
14
+
15
+ ### Added
16
+
17
+ - 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.
18
+ - Added a `bullet_list` wrapper to the Python adapter.
19
+ - 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.
20
+ - The Python adapter's wrappers are now generated from the renderer catalogue, so they stay in step with the renderers they wrap.
21
+ - The Swift adapter now ships as a Swift package with generated wrappers, exposing a `CliStyle` product.
22
+ - The Bash, Python, and Swift adapters now fall back to plain text when the `cli-style` binary is not on `PATH`, instead of failing.
23
+ - `bun run check:adapters` now fails when the generated adapter wrappers are out of date with the renderer catalogue.
24
+
25
+ ### Fixed
26
+
27
+ - The published package now includes the Python and Swift adapter packages, which were missing from the build.
28
+
5
29
  ## 0.13.0 - 2026-09-05
6
30
 
7
31
  ### Added
package/README.md CHANGED
@@ -17,7 +17,27 @@ JavaScript projects can install the package directly:
17
17
  bun add @lewishowles/cli-style
18
18
  ```
19
19
 
20
- Bash, Python, and Swift projects call the `cli-style` binary through thin adapters. If the project already has Node or Bun tooling, add this package as a dev dependency and use the package binary. Otherwise, install or vendor the standalone binary and put it on `PATH`:
20
+ Python projects can install the published package from PyPI:
21
+
22
+ ```bash
23
+ pip install lewishowles-cli-style
24
+ ```
25
+
26
+ They can also install the adapter from a local path with `uv`:
27
+
28
+ ```bash
29
+ uv add --editable ../cli-style/adapters/python
30
+ ```
31
+
32
+ Or install it straight from this repository:
33
+
34
+ ```bash
35
+ uv add "lewishowles-cli-style @ git+https://github.com/lewishowles/cli-style.git#subdirectory=adapters/python"
36
+ ```
37
+
38
+ Swift projects can add `adapters/swift` as a local package dependency and use its `CliStyle` product.
39
+
40
+ 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
41
 
22
42
  ```bash
23
43
  export PATH="/path/to/cli-style/bin:$PATH"
@@ -139,11 +159,7 @@ JSON
139
159
 
140
160
  ### Python
141
161
 
142
- Add the adapter directory to `PYTHONPATH`, then import the generic `render()` helper or convenience functions:
143
-
144
- ```bash
145
- export PYTHONPATH="$(cli-style adapter-path python):$PYTHONPATH"
146
- ```
162
+ Install the package as described in [Install](#install), then import the generic `render()` helper or convenience functions:
147
163
 
148
164
  ```python
149
165
  from cli_style import status, row, span, hint, divider
@@ -179,11 +195,23 @@ print(output)
179
195
 
180
196
  ### Swift
181
197
 
182
- Add the adapter file to your Swift project, then use the `CliStyle` enum for convenience functions or the generic `render` method:
198
+ 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
199
 
184
200
  ```bash
185
201
  cli-style adapter-path swift
186
- # Returns the path to CliStyle.swift for inclusion in your project
202
+ # Returns the path to the adapters/swift package directory
203
+ ```
204
+
205
+ ```swift
206
+ dependencies: [
207
+ .package(path: "../cli-style/adapters/swift"),
208
+ ],
209
+ targets: [
210
+ .target(
211
+ name: "YourTarget",
212
+ dependencies: [.product(name: "CliStyle", package: "CliStyle")]
213
+ ),
214
+ ]
187
215
  ```
188
216
 
189
217
  ```swift
@@ -227,7 +255,8 @@ Renderer names are stable for `cli-style render`, `cli_style_render`, and Python
227
255
  | --------------------- | ------------------------------------- | ------------------------------------ | ---------------------------------- | -------------------------------------- | --------------------------------------------------------------- |
228
256
  | `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
257
  | `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` | Use `render("row-group", ...)` | Use `CliStyle.render` | Auto-aligned group of labelled value rows. |
258
+ | `row-group` | `rowGroup(options)` | Use `cli_style_render` | `row_group(rows)` | Use `CliStyle.render` | Auto-aligned group of labelled value rows. |
259
+ | `bullet-list` | `bulletList(items, options)` | Use `cli_style_render` | `bullet_list(items)` | Use `CliStyle.render` | Wrapped flat or nested bullet items. |
231
260
  | `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
261
  | `hint` | `hint(message, options)` | `cli_style_hint message` | `hint(message)` | `CliStyle.hint(message)` | Informational hint line. |
233
262
  | `divider` | `divider(options)` | `cli_style_divider label` | `divider(label)` | `CliStyle.divider(label)` | Section divider with an optional label. |
@@ -238,7 +267,7 @@ Renderer names are stable for `cli-style render`, `cli_style_render`, and Python
238
267
  | `next-step-block` | `nextStepBlock(options)` | `cli_style_next_step_block ...` | `next_step_block(...)` | `CliStyle.nextStepBlock(...)` | Next-step guidance with command and alternative. |
239
268
  | `chip` | `chip(label, tone, options)` | Use `cli_style_render` | Use `render("chip", ...)` | Use `CliStyle.render` | Compact labelled state. |
240
269
  | `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` | Use `render("table", ...)` | Use `CliStyle.render` | Tabular records with narrow-width fallback. |
270
+ | `table` | `table(options)` | Use `cli_style_render` | `table(columns, rows)` | Use `CliStyle.render` | Tabular records with narrow-width fallback. |
242
271
  | `progress-bar` | `progressBar(options)` | Use `cli_style_render` | Use `render("progress-bar", ...)` | Use `CliStyle.render` | Single progress value with numeric text. |
243
272
  | `bar-chart` | `barChart(options)` | Use `cli_style_render` | Use `render("bar-chart", ...)` | Use `CliStyle.render` | Multi-row bar chart. |
244
273
  | `sparkline` | `sparkline(options)` | Use `cli_style_render` | Use `render("sparkline", ...)` | Use `CliStyle.render` | Compact trend with latest, minimum, and maximum values. |
@@ -306,6 +335,29 @@ Use these shapes with `cli-style render`, `cli_style_render`, or Python `render(
306
335
  - `labelWidth`: optional minimum width for every label
307
336
  - Per-row fields match `row`, including `label`, `value`, `result`, `labelColour`, `valueColour`, and `separator`
308
337
 
338
+ ### `bullet-list`
339
+
340
+ 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:
341
+
342
+ ```js
343
+ bulletList(
344
+ [
345
+ "Install dependencies",
346
+ {
347
+ text: "Run checks",
348
+ items: ["Review failures", "Repeat the focused check"],
349
+ },
350
+ ],
351
+ { width: 48 },
352
+ );
353
+ // • Install dependencies
354
+ // • Run checks
355
+ // ◦ Review failures
356
+ // ◦ Repeat the focused check
357
+ ```
358
+
359
+ Use `profile: "agent"` for Markdown-compatible `-` bullets, or `unicode: false` for `*` bullets.
360
+
309
361
  ### `span`
310
362
 
311
363
  ```json
@@ -721,3 +773,13 @@ cli-style gallery --dark --section primitives
721
773
  ```
722
774
 
723
775
  Use `--interactive` to select a section or fixture with `fzf` when it is installed.
776
+
777
+ ## Generated adapter wrappers
778
+
779
+ 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:
780
+
781
+ ```bash
782
+ bun run generate:adapters
783
+ ```
784
+
785
+ `bun run check` runs `check:adapters`, which fails when the committed wrappers are stale.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lewis Howles
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # lewishowles-cli-style
2
+
3
+ `lewishowles-cli-style` is a Python adapter for the shared `cli-style` command-line renderer. It lets Python programs use the same terminal output styles as the JavaScript package.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ python -m pip install lewishowles-cli-style
9
+ ```
10
+
11
+ The package supports Python 3.9 and later. The installed distribution is named `lewishowles-cli-style`, and you import it as `cli_style`.
12
+
13
+ Rendering happens in the separate `cli-style` binary, so that needs to be on your `PATH`. The [main readme](https://github.com/lewishowles/cli-style#install) covers the ways to install it.
14
+
15
+ ## Usage
16
+
17
+ ```python
18
+ from cli_style import render
19
+
20
+ print(render("status", {"type": "success", "label": "Build passed"}))
21
+ ```
22
+
23
+ If the `cli-style` binary is not available, `render()` returns sorted plain `key: value` text by default. Pass `raise_on_missing=True` to raise `CliStyleNotFoundError` instead.
24
+
25
+ ## More information
26
+
27
+ - [Repository](https://github.com/lewishowles/cli-style)
28
+ - [Issue tracker](https://github.com/lewishowles/cli-style/issues)
29
+ - [MIT licence](https://github.com/lewishowles/cli-style/blob/main/LICENSE)
@@ -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
+ ]