* fix(pr): a subagent whose description names a PR folds into that PR A subagent run folded into whatever PR its parent's last pr-link carried, so review runs for #1703, #1712, #1728 and #1729 landed on a stale closed #24. The Agent description ("Review PR 1729 ...") is now read from the subagent's .meta.json at report time; a single PR it names outranks the carried PR. * fix(pr): date each PR by its own turns and count its agent runs Every PR row carried the whole session's first and last timestamp, so one long orchestrator session stamped the same span and "1 session" on all of them. Rows now span their first to last attributed turn or folded run, and a new `runs` field counts contributing sessions plus folded subagent runs. * feat(pr): local one-shot, follow-up rounds, review runs, merge time and cost split per PR Each PR row now carries signals read from cached commands, no GitHub calls: openedAt (gh pr create paired with the PR's first pr-link), follow-up rounds (pushes naming its --head branch, or from a run whose description names it, in 10-minute bursts), oneShot only when the open and its branch were seen, reviewRuns and reviewCostUSD, mergedAt and timeToMergeMs, a build/review/fixes cost split that sums to the row, and linkEvidence to flag pr-link-only rows. * feat(session-why): PRs the session opened, their follow-up rounds and review runs The why view now carries prWork: each gh pr create whose output printed a PR URL, the pushes after it on its --head branch (or from a helper whose description names that PR) in 10-minute rounds, and the helpers that read a PR without committing or pushing, with their cost. * perf(pr): only parse commands that can name a push or a PR * feat(app): local PR facts on PR cards and PR work in the session view Each PR card gets one line of facts from the CLI's local signals: the review run and its cost, one shot or follow-up rounds, and merge time after open. Unknowns are left out; a pr-link-only row says so. The count shows agent runs instead of sessions. The expanded card splits spend into building, review runs and after first review, and lists the review runs. The session view lists the PRs it opened and the review runs it spawned. * perf(pr): read subagent descriptions only for PR attribution Every report, status and menubar refresh read each subagent's .meta.json (about 2,000 files in 30 days) and the cross-provider correlation scanned every folded run's commands for PR signals it never uses. Sessions now carry the sidecar path; the description is read on demand, memoized by mtime, only for folded runs and runs that push, and correlation skips the command scan. The by-pr footer now counts runs to match the Runs column. |
||
|---|---|---|
| .. | ||
| build | ||
| electron | ||
| flathub | ||
| renderer | ||
| scripts | ||
| .gitignore | ||
| demo-bridge.mjs | ||
| DISTRIBUTION.md | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.electron.json | ||
| tsconfig.json | ||
| vite.config.ts | ||
| vite.vscode.config.ts | ||
| vitest.config.ts | ||
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, andsandbox: true.- Renderer code calls
window.codeburnonly throughapp/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-jsonand 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 desktoplauncher subcommand. - Implement in-app pairing, approve, pull, and visibility mutations currently shown as M2 affordances.
- Build the Models Compare sheet.
- Expand
codeburn optimize --format jsonwith evidence and fix commands so Optimize can show richer actionable fixes.