Skip to content

Commit c1e06aa

Browse files
docs(ci): enforce squash merge with conventional commits for automated releases (#14)
Add comprehensive documentation and templates to enforce squash merge workflow and conventional commits, fixing semantic-release integration. Changes: - Add .github/pull_request_template.md: Guide contributors to provide conventional commit message in PR description for squash merge - Add .github/CONTRIBUTING.md: Complete contributing guide covering development setup, PR process, conventional commits, code style, testing, and feature development workflow - Add .github/SQUASH_MERGE.md: Repository configuration instructions for maintainers to enable squash merge only via GitHub settings or CLI - Update README.md: Add contributing section linking to new documentation and emphasizing squash merge requirement - Update tracking/documentation.md: Document this configuration work Problem Solved: Previous PR #13 merge commit "Fix/security patches (#13)" didn't follow conventional commit format, causing semantic-release to skip release. Squash merge ensures single commit per PR with proper format. Benefits: - Clean git history (one commit per feature/fix) - Automatic semantic versioning from commit messages - Proper changelog generation via semantic-release - Easy rollbacks with single commit per feature - Consistent commit format enforcement Configuration Required: Repository maintainer must configure GitHub settings to disable merge commits and rebase merging, enable squash merge only. Instructions provided in .github/SQUASH_MERGE.md. Refs: #13 Co-authored-by: Danny Teller <[email protected]>
1 parent 5c2afcb commit c1e06aa

File tree

5 files changed

+710
-0
lines changed

5 files changed

+710
-0
lines changed

.github/CONTRIBUTING.md

Lines changed: 336 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,336 @@
1+
# Contributing to matlas-cli
2+
3+
Thank you for your interest in contributing to matlas-cli! This guide will help you get started.
4+
5+
## Table of Contents
6+
7+
- [Development Setup](#development-setup)
8+
- [Pull Request Process](#pull-request-process)
9+
- [Commit Message Guidelines](#commit-message-guidelines)
10+
- [Code Style](#code-style)
11+
- [Testing](#testing)
12+
- [Feature Development](#feature-development)
13+
14+
## Development Setup
15+
16+
### Prerequisites
17+
18+
- **Go 1.24+** required
19+
- Git
20+
- Make (optional, but recommended)
21+
22+
### Getting Started
23+
24+
1. **Fork and clone the repository**:
25+
```bash
26+
git clone https://github.com/YOUR_USERNAME/matlas-cli.git
27+
cd matlas-cli
28+
```
29+
30+
2. **Install dependencies**:
31+
```bash
32+
go mod download
33+
```
34+
35+
3. **Build the project**:
36+
```bash
37+
make build
38+
# or
39+
go build -o bin/matlas ./...
40+
```
41+
42+
4. **Run tests**:
43+
```bash
44+
make test
45+
```
46+
47+
## Pull Request Process
48+
49+
### Before Submitting
50+
51+
1. **Create a feature branch** from `main`:
52+
```bash
53+
git checkout -b feature/my-feature
54+
# or
55+
git checkout -b fix/issue-description
56+
```
57+
58+
2. **Make your changes** following our code style and guidelines
59+
60+
3. **Test your changes**:
61+
```bash
62+
make test
63+
make lint
64+
```
65+
66+
4. **Update documentation** if needed:
67+
- Update relevant files in `docs/`
68+
- Update `CHANGELOG.md` under `## [Unreleased]` section
69+
- Add examples to `examples/` if introducing new features
70+
- Create feature tracking file in `features/` using `features/TEMPLATE.md`
71+
72+
### Submitting Your PR
73+
74+
1. **Push your branch**:
75+
```bash
76+
git push origin feature/my-feature
77+
```
78+
79+
2. **Open a Pull Request** on GitHub
80+
81+
3. **Fill out the PR template** completely:
82+
- Provide clear description
83+
- Select the type of change
84+
- Specify scope (if applicable)
85+
- Provide a **conventional commit message** that will be used for squash merge
86+
- Check all applicable items in the checklist
87+
88+
### Merge Process
89+
90+
**This repository uses SQUASH MERGE ONLY**. When your PR is merged:
91+
92+
- All commits will be squashed into a single commit
93+
- The commit message will be taken from the PR template
94+
- The commit message MUST follow [Conventional Commits](https://www.conventionalcommits.org/) format
95+
- This ensures proper versioning and changelog generation via semantic-release
96+
97+
## Commit Message Guidelines
98+
99+
We follow [Conventional Commits](https://www.conventionalcommits.org/) specification for automatic versioning and changelog generation.
100+
101+
### Format
102+
103+
```
104+
<type>(<optional scope>): <short summary>
105+
106+
<optional body>
107+
108+
<optional footer(s)>
109+
```
110+
111+
### Types
112+
113+
| Type | Description | Version Impact | In Changelog |
114+
|------|-------------|----------------|--------------|
115+
| `feat` | New feature | Minor (0.X.0) | ✅ Features |
116+
| `fix` | Bug fix | Patch (0.0.X) | ✅ Bug Fixes |
117+
| `perf` | Performance improvement | Patch (0.0.X) | ✅ Performance |
118+
| `refactor` | Code refactoring | Patch (0.0.X) | ✅ Refactoring |
119+
| `docs` | Documentation only | Patch (0.0.X) | ✅ Documentation |
120+
| `test` | Tests only | None | ❌ Hidden |
121+
| `build` | Build system or deps | None | ❌ Hidden |
122+
| `ci` | CI configuration | None | ❌ Hidden |
123+
| `chore` | Maintenance tasks | None | ❌ Hidden |
124+
125+
### Scopes
126+
127+
Use repository areas for clarity:
128+
129+
- `infra` - Infrastructure/apply workflows
130+
- `atlas` - Atlas API operations
131+
- `database` - Database operations
132+
- `cli` - CLI framework/flags
133+
- `docs` - Documentation
134+
- `types` - Type definitions
135+
- `services` - Service layer
136+
- etc.
137+
138+
### Examples
139+
140+
**Feature:**
141+
```
142+
feat(atlas): add VPC endpoint management commands
143+
144+
Implement create, list, get, and delete operations for Atlas VPC endpoints.
145+
Supports AWS, Azure, and GCP providers.
146+
147+
Closes: #123
148+
```
149+
150+
**Bug fix:**
151+
```
152+
fix(database): correct pagination when limit is provided
153+
154+
The list operation was ignoring the --limit flag when paginating
155+
through results. Now properly respects the limit parameter.
156+
157+
Fixes: #456
158+
```
159+
160+
**Documentation:**
161+
```
162+
docs: update installation instructions for Windows
163+
164+
Added PowerShell examples and troubleshooting section.
165+
```
166+
167+
**Breaking change:**
168+
```
169+
feat(infra)!: remove deprecated --legacy flag from apply command
170+
171+
BREAKING CHANGE: The --legacy flag has been removed. Users should
172+
migrate to the new apply format described in docs/infra.md.
173+
174+
Closes: #789
175+
```
176+
177+
### Breaking Changes
178+
179+
To mark a breaking change, use one of these methods:
180+
181+
1. **Append `!` after type/scope**:
182+
```
183+
feat(api)!: drop support for v1 endpoints
184+
```
185+
186+
2. **Include `BREAKING CHANGE:` footer**:
187+
```
188+
feat(infra): update apply pipeline
189+
190+
BREAKING CHANGE: removed --legacy flag, use new format instead
191+
```
192+
193+
## Code Style
194+
195+
### Go Code Guidelines
196+
197+
- Follow standard Go conventions and idioms
198+
- Use `gofmt` for formatting (automatically applied by `make fmt`)
199+
- Run `make lint` before committing
200+
- Add comments for exported functions and complex logic
201+
- Write meaningful variable and function names
202+
203+
### Error Handling
204+
205+
Follow our error handling standards (see `.cursor/rules/error-handling.mdc`):
206+
207+
- Preserve real causes with wrapped errors
208+
- Support both concise and verbose output modes
209+
- Use consistent error formatting across commands
210+
211+
### Logging
212+
213+
Follow logging guidelines (see `.cursor/rules/logging.mdc`):
214+
215+
- Use appropriate log levels (Debug, Info, Warn, Error)
216+
- Automatically mask sensitive data (credentials, connection strings)
217+
- Provide context in log messages
218+
219+
## Testing
220+
221+
### Running Tests
222+
223+
```bash
224+
# Run all tests
225+
make test
226+
227+
# Run specific test package
228+
go test ./internal/services/atlas/...
229+
230+
# Run with coverage
231+
go test -cover ./...
232+
233+
# Run with race detector
234+
go test -race ./...
235+
```
236+
237+
### Writing Tests
238+
239+
- Write unit tests for new functionality
240+
- Update existing tests when modifying behavior
241+
- Use table-driven tests where appropriate
242+
- Mock external dependencies (Atlas SDK, MongoDB driver)
243+
- Follow existing test patterns in the codebase
244+
245+
### Live Tests
246+
247+
For integration tests with real Atlas/MongoDB instances:
248+
249+
- Place test scripts in `scripts/`
250+
- Follow the live tests policy (`.cursor/rules/live-tests.mdc`)
251+
- Document prerequisites and setup instructions
252+
253+
## Feature Development
254+
255+
When adding new user-facing features, ALWAYS provide:
256+
257+
### 1. CLI Interface
258+
259+
- Add or extend subcommands in the appropriate command group:
260+
- `cmd/infra/` - Infrastructure workflows
261+
- `cmd/atlas/` - Atlas resource management
262+
- `cmd/database/` - Database operations
263+
- `cmd/config/` - Configuration management
264+
265+
- Use consistent flag naming and patterns
266+
- Update command help text and examples
267+
268+
### 2. YAML ApplyDocument Support
269+
270+
If the feature can be expressed declaratively:
271+
272+
- Define or extend types in `internal/types/`
273+
- Add YAML kind support in `internal/apply/loader.go`
274+
- Implement validation in `internal/apply/validation.go`
275+
- Wire execution in `internal/apply/executor.go`
276+
- Both CLI and YAML must use same `internal/services/*` logic
277+
278+
### 3. Documentation
279+
280+
- Update command documentation in `docs/`
281+
- Add examples to `examples/`
282+
- Update `CHANGELOG.md` under `## [Unreleased]`
283+
- Create feature tracking file in `features/` using template
284+
285+
### 4. Feature Tracking
286+
287+
Create a summary file following `features/TEMPLATE.md`:
288+
289+
```bash
290+
cp features/TEMPLATE.md features/$(date +%F)-<short-slug>.md
291+
```
292+
293+
Minimum content:
294+
- Title: `Feature: <name>`
295+
- Summary: 2-6 sentences describing the feature
296+
- Implementation details (CLI, YAML, services, tests, docs)
297+
298+
See `.cursor/rules/feature-format-support.mdc` for complete requirements.
299+
300+
## Documentation Standards
301+
302+
### Writing Documentation
303+
304+
All documentation must:
305+
306+
- Reside under `docs/` directory
307+
- Use Jekyll frontmatter (layout, title, permalink)
308+
- Follow GitHub Pages Jekyll setup in `docs/_config.yml`
309+
- Include code examples with proper syntax highlighting
310+
- Update navigation in `docs/_config.yml` for new pages
311+
312+
### Preview Documentation Locally
313+
314+
```bash
315+
cd docs
316+
bundle install
317+
bundle exec jekyll serve
318+
```
319+
320+
Visit `http://localhost:4000/matlas-cli/` to preview.
321+
322+
See `.cursor/rules/documentation-standards.mdc` for complete requirements.
323+
324+
## Getting Help
325+
326+
- **Questions?** Open a [Discussion](https://github.com/teabranch/matlas-cli/discussions)
327+
- **Bug Reports:** Open an [Issue](https://github.com/teabranch/matlas-cli/issues)
328+
- **Feature Requests:** Open an [Issue](https://github.com/teabranch/matlas-cli/issues) with the "enhancement" label
329+
330+
## Code of Conduct
331+
332+
Please be respectful and constructive in all interactions. We're building this tool together for the MongoDB community.
333+
334+
---
335+
336+
Thank you for contributing to matlas-cli! 🚀

0 commit comments

Comments
 (0)