Skip to content

Split config manifest/state and normalize URLs#257

Open
bresilla wants to merge 2 commits intomarcosnils:masterfrom
bresilla:split-config-state
Open

Split config manifest/state and normalize URLs#257
bresilla wants to merge 2 commits intomarcosnils:masterfrom
bresilla:split-config-state

Conversation

@bresilla
Copy link

@bresilla bresilla commented Dec 1, 2025

I use this tool across multiple machines and keep my dotfiles under version control. The problem is that every time I update on one machine and push the dotfiles, the other machines think they already have the latest versions. This happens because the manifest mixes two things that should be separate: the repository list (portable) and the per-machine state (mutable versions).

This PR cleanly separates them. The manifest now contains only the repository names, while the per-machine version state is stored in a separate location. On Linux this follows the XDG spec in ~/.local/share/, and on Windows and macOS it follows their respective standard app-data paths. With this split, one can push git changes to without every update mutating the manifest.

Summary

  • Separate per-machine mutable binary state into its own state file while keeping the manifest minimal and portable.
  • Normalize manifest repository URLs to canonical base URLs (e.g., https://github.com/owner/repo) while keeping version-specific release URLs in the state file only.
  • Introduce migration logic in CheckAndLoad to automatically split legacy manifests and normalize existing URLs on the first run.

marcosnils and others added 2 commits December 1, 2025 16:37
- Introduce `stateEntry` and `state` structs to manage per-machine mutable data.
- Refactor config loading to separate manifest and state.
- Implement a migration logic to split existing config into manifest and state files.
- Update `write` function to `writeAll` and introduce `writeManifest` and `writeState` functions for separate persistence.
- Refine `getConfigPath` logic.
- Add `getStatePath` to determine the location for the state file based on OS and environment variables.
- Add `StateURL` field to `Binary` struct to persist original URLs.
- Introduce URL normalization for manifest entries, converting release-specific URLs to base repository links.
- Update `install` and `update` commands to utilize the new `StateURL` field.
@Amolith
Copy link
Contributor

Amolith commented Dec 4, 2025

Ooh I've been having this same annoyance and just pull bin changes from one pretty-much-always-on machine, overwriting local bin changes. Looking forward to this in a release once it's ready ❤️

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.

3 participants