-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(dotfiles): file history with tracking, checkpoints, and a browser #12849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
4b48c68
refactor(git): add plumbing helpers for detached snapshots
jdx fe08886
feat(bootstrap): record generations
jdx 8e37a0b
fix(bootstrap): address review feedback on generation recording
jdx cb1041a
fix(bootstrap): record a --from generation only when the checkout cha…
jdx 4b09508
fix(bootstrap): identify --from generations by their checkout in the …
jdx bd6bd70
feat(bootstrap): diff generations
jdx db934e3
fix(bootstrap): address review feedback on generations diff
jdx 708c2cf
fix(bootstrap): diff a root present in one snapshot only
jdx 4979bc3
feat(bootstrap): journal dotfiles and edits
jdx 8609390
fix(bootstrap): address review feedback on the dotfiles journal
jdx 18bd62d
feat(dotfiles): track files in place with history
jdx da3681f
fix(dotfiles): address review feedback on tracking
jdx cdcf5b4
test(history): silence shellcheck on tracked-file assertions
jdx 6fae916
fix(dotfiles): reject add --mode track and keep every variant os
jdx 37dcec1
refactor(dotfiles): move history under bootstrap dotfiles, records ho…
jdx c696df3
fix(dotfiles): address review feedback on tracking and history
jdx 8071389
fix(dotfiles): exclusions, saved deletions, subtree promotion, and pr…
jdx e120f23
fix(dotfiles): find git.exe on Windows, address the tracked symlink a…
jdx e875321
docs: take the agent guide from main
jdx 3293117
fix(dotfiles): layer overrides keep what they leave unsaid, exclusion…
jdx f3ea8fb
fix(dotfiles): repeated exclusion globs keep their place in the order
jdx b0eb3ca
docs(dotfiles): source links point at the dotfiles command modules
jdx dcc98c3
docs(dotfiles): history subcommand source links point at their own mo…
jdx 6060528
fix(dotfiles): carried modes come from a non-protective checkpoint, a…
jdx f6e9dff
fix(dotfiles): carried modes are looked for past checkpoints that did…
jdx 9d6f8dd
fix(dotfiles): take carried modes only from checkpoints that recorded…
jdx a86488b
fix(dotfiles): record permission-only changes and keep saved sibling …
jdx e3eec1c
fix(dotfiles): pending operations are listed, keys use forward slashe…
jdx 1f3c046
fix(dotfiles): an exclusion always wins, untrack refuses to drop a re…
jdx 4d3200b
fix(dotfiles): a permission-only change is listed among a checkpoint'…
jdx 73261e0
fix(dotfiles): an excluded part of a referenced source is reported, a…
jdx cd471b3
fix(dotfiles): preserve baselines and discard rejected no-op runs
jdx 5b8677e
fix(bootstrap): allow tracking around managed file footprints
jdx 8c11025
fix(bootstrap): protect tracked children from managed directory writes
jdx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| <!-- @generated by usage-cli from usage spec --> | ||
| # `mise bootstrap dotfiles history` | ||
|
|
||
| - **Usage:** `mise bootstrap dotfiles history [FLAGS] [SUBCOMMAND]` | ||
| - **Effect:** read-only | ||
| - **Source code:** [`src/cli/dotfiles/history/mod.rs`](https://github.com/jdx/mise/blob/main/src/cli/dotfiles/history/mod.rs) | ||
|
|
||
| Browse the checkpoints of your dotfiles | ||
|
|
||
| Every save, every mutating bootstrap command, and the watcher record a | ||
| checkpoint of the tracked files: the global mise config directory, the | ||
| dotfiles root, and every `[dotfiles]` entry. A checkpoint holds files, | ||
| never package or service state: restoring one restores files. Without a | ||
| subcommand this lists them, newest first. | ||
|
|
||
| ## Flags | ||
| - **`-J --json`** — Output in JSON format | ||
| - **`-n --limit <LIMIT>`** — Show at most this many checkpoints (0 for all) | ||
|
|
||
| **Default:** `20` | ||
| - **`--path <PATH>`** — Only checkpoints where this path (or something under it) changed | ||
| - **`--trigger <TRIGGER>`** — Only checkpoints with this trigger (edit, save, bootstrap, …) | ||
| - **`--pending`** — Only checkpoints recorded by operations that did not finish | ||
| - **`-h --help`** — Print help | ||
|
|
||
| ## Subcommands | ||
|
|
||
| - [`mise bootstrap dotfiles history describe <REF> <TEXT>`](/cli/bootstrap/dotfiles/history/describe.md) | ||
| - [`mise bootstrap dotfiles history diff [FLAGS] [A] [B]`](/cli/bootstrap/dotfiles/history/diff.md) | ||
| - [`mise bootstrap dotfiles history ls [FLAGS]`](/cli/bootstrap/dotfiles/history/ls.md) | ||
| - [`mise bootstrap dotfiles history show [FLAGS] [REF]`](/cli/bootstrap/dotfiles/history/show.md) | ||
|
|
||
| Examples: | ||
|
|
||
| ``` | ||
| mise bootstrap dotfiles history | ||
| mise bootstrap dotfiles history --path ~/.config/hypr/bindings.lua | ||
| mise bootstrap dotfiles history show latest | ||
| mise bootstrap dotfiles history diff # the working tree against the latest checkpoint | ||
| mise bootstrap dotfiles history diff 11 12 --patch | ||
| mise bootstrap dotfiles save --description "before the theme change" | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <!-- @generated by usage-cli from usage spec --> | ||
| # `mise bootstrap dotfiles history describe` | ||
|
|
||
| - **Usage:** `mise bootstrap dotfiles history describe <REF> <TEXT>` | ||
| - **Effect:** modifies state | ||
| - **Source code:** [`src/cli/dotfiles/history/describe.rs`](https://github.com/jdx/mise/blob/main/src/cli/dotfiles/history/describe.rs) | ||
|
|
||
| Set the description of a checkpoint | ||
|
|
||
| ## Arguments | ||
| - **`<REF>`** — Checkpoint id, `latest`, `latest~N`, or a uuid prefix | ||
| - **`<TEXT>`** — The new description | ||
|
|
||
| ## Flags | ||
| - **`-h --help`** — Print help |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <!-- @generated by usage-cli from usage spec --> | ||
| # `mise bootstrap dotfiles history diff` | ||
|
|
||
| - **Usage:** `mise bootstrap dotfiles history diff [FLAGS] [A] [B]` | ||
| - **Effect:** read-only | ||
| - **Source code:** [`src/cli/dotfiles/history/diff.rs`](https://github.com/jdx/mise/blob/main/src/cli/dotfiles/history/diff.rs) | ||
|
|
||
| Compare checkpoints, or the working tree against one | ||
|
|
||
| Without arguments, shows what changed by hand since the latest | ||
| checkpoint. With one reference, shows what that checkpoint changed | ||
| against the one before it. With two, compares the two states. | ||
|
|
||
| ## Arguments | ||
| - **`[A]`** — Checkpoint id, `latest`, `latest~N`, or a uuid prefix | ||
| - **`[B]`** — Compare `A` with this checkpoint instead of its predecessor | ||
|
|
||
| ## Flags | ||
| - **`-p --patch`** — Print the full patch instead of a per-file summary | ||
| - **`--path <PATH>`** — Restrict to one path (a file or a directory) | ||
| - **`--exit-code`** — Exit 1 when the two sides differ | ||
| - **`-h --help`** — Print help |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <!-- @generated by usage-cli from usage spec --> | ||
| # `mise bootstrap dotfiles history ls` | ||
|
|
||
| - **Usage:** `mise bootstrap dotfiles history ls [FLAGS]` | ||
| - **Aliases:** `list` | ||
| - **Effect:** read-only | ||
| - **Source code:** [`src/cli/dotfiles/history/ls.rs`](https://github.com/jdx/mise/blob/main/src/cli/dotfiles/history/ls.rs) | ||
|
|
||
| List checkpoints, newest first | ||
|
|
||
| ## Flags | ||
| - **`-J --json`** — Output in JSON format | ||
| - **`-n --limit <LIMIT>`** — Show at most this many checkpoints (0 for all) | ||
|
|
||
| **Default:** `20` | ||
| - **`--path <PATH>`** — Only checkpoints where this path (or something under it) changed | ||
| - **`--trigger <TRIGGER>`** — Only checkpoints with this trigger (edit, save, bootstrap, …) | ||
| - **`--pending`** — Only checkpoints recorded by operations that did not finish | ||
| - **`-h --help`** — Print help |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <!-- @generated by usage-cli from usage spec --> | ||
| # `mise bootstrap dotfiles history show` | ||
|
|
||
| - **Usage:** `mise bootstrap dotfiles history show [FLAGS] [REF]` | ||
| - **Effect:** read-only | ||
| - **Source code:** [`src/cli/dotfiles/history/show.rs`](https://github.com/jdx/mise/blob/main/src/cli/dotfiles/history/show.rs) | ||
|
|
||
| Show one checkpoint: what triggered it, what changed, and its journal | ||
|
|
||
| ## Arguments | ||
| - **`[REF]`** — Checkpoint id, `latest` (the default), `latest~N`, or a uuid prefix | ||
|
|
||
| ## Flags | ||
| - **`-J --json`** — Output in JSON format | ||
| - **`--files`** — List every file in the snapshot | ||
| - **`--path <PATH>`** — Resolve `latest~N` among the checkpoints where this path changed | ||
| - **`-h --help`** — Print help |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <!-- @generated by usage-cli from usage spec --> | ||
| # `mise bootstrap dotfiles paths` | ||
|
|
||
| - **Usage:** `mise bootstrap dotfiles paths [-J --json] [--preview <PATH>]` | ||
| - **Effect:** read-only | ||
| - **Source code:** [`src/cli/dotfiles/paths.rs`](https://github.com/jdx/mise/blob/main/src/cli/dotfiles/paths.rs) | ||
|
|
||
| Show what history tracks and under which policies | ||
|
|
||
| Every entry is listed with the file that declared it, its policies, and | ||
| how many files it currently covers. Declarations that history could not | ||
| honour are listed as invalid, omitted, or incomplete, so a failed | ||
| enrollment is never mistaken for protection. | ||
|
|
||
| ## Flags | ||
| - **`-J --json`** — Output in JSON format | ||
| - **`--preview <PATH>`** — Show what tracking this path would capture | ||
| - **`-h --help`** — Print help |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <!-- @generated by usage-cli from usage spec --> | ||
| # `mise bootstrap dotfiles save` | ||
|
|
||
| - **Usage:** `mise bootstrap dotfiles save [FLAGS] [PATH]…` | ||
| - **Effect:** modifies state | ||
| - **Source code:** [`src/cli/dotfiles/save.rs`](https://github.com/jdx/mise/blob/main/src/cli/dotfiles/save.rs) | ||
|
|
||
| Save a checkpoint of the tracked files now | ||
|
|
||
| Fails when history cannot save or a requested path is not tracked, so a | ||
| script or an agent gets a trustworthy result; a save that finds nothing | ||
| changed succeeds as a no-op. `--best-effort` turns save errors into a | ||
| warning for `set -e` update scripts. | ||
|
|
||
| ## Arguments | ||
| - **`[PATH]…`** — Paths to save; every one must be tracked | ||
|
|
||
| ## Flags | ||
| - **`-d --description <TEXT>`** — A description for the checkpoint | ||
| - **`--trigger <TRIGGER>`** — What is saving: save (the default), agent, or update | ||
|
|
||
| **Default:** `save` | ||
| - **`--task <ID>`** — The task an agent is working on | ||
| - **`--label <LABEL>`** — A label to find the checkpoint by later | ||
| - **`--best-effort`** — Warn instead of failing when history cannot save | ||
| - **`-h --help`** — Print help |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <!-- @generated by usage-cli from usage spec --> | ||
| # `mise bootstrap dotfiles track` | ||
|
|
||
| - **Usage:** `mise bootstrap dotfiles track [FLAGS] <PATH>…` | ||
| - **Effect:** modifies state | ||
| - **Source code:** [`src/cli/dotfiles/track.rs`](https://github.com/jdx/mise/blob/main/src/cli/dotfiles/track.rs) | ||
|
|
||
| Track a file or directory where it is | ||
|
|
||
| Adds a `[dotfiles]` entry with `mode = "track"`: the file stays where it | ||
| is, nothing is copied or linked, and history saves a checkpoint of it | ||
| right away. With the history watcher service running, later edits are | ||
| saved automatically; without it, `mise bootstrap dotfiles save` saves them. | ||
|
|
||
| `--os` and `--profile` declare a variant: a separate shared stream for | ||
| machines matching that platform or mise environment, so a Mac and a | ||
| Linux box can share the same live path with different contents. | ||
|
|
||
| ## Arguments | ||
| - **`<PATH>…`** — Paths to track (absolute or starting with ~/) | ||
|
|
||
| ## Flags | ||
| - **`--os <OS>`** — Declare a variant for this platform (macos, linux, linux/arm64, …) | ||
| - **`--profile <PROFILE>`** — Declare a variant for this mise environment | ||
| - **`--no-autosave`** — Save only on `mise bootstrap dotfiles save <path>`, never automatically | ||
| - **`--no-share`** — Keep the file out of the shared setup (still backed up) | ||
| - **`--no-backup`** — Keep the file out of remote backups (still protected locally) | ||
| - **`--local`** — Write to config.local.toml (this machine only) instead of config.toml | ||
| - **`-y --yes`** — Accept without prompting | ||
| - **`-h --help`** — Print help | ||
|
|
||
| Examples: | ||
|
|
||
| ``` | ||
| mise bootstrap dotfiles track ~/.zshrc ~/.config/hypr | ||
| mise bootstrap dotfiles track ~/.zshrc --os macos | ||
| mise bootstrap dotfiles track ~/.config/app/state.json --no-autosave | ||
| mise bootstrap dotfiles track ~/.ssh/config --no-share | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <!-- @generated by usage-cli from usage spec --> | ||
| # `mise bootstrap dotfiles untrack` | ||
|
|
||
| - **Usage:** `mise bootstrap dotfiles untrack <PATH>…` | ||
| - **Effect:** modifies state | ||
| - **Source code:** [`src/cli/dotfiles/untrack.rs`](https://github.com/jdx/mise/blob/main/src/cli/dotfiles/untrack.rs) | ||
|
|
||
| Stop tracking a file or directory | ||
|
|
||
| Removes the `[dotfiles]` track entry (or switches an inherited one off in | ||
| config.local.toml) and stops future captures. The file itself and its | ||
| existing checkpoints are left exactly as they are. | ||
|
|
||
| ## Arguments | ||
| - **`<PATH>…`** — Paths to stop tracking | ||
|
|
||
| ## Flags | ||
| - **`-h --help`** — Print help | ||
|
|
||
| Examples: | ||
|
|
||
| ``` | ||
| mise bootstrap dotfiles untrack ~/.zshrc | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.