Mercurial
annotate .claude/skills/zenbu-hg-web/SKILL.md @ 271:13d61401c57d
redirect Copilot cache to service state
Set XDG_CACHE_HOME from the configured inference state so the systemd service can extract Copilot outside its protected home directory.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 07 Aug 2026 13:24:05 -0700 |
| parents | b8b6e726964a |
| children |
| rev | line source |
|---|---|
|
248
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
1 --- |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
2 name: zenbu-hg-web |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
3 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. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
4 --- |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
5 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
6 # Hg Web |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
7 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
8 Use this skill for `hg-web/`, a GitHub-style Mercurial repository browser backed by a C server and a TypeScript frontend. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
9 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
10 ## Structure |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
11 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
12 - `hg-web/main.c`: C server, routes, Mercurial proxy APIs, wire protocol streaming. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
13 - `hg-web/src/main.tsx`: frontend entry. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
14 - `hg-web/src/components/`: React/TypeScript UI components. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
15 - `hg-web/src/index.html`, `index.css`, `base.css`: shell and styles. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
16 - `hg-web/BUILD`: Bun bundle, static assets, C server, and release bundle. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
17 - `hg-web/deploy.sh`: deployment entry point. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
18 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
19 The server depends on `//seobeo:seobeo`. The frontend bundle includes `markdown_converter:markdown_to_html_wasm` and `third_party/highlight:js`. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
20 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
21 ## Backend model |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
22 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
23 The C backend proxies to local `hg serve` at: |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
24 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
25 ```c |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
26 #define HG_SERVE_HOST "127.0.0.1" |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
27 #define HG_SERVE_PORT "4444" |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
28 ``` |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
29 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
30 Public endpoints include: |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
31 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
32 - `GET /` |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
33 - `GET /directories` |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
34 - `GET /graph` |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
35 - `GET /api/repo/list?path=...` |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
36 - `GET /api/repo/file?path=...` |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
37 - `GET /api/repo/readme?path=...` |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
38 - `GET /api/graph/:graph_id?...` |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
39 - `GET /repo` and `POST /repo` streaming Mercurial wire protocol proxy. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
40 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
41 Use `sanitize_path` and `Seobeo_Url_Decode` patterns for any path-derived endpoint. Never pass raw path input to an hg path. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
42 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
43 ## Frontend model |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
44 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
45 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: |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
46 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
47 - directory listings from `/api/repo/list`, |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
48 - file contents from `/api/repo/file`, |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
49 - README markdown rendering through the WASM markdown converter, |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
50 - syntax highlighting through highlight.js, |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
51 - graph data via `/api/graph/:graph_id`. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
52 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
53 ## Build |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
54 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
55 ```bash |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
56 bazel build //hg-web:hg_web_server |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
57 bazel build //hg-web:hg_web_server_bundle |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
58 ``` |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
59 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
60 If changing shared networking behavior, also run the relevant seobeo tests. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
61 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
62 ## Safety checklist |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
63 |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
64 - Prefer Dowa aliases (`uint8`, `uint32`, `boolean`, `TRUE`/`FALSE`) over |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
65 `<stdint.h>` `_t` types and `<stdbool.h>` `bool` in first-party C. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
66 - Preserve binary-safe streaming in `StreamHgWireProtocol`; Mercurial bundle data can contain null bytes. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
67 - Do not buffer large wire-protocol responses through the normal HTTP client path unless the task explicitly requires it. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
68 - Validate and sanitize all path and graph inputs. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
69 - 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. |
|
b8b6e726964a
[style] Use Dowa type aliases in C
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
70 - If changing route names, update both backend registrations and frontend fetch/navigation code. |