Thank you for your interest in contributing to NoteDown! This guide will help you get started with development, building, and submitting changes.
- Quick Start
- Development Setup
- Build System
- Development Workflow
- Testing
- Code Standards
- Release Process
- Submitting Changes
- Getting Help
# 1. Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/NoteDown.git
cd NoteDown
# 2. Set up development environment
make setup
# 3. Build and test
make dev
make test
# 4. Make your changes
# ... edit files ...
# 5. Test your changes
make fmt
make lint
make test
make build
# 6. Submit a pull request- Go 1.19+ - Install Go
- Git - Install Git
- Node.js & npm - Install Node.js (for VSCode extension)
- Make - Usually pre-installed on Linux/macOS, Install on Windows
# Automated setup (recommended)
make setup
# This will install:
# - golangci-lint for Go linting
# - npm dependencies for VSCode extension
# - vsce for extension packaging# Install Go linting tool
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.54.2
# Install VSCode extension dependencies
cd vscode-extension
npm install
npm install -g @vscode/vsce
cd ..
# Download Go modules
go mod downloadNoteDown uses a comprehensive Makefile-based build system. See the Build System Guide for full details.
| Command | Purpose | When to Use |
|---|---|---|
make dev |
Development build with race detection | Daily development |
make build |
Production build for current platform | Testing your changes |
make test |
Run all tests | Before committing |
make lint |
Run linters | Before committing |
make fmt |
Format code | Before committing |
make clean |
Clean build artifacts | When switching branches |
# Build for all platforms (takes longer)
make build-cli
# Test specific platform
GOOS=windows GOARCH=amd64 go build -o noted.exe ./cmd/noted# 1. Start with a clean state
make clean
# 2. Pull latest changes
git pull origin main
# 3. Create a feature branch
git checkout -b feature/your-feature-name
# 4. Make your changes
# ... edit files ...
# 5. Test as you go
make dev # Quick build with race detection
./noted --help # Test the binary
# 6. Before committing
make fmt # Format code
make lint # Check for issues
make test # Run tests
make build # Full build
make test-build # Test the built binary# Build extension
make build-vscode
# Install for testing
# 1. Open VSCode
# 2. Ctrl+Shift+P -> "Extensions: Install from VSIX"
# 3. Select dist/notedown-vscode-X.X.X.vsix
# Development with watch mode
cd vscode-extension
npm run watch # Rebuilds on file changes# Run all tests
make test
# Run specific test suites
go test ./... # Go tests only
cd vscode-extension && npm test # VSCode extension tests
# Run tests with coverage
go test -cover ./...
# Run tests in verbose mode
go test -v ./...- Place test files alongside source files with
_test.gosuffix - Use table-driven tests for multiple test cases
- Include both unit tests and integration tests
func TestFunction(t *testing.T) {
tests := []struct {
name string
input string
expected string
}{
{"basic case", "input", "expected"},
// ... more test cases
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := Function(tt.input)
if result != tt.expected {
t.Errorf("got %v, want %v", result, tt.expected)
}
})
}
}- Use the VSCode testing framework
- Place tests in
vscode-extension/src/test/ - Test both unit functionality and extension integration
Always test your changes thoroughly:
# 1. Build and basic functionality test
make build
./dist/noted --version
./dist/noted --help
# 2. Test CLI commands
./dist/noted init test-repo
cd test-repo
../dist/noted new "Test Note"
../dist/noted list
cd ..
# 3. Test VSCode extension
make build-vscode
# Install and test in VSCode
# 4. Clean up
rm -rf test-repo- Follow Go Code Review Comments
- Use
gofmtandgoimportsfor formatting - Add comments for exported functions and types
- Handle errors appropriately
- Use meaningful variable and function names
// Good: Descriptive function with proper error handling
func CreateNote(title, content string) (*Note, error) {
if title == "" {
return nil, fmt.Errorf("title cannot be empty")
}
note := &Note{
Title: title,
Content: content,
Created: time.Now(),
}
if err := note.Validate(); err != nil {
return nil, fmt.Errorf("invalid note: %w", err)
}
return note, nil
}- Follow TypeScript Style Guide
- Use ESLint for linting
- Add JSDoc comments for functions
- Use proper TypeScript types
/**
* Creates a new note in the workspace
* @param title The note title
* @param content The note content
* @returns Promise resolving to the created note
*/
async function createNote(title: string, content: string): Promise<Note> {
if (!title.trim()) {
throw new Error('Title cannot be empty');
}
const note: Note = {
title: title.trim(),
content: content.trim(),
created: new Date(),
};
return await noteService.create(note);
}- Update documentation when adding features
- Include practical examples in documentation
- Update the changelog for significant changes
- Add inline code comments for complex logic
The release process is largely automated through the build system:
# Ensure everything is clean and tested
make clean
make test
make lint
make release
# Verify release artifacts
ls -la dist/
cat dist/checksums.sha256Version is automatically detected from vscode-extension/package.json:
{
"version": "0.2.0"
}To release a new version:
- Update the version in
vscode-extension/package.json - Commit the version change
- Create a git tag:
git tag -a v0.2.0 -m "Release v0.2.0" - Push:
git push origin v0.2.0
# Create complete release with checksums
make checksums
# Upload to GitHub releases:
# - All .tar.gz files
# - All .zip files
# - .vsix file
# - checksums.sha256The project supports GitHub Actions for automated releases:
# .github/workflows/release.yml
name: Release
on:
push:
tags: ['v*']
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Build releases
run: make checksums
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.tar.gz
dist/*.zip
dist/*.vsix
dist/checksums.sha256- All tests pass (
make test) - Code is properly formatted (
make fmt) - No linting issues (
make lint) - Version updated in
package.json - Documentation updated
- Changelog updated
- Release builds successfully (
make release) - Checksums generated (
make checksums) - Git tag created and pushed
- GitHub release created with all artifacts
# Pre-submission checklist
make clean
make fmt
make lint
make test
make build
make test-build
# Ensure no build artifacts are committed
git status- Fork the repository and create your branch from
main - Make your changes following the development workflow
- Add tests for new functionality
- Update documentation as needed
- Run the full test suite and ensure it passes
- Submit a pull request with:
- Clear title describing the change
- Detailed description of what was changed and why
- Link to any related issues
- Screenshots for UI changes
## Description
Brief description of changes and motivation.
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
- [ ] Build system change
## Testing
- [ ] Tests added/updated
- [ ] All tests pass locally
- [ ] Tested on multiple platforms (if applicable)
## Documentation
- [ ] Documentation updated
- [ ] README updated (if needed)
- [ ] Comments added for complex code
## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] No unnecessary debug/console statements
- [ ] Build artifacts not included in commit- Open a GitHub Discussion
- Check existing issues
- Review the documentation
- See the Build System Guide
- Check the Troubleshooting section
- Ensure you have all prerequisites installed
- All submissions require review before merging
- Reviews focus on code quality, testing, and documentation
- Address reviewer feedback promptly
- Squash commits before final merge if requested
Use conventional commit format:
type(scope): description
feat(cli): add new note creation command
fix(vscode): resolve extension loading issue
docs(build): update cross-platform build guide
feature/description- New featuresfix/description- Bug fixesdocs/description- Documentation updatesrefactor/description- Code refactoring
- Keep functions focused and small
- Use meaningful names for variables and functions
- Add comments for complex business logic
- Group related functionality together
- Follow existing project structure
Thank you for contributing to NoteDown! 🚀
Your contributions help make NoteDown a better tool for everyone. If you have questions about contributing, don't hesitate to ask in the discussions or open an issue.