Cursor Team On-Demand Usage Indicator
Shows Cursor on-demand spend directly in the VS Code status bar.
Features
- Status bar indicator with today's spend, for example:
$ 42.10 today
- One-click QuickPick menu with details (today + MTD + cycle dates), refresh, logout, and open dashboard actions
- Login flow via Chrome + DevTools Protocol cookie capture
- Manual cookie paste fallback when browser automation is unavailable
- Secure cookie storage using
vscode.SecretStorage
Status Bar UX
The extension follows VS Code status bar guidelines:
- single status bar item
- short label text
- one icon per state
- contextual item on the right side
References:
Settings
This extension contributes:
cursorUsage.teamId (string, required): Cursor team ID used for API requests
cursorUsage.refreshIntervalSeconds (enum: 10, 15, 30, 60, default 30)
If cursorUsage.teamId is missing, the status bar shows Cursor: Setup and opens settings on click.
Login & Session
- Preferred flow:
Login with Chrome then Finish Login
- Fallback flow:
Paste Cookie Manually
- Session token is stored in VS Code secret storage (OS keychain-backed)
The extension also attempts one-time import from legacy file ~/.cursor-session for compatibility with the shell prototype.
Development
npm install
npm run compile
npm run lint
npm test
CI/CD
Pre-commit hooks (via Husky):
- Runs lint, compile, and unit tests before every commit
- Prevents broken code from being committed
GitHub Actions:
- Runs on every push and pull request to
main/master
- Executes: lint → compile → unit tests → build verification
- See
.github/workflows/ci.yml for details
Run Locally (Extension Development Host)
- Open this folder in VS Code or Cursor.
- Run:
npm install
npm run compile
- Press
F5 to launch an Extension Development Host window.
- In the new window:
- Open settings and set
cursorUsage.teamId
- Click the status bar item (
Cursor: Setup or Cursor: Login)
- Use
Login with Chrome (or Paste Cookie Manually)
- Validate states:
- Missing team id ->
Cursor: Setup
- Missing/expired session ->
Cursor: Login
- Valid session ->
$(credit-card) $ ... (Xd cycle end)
Tip: You can also run Developer: Reload Window in the development host after changes.
Generate a VSIX
Yes. You can package this extension as a .vsix file.
npm install
npm run vsix:package
This generates a file like:
cursor-team-on-demand-usage-indicator-0.0.1.vsix
Install it locally with:
code --install-extension cursor-team-on-demand-usage-indicator-0.0.1.vsix
Or in VS Code/Cursor: Extensions: Install from VSIX...
Publish to VS Code Marketplace
Prerequisites:
- Add your publisher in
package.json:
{
"publisher": "your-publisher-id"
}
- Create a Personal Access Token in Azure DevOps for Marketplace publishing.
Then publish with:
export VSCE_PAT="your_marketplace_token"
npm run vsix:publish
Version bump publish helpers:
npm run vsix:publish:patch
npm run vsix:publish:minor
npm run vsix:publish:major
How to Use
- Set
cursorUsage.teamId in Settings.
- Click the status bar item.
- Choose one login method:
Login with Chrome, then Finish Login
Paste Cookie Manually (fallback)
- Once authenticated, the status bar refreshes automatically using
cursorUsage.refreshIntervalSeconds.
- Click the status bar item anytime for:
- usage details
- refresh now
- logout
- open Cursor dashboard
Tests
- Unit tests (
mocha): JWT/session/api/status bar logic
- VS Code smoke tests (
vscode-test): extension activation and command registration