Run from the repository root with Bun. Install: bun install (Bun only — not npm/yarn/pnpm).
| Command | What it does |
|---|---|
bun install |
Install dependencies (bun.lock). |
bun run dev |
Next.js dev on 4000 only, Turbopack + hot reload. |
bun run dev:fresh |
Same as dev, but deletes .next first (fixes rare stale cache issues). |
bun run build |
Production build → .next/ (typecheck + Next lint). |
bun run start |
Serve production build on 4000 only. |
bun run scan |
Scan TARGET_REPO; writes cards + scan memory. Set TARGET_REPO (path to a repo or tree). |
bun run db:clear |
Remove default data/codepiece.db (+ WAL/SHM) and data/scan-memory.json (clean slate). |
bun run seed:samples |
Scan samples/the-algorithms-typescript (TheAlgorithms/TypeScript snapshot) with REPO_LABEL=TheAlgorithms/TypeScript and --force. |
bun run db:stats |
Read-only SQLite report (users, cards, swipes, snippet_memos, breakdowns, file sizes). Respects CODEPIECE_DB. |
bun run db:push |
Drizzle Kit — push src/db/schema.ts to the SQLite file (CODEPIECE_DB). Use when the schema changes; normal dev creates tables via INIT_SQL on first open. |
bun test |
Full test suite. |
bun run test:scan |
Scanner + src/lib tests only. |
bun run test:web |
tests/web only. |
| Variable | Role | Default |
|---|---|---|
CODEPIECE_DB |
SQLite file path | data/codepiece.db |
TARGET_REPO |
Tree to scan (bun run scan) |
(required for scan unless using seed:samples) |
Full env table: TECHNICAL.md. Ports, Docker, scan --force: TROUBLESHOOTING.md. Tests: TEST-SPEC.md.
Local app with sample cards
bun install
bun run seed:samples
bun run devVerify before a PR
bun install
bun test
bun run buildInspect database
bun run db:stats