- Update .woodpecker/codex-review.yml: node:22-slim → node:24-slim - Update packages/cli-tools engines: >=18 → >=24.0.0 - Update README.md, CONTRIBUTING.md, prerequisites docs to reference Node 24+ - Rename eslint.config.js → eslint.config.mjs to eliminate Node 24 MODULE_TYPELESS_PACKAGE_JSON warnings (ESM detection overhead) - Add .nvmrc targeting Node 24 - Fix pre-existing no-unsafe-return lint error in matrix-room.service.ts - Add Campsite Rule to CLAUDE.md - Regenerate Prisma client for Node 24 compatibility All Dockerfiles and main CI pipelines already used node:24. This commit aligns the remaining stragglers (codex-review CI, cli-tools engines, documentation) and resolves Node 24 ESM module detection warnings. Quality gates: lint ✅ typecheck ✅ tests ✅ (6 pre-existing API failures) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
11 KiB
Contributing to Mosaic Stack
Thank you for your interest in contributing to Mosaic Stack! This document provides guidelines and processes for contributing effectively.
Table of Contents
- Development Environment Setup
- Code Style Guidelines
- Branch Naming Conventions
- Commit Message Format
- Pull Request Process
- Testing Requirements
- Where to Ask Questions
Development Environment Setup
Prerequisites
- Node.js: 24.0.0 or higher
- pnpm: 10.0.0 or higher (package manager)
- Docker: 20.10+ and Docker Compose 2.x+ (for database services)
- Git: 2.30+ for version control
Installation Steps
-
Clone the repository
git clone https://git.mosaicstack.dev/mosaic/stack mosaic-stack cd mosaic-stack -
Install dependencies
pnpm install -
Set up environment variables
cp .env.example .env # Edit .env with your configurationKey variables to configure:
DATABASE_URL- PostgreSQL connection stringOIDC_ISSUER- Authentik OIDC issuer URLOIDC_CLIENT_ID- OAuth client IDOIDC_CLIENT_SECRET- OAuth client secretJWT_SECRET- Random secret for session tokens
-
Initialize the database
# Start Docker services (PostgreSQL, Valkey) docker compose up -d # Generate Prisma client pnpm prisma:generate # Run migrations pnpm prisma:migrate # Seed development data (optional) pnpm prisma:seed -
Start development servers
pnpm devThis starts all services:
- Web: http://localhost:3000
- API: http://localhost:3001
Quick Reference Commands
| Command | Description |
|---|---|
pnpm dev |
Start all development servers |
pnpm dev:api |
Start API only |
pnpm dev:web |
Start Web only |
docker compose up -d |
Start Docker services |
docker compose logs -f |
View Docker logs |
pnpm prisma:studio |
Open Prisma Studio GUI |
make help |
View all available commands |
Code Style Guidelines
Mosaic Stack follows strict code style guidelines to maintain consistency and quality. For comprehensive guidelines, see CLAUDE.md.
Formatting
We use Prettier for consistent code formatting:
- Semicolons: Required
- Quotes: Double quotes (
") - Indentation: 2 spaces
- Trailing commas: ES5 compatible
- Line width: 100 characters
- End of line: LF (Unix style)
Run the formatter:
pnpm format # Format all files
pnpm format:check # Check formatting without changes
Linting
We use ESLint for code quality checks:
pnpm lint # Run linter
pnpm lint:fix # Auto-fix linting issues
TypeScript
All code must be strictly typed TypeScript:
- No
anytypes allowed - Explicit type annotations for function returns
- Interfaces over type aliases for object shapes
- Use shared types from
@mosaic/sharedpackage
PDA-Friendly Design (NON-NEGOTIABLE)
Never use demanding or stressful language in UI text:
| ❌ AVOID | ✅ INSTEAD |
|---|---|
| OVERDUE | Target passed |
| URGENT | Approaching target |
| MUST DO | Scheduled for |
| CRITICAL | High priority |
| YOU NEED TO | Consider / Option to |
| REQUIRED | Recommended |
See docs/3-architecture/3-design-principles/1-pda-friendly.md for complete design principles.
Branch Naming Conventions
We follow a Git-based workflow with the following branch types:
Branch Types
| Prefix | Purpose | Example |
|---|---|---|
feature/ |
New features | feature/42-user-dashboard |
fix/ |
Bug fixes | fix/123-auth-redirect |
docs/ |
Documentation | docs/contributing |
refactor/ |
Code refactoring | refactor/prisma-queries |
test/ |
Test-only changes | test/coverage-improvements |
Workflow
- Always branch from
develop - Merge back to
developvia pull request mainis for stable releases only
# Start a new feature
git checkout develop
git pull --rebase
git checkout -b feature/my-feature-name
# Make your changes
# ...
# Commit and push
git push origin feature/my-feature-name
Commit Message Format
We use Conventional Commits for clear, structured commit messages:
Format
<type>(#issue): Brief description
Detailed explanation (optional).
References: #123
Types
| Type | Description |
|---|---|
feat |
New feature |
fix |
Bug fix |
docs |
Documentation changes |
test |
Adding or updating tests |
refactor |
Code refactoring (no functional change) |
chore |
Maintenance tasks, dependencies |
Examples
feat(#42): add user dashboard widget
Implements the dashboard widget with task and event summary cards.
Responsive design with PDA-friendly language.
fix(#123): resolve auth redirect loop
Fixed OIDC token refresh causing redirect loops on session expiry.
refactor(#45): extract database query utilities
Moved duplicate query logic to shared utilities package.
test(#67): add coverage for activity service
Added unit tests for all activity service methods.
docs: update API documentation for endpoints
Clarified pagination and filtering parameters.
Commit Guidelines
- Keep the subject line under 72 characters
- Use imperative mood ("add" not "added" or "adds")
- Reference issue numbers when applicable
- Group related commits before creating PR
Pull Request Process
Before Creating a PR
-
Ensure tests pass
pnpm test pnpm build -
Check code coverage (minimum 85%)
pnpm test:coverage -
Format and lint
pnpm format pnpm lint -
Update documentation if needed
- API docs in
docs/4-api/ - Architecture docs in
docs/3-architecture/
- API docs in
Creating a Pull Request
-
Push your branch to the remote
git push origin feature/my-feature -
Create a PR via GitLab at: https://git.mosaicstack.dev/mosaic/stack/-/merge_requests
-
Target branch:
develop -
Fill in the PR template:
- Title:
feat(#issue): Brief description(follows commit format) - Description: Summary of changes, testing done, and any breaking changes
- Title:
-
Link related issues using
Closes #123orReferences #123
PR Review Process
- Automated checks: CI runs tests, linting, and coverage
- Code review: At least one maintainer approval required
- Feedback cycle: Address review comments and push updates
- Merge: Maintainers merge after approval and checks pass
Merge Guidelines
- Rebase commits before merging (keep history clean)
- Squash small fix commits into the main feature commit
- Delete feature branch after merge
- Update milestone if applicable
Testing Requirements
Test-Driven Development (TDD)
All new code must follow TDD principles. This is non-negotiable.
TDD Workflow: Red-Green-Refactor
-
RED - Write a failing test first
# Write test for new functionality pnpm test:watch # Watch it fail git add feature.test.ts git commit -m "test(#42): add test for getUserById" -
GREEN - Write minimal code to pass the test
# Implement just enough to pass pnpm test:watch # Watch it pass git add feature.ts git commit -m "feat(#42): implement getUserById" -
REFACTOR - Clean up while keeping tests green
# Improve code quality pnpm test:watch # Ensure still passing git add feature.ts git commit -m "refactor(#42): extract user mapping logic"
Coverage Requirements
- Minimum 85% code coverage for all new code
- Write tests BEFORE implementation — no exceptions
- Test files co-located with source:
feature.service.ts→feature.service.spec.tscomponent.tsx→component.test.tsx
Test Types
| Type | Purpose | Tool |
|---|---|---|
| Unit tests | Test functions/methods in isolation | Vitest |
| Integration tests | Test module interactions (service + DB) | Vitest |
| E2E tests | Test complete user workflows | Playwright |
Running Tests
pnpm test # Run all tests
pnpm test:watch # Watch mode for TDD
pnpm test:coverage # Generate coverage report
pnpm test:api # API tests only
pnpm test:web # Web tests only
pnpm test:e2e # Playwright E2E tests
Coverage Verification
After implementation:
pnpm test:coverage
# Open coverage/index.html in browser
# Verify your files show ≥85% coverage
Test Guidelines
- Descriptive names:
it("should return user when valid token provided") - Group related tests: Use
describe()blocks - Mock external dependencies: Database, APIs, file system
- Avoid implementation details: Test behavior, not internals
Where to Ask Questions
Issue Tracker
All questions, bug reports, and feature requests go through the issue tracker: https://git.mosaicstack.dev/mosaic/stack/issues
Issue Labels
| Category | Labels |
|---|---|
| Priority | p0 (critical), p1 (high), p2 (medium), p3 (low) |
| Type | api, web, database, auth, plugin, ai, devops, docs, testing |
| Status | todo, in-progress, review, blocked, done |
Documentation
Check existing documentation first:
- README.md - Project overview
- CLAUDE.md - Comprehensive development guidelines
- docs/ - Full documentation suite
Getting Help
- Search existing issues - Your question may already be answered
- Create an issue with:
- Clear title and description
- Steps to reproduce (for bugs)
- Expected vs actual behavior
- Environment details (Node version, OS, etc.)
Communication Channels
- Issues: For bugs, features, and questions (primary channel)
- Pull Requests: For code review and collaboration
- Documentation: For clarifications and improvements
Thank you for contributing to Mosaic Stack! Every contribution helps make this platform better for everyone.
For more details, see: