cc-cream 0.1.14 → 0.1.16

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
@@ -4,6 +4,16 @@ All notable changes to cc-cream are documented here. Format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
5
5
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.1.16] — 2026-05-29
8
+
9
+ ### Fixed
10
+ - **The status bar silently rendered nothing when `~/.claude` is a symlink** (dotfile managers like stow/chezmoi/yadm, or an iCloud/Dropbox-synced config dir). The "am-I-the-entrypoint" guard compared `import.meta.url` (which Node's ESM loader canonicalizes — symlinks resolved) against `pathToFileURL(process.argv[1])` (left as-invoked, through the symlink). Under a symlinked path the two never matched, so `main()` never ran and the bar appeared as an empty line with no error — invisible to diagnose. The guard now compares **realpaths** (falling back to the href check if realpath fails), so a symlinked install renders correctly. Found while verifying a fresh v0.1.15 plugin install.
11
+
12
+ ## [0.1.15] — 2026-05-29
13
+
14
+ ### Fixed
15
+ - **An orphaned status line no longer crashes on every render after `/plugin uninstall`.** If you ran `/plugin uninstall cc-cream` without first running `/cc-cream:uninstall`, the `statusLine` entry stayed in `settings.json` while the plugin cache was deleted. The cache-glob then matched nothing, the baked command collapsed to a bare relative `src/cc-cream.js`, and Claude Code hit `MODULE_NOT_FOUND` (exit 1) on every render — and `/cc-cream:uninstall` was gone, so the only fix was hand-editing `settings.json`. The auto-update command now captures the resolved version dir in `$d` and short-circuits with `[ -z "$d" ] && exit 0`, so an orphaned status line is inert (silent, exit 0) instead of a recurring error. "Degrade, never crash." New installs/auto-wires get the guarded command; existing users pick it up on their next `/cc-cream:setup`.
16
+
7
17
  ## [0.1.14] — 2026-05-29
8
18
 
9
19
  ### Changed
@@ -124,6 +134,8 @@ line and prints a colored ≤3-row bar — zero tokens, the model never sees it.
124
134
  - Supports **macOS and Linux**; Windows is a planned fast-follow.
125
135
  - Requires Claude Code **2.1.132+** (`effort` / `thinking` need 2.1.145+).
126
136
 
137
+ [0.1.16]: https://github.com/bart-turczynski/cc-cream/compare/v0.1.15...v0.1.16
138
+ [0.1.15]: https://github.com/bart-turczynski/cc-cream/compare/v0.1.14...v0.1.15
127
139
  [0.1.6]: https://github.com/bart-turczynski/cc-cream/compare/v0.1.5...v0.1.6
128
140
  [0.1.5]: https://github.com/bart-turczynski/cc-cream/compare/v0.1.4...v0.1.5
129
141
  [0.1.4]: https://github.com/bart-turczynski/cc-cream/compare/v0.1.3...v0.1.4
package/README.md CHANGED
@@ -118,13 +118,24 @@ and you may need to **restart** it for the bar to appear.
118
118
 
119
119
  ### Uninstall
120
120
 
121
- Plugin users — two steps (Claude Code can't clean `settings.json` when a plugin
122
- is removed, so the wiring is cleared separately from the cache):
121
+ Plugin users — two steps, **in this order** (Claude Code can't clean
122
+ `settings.json` when a plugin is removed, so the wiring is cleared separately
123
+ from the cache):
123
124
  ```
124
- /cc-cream:uninstall # removes the statusLine wiring
125
- /plugin uninstall cc-cream # drops the plugin from the cache
125
+ /cc-cream:uninstall # 1. removes the statusLine wiring (run this FIRST)
126
+ /plugin uninstall cc-cream # 2. drops the plugin from the cache
126
127
  ```
127
128
 
129
+ > **Order matters.** `/cc-cream:uninstall` lives inside the plugin, so once you
130
+ > run `/plugin uninstall` it's gone. The status line itself degrades to nothing
131
+ > if the cache is missing (it won't error), but the now-inert `statusLine` block
132
+ > lingers in `settings.json`. To clear it after the plugin is already gone, run
133
+ > the npm bin (no global install needed):
134
+ > ```bash
135
+ > npx -y -p cc-cream cc-cream-setup --uninstall
136
+ > ```
137
+ > or remove the `statusLine` key from `~/.claude/settings.json` by hand.
138
+
128
139
  npm / manual users:
129
140
  ```bash
130
141
  cc-cream-setup --uninstall # npm (add --purge to also remove runtime + config)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-cream",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "Claude Code cache/context/cost status-line tool",
5
5
  "directories": {
6
6
  "doc": "docs"
package/src/cc-cream.js CHANGED
@@ -3,10 +3,11 @@
3
3
  // Reads the session JSON Claude Code pipes on stdin and prints a colored
4
4
  // <=3-row bar. Hard rule: degrade, never crash.
5
5
 
6
+ import { realpathSync } from 'node:fs';
6
7
  import os from 'node:os';
7
8
  import path from 'node:path';
8
9
  import process from 'node:process';
9
- import { pathToFileURL } from 'node:url';
10
+ import { fileURLToPath, pathToFileURL } from 'node:url';
10
11
  import { loadConfig, readConfigFile } from './config.js';
11
12
  import { render } from './render.js';
12
13
  import {
@@ -72,6 +73,23 @@ async function main() {
72
73
  process.exit(0);
73
74
  }
74
75
 
75
- if (import.meta.url === pathToFileURL(process.argv[1] || '').href) {
76
+ // Robust "is this module the entrypoint?" check. Node's ESM loader canonicalizes
77
+ // import.meta.url (symlinks resolved), but process.argv[1] stays as it was invoked.
78
+ // A plain href comparison therefore fails silently when cc-cream runs from a
79
+ // symlinked path — e.g. a ~/.claude managed by a dotfile manager (stow/chezmoi/yadm)
80
+ // or synced via iCloud/Dropbox — skipping main() so the bar renders NOTHING with no
81
+ // error. Comparing realpaths makes the symlinked and canonical paths match. Falls
82
+ // back to the href comparison if realpath fails (e.g. a path that no longer exists).
83
+ function isEntrypoint() {
84
+ const arg = process.argv[1];
85
+ if (!arg) return false;
86
+ try {
87
+ return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(arg);
88
+ } catch {
89
+ return import.meta.url === pathToFileURL(arg).href;
90
+ }
91
+ }
92
+
93
+ if (isEntrypoint()) {
76
94
  main();
77
95
  }
package/src/install.js CHANGED
@@ -28,8 +28,16 @@ const TRUST_NOTE =
28
28
  // it, a non-numeric cache dir (a git-sha install like `c83650b6360f/`) sorts
29
29
  // last and pins the bar to whatever version that happens to be, defeating
30
30
  // auto-update. With it, `/plugin update` is applied live with no re-run of setup.
31
+ //
32
+ // The resolved dir is captured in `$d` and GUARDED with `[ -z "$d" ] && exit 0`:
33
+ // when the glob matches nothing — the state left behind if a user runs
34
+ // `/plugin uninstall cc-cream` WITHOUT first running `/cc-cream:uninstall`, so a
35
+ // stale statusLine outlives the deleted cache — the command degrades to a silent
36
+ // exit 0 instead of running a bare relative `src/cc-cream.js` that crashes with
37
+ // MODULE_NOT_FOUND on every render. "Degrade, never crash" (CLAUDE.md). `exec`
38
+ // replaces the shell so stdin/stdout pass straight through to the renderer.
31
39
  export function autoUpdateCommand(nodePath) {
32
- return `${nodePath} "$(ls -1d "\${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/plugins/cache/*/cc-cream/*/ 2>/dev/null | grep -E '/[0-9]+(\\.[0-9]+)+/$' | sort -V | tail -1)src/cc-cream.js"`;
40
+ return `d="$(ls -1d "\${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/plugins/cache/*/cc-cream/*/ 2>/dev/null | grep -E '/[0-9]+(\\.[0-9]+)+/$' | sort -V | tail -1)"; [ -z "$d" ] && exit 0; exec ${nodePath} "\${d}src/cc-cream.js"`;
33
41
  }
34
42
 
35
43
  // `desired` is considered already installed if it matches the planned command