Thanks for your interest in contributing! This guide covers everything you need to get started.
- Node.js v18 or later
- npm
-
Fork and clone the repository:
git clone https://github.com/<your-username>/drafts.git cd drafts
-
Install dependencies:
npm install
-
Start the dev watcher:
npm run dev
| Command | Description |
|---|---|
npm run build |
Build with tsup (ESM, node18 target) |
npm run dev |
Build in watch mode |
npm run test |
Run tests (vitest) |
npm run test:watch |
Run tests in watch mode |
npm run typecheck |
TypeScript check (tsc --noEmit) |
src/
index.ts # Commander CLI router
commands/ # Command handlers (init, add feature/page/component)
templates/ # String template constants with {{variable}} placeholders
ui/ # Terminal UX (figlet, clack, ora, gradient)
utils/ # File I/O, shell exec, interpolation, project detection
tests/ # Test files (vitest)
Key things to know:
- ESM-only — use
.jsextensions in relative imports - Templates are strings, not files on disk. They live in
src/templates/as exported constants and use{{variableName}}syntax interpolated bysrc/utils/template.ts. - tsup bundles everything to a single
dist/index.jswith a#!/usr/bin/env nodeshebang.
We use a three-tier branch model:
main— production releasesdev— integration branch- Feature branches — your working branches
Use a type prefix followed by a short kebab-case description:
feat/add-auth-template
fix/init-crash-on-windows
refactor/simplify-template-engine
chore/update-dependencies
docs/improve-readme
Always branch from dev:
git checkout dev
git pull origin dev
git checkout -b feat/your-featureWe follow Conventional Commits:
<type>(<scope>): <summary>
- type:
feat,fix,refactor,chore,docs,test,style,perf - scope (optional): area of the codebase (e.g.,
init,templates,cli) - summary: imperative, lowercase, no trailing period
Examples:
feat(init): add tailwind config to scaffold
fix(add-feature): handle missing package.json gracefully
docs: update contributing guide
chore: bump vitest to 3.2
-
Make sure your code passes all checks:
npm run typecheck npm run test npm run build -
Push your branch and open a PR against
dev(notmain). -
Fill out the PR template with a summary, change type, and checklist.
-
PRs are squash-merged into
dev. Merge commits are used fromdevintomainfor releases.
Found a bug or have a feature idea? Open an issue using one of the provided templates.
This project follows the Contributor Covenant. By participating, you agree to uphold this standard.