-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path820-open-source.mdc
More file actions
468 lines (335 loc) · 8.76 KB
/
Copy path820-open-source.mdc
File metadata and controls
468 lines (335 loc) · 8.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
---
title: Open Source Project Engineering Ruleset
description: Best practices for open source projects including contribution guidelines, documentation, and community management.
priority: 820
alwaysApply: false
files:
include:
- ".github/CONTRIBUTING.md"
- "CONTRIBUTORS.md"
- ".all-contributorsrc"
- "LICENSE"
- "CHANGELOG.md"
---
# Open Source Project Engineering Ruleset
**Goal:** Create welcoming, maintainable open source projects that encourage contributions and make it easy for others to use and contribute.
## Essential Files
### .github/CONTRIBUTING.md
**MUST** include:
- How to set up development environment
- How to run tests
- Code style and formatting guidelines
- How to submit pull requests
- How to report bugs
- Code of conduct reference
**Template:**
```markdown
# Contributing
Thank you for your interest in contributing!
## Development Setup
1. Fork the repository
2. Clone your fork: `git clone https://github.com/your-username/project.git`
3. Install dependencies: `make init`
4. Run tests: `make test`
## Making Changes
1. Create a branch: `git checkout -b feature/your-feature`
2. Make your changes
3. Run tests: `make test`
4. Run linter: `make lint`
5. Commit using [conventional commits](https://www.conventionalcommits.org/)
6. Push and open a pull request
> [!NOTE]
> **Agents:** remote writes (push/PR creation) are default-deny and require explicit authorization (see `020-agent-audit.mdc`).
## Code Style
- Follow the existing code style
- Run `make lint` before committing
- Add tests for new features
- Update documentation as needed
## Reporting Bugs
Use GitHub Issues and include:
- Description of the bug
- Steps to reproduce
- Expected vs actual behavior
- Environment details (OS, version, etc.)
## Questions?
Open a GitHub Discussion or reach out to maintainers.
```
### LICENSE
**MUST** include a license file. Common choices:
- **MIT** - Permissive, widely used
- **Apache 2.0** - Permissive with patent grant
- **GPL v3** - Copyleft, requires derivative works to be open source
- **BSD 3-Clause** - Permissive, similar to MIT
### README.md
**MUST** include:
- Project description and purpose
- Quick start / installation instructions
- Basic usage examples
- Link to full documentation
- Contributing guidelines link
- License information
- Badges (build status, version, etc.)
### CHANGELOG.md
**SHOULD** maintain a changelog following [Keep a Changelog](https://keepachangelog.com/) format:
```markdown
# Changelog
## [1.2.0] - 2025-01-15
### Added
- New feature X
- Support for Y
### Changed
- Improved performance of Z
### Fixed
- Bug fix A
- Bug fix B
## [1.1.0] - 2025-01-01
...
```
## Contribution Tracking
### All Contributors
Use [All Contributors](https://allcontributors.org/) to recognize contributions:
**Installation:**
```bash
npm install -D all-contributors-cli
```
**Configuration (`.all-contributorsrc`):**
```json
{
"projectName": "my-project",
"projectOwner": "your-username",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"imageSize": 100,
"commit": true,
"contributors": [],
"contributorsPerLine": 7
}
```
**Usage:**
```bash
# Add a contributor
npx all-contributors add username code,doc
# Update README
npx all-contributors generate
```
**Contribution Types:**
- `code` - Code contributions
- `doc` - Documentation
- `bug` - Bug reports
- `ideas` - Ideas/planning
- `review` - Pull request reviews
- `test` - Tests
- `translation` - Translations
- `question` - Answering questions
- `maintenance` - Maintenance work
### CONTRIBUTORS.md
Alternative to All Contributors, manually maintained:
```markdown
# Contributors
Thank you to all contributors!
## Core Maintainers
- [@username1](https://github.com/username1)
- [@username2](https://github.com/username2)
## Contributors
- [@contributor1](https://github.com/contributor1) - Feature X, Bug fix Y
- [@contributor2](https://github.com/contributor2) - Documentation improvements
```
## Code of Conduct
**SHOULD** include a Code of Conduct. Use [Contributor Covenant](https://www.contributor-covenant.org/):
```markdown
# Contributor Covenant Code of Conduct
## Our Pledge
We pledge to make participation in our project a harassment-free experience...
[Full text from contributor-covenant.org]
```
## Issue Templates
Create `.github/ISSUE_TEMPLATE/`:
### Bug Report Template
```markdown
---
name: Bug Report
about: Report a bug
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear description of what the bug is.
**To Reproduce**
Steps to reproduce:
1. ...
2. ...
**Expected behavior**
What you expected to happen.
**Environment:**
- OS: [e.g., macOS 14.0]
- Version: [e.g., 1.2.3]
- Other relevant details
**Additional context**
Any other context about the problem.
```
### Feature Request Template
```markdown
---
name: Feature Request
about: Suggest a new feature
title: ''
labels: enhancement
assignees: ''
---
**Describe the feature**
A clear description of what you want.
**Use case**
Why is this feature needed?
**Proposed solution**
How should this work?
**Alternatives considered**
Other solutions you've considered.
```
## Pull Request Template
Create `.github/PULL_REQUEST_TEMPLATE.md`:
```markdown
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Tests added/updated
- [ ] Manual testing performed
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Comments added for complex logic
- [ ] Documentation updated
- [ ] No new warnings generated
- [ ] Tests pass locally
```
## Documentation Standards
### API Documentation
- Document all public APIs
- Include examples
- Document parameters and return values
- Include error cases
### Examples
Provide working examples:
```markdown
## Examples
### Basic Usage
\`\`\`python
from mylib import MyClass
obj = MyClass()
result = obj.do_something()
\`\`\`
### Advanced Usage
\`\`\`python
# More complex example
...
\`\`\`
```
## Release Management
### Semantic Versioning
Follow [Semantic Versioning](https://semver.org/):
- **MAJOR** - Breaking changes
- **MINOR** - New features (backward compatible)
- **PATCH** - Bug fixes (backward compatible)
### Release Process
1. Update version in code
2. Update CHANGELOG.md
3. Create git tag: `git tag v1.2.0`
4. Push tag: `git push origin v1.2.0`
5. Create GitHub release
6. Publish to package registry (if applicable)
## Security
### Security Policy
Create `SECURITY.md`:
```markdown
# Security Policy
## Supported Versions
| Version | Supported |
| ------- | ------------------ |
| 1.x.x | :white_check_mark: |
| < 1.0 | :x: |
## Reporting a Vulnerability
Please report security vulnerabilities to security@acme.com
Do not open public issues for security vulnerabilities.
```
### Dependency Management
- Regularly update dependencies
- Use Dependabot or similar
- Audit for vulnerabilities
- Pin versions in production
## Community Management
### Responding to Issues
- Acknowledge issues promptly (within 48 hours)
- Ask clarifying questions
- Label issues appropriately
- Close issues when resolved (with explanation)
### Reviewing Pull Requests
- Review within a week
- Provide constructive feedback
- Thank contributors
- Merge when ready
### Communication
- Be welcoming and inclusive
- Use inclusive language
- Assume good intent
- Be patient with newcomers
## Automation
### GitHub Actions
Automate common tasks:
- CI/CD pipelines
- Dependency updates (Dependabot)
- Release automation
- Label management
- Stale issue/PR management
### Pre-commit Hooks
Enforce code quality:
```yaml
# .pre-commit-config.yaml
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
```
## Best Practices
### Making It Easy to Contribute
- Clear setup instructions
- Good first issues labeled
- Comprehensive documentation
- Responsive maintainers
### Maintaining Quality
- Code reviews for all PRs
- Automated testing
- Linting and formatting
- Documentation requirements
### Building Community
- Welcome new contributors
- Recognize contributions
- Regular communication
- Clear project vision
## Review Checklist
When reviewing open source projects, check:
- [ ] .github/CONTRIBUTING.md exists and is comprehensive
- [ ] LICENSE file is present
- [ ] README.md is clear and helpful
- [ ] CHANGELOG.md is maintained
- [ ] Code of Conduct is present
- [ ] Issue templates are set up
- [ ] PR template is configured
- [ ] Security policy exists
- [ ] Contribution tracking is in place
- [ ] Documentation is up to date
- [ ] Examples are provided
- [ ] CI/CD is configured
- [ ] Dependencies are managed
---