claude-rpc 1.5.4 → 1.7.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
@@ -15,7 +15,7 @@
15
15
 
16
16
  **Discord Rich Presence for [Claude Code](https://claude.com/claude-code)** — your live model, project, tokens, and lifetime stats, driven by the hooks Claude Code already fires.
17
17
 
18
- **[claude-rpc.com →](https://claude-rpc.com)** — see it in one page.
18
+ **[claude-rpc.com →](https://claude-rpc.com)** — see it in one page. · **[Discord →](https://claude-rpc.com/discord?s=readme)** — help, ideas, show your card.
19
19
 
20
20
  [![community · sessions](https://claude-rpc-totals.claude-rpc.workers.dev/sessions.svg)](#community-totals)   [![community · tokens](https://claude-rpc-totals.claude-rpc.workers.dev/tokens.svg)](#community-totals)
21
21
 
@@ -142,13 +142,18 @@ The web dashboard pushes updates via SSE; the TUI refreshes on a 3-second tick.
142
142
 
143
143
  ### beyond your machine
144
144
 
145
- Shields-style badges and a poster-style summary card you can paste into a README or a Discord message. The fastest path is one command:
145
+ Stat cards and badges for a README, a site or a Discord message, all from one command. Run it bare for a menu: pick a card, then a **live link** (paste once, it refreshes itself), a **PNG** or an **SVG**:
146
146
 
147
147
  ```sh
148
- claude-rpc readme # prints paste-ready README badge markdown
149
- claude-rpc readme --raw | pbcopy # straight to your clipboard
148
+ claude-rpc statcards # menu: card → link / PNG / SVG
149
+ claude-rpc statcards stats --link --md | pbcopy # README markdown, straight to the clipboard
150
+ claude-rpc statcards poster --png # ./claude-poster.png, 2× for Discord / X
151
+ claude-rpc statcards badge --metric streak --svg # ./claude-badge-streak.svg
152
+ claude-rpc statcards list # every card and where it can go
150
153
  ```
151
154
 
155
+ Cards: `stats` (totals + year heatmap), `profile`, `badge`, `heatmap`, `poster`, `session`, `wrapped`. PNGs are drawn by whatever the machine already has (rsvg-convert, or Chrome / Edge / Brave / Chromium headless; Edge ships with Windows), so there is still nothing to install. The link option prints the URL, Markdown and an `<img>` tag, and copies the Markdown.
156
+
152
157
  **Live stats + year heatmap, paste once.** With a public profile (`claude-rpc profile set --handle <you> && claude-rpc profile on`), the community worker serves an always-current stats card with your last 12 months as a heatmap. You don't need `gh` or a gist, and there's nothing to re-run:
153
158
 
154
159
  ```md
@@ -171,27 +176,16 @@ The smaller card and badges are still there:
171
176
 
172
177
  The card shows tokens, sessions, active hours and streak; badge `metric=` is one of `tokens · sessions · hours · streak` (optional `&label=` to retitle). Both refresh themselves as the daemon flushes your profile (~every 30 min). Your profile page at `/u/<you>` has a one-click "copy" for the whole block.
173
178
 
174
- Prefer to render locally? `badge`/`card`/`calendar`/`github-stat` all write SVG, and `--gist` self-hosts a live one:
175
-
176
- ```sh
177
- claude-rpc badge --metric hours --range 7d --out claude-hours.svg
178
- claude-rpc badge --metric streak --out claude-streak.svg
179
- claude-rpc badge --metric hours --gist # publish to a gist (live README badge)
180
- claude-rpc card --range year --out year-on-claude.svg
181
- claude-rpc calendar --metric tokens --out heatmap.svg # year heatmap (hours by default)
182
- claude-rpc calendar --card --out stats.svg # stats + heatmap, offline
183
- ```
179
+ No public profile? Every card except `wrapped` also renders offline from your local stats, as PNG or SVG (`statcards <card> --png` / `--svg`). The older one-card commands (`badge`, `card`, `calendar`, `github-stat`, `session-card`, `readme`) still work, including `--gist`.
184
180
 
185
181
  <div align="center">
186
182
  <img src="site/examples/week-on-claude.svg" width="270" alt="Week-on-claude summary card" />
187
183
  <img src="site/examples/month-on-claude.svg" width="270" alt="Month-on-claude summary card" />
188
184
  <img src="site/examples/year-on-claude.svg" width="270" alt="Year-on-claude summary card — hours, prompts, tokens, lines, cost, daily activity strip" />
189
185
  <br/>
190
- <sub><code>card --range week · month · year</code> (also <code>all</code>) — live at <code>/api/card.svg</code> while <code>claude-rpc serve</code> is running</sub>
186
+ <sub><code>statcards poster --range week · month · year</code> (also <code>all</code>) — live at <code>/api/card.svg</code> while <code>claude-rpc serve</code> is running</sub>
191
187
  </div>
192
188
 
193
- `badge --gist` writes the SVG to your own GitHub gist (creates one on first run, updates it after — id remembered in `config.json`). The URL printed back is README-ready and updates every time you re-run the command. Uses `gh` if available, else `GH_TOKEN` with `gist` scope.
194
-
195
189
  Live equivalents while `claude-rpc serve` is running (the local dashboard server — the daemon itself serves no HTTP):
196
190
 
197
191
  - `http://127.0.0.1:47474/api/badge.svg?metric=hours&range=7d`
@@ -253,9 +247,9 @@ Per-project, runtime, or auto-detected — whichever fits how you work.
253
247
  Or from the command line, in any project:
254
248
 
255
249
  ```sh
256
- claude-rpc private # add cwd to ~/.claude-rpc/private-list.json
257
- claude-rpc public # remove cwd
258
- claude-rpc privacy # show the resolved visibility for the current dir
250
+ claude-rpc private # hide this folder (adds it to ~/.claude-rpc/private-list.json)
251
+ claude-rpc private off # show it again
252
+ claude-rpc private status # what Discord sees for this folder, and why
259
253
  ```
260
254
 
261
255
  Or globally, in `config.json`:
@@ -306,7 +300,9 @@ It's a thin bootstrapper — on the first session it just runs `npx claude-rpc@l
306
300
 
307
301
  ## commands
308
302
 
309
- `claude-rpc --help` lists them all — and after `setup` you rarely need any.
303
+ `claude-rpc help` lists them all, grouped; `claude-rpc help <command>` (or `<command> --help`) shows one command's options and examples. After `setup` you rarely need any.
304
+
305
+ **Tab completion:** `claude-rpc completion install` turns it on for bash, zsh, fish or PowerShell (setup offers it too). `claude-rpc re<Tab>` → `recap` / `restart`, `claude-rpc scan --<Tab>` → `--force`, and flag values, project names and files complete as well. A typo gets a "did you mean".
310
306
 
311
307
  <details>
312
308
  <summary><b>full command reference</b></summary>
@@ -315,43 +311,47 @@ It's a thin bootstrapper — on the first session it just runs `npx claude-rpc@l
315
311
 
316
312
  | Command | What it does |
317
313
  | ---------------- | ------------ |
318
- | `setup` (or `install`) | Install Claude Code hooks + login autostart, seed config, start the daemon (test-fires one synthetic SessionStart to prove the pipe works). `--link <code>` also links this machine to your verified profile |
319
- | `uninstall` | Remove Claude Code hooks + the login-autostart entry (keeps your data) |
320
- | `upgrade-config` | Re-run idempotent migrations on `config.json` |
321
- | `start` / `stop` / `restart` | Lifecycle for the detached daemon |
322
- | `status` | Interactive TUI — heatmap, hour histogram, leaderboards (`--dump`, or `dump`, for plain output) |
323
- | `today` / `week` | Focused views (today's stats, weekday breakdown) |
324
- | `compare` | This week vs last week, side by side |
325
- | `projects` / `project <name>` | Every project ranked by active time (`--limit N`) / one project's full record + recent daily rhythm |
326
- | `usage` | Subscription limits — session + weekly %, the same numbers `/usage` shows |
327
- | `serve` | Open the local web dashboard (port 47474) |
328
- | `preview` | Render every rotation frame against real state |
329
- | `vars` | Dump the full template-var list as JSON |
330
- | `scan` / `rescan`| Incremental / forced re-parse of `~/.claude/projects` |
331
- | `backfill <dir>` | Import transcripts from any folder (backup, other machine) |
332
- | `insights` | Print 3–5 auto-generated lines about your week |
333
- | `recap` | Standup summary — yesterday's work, paste-ready (`today\|week\|date`, `--md`) |
334
- | `export` | Dump the aggregate as JSON, or daily rows as CSV (`--csv` `--out`) |
335
- | `badge` | Shields-style SVG (`--metric` `--range` `--out` `--gist`) |
336
- | `card` | Poster-style SVG (`--range year\|month\|week\|all`) |
337
- | `github-stat` | Embeddable profile stat card (`--handle` `--out` `--gist`) |
338
- | `calendar` | Year activity heatmap SVG (`--metric hours\|tokens` `--card` `--out` `--gist`) |
339
- | `session-card` | Recap card for the current session (`--out`) |
340
- | `readme` | Paste-ready README badge markdown for your profile (`--raw` to pipe) |
314
+ | **Get started** | |
315
+ | `setup` | Install Claude Code hooks + login autostart, seed config, start the daemon. `--link <code>` also links this machine to your verified profile (`--wrapped` publishes your year too) |
316
+ | `completion` | Tab completion: `install`, `uninstall`, or print the `bash` / `zsh` / `fish` / `powershell` script |
317
+ | `uninstall` | Remove hooks, login autostart, PATH entry and tab completion (keeps your data) |
318
+ | **Your stats** | |
319
+ | `status` | Interactive TUI: heatmap, hour histogram, leaderboards (`--dump` for plain output) |
320
+ | `today` | Today's stats + when in the day you code |
321
+ | `week` | This week day by day; `--compare` puts it next to last week |
322
+ | `projects [name]`| Every project ranked by active time (`--limit N`), or one project's full record + recent daily rhythm |
323
+ | `usage` | Subscription limits: session + weekly %, the same numbers `/usage` shows |
324
+ | `recap` | Standup summary, yesterday by default (`today\|week\|YYYY-MM-DD`, `--md`, `--json`) |
325
+ | `insights` | 3–5 auto-generated lines about your history |
326
+ | `wrapped` | Your animated year in review; `--publish` puts it on `claude-rpc.com/wrapped/<handle>` |
327
+ | `serve` | The local web dashboard (port 47474) |
328
+ | `export` | The aggregate as JSON, or daily rows as CSV (`--csv` `--out`) |
329
+ | **Share** | |
330
+ | `statcards [card]` | Cards and badges as a live link, PNG or SVG: `stats` `profile` `badge` `heatmap` `poster` `session` `wrapped` (`--link` `--png [file]` `--svg [file]` `--md` `--html` `--metric` `--range` `--copy`; bare = menu) |
341
331
  | `statusline` | One-line status for tmux/shell prompts (`--template`) |
342
- | `mcp install` / `mcp uninstall` | Wire / remove the stats MCP server in Claude Code (one command) |
343
- | `mcp` | Run the MCP server (stdio) for Claude Code |
344
- | `wrapped` | Open your animated year-in-review (Claude Wrapped); `--publish` puts it on `claude-rpc.com/wrapped/<handle>` |
345
- | `pause` / `resume` | Snooze the Discord card everywhere (`pause [30m\|2h]`, default 1h; `pause status`, `pause off`); `unpause` = `resume` |
346
- | `private` / `public` / `privacy` | Per-cwd visibility toggles + status |
347
- | `community` | Anonymous community totals, on by default for fresh installs — `status` \| `off` \| `on` \| `report` |
348
- | `profile` | Opt-in public leaderboard profile — `status` \| `set` \| `on` \| `off` \| `publish` \| `verify` |
349
- | `squad` | Private mini-leaderboards with friends — `status` \| `create <name>` \| `join <code>` \| `leave [id]` |
350
- | `link` | One profile across machines: `link` mints a code on your verified machine, `link <code>` claims it on the new one |
332
+ | `mcp` | The stats MCP server (stdio); `mcp install` / `mcp uninstall` wire it into Claude Code |
333
+ | **Privacy** | |
334
+ | `private [on\|off\|status]` | Hide this folder from Discord, show it again, or see how it resolves |
335
+ | `pause [30m\|2h\|off\|status]` | Hide the card everywhere for a while (default 1h) |
336
+ | **Online** | |
337
+ | `profile` | Opt-in public leaderboard profile: `status` \| `set` \| `on` \| `off` \| `publish` \| `verify` |
338
+ | `squad` | Private mini-leaderboards with friends: `status` \| `create <name>` \| `join <code>` \| `leave [id]` |
339
+ | `link [code]` | One profile across machines: `link` mints a code on your verified machine, `link <code>` claims it on the new one |
340
+ | `community` | Anonymous community totals, on by default for fresh installs: `status` \| `off` \| `on` \| `report` |
341
+ | **Daemon** | |
342
+ | `start` / `stop` / `restart` | Lifecycle for the detached daemon |
343
+ | `logs` | Follow the daemon log |
344
+ | **Troubleshoot** | |
351
345
  | `doctor` | Diagnostic checklist with one-line fix hints (`--fix` to auto-repair) |
352
- | `tail` / `logs` / `log` | Tail the daemon log |
346
+ | `scan` | Re-count your history from `~/.claude/projects` (`--force` re-parses everything) |
347
+ | `backfill <dir>` | Import transcripts from any folder (backup, other machine) |
348
+ | `preview` | Render every rotation frame against real state |
349
+ | `vars` | The full template-variable list as JSON |
350
+ | `upgrade-config` | Re-run idempotent migrations on `config.json` |
353
351
  | `daemon` | Run the daemon in the foreground (debugging) |
354
352
 
353
+ Older names still work and always will within 1.x: `install` (setup), `dump` (status --dump), `compare` (week --compare), `project <name>` (projects <name>), `rescan` (scan --force), `resume` / `unpause` (pause off), `public` (private off), `privacy` (private status), `tail` / `log` (logs), and `badge`, `card`, `github-stat`, `calendar`, `session-card`, `readme` (statcards).
354
+
355
355
  Exit codes: `0` ok · `1` user error · `2` system error · `3` wrong state. `--version` and `--help` work as expected.
356
356
 
357
357
  </details>
@@ -395,9 +395,9 @@ rm -rf ~/.claude-rpc # stats; plus the per-OS config dir if you want it g
395
395
 
396
396
  <br/>
397
397
 
398
- - **Discord doesn't show anything.** Discord *desktop* must be running. The browser client doesn't expose the local IPC bridge. `claude-rpc tail` shows what the daemon is actually doing.
398
+ - **Discord doesn't show anything.** Discord *desktop* must be running. The browser client doesn't expose the local IPC bridge. `claude-rpc logs` shows what the daemon is actually doing.
399
399
  - **Hooks don't fire.** `claude-rpc setup` re-registers them and now test-fires a synthetic `SessionStart` end-to-end, so a broken hook command surfaces immediately. Restart Claude Code afterwards so it re-reads its hook config.
400
- - **Config error.** Bad JSON in `config.json` no longer crashes anything — the daemon logs one line and falls back to baked defaults. `claude-rpc tail` shows the parse error verbatim.
400
+ - **Config error.** Bad JSON in `config.json` no longer crashes anything — the daemon logs one line and falls back to baked defaults. `claude-rpc logs` shows the parse error verbatim.
401
401
  - **Old binary path baked into hooks.** Common after manual exe replacement. `claude-rpc setup` rewrites hook entries to point at the canonical install location.
402
402
 
403
403
  </details>
package/SECURITY.md CHANGED
@@ -137,11 +137,11 @@ described under **Scope** below.
137
137
 
138
138
  ## 3. Outbound network
139
139
 
140
- There are six distinct network behaviors: community totals (3a), gist
140
+ There are seven distinct network behaviors: community totals (3a), gist
141
141
  publishing (3b), squads/web login (3c), subscription-usage polling (3d),
142
- the cosmetic GIF assets (3e), and the opt-in status webhook (3f). Each is
143
- independently optional. The separate desktop dashboard app, if installed,
144
- additionally auto-updates itself (3g).
142
+ the cosmetic GIF assets (3e), the opt-in status webhook (3f), and the
143
+ CLI auto-update check (3h). Each is independently optional. The separate
144
+ desktop dashboard app, if installed, additionally auto-updates itself (3g).
145
145
 
146
146
  ### 3a. Community totals (telemetry) — ON by default for fresh installs
147
147
 
@@ -342,20 +342,36 @@ removing `webhook.url`.
342
342
 
343
343
  ### 3g. Desktop dashboard auto-update — the optional Electron app only
344
344
 
345
- **Source:** `dashboard/main.js` (`initAutoUpdater`, electron-updater). The npm
346
- CLI package never auto-updates. The *separate* desktop dashboard app, if you
345
+ **Source:** `dashboard/main.js` (`initAutoUpdater`, electron-updater). The *separate* desktop dashboard app, if you
347
346
  install it, polls GitHub Releases hourly and downloads + installs updates on
348
347
  quit (`autoDownload` / `autoInstallOnAppQuit`) over HTTPS. The release binaries
349
348
  are currently **unsigned**, so update integrity rests on GitHub Releases + TLS
350
349
  rather than a code signature — a known gap tracked for provenance + published
351
350
  checksums. Avoid it by not installing the dashboard.
352
351
 
352
+ ### 3h. CLI auto-update — ON by default, npm global installs only
353
+
354
+ **Source:** `src/updater.js`, called from the daemon; settings in
355
+ `default-config.js` (`update`). Every ~6 hours the daemon sends one plain
356
+ `GET https://registry.npmjs.org/claude-rpc/latest` (no identifiers, no
357
+ payload) and reads the `version` field. If a newer **same-major** release
358
+ exists and this copy was installed with `npm install -g`, it runs
359
+ `npm install -g claude-rpc@<exact version>` and restarts itself — the same
360
+ package, same npm integrity and provenance checks as a manual install.
361
+ Homebrew, `npx`, the packaged exe and source checkouts are never modified (they
362
+ only log that an update exists). A new major version is never installed
363
+ unattended, a failed install is not retried for 24 hours, and the version
364
+ string is validated as `x.y.z` before it reaches the command line.
365
+ **Turn it off:** `claude-rpc update off` (or `update.auto: false`).
366
+ `claude-rpc update` checks by hand; `claude-rpc update now` installs.
367
+
353
368
  ## 4. Local subprocesses
354
369
 
355
370
  Every binary the package can spawn, with its trigger and argument shape. All
356
371
  arguments are static constants or values we control — none interpolate
357
372
  untrusted or remote input into a shell:
358
373
 
374
+ - `npm install -g claude-rpc@<x.y.z>` — auto-update / `update now` (`src/updater.js`, 3h).
359
375
  - `reg.exe add/delete` — the Windows Run key (`src/install.js`).
360
376
  - `wscript.exe` — runs the generated windowless startup shim (`src/install.js`).
361
377
  - `powershell.exe -NoProfile -NonInteractive -EncodedCommand …` — packaged
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-rpc",
3
- "version": "1.5.4",
3
+ "version": "1.7.0",
4
4
  "description": "Discord Rich Presence for Claude Code — live model, project, tokens, and lifetime stats driven by Claude Code's hook system.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -32,6 +32,7 @@
32
32
  "dist:mac": "npm run build:exe && npm run prep:dashboard && npm --prefix dashboard run dist:mac",
33
33
  "dist:win": "npm run build:exe && npm run prep:dashboard && npm --prefix dashboard run dist:win",
34
34
  "test": "node ./scripts/run-tests.mjs",
35
+ "release": "node ./scripts/release.mjs",
35
36
  "lint": "eslint src test vscode-extension",
36
37
  "format": "prettier --write \"src/**/*.js\" \"test/**/*.js\"",
37
38
  "format:check": "prettier --check \"src/**/*.js\" \"test/**/*.js\"",