@v1nvn/statusline 0.28.0 → 0.29.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 CHANGED
@@ -1,15 +1,15 @@
1
1
  # @v1nvn/statusline
2
2
 
3
- The CLI behind the statusline plugin: it composes the two settings keys
4
- that paint Claude Code's status line and agent panel, then reverts and checks
5
- them. Pure TypeScript — the bash runtime it points at ships inside the plugin
6
- (`plugins/statusline/runtime/`), not in this package.
3
+ The statusline package: the CLI that writes the two settings keys painting
4
+ Claude Code's status line and agent panel, and the renderer those keys spawn —
5
+ `dist/render.mjs`, synced into the plugin data dir and run with `node`. Pure
6
+ TypeScript, zero bash.
7
7
 
8
8
  User-facing docs: [root README § statusline](../../README.md#statusline).
9
9
 
10
10
  ## Quickstart
11
11
 
12
- Install once (the runtime the keys point at lives in the plugin cache):
12
+ Install once:
13
13
 
14
14
  ```sh
15
15
  claude plugin marketplace add v1nvn/agentic
@@ -22,7 +22,7 @@ offers the picker in chat, and writes the pick.
22
22
  In a terminal outside Claude Code — the wizard, the terminal guide:
23
23
 
24
24
  ```sh
25
- npx -y @v1nvn/statusline@0.28.0 configure
25
+ npx -y @v1nvn/statusline@0.29.0 configure
26
26
  ```
27
27
 
28
28
  Pass one stacks the five theme bars: `j/k` focus · `w` width · enter picks.
@@ -35,27 +35,27 @@ One CLI, both ways: `/lab` inside a session runs these same commands; `npx`
35
35
  runs them in a terminal. Every subcommand takes `--home <dir>` to operate on
36
36
  another home instead of `$HOME`.
37
37
 
38
- | Command | Does |
39
- |---|---|
40
- | `configure` | write both settings keys. Bare on a TTY: the wizard. With flags: `--theme <name>` (quiet, lean, classic, rich, custom) is the base design, item flags override it, `--layout` overrides its layout; a layout item nothing picks is an error naming it; a foreign key needs `--force` |
41
- | `preview` | render the candidate bar and panel row through the same resolution `configure` uses, writing nothing; `--plain` strips the color escapes so glyphs survive chat |
42
- | `catalog` | the themes block (`*` marks the live theme) then one line per item, `*` marking the live variant; `--themes` cuts to the block |
43
- | `status` | one row per fact plus a verdict — exit 0 healthy, 1 needs action, every action row names its fix |
44
- | `restore` | both keys back to their pre-lab values from `backup.json`, then deletes the lab data — `--dry-run` prints the plan; `--force` splices over a key changed after the takeover |
38
+ | Command | Does |
39
+ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
40
+ | `configure` | the sole writer — writes both settings keys and syncs the bundled renderer into the data dir. Bare on a TTY: the wizard. With flags: `--theme <name>` (quiet, lean, classic, rich, custom) is the base design, item flags override it, `--layout` overrides its layout; a layout item nothing picks is an error naming it; a foreign key needs `--force` |
41
+ | `preview` | render the candidate bar and panel row through the same resolver the keys paint with, writing nothing; `--plain` strips the color escapes so glyphs survive chat |
42
+ | `catalog` | the themes block (`*` marks the theme the key names) then one line per item, `*` marking the resolved variant; `--themes` cuts to the block |
43
+ | `status` | one row per fact — node, the data-dir renderer, both keys, the theme the key names, backup, captures — plus a verdict; exit 0 healthy, 1 needs action, every action row names its fix |
44
+ | `restore` | both keys back to their pre-lab values from `backup.json`, then deletes the lab data — `--dry-run` prints the plan; `--force` splices over a key changed after the takeover |
45
45
 
46
46
  ```sh
47
- npx -y @v1nvn/statusline@0.28.0 preview --theme rich --plain # chat-safe sketch, nothing written
48
- npx -y @v1nvn/statusline@0.28.0 configure --theme rich # the write — live on the next paint
49
- npx -y @v1nvn/statusline@0.28.0 configure --theme rich --bar percent # one swap on top of the theme
50
- npx -y @v1nvn/statusline@0.28.0 catalog --themes
51
- npx -y @v1nvn/statusline@0.28.0 status
52
- npx -y @v1nvn/statusline@0.28.0 restore
47
+ npx -y @v1nvn/statusline@0.29.0 preview --theme rich --plain # chat-safe sketch, nothing written
48
+ npx -y @v1nvn/statusline@0.29.0 configure --theme rich # the write — live on the next paint
49
+ npx -y @v1nvn/statusline@0.29.0 configure --theme rich --bar percent # one swap on top of the theme
50
+ npx -y @v1nvn/statusline@0.29.0 catalog --themes
51
+ npx -y @v1nvn/statusline@0.29.0 status
52
+ npx -y @v1nvn/statusline@0.29.0 restore
53
53
  ```
54
54
 
55
55
  ## Develop
56
56
 
57
57
  ```sh
58
- yarn workspace @v1nvn/statusline build # vite → dist/
58
+ yarn workspace @v1nvn/statusline build # vite → dist/ (index.js + render.mjs)
59
59
  yarn workspace @v1nvn/statusline test # vitest
60
60
  yarn lint && yarn typecheck # from the repo root
61
61
  ```
@@ -64,36 +64,58 @@ Node ≥ 22. One workspace dep: `@v1nvn/agentic-core` (usage/exit helpers).
64
64
 
65
65
  ## Modules
66
66
 
67
- | File | Role |
68
- |---|---|
69
- | `src/cli.ts` | commander wiring — five subcommands, help text |
70
- | `src/index.ts` | bin entry — verb dispatch, exit codes, wizard TTY deps |
71
- | `src/configure.ts` | the writer — theme + flag resolution, key composition, ours-matcher, JSON splice engine, backup write |
72
- | `src/resolve.ts` | runtime resolution + key parsing — the one resolution way |
73
- | `src/restore.ts` | revert decision tree + explicit-path cleanup |
74
- | `src/status.ts` | diagnostic rows + verdict, the live theme named |
75
- | `src/catalog.ts` | themes block + item listing, live picks starred |
76
- | `src/themes.ts` | the five theme bundles — layout, one variant per item, summary |
77
- | `src/live-theme.ts` | the shared matcher — the theme a key equals exactly |
78
- | `src/preview.ts` | the preview command — a candidate rendered, nothing written |
79
- | `src/wizard.ts` · `src/wizard-tui.ts` | the terminal wizard — theme pass, then refinement seeded from the pick |
80
- | `src/payloads.ts` · `src/demo-repo.ts` | preview plumbing — spawns the runtime with env + stdin; demo git repo for fixtures |
81
- | `assets/` | preview fixtures — `payloads/p1–p4.json` (main surface), `ticks/multi.json` (panel) |
67
+ | File | Role |
68
+ | -------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
69
+ | `src/cli.ts` | commander wiring — five subcommands, help text |
70
+ | `src/index.ts` | bin entry — verb dispatch, exit codes, wizard TTY deps |
71
+ | `src/configure.ts` | the writer — validation, diff-from-base flags, ours-matcher, JSON splice engine, backup write, renderer sync |
72
+ | `src/resolve.ts` | the settings keys — composition, ours-matching, and parsing back into decisions |
73
+ | `src/restore.ts` | revert decision tree + explicit-path cleanup |
74
+ | `src/status.ts` | diagnostic rows + verdict — node, renderer, keys, theme |
75
+ | `src/catalog.ts` | themes block + item listing, resolved picks starred |
76
+ | `src/themes.ts` | the five theme bundles — layout, one variant per item, summary |
77
+ | `src/preview.ts` | the preview command — a candidate rendered, nothing written |
78
+ | `src/wizard.ts` · `src/wizard-tui.ts` | the terminal wizard — theme pass, then refinement of the pick's overrides |
79
+ | `src/payloads.ts` · `src/demo-repo.ts` | preview plumbing — fixtures anchored to the moment, in-process renders; demo git repo |
80
+ | `src/render/entry.ts` | the `render.mjs` entry the keys spawn — argv to line or panel, both capture tees |
81
+ | `src/render/argv.ts` | the renderer's argv grammar — `node:util` parseArgs, never commander |
82
+ | `src/render/theme.ts` | `resolvePaint` — the one theme resolver, shared by paint and display |
83
+ | `src/render/engine.ts` | the line engine — compose, `vlen`, the fit ladder |
84
+ | `src/render/items.ts` | the item registry — 16 items, defaults, rungs, `DEFAULT_LAYOUT` |
85
+ | `src/render/segments.ts` | the per-item segment renderers |
86
+ | `src/render/payload.ts` | the stdin payload types + parse |
87
+ | `src/render/git.ts` | the git reads |
88
+ | `src/render/panel.ts` | the agent-panel renderer — its own `vlen` and fit ladder |
89
+ | `src/render/awk.ts` | printf-style decimal formatting on exact IEEE bits |
90
+ | `src/render/capture.ts` | the capture tee + `DATA_DIR` |
91
+ | `src/render/index.ts` | the in-process barrel the CLI renders through |
92
+ | `assets/` | preview fixtures — `payloads/p1–p4.json` (main surface), `ticks/multi.json` (panel) |
82
93
 
83
94
  ## Contracts
84
95
 
85
- - `configure` writes exactly two keys of `~/.claude/settings.json` — nothing
86
- else on disk except `backup.json` and `captures/`.
87
- - The key value is one inline shell command: resolver statement first, env
88
- assignments hugging `bash` last; statement order is pinned by golden tests.
89
- - A theme is configure-time only: a theme write and a flags write of the same
90
- values produce identical settings text — the runtime never learns themes
91
- exist.
92
- - The live theme is re-derived by matching the key against the bundles; no
93
- theme name is stored in settings.
94
- - One resolution way: the newest-plugin-cache glob — `installed_plugins.json`
95
- is read nowhere.
96
+ - `configure` is the sole writer: one run writes both keys and syncs the
97
+ bundled `render.mjs` into the data dir — its only other write is
98
+ `backup.json`. `preview`, `catalog`, and `status` write nothing;
99
+ `captures/` is the renderer's paint-time tee, not a CLI write.
100
+ - The key value is one direct data-dir command:
101
+ `node "$HOME/.claude/plugins/data/statusline-agentic/render.mjs" --theme=lean --bar=gauge || true`
102
+ — no glob resolver, no plugin-cache coupling; the panel key adds the `panel`
103
+ positional. Key spellings are pinned byte-exact by tests.
104
+ - Decisions ride argv: `--theme` first, then one `--<item>=<alt>` per pick
105
+ that differs from the theme's own, `--layout` only when passed. Ambient
106
+ state stays env — `NO_COLOR`, `COLUMNS`, `HOME`.
107
+ - The renderer resolves the theme at paint: item flags beat it, `--layout`
108
+ beats its layout — one resolver, no second path. `catalog` stars through
109
+ it, `preview` and the wizard render through it in-process, and `status`
110
+ reads the theme name straight from the key.
111
+ - The theme name rides the key: `status` and `catalog` read it straight from
112
+ the key, swaps appended — `theme: lean +bar=gauge` — so a swap keeps the
113
+ name.
114
+ - The renderer bundle is dependency-free (node built-ins only) and parses its
115
+ own argv — never commander, never `@v1nvn/agentic-core` — so any node ≥ 18
116
+ the host has paints.
96
117
  - One splice home: the settings.json span primitives live in `configure.ts`;
97
118
  `restore` imports them.
98
- - `restore` never resolves the runtime — it works uninstalled.
119
+ - `restore` never runs the renderer — it works uninstalled, deleting
120
+ `render.mjs` with the rest of the lab data by explicit path.
99
121
  - Deletion is explicit paths only — no globs, no recursive rm.