ofershap

cursor-usage-tracker

Monitor Cursor IDE usage, detect spending anomalies, and alert your team. Self-hosted, open-source.

by ofershap

TypeScript

TypeScript99.4%
JavaScript0.3%
CSS0.2%
Dockerfile0.1%

Commit activity

Last 12 weeks · 4 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent PRs & issues

Active · 2 in progress · Last activity 1w ago
See all on GitHub →
mcobery

Enhanced the /teams/spend endpoint response structure to include new fields: , , , and . Updated the function to accommodate the new API shape, ensuring backward compatibility with pre-2026 data. Added defensive defaults in the SQLite upsert function to prevent crashes due to missing fields. Implemented tests to verify the normalization of both pre-2026 and post-2026 API shapes. Addresses GH issue https://github.com/ofershap/cursor-usage-tracker/issues/19. Introduced PostgreSQL as an alternative database option, allowing users to set for enhanced data handling. Created for a full stack setup including the tracker app and PostgreSQL. Added for standalone PostgreSQL service management. Updated and to include PostgreSQL dependencies ( and ). Enhanced error handling in the application to accommodate PostgreSQL integration. Updated README with instructions for using PostgreSQL and Docker setup. Bumped several dependencies including @tailwindcss/postcss to 4.2.1, resend to 6.9.3, and tailwindcss to 4.2.1. Updated @elevenlabs/elevenlabs-js to 2.37.0, @types/node to 25.3.3, eslint to 10.0.2, lint-staged to 16.3.1, and typescript-eslint to 8.56.1. These updates include minor and patch version changes to improve stability and performance. Introduced a new script command "detect" in package.json to facilitate detection functionality via the CLI. This addition enhances the usability of the CLI tools provided in the project. Introduced new CLI commands and in package.json to clear collected data from the database, allowing for a fresh start or post-testing cleanup. Updated README with instructions on using the reset command, including options for wiping specific tables or all tables. Enhanced project documentation to reflect the addition of the reset functionality and its usage. Modified to include PostgreSQL configuration options for user, password, database, host, and port. Updated files to utilize environment variables for PostgreSQL settings, enhancing flexibility and security. Adjusted npm scripts in to remove hardcoded PostgreSQL URLs, allowing for dynamic configuration through the file. Enhanced error handling in PostgreSQL-related scripts to ensure proper execution and user guidance.

mcobery · 2mo ago
Sebastien-Meiffren

Summary Running fails to persist spending data because Cursor's API response shape has changed. Two related issues: 1. The endpoint no longer returns , causing a SQLite constraint violation. 2. The endpoint now returns for users under their plan limit and exposes the actual cycle total in a new field, . As a result, even after working around the constraint error, all stored spend values would be . Reproduction Output: is reported, while every other collector (daily usage, groups, usage events, analytics) succeeds. Root cause A live response from (page 1, pageSize 3) currently looks like: Differences from what the codebase expects (see in and in ): — no longer present. The collector binds , which better-sqlite3 sends as , hitting . — semantics appear to have changed. It now seems to represent the overage above the plan-included amount, and is for everyone within plan. — new field. Represents the cycle-to-date total (what the dashboard previously showed as ). New fields seen on members: , . Suggested fix In , normalize the response so the rest of the pipeline keeps working: (total cycle spend) (or if not derivable) Defensive / in bindings as a belt-and-suspenders fix against future schema changes. Update and to document the new fields and the new semantics of . The API reference in should also be refreshed — it currently lists only for this endpoint. Environment Branch: @ Node / SQLite: better-sqlite3 Team size in repro: 50 members, 17 spend pages

Sebastien-Meiffren · 1w ago
alex-pex

Fixes #19. Changes 1. Normalize the new response shape Cursor changed : is now the overage above the plan, the cycle total moved to , and is gone. The collector crashed with , and even past that it would have stored 0 spend for every user within plan. now normalizes each member so downstream code keeps its contract: = (cycle total) = if present, otherwise Pre-2026 responses keep working. Tests cover both shapes, and documents the new response. 2. Fix the top-model query in The query filters on (shared ) but selected without the alias, so SQLite threw . is used by the z-score and trend detectors, so anomaly detection failed. Includes a regression test. This is a separate bug from #19; happy to split it into its own PR if you prefer. Credits Commit 1 is based on @mcobery's work in #21 (closed unmerged), reduced to the minimal fix: no , no fetch error wrapping, no extra defaults (the normalization already guarantees the values) and no unused fields. He is credited as co-author. Checks , , and pass on Node 22. Note: #22 touches some of the same files.

alex-pex · 1w ago
Structured data for AI agents

Repository: ofershap/cursor-usage-tracker. Description: Monitor Cursor IDE usage, detect spending anomalies, and alert your team. Self-hosted, open-source. Stars: 34, Forks: 11. Primary language: TypeScript. Languages: TypeScript (99.4%), JavaScript (0.3%), CSS (0.2%), Dockerfile (0.1%). License: MIT. Topics: ai, ai-costs, anomaly-detection, cursor, cursor-ide, enterprise, nextjs, open-source, slack-alerts, sqlite, typescript, usage-monitoring. Latest release: v1.24.1 (1w ago). Open PRs: 2, open issues: 0. Last activity: 1w ago. Community health: 85%. Top contributors: ofershap, dependabot[bot], alex-pex.