Skip to content

Commit c8ee1e4

Browse files
authored
chore: Update cursor rules with more details (#17021)
trying to un-stupidify cursor in some cases, esp. background tasks.
1 parent b0a1e0c commit c8ee1e4

File tree

5 files changed

+136
-85
lines changed

5 files changed

+136
-85
lines changed

.cursor/environment.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "Sentry JavaScript SDK Development",
3+
"install": "curl https://get.volta.sh | bash && export VOLTA_HOME=\"$HOME/.volta\" && export PATH=\"$VOLTA_HOME/bin:$PATH\" && export VOLTA_FEATURE_PNPM=1 && yarn install",
4+
"start": "export VOLTA_HOME=\"$HOME/.volta\" && export PATH=\"$VOLTA_HOME/bin:$PATH\" && export VOLTA_FEATURE_PNPM=1",
5+
"terminals": [
6+
{
7+
"name": "Development",
8+
"command": "export VOLTA_HOME=\"$HOME/.volta\" && export PATH=\"$VOLTA_HOME/bin:$PATH\" && export VOLTA_FEATURE_PNPM=1 && echo 'Volta setup complete. Node version:' && node --version && echo 'Yarn version:' && yarn --version",
9+
"description": "Main development terminal with Volta environment configured"
10+
}
11+
]
12+
}

.cursor/rules/sdk_dependency_upgrades.mdc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ description: Use this rule if you are looking to upgrade a dependency in the Sen
33
globs:
44
alwaysApply: false
55
---
6+
67
# Yarn v1 Dependency Upgrades
78

89
## Upgrade Process
@@ -45,10 +46,12 @@ Avoid upgrading top-level dependencies (defined in `package.json`), especially i
4546
**STOP UPGRADE IMMEDIATELY** if upgrading any dependency with `opentelemetry` in the name and the new version or any of its dependencies uses forbidden OpenTelemetry versions.
4647

4748
**FORBIDDEN VERSION PATTERNS:**
49+
4850
- `2.x.x` versions (e.g., `2.0.0`, `2.1.0`)
4951
- `0.2xx.x` versions (e.g., `0.200.0`, `0.201.0`)
5052

5153
When upgrading OpenTelemetry dependencies:
54+
5255
1. Check the dependency's `package.json` after upgrade
5356
2. Verify the package itself doesn't use forbidden version patterns
5457
3. Verify none of its dependencies use `@opentelemetry/*` packages with forbidden version patterns
@@ -153,6 +156,7 @@ yarn info <package-name> versions
153156
```
154157

155158
The `yarn info` command provides detailed dependency information without requiring installation, making it particularly useful for:
159+
156160
- Verifying OpenTelemetry packages don't introduce forbidden version patterns (`2.x.x` or `0.2xx.x`)
157161
- Checking what dependencies a package will bring in before upgrading
158162
- Understanding package version history and compatibility

.cursor/rules/sdk_development.mdc

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ You are working on the Sentry JavaScript SDK, a critical production SDK used by
1212
**CRITICAL**: All changes must pass these checks before committing:
1313

1414
1. **Always run `yarn lint`** - Fix all linting issues
15-
2. **Always run `yarn test`** - Ensure all tests pass
15+
2. **Always run `yarn test`** - Ensure all tests pass
1616
3. **Always run `yarn build:dev`** - Verify TypeScript compilation
1717

1818
## Development Commands
1919

2020
### Build Commands
21+
2122
- `yarn build` - Full production build with package verification
2223
- `yarn build:dev` - Development build (transpile + types)
2324
- `yarn build:dev:watch` - Development build in watch mode (recommended)
@@ -26,13 +27,11 @@ You are working on the Sentry JavaScript SDK, a critical production SDK used by
2627
- `yarn build:bundle` - Build browser bundles only
2728

2829
### Testing
29-
- `yarn test` - Run all tests (excludes integration tests)
30-
- `yarn test:unit` - Run unit tests only
31-
- `yarn test:pr` - Run tests affected by changes (CI mode)
32-
- `yarn test:pr:browser` - Run affected browser-specific tests
33-
- `yarn test:pr:node` - Run affected Node.js-specific tests
30+
31+
- `yarn test` - Run all unit tests
3432

3533
### Linting and Formatting
34+
3635
- `yarn lint` - Run ESLint and Prettier checks
3736
- `yarn fix` - Auto-fix linting and formatting issues
3837
- `yarn lint:es-compatibility` - Check ES compatibility
@@ -42,12 +41,17 @@ You are working on the Sentry JavaScript SDK, a critical production SDK used by
4241
This repository uses **Git Flow**. See [docs/gitflow.md](docs/gitflow.md) for details.
4342

4443
### Key Rules
44+
4545
- **All PRs target `develop` branch** (NOT `master`)
4646
- `master` represents the last released state
4747
- Never merge directly into `master` (except emergency fixes)
4848
- Avoid changing `package.json` files on `develop` during pending releases
49+
- Never update dependencies, package.json content or build scripts unless explicitly asked for
50+
- When asked to do a task on a set of files, always make sure that all occurences in the codebase are covered. Double check that no files have been forgotten.
51+
- Unless explicitly asked for, make sure to cover all files, including files in `src/` and `test/` directories.
4952

5053
### Branch Naming
54+
5155
- Features: `feat/descriptive-name`
5256
- Releases: `release/X.Y.Z`
5357

@@ -56,27 +60,33 @@ This repository uses **Git Flow**. See [docs/gitflow.md](docs/gitflow.md) for de
5660
This is a Lerna monorepo with 40+ packages in the `@sentry/*` namespace.
5761

5862
### Core Packages
63+
5964
- `packages/core/` - Base SDK with interfaces, type definitions, core functionality
60-
- `packages/types/` - Shared TypeScript type definitions (active)
65+
- `packages/types/` - Shared TypeScript type definitions - this is deprecated, never modify this package
6166
- `packages/browser-utils/` - Browser-specific utilities and instrumentation
67+
- `packages/node-core/` - Node Core SDK which contains most of the node-specific logic, excluding OpenTelemetry instrumentation.
6268

6369
### Platform SDKs
70+
6471
- `packages/browser/` - Browser SDK with bundled variants
65-
- `packages/node/` - Node.js SDK with server-side integrations
72+
- `packages/node/` - Node.js SDK. All general Node code should go into node-core, the node package itself only contains OpenTelemetry instrumentation on top of that.
6673
- `packages/bun/`, `packages/deno/`, `packages/cloudflare/` - Runtime-specific SDKs
6774

6875
### Framework Integrations
76+
6977
- Framework packages: `packages/{framework}/` (react, vue, angular, etc.)
7078
- Client/server entry points where applicable (nextjs, nuxt, sveltekit)
7179
- Integration tests use Playwright (Remix, browser-integration-tests)
7280

7381
### User Experience Packages
82+
7483
- `packages/replay-internal/` - Session replay functionality
7584
- `packages/replay-canvas/` - Canvas recording for replay
7685
- `packages/replay-worker/` - Web worker support for replay
7786
- `packages/feedback/` - User feedback integration
7887

7988
### Development Packages (`dev-packages/`)
89+
8090
- `browser-integration-tests/` - Playwright browser tests
8191
- `e2e-tests/` - End-to-end tests for 70+ framework combinations
8292
- `node-integration-tests/` - Node.js integration tests
@@ -88,41 +98,55 @@ This is a Lerna monorepo with 40+ packages in the `@sentry/*` namespace.
8898
## Development Guidelines
8999

90100
### Build System
101+
91102
- Uses Rollup for bundling (`rollup.*.config.mjs`)
92103
- TypeScript with multiple tsconfig files per package
93104
- Lerna manages package dependencies and publishing
94105
- Vite for testing with `vitest`
95106

96107
### Package Structure Pattern
108+
97109
Each package typically contains:
110+
98111
- `src/index.ts` - Main entry point
99112
- `src/sdk.ts` - SDK initialization logic
100113
- `rollup.npm.config.mjs` - Build configuration
101114
- `tsconfig.json`, `tsconfig.test.json`, `tsconfig.types.json`
102115
- `test/` directory with corresponding test files
103116

104117
### Key Development Notes
118+
105119
- Uses Volta for Node.js/Yarn version management
106120
- Requires initial `yarn build` after `yarn install` for TypeScript linking
107121
- Integration tests use Playwright extensively
108-
- Native profiling requires Python <3.12 for binary builds
122+
- Never change the volta, yarn, or package manager setup in general unless explicitly asked for
123+
124+
### Notes for Background Tasks
125+
126+
- Make sure to use [volta](https://volta.sh/) for development. Volta is used to manage the node, yarn and pnpm version used.
127+
- Make sure that [PNPM support is enabled in volta](https://docs.volta.sh/advanced/pnpm). This means that the `VOLTA_FEATURE_PNPM` environment variable has to be set to `1`.
128+
- Yarn, Node and PNPM have to be used through volta, in the versions defined by the volta config. NEVER change any versions unless explicitly asked to.
109129

110130
## Testing Single Packages
131+
111132
- Test specific package: `cd packages/{package-name} && yarn test`
112133
- Build specific package: `yarn build:dev:filter @sentry/{package-name}`
113134

114135
## Code Style Rules
136+
115137
- Follow existing code conventions in each package
116138
- Check imports and dependencies - only use libraries already in the codebase
117139
- Look at neighboring files for patterns and style
118140
- Never introduce code that exposes secrets or keys
119141
- Follow security best practices
120142

121143
## Before Every Commit Checklist
144+
122145
1. ✅ `yarn lint` (fix all issues)
123146
2. ✅ `yarn test` (all tests pass)
124147
3. ✅ `yarn build:dev` (builds successfully)
125148
4. ✅ Target `develop` branch for PRs (not `master`)
126149

127150
## Documentation Sync
128-
**IMPORTANT**: When editing CLAUDE.md, also update .cursor/rules/sdk_development.mdc and vice versa to keep both files in sync.
151+
152+
**IMPORTANT**: When editing CLAUDE.md, also update .cursor/rules/sdk_development.mdc and vice versa to keep both files in sync.

0 commit comments

Comments
 (0)