44 lines
1.3 KiB
Markdown
44 lines
1.3 KiB
Markdown
# AGENTS.md
|
|
|
|
## Repository Purpose
|
|
TypeScript algorithms learning library with demo UI. Also publishes as a npm library.
|
|
|
|
## Essential Commands
|
|
|
|
**Development:**
|
|
- `npm run dev` - Start Vite dev server (demo UI in src/)
|
|
- `npm run build` - Build library (tsc + vite build → dist/)
|
|
- `npm run test` - Run tests with Vitest
|
|
- `npm run test:report` - Run tests with verbose output
|
|
- `npm run coverage` - Run tests with coverage report
|
|
|
|
**Add New Algorithm:**
|
|
- `npm run add:module <name>` - Create new algorithm module in lib/
|
|
- Generates: `.ts`, `.test.ts`, `index.ts`, `readme.md`
|
|
- Creates test with sample data [-12, 1, 4, 6, 22]
|
|
|
|
## Architecture
|
|
|
|
**Dual Structure:**
|
|
- `src/` - Vite demo application (development only)
|
|
- `lib/` - Library source code (gets built to dist/)
|
|
|
|
**Library Entry:**
|
|
- Main: `./lib/main.ts` → exports setupCounter
|
|
- Build outputs: `dist/counter.{js,umd.cjs}`
|
|
- Types: `./index.d.ts`
|
|
|
|
**Algorithm Pattern:**
|
|
Each algorithm in lib/ has:
|
|
- Implementation in `<name>.ts`
|
|
- Test in `<name>.test.ts`
|
|
- Index re-export in `index.ts`
|
|
- README with complexity analysis
|
|
|
|
## Build Order
|
|
When publishing: `npm run build` → generates library files in dist/
|
|
|
|
## Testing
|
|
- Uses Vitest (not Jest)
|
|
- Test files alongside implementations in lib/
|
|
- Default test array: [-12, 1, 4, 6, 22] |