Skip to content

Commit 0d20bfe

Browse files
committed
Add Claude & Cursor agent rules
wip
1 parent 7761d2b commit 0d20bfe

File tree

3 files changed

+295
-0
lines changed

3 files changed

+295
-0
lines changed

.cursor/rules/release-process.mdc

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
globs: CHANGELOG.md
3+
alwaysApply: false
4+
---
5+
# Sentry PHP SDK Release Process
6+
7+
## Release Process
8+
9+
To prepare a new release (e.g., version 4.14.0):
10+
11+
1. **Update master branch**: Always ensure master is up-to-date first
12+
```bash
13+
git checkout master
14+
git pull origin master
15+
```
16+
17+
2. **Create release branch**: Create a branch named `prepare-X.Y.Z`
18+
```bash
19+
git checkout -b prepare-4.14.0
20+
```
21+
22+
3. **Find changes since last release**: Check commits since the last version tag
23+
```bash
24+
git log --oneline --no-merges 4.13.0..HEAD
25+
```
26+
27+
4. **Update CHANGELOG.md**: Add new version section with:
28+
- Version number and announcement text
29+
- Features section for new features
30+
- Bug Fixes section for bug fixes
31+
- Misc section for documentation/readme updates
32+
- Use format: `- Description [(#PR)](mdc:https:/github.com/getsentry/sentry-php/pull/PR)`
33+
34+
## CHANGELOG.md Format
35+
36+
```markdown
37+
## X.Y.Z
38+
39+
The Sentry SDK team is happy to announce the immediate availability of Sentry PHP SDK vX.Y.Z.
40+
41+
### Features
42+
43+
- New feature description [(#1234)](mdc:https:/github.com/getsentry/sentry-php/pull/1234)
44+
45+
### Bug Fixes
46+
47+
- Bug fix description [(#1235)](mdc:https:/github.com/getsentry/sentry-php/pull/1235)
48+
49+
### Misc
50+
51+
- Documentation/misc changes [(#1236)](mdc:https:/github.com/getsentry/sentry-php/pull/1236)
52+
```
53+
54+
## Committing Changes
55+
56+
After updating CHANGELOG.md:
57+
58+
1. **Stage only the changelog**: `git add CHANGELOG.md`
59+
2. **Create simple commit**: `git commit -m "Prepare X.Y.Z"`
60+
- Use simple commit message format
61+
- Don't include additional descriptions or generated tags
62+
63+
## Common Commands
64+
65+
- Check git status: `git status`
66+
- View recent commits: `git log --oneline -10`
67+
- Create branch: `git checkout -b branch-name`
68+
- Update from remote: `git pull origin master`

.cursor/rules/sentry-php.mdc

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: true
5+
---
6+
# Sentry PHP SDK Development Rules
7+
8+
## Project Overview
9+
The Sentry PHP SDK is an official error tracking and monitoring library for PHP applications. It provides error reporting, performance monitoring, and crash reporting capabilities.
10+
11+
## Core Requirements
12+
13+
### PHP Version Compatibility
14+
- All code must support PHP 7.2 and up (including PHP 8.x)
15+
- Use appropriate type hints and features compatible with the minimum PHP version
16+
- Test against multiple PHP versions in CI
17+
18+
### Breaking Changes Policy
19+
- No breaking changes to any public methods are allowed in minor/patch releases
20+
- Existing methods in interfaces cannot be altered without major version bump
21+
- Follow semantic versioning strictly as defined in [CONTRIBUTING.md](mdc:CONTRIBUTING.md)
22+
23+
## Code Quality Standards
24+
25+
### Code Style and Linting
26+
- All code must adhere to the project's code style
27+
- Run `composer cs-check` to check for linting errors
28+
- Use `composer cs-fix` to automatically fix linting issues
29+
- Configuration is in [.php-cs-fixer.dist.php](mdc:.php-cs-fixer.dist.php)
30+
31+
### Static Analysis
32+
- Code must pass PHPStan analysis (`composer phpstan`)
33+
- Code must pass Psalm analysis (`composer psalm`)
34+
- Baseline files exist for legacy issues: [phpstan-baseline.neon](mdc:phpstan-baseline.neon) and [psalm-baseline.xml](mdc:psalm-baseline.xml)
35+
36+
### Testing Requirements
37+
- All new features require comprehensive tests
38+
- Tests are located in the [tests/](mdc:tests) directory
39+
- Run tests with `composer tests` or `vendor/bin/phpunit`
40+
- Test structure mirrors the src/ directory structure
41+
- Use PHPUnit for unit testing
42+
43+
## Project Structure
44+
45+
### Main Source Code
46+
- Core SDK code is in [src/](mdc:src) directory
47+
- Entry point functions are in [src/functions.php](mdc:src/functions.php)
48+
- Main client class is [src/Client.php](mdc:src/Client.php)
49+
- Configuration handled by [src/Options.php](mdc:src/Options.php)
50+
51+
### Key Components
52+
- **Events**: [src/Event.php](mdc:src/Event.php) - Core event structure
53+
- **Error Handling**: [src/ErrorHandler.php](mdc:src/ErrorHandler.php) - Error capture
54+
- **Integrations**: [src/Integration/](mdc:src/Integration) - Framework integrations
55+
- **Transport**: [src/Transport/](mdc:src/Transport) - Data transmission
56+
- **Serialization**: [src/Serializer/](mdc:src/Serializer) - Data serialization
57+
- **Tracing**: [src/Tracing/](mdc:src/Tracing) - Performance monitoring
58+
- **Profiling**: [src/Profiling/](mdc:src/Profiling) - Performance profiling
59+
60+
### Dependencies
61+
- Core dependencies defined in [composer.json](mdc:composer.json)
62+
- PSR-7 HTTP messages via guzzlehttp/psr7
63+
- Symfony OptionsResolver for configuration
64+
- PSR-3 logging interface support
65+
66+
## Development Workflow
67+
68+
### Code Formatting
69+
- Always add import statements for all classes and functions used
70+
- Use proper PHP namespacing (`Sentry\` namespace)
71+
- Follow PSR-4 autoloading standards
72+
73+
### Commit Messages
74+
- Follow the commit message format: https://develop.sentry.dev/commit-messages/#commit-message-format
75+
- Use conventional commits for automatic changelog generation
76+
77+
### Pull Request Guidelines
78+
- Read [CONTRIBUTING.md](mdc:CONTRIBUTING.md) before submitting PRs
79+
- PRs use LOGAF scale for feedback (Low, Medium, High priority comments)
80+
- Ensure all CI checks pass (tests, linting, static analysis)
81+
- Add appropriate tests for new functionality
82+
83+
## Common Patterns
84+
85+
### Error Handling
86+
- Use proper exception handling and logging
87+
- Capture exceptions with appropriate context
88+
- Follow Sentry's error reporting best practices
89+
90+
### Configuration
91+
- Use [src/Options.php](mdc:src/Options.php) for configuration management
92+
- Support environment-based configuration
93+
- Provide sensible defaults
94+
95+
### Integration Development
96+
- New integrations go in [src/Integration/](mdc:src/Integration)
97+
- Follow existing integration patterns
98+
- Provide proper setup and teardown methods
99+
- Document integration usage
100+
101+
### Testing Patterns
102+
- Test files mirror source structure in [tests/](mdc:tests)
103+
- Use descriptive test method names
104+
- Include both positive and negative test cases
105+
- Mock external dependencies appropriately
106+
107+
## Documentation
108+
- Update [CHANGELOG.md](mdc:CHANGELOG.md) for user-facing changes
109+
- Follow upgrade guides pattern for breaking changes
110+
- Maintain compatibility with official Sentry documentation
111+
112+
## Release Process
113+
- Releases are managed through GitHub Actions and Craft
114+
- Follow the release process outlined in [CONTRIBUTING.md](mdc:CONTRIBUTING.md)
115+
- Two-person approval process for releases
116+
- Automatic changelog generation from conventional commits

CLAUDE.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Sentry PHP SDK Development Rules
2+
3+
## Project Overview
4+
The Sentry PHP SDK is an official error tracking and monitoring library for PHP applications. It provides error reporting, performance monitoring, and crash reporting capabilities.
5+
6+
## Core Requirements
7+
8+
### PHP Version Compatibility
9+
- All code must support PHP 7.2 and up (including PHP 8.x)
10+
- Use appropriate type hints and features compatible with the minimum PHP version
11+
- Test against multiple PHP versions in CI
12+
13+
### Breaking Changes Policy
14+
- No breaking changes to any public methods are allowed in minor/patch releases
15+
- Existing methods in interfaces cannot be altered without major version bump
16+
- Follow semantic versioning strictly as defined in [CONTRIBUTING.md](mdc:CONTRIBUTING.md)
17+
18+
## Code Quality Standards
19+
20+
### Code Style and Linting
21+
- All code must adhere to the project's code style
22+
- Run `composer cs-check` to check for linting errors
23+
- Use `composer cs-fix` to automatically fix linting issues
24+
- Configuration is in [.php-cs-fixer.dist.php](mdc:.php-cs-fixer.dist.php)
25+
26+
### Static Analysis
27+
- Code must pass PHPStan analysis (`composer phpstan`)
28+
- Code must pass Psalm analysis (`composer psalm`)
29+
- Baseline files exist for legacy issues: [phpstan-baseline.neon](mdc:phpstan-baseline.neon) and [psalm-baseline.xml](mdc:psalm-baseline.xml)
30+
31+
### Testing Requirements
32+
- All new features require comprehensive tests
33+
- Tests are located in the [tests/](mdc:tests) directory
34+
- Run tests with `composer tests` or `vendor/bin/phpunit`
35+
- Test structure mirrors the src/ directory structure
36+
- Use PHPUnit for unit testing
37+
38+
## Project Structure
39+
40+
### Main Source Code
41+
- Core SDK code is in [src/](mdc:src) directory
42+
- Entry point functions are in [src/functions.php](mdc:src/functions.php)
43+
- Main client class is [src/Client.php](mdc:src/Client.php)
44+
- Configuration handled by [src/Options.php](mdc:src/Options.php)
45+
46+
### Key Components
47+
- **Events**: [src/Event.php](mdc:src/Event.php) - Core event structure
48+
- **Error Handling**: [src/ErrorHandler.php](mdc:src/ErrorHandler.php) - Error capture
49+
- **Integrations**: [src/Integration/](mdc:src/Integration) - Framework integrations
50+
- **Transport**: [src/Transport/](mdc:src/Transport) - Data transmission
51+
- **Serialization**: [src/Serializer/](mdc:src/Serializer) - Data serialization
52+
- **Tracing**: [src/Tracing/](mdc:src/Tracing) - Performance monitoring
53+
- **Profiling**: [src/Profiling/](mdc:src/Profiling) - Performance profiling
54+
55+
### Dependencies
56+
- Core dependencies defined in [composer.json](mdc:composer.json)
57+
- PSR-7 HTTP messages via guzzlehttp/psr7
58+
- Symfony OptionsResolver for configuration
59+
- PSR-3 logging interface support
60+
61+
## Development Workflow
62+
63+
### Code Formatting
64+
- Always add import statements for all classes and functions used
65+
- Use proper PHP namespacing (`Sentry\` namespace)
66+
- Follow PSR-4 autoloading standards
67+
68+
### Commit Messages
69+
- Follow the commit message format: https://develop.sentry.dev/commit-messages/#commit-message-format
70+
- Use conventional commits for automatic changelog generation
71+
72+
### Pull Request Guidelines
73+
- Read [CONTRIBUTING.md](mdc:CONTRIBUTING.md) before submitting PRs
74+
- PRs use LOGAF scale for feedback (Low, Medium, High priority comments)
75+
- Ensure all CI checks pass (tests, linting, static analysis)
76+
- Add appropriate tests for new functionality
77+
78+
## Common Patterns
79+
80+
### Error Handling
81+
- Use proper exception handling and logging
82+
- Capture exceptions with appropriate context
83+
- Follow Sentry's error reporting best practices
84+
85+
### Configuration
86+
- Use [src/Options.php](mdc:src/Options.php) for configuration management
87+
- Support environment-based configuration
88+
- Provide sensible defaults
89+
90+
### Integration Development
91+
- New integrations go in [src/Integration/](mdc:src/Integration)
92+
- Follow existing integration patterns
93+
- Provide proper setup and teardown methods
94+
- Document integration usage
95+
96+
### Testing Patterns
97+
- Test files mirror source structure in [tests/](mdc:tests)
98+
- Use descriptive test method names
99+
- Include both positive and negative test cases
100+
- Mock external dependencies appropriately
101+
102+
## Documentation
103+
- Update [CHANGELOG.md](mdc:CHANGELOG.md) for user-facing changes
104+
- Follow upgrade guides pattern for breaking changes
105+
- Maintain compatibility with official Sentry documentation
106+
107+
## Release Process
108+
- Releases are managed through GitHub Actions and Craft
109+
- Follow the release process outlined in [CONTRIBUTING.md](mdc:CONTRIBUTING.md)
110+
- Two-person approval process for releases
111+
- Automatic changelog generation from conventional commits

0 commit comments

Comments
 (0)