codeburn/app
ozymandiashh e07985f67a
Some checks failed
CI / semgrep (push) Waiting to run
Tests / test (22) (push) Waiting to run
Tests / test (22.13.0) (push) Waiting to run
Tests / test (24) (push) Waiting to run
Tests / test (26) (push) Waiting to run
Tests / test-platforms (macos-latest) (push) Waiting to run
Tests / test-platforms (windows-latest) (push) Waiting to run
Tests / desktop (push) Waiting to run
Windows Menubar CI / check (ubuntu-latest) (push) Has been cancelled
Windows Menubar CI / check (windows-latest) (push) Has been cancelled
Claude quota: recover the credential from the source it came from (#1516)
* fix(quota): recover the Claude credential from the source it came from

Both Claude quota providers resolve the OAuth credential from
~/.claude/.credentials.json and fall back to the macOS Keychain, which is
where Claude Code keeps it on a normal Mac. Every recovery re-read went to
the file whatever the credential had come from, so for a Keychain user it
read nothing and the one place a renewed token can appear was never
consulted: a lapsed login left the retry a dead end indefinitely.

A recovery now re-reads whichever store the credential came from. When it
cannot recover - the credential is unchanged and its expiresAt has passed -
the provider reports terminalFailure with a line telling the user to run
Claude Code once, rather than the transientFailure the desktop app's quota
cards hold the last connected numbers through. A 401 on a credential still
within its life keeps its transient handling and its backoff.

The desktop app carries its own copy of this provider, where the same
file-only re-read sat in two branches - the 401 and the one that re-reads a
credential within five minutes of expiry - and both are fixed.

* fix(quota): keep keychain reads on forced refresh and hold reconnect prompt

Drop the near-expiry keychain re-read from the desktop provider; a keychain
credential is re-read only after a 401, which only a forced refresh reaches.
Hold terminalFailure through keychainUnchecked background polls.

---------

Co-authored-by: review-bot <resham0209@gmail.com>
2026-09-23 18:16:23 +02:00
..
build 0.9.25: correctness, energy, menu bar and installer fixes (#1511) 2026-09-21 00:16:21 +02:00
electron Claude quota: recover the credential from the source it came from (#1516) 2026-09-23 18:16:23 +02:00
flathub chore: plain DMG window and the Flathub hash for desktop-v0.9.25 (#1519) 2026-09-21 23:44:30 +02:00
renderer 0.9.25 round 2: fixes found testing the built apps (#1517) 2026-09-21 13:53:45 +02:00
scripts fix(app): stage the CLI closure without anchoring on the checkout's absolute path (#1473) 2026-09-18 04:59:38 -07:00
.gitignore feat(app): ship the tray app with the Windows desktop builds 2026-09-02 04:48:03 -07:00
demo-bridge.mjs fix(app): pass --min-cost 0 so Models shows sub-cent and unpriced rows (#1474) 2026-09-18 04:12:27 -07:00
DISTRIBUTION.md 0.9.25: correctness, energy, menu bar and installer fixes (#1511) 2026-09-21 00:16:21 +02:00
package-lock.json chore: release 0.9.25 (#1518) 2026-09-21 18:33:28 +02:00
package.json chore: plain DMG window and the Flathub hash for desktop-v0.9.25 (#1519) 2026-09-21 23:44:30 +02:00
README.md chore: release 0.9.25 (#1518) 2026-09-21 18:33:28 +02:00
tsconfig.electron.json feat(app): scaffold Electron+Vite package and codeburn CLI spawn 2026-07-10 15:16:55 -07:00
tsconfig.json fix(app): clean build stamp, splash without hash, About checks for updates 2026-07-17 14:30:00 -07:00
vite.config.ts Restore the standard desktop development port 2026-09-12 13:09:00 -07:00
vitest.config.ts 0.9.25: correctness, energy, menu bar and installer fixes (#1511) 2026-09-21 00:16:21 +02:00

CodeBurn Desktop

Electron desktop shell for CodeBurn's local-first usage views. M1 runs as a developer app and reads data by spawning the installed codeburn CLI; it does not run a daemon or HTTP server.

Development

npm --prefix app install
npm --prefix app run dev

Validation:

npm --prefix app run test
npm --prefix app run typecheck

CLI Dependency

Packaged builds ship their own version-matched copy of the codeburn CLI and require nothing installed — the app spawns the bundled CLI with Electron's own binary as Node (ELECTRON_RUN_AS_NODE). In development (Vite dev server) the app uses the repo's freshly-built CLI, and either can be overridden with CODEBURN_BIN or a persisted path file. See DISTRIBUTION.md for the bundling and resolution details. Electron resolves and spawns the CLI from the main process, then sends decoded JSON through the secure preload bridge into the renderer.

This follows the menubar pattern:

  • contextIsolation: true, nodeIntegration: false, and sandbox: true.
  • Renderer code calls window.codeburn only through app/renderer/lib/ipc.ts.
  • Main process handlers return JSON envelopes so structured CLI errors survive IPC.
  • Missing CLI, bad JSON, timeout, and nonzero exits are surfaced as honest UI states.
  • The renderer never imports CodeBurn engine code from src/; the data contract is spawn CLI, decode JSON, poll.

Data Contract

Current bridge calls:

  • Overview: codeburn status --format menubar-json --period <period> [--provider <provider>]
  • Plans: codeburn status --format json --period <period>
  • Models: codeburn models --format json --period <period> [--provider <provider>] [--by-task]
  • Optimize: codeburn yield --format json --period <period>
  • Spend flow: codeburn spend --format flow-json --period <period> [--provider <provider>]
  • Devices: codeburn devices --format json --period <period>
  • Device scan: codeburn devices scan --format json
  • Share status: codeburn share status --format json
  • Identity: codeburn identity --format json

Supported M1 periods are today, week, 30days, month, and all. Provider filtering is passed through where the CLI command supports it.

Refresh tiers

Not every call runs at the same cadence. The headline overview is the only live poll; it asks for neither optimize findings nor a fresh act report. act report refreshes on mount, on a manual refresh, and every 10 minutes; yield every 5. The optimize scan runs at most once a day per query scope, is stored in userData with the time it was computed, is reused only on the same local day, and is forced fresh by the Optimize page or a manual refresh. A figure that is not live is shown with its age. On battery the live interval doubles. While the window is hidden the app stops polling and animating altogether, and catches up immediately when it comes back.

The CLI is spawned once as a resident codeburn serve --stdio child rather than per request. After 15 idle minutes it is retired and the next request starts a new resident; CODEBURN_SERVE_IDLE_MS tunes or disables that.

Sections

  • Overview: daily spend, spend stats, waste summary, and expensive sessions from menubar-json.
  • Spend: project/activity/tool/MCP/subagent lenses plus model-to-project flow.
  • Optimize: waste findings from menubar-json and reverted/abandoned yield data.
  • Models: model and task tables from models --format json.
  • Plans: plan pacing from status --format json.
  • Settings: device identity, nearby scan results, paired-device usage, and M2 visual affordances.

Packaging

npm run package produces a macOS .dmg/.zip (arm64 and x64) via electron-builder. Release builds are signed with a Developer ID Application certificate and notarized by Apple (ad-hoc signing is only a fallback when no signing identity is configured). Packaging rebuilds the root CLI and bundles it into the app (Resources/cli), so installs need nothing on the target machine. See DISTRIBUTION.md for build instructions, the bundled-CLI mechanism, artifact locations, and the notarization process.

M2 Backlog

  • Add Electron autoUpdater (the app already bundles its own version-matched CLI, so end-user installs need nothing on the machine; auto-update is the remaining piece).
  • Keep npm as a separate CLI-user channel at the same version as the desktop app.
  • Add a codeburn desktop launcher subcommand.
  • Implement in-app pairing, approve, pull, and visibility mutations currently shown as M2 affordances.
  • Build the Models Compare sheet.
  • Expand codeburn optimize --format json with evidence and fix commands so Optimize can show richer actionable fixes.