Skip to content

feat(providers): codemie install codenotch + budget plugin bridge - #569

Open
8nevil8 wants to merge 4 commits into
mainfrom
feat/codenotch-plugin
Open

8nevil8 wants to merge 4 commits into
mainfrom
feat/codenotch-plugin

Conversation

@8nevil8

@8nevil8 8nevil8 commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

codemie install codenotch installs Codenotch (the macOS notch app for AI usage) from its latest GitHub release, and codemie install codenotch --budget-plugin additionally registers CodeMie Budget and CodeMie Claude as native providers in it — fed by the user's existing CodeMie profile, with no separate sign-in and no separate binary to install.

The companion Codenotch PR (vinzdg/codenotch#255) adds the runtime plugin system this integrates with; the contract is docs/design/plugin-protocol.md there.

Changes

  • Install/uninstallcodemie install codenotch downloads the latest Codenotch.dmg from GitHub releases and installs it to /Applications (stops a running instance first); codemie uninstall codenotch removes the app and unregisters the providers. macOS-only, with a clear error elsewhere.
  • --budget-plugin — writes the two provider manifests + glyphs into ~/Library/Application Support/Codenotch/Plugins/ (idempotent). Codenotch watches that directory and picks the providers up live; both render natively and can be toggled, reordered, or deleted like built-in providers.
  • The bridge — the providers' exec target is the CLI itself: a hidden, internal codemie codenotch snapshot --provider <id> command. It reads the active profile and the CLI's own SSO credential store (first-party CredentialStore/ConfigLoader), calls the same GET {baseUrl}/v1/analytics/budget_usage the statusline uses, and prints the protocol JSON on stdout with protocol exit codes (3 auth / 4 rate-limited / 5 nothing metered). A 60 s on-disk cache keeps Codenotch's polling off the backend; raw rows are re-parsed on read so caches stay interchangeable.
  • Providerscodemie-budget: every budget bucket on the account with a synthesized Total headline (spent / remaining / reset). codemie-claude: the same buckets shaped like Codenotch's usual Claude provider (headline = the CLI bucket sessions spend from) plus live session activity via Codenotch's claudeSessions monitor on ~/.claude.
  • Release cycle — the bridge ships inside the regular @codemieai/code npm package; no Swift toolchain, no separate package, nothing to clone. (This supersedes the earlier standalone Swift plugin draft on this branch, which is removed.)

Testing

  • npm run ci (lint, build, unit + cli projects) green; the 4 failures in tests/integration/sso-claude-plugin.test.ts are pre-existing on origin/main (verified identical failure set on a pristine main worktree).
  • End-to-end on a real CodeMie SSO account: both bridge payloads (total + per-bucket windows, correct figures), the full install codenotch --budget-plugin flow (release download, app install, registration), and a running Codenotch rendering fresh data through the bridge — including disable/enable and unregister→register without an app restart.

Checklist

  • Self-reviewed
  • Manual testing performed (live Codenotch app on a real account)
  • Documentation updated (docs/CODENOTCH.md, docs/AGENTS.md entry, docs/COMMANDS.md entry, three new tips.json entries; AGENTS.md now codifies tips+docs with every command change)
  • No breaking changes (additive; install/uninstall gain a codenotch case)

…pending

Standalone Codenotch plugin (SwiftPM, no deps) that registers two
providers in the Codenotch macOS notch app from the user's existing
CodeMie CLI setup — no separate sign-in:

- codemie-budget: every budget bucket on the account with a Total
  headline summing them (spent / remaining / reset)
- codemie-claude: per-bucket session spending (CLI / platform /
  premium) shaped like Codenotch's usual Claude provider, plus live
  session activity via a claudeSessions monitor on ~/.claude

Reads ~/.codemie config and decrypts CodeMie's own SSO credential
store (AES-256-GCM + legacy CBC, key from hostname+platform+arch
exactly as the statusline — os.hostname(), not ProcessInfo.hostName),
then calls the same /v1/analytics/budget_usage endpoint the statusline
uses, with a 60s on-disk cache to spare the backend.

Registration is one command — 'codemie-codenotch register' writes the
plugin manifests Codenotch watches for; 'unregister' removes them.
Lives outside the npm build by design so any distribution channel
(npm wrapper, brew, direct download) can ship it untouched.

49 swift-testing tests cover config parsing, GCM+CBC round-trips, row
matching, payload shapes, cache behaviour, exit codes and register
idempotency. Verified live against a real CodeMie SSO account:
rings, tooltip money rows, settings rows, disable/enable and
unregister→register all without an app restart.
@8nevil8
8nevil8 force-pushed the feat/codenotch-plugin branch from e55da48 to ccbfedd Compare September 18, 2026 10:03
Replaces the standalone Swift package with an integration that ships in
the regular CLI build:

- codemie install codenotch downloads the latest Codenotch release from
  GitHub and installs it to /Applications; codemie uninstall codenotch
  removes it again.
- codemie install codenotch --budget-plugin additionally registers the
  CodeMie Budget and CodeMie Claude providers with Codenotch, which
  picks them up live (no app restart). Both render natively and can be
  toggled, reordered or removed like built-in providers.
- The providers' exec target is the CLI itself: a hidden, internal
  'codemie codenotch snapshot --provider <id>' bridge reads the active
  profile and the CLI's own SSO credential store, calls the same
  budget_usage endpoint the statusline uses (60s on-disk cache, raw rows
  re-parsed on read so caches stay interchangeable), and prints the
  plugin-protocol JSON. Protocol exit codes: 3 auth, 4 rate-limited,
  5 nothing metered.

No separate binary, no npm package of its own, no Swift toolchain —
every CLI release carries the bridge.

Verified end-to-end on a real CodeMie SSO account: both bridge payloads
(totals and per-bucket windows), the full install flow, and a running
Codenotch rendering fresh data through the bridge.
@8nevil8 8nevil8 changed the title feat(providers): add codenotch plugin for budget and Claude session spending feat(providers): codemie install codenotch + budget plugin bridge Sep 18, 2026
8nevil8 and others added 2 commits September 18, 2026 14:04
…r command changes

- tips.json gains three entries for the codenotch integration (install,
  --budget-plugin, manage/uninstall) so the feature is discoverable
  through session tips and 'codemie tips' — all validated against the
  live command tree.
- docs/COMMANDS.md documents 'codemie install/uninstall codenotch' with
  the --budget-plugin flag.
- AGENTS.md codifies the rule: any change to a user-visible command or
  flag updates src/utils/tips.json and docs/COMMANDS.md (plus
  docs/AGENTS.md for installable agents) in the same PR — a command
  change without its tips and docs is an incomplete change.
…e provider

Registers one provider instead of two: the budget-only "CodeMie Budget"
manifest is gone and "CodeMie Usage" (codemie-claude) now carries every
budget bucket, led by the CLI bucket, plus live session activity.

Register and unregister both prune the retired codemie-budget plugin
directory, so an earlier registration stops polling a provider id the
bridge now rejects. Docs, tips and install output follow the new name.

Generated with AI

Co-Authored-By: codemie-ai <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant