Contributing
Getting started
Section titled “Getting started”Prerequisites
Section titled “Prerequisites”- Node.js >= 20.0.0
- pnpm >= 9.0.0 —
npm install -g pnpm - Go >= 1.24.5 (for gateway development only)
git clone https://github.com/ruachtech/rep.gitcd reppnpm installpnpm run buildpnpm run testFor gateway:
cd gatewaygo test -race ./...Project structure
Section titled “Project structure”rep/├── spec/ # Protocol specification documents├── schema/ # JSON schemas for payload and manifest├── gateway/ # Go reference implementation (stdlib only)├── sdk/ # @rep-protocol/sdk (zero runtime deps)├── cli/ # @rep-protocol/cli├── adapters/ # React, Vue, Svelte adapters├── codemod/ # Migration tool├── docs/ # This documentation site (Astro/Starlight)└── examples/ # Example applicationsCommit conventions
Section titled “Commit conventions”This project uses Conventional Commits. Every commit to main must follow this format:
<type>(<scope>): <description>
[optional body]| Type | Effect | Example |
|---|---|---|
fix | Patch release | fix(sdk): handle missing meta field |
feat | Minor release | feat(gateway): add poll mode for hot reload |
feat! | Major release | feat!(sdk)!: rename getSecure to decrypt |
docs | No release | docs(spec): clarify SRI verification |
chore | No release | chore: update dev dependencies |
refactor | No release | refactor(gateway): extract inject middleware |
test | No release | test(sdk): add hot reload tests |
perf | No release | perf(gateway): reduce allocation in inject |
Scopes
Section titled “Scopes”sdk, gateway, cli, react, vue, svelte, codemod, spec, docs
Code style
Section titled “Code style”Go (Gateway)
Section titled “Go (Gateway)”- Standard library only. No third-party dependencies.
- Structured logging via
log/slog - Error wrapping:
fmt.Errorf("context: %w", err) - No
init()functions - Tests use stdlib only (
testing,net/http/httptest) - Use
t.Setenv()for env var tests (neveros.Setenvdirectly) - Run with
-raceflag
TypeScript (SDK, CLI, Adapters)
Section titled “TypeScript (SDK, CLI, Adapters)”- Zero runtime dependencies for the SDK
- Vitest + jsdom for testing
vi.resetModules()before each SDK test (because_init()runs on module load)- DOM cleanup in
beforeEach
Testing
Section titled “Testing”# All TypeScript packagespnpm run test
# Gateway (from gateway/)go test -race ./...
# Specific packagepnpm --filter @rep-protocol/sdk run testRelease process
Section titled “Release process”Releases are automated via release-please:
- Push conventional commits to
main - Release-please creates/updates a Release PR with version bumps and changelogs
- Merging the Release PR triggers npm publishing for all packages
- The gateway is versioned independently via
gateway/VERSIONand released through GoReleaser
PR guidelines
Section titled “PR guidelines”- Branch from
main - Keep PRs focused on a single change
- Include tests for new functionality
- Use squash-merge with a conventional commit message