[PR #1810] [MERGED] Website: Make a mod, the full guide, and the API portal at /docs/api #3782

Closed
opened 2026-11-03 04:12:16 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1810
Author: @ludovic111
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @ludovic111

Base: main ← Head: docs/api-portal-website


📝 Commits (2)

  • 4a9ca29 Website: the API portal at /docs/api, with Markdown tables
  • a6f951e Website: Make a mod, the full guide from the first line to the registry

📊 Changes

22 files changed (+696 additions, -23 deletions)

View changed files

📝 docs/api/README.md (+2 -1)
📝 docs/api/mods.md (+3 -0)
📝 website/Caddyfile (+4 -0)
📝 website/README.md (+7 -2)
📝 website/build.mjs (+28 -8)
📝 website/docs/apis.md (+2 -2)
➕ website/docs/content-mods.md (+114 -0)
📝 website/docs/index.md (+1 -0)
➕ website/docs/make-a-mod.md (+88 -0)
➕ website/docs/mod-code.md (+190 -0)
➕ website/docs/mod-manifest.md (+60 -0)
📝 website/docs/mods.md (+5 -3)
📝 website/docs/nav.json (+3 -1)
➕ website/docs/publish-a-mod.md (+57 -0)
➕ website/docs/test-a-mod.md (+59 -0)
📝 website/railway.json (+1 -1)
📝 website/serve.mjs (+5 -1)
📝 website/src/docs.html (+1 -1)
📝 website/src/markdown.js (+36 -3)
➕ website/src/markdown.test.mjs (+25 -0)

...and 2 more files

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What

Make a mod: the full guide on the site (added on request: playhorizon.dev had no complete "how to make a mod"). A new docs group, six pages, from nothing to a published mod:

Page What it covers
/docs/make-a-mod the path; what mods can do today; install Rust, the wasm target and cargo horizon-mod; new, the project layout, build; seeing it in the game as a dev mod (the launcher's Settings, Game arguments --dev-mod …, or cargo horizon-mod run --game … -- --resources …); logs, the horizon-mods folder, what happens when a mod fails
/docs/mod-manifest every manifest key; every capability with the sentence players read and the calls it allows, with limits; the import check; what no mod can do (sandbox, memory, budget); API versions
/docs/mod-code the Mod trait, Registration, every hook and when it runs, command results (Ok(None), Ok(Some), Err in red), every SDK call per module; a worked example, Playtime (tick, command, HUD, storage, a unit test), step by step. I built it with cargo horizon-mod build, ran check on it (trial run ok) and its unit test passes
/docs/content-mods the ruby example's layout and manifest; block keys (from horizon-mods/src/content.rs), item keys, recipes, loot, tags, models, names, namespaces, limits; trying it as a folder dev mod and zipping it
/docs/test-a-mod unit tests, the dev-mod loop and what to try, why a mod stops, cargo horizon-mod check and its options
/docs/publish-a-mod version, release build, check, public source and licence; minisign signing (key pair, sign, verify with check --key --signature, checked here); the submit form field by field; review, publication, updates, reports

Links in: the top bar's Docs opens the docs, whose nav has the new "Make a mod" group and whose index links it; /mods's Make a mod button goes to the guide (it went to /docs/mods); /mods/submit links Publish and Make a mod; /docs/mods and the Mod API's Guide point at it. The API reference (docs/api/*) is on the site through the portal below.

Two gaps the guide states plainly instead of hiding: there is no cargo horizon-mod new --template (one template, the client code mod), and the registry can't take a content-only mod yet, because cargo horizon-mod check refuses a .hmod with no mod.wasm (checked on the ruby example) and build doesn't pack assets/ and data/. A small follow-up PR fixes those and updates the guide. cargo horizon-mod test goes into the guide with #1816.

The API portal (the first commit)

The API portal (docs/api/) is on the website: playhorizon.dev/docs/api is its index and /docs/api/<page> each page (Mod API, its generated reference, the registry index, Server API and reference, Agent control, Launcher, Data formats, Shaders, Stability). Today /docs/api is a 404.

  • Not a copy. website/docs/nav.json lists the portal as api (its README) and api/<page>; build.mjs reads them from the checkout, or from main on GitHub when Railway builds website/ alone, the way it already reads the README. Links between portal pages become site links (and the build's link check now covers them: a portal page missing from the nav fails the build); every other relative link (../mods.md, ../../AGENTS.md, …) goes to the file on GitHub. The generated references' header comment is dropped.
  • Tables render. src/markdown.js had no tables: the "Ways in" table, the references, and the existing tables on /docs/apis and /docs/performance showed as one paragraph of pipes (see the live /docs/apis). Now | … | + a rule row is a <table> in a scroll box; \| and bars inside code spans stay in their cell. A link whose label is a code span used to throw; fixed.
  • Routing. Caddy rewrites /docs/api/<page> to its file and redirects /docs/api/ to /docs/api; serve.mjs does the same; Railway's watchPatterns gain /docs/api/** so a portal change redeploys.
  • Links in. Nav groups "Build on Horizon" (the summary, the portal, stability) and "API reference"; /docs/mods links the Mod API, its reference and its ways in; /docs/apis links the portal instead of the GitHub folder and is titled "APIs at a glance" so it doesn't sit beside "Horizon APIs" under nearly the same name. "Edit this page on GitHub" points at the page's real file.

How tested

  • Guide: node build.mjs (31 docs pages, the link and anchor check clean); every new page, /mods and /mods/submit served 200 by serve.mjs; the rendered pages have their tables and code blocks and no raw Markdown. The Playtime code on the page is the code I built and checked (cargo horizon-mod build, check: trial run ok; cargo test: 1 passed); the signing commands were run with minisign 0.12 and check --key --signature said "signature verified".
  • node --test src/ (4 new renderer tests: a table, a bar in a code span, rows with no rule line, a code label in a link): 15/15 pass.
  • node build.mjs from the checkout and from a copy of website/ alone (Railway's way, portal fetched from main): 25 docs pages, link check clean.
  • Pages built from main and from this branch compared: the home page, releases, hosting and mods differ only by the added CSS (and the mods link); /docs/performance's folder table is now a table.
  • Caddy (this Caddyfile, caddy run) and serve.mjs: /docs/api 200, /docs/api/ 301 → /docs/api, /docs/api/mods and /docs/api/server-reference 200, /docs/api/nope 404, /docs/hosting 200, /server 301.
  • Looked at /docs/api/mods#ways-in in Safari: the table reads as a table in the dark theme, nav groups in place.
**pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at bd591f985, 1 min 23 s)
| Scope | ✅ 22 files, +696 −23 (mostly the guide's prose) | Public tree ✅ | no Rust/Python change | Parity ➖ no harness affected | Label `skip-release`

Needs Ludovic

Nothing. After merge Railway redeploys (the website/** watch pattern matches).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/1810 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `docs/api-portal-website` --- ### 📝 Commits (2) - [`4a9ca29`](https://github.com/horizon-rust/horizon/commit/4a9ca2988732944ea794e23852132e02c2aec567) Website: the API portal at /docs/api, with Markdown tables - [`a6f951e`](https://github.com/horizon-rust/horizon/commit/a6f951e126f2dc210aa278531790334ff655e10c) Website: Make a mod, the full guide from the first line to the registry ### 📊 Changes **22 files changed** (+696 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `docs/api/README.md` (+2 -1) 📝 `docs/api/mods.md` (+3 -0) 📝 `website/Caddyfile` (+4 -0) 📝 `website/README.md` (+7 -2) 📝 `website/build.mjs` (+28 -8) 📝 `website/docs/apis.md` (+2 -2) ➕ `website/docs/content-mods.md` (+114 -0) 📝 `website/docs/index.md` (+1 -0) ➕ `website/docs/make-a-mod.md` (+88 -0) ➕ `website/docs/mod-code.md` (+190 -0) ➕ `website/docs/mod-manifest.md` (+60 -0) 📝 `website/docs/mods.md` (+5 -3) 📝 `website/docs/nav.json` (+3 -1) ➕ `website/docs/publish-a-mod.md` (+57 -0) ➕ `website/docs/test-a-mod.md` (+59 -0) 📝 `website/railway.json` (+1 -1) 📝 `website/serve.mjs` (+5 -1) 📝 `website/src/docs.html` (+1 -1) 📝 `website/src/markdown.js` (+36 -3) ➕ `website/src/markdown.test.mjs` (+25 -0) _...and 2 more files_ </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What **Make a mod: the full guide on the site** (added on request: playhorizon.dev had no complete "how to make a mod"). A new docs group, six pages, from nothing to a published mod: | Page | What it covers | | --- | --- | | `/docs/make-a-mod` | the path; what mods can do today; install Rust, the wasm target and `cargo horizon-mod`; `new`, the project layout, `build`; seeing it in the game as a dev mod (the launcher's **Settings, Game arguments** `--dev-mod …`, or `cargo horizon-mod run --game … -- --resources …`); logs, the `horizon-mods` folder, what happens when a mod fails | | `/docs/mod-manifest` | every manifest key; every capability with the sentence players read and the calls it allows, with limits; the import check; what no mod can do (sandbox, memory, budget); API versions | | `/docs/mod-code` | the `Mod` trait, `Registration`, every hook and when it runs, command results (`Ok(None)`, `Ok(Some)`, `Err` in red), every SDK call per module; **a worked example, Playtime** (tick, command, HUD, storage, a unit test), step by step. I built it with `cargo horizon-mod build`, ran `check` on it (trial run ok) and its unit test passes | | `/docs/content-mods` | the ruby example's layout and manifest; block keys (from `horizon-mods/src/content.rs`), item keys, recipes, loot, tags, models, names, namespaces, limits; trying it as a folder dev mod and zipping it | | `/docs/test-a-mod` | unit tests, the dev-mod loop and what to try, why a mod stops, `cargo horizon-mod check` and its options | | `/docs/publish-a-mod` | version, release build, check, public source and licence; **minisign signing** (key pair, sign, verify with `check --key --signature`, checked here); the submit form field by field; review, publication, updates, reports | Links in: the top bar's **Docs** opens the docs, whose nav has the new "Make a mod" group and whose index links it; `/mods`'s **Make a mod** button goes to the guide (it went to `/docs/mods`); `/mods/submit` links Publish and Make a mod; `/docs/mods` and the Mod API's Guide point at it. The API reference (`docs/api/*`) is on the site through the portal below. Two gaps the guide states plainly instead of hiding: there is no `cargo horizon-mod new --template` (one template, the client code mod), and the registry can't take a content-only mod yet, because `cargo horizon-mod check` refuses a `.hmod` with no `mod.wasm` (checked on the ruby example) and `build` doesn't pack `assets/` and `data/`. A small follow-up PR fixes those and updates the guide. `cargo horizon-mod test` goes into the guide with #1816. ### The API portal (the first commit) The API portal (`docs/api/`) is on the website: `playhorizon.dev/docs/api` is its index and `/docs/api/<page>` each page (Mod API, its generated reference, the registry index, Server API and reference, Agent control, Launcher, Data formats, Shaders, Stability). Today `/docs/api` is a 404. - **Not a copy.** `website/docs/nav.json` lists the portal as `api` (its README) and `api/<page>`; `build.mjs` reads them from the checkout, or from `main` on GitHub when Railway builds `website/` alone, the way it already reads the README. Links between portal pages become site links (and the build's link check now covers them: a portal page missing from the nav fails the build); every other relative link (`../mods.md`, `../../AGENTS.md`, …) goes to the file on GitHub. The generated references' header comment is dropped. - **Tables render.** `src/markdown.js` had no tables: the "Ways in" table, the references, and the existing tables on `/docs/apis` and `/docs/performance` showed as one paragraph of pipes (see the live `/docs/apis`). Now `| … |` + a rule row is a `<table>` in a scroll box; `\|` and bars inside code spans stay in their cell. A link whose label is a code span used to throw; fixed. - **Routing.** Caddy rewrites `/docs/api/<page>` to its file and redirects `/docs/api/` to `/docs/api`; `serve.mjs` does the same; Railway's `watchPatterns` gain `/docs/api/**` so a portal change redeploys. - **Links in.** Nav groups "Build on Horizon" (the summary, the portal, stability) and "API reference"; `/docs/mods` links the Mod API, its reference and its ways in; `/docs/apis` links the portal instead of the GitHub folder and is titled "APIs at a glance" so it doesn't sit beside "Horizon APIs" under nearly the same name. "Edit this page on GitHub" points at the page's real file. ## How tested - Guide: `node build.mjs` (31 docs pages, the link and anchor check clean); every new page, `/mods` and `/mods/submit` served 200 by `serve.mjs`; the rendered pages have their tables and code blocks and no raw Markdown. The Playtime code on the page is the code I built and checked (`cargo horizon-mod build`, `check`: trial run ok; `cargo test`: 1 passed); the signing commands were run with minisign 0.12 and `check --key --signature` said "signature verified". - `node --test src/` (4 new renderer tests: a table, a bar in a code span, rows with no rule line, a code label in a link): 15/15 pass. - `node build.mjs` from the checkout and from a copy of `website/` alone (Railway's way, portal fetched from `main`): 25 docs pages, link check clean. - Pages built from main and from this branch compared: the home page, releases, hosting and mods differ only by the added CSS (and the mods link); `/docs/performance`'s folder table is now a table. - Caddy (this Caddyfile, `caddy run`) and `serve.mjs`: `/docs/api` 200, `/docs/api/` 301 → `/docs/api`, `/docs/api/mods` and `/docs/api/server-reference` 200, `/docs/api/nope` 404, `/docs/hosting` 200, `/server` 301. - Looked at `/docs/api/mods#ways-in` in Safari: the table reads as a table in the dark theme, nav groups in place. ``` **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at bd591f985, 1 min 23 s) | Scope | ✅ 22 files, +696 −23 (mostly the guide's prose) | Public tree ✅ | no Rust/Python change | Parity ➖ no harness affected | Label `skip-release` ``` ## Needs Ludovic Nothing. After merge Railway redeploys (the `website/**` watch pattern matches). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:16 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#3782
No description provided.