Skip to content

Commit ff4cefd

Browse files
committed
Update README to new Codex story
1 parent b9d12a6 commit ff4cefd

1 file changed

Lines changed: 64 additions & 50 deletions

File tree

README.md

Lines changed: 64 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,49 @@
1-
# Codex Account Manager
1+
# Codex Manager
22

3-
Manage multiple Codex accounts from one UI: switch the active `~/.codex/auth.json`, group accounts by status, and keep an eye on usage/refresh.
3+
A Zig-first desktop/web account manager for Codex with typed RPC, deterministic launch modes, and automatic quota-state transitions.
44

5-
Built with SolidJS (frontend) + Zig (backend), rendered locally through WebUI Zig (SmallThingz/webui).
5+
![Zig](https://img.shields.io/badge/Zig-0.15.2+-f7a41d?logo=zig&logoColor=111)
6+
![Frontend](https://img.shields.io/badge/Frontend-SolidJS-2c4f7c)
7+
![Runtime](https://img.shields.io/badge/Runtime-WebUI_Zig-111827)
8+
![Modes](https://img.shields.io/badge/Modes-webview%20%7C%20browser%20%7C%20web-0f766e)
69

7-
## What It Does
10+
## ⚡ Features
811

9-
- Manage multiple accounts in one place (active / depleted / frozen)
10-
- Switch the active account instantly (updates `~/.codex/auth.json`)
11-
- Drag-and-drop reorder between buckets
12-
- Pull usage/credits and show refresh timing
13-
- Light/dark theme with persistence
12+
- Multi-account management with clear buckets: `active`, `depleted`, `frozen`.
13+
- Fast account switching (updates `~/.codex/auth.json`).
14+
- Drag-and-drop account movement across buckets.
15+
- Per-account usage refresh with immediate card updates.
16+
- Quota-driven lifecycle rules:
17+
- `0` remaining quota in active => auto-move to depleted.
18+
- non-zero quota in depleted => auto-move back to active.
19+
- Auto-refresh support for active and depleted flows.
20+
- Theme + UI preference persistence.
1421

15-
## Quick Start
16-
17-
### Dev
22+
## 🚀 Quick Start
1823

1924
```bash
2025
zig build dev
2126
```
2227

23-
This runs the frontend build (npm + Vite) and starts the app.
24-
25-
### Modes
28+
This runs frontend build steps (TypeScript + Vite) and launches the app.
2629

27-
- Default: desktop-ish window (Chromium app-window when available)
28-
- Force web mode:
30+
### Launch Modes
2931

3032
```bash
33+
zig build dev -- --webview
34+
zig build dev -- --browser
3135
zig build dev -- --web
3236
```
3337

34-
If the app prints a `http://127.0.0.1:...` URL, you can always open it manually in any browser.
38+
- `--webview`: prefer native webview surface.
39+
- `--browser`: prefer app-window/browser-window mode.
40+
- `--web`: open in a normal browser tab.
3541

36-
## Requirements
42+
Default (no flag) uses ordered fallback: `webview -> browser window -> web tab`.
3743

38-
Build-time:
39-
- Zig `0.15.2+`
40-
- Node.js `20+`
41-
- `npm`
44+
## 📦 Build / Install
4245

43-
Runtime:
44-
- `curl` in `PATH`
45-
- `codex` CLI in `PATH`
46-
- A browser installed (Chromium-family recommended for the best desktop window behavior)
47-
48-
## Build / Install
49-
50-
Optimized local install:
46+
Optimized install:
5147

5248
```bash
5349
zig build install -Doptimize=ReleaseFast
@@ -60,39 +56,57 @@ Run:
6056
./zig-out/bin/codex-manager --web
6157
```
6258

63-
Build the release matrix (writes to `zig-out/bin/`):
59+
Build release matrix:
6460

6561
```bash
6662
zig build build-all-targets
6763
```
6864

69-
## How It Works (High Level)
65+
## 🧰 Requirements
66+
67+
Build-time:
68+
69+
- Zig `0.15.2+`
70+
- Node.js `20+`
71+
- `npm`
72+
73+
Runtime:
74+
75+
- `curl` in `PATH`
76+
- `codex` CLI in `PATH`
77+
- Browser installed (Chromium-family recommended for desktop-window behavior)
78+
79+
## 🧠 Architecture (At a Glance)
80+
81+
- **Frontend**: SolidJS SPA (`frontend/`).
82+
- **Backend**: Zig app (`src/`) serving local UI + handling all account state mutations.
83+
- **Bridge**: typed WebUI RPC surface via `webuiRpc.cm_rpc(...)`.
84+
- **State ownership**: backend-authoritative persistence for account/view/usage data.
85+
86+
## 🗂️ Storage
7087

71-
- The Zig backend serves a local HTTP UI on `127.0.0.1` and exposes typed RPC.
72-
- The frontend calls back into Zig via `globalThis.webui.call("cm_rpc", requestJson)` (with HTTP fallback to `/rpc`).
73-
- Account state is stored locally; switching updates `~/.codex/auth.json`.
88+
Local app data directory:
7489

75-
## Storage
90+
- `accounts.json` — managed account records
91+
- `bootstrap-state.json` — boot snapshot + UI cache
92+
- `ui-theme.txt` — theme selection
7693

77-
Local app data directory files:
78-
- `accounts.json` (managed accounts)
79-
- `bootstrap-state.json` (UI bootstrap cache)
80-
- `ui-theme.txt` (theme selection)
94+
Codex auth target:
8195

82-
Active Codex auth target:
8396
- `~/.codex/auth.json`
8497

85-
## Testing
98+
## Testing
8699

87100
```bash
88101
zig build test
89102
```
90103

91-
## Troubleshooting
104+
## 🔎 Troubleshooting
92105

93-
- UI opens but looks blank:
94-
- Use the printed `http://127.0.0.1:...` URL in a browser to confirm the server is reachable.
95-
- `Backend RPC unavailable in this session`:
96-
- Launch through the app (`zig build dev`) and make sure `/webui.js` loads.
97-
- Desktop window does not appear:
98-
- Ensure a Chromium-based browser is installed (Chrome/Chromium/Brave/Edge).
106+
- App prints URL but no window appears:
107+
- Open the printed `http://127.0.0.1:...` URL directly in your browser.
108+
- Native webview mode fails on Linux:
109+
- Verify your WebKitGTK runtime/tooling for your distro.
110+
- Use `--browser` or `--web` as fallback.
111+
- RPC bridge unavailable at startup:
112+
- Ensure `webui_bridge.js` is injected and loaded by the served page.

0 commit comments

Comments
 (0)