|
| 1 | +# Copilot Token Tracker CLI |
| 2 | + |
| 3 | +Command-line interface for analyzing GitHub Copilot token usage from local session files. Works anywhere Copilot Chat stores its session data. |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +```bash |
| 8 | +# Run directly with npx (no install required) |
| 9 | +npx copilot-token-tracker-cli stats |
| 10 | + |
| 11 | +# Or install globally |
| 12 | +npm install -g copilot-token-tracker-cli |
| 13 | +copilot-token-tracker stats |
| 14 | +``` |
| 15 | + |
| 16 | +## Commands |
| 17 | + |
| 18 | +### `stats` - Session Overview |
| 19 | + |
| 20 | +Show discovered session files, sessions, chat turns, and token counts. |
| 21 | + |
| 22 | +```bash |
| 23 | +copilot-token-tracker stats |
| 24 | +copilot-token-tracker stats --verbose # Show per-folder breakdown |
| 25 | +``` |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +### `usage` - Token Usage Report |
| 30 | + |
| 31 | +Show token usage broken down by time period. |
| 32 | + |
| 33 | +```bash |
| 34 | +copilot-token-tracker usage |
| 35 | +copilot-token-tracker usage --models # Show per-model breakdown |
| 36 | +copilot-token-tracker usage --cost # Show estimated cost |
| 37 | +``` |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +### `environmental` - Environmental Impact |
| 42 | + |
| 43 | +Show environmental impact of your Copilot usage (CO₂ emissions, water usage, tree equivalents). |
| 44 | + |
| 45 | +```bash |
| 46 | +copilot-token-tracker environmental |
| 47 | +copilot-token-tracker env # Short alias |
| 48 | +``` |
| 49 | + |
| 50 | +### `fluency` - Fluency Score |
| 51 | + |
| 52 | +Show your Copilot Fluency Score across multiple categories (Prompt Engineering, Context Engineering, Agentic, Tool Usage, Customization, Team Collaboration). |
| 53 | + |
| 54 | +```bash |
| 55 | +copilot-token-tracker fluency |
| 56 | +copilot-token-tracker fluency --tips # Show improvement tips, if there are any |
| 57 | +``` |
| 58 | + |
| 59 | +### `diagnostics` - Search Locations & Stats |
| 60 | + |
| 61 | +Show all locations searched for session files, whether each path exists, and per-location stats (files, sessions, chat turns, tokens). |
| 62 | + |
| 63 | +```bash |
| 64 | +copilot-token-tracker diagnostics |
| 65 | +``` |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | +## Data Sources |
| 70 | + |
| 71 | +The CLI scans the same session files that the [Copilot Token Tracker VS Code extension](https://marketplace.visualstudio.com/items?itemName=RobBos.copilot-token-tracker) uses: |
| 72 | + |
| 73 | +- **VS Code** (Stable, Insiders, Exploration) workspace and global storage |
| 74 | +- **VSCodium** and **Cursor** editor sessions |
| 75 | +- **VS Code Remote** / Codespaces sessions |
| 76 | +- **Copilot CLI** agent mode sessions |
| 77 | +- **OpenCode** sessions (JSON and SQLite) |
| 78 | + |
| 79 | +## Development |
| 80 | + |
| 81 | +```bash |
| 82 | +# From the repository root |
| 83 | +npm run cli:build # Build the CLI |
| 84 | +npm run cli:stats # Run stats command |
| 85 | +npm run cli:usage # Run usage command |
| 86 | +npm run cli:environmental # Run environmental command |
| 87 | +npm run cli:fluency # Run fluency command |
| 88 | +npm run cli:diagnostics # Run diagnostics command |
| 89 | +npm run cli -- --help # Run any CLI command |
| 90 | +``` |
| 91 | + |
| 92 | +## Requirements |
| 93 | + |
| 94 | +- Node.js 18 or later |
| 95 | +- GitHub Copilot Chat session files on the local machine |
| 96 | + |
| 97 | +## License |
| 98 | + |
| 99 | +MIT - See [LICENSE](../LICENSE) for details. |
0 commit comments