Repository navigation
feat(cursor): unify tracing with existing extension plugin #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Abhijeet Prasad (AbhiPrasad)
merged 4 commits into
main
from
codex/cursor-extension-unified
Oct 6, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1402a7d
feat(cursor): unify tracing with existing extension plugin
AbhiPrasad ff5337c
fix(cursor): guard distribution updates and declare MCP key
AbhiPrasad a038906
chore(cursor): remove distribution guard
AbhiPrasad 1abb717
docs(cursor): direct contributors to monorepo source
AbhiPrasad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,25 @@ | ||
| { | ||
| "name": "trace-cursor", | ||
| "name": "braintrust", | ||
| "displayName": "Braintrust", | ||
| "version": "0.2.0", | ||
| "description": "Trace Cursor agent sessions, model output, and tool operations to Braintrust through the shared bt daemon.", | ||
| "author": { "name": "Braintrust" }, | ||
| "homepage": "https://www.braintrust.dev", | ||
| "repository": "https://github.com/braintrustdata/braintrust-coding-agent-plugins", | ||
| "license": "Apache-2.0", | ||
| "hooks": "hooks/hooks.json" | ||
| "description": "Connect Cursor to Braintrust MCP and trace agent sessions.", | ||
| "author": { "name": "Braintrust Data, Inc.", "email": "support@braintrust.dev" }, | ||
| "homepage": "https://braintrust.dev", | ||
| "repository": "https://github.com/braintrustdata/braintrust-cursor-extension", | ||
| "license": "MIT", | ||
| "keywords": ["braintrust", "mcp", "ai", "evaluation", "experiments", "observability", "logs", "tracing"], | ||
| "logo": "logo.svg", | ||
| "hooks": "hooks/hooks.json", | ||
| "mcpServers": "mcp.json", | ||
| "variables": { | ||
| "type": "object", | ||
| "properties": { | ||
| "BRAINTRUST_API_KEY": { | ||
| "type": "string", | ||
| "title": "Braintrust API key", | ||
| "description": "API key for the Braintrust MCP server" | ||
| } | ||
| }, | ||
| "required": ["BRAINTRUST_API_KEY"] | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| node_modules/ | ||
| out/ | ||
| *.vsix | ||
| .vscode-test/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "name": "Run Extension", | ||
| "type": "extensionHost", | ||
| "request": "launch", | ||
| "args": ["--extensionDevelopmentPath=${workspaceFolder}"], | ||
| "outFiles": ["${workspaceFolder}/out/**/*.js"], | ||
| "preLaunchTask": "npm: build" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "version": "2.0.0", | ||
| "tasks": [ | ||
| { | ||
| "type": "npm", | ||
| "script": "build", | ||
| "group": "build", | ||
| "problemMatcher": ["$tsc"] | ||
| }, | ||
| { | ||
| "type": "npm", | ||
| "script": "watch", | ||
| "group": "build", | ||
| "isBackground": true, | ||
| "problemMatcher": ["$tsc-watch"] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| src/** | ||
| .vscode/** | ||
| .cursor-plugin/** | ||
| mcp.json | ||
| logo.svg | ||
| tsconfig.json | ||
| CONTRIBUTING.md | ||
| .gitignore | ||
| **/*.ts | ||
| **/*.map | ||
| node_modules/** | ||
| .vscode-test/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| # Contributing | ||
|
|
||
| The source for this plugin and extension lives in | ||
| [braintrust-coding-agent-plugins](https://github.com/braintrustdata/braintrust-coding-agent-plugins) | ||
| under `src/plugins/cursor/content/`. The | ||
| [braintrust-cursor-extension](https://github.com/braintrustdata/braintrust-cursor-extension) | ||
| repository is generated from this directory during a release. Make changes and | ||
| open pull requests in the monorepo. | ||
|
|
||
| ## Development Setup | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Node.js 20.18.1 or newer | ||
| - npm | ||
|
|
||
| ### Build from Source | ||
|
|
||
| ```bash | ||
| # Clone the source repository | ||
| git clone https://github.com/braintrustdata/braintrust-coding-agent-plugins.git | ||
| cd braintrust-coding-agent-plugins/src/plugins/cursor/content | ||
|
|
||
| # Install dependencies | ||
| npm ci | ||
|
|
||
| # Build the extension | ||
| npm run build | ||
| ``` | ||
|
|
||
| From the monorepo root, run `make validate-cursor` to build and validate the | ||
| Cursor distribution tree, including its plugin manifest, MCP configuration, | ||
| and tracing hooks. | ||
|
|
||
| ### Running in Development | ||
|
|
||
| 1. Open `src/plugins/cursor/content/` in Cursor | ||
| 2. Press `F5` to launch the Extension Development Host | ||
| 3. A new Cursor window will open with the extension loaded | ||
|
|
||
| ### Setting the Environment Variable for Development | ||
|
|
||
| The extension reads `BRAINTRUST_API_KEY` from the process environment at runtime. You must set this variable **before** launching Cursor so the extension host process inherits it. | ||
|
|
||
| #### macOS / Linux | ||
|
|
||
| ```bash | ||
| # Set the environment variable and launch Cursor | ||
| export BRAINTRUST_API_KEY="your-api-key-here" | ||
| cursor . | ||
|
|
||
| # Or in a single line | ||
| BRAINTRUST_API_KEY="your-api-key-here" cursor . | ||
| ``` | ||
|
|
||
| For persistent configuration, add to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.): | ||
|
|
||
| ```bash | ||
| export BRAINTRUST_API_KEY="your-api-key-here" | ||
| ``` | ||
|
|
||
| Then restart your terminal and Cursor. | ||
|
|
||
| #### Windows (PowerShell) | ||
|
|
||
| ```powershell | ||
| # Set for current session | ||
| $env:BRAINTRUST_API_KEY = "your-api-key-here" | ||
|
|
||
| # Launch Cursor | ||
| cursor . | ||
| ``` | ||
|
|
||
| For persistent configuration: | ||
|
|
||
| ```powershell | ||
| # Set permanently for user | ||
| [Environment]::SetEnvironmentVariable("BRAINTRUST_API_KEY", "your-api-key-here", "User") | ||
| ``` | ||
|
|
||
| Then restart PowerShell and Cursor. | ||
|
|
||
| #### Windows (Command Prompt) | ||
|
|
||
| ```cmd | ||
| # Set for current session | ||
| set BRAINTRUST_API_KEY=your-api-key-here | ||
|
|
||
| # Launch Cursor | ||
| cursor . | ||
| ``` | ||
|
|
||
| For persistent configuration, use System Properties > Environment Variables. | ||
|
|
||
| ### Installing a Local Build | ||
|
|
||
| 1. From `src/plugins/cursor/content/`, build the extension: `npm run build` | ||
| 2. Package it: `npx vsce package` (produces a `.vsix` file) | ||
| 3. In Cursor, open Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`) | ||
| 4. Run **Extensions: Install from VSIX...** | ||
| 5. Select the generated `.vsix` file | ||
|
|
||
| ## Project Structure | ||
|
|
||
| ``` | ||
| braintrust-coding-agent-plugins/src/plugins/cursor/content/ | ||
| ├── .cursor-plugin/ # Cursor plugin manifest | ||
| ├── hooks/ # Tracing hooks | ||
| ├── mcp.json # Braintrust MCP server | ||
| ├── package.json # Extension manifest | ||
| ├── tsconfig.json # TypeScript configuration | ||
| ├── src/ | ||
| │ └── extension.ts # Main extension code | ||
| ├── out/ # Compiled output (git-ignored) | ||
| └── README.md | ||
| ``` | ||
|
|
||
| ## Scripts | ||
|
|
||
| - `npm run build` — Compile TypeScript | ||
| - `npm run watch` — Compile in watch mode | ||
| - `npm run lint` — Run ESLint (requires eslint to be installed) | ||
| - `npm run package` — Create a `.vsix` package | ||
| - `npm run publish:openvsx` — Publish to OpenVSX (for Cursor) | ||
| - `npm run publish:vscode` — Publish to VS Code Marketplace | ||
|
|
||
| ## Publishing | ||
|
|
||
| The monorepo's **Release Plugin** workflow prepares a version pull request. | ||
| After that pull request is approved and merged, the workflow publishes the | ||
| generated Cursor plugin tree to `braintrustdata/braintrust-cursor-extension`. | ||
| The version script updates the Cursor plugin manifest, `package.json`, and | ||
| `package-lock.json` together. Do not edit the distribution repository directly. | ||
|
|
||
| Publishing the VS Code extension to an extension marketplace is a separate | ||
| release action. `npm run package` creates a `.vsix` file for local testing. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.