Skip to content

Commit 738e5d1

Browse files
committed
Format
1 parent 7ba1c60 commit 738e5d1

3 files changed

Lines changed: 51 additions & 54 deletions

File tree

.claude/rules/docs-maintenance.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ paths:
44
---
55

66
When modifying code in a directory that contains a `CLAUDE.md` file, check whether your changes affect the documented
7-
architecture, key decisions, or gotchas. If they do, update the `CLAUDE.md` to stay in sync.
8-
If you notice a `CLAUDE.md` missing in a directory where there should be one, add it.
9-
Skip this for trivial changes (bug fixes, formatting, small refactors that don't change the architecture).
7+
architecture, key decisions, or gotchas. If they do, update the `CLAUDE.md` to stay in sync. If you notice a `CLAUDE.md`
8+
missing in a directory where there should be one, add it. Skip this for trivial changes (bug fixes, formatting, small
9+
refactors that don't change the architecture).
1010

1111
If something failed due to a wrong assumption, add a `Gotcha/Why` entry to the nearest `CLAUDE.md`.
1212

13-
Add `Decision/Why` entries to the nearest colocated `CLAUDE.md` for key decisions. If the decision has rich
14-
evidence (benchmarks, detailed analysis), put the evidence in `docs/notes/` and link from the CLAUDE.md.
13+
Add `Decision/Why` entries to the nearest colocated `CLAUDE.md` for key decisions. If the decision has rich evidence
14+
(benchmarks, detailed analysis), put the evidence in `docs/notes/` and link from the CLAUDE.md.

docs/architecture.md

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,54 @@
11
# Architecture
22

3-
High-level map of loc-counter's subsystems. Each row links to the colocated
4-
CLAUDE.md that contains the full details.
3+
High-level map of loc-counter's subsystems. Each row links to the colocated CLAUDE.md that contains the full details.
54

65
## Frontend (`src/lib/`)
76

87
Details: [`src/lib/CLAUDE.md`](../src/lib/CLAUDE.md)
98

10-
| Module | Purpose |
11-
|---|---|
12-
| `components/` | Svelte UI — `ResultsChart`, `ResultsTable`, `ResultsSummary`, `PipelineProgress`, `RepoInput`, era-markers plugin |
13-
| `git/clone.ts` | Clone/fetch via isomorphic-git + lightning-fs, abort support, staleness monitor |
14-
| `git/history.ts` | Commit log grouped by date, batch fetching, `CompactOidSet` dedup |
15-
| `git/count.ts` | Line counting per tree, prod/test classification, blob dedup, incremental tree diffing |
16-
| `git/mailmap.ts` | `.mailmap` parsing and author normalization |
17-
| `worker/` | Web Worker entry point (Comlink) — orchestrates full and incremental analysis pipelines |
18-
| `types.ts` | Shared interfaces (`LanguageCount`, `DayStats`, `AnalysisResult`, `ProgressEvent`, etc.) |
19-
| `languages.ts` | Language registry (~35 languages), extension mapping, inline test detection |
20-
| `cache.ts` | IndexedDB results cache — LRU eviction, 500 MB limit, separate meta store |
21-
| `server-cache.ts` | Shared server cache client (opt-in via `PUBLIC_SHARED_CACHE_URL`) |
22-
| `url.ts` | Repo URL parsing and normalization (GitHub/GitLab/Bitbucket, owner/repo shorthand) |
23-
24-
The SvelteKit app itself lives in `src/routes/` (single page) with global styles
25-
in `src/app.css` (Tailwind v4 + CSS custom properties).
9+
| Module | Purpose |
10+
| ----------------- | ----------------------------------------------------------------------------------------------------------------- |
11+
| `components/` | Svelte UI — `ResultsChart`, `ResultsTable`, `ResultsSummary`, `PipelineProgress`, `RepoInput`, era-markers plugin |
12+
| `git/clone.ts` | Clone/fetch via isomorphic-git + lightning-fs, abort support, staleness monitor |
13+
| `git/history.ts` | Commit log grouped by date, batch fetching, `CompactOidSet` dedup |
14+
| `git/count.ts` | Line counting per tree, prod/test classification, blob dedup, incremental tree diffing |
15+
| `git/mailmap.ts` | `.mailmap` parsing and author normalization |
16+
| `worker/` | Web Worker entry point (Comlink) — orchestrates full and incremental analysis pipelines |
17+
| `types.ts` | Shared interfaces (`LanguageCount`, `DayStats`, `AnalysisResult`, `ProgressEvent`, etc.) |
18+
| `languages.ts` | Language registry (~35 languages), extension mapping, inline test detection |
19+
| `cache.ts` | IndexedDB results cache — LRU eviction, 500 MB limit, separate meta store |
20+
| `server-cache.ts` | Shared server cache client (opt-in via `PUBLIC_SHARED_CACHE_URL`) |
21+
| `url.ts` | Repo URL parsing and normalization (GitHub/GitLab/Bitbucket, owner/repo shorthand) |
22+
23+
The SvelteKit app itself lives in `src/routes/` (single page) with global styles in `src/app.css` (Tailwind v4 + CSS
24+
custom properties).
2625

2726
## CORS proxy (`cors-proxy/`)
2827

2928
Details: [`cors-proxy/CLAUDE.md`](../cors-proxy/CLAUDE.md)
3029

31-
| Component | Purpose |
32-
|---|---|
33-
| Cloudflare Worker (Hono) | Adds CORS headers, forwards bytes to git hosts (GitHub, GitLab, Bitbucket) |
34-
| Rate limiting | Cloudflare edge rules + in-memory per-isolate counters |
35-
| Ref caching | Caches v1 `/info/refs` responses at the edge (12 h TTL) |
36-
| Shared results cache | Optional R2-backed cache for analysis results (`GET`/`PUT /cache/v1/:repoHash`) |
30+
| Component | Purpose |
31+
| ------------------------ | ------------------------------------------------------------------------------- |
32+
| Cloudflare Worker (Hono) | Adds CORS headers, forwards bytes to git hosts (GitHub, GitLab, Bitbucket) |
33+
| Rate limiting | Cloudflare edge rules + in-memory per-isolate counters |
34+
| Ref caching | Caches v1 `/info/refs` responses at the edge (12 h TTL) |
35+
| Shared results cache | Optional R2-backed cache for analysis results (`GET`/`PUT /cache/v1/:repoHash`) |
3736

3837
## Tooling
3938

40-
| Directory | Purpose |
41-
|---|---|
42-
| `scripts/` | Go-based check runner |
43-
| `tests/` | Vitest (unit) + Playwright (e2e) |
44-
| `shared/` | `language-ids.ts` — single source of truth for valid language IDs, imported by both frontend and CORS proxy |
39+
| Directory | Purpose |
40+
| ---------- | ----------------------------------------------------------------------------------------------------------- |
41+
| `scripts/` | Go-based check runner |
42+
| `tests/` | Vitest (unit) + Playwright (e2e) |
43+
| `shared/` | `language-ids.ts` — single source of truth for valid language IDs, imported by both frontend and CORS proxy |
4544

4645
## Cross-cutting patterns
4746

48-
- **Web Worker isolation** — All git operations and line counting run in a
49-
dedicated Web Worker (via Comlink). The main thread only drives the UI.
50-
- **Diff-based incremental processing** — After the first commit's full tree
51-
walk, every subsequent commit uses recursive tree diffing (`diffTreesDetailed`)
52-
so only changed files are re-counted.
53-
- **IndexedDB caching with LRU eviction** — Analysis results are cached
54-
client-side in IndexedDB with a 500 MB cap. A separate lightweight meta store
55-
enables eviction and size checks without deserializing full results.
56-
- **Incremental refresh**`analyzeIncremental` fetches only new commits since
57-
the last cached result and merges the new days in.
47+
- **Web Worker isolation** — All git operations and line counting run in a dedicated Web Worker (via Comlink). The main
48+
thread only drives the UI.
49+
- **Diff-based incremental processing** — After the first commit's full tree walk, every subsequent commit uses
50+
recursive tree diffing (`diffTreesDetailed`) so only changed files are re-counted.
51+
- **IndexedDB caching with LRU eviction** — Analysis results are cached client-side in IndexedDB with a 500 MB cap. A
52+
separate lightweight meta store enables eviction and size checks without deserializing full results.
53+
- **Incremental refresh**`analyzeIncremental` fetches only new commits since the last cached result and merges the
54+
new days in.

docs/style-guide.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Writing and code styles.
66

77
- Wording
88
- **Use a friendly style**: Make all texts informal, friendly, encouraging, and concise.
9-
- **Always prefer active voice**: Active voice is direct and clear. Passive voice feels bureaucratic.
10-
"We released a new feature" not "A new feature was released." "Add a repo" not "A repo can be added."
9+
- **Always prefer active voice**: Active voice is direct and clear. Passive voice feels bureaucratic. "We released a
10+
new feature" not "A new feature was released." "Add a repo" not "A repo can be added."
1111
- **Use verbs, not verb-noun phrases**: "Search" not "Make a search." "Analyze" not "Perform an analysis."
1212
- **Don't use permissive language**: Give users confidence. "Add repos and start searching" not "Add repos and you
1313
can start searching."
@@ -37,19 +37,19 @@ Writing and code styles.
3737
- **Use ISO dates**: Use YYYY-MM-DD wherever it makes sense.
3838
- UI
3939
- Make **error messages** positive, actionable, and specific.
40-
- **Success messages**: Talk about the user, not the action. Make success implicit and warm.
41-
"You're in!" not "Login successful." "Repo added" not "The repository has been successfully added."
40+
- **Success messages**: Talk about the user, not the action. Make success implicit and warm. "You're in!" not "Login
41+
successful." "Repo added" not "The repository has been successfully added."
4242
- **Confirmation dialogs**: Title should be a verb+noun question ("Delete this repo?"). Body should be a plain
4343
irreversibility warning ("This can't be undone."). Buttons should be outcome verbs ("Delete" / "Keep"), never
4444
"Yes" / "No".
45-
- **Empty states**: Say what belongs here and offer a next step.
46-
"No repos yet. Add one to start tracking lines of code."
45+
- **Empty states**: Say what belongs here and offer a next step. "No repos yet. Add one to start tracking lines of
46+
code."
4747
- **Start UI actions with a verb**: This makes buttons and links more actionable. Use "Create user" instead of "New
4848
user".
49-
- **Link the destination, not the sentence**: Only link text that describes where you'll go.
50-
"Read the [style guide](...)." not "[Read the style guide](...)."
51-
- **Helper text**: Only add helper text if users actually need it. Keep it short and specific.
52-
"Must be a valid GitHub URL" not "Please enter the URL of the GitHub repository you would like to add."
49+
- **Link the destination, not the sentence**: Only link text that describes where you'll go. "Read the
50+
[style guide](...)." not "[Read the style guide](...)."
51+
- **Helper text**: Only add helper text if users actually need it. Keep it short and specific. "Must be a valid
52+
GitHub URL" not "Please enter the URL of the GitHub repository you would like to add."
5353
- **Give examples in placeholder text**: Use "Example: 2025-01-01" or "name@example.com" rather than an instruction
5454
like "Enter your email".
5555
- **Never write "something(s)"**: Always pluralize dynamically: "1 user" instead of "1 user(s)".

0 commit comments

Comments
 (0)