All checks were successful
CI/CD / detect-changes (pull_request) Successful in 4s
CI/CD / test-frontend (pull_request) Successful in 6s
CI/CD / test-go-pg (pull_request) Successful in 2m43s
CI/CD / test-sqlite (pull_request) Successful in 2m51s
CI/CD / build-and-deploy (pull_request) Successful in 1m13s
Lift block rendering to kernel SDK primitives (sw.renderers + sw.markdown) so all surfaces share one markdown pipeline. Rewrite docs for external audience — remove all fork history references. Add Mermaid architecture diagrams, CONTRIBUTING guide, and extension tutorial. - sw.renderers SDK module: kernel-level renderer registry - sw.markdown SDK module: unified marked v16 + DOMPurify pipeline - Browser extension script loader for renderer injection - Notes + Docs surfaces migrated to sw.markdown.renderSync() - 4 renderer extensions rewritten to IIFE + sw.renderers.register() - 6 Mermaid diagrams in ARCHITECTURE.md - CONTRIBUTING.md + TUTORIAL-FIRST-EXTENSION.md - DESIGN-WORKFLOWS.md replaces fork-era design doc - Surface alias routes removed from main.go - ICD/SDK runners migrated to /admin/packages/ endpoints - 13 new renderer tests - Docs, CHANGELOG, ROADMAP cleaned of fork references Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
65 lines
2.1 KiB
Markdown
65 lines
2.1 KiB
Markdown
# Contributing to Switchboard Core
|
|
|
|
## Development Setup
|
|
|
|
**Requirements:** Go 1.23+, Node.js 20+ (for frontend tests), SQLite (local dev).
|
|
|
|
**Build from source:**
|
|
|
|
```sh
|
|
cd server
|
|
go build -o switchboard-core .
|
|
DB_DRIVER=sqlite DATABASE_URL=/tmp/switchboard.db ./switchboard-core
|
|
```
|
|
|
|
**Docker (recommended):**
|
|
|
|
```sh
|
|
docker compose up --build
|
|
# open http://localhost:3000 (default login: admin / admin)
|
|
```
|
|
|
|
Data persists in the `sb_data` named volume. Reset with `docker compose down -v`.
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
server/ Go backend (handlers, store, config, auth, workflow engine)
|
|
src/js/ Browser SDK and built-in surface JS
|
|
packages/ Extension packages (surfaces, libraries, browser extensions)
|
|
build.sh Builds each subdirectory into a .pkg archive
|
|
docs/ Documentation markdown (served at /api/v1/docs)
|
|
k8s/ Kubernetes manifests and Helm chart
|
|
```
|
|
|
|
## Running Tests
|
|
|
|
**Backend:** `cd server && go test ./...`
|
|
|
|
**Frontend:** `node --test src/js/__tests__/`
|
|
|
|
## Code Conventions
|
|
|
|
- **Go:** Standard formatting via `gofmt`. Handlers in `server/handlers/`,
|
|
persistence in `server/store/`. Database access goes through the store
|
|
interface, never directly from handlers.
|
|
- **Browser JS:** Vanilla ES modules + Preact via CDN. No build step for
|
|
browser code (except the CM6 editor bundle). SDK lives at `src/js/sw/`.
|
|
- **Extensions:** IIFE pattern (see `packages/*/js/script.js`). Register with
|
|
`sw.renderers` or `sw.slots` via the `sw:ready` event.
|
|
|
|
## Creating a Package
|
|
|
|
A package is a ZIP archive (`.pkg`) containing `manifest.json` and optional
|
|
`js/`, `css/`, `assets/`, and `script.star` files. The build script
|
|
(`packages/build.sh`) automates this. See `docs/PACKAGE-FORMAT.md` for the
|
|
full manifest spec and `docs/TUTORIAL-FIRST-EXTENSION.md` for a walkthrough.
|
|
|
|
## Pull Request Process
|
|
|
|
1. Create a feature branch from `main`.
|
|
2. Make your changes. Keep commits focused.
|
|
3. Run both Go and JS test suites and confirm they pass.
|
|
4. Submit a PR with a clear description of what changed and why.
|
|
5. Address review feedback, then squash-merge when approved.
|