2.0 KiB
2.0 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Commands
yarn test # run all tests (watch mode)
yarn test:report # run tests with verbose output
yarn coverage # run tests with coverage report
yarn dev # start Vite dev server for the demo UI
yarn build # compile TypeScript + build library to dist/
yarn add:module <name> # scaffold a new algorithm module in lib/<name>/
To run a single test file:
npx vitest run lib/<name>/<name>.test.ts
Architecture
The repo has two independent layers:
lib/— algorithm implementations, built as a publishable npm library. Each algorithm lives in its own subdirectory (lib/<name>/) with an implementation file, a test file, and anindex.tsre-export.src/— Vite demo app (development only, not shipped in the library).
The library entry point is lib/main.ts. Build output goes to dist/ (counter.js / counter.umd.cjs).
Adding a New Algorithm
yarn add:module <algorithmName>
This creates lib/<algorithmName>/ with:
<algorithmName>.ts— implementation stub<algorithmName>.test.ts— Vitest test with default array[-12, 1, 4, 6, 22]index.ts— re-exportreadme.md— template with complexity table and time-tracking table (in Russian)
For competitive-programming / stdin problems, use lib/__templateForSolution.ts as a base — it reads lines via readline and parses them as numbers.
Testing
Uses Vitest (not Jest). Test files live next to implementations in lib/. The vitest.config.ts enables @vitest/coverage-v8 for HTML + JSON coverage reports (output in coverage/).
Learning Structure
Progress is tracked in docs/:
docs/progress.md— weekly skill ratingsdocs/daily-practice.md— session logdocs/learning-plan.md/docs/weekly-schedule.md— roadmapdocs/rules.md— learning philosophy and algorithm phase breakdown (Phase 1–4 over 16 weeks)