Development Setup
This guide covers setting up a local development environment for nemar-cli.
Prerequisites
Section titled “Prerequisites”- Bun >= 1.0.0
- Git
- GitHub CLI (
gh) for integration testing
Install Dependencies
Section titled “Install Dependencies”bun installThis also runs husky via the prepare script, which sets up Git pre-commit hooks automatically.
Pre-commit Hooks
Section titled “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
Section titled “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
Section titled “Running Locally”# Run CLI in developmentbun run src/index.ts
# Run with argumentsbun run src/index.ts dataset listTesting
Section titled “Testing”# Run all testsbun test
# Run specific test filebun test test/license-provenance.test.tsLinting and Formatting
Section titled “Linting and Formatting”# Check for lint issuesbun run lint
# Auto-fix lint issuesbun run lint:fix
# Format codebun run format
# Type check (frontend only)bun run typecheck
# Type check backendcd backend && bun run typecheckBuilding
Section titled “Building”bun run buildThis produces dist/index.js targeting the Bun runtime.