From c57c7034c9527941aa8ae2c2db432b7051dc6436 Mon Sep 17 00:00:00 2001 From: Iain Date: Fri, 9 Oct 2026 18:24:57 +0100 Subject: [PATCH] chore: rename the repo to token-usage-dashboard --- .env.example | 2 +- .github/CONTRIBUTING.md | 8 +++---- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- .github/ISSUE_TEMPLATE/config.yml | 10 ++++----- .github/ISSUE_TEMPLATE/feature_request.yml | 4 ++-- .github/README.md | 22 +++++++++---------- .github/SECURITY.md | 2 +- .github/SUPPORT.md | 16 +++++++------- .github/workflows/release.yml | 4 ++-- Dockerfile | 2 +- ...-dashboard.js => token-usage-dashboard.js} | 2 +- docker/compose.yaml | 8 +++---- package-lock.json | 2 +- package.json | 10 ++++----- scripts/install.sh | 8 +++---- ....service => token-usage-dashboard.service} | 4 ++-- src/lib/logos/Logo.svelte | 2 +- src/lib/server/config.ts | 7 +++++- src/routes/+page.svelte | 4 ++-- 19 files changed, 62 insertions(+), 57 deletions(-) rename bin/{ai-usage-dashboard.js => token-usage-dashboard.js} (98%) rename scripts/{ai-usage-dashboard.service => token-usage-dashboard.service} (69%) diff --git a/.env.example b/.env.example index 41b7c5f..73a0a6b 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,6 @@ # Everything here is optional. Defaults are in brackets. -# Where the history database lives [~/.local/share/ai-usage-dashboard/usage.db] +# Where the history database lives [~/.local/share/token-usage-dashboard/usage.db] # AIUSAGE_DB=/data/usage.db # Where each tool keeps its transcripts, if you moved them diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 9d54cf2..ae96cda 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -7,8 +7,8 @@ Bug reports, typo fixes and whole features are all welcome. By joining in, you a ## Ways to contribute -- 🐛 **Report a bug** - open a [bug report](https://github.com/NotAFlightRisk/ai-usage-dashboard/issues/new?template=bug_report.yml) -- 💡 **Suggest a feature** - open a [feature request](https://github.com/NotAFlightRisk/ai-usage-dashboard/issues/new?template=feature_request.yml) +- 🐛 **Report a bug** - open a [bug report](https://github.com/NotAFlightRisk/token-usage-dashboard/issues/new?template=bug_report.yml) +- 💡 **Suggest a feature** - open a [feature request](https://github.com/NotAFlightRisk/token-usage-dashboard/issues/new?template=feature_request.yml) - 📖 **Improve the docs** - typos, unclear wording and missing examples are all fair game - 🔧 **Submit a fix** - see below - 🔒 **Report a vulnerability** - please _don't_ open a public issue, see [SECURITY.md](./SECURITY.md) @@ -18,8 +18,8 @@ Bug reports, typo fixes and whole features are all welcome. By joining in, you a ## Getting started ```bash -git clone git@github.com:NotAFlightRisk/ai-usage-dashboard.git -cd ai-usage-dashboard +git clone git@github.com:NotAFlightRisk/token-usage-dashboard.git +cd token-usage-dashboard npm install npm run dev ``` diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 7421736..33f64b6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -78,5 +78,5 @@ body: required: true - label: I am running the latest version required: true - - label: I agree to follow this project's [Code of Conduct](https://github.com/NotAFlightRisk/ai-usage-dashboard/blob/main/.github/CODE_OF_CONDUCT.md) + - label: I agree to follow this project's [Code of Conduct](https://github.com/NotAFlightRisk/token-usage-dashboard/blob/main/.github/CODE_OF_CONDUCT.md) required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index f0e93ca..a034727 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -8,21 +8,21 @@ blank_issues_enabled: false contact_links: - name: 🔒 Report a Security Vulnerability - url: https://github.com/NotAFlightRisk/ai-usage-dashboard/security/policy + url: https://github.com/NotAFlightRisk/token-usage-dashboard/security/policy about: Never report vulnerabilities in a public issue. Read our security policy and disclose privately. - name: 📖 Documentation - url: https://github.com/NotAFlightRisk/ai-usage-dashboard/blob/main/.github/README.md + url: https://github.com/NotAFlightRisk/token-usage-dashboard/blob/main/.github/README.md about: Usage, configuration and deployment docs. Worth checking before filing. - name: 🙋 Support & Troubleshooting - url: https://github.com/NotAFlightRisk/ai-usage-dashboard/blob/main/.github/SUPPORT.md + url: https://github.com/NotAFlightRisk/token-usage-dashboard/blob/main/.github/SUPPORT.md about: Not sure where something belongs? This explains where to ask what. - name: 💬 Questions & Ideas - url: https://github.com/NotAFlightRisk/ai-usage-dashboard/discussions + url: https://github.com/NotAFlightRisk/token-usage-dashboard/discussions about: Ask a question, share an idea, or show what you've built. - name: 🛠️ Contributing Guide - url: https://github.com/NotAFlightRisk/ai-usage-dashboard/blob/main/.github/CONTRIBUTING.md + url: https://github.com/NotAFlightRisk/token-usage-dashboard/blob/main/.github/CONTRIBUTING.md about: Want to fix it yourself? Start here for setup and the PR workflow. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 58d218f..29529e3 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -6,7 +6,7 @@ body: - type: markdown attributes: value: | - Thanks for the suggestion! Please [search existing issues and discussions](https://github.com/NotAFlightRisk/ai-usage-dashboard/issues?q=is%3Aissue) first to avoid duplicates. + Thanks for the suggestion! Please [search existing issues and discussions](https://github.com/NotAFlightRisk/token-usage-dashboard/issues?q=is%3Aissue) first to avoid duplicates. - type: textarea id: problem @@ -52,5 +52,5 @@ body: options: - label: I have searched existing issues for duplicates required: true - - label: I agree to follow this project's [Code of Conduct](https://github.com/NotAFlightRisk/ai-usage-dashboard/blob/main/.github/CODE_OF_CONDUCT.md) + - label: I agree to follow this project's [Code of Conduct](https://github.com/NotAFlightRisk/token-usage-dashboard/blob/main/.github/CODE_OF_CONDUCT.md) required: true diff --git a/.github/README.md b/.github/README.md index 7a8c6c0..d252539 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,11 +1,11 @@ -

AI usage dashboard

+

Token usage dashboard

Beautiful dashboard showing a breakdown of where all of your tokens are going
npx token-usage-dashboard

- The dashboard, showing a usage calendar, daily totals and plan windows + The dashboard, showing a usage calendar, daily totals and plan windows

--- @@ -56,7 +56,7 @@ Most of it lives behind the gear icon: theme, default range, how often to rescan Anthropic for your plan windows, and price overrides for any model we've got wrong or don't know. Paths are environment variables, since they're needed before the app starts. See -[`.env.example`](https://github.com/NotAFlightRisk/ai-usage-dashboard/blob/main/.env.example) for the full list. The ones you'll actually want are +[`.env.example`](https://github.com/NotAFlightRisk/token-usage-dashboard/blob/main/.env.example) for the full list. The ones you'll actually want are `AIUSAGE_DB`, `AIUSAGE_CLAUDE_DIR` and `AIUSAGE_CODEX_DIR`. --- @@ -78,18 +78,18 @@ we can read, it can go in - open an issue with a sample and we'll have a look. ### Option 1: Docker -The image is on DockerHub ([`notaflightrisk/ai-usage-dashboard`](https://hub.docker.com/r/notaflightrisk/ai-usage-dashboard)) +The image is on DockerHub ([`notaflightrisk/token-usage-dashboard`](https://hub.docker.com/r/notaflightrisk/token-usage-dashboard)) and GHCR. Mount the directories you want read, plus somewhere to keep the database: ```shell docker run -p 127.0.0.1:8080:8080 \ -v ~/.claude:/home/node/.claude:ro \ -v ~/.codex:/home/node/.codex:ro \ - -v ai-usage:/data \ - notaflightrisk/ai-usage-dashboard + -v token-usage:/data \ + notaflightrisk/token-usage-dashboard ``` -There's a compose file in [`docker/`](https://github.com/NotAFlightRisk/ai-usage-dashboard/blob/main/docker/compose.yaml) if you'd rather. The container has +There's a compose file in [`docker/`](https://github.com/NotAFlightRisk/token-usage-dashboard/blob/main/docker/compose.yaml) if you'd rather. The container has to bind `0.0.0.0` internally, so publish the port to localhost like that unless something in front of it is checking who's asking. @@ -104,7 +104,7 @@ so it comes back after a reboot: ### Option 3: From a release -Grab the tarball from [releases](https://github.com/NotAFlightRisk/ai-usage-dashboard/releases), +Grab the tarball from [releases](https://github.com/NotAFlightRisk/token-usage-dashboard/releases), then `npm ci --omit=dev && npm start`. ### Option 4: From source @@ -119,8 +119,8 @@ You'll need [Node](https://nodejs.org/) 22.12 or newer, plus [Git](https://git-s It's a [SvelteKit](https://svelte.dev/docs/kit) app and the build is self-contained so there's no runtime dependencies at all. ```bash -git clone git@github.com:NotAFlightRisk/ai-usage-dashboard.git -cd ai-usage-dashboard +git clone git@github.com:NotAFlightRisk/token-usage-dashboard.git +cd token-usage-dashboard npm install npm run dev ``` @@ -134,6 +134,6 @@ The other scripts you'll want are `npm run check` (types), `npm test` (tests) an


- Licensed under MIT, © NotAFlightRisk 2026 + Licensed under MIT, © NotAFlightRisk 2026

diff --git a/.github/SECURITY.md b/.github/SECURITY.md index b6d42b0..651e5b4 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -31,7 +31,7 @@ and is never stored or logged. Acceptable channels: -1. **GitHub** (preferred) - open an [advisory](https://github.com/NotAFlightRisk/ai-usage-dashboard/security/advisories/new) from the Security tab +1. **GitHub** (preferred) - open an [advisory](https://github.com/NotAFlightRisk/token-usage-dashboard/security/advisories/new) from the Security tab 2. **Email** - [security@peng.ly](mailto:security@peng.ly) (PGP: [`A8431F9F332FB0CD`](https://github.com/NotAFlightRisk.gpg)) Include the type of issue, the affected version and file paths, steps to reproduce, a PoC if you've got one, and what an attacker could actually achieve with it. diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md index 9a6083c..c5c5a06 100644 --- a/.github/SUPPORT.md +++ b/.github/SUPPORT.md @@ -4,19 +4,19 @@ Need a hand? Here's where to go 👇 ## Before you ask -Have a look at the [README](./README.md), especially [Usage](./README.md#usage) and [Configuration](./README.md#configuration). Then search [existing issues](https://github.com/NotAFlightRisk/ai-usage-dashboard/issues?q=is%3Aissue), because someone's likely hit the same thing. +Have a look at the [README](./README.md), especially [Usage](./README.md#usage) and [Configuration](./README.md#configuration). Then search [existing issues](https://github.com/NotAFlightRisk/token-usage-dashboard/issues?q=is%3Aissue), because someone's likely hit the same thing. --- ## Where to ask -| I want to... | Go here | -| ------------------------------- | --------------------------------------------------------------------------------------------------------------- | -| Ask a question or share an idea | [Discussions](https://github.com/NotAFlightRisk/ai-usage-dashboard/discussions) | -| Report a bug | [Bug report](https://github.com/NotAFlightRisk/ai-usage-dashboard/issues/new?template=bug_report.yml) | -| Request a feature | [Feature request](https://github.com/NotAFlightRisk/ai-usage-dashboard/issues/new?template=feature_request.yml) | -| Report a vulnerability | [Security policy](./SECURITY.md) - **not** a public issue | -| Contribute a change | [Contributing guide](./CONTRIBUTING.md) | +| I want to... | Go here | +| ------------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| Ask a question or share an idea | [Discussions](https://github.com/NotAFlightRisk/token-usage-dashboard/discussions) | +| Report a bug | [Bug report](https://github.com/NotAFlightRisk/token-usage-dashboard/issues/new?template=bug_report.yml) | +| Request a feature | [Feature request](https://github.com/NotAFlightRisk/token-usage-dashboard/issues/new?template=feature_request.yml) | +| Report a vulnerability | [Security policy](./SECURITY.md) - **not** a public issue | +| Contribute a change | [Contributing guide](./CONTRIBUTING.md) | --- diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 54c4763..c141c03 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,14 +41,14 @@ jobs: env: TAG: ${{ inputs.tag }} run: | - tar -czf "ai-usage-dashboard-$TAG.tar.gz" build bin package.json package-lock.json .env.example + tar -czf "token-usage-dashboard-$TAG.tar.gz" build bin package.json package-lock.json .env.example echo "Run it with: npm ci --omit=dev && npm start" >> "$GITHUB_STEP_SUMMARY" - name: Publish the release env: GH_TOKEN: ${{ github.token }} TAG: ${{ inputs.tag }} run: | - gh release create "$TAG" "ai-usage-dashboard-$TAG.tar.gz" \ + gh release create "$TAG" "token-usage-dashboard-$TAG.tar.gz" \ --title "$TAG" \ --generate-notes \ --repo "$GITHUB_REPOSITORY" diff --git a/Dockerfile b/Dockerfile index 4620456..1a3c1ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,4 +17,4 @@ USER node VOLUME /data EXPOSE 8080 HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://127.0.0.1:8080/ > /dev/null || exit 1 -CMD ["node", "bin/ai-usage-dashboard.js", "--no-open"] +CMD ["node", "bin/token-usage-dashboard.js", "--no-open"] diff --git a/bin/ai-usage-dashboard.js b/bin/token-usage-dashboard.js similarity index 98% rename from bin/ai-usage-dashboard.js rename to bin/token-usage-dashboard.js index fc4765b..ca1b22c 100755 --- a/bin/ai-usage-dashboard.js +++ b/bin/token-usage-dashboard.js @@ -78,7 +78,7 @@ process.env.PORT = String(port); const shown = host === '0.0.0.0' || host === '::' ? 'localhost' : host; const url = `http://${shown.includes(':') ? `[${shown}]` : shown}:${port}`; await import(resolve(root, 'build', 'index.js')); -console.log(`\n AI usage dashboard is on ${url}\n`); +console.log(`\n Token usage dashboard is on ${url}\n`); const wantsBrowser = flag('--open') || (process.stdout.isTTY && !flag('--no-open')); if (wantsBrowser) { diff --git a/docker/compose.yaml b/docker/compose.yaml index e83a4fa..a5e6582 100644 --- a/docker/compose.yaml +++ b/docker/compose.yaml @@ -1,13 +1,13 @@ services: - ai-usage-dashboard: - image: notaflightrisk/ai-usage-dashboard:latest + token-usage-dashboard: + image: notaflightrisk/token-usage-dashboard:latest ports: - '8080:8080' volumes: - ${HOME}/.claude:/home/node/.claude:ro - ${HOME}/.codex:/home/node/.codex:ro - - ai-usage:/data + - token-usage:/data restart: unless-stopped volumes: - ai-usage: + token-usage: diff --git a/package-lock.json b/package-lock.json index e4a029e..0d19929 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "MIT", "bin": { - "aiusage": "bin/ai-usage-dashboard.js" + "aiusage": "bin/token-usage-dashboard.js" }, "devDependencies": { "@sveltejs/adapter-node": "^6.0.0", diff --git a/package.json b/package.json index 0721f99..d8d04cc 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "dev": "vite dev", "build": "vite build", "prepublishOnly": "npm run build", - "start": "node bin/ai-usage-dashboard.js", + "start": "node bin/token-usage-dashboard.js", "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "test": "vitest run", @@ -40,10 +40,10 @@ "cost" ], "license": "MIT", - "homepage": "https://github.com/NotAFlightRisk/ai-usage-dashboard", - "bugs": "https://github.com/NotAFlightRisk/ai-usage-dashboard/issues", + "homepage": "https://github.com/NotAFlightRisk/token-usage-dashboard", + "bugs": "https://github.com/NotAFlightRisk/token-usage-dashboard/issues", "bin": { - "aiusage": "bin/ai-usage-dashboard.js" + "aiusage": "bin/token-usage-dashboard.js" }, "files": [ "bin", @@ -56,7 +56,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/NotAFlightRisk/ai-usage-dashboard.git" + "url": "git+https://github.com/NotAFlightRisk/token-usage-dashboard.git" }, "imports": { "#lib/*": "./src/lib/*" diff --git a/scripts/install.sh b/scripts/install.sh index a9e1170..5c1e9b9 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -5,17 +5,17 @@ set -euo pipefail port="${1:-4747}" dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" node="$(command -v node)" -unit="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user/ai-usage-dashboard.service" +unit="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user/token-usage-dashboard.service" [ -d "$dir/build" ] || { echo "No build/ yet. Run: npm ci && npm run build" >&2; exit 1; } mkdir -p "$(dirname "$unit")" sed -e "s|__DIR__|$dir|g" -e "s|__NODE__|$node|g" -e "s|__PORT__|$port|g" \ - "$dir/scripts/ai-usage-dashboard.service" > "$unit" + "$dir/scripts/token-usage-dashboard.service" > "$unit" systemctl --user daemon-reload -systemctl --user enable --now ai-usage-dashboard.service +systemctl --user enable --now token-usage-dashboard.service loginctl enable-linger "$USER" 2>/dev/null || true echo "Running on http://127.0.0.1:$port" -echo "Logs: journalctl --user -u ai-usage-dashboard -f" +echo "Logs: journalctl --user -u token-usage-dashboard -f" diff --git a/scripts/ai-usage-dashboard.service b/scripts/token-usage-dashboard.service similarity index 69% rename from scripts/ai-usage-dashboard.service rename to scripts/token-usage-dashboard.service index 06c5591..456a32f 100644 --- a/scripts/ai-usage-dashboard.service +++ b/scripts/token-usage-dashboard.service @@ -1,5 +1,5 @@ [Unit] -Description=AI usage dashboard +Description=Token usage dashboard After=network.target [Service] @@ -8,7 +8,7 @@ WorkingDirectory=__DIR__ Environment=NODE_ENV=production Environment=HOST=127.0.0.1 Environment=PORT=__PORT__ -ExecStart=__NODE__ __DIR__/bin/ai-usage-dashboard.js --no-open +ExecStart=__NODE__ __DIR__/bin/token-usage-dashboard.js --no-open Restart=on-failure RestartSec=5 diff --git a/src/lib/logos/Logo.svelte b/src/lib/logos/Logo.svelte index e8e3db0..ae151c0 100644 --- a/src/lib/logos/Logo.svelte +++ b/src/lib/logos/Logo.svelte @@ -17,7 +17,7 @@ width={size} height={size} role="img" - aria-label="AI usage dashboard" + aria-label="Token usage dashboard" > {#each cells as cell (`${cell.row}-${cell.column}`)} diff --git a/src/lib/server/config.ts b/src/lib/server/config.ts index c796051..857f384 100644 --- a/src/lib/server/config.ts +++ b/src/lib/server/config.ts @@ -1,3 +1,4 @@ +import { existsSync } from 'node:fs'; import { homedir } from 'node:os'; import { join } from 'node:path'; @@ -5,9 +6,13 @@ const home = homedir(); const env = (name: string, fallback: string) => (process.env[name] || '').trim() || fallback; const dataHome = env('XDG_DATA_HOME', join(home, '.local', 'share')); +const dataDirs = ['token-usage-dashboard', 'ai-usage-dashboard'].map((name) => + join(dataHome, name) +); +const dataDir = dataDirs.find((dir) => existsSync(dir)) ?? dataDirs[0]; export const config = { - dbPath: env('AIUSAGE_DB', join(dataHome, 'ai-usage-dashboard', 'usage.db')), + dbPath: env('AIUSAGE_DB', join(dataDir, 'usage.db')), claudeDir: env('AIUSAGE_CLAUDE_DIR', join(home, '.claude')), codexDir: env('AIUSAGE_CODEX_DIR', join(home, '.codex')), openCodeDir: env('AIUSAGE_OPENCODE_DIR', join(dataHome, 'opencode')), diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 17fea71..1625394 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -233,13 +233,13 @@ - AI usage dashboard + Token usage dashboard
- AI usage + Token usage