Mercurial
view .claude/skills/zenbu-hg-web/SKILL.md @ 272:41a49c29a28f
polish JRPG conversation experience
Integrate desktop conversations into the utility panel, simplify the mobile frame, add modal destinations and a reusable Zenbu composer lab, and preserve explicit conversation resume behavior.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 07 Aug 2026 16:05:29 -0700 |
| parents | b8b6e726964a |
| children |
line wrap: on
line source
--- name: zenbu-hg-web description: Use this skill when changing hg-web, the Mercurial repository browser, including the C API server, hg proxying, React/TypeScript frontend, markdown rendering, graph views, or static asset bundle. --- # Hg Web Use this skill for `hg-web/`, a GitHub-style Mercurial repository browser backed by a C server and a TypeScript frontend. ## Structure - `hg-web/main.c`: C server, routes, Mercurial proxy APIs, wire protocol streaming. - `hg-web/src/main.tsx`: frontend entry. - `hg-web/src/components/`: React/TypeScript UI components. - `hg-web/src/index.html`, `index.css`, `base.css`: shell and styles. - `hg-web/BUILD`: Bun bundle, static assets, C server, and release bundle. - `hg-web/deploy.sh`: deployment entry point. The server depends on `//seobeo:seobeo`. The frontend bundle includes `markdown_converter:markdown_to_html_wasm` and `third_party/highlight:js`. ## Backend model The C backend proxies to local `hg serve` at: ```c #define HG_SERVE_HOST "127.0.0.1" #define HG_SERVE_PORT "4444" ``` Public endpoints include: - `GET /` - `GET /directories` - `GET /graph` - `GET /api/repo/list?path=...` - `GET /api/repo/file?path=...` - `GET /api/repo/readme?path=...` - `GET /api/graph/:graph_id?...` - `GET /repo` and `POST /repo` streaming Mercurial wire protocol proxy. Use `sanitize_path` and `Seobeo_Url_Decode` patterns for any path-derived endpoint. Never pass raw path input to an hg path. ## Frontend model Prefer editing components under `hg-web/src/components/`. Keep API paths aligned with backend registrations in `main.c`. The frontend should be able to handle: - directory listings from `/api/repo/list`, - file contents from `/api/repo/file`, - README markdown rendering through the WASM markdown converter, - syntax highlighting through highlight.js, - graph data via `/api/graph/:graph_id`. ## Build ```bash bazel build //hg-web:hg_web_server bazel build //hg-web:hg_web_server_bundle ``` If changing shared networking behavior, also run the relevant seobeo tests. ## Safety checklist - Prefer Dowa aliases (`uint8`, `uint32`, `boolean`, `TRUE`/`FALSE`) over `<stdint.h>` `_t` types and `<stdbool.h>` `bool` in first-party C. - Preserve binary-safe streaming in `StreamHgWireProtocol`; Mercurial bundle data can contain null bytes. - Do not buffer large wire-protocol responses through the normal HTTP client path unless the task explicitly requires it. - Validate and sanitize all path and graph inputs. - Keep content types accurate: JSON for API listing responses, `text/plain` or source-specific content for file/graph proxy responses, `text/html` for the app shell. - If changing route names, update both backend registrations and frontend fetch/navigation code.