feat(modtool): mod init --test writes a starter test; players' mods page covers sources #2868

Merged
HumanBean merged 3 commits from HumanBean/Longshot:docs/mods-sources-leftovers into mod-api 2026-11-30 19:24:23 +00:00
Owner

Summary

The players' mods page, docs/user/using-mods.md, still said "Nothing downloads or unpacks mods for you", and it
only described emulator-style folders put in mods/ by hand. Players can now add sources (a git repository, a signed
longshot-repo.json, an .lsmod URL) in the launcher or with Longshot.exe mod source add, and install, update, pin
and remove mods from them. The page now covers both ways to get mods:

  • from a source: the launcher's Mods > Repositories / Discover, or mod source add, search, install,
    update, pin, remove. It also covers repo keys, the store and mod gc;
  • a mod of your own: an .lsmod or .zip, a Longshot mod's folder or an emulator mod, put in the profile's
    mods/ or copied in with mod add / mod import.

What it said about file mods (romfs/exefs, the Mods tab, the order, the size table, the log) is kept.

The README that mod init writes ended with "mod pack makes its .lsmod". It now says how to share the mod, as
getting-started.md's step 9 does: push to git and tag each version, mod publish for a repo, mod pack for one
file. Its test checks this text.

docs/modding/template/AGENTS.md, CLAUDE.md and README.md were stale and read by nothing (mod init writes its
own README; the builder only hashes the folder). They are removed. api-schema.md's list of the template's files now
includes .gitignore.

Read first: docs/user/using-mods.md, then game/crates/modtool/src/cmd/init.rs.

mod init --test (second commit). mod init still writes no test; --test also writes test/main.test.ts, from docs/modding/template/test/main.test.ts (kept), which mod test passes as written. Help, tools.md, agents.md, testing.md, getting-started.md step 6 and api-schema.md say so.

Testing

Tested: Linux. No game run: docs, plus a string the builder's mod init writes.

  • cargo test -p modtool --lib cmd::init (through the job queue): 2 passed

  • python3 -I tests/run_all.py --exact tests/test_doc_anchors.py tests/test_check_pr_description.py tests/test_dev_check.py: 3 passed

  • pre-commit run --files on the changed files: passed

  • A fresh reviewer checked every claim against modtool (USAGE, service.rs, sources.rs), mod-store and the launcher's
    labels. Its three wording fixes are in.

  • Review fixes (a0b07a96): the source example adds with --yes before searching; pin says it installs the version.

  • tests/run_all.py, the whole suite, once through the job queue on a0b07a96: 734 passed, 1 failed, 114 skipped: the only failure, tests/test_lifter.py (build-core's control::tests::the_socket_is_made_private_and_a_client_handed_over, control.rs:428), fails the same way on mod-api @ 12f42db5.

Still to test:

  • None

  • cargo test -p modtool --lib cmd::init (through the job queue) on the second commit: 3 passed, including the new init_test_writes_a_starter_test_that_mod_test_passes (runs init --test then mod test: 2 passed) and plain init writing no test/.

Measurements

Nothing to measure: docs and an opt-in mod init flag; nothing the game runs changed.

Risks

Nothing a player notices except the new README text in a mod made with mod init. If the launcher's Mods page labels
change, the page's names for them (Mods, Repositories, Discover, Add mods) will need updating.

Checklist

Ready for review

  • One topic, on current mod-api; the title is a Conventional Commit.
  • Tested on my own PC, as Testing says (no game run needed).
  • mise run test passes (any failure that also fails on main is named). (tests/test_lifter.py: build-core's socket hand-over test, failing on mod-api @ 12f42db5 too.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A check under tests/ that reads changed source is updated, not weakened (init's test checks the README).
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc

## Summary The players' mods page, `docs/user/using-mods.md`, still said "Nothing downloads or unpacks mods for you", and it only described emulator-style folders put in `mods/` by hand. Players can now add sources (a git repository, a signed `longshot-repo.json`, an `.lsmod` URL) in the launcher or with `Longshot.exe mod source add`, and install, update, pin and remove mods from them. The page now covers both ways to get mods: - **from a source**: the launcher's Mods > Repositories / Discover, or `mod source add`, `search`, `install`, `update`, `pin`, `remove`. It also covers repo keys, the store and `mod gc`; - **a mod of your own**: an `.lsmod` or `.zip`, a Longshot mod's folder or an emulator mod, put in the profile's `mods/` or copied in with `mod add` / `mod import`. What it said about file mods (romfs/exefs, the Mods tab, the order, the size table, the log) is kept. The README that `mod init` writes ended with "`mod pack` makes its `.lsmod`". It now says how to share the mod, as getting-started.md's step 9 does: push to git and tag each version, `mod publish` for a repo, `mod pack` for one file. Its test checks this text. `docs/modding/template/AGENTS.md`, `CLAUDE.md` and `README.md` were stale and read by nothing (`mod init` writes its own README; the builder only hashes the folder). They are removed. api-schema.md's list of the template's files now includes `.gitignore`. Read first: `docs/user/using-mods.md`, then `game/crates/modtool/src/cmd/init.rs`. **`mod init --test`** (second commit). `mod init` still writes no test; `--test` also writes `test/main.test.ts`, from `docs/modding/template/test/main.test.ts` (kept), which `mod test` passes as written. Help, tools.md, agents.md, testing.md, getting-started.md step 6 and api-schema.md say so. ## Testing **Tested:** Linux. No game run: docs, plus a string the builder's `mod init` writes. - `cargo test -p modtool --lib cmd::init` (through the job queue): 2 passed - `python3 -I tests/run_all.py --exact tests/test_doc_anchors.py tests/test_check_pr_description.py tests/test_dev_check.py`: 3 passed - `pre-commit run --files` on the changed files: passed - A fresh reviewer checked every claim against modtool (USAGE, service.rs, sources.rs), mod-store and the launcher's labels. Its three wording fixes are in. - Review fixes (a0b07a96): the source example adds with `--yes` before searching; `pin` says it installs the version. - `tests/run_all.py`, the whole suite, once through the job queue on a0b07a96: 734 passed, 1 failed, 114 skipped: the only failure, `tests/test_lifter.py` (build-core's `control::tests::the_socket_is_made_private_and_a_client_handed_over`, control.rs:428), fails the same way on mod-api @ 12f42db5. **Still to test:** - None - `cargo test -p modtool --lib cmd::init` (through the job queue) on the second commit: 3 passed, including the new `init_test_writes_a_starter_test_that_mod_test_passes` (runs `init --test` then `mod test`: 2 passed) and plain init writing no `test/`. ## Measurements Nothing to measure: docs and an opt-in `mod init` flag; nothing the game runs changed. ## Risks Nothing a player notices except the new README text in a mod made with `mod init`. If the launcher's Mods page labels change, the page's names for them (Mods, Repositories, Discover, Add mods) will need updating. ## Checklist ### Ready for review - [x] One topic, on current `mod-api`; the title is a Conventional Commit. - [x] Tested on my own PC, as Testing says (no game run needed). - [x] `mise run test` passes (any failure that also fails on `main` is named). (`tests/test_lifter.py`: build-core's socket hand-over test, failing on mod-api @ 12f42db5 too.) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A check under `tests/` that reads changed source is updated, not weakened (init's test checks the README). - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. πŸ€– Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016o1k1SQVyAWsujjFVd8Wuc
docs(modding): players' mods page covers sources and installs; init's README says how to share
Some checks failed
PR description / Title and description (pull_request_target) Failing after 7s
8065ec2313
docs/user/using-mods.md described only folders put in mods/ by hand and said nothing downloads mods. It now covers
both ways a player gets mods: sources (a git repository, a signed longshot-repo.json, an .lsmod URL) added in the
launcher or with `mod source add`, installed, updated, pinned and removed with `mod install`/`update`/`pin`/`remove`
into the store; and a mod of their own (an .lsmod or .zip, a Longshot mod's folder, an emulator mod) put in the
profile's mods/ or added with `mod add`/`mod import`. The file mods' layout, the Mods tab, order and log stay.

The README `mod init` writes said only "`mod pack` makes its `.lsmod`": it now says how to share the mod as
getting-started.md's step 9 does (push to git and tag each version; `mod publish` for a repo; `mod pack` for one
file), and init's test checks it.

docs/modding/template/AGENTS.md, CLAUDE.md and README.md were read by nothing (init writes its own README, and the
builder only hashes the folder) and were stale: removed. api-schema.md's list of the template's files names its
.gitignore too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member

Possibly related, for context:

  • PR #2852 docs(modding): Your first mod offers a coding agent beside the steps by hand, and reads more easily β€” Merged mod-sharing guidance in getting-started; this PR extends it to the player guide and init README.
  • PR #1210 docs(website): a Mods page: installing mods, turning them off, the load order and checking the log β€” Earlier merged players' mods guide; this updates the same guidance for repository installs.
Possibly related, for context: - PR #2852 docs(modding): Your first mod offers a coding agent beside the steps by hand, and reads more easily β€” Merged mod-sharing guidance in getting-started; this PR extends it to the player guide and init README. - PR #1210 docs(website): a Mods page: installing mods, turning them off, the load order and checking the log β€” Earlier merged players' mods guide; this updates the same guidance for repository installs.
feat(modtool): mod init --test writes a starter test that mod test passes
Some checks failed
PR description / Title and description (pull_request_target) Failing after 5s
350b157225
A new mod has no test by default. With `--test`, `mod init` also writes test/main.test.ts from the template (two tests
of the hearts the starter mod logs, on the fake game and the real one), so `mod test` has something to run at once.
init's tests check that `init --test` writes a mod whose `mod test` passes, and that plain init writes no test.

USAGE, tools.md, agents.md, testing.md, getting-started.md's step 6 and api-schema.md's template list name the flag.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

Added a second commit: mod init --test writes the template's starter test (plain mod init writes none). init's tests pass (3).

Added a second commit: `mod init --test` writes the template's starter test (plain `mod init` writes none). init's tests pass (3).
Author
Owner
@review
BeanBot left a comment

Recommendation: Approve. The PR adds a modtool feature but its docs title would classify the release as documentation-only and select the wrong version bump. The new player guide also contains command sequences that can lead to an unsuccessful install or an unintended version change. Nothing blocking is left. Recommend approval; not approved on the forge.

The change documents mod sources and sharing, removes unused template files, and adds an optional starter test to mod init. The initializer test exercises the new option, while several player-facing instructions need correction.

Should fix (3): not blocking, but worth doing before merging.

  • L1: The PR title uses docs even though this change adds the mod init --test feature. The repository uses the squash title to choose the release type and minimum version. When: When merged under this title, the new modtool option is released as a documentation change with a patch minimum instead of the minor minimum required for a new modder feature. Do: Change the title to a feat Conventional Commit that describes the new initializer option and documentation.
  • L2 docs/user/using-mods.md:36: The command example searches immediately after a preview-only source add. (more on the line) Do: Show the second source add with --yes after the preview and key check, before search.
  • L3 docs/user/using-mods.md:48: The description of pinning omits that the command can change the installed version. (more on the line) Do: Say that pin installs the specified version if necessary and then keeps it pinned.

@fix can do L1, L2 and L3.

Checks: Failing on this head, which is behind its base, where it passes: PR description / Title and description (pull_request_target). @rebase (or @fix) brings it up to date and runs it again; not held against it.

More: does it help, other systems, switches, what was read

Does it help: Yes: the reported Linux run says all three initializer tests passed, including creating and running the two starter tests. This is not a performance change.

Other systems: The new flag affects mod authors using the builder on Windows and Linux; the implementation uses the existing argument parser and file writer. No game runtime, renderer, save, audio, or input code changes.

Switches: mod init --test is a new opt-in command option, default off; that default preserves existing initializer behavior.

Reviewed: 350b157225 against cb37f5ab8a: Read the diff, initializer, argument parser, starter template, player guide, changed documentation passages, source command and relevant source and pin handling. Skimmed the remaining long documentation files and modtool help, repository references to the deleted templates, and commit history. No recorded game runs or translations were supplied.; nothing run (a code review).

Checked and fine:

  • Both commits record AI assistance.
  • The starter test is generated only with --test, and the new test invokes mod test on the generated mod.
  • Deleted template guidance has no remaining initializer references; the builder hashes the template directory.
  • No game-derived files, generated outputs, renderer API changes, or environment switches appear in the diff.

Testing: Read-only review; no commands from the project or tests were run. The author reports three initializer tests passing on Linux. The full mise run test remains unreported, and CI's description check is listed as behind the base.

Overlaps and merge order: Not checked; network is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The PR adds a modtool feature but its `docs` title would classify the release as documentation-only and select the wrong version bump. The new player guide also contains command sequences that can lead to an unsuccessful install or an unintended version change. Nothing blocking is left. Recommend approval; not approved on the forge. The change documents mod sources and sharing, removes unused template files, and adds an optional starter test to `mod init`. The initializer test exercises the new option, while several player-facing instructions need correction. **Should fix (3)**: not blocking, but worth doing before merging. - **L1**: The PR title uses `docs` even though this change adds the `mod init --test` feature. The repository uses the squash title to choose the release type and minimum version. *When:* When merged under this title, the new modtool option is released as a documentation change with a patch minimum instead of the minor minimum required for a new modder feature. **Do:** Change the title to a `feat` Conventional Commit that describes the new initializer option and documentation. - **L2** `docs/user/using-mods.md:36`: The command example searches immediately after a preview-only source add. (more on the line) **Do:** Show the second `source add` with `--yes` after the preview and key check, before search. - **L3** `docs/user/using-mods.md:48`: The description of pinning omits that the command can change the installed version. (more on the line) **Do:** Say that pin installs the specified version if necessary and then keeps it pinned. `@fix` can do L1, L2 and L3. **Checks:** Failing on this head, which is behind its base, where it passes: `PR description / Title and description (pull_request_target)`. `@rebase` (or `@fix`) brings it up to date and runs it again; not held against it. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes: the reported Linux run says all three initializer tests passed, including creating and running the two starter tests. This is not a performance change. **Other systems:** The new flag affects mod authors using the builder on Windows and Linux; the implementation uses the existing argument parser and file writer. No game runtime, renderer, save, audio, or input code changes. **Switches:** `mod init --test` is a new opt-in command option, default off; that default preserves existing initializer behavior. **Reviewed:** 350b1572250e against cb37f5ab8a63: Read the diff, initializer, argument parser, starter template, player guide, changed documentation passages, source command and relevant source and pin handling. Skimmed the remaining long documentation files and modtool help, repository references to the deleted templates, and commit history. No recorded game runs or translations were supplied.; nothing run (a code review). **Checked and fine:** - Both commits record AI assistance. - The starter test is generated only with `--test`, and the new test invokes `mod test` on the generated mod. - Deleted template guidance has no remaining initializer references; the builder hashes the template directory. - No game-derived files, generated outputs, renderer API changes, or environment switches appear in the diff. **Testing:** Read-only review; no commands from the project or tests were run. The author reports three initializer tests passing on Linux. The full `mise run test` remains unreported, and CI's description check is listed as behind the base. **Overlaps and merge order:** Not checked; network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -39,0 +33,4 @@
**From the command line**, the same with `Longshot.exe mod` (add `--profile DIR` to pick the profile):
```text
Longshot.exe mod source add https://git.example.org/mooki/heart-tracker
Member

L2 (should fix): The command example searches immediately after a preview-only source add.

When: A player follows the three commands in order: source add without --yes does not save the source, so search and install cannot find that source's mod.

Do: Show the second source add with --yes after the preview and key check, before search.

**L2** (should fix): The command example searches immediately after a preview-only source add. *When:* A player follows the three commands in order: `source add` without `--yes` does not save the source, so search and install cannot find that source's mod. **Do:** Show the second `source add` with `--yes` after the preview and key check, before search.
@ -39,0 +45,4 @@
`source add <url> --accept-key KEY --yes` again.
- `install <id>` (the id `search` shows, from the mod's `mod.toml`) brings the newest version, with any other mods
it needs, checks its files against what the source listed, and switches it on. `--version V` installs another version.
- `update` brings every installed mod's newest version (`update <id>`: one mod's). `pin <id> <version>` keeps a mod
Member

L3 (should fix): The description of pinning omits that the command can change the installed version.

When: A player on version 2 runs pin <id> 1 expecting the mod to stay where it is; the pin operation installs version 1 before pinning it.

Do: Say that pin installs the specified version if necessary and then keeps it pinned.

**L3** (should fix): The description of pinning omits that the command can change the installed version. *When:* A player on version 2 runs `pin <id> 1` expecting the mod to stay where it is; the pin operation installs version 1 before pinning it. **Do:** Say that pin installs the specified version if necessary and then keeps it pinned.
docs(mods): the players' source example adds with --yes before searching; pin can install
All checks were successful
PR description / Title and description (pull_request_target) Successful in 7s
a0b07a96f1
source add without --yes only previews, so the example showed a search that
could not find the mod. pin <id> <version> installs that version when the
mod is on another one (service.rs pin), which the page did not say.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean changed title from docs(modding): players' mods page covers sources and installs; init's README says how to share to feat(modtool): mod init --test writes a starter test; players' mods page covers sources 2026-11-30 17:38:04 +00:00
Author
Owner

Thanks. L2 and L3 fixed in a0b07a96: the example now adds the source with --yes before searching, and pin says it installs the version when the mod is on another one (service.rs pin). L1: agreed, the title should be a feat(modtool) one since mod init --test is new; retitled. Measurements now says why there is nothing to measure.

Thanks. L2 and L3 fixed in a0b07a96: the example now adds the source with `--yes` before searching, and `pin` says it installs the version when the mod is on another one (service.rs `pin`). L1: agreed, the title should be a `feat(modtool)` one since `mod init --test` is new; retitled. Measurements now says why there is nothing to measure.
HumanBean merged commit e59af44f6b into mod-api 2026-11-30 19:24:23 +00:00
HumanBean deleted branch docs/mods-sources-leftovers 2026-11-30 19:24:24 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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
MagicBeanDev/Longshot!2868
No description provided.