Skip to content

Commit 7772f2f

Browse files
committed
feat: add claude.md
1 parent daeeccb commit 7772f2f

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Development Commands
6+
7+
**Testing and Quality:**
8+
- `bun test` - Run all tests
9+
- `bun run lint` - Lint code with Biome
10+
- `bun run format` - Format code with Biome (writes changes)
11+
- `bun typecheck` - Type check with TypeScript (note: script name has typo "typecheek")
12+
13+
**Build and Release:**
14+
- `bun run build` - Build distribution files with tsdown
15+
- `bun run release` - Full release workflow (lint + typecheck + test + build + version bump)
16+
17+
**Development Usage:**
18+
- `bun run report daily` - Show daily usage report
19+
- `bun run report session` - Show session-based usage report
20+
- `bun run index.ts` - Direct execution for development
21+
22+
## Architecture Overview
23+
24+
This is a CLI tool that analyzes Claude Code usage data from local JSONL files stored in `~/.claude/projects/`. The architecture follows a clear separation of concerns:
25+
26+
**Core Data Flow:**
27+
1. **Data Loading** (`data-loader.ts`) - Parses JSONL files from Claude's local storage
28+
2. **Cost Calculation** (`cost-calculator.ts`) - Handles token-to-cost conversions using LiteLLM pricing data
29+
3. **Command Execution** (`commands/`) - CLI subcommands that orchestrate data loading and presentation
30+
4. **CLI Entry** (`index.ts`) - Gunshi-based CLI setup with subcommand routing
31+
32+
**Key Data Structures:**
33+
- Raw usage data is parsed from JSONL with timestamp, token counts, and pre-calculated costs
34+
- Data is aggregated into either daily summaries or session summaries
35+
- Sessions are identified by directory structure: `projects/{project}/{session}/{file}.jsonl`
36+
37+
**External Dependencies:**
38+
- Uses LiteLLM model pricing data for cost calculations (JSON format in `model_prices.json`)
39+
- Supports JST timezone conversion for date formatting
40+
- CLI built with `gunshi` framework, tables with `cli-table3`
41+
42+
## Code Style Notes
43+
44+
- Uses Biome for formatting with tab indentation and double quotes
45+
- TypeScript with strict mode and bundler module resolution
46+
- No console.log allowed except where explicitly disabled with biome-ignore
47+
- Error handling: silently skips malformed JSONL lines during parsing
48+
- File paths always use Node.js path utilities for cross-platform compatibility

0 commit comments

Comments
 (0)