Mercurial
comparison .claude/skills/zenbu-personal-site/SKILL.md @ 248:b8b6e726964a
[style] Use Dowa type aliases in C
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Tue, 04 Aug 2026 02:44:06 -0700 |
| parents | |
| children | 30c2196d03d4 |
comparison
equal
deleted
inserted
replaced
| 247:70f2a3dafc1c | 248:b8b6e726964a |
|---|---|
| 1 --- | |
| 2 name: zenbu-personal-site | |
| 3 description: Use this skill when updating the mrjunejune personal website, blog, resume, tools, notes/editor APIs, uploads, PWA assets, or deployment bundle. | |
| 4 --- | |
| 5 | |
| 6 # Mrjunejune Personal Site | |
| 7 | |
| 8 Use this skill for `mrjunejune/`, the personal website served by a C backend. | |
| 9 | |
| 10 ## Structure | |
| 11 | |
| 12 - `mrjunejune/main.c`: C web server, routes, APIs, S3 upload URL generation, editor persistence, media conversion, WebSocket chat. | |
| 13 - `mrjunejune/src/`: static site source files and HTML templates. | |
| 14 - `mrjunejune/src/parts/`: shared HTML includes used by `{{...}}` template placeholders. | |
| 15 - `mrjunejune/src/public/`: public assets, PWA files, media, generated JS, icons, resume PDF. | |
| 16 - `mrjunejune/test/`: integration tests and snapshots. | |
| 17 - `mrjunejune/BUILD`: Bazel build, bundle, asset movement, and test-visible filegroups. | |
| 18 - `mrjunejune/.config` and `.config.development`: server configuration. Do not commit secrets. | |
| 19 | |
| 20 ## How rendering works | |
| 21 | |
| 22 Handlers allocate a response body from `Dowa_Arena`, render an HTML file with `Seobeo_Render_Html_FilePath`, and return a response map: | |
| 23 | |
| 24 ```c | |
| 25 Seobeo_Request_Entry *resp = NULL; | |
| 26 char *final_body = Dowa_Arena_Allocate(arena, 50 * 1024); | |
| 27 Seobeo_Render_Html_FilePath(final_body, "/tools/index.html", arena); | |
| 28 Dowa_HashMap_Push_Arena(resp, "body", final_body, arena); | |
| 29 return resp; | |
| 30 ``` | |
| 31 | |
| 32 The simple template renderer replaces `{{...}}` tokens with file contents loaded through `Seobeo_Web_LoadFile`. | |
| 33 | |
| 34 ## Routes and features | |
| 35 | |
| 36 Existing route areas include: | |
| 37 | |
| 38 - Home, resume, tools, markdown-to-HTML, file converter, blog, talk/chat, notes, and editor pages. | |
| 39 - Redirect helpers built with `CREATE_REDIRECT_HANDLER`. | |
| 40 - File/media conversion APIs using `ffmpeg` and temporary files under `/tmp`. | |
| 41 - S3 presigned upload URL API using `Authorization: Bearer <token>`. | |
| 42 - Editor save/load APIs backed by `deita` SQLite. | |
| 43 - WebSocket chat broadcasting through seobeo WebSocket server APIs. | |
| 44 | |
| 45 When adding pages, add the HTML/CSS/JS under `src/`, register a route in `main.c`, and update tests/snapshots if the route should be covered. | |
| 46 | |
| 47 ## Build and test | |
| 48 | |
| 49 ```bash | |
| 50 bazel build //mrjunejune:mrjunejune_server | |
| 51 bazel build //mrjunejune:mrjunejune_server_bundle | |
| 52 bazel test //mrjunejune/test:integration_test | |
| 53 ``` | |
| 54 | |
| 55 Use the debug server when investigating routing or networking: | |
| 56 | |
| 57 ```bash | |
| 58 bazel build //mrjunejune:mrjunejune_server_debug -c dbg | |
| 59 ``` | |
| 60 | |
| 61 ## Production-minded checklist | |
| 62 | |
| 63 - Use Dowa's fixed-width aliases and `boolean`/`TRUE`/`FALSE` in first-party C | |
| 64 instead of introducing `<stdint.h>` `_t` types or `<stdbool.h>` `bool`. | |
| 65 - Keep auth-protected APIs strict: missing auth should be `401`, invalid token `403`, malformed JSON/input `400`, unavailable DB/S3/ffmpeg `500`. | |
| 66 - Never hardcode secrets. Read configuration from `.config` or environment wiring already used by the Bazel target. | |
| 67 - For uploads and downloads, validate filenames and content lengths before touching `/tmp`. | |
| 68 - For binary responses, set `content-length` and avoid string-only operations on body bytes. | |
| 69 - If a route is part of the public website, add or update snapshot coverage in `mrjunejune/test`. | |
| 70 - Keep PWA changes consistent across `manifest.json`, `sw.js`, icons, and `PWA_SETUP.md`. | |
| 71 - Reuse `seobeo`, `dowa`, `deita`, `s3`, and `markdown_converter` instead of adding parallel implementations. |