codex-usage-dashboard 0.1.3 → 0.1.4

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
@@ -1,135 +1,8 @@
1
- # Codex Usage Dashboard
1
+ # codex usage
2
2
 
3
- Multi-user Codex usage tracking with a Vercel-hosted dashboard, Supabase Auth, and both direct `npx` connect and website pairing flows.
3
+ i cycle between multiple codex accounts and wanted to keep track of them so i created this
4
4
 
5
- ## Stack
5
+ website: https://codexusage.vercel.app
6
+ installation: `npx codex-usage-dashboard@latest connect --site "https://codexusage.vercel.app"`
6
7
 
7
- - Vite + TanStack Router + React Query
8
- - Supabase Auth + Postgres
9
- - Vercel Functions for pairing and sync ingest
10
- - Local Codex access through a bundled `@openai/codex` `app-server`
11
-
12
- ## What changed
13
-
14
- This repo no longer treats the dashboard as a public read-only board.
15
-
16
- - Users can start from the website with Google, or from the terminal with a one-line `npx` command.
17
- - The direct terminal path provisions a dashboard session, opens the browser, and stores the local sync token under `CODEX_HOME`.
18
- - The website pairing flow is still available and now emits `npx` commands instead of `curl | node`.
19
- - Vercel receives sync payloads and writes them to Supabase with the service-role key.
20
- - Row-level security keeps each signed-in user scoped to their own accounts and snapshots.
21
-
22
- ## Local setup
23
-
24
- 1. Start Docker Desktop.
25
- 2. Run `npm install`.
26
- 3. Run `npm run setup:local`.
27
- 4. Run `supabase db reset`.
28
- 5. Run `npm run dev`.
29
- 6. Open `http://localhost:5173`.
30
-
31
- The Vite dev server now serves the local pairing and sync API routes under `/api/*`.
32
-
33
- ## Hosted setup
34
-
35
- 1. Link the repo to a hosted Supabase project with `supabase link --project-ref <ref>`.
36
- 2. Run `npm run setup:hosted`.
37
- 3. Set these Vercel environment variables:
38
- - `SUPABASE_URL`
39
- - `SUPABASE_SERVICE_ROLE_KEY`
40
- - `VITE_SUPABASE_URL`
41
- - `VITE_SUPABASE_ANON_KEY`
42
- 4. In Supabase Auth settings, enable `Manual linking` if you want guest dashboard sessions to upgrade into Google later.
43
- 5. If you want the website-first flow, enable the Google provider in Supabase Auth.
44
- 6. Deploy to Vercel.
45
-
46
- `npm run setup:hosted` now writes the local env files and pushes any pending hosted Supabase migrations.
47
-
48
- ## Direct connect flow
49
-
50
- Run this on any machine:
51
-
52
- ```bash
53
- npx codex-usage-dashboard@latest connect --site "https://codex-use-age.vercel.app"
54
- ```
55
-
56
- For local development in this repo, use:
57
-
58
- ```bash
59
- npm run connect -- --site "http://localhost:5173"
60
- ```
61
-
62
- The package now brings a compatible `@openai/codex` CLI dependency with it, so `connect`, `pair`, and `sync` do not require a separate global Codex install.
63
-
64
- If the machine has never logged into Codex before, authenticate once with:
65
-
66
- ```bash
67
- npx @openai/codex@latest login
68
- ```
69
-
70
- That command:
71
-
72
- - starts a local `codex app-server`
73
- - reads the current Codex account and rate limits
74
- - provisions a dashboard owner session without requiring Google first
75
- - opens the hosted dashboard in the browser
76
- - stores the device token under `CODEX_HOME` in `codex-usage-sync.json`
77
- - pushes the first snapshot to the dashboard
78
-
79
- If the same machine is already connected, rerun the same command to reopen the dashboard and refresh the local snapshot.
80
-
81
- ## Website pairing flow
82
-
83
- 1. Sign in on the website.
84
- 2. Click `Create pairing command`.
85
- 3. Run the generated command on the machine you want to pair.
86
-
87
- The generated command looks like:
88
-
89
- ```bash
90
- npx codex-usage-dashboard@latest pair "https://codex-use-age.vercel.app/api/pair/complete?token=..."
91
- ```
92
-
93
- ## Live sync after pairing
94
-
95
- To keep syncing from that machine:
96
-
97
- ```bash
98
- npx codex-usage-dashboard@latest sync --watch
99
- ```
100
-
101
- The saved device token is read from the same Codex home that the CLI uses.
102
-
103
- ## Dev scripts
104
-
105
- - `npm run connect -- --site "<site-url>"`: local version of the direct connect command
106
- - `npm run pair -- "<pair-url>"`: local version of the hosted pairing command
107
- - `npm run sync -- --watch`: local version of the hosted sync command
108
- - `npm run collector`: legacy single-operator collector script
109
-
110
- ## Publishing
111
-
112
- 1. Run `npm version patch` (or `minor` / `major`) before every new publish.
113
- 2. Run `npm run release:check` to verify the tarball contents and confirm the version is still unpublished.
114
- 3. Run `npm publish`.
115
-
116
- `npm publish` cannot overwrite an existing version on npm, so repeating a publish for the same version will fail with `E403`.
117
-
118
- ## Tario-specific Git workflow for Codex
119
-
120
- If the current machine or user context indicates Tario is the operator, treat that as a master-by-default environment.
121
-
122
- - Use the local machine identity to decide this.
123
- - Treat `scutil --get ComputerName` returning `tario` as the primary signal.
124
- - Treat `/Users/tarioyou` and the local user `tarioyou` as reinforcing signals.
125
- - In that Tario context, unless otherwise specified, work directly on `master`.
126
- - If the user explicitly says to work on a branch, create or switch to that branch and work there.
127
- - Do not create, switch to, or push feature branches by default.
128
- - Do not default to PR-first workflows or branch-based workflows unless the user asks for them.
129
- - This rule is specific to Tario's environment; when the operator is not Tario, normal branch workflows remain allowed.
130
-
131
- ## Notes
132
-
133
- - The Vercel API routes live in `api/`.
134
- - Pairing and device state live in `codex_pairing_sessions` and `codex_devices`.
135
- - Existing rows without an owner remain in the database but are hidden by RLS from signed-in users.
8
+ ![Codex usage](./public/codexusage.png)
@@ -359,7 +359,7 @@ async function runConnectCommand(args) {
359
359
 
360
360
  if (!siteOrigin) {
361
361
  throw new Error(
362
- `This device was unlinked from the dashboard. Rerun \`${NPX_COMMAND} connect --site "https://codex-use-age.vercel.app"\` to create a new connection.`,
362
+ `This device was unlinked from the dashboard. Rerun \`${NPX_COMMAND} connect --site "<dashboard-url>"\` to create a new connection.`,
363
363
  )
364
364
  }
365
365
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "codex-usage-dashboard",
3
3
  "private": false,
4
- "version": "0.1.3",
4
+ "version": "0.1.4",
5
5
  "files": [
6
6
  "README.md",
7
7
  "bin"