Contributing & Extending
This guide is for contributors extending Patchwork features.
Database Migrations
Section titled “Database Migrations”- Edit
src/db/schema.ts. - Generate plain SQL migration files:
Terminal window npm run db:generate - Apply migrations locally:
Terminal window npm run db:migrate - Regenerate docs so Database Schema updates:
Terminal window npm run docs:generate
Adding a Slash Command
Section titled “Adding a Slash Command”- Add the command definition to
RAW_COMMANDSinsrc/lib/commands/registry.ts(metadata, args, options,minRole,examples). Usage strings are built automatically byformatUsage(). - Implement client/server execution in
src/components/CommandPalette.tsxandsrc/app/api/commands/execute/route.ts. - Run
npm run docs:generateandnpm run docs:check(which fails if any registered command is undocumented).
Adding a System Setting
Section titled “Adding a System Setting”- Add the field with
.min()/.max()/.default()insrc/lib/settings.ts. - Expose the control in
src/components/SystemConfigView.tsx. - Run
npm run docs:generateandnpm run docs:check.
Documentation Rule
Section titled “Documentation Rule”Documentation is part of the definition of done. Every user-visible change must update the matching page in docs-site/, run npm run docs:generate, add an entry under ## [Unreleased] in CHANGELOG.md, and pass npm run docs:check and npm run docs:build.
Versioning & Releases
Section titled “Versioning & Releases”- Never hardcode version numbers; use
src/lib/version.ts(app) orscripts/lib/version.mjs(scripts) and displayv+ SemVer (for examplev0.7.0-beta). - Run
npm run version:checkto verify consistency acrosspackage.json, lockfiles,docs-site/,README.md,CHANGELOG.md, anddocumentation-dist/.build-info.json. - To prepare a release bump, run
npm run release:prepare -- <version>. It updates package manifests and lockfiles, rollsCHANGELOG.mdand the docs changelog page, runs checks, and prints thegit commitandgit tagcommands without executing git.
Standing Rules for Contributors
Section titled “Standing Rules for Contributors”- MinIO is the only attachment storage: Never replace MinIO with local filesystem storage or another backend, and never add a
STORAGE_DRIVERor storage-driver abstraction. - Default prerequisites stay minimal: The default Easy install path must require only Node.js 20+ and
git. Any new runtime dependency, service, or system requirement must be provisioned automatically by the installer in Easy mode, documented, SHA-256 verified if downloaded, and covered bytests/easy-install.test.ts.