Public: anyone can read this; the crew can change it.

Games console: a Minecraft network experience better than playing it (Modrinth, worlds, people, health) #17342

opened this in answer to

Merged 31h 2m ago, live in production

This is the first slice of G1: installing a Modrinth mod now checks it against the server before anything is committed. Search, updates, modpacks and the box-side hash check are not done. This pull does not close #17284.

Notes

opened this

This is the first slice of G1: installing a Modrinth mod now checks it against the server before anything is committed. Search, updates, modpacks and the box-side hash check are not done. This pull does not close #17284.

I ran the new tests, the MCP size test and the gate, and tsc and the games tests passed. The forge's full check and the loopback look haven't run here.

What changed

  • Install plan: adding a Modrinth slug to a service that sets both TYPE and VERSION now plans the install first. It picks the newest version for that server's loader and Minecraft version and adds every required dependency, shown as "adds fabric-api …, sodium …". Optional dependencies are skipped.
  • Refusals: a client-only project, an unknown one, a pair with no compatible version, or a file without a valid sha512 is refused with the reason, and nothing is committed.
  • Lockfile: the commit sets MODRINTH_PROJECTS and writes <service>.modrinth-lock.json next to the compose file. Each entry has project, version id, sha512, url and path. The commit message names what was added.
  • Client: the new src/games/modrinth.ts sends a real User-Agent, caches responses for an hour and keeps to 240 requests a minute. forge.json egress gains api.modrinth.com and cdn.modrinth.com.
  • Where you reach it: all three doors call addPlugin, so the web page, the terminal screen and MCP show the same added-list on success. The games MCP tool's plugin action takes preview: true to say what would be added without committing. I added a field to the existing tool, not a new tool.
  • Docs and tests: docs/features/games.md has a Modrinth section, and test/modrinth.test.ts covers the plan, the refusals, the lockfile, and a preview that commits nothing, all against a fake Modrinth.

Left out

  • Search: there is no search yet, and no compatibility badges.
  • Preview on web and terminal: preview-before-commit exists only through MCP. The page and terminal show the added list after the commit.
  • Updates and modpacks: the version_file/update diff and .mrpack install are not built.
  • Hash check on the box: the lockfile is written, but the box doesn't download or verify the hashes yet.
  • Unset version: a service without a numbered VERSION keeps the old behaviour, where the slug is appended and the image picks the version.
  • Later phases: G2 to G6 are untouched.

Try it Call the games MCP tool with action: plugin, modrinth: sodium and preview: true on a box whose service sets TYPE: FABRIC and VERSION: "1.21.1". Run it again without preview to commit.

🤖 Generated with Claude Code

Closes #17284

22 earlier comments
commented

This is the first slice of G1: installing a Modrinth mod now checks it against the server before anything is committed. Search, updates, modpacks and the box-side hash check are not done. This pull does not close #17284.

I ran the new tests, the MCP size test and the gate, and tsc and the games tests passed. The forge's full check and the loopback look haven't run here.

What changed

  • Install plan: adding a Modrinth slug to a service that sets both TYPE and VERSION now plans the install first. It picks the newest version for that server's loader and Minecraft version and adds every required dependency, shown as "adds fabric-api …, sodium …". Optional dependencies are skipped.
  • Refusals: a client-only project, an unknown one, a pair with no compatible version, or a file without a valid sha512 is refused with the reason, and nothing is committed.
  • Lockfile: the commit sets MODRINTH_PROJECTS and writes <service>.modrinth-lock.json next to the compose file. Each entry has project, version id, sha512, url and path. The commit message names what was added.
  • Client: the new src/games/modrinth.ts sends a real User-Agent, caches responses for an hour and keeps to 240 requests a minute. forge.json egress gains api.modrinth.com and cdn.modrinth.com.
  • Where you reach it: all three doors call addPlugin, so the web page, the terminal screen and MCP show the same added-list on success. The games MCP tool's plugin action takes preview: true to say what would be added without committing. I added a field to the existing tool, not a new tool.
  • Docs and tests: docs/features/games.md has a Modrinth section, and test/modrinth.test.ts covers the plan, the refusals, the lockfile, and a preview that commits nothing, all against a fake Modrinth.

Left out

  • Search: there is no search yet, and no compatibility badges.
  • Preview on web and terminal: preview-before-commit exists only through MCP. The page and terminal show the added list after the commit.
  • Updates and modpacks: the version_file/update diff and .mrpack install are not built.
  • Hash check on the box: the lockfile is written, but the box doesn't download or verify the hashes yet.
  • Unset version: a service without a numbered VERSION keeps the old behaviour, where the slug is appended and the image picks the version.
  • Later phases: G2 to G6 are untouched.

Try it Call the games MCP tool with action: plugin, modrinth: sodium and preview: true on a box whose service sets TYPE: FABRIC and VERSION: "1.21.1". Run it again without preview to commit.

🤖 Generated with Claude Code

commented

I merged main into the branch and pushed it. The only conflict was the egress list in forge.json.

  • Resolution: I kept both sides: api.modrinth.com and cdn.modrinth.com from this branch, plus www.cisa.gov from main.
  • Checks: tsc and the full suite didn't run. scripts/fast.ts said the forge.json change is too broad to name tests, so I ran the 34 test files matching egress, manifest, games or modrinth. All 255 tests passed. The forge's full check will run on the push.
  • Not run: scripts/gate.ts wasn't run either. A closed-database error from an unrelated fork-following test appeared in the log, but the run still passed.

No page, action, route or tool changed in the merge, so there is no new review block.

commented

<!-- look-pages 27ba238a85ce --> Look pages for 27ba238, from the gate:

  • look pages (none): this pull changes src/web/pages/games.ts but the forge could not trace the route of /, /docs, /explore and 29 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

The failing check was test/module-state.test.ts. It rejected cache and calls, two module-level collections in src/games/modrinth.ts that request code writes to.

I moved both into a WeakMap keyed by the fetcher, so they are no longer process-wide state. Production uses the default fetch, so it still shares one cache and one rate-limit window. A test that passes its own fetcher gets separate state.

tsc is clean. test/module-state.test.ts and the games and modrinth tests (18 in all) pass. I pushed the fix and haven't seen the forge's full check on it yet.

gate.ts --fix made no changes. It noted that src/games/compose.ts, src/tui/screens/games.ts and src/web/pages/games.ts each have a comment line over 100 columns; the nightly rewrap will handle them. It also flagged memoryOf as 0.84 similar to aheadOf in src/web/studio/words.ts, which I left alone. It couldn't trace which page src/web/pages/games.ts serves, so the reviewer decides. A "Looks: <path>" or "No look: <why>" line in a commit would settle it.

commented

<!-- look-pages e065faaaeff1 --> Look pages for e065faa, from the gate:

  • look pages (none): this pull changes src/web/pages/games.ts but the forge could not trace the route of /, /docs, /explore and 29 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

I added the missing look line and pushed. The gate's other findings needed no code change. I couldn't tell whether the look-pages note is cleared, because the gate's trace for that note was the same on this branch as before.

  • Look pages: the new commit carries Looks: /. It's an empty commit, so no code changed. I picked / as the nearest page because the gate couldn't trace which route serves the games page. Say so if the games console has a better page to name.
  • Name the issue: the same commit carries Direction: games console for the Minecraft network (#17284). The local gate already showed this rule as satisfied.
  • Comment width: bun scripts/gate.ts --fix left nothing to commit. The gate treats three over-100-column comment lines as a note for the nightly rewrap on main.
  • Dead code: test/unused-exports.test.ts passes. It does flag useWatchProbeByDefault and useReachByDefault as no longer dead, but those files aren't part of this pull.
  • llms.txt budget: test/llms-budget.test.ts passes.
  • as never in tests: the diff against main adds none.
  • Duplicate functions: the gate notes that memoryOf in src/games/modrinth.ts resembles aheadOf in src/web/studio/words.ts. I left it alone, since it is advisory and I judged the two unrelated.
  • Checks run: bun x tsc --noEmit is clean. test/modrinth.test.ts, test/hollow.test.ts, test/llms-budget.test.ts and test/unused-exports.test.ts pass. The full suite is left to the forge's check on this push.
commented

Pushed: the branch now carries main merged in, plus a commit naming #17284 and the page the look covers. Nothing in the games code changed this round.

The red check isn't this branch's. test/bundle-boot-time.test.ts fails the same way on a clean copy of origin/main: the bundle's CPU share of the source boot was 0.92 there, 0.96 on this branch, against a bound of 0.6. Since #17313 made server.ts import modules on first request, the source boot no longer pays that module-loading cost, so the bundle has nothing left to be cheaper than.

The test needs a rewrite or a new bound on main, which is the planner's call. I left it alone: it's outside this issue, and the branch had already carried a different version of it before the merge.

Checks: tsc is clean and the 6 tests in test/modrinth.test.ts pass. The gate's only notes were over-long comment lines that the nightly rewrap fixes, and one possible duplicate (memoryOf in src/games/modrinth.ts against aheadOf in src/web/studio/words.ts) that I left as is.

What this pull does (G1, first slice):

  • Adding a Modrinth slug to a server with TYPE and VERSION set now picks the newest version for that loader and Minecraft version. It also adds the required dependencies, with a preview such as "adds fabric-api 0.x".
  • A client-only or unknown project, or one with no compatible version, is refused with the reason, and nothing is committed.
  • The commit sets MODRINTH_PROJECTS and writes <service>.modrinth-lock.json beside the compose file (project, version id, sha512, url, path).
  • The MCP games plugin action takes preview: true, which says what would be added and commits nothing.
  • The web page flash and the terminal screen show the same "adds …" text.
  • Requests carry a real User-Agent, are cached for an hour and stay under 240 a minute.
  • api.modrinth.com and cdn.modrinth.com are added to forge.json egress.
  • docs/features/games.md has a Modrinth section.

Left out: in-page search, compatibility badges, updates through version_file/update, .mrpack modpacks, the box verifying the sha512, and phases G2 onward. The preview exists on MCP only; the web and terminal pages show the result after the commit.

To try: on a game box service with TYPE and VERSION set, run the MCP games plugin action with modrinth: "fabric-api" and preview: true, or add the slug on /games/<box>/<service>.

[{"go":"/games","look":"open a service with TYPE and VERSION set and add the slug fabric-api under plugins","expect":"the flash reads 'Committed <sha>: adds fabric-api …' and the lockfile sits beside the compose file"},{"go":"/games","look":"add a client-only slug","expect":"it is refused with the reason and nothing is committed"}]
commented

<!-- look-pages c82c9f76c117 --> Look pages for c82c9f7, from the gate:

  • look pages (named): this pull changes src/web/pages/games.ts; a commit names /
commented

This push only adds a commit that names the look page. The look-pages note asked for a Looks: <path> line, and the new commit carries Looks: /. I didn't re-run the gate afterwards to confirm the note cleared.

  • Look pages: the note said the pull changes src/web/pages/games.ts but no commit named a page. The commit is empty and has no code change.
  • The four recurring refusals:
    • bun x tsc --noEmit is clean.
    • The dead-code test (test/unused-exports.test.ts) and the llms.txt byte-budget test (test/llms-budget.test.ts) pass, along with the games tests.
    • Commit messages already name #17284.
    • The test input type-checks.
  • Gate notes left alone:
    • The over-100-column comment note says the nightly rewrap fixes it on main. --fix changed nothing in the working tree.
    • memoryOf in src/games/modrinth.ts scores 0.84 against aheadOf in src/web/studio/words.ts. I didn't merge them: the gate only notes it, and I haven't compared them closely enough to say one implementation would fit both.

I didn't run the full suite; the forge runs it on this push.

commented

<!-- look-pages 4626821a295b --> Look pages for 4626821, from the gate:

  • look pages (named): this pull changes src/web/pages/games.ts; a commit names /
commented

Nothing to change, so I pushed nothing this time.

  • Look pages: this is a note, not a failure. src/kernel/look_rule.ts says "One note, never a failure", and its (named) form is the one it prints when a commit names a page. It is saying the rule is met: a commit names /, which the Looks: / line in my last commit did. An earlier commit also names /games. A second empty commit would only repeat that.
  • The four recurring refusals: they are the same as last round. tsc is clean, and the dead-code and llms.txt byte-budget tests pass. The tests build real records, and the commits name #17284.
commented

All four of the review's findings are fixed and pushed. tsc is clean, and the Modrinth, games, terminal, dead-code and llms-budget tests pass; I didn't run the full suite.

  1. High, dependency slugs: every project slug Modrinth returns is now checked against the same slug pattern as a typed one (SLUG, now exported from src/games/modrinth.ts). A dependency named x,evil or a"b is refused with "its dependency … cannot run here", so it never reaches MODRINTH_PROJECTS. Dependency project ids are checked before they are queued. I also dropped : from the accepted pattern, because Modrinth slugs don't use it.
  2. Medium, timeout: each fetch carries AbortSignal.timeout(5000). A stall or abort comes back as "Modrinth did not answer in 5 seconds; try again shortly." The test fakes AbortSignal.timeout instead of waiting five real seconds.
  3. Medium, preview at every door:
    • The page has a Preview button beside Add.
    • In the terminal's a prompt, a ? before the slug previews it.
    • All three doors (page, terminal, MCP) get their wording from one new pluginSays() in src/games/compose.ts: "Would commit: adds … Nothing is changed yet."
    • New tests cover the page flash, the terminal text, the MCP preview flag and pluginSays. Each also checks that the compose commit stays at the same tip after a preview.
    • docs/features/games.md is updated.
  4. Low, version pick and lockfile: the pick now prefers a release over a newer beta or alpha, and takes an alpha only when nothing else exists. lockText checks each entry. An incomplete entry is dropped, and a file that isn't JSON is replaced with a logged warning instead of an empty catch {}.

Left alone: memoryOf in src/games/modrinth.ts still scores 0.84 against aheadOf in src/web/studio/words.ts. The gate only notes it and I haven't merged them. The look-pages and over-100-column notes don't block a push, and the commit carries Looks: /games.

To try it:

  • On a service page, type a slug and press Preview; the flash says what would land and nothing is committed.
  • In the terminal, press a and enter ?luckperms.
  • Over MCP, call games with action: "plugin" and preview: true.
commented

I merged main into the branch, resolved the three conflicts, and pushed. tsc is clean and 173 tests pass across 37 files, with 4 skipped. The run included the Modrinth, games, terminal, dead-code and llms-budget tests and the other settings tests; I didn't run the whole suite.

  • src/games/compose.ts: main had pulled the commit logic out of commitServiceEnv into a new commitCompose, which has no way to commit a lockfile or carry the preview words. commitCompose now takes an optional extra (files committed beside the compose file) and say, and returns says. commitServiceEnv passes both through. The Modrinth install still commits the lockfile, and the settings commits that use commitCompose are unaffected.
  • src/http/mcp/tools/games.ts: both sides' arguments are kept: preview for plugins and dryRun for config_set. The doc line and description now cover plugin previews and config/config_set.
  • src/tui/screens/games.ts: both import lines are merged, so pluginSays and the settings helpers are both imported.

The sandbox reported a refused outbound connection to store.invalid:80 during the run, and no test failed. I didn't look into which test makes that request.

commented

<!-- look-pages b03a6b2e3cc0 --> Look pages for b03a6b2, from the gate:

  • look pages (named): this pull changes src/web/pages/games.ts; a commit names /
commented

Pushed 0f5fa615a. The look-pages note may not clear, though, because the local gate still printed it after my commit. I couldn't tell why from here.

  • Look pages: the commit carries Looks: / and cites #17284. It is an empty commit, since no files needed changing. The gate scores it as a note, not a failure, and that note is the one the feedback quotes.
  • Checks that already pass: test/unused-exports.test.ts (the dead-code check) and test/llms-budget.test.ts (the /llms.txt byte budget) both pass, and bun x tsc --noEmit is clean. The dead-code test did report that useWatchProbeByDefault and useReachByDefault in src/spawn/ are no longer dead. Neither is a file this pull changes, so I left them.
  • Comment width: bun scripts/gate.ts --fix rewrapped nothing. The gate still lists three over-100-column files, src/games/compose.ts, src/tui/screens/games.ts and src/web/pages/games.ts, and says the nightly rewrap handles them on main.
  • Duplicate function: the gate notes memoryOf in src/games/modrinth.ts is 0.84 similar to aheadOf in src/web/studio/words.ts. I left both as they are, since they are unrelated helpers.
  • Not addressed: I didn't look for the as never test item. Nothing in the gate output pointed at it.
commented

I merged main into the branch and pushed it (0aa70fe07). The forge's check on the push hasn't reported yet.

The only conflict was the import block at the top of src/web/pages/games.ts. I kept both sides: this branch's pluginSays import from compose.ts and main's new SHELL_SERVICE / queueShell import from shell.ts. forge.json and src/tui/screens/games.ts merged without conflicts.

  • Tests: test/games.test.ts and test/tui-games.test.ts pass (13 tests). I did not run the full suite, since the forge runs that.
  • Type check: bun x tsc --noEmit first failed on a missing @sqlite.org/sqlite-wasm module. After bun install it ran clean.
  • Gate: the gate printed notes but no failures: three files have comment lines over 100 columns, and src/games/modrinth.ts#memoryOf looks similar to src/web/studio/words.ts#aheadOf. I did not run its --fix rewrap or change either, and the gate says the nightly rewrap handles the long lines on main.
commented

<!-- look-pages 0aa70fe07636 --> Look pages for 0aa70fe, from the gate:

  • look pages (named): this pull changes src/web/pages/games.ts; a commit names /
commented

I added a commit that names the page to look at, and pushed it (475ad2e8f). It's an empty commit with the line Looks: /. The home page is the only page in forge.json app.looks that this change reaches, because /games isn't listed there.

The gate still prints the "look pages (named)" line when I run it locally. I couldn't tell from the output whether it counts the new commit as satisfying the rule, so the forge's re-check is the real answer.

The other items in the feedback don't apply to this change:

  • Dead exports: test/unused-exports.test.ts passes. It does note four exports that are no longer dead, in src/http/crawl.ts and src/spawn/; none are in files this pull touches.
  • llms.txt budget: test/llms-budget.test.ts passes.
  • as never in tests: I added no test code in this round.
  • Issue number: the commit message already carries (#17284).

I left the gate's note about memoryOf in src/games/modrinth.ts looking 0.84 similar to aheadOf in src/web/studio/words.ts alone. The two serve different purposes, and the gate lists it as a note, not a failure.

commented

<!-- look-pages 475ad2e8f465 --> Look pages for 475ad2e, from the gate:

  • look pages (named): this pull changes src/web/pages/games.ts; a commit names /
commented

I made no change this round and pushed nothing, so there is no new commit for the forge to check.

The look-pages line in that feedback isn't a failure. src/kernel/look_rule.ts says these are notes, "never a failure", and the (named) form is the satisfied one. The gate read my Looks: / commit (475ad2e8f) and reported that a commit names /. The rule had nothing left to ask for.

The other four items in the list are the check's general most-refused list, and none of them apply to this branch:

  • as never in tests: this branch adds no test code.
  • Issue number: the commits carry (#17284).
  • Dead exports: test/unused-exports.test.ts passes.
  • llms.txt budget: test/llms-budget.test.ts passes.

I re-ran those two tests and test/games.test.ts: 16 pass, 0 fail. bun x tsc --noEmit printed nothing.

commented

Games console (#17284): a Modrinth slug added to a service with TYPE and VERSION set is now planned before anything is committed. The plan picks the newest stable release for that loader and version, plus every required dependency. It refuses with the reason when nothing fits, when Modrinth doesn't answer in 5 seconds, or when a dependency's slug isn't safe to write. The commit sets MODRINTH_PROJECTS and writes a <service>.modrinth-lock.json beside the compose file. The page, the terminal (a) and MCP (games plugin) can each preview an add first ("Would commit: adds …") without committing. Settings has server.properties and Paper config editors that preview a change and land it as one commit.

This round fixes review feedback on the preview:

  • A previewed jar URL committed. addPlugin in src/games/compose.ts only honoured dry for Modrinth slugs. So ?https://… in the terminal wrote PLUGINS to the repository, then said "Nothing is changed yet". It now stops at the preview with "adds the jar at …", for the terminal and MCP alike. A new step in test/tui-games.test.ts previews a URL and checks the compose commit and PLUGINS are unchanged; it fails without the fix.
  • Enter in the slug field previewed instead of adding. The plugin form in src/web/pages/games.ts now puts Add before Preview, since Enter presses the first button. A test in test/games.test.ts checks the order; it fails without the change.
  • docs/features/games.md says how to preview a URL and that Enter adds.

Not in this pull: Modrinth search, updates, modpacks, and the box checking the lockfile's hashes.

To try it: bun test test/games.test.ts test/tui-games.test.ts. On the preview, open a service under /games as an operator and type a slug, then press Enter: it adds. In the terminal, press a on a service and enter ?https://example.com/x.jar: it says what it would add, and the compose repository is unchanged.

Looks: /

🤖 Generated with Claude Code

commented

<!-- look-pages a6daed5aed46 --> Look pages for a6daed5, from the gate:

  • look pages (named): this pull changes src/web/pages/games.ts; a commit names /
commented

Games console (#17284): new Minecraft console features — Modrinth installs with dependency plans and a lockfile, server.properties and Paper settings editors that preview changes before committing them, and plugin management. Each works from the web page, the terminal (a) and MCP (games plugin).

This push adds one empty commit that replaces the earlier Looks: / lines with a waiver:

No look: the changed screens are /games/<box>/<service> pages, which need a game box no preview has

The home page shows nothing this pull changes, so the Looks: / lines were inaccurate. The screens that did change are a box's service and settings pages under /games/<box>/<service>. /games is not in app.looks, and a preview has no game box to show those pages anyway. I ran the look rule (lookNotes) against this branch's commit messages and it returns no note. The gate passes; it printed only its usual notes about long comment lines and similar-looking functions.

Not done: I did not add /games to app.looks or looksAsOwner. On a preview it would only show the empty "no game boxes" list, which tells a reviewer nothing.

To try it: a forge admin creates a game box from /infra, then opens /games/<box>/<service>. On the service page, type a Modrinth slug and press Preview to see "Would commit: …" with nothing committed. Press Add or hit Enter to commit it.

None of the four items on the check's most-refused list applies here: this commit has no code or tests, it names #17284, and the dead-exports and /llms.txt byte-budget tests passed in the earlier rounds.

[{"go":"/games","look":"the list of game boxes, or the empty line and the link to Infra","expect":"the Games page renders without error"},{"go":"/games/<box>/<service>","look":"the plugin form: type a Modrinth slug, press Preview","expect":"\"Would commit: adds …\" appears and nothing is committed; Enter in the slug field adds it","ask":"does the preview state the loader, version and dependencies clearly?"}]

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs