summaryrefslogtreecommitdiff
path: root/cgithub/CLAUDE.md
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-09-18 07:27:21 +0100
committerJoe Mou <dev@mou.fo>2026-09-18 07:27:21 +0100
commit9659525bf2387af6deab9d401784b94b1f44d395 (patch)
treec67dc1dd05bf2a8fa48dc123d6353d255a658ef1 /cgithub/CLAUDE.md
parent9819d8e5504d6f03d27ec6b8786eec8fe5a752a5 (diff)
parent01494e6fa1345a509560e5e19a7f08cb2aac5cc8 (diff)
Merge commit 'FILTERED_HEAD'HEADmain
Diffstat (limited to 'cgithub/CLAUDE.md')
-rw-r--r--cgithub/CLAUDE.md45
1 files changed, 45 insertions, 0 deletions
diff --git a/cgithub/CLAUDE.md b/cgithub/CLAUDE.md
new file mode 100644
index 0000000..ef7b133
--- /dev/null
+++ b/cgithub/CLAUDE.md
@@ -0,0 +1,45 @@
+## Project Overview
+
+cgithub is a lightweight GitHub alternative frontend that scrapes GitHub's server-rendered HTML instead of using the API. Data is usually extracted from embedded JSON data from `<script type="application/json">` tags that GitHub includes for hydration.
+
+## Commands
+
+```bash
+# Local dev server (Cloudflare Workers runtime)
+pnpm run dev
+
+# Deploy to Cloudflare Workers
+pnpm run deploy
+
+# Run tests
+pnpm test
+```
+
+## Architecture
+
+**Stack:** Hono (web framework) + Eta (templating) + TypeScript, running on Cloudflare Workers
+
+**Source files:**
+- `src/app.ts` - Hono routes
+- `src/worker.ts` - Cloudflare Workers entry (config in `wrangler.jsonc`)
+- `src/scraper.ts` - GitHub HTML fetching and JSON extraction logic
+
+**Templates:** `views/*.eta` - Eta templates with layout inheritance. `views/layouts/base.eta` is the HTML shell every page uses; `views/layouts/repo.eta` wraps it with the repository header, nav, and search box. Templates address each other from the views root (`/layouts/base.eta`) or as siblings (`./_tree`). On Workers, runtime code generation is disallowed, so `scripts/build.ts` precompiles templates to `src/views.generated.ts`. The same script records the build's `git describe` output in `src/build.generated.ts` for the page footer. Both are gitignored and regenerated by the `dev`/`deploy` scripts.
+
+**Static files:** `public/static/*`, served by Workers Static Assets.
+
+**Routes:**
+- `GET /:owner` - User or organization profile with pinned repositories
+- `GET /:owner/:repo` - Repository info with directory listing
+- `GET /:owner/:repo/tree/:branch/:path*` - Directory listing
+- `GET /:owner/:repo/blob/:branch/:path` - File content view
+- `GET /:owner/:repo/commits/:branch/:path*` - Commit history of the repository, a directory, or a file
+- `GET /:owner/:repo/wiki` - Wiki home page
+- `GET /:owner/:repo/wiki/:page` - Wiki page (also `/:page/:oid` for a revision)
+- `GET /:owner/:repo/wiki/_pages` - Wiki page index
+
+## Instructions
+
+- Use `for (const ... of ...)` instead of `.forEach()`
+- Update `scraper.test.ts`
+- When implementing a new feature update `README.md`