๐ค Contributing
๐ป Development Workflowโ
๐ Prerequisitesโ
- Go 1.26+ โ required for compilation
- Node.js 20+ โ required for building the documentation site
๐จ Buildingโ
End users: Use the setup script instead โ see Installation. The
go buildworkflow below is for development and testing only.
# Compile the binary
go build -o tresor.exe .
# Build with version info
go build -ldflags "-X main.version=1.0.0 -X main.commit=abc123" -o tresor.exe .
๐งช Running Testsโ
# All unit tests
go test ./...
# Single package
go test ./internal/engine/...
# E2E integration (requires running daemon)
./tresor.exe run --config config.yaml &
go test -tags=integration ./e2e/...
See the /Tresor-docs/docs/dev/testing page for the full verification sequence.
๐ Code Styleโ
- Follow Go conventions (
gofmtfor formatting,govetfor static analysis) - Match existing code patterns: naming, comment density, error handling
- Use table-driven tests for comprehensive coverage
- Write tests before or alongside implementation
๐ Adding a New Pluginโ
- Create a new file in
internal/plugins/(e.g.,my_plugin.go) - Implement one or more transformer interfaces (
RequestTransformer,ResponseTransformer,StreamResponseTransformer) - Register the plugin in an
init()function:Register("my_plugin", &MyPlugin{}) - Add a config schema for web UI consumption
- Write unit tests covering request transform, response transform, and streaming (if applicable)
- Run
go test ./internal/plugins/...to verify
See the /Tresor-docs/docs/dev/plugin-system page for interface definitions and examples.
๐ Modifying the Web UIโ
The web UI source files are in internal/api/web/:
index.htmlโ Page structure and tab content (downstreams, aliases, rules, plugins, settings, about)style.cssโ Styling and responsive layoutapp.jsโ Application logic, API calls, dynamic rendering, login screen, theme toggle
The embedded files are compiled into the binary via //go:embed web/* in internal/api/embed.go. After editing, rebuild the binary.
๐งช Testing Web UI Changesโ
- Rebuild:
go build -o tresor.exe . - Start the daemon:
./tresor.exe run --config config.yaml - Navigate to each affected tab in the browser
- Perform core interactions (create, edit, delete, hot-switch)
- Verify the UI reflects expected state and no JavaScript errors occur
๐ Documentationโ
The documentation site is a standalone Docusaurus project (repo: ladbaby/Tresor-docs). Docs source files are in docs-content/, organized under user/ and dev/ subdirectories.
# Install dependencies (first time only)
npm install
# Start development server with hot reload
npm start
# Build for production
npm run build
# Serve the built site locally
npm run serve
โ๏ธ Documentation Conventionsโ
- Use
.mdxformat for all documentation pages - Frontmatter must include
titleanddescription - Use
<Tabs>and<TabItem>for platform-specific instructions - Link between related pages using absolute paths with the full site path (e.g.,
/Tresor-docs/docs/user/configuration/basics) - Keep user docs focused on what and why; keep developer docs focused on how
๐ฌ Pull Request Processโ
- Fork the repository and create a feature branch
- Make your changes following the code style guidelines
- Run the full test suite:
go test ./... - Update documentation if your change affects user-facing behavior
- Submit the pull request with a clear description of changes
- Ensure CI checks pass (build, tests)
๐ Git Conventionsโ
- Commit messages follow conventional commit style:
type(scope): message- Types:
feat,fix,docs,ci,refactor,test - Example:
fix(engine): handle nil pipeline context in streaming transform
- Types:
- Keep commits focused and atomic
- Squash related commits before merging