Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

> **Template notice:** This file describes the template repository itself. If you've created a project from this template, replace this content with guidance specific to your project.

## About This Repository

This is a minimal Node.js library and CLI starter template. The Fibonacci sequence code in `src/` is a placeholder — replace it with your actual library and CLI logic when starting a new project.

## Commands

```sh
pnpm test # Run all tests
pnpm vitest run <file> # Run a single test file (e.g. src/lib.test.ts)
pnpm vitest # Run tests in watch mode

pnpm tsc # Type-check without emitting
pnpm eslint # Lint
pnpm eslint --fix # Lint and auto-fix
pnpm prettier --check . # Check formatting
pnpm prettier --write . # Fix formatting

pnpm prepack # Compile TypeScript to dist/ (tsc -p tsconfig.build.json)
pnpm start # Run CLI directly via jiti (no compile step needed)
```

## Architecture

This is a minimal Node.js library + CLI starter template written in TypeScript targeting Node 24 (ESM).

- **`src/lib.ts`** — The library's public API (currently a Fibonacci sequence generator as a placeholder example).
- **`src/bin.ts`** — CLI entry point built with Commander.js that wraps the library.
- **`src/*.test.ts`** — Vitest test files co-located with source.

### Build outputs

TypeScript compiles via `tsconfig.build.json` into `dist/`:

- `dist/lib.js` + `dist/lib.d.ts` — library entry (exported as `"."`)
- `dist/bin.js` — CLI binary (exported as `"./bin"` and registered as the `nodejs-starter` bin)

The development workflow uses **jiti** to run `src/bin.ts` directly without a compile step (`pnpm start`).

### Tooling details

- **ESLint** uses flat config (`eslint.config.ts`) with `typescript-eslint` strict + stylistic type-checked rules.
- **Prettier** uses `prettier-plugin-organize-imports` — import order is auto-managed.
- **Lefthook** runs pre-commit hooks (type-check → format → lint) with `fail_on_changes: always`, so hooks can auto-fix files but will abort the commit if any file changed, requiring a re-stage.
- **Vitest** requires 100% code coverage (lines, functions, branches, statements) enforced via the `coverage` threshold in `vitest.config.ts`.
Loading