Development Setup¶
This guide covers setting up a local development environment for nemar-cli.
Prerequisites¶
- Bun >= 1.0.0
- Git
- GitHub CLI (
gh) for integration testing
Install Dependencies¶
bun install
This also runs husky via the prepare script, which sets up Git pre-commit hooks automatically.
Pre-commit Hooks¶
The project uses husky and lint-staged for pre-commit checks. These run automatically on every commit:
- lint-staged - Runs
biome check --fixon staged TypeScript files insrc/andbackend/src/ - Frontend typecheck - Runs
tsc --noEmiton the CLI source - Backend typecheck - Runs
tsc --noEmiton the backend source (Cloudflare Workers)
Both frontend and backend typechecks run because they have separate tsconfig.json files with different targets (Bun vs Cloudflare Workers). A type error in either will block the commit.
If a Hook Fails¶
Fix the reported errors and try committing again. Common issues:
| Error | Fix |
|---|---|
| Biome lint error | Run bun run lint:fix to auto-fix, or fix manually |
| Frontend type error | Check src/ for TypeScript issues |
| Backend type error | Check backend/src/ for TypeScript issues |
Running Locally¶
# Run CLI in development
bun run src/index.ts
# Run with arguments
bun run src/index.ts dataset list
Testing¶
# Run all tests
bun test
# Run specific test file
bun test test/license-provenance.test.ts
Linting and Formatting¶
# Check for lint issues
bun run lint
# Auto-fix lint issues
bun run lint:fix
# Format code
bun run format
# Type check (frontend only)
bun run typecheck
# Type check backend
cd backend && bun run typecheck
Building¶
bun run build
This produces dist/index.js targeting the Bun runtime.