Skip to content

✨ Add --strict-version flag to mod sync#84

Merged
sakuro merged 6 commits into
mainfrom
feature/add-strict-version-flag-to-mod-sync
Apr 21, 2026
Merged

✨ Add --strict-version flag to mod sync#84
sakuro merged 6 commits into
mainfrom
feature/add-strict-version-flag-to-mod-sync

Conversation

@sakuro
Copy link
Copy Markdown
Owner

@sakuro sakuro commented Apr 21, 2026

Summary

Add --strict-version flag to mod sync that installs the exact MOD versions recorded in the save file, rather than the latest available versions.

Changes

  • Add --strict-version option to mod sync
  • Without --strict-version: installs missing MODs at latest version, does not record version in mod-list.json
  • With --strict-version: installs exact save versions, records version in mod-list.json, deletes newer installed versions
  • Update completion scripts (zsh, bash, fish) and documentation

Background

Factorio picks the newest available zip when multiple versions coexist in the MOD directory. So when --strict-version downgrades a MOD, the newer zip must be deleted. The deletion is shown in the pre-sync confirmation plan before any destructive operations.

Closes #75

sakuro added 4 commits April 21, 2026 14:40
Install exact MOD versions from the save file instead of the latest.
Deletes newer installed versions since Factorio picks the newest zip when
multiple versions coexist.
The portal API response body contains "Mod not found" without the MOD name.
By prioritizing api_message, the MOD name was lost from the error shown to users.
When replacing an existing MOD (e.g. with --strict-version), display
the transition as "mod-name (old → new)" instead of "mod-name@new".
…rded

plan_existing_mod_changes compared nil (from mod-list.json) against the save
version, always producing an :update action even when the correct version was
already installed.

When mod-list.json has no version recorded for a MOD, fall back to the
actually installed version for the comparison. This avoids treating
already-correct installations as needing an update.
@sakuro sakuro force-pushed the feature/add-strict-version-flag-to-mod-sync branch from f8656c9 to e29de92 Compare April 21, 2026 11:39
sakuro added 2 commits April 21, 2026 21:08
RequiresGameStopped is prepended after CommandWrapper, so it sits outer
in the call chain. When the game is running, the exception is raised
before super is called, meaning CommandWrapper's rescue block is never
entered and no error message is displayed.

Display the error via say before raising so the user sees it regardless
of the call chain order.
When --strict-version removes a newer zip and downloads the save version,
the same MOD appeared in Delete, Install, and Update — three redundant
lines. Detect mods present in both mods_to_delete and install_targets,
show them once under Downgrade, and omit them from the individual sections.
@sakuro sakuro merged commit eae1b56 into main Apr 21, 2026
4 checks passed
@sakuro sakuro deleted the feature/add-strict-version-flag-to-mod-sync branch April 21, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ Add --strict-version flag to mod sync

1 participant