When contributing to this repository, please first discuss the change you wish to make via issue or any other method with the owners of this repository before making a change.
- Clone the repo
git clone https://github.com/clerk/cli
cd cli- Install dependencies
bun install- Run the CLI from source (fastest, no compilation)
bun run dev- Or compile a native binary and run it
bun run start -- --helpIn addition to running from source, you can install pre-release builds published to npm.
Canary — published automatically on every push to main that does not trigger a stable release:
npm install -g clerk@canarySnapshot — published on-demand from PR branches by commenting !snapshot (or !snapshot <name>) on a pull request. The commenter must be a member or owner of the repository's organization. The exact version to install is posted as a PR comment after publishing:
npm install -g clerk@<version>See docs/releasing.md for full details on release channels and version formats.
After modifying files, run these commands to match what CI enforces on pull requests:
bun run format # Format with oxfmt (writes changes)
bun run lint # Lint with oxlint
bun run test # Run unit tests
bun run test:e2e:op # Run E2E tests with secrets from 1Password (preferred locally)
bun run test:e2e # Run E2E tests with env vars already set (CI / non-1Password setups)When changing functionality or adding new code, add or update tests to verify the new behavior. Tests use Bun's built-in test runner:
bun testCheck for existing *.test.ts files near the code you're modifying.
E2E tests verify that clerk init produces a buildable, type-safe project with working browser auth for each supported framework (Next.js, React, Vue, Nuxt, Astro, React Router, TanStack Start). They require a Clerk staging application and credentials.
Locally, prefer bun run test:e2e:op. It wraps test:e2e in op run, which resolves the required secrets from 1Password in-memory so nothing ever lands on disk. Any flags you pass are forwarded to the underlying runner:
# Install browser (only required once)
bunx playwright install chromium
bun run test:e2e:op # Run all E2E tests (secrets from 1Password)
bun run test:e2e:op -- --filter react # Run only tests matching "react"
bun run test:e2e:op -- --debug # Force serial execution for parsing logs (sets CLERK_E2E_DEBUG=1)
bun run test:e2e:op -- --har # Capture HAR files to test/e2e/.har for network debugging
bun run test:e2e:op -- --har-dir ./out # Capture HAR files to a custom directory
bun run e2e:refresh-fixtures # Re-scaffold fixture projects from upstream CLIsIf you already have the required env vars exported (e.g. in CI, or you don't have access to the 1Password vault), use bun run test:e2e directly instead. The flags are identical:
# Required env vars: CLERK_PLATFORM_API_KEY and CLERK_CLI_TEST_APP_ID
bun run test:e2e -- --filter reactE2E test files live in test/e2e/, with fixture projects in test/e2e/fixtures/. Each test file exports a FixtureConfig and calls runFixtureTest() and runBrowserTest() from test/e2e/lib/. See .claude/rules/e2e.md for full details on adding fixtures and required env vars.
- Search for open or closed pull requests that relate to your submission to avoid duplicating effort
- Create your feature branch (
git checkout -b feat/amazing_feature) - Write tests to verify your change
- If your change affects user-facing behavior, add a changeset (
bunx changeset) - Commit your changes using conventional commits (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feat/amazing_feature) - Open a pull request
We use Changesets for versioning and changelog generation. When your PR changes user-facing behavior, add a changeset:
bunx changesetFollow the interactive prompts to select the affected package (clerk) and the bump type (patch, minor, or major). Commit the generated .changeset/*.md file with your PR.
If your change is internal-only (CI, tests, docs, refactoring), you can skip the changeset.
For more details, see Adding a Changeset.
All commit messages must follow the conventional commits specification:
<type>[optional scope]: <description>
Common types: feat, fix, chore, docs, refactor, test, ci, build, perf.
- Prefer multiple small PRs with related changes over large PRs
- Always include a description explaining what the PR does and why
- For bug fixes, include steps to reproduce the issue or a screen recording
Found a bug or want to suggest a feature? Submit an issue on GitHub. Before creating an issue, search the issue archive to avoid duplicates.
Note: Only Clerk employees can publish packages.
See docs/releasing.md for the full release flow.
By contributing to Clerk, you agree that your contributions will be licensed under its MIT License.