|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- `src/` holds Astro pages (`src/pages/*.astro`), layouts (`src/layouts/`), UI components (`src/components/`), and client utilities (`src/lib/`). |
| 5 | +- `public/` contains static assets and proxy bundles (e.g., `public/sw.js`, `public/assets/bundled/`). |
| 6 | +- `index.ts` is the Fastify production server entry; `config.ts` contains runtime configuration. |
| 7 | +- `docs/CODEBASE_MAP.md` is the canonical, full codebase map. |
| 8 | + |
| 9 | +## Build, Test, and Development Commands |
| 10 | +- `pnpm dev`: start the Astro dev server with HMR for local development. |
| 11 | +- `pnpm start`: run the Fastify server via `tsx index.ts` (production-style runtime). |
| 12 | +- `pnpm build`: typecheck then build the Astro site (`astro check && astro build`). |
| 13 | +- `pnpm preview`: serve the built site locally using Astro preview. |
| 14 | +- `pnpm typecheck`: run `astro check` only. |
| 15 | +- `pnpm check`: format and lint (`prettier --write .` and `biome check --write .`). |
| 16 | +- `pnpm precommit`: full verification (`pnpm typecheck && pnpm check`). |
| 17 | + |
| 18 | +## Coding Style & Naming Conventions |
| 19 | +- Language stack: TypeScript, Astro, React, Tailwind. |
| 20 | +- Formatting/linting: Prettier + Biome; use `pnpm check`. |
| 21 | +- Style defaults: 2-space indentation, LF line endings, TypeScript strict mode. |
| 22 | +- Path alias: `@/` maps to `./src/`. |
| 23 | +- Use file-based routing in `src/pages/` and PascalCase for components (e.g., `Browser.tsx`). |
| 24 | +- Keep client-only logic in `src/lib/` and guard SSR-sensitive code with `typeof window`. |
| 25 | + |
| 26 | +## Testing Guidelines |
| 27 | +- No dedicated test framework is configured in this repo. |
| 28 | +- Use `pnpm typecheck` and `pnpm build` as baseline verification. |
| 29 | +- When adding tests, align with Astro/TypeScript defaults and document new commands here. |
| 30 | + |
| 31 | +## Commit & Pull Request Guidelines |
| 32 | +- Recent history mixes short imperative messages (e.g., “Bump deps”) and Conventional Commits from automation (e.g., `chore(deps): ...`). |
| 33 | +- Prefer Conventional Commit style for clarity, especially for dependency updates. |
| 34 | +- PRs should include a brief description, linked issues where applicable, and screenshots for UI changes. |
| 35 | + |
| 36 | +## Security & Configuration Notes |
| 37 | +- Review `SECURITY.md` for reporting guidelines. |
| 38 | +## Architecture & Proxy Notes |
| 39 | +- Frontend: Astro pages + React components with Tailwind. |
| 40 | +- Backend: Fastify server in `index.ts` handling Wisp WebSocket routing, compression, and optional auth. |
| 41 | +- Proxy flow: URL encoded in `src/lib/tabs.ts` → iframe load → service worker (`public/sw.js`) → UV + Wisp/Bare-Mux. |
| 42 | + |
| 43 | +## Configuration Notes |
| 44 | +- Runtime settings live in `config.ts` (server port, obfuscation, compression, basic auth). |
| 45 | +- Build obfuscation uses `randomize.ts` and renames files under `src/components/`, `src/layouts/`, `src/lib/`, `src/pages/`. |
| 46 | +- Avoid hardcoding secrets in the repo. |
0 commit comments