Mindful Stage
Keyboard-driven incremental staging for VS Code. Jump between unstaged hunks and
files, stage one piece at a time, then commit with a clear picture of what's
going in.
The main use case is reviewing LLM output. LLMs in a polyrepo can be efficient
with the additional context, but will often make changes across many repos which
can be difficult to navigate as a regular person. This extension provides
commands to land on the next (or previous) change, read it (argue with the LLM
about how it's done an absolutely terrible job), then fix it, stage it, and then
move on.
It handles nested git repos across multiple workspaces, and stays fast, even
with hundreds of repos.
Pairs well with magit.
Demo
Live status
Mindful stage has an extremely optimized file watcher that respects gitignore
that keeps the extension up-to-date.
Stage hunks
It makes it easier than ever to use git interactive. Staging hunks (and
selections) let you review the files in small pieces.
See unpushed commits
After commiting, lets you see which repos aren't pushed to upstream.
Work across many repos
The super power of Mindful Stage is how it makes it viable to work in large
polyrepos with LLMs and still have any idea what's going on.
Gutter marks and explorer badges
This extension provides gutter marks & file badges/colorization that can be
customized to your preferences.
Turn the gutter and badges on and off with:
{
"mindfulStage.gutterDecorations": true,
"mindfulStage.explorerBadges": true,
}
The colors follow the active theme. Override them with:
"workbench.colorCustomizations": {
"mindfulStage.unstagedChange": "#e5c07b",
"mindfulStage.stagedChange": "#c678dd",
"mindfulStage.unstagedDeletion": "#e06c75",
"mindfulStage.stagedDeletion": "#c678dd",
"mindfulStage.untracked": "#98c379",
"mindfulStage.unstagedTypeChange": "#e5c07b",
"mindfulStage.stagedAddition": "#c678dd",
"mindfulStage.stagedRename": "#c678dd",
"mindfulStage.stagedTypeChange": "#c678dd",
"mindfulStage.conflicted": "#d19a66"
}
This has some overlap with the built-in git functionality, set the following to
disable the parts this extension provides:
"scm.diffDecorations": "none", // built-in gutter marks
"git.decorations.enabled": false, // built-in explorer badges
"git.countBadge": "off", // count on the Source Control icon
"git.enableStatusBarSync": false // Sync item in the status bar
Commands
| Command ID |
What it does |
mindfulStage.nextUnstaged |
Jump to next unstaged file |
mindfulStage.prevUnstaged |
Jump to previous unstaged file |
mindfulStage.nextUnstagedHunk |
Jump to next unstaged hunk |
mindfulStage.prevUnstagedHunk |
Jump to previous unstaged hunk |
mindfulStage.nextUnstagedRepo |
Jump to the next repo with unstaged changes |
mindfulStage.prevUnstagedRepo |
Jump to the previous repo with unstaged changes |
mindfulStage.nextStaged |
Jump to next staged file |
mindfulStage.prevStaged |
Jump to previous staged file |
mindfulStage.nextStagedHunk |
Jump to next staged hunk |
mindfulStage.prevStagedHunk |
Jump to previous staged hunk |
mindfulStage.nextStagedRepo |
Jump to the next repo with staged changes |
mindfulStage.prevStagedRepo |
Jump to the previous repo with staged changes |
mindfulStage.stageHunkAtCursor |
Stage the unstaged hunk under the cursor |
mindfulStage.stageSelection |
Stage only the selected unstaged lines |
mindfulStage.startTracking |
Add an untracked file |
mindfulStage.repeatLast |
Repeat the last navigation |
mindfulStage.pickRepo |
Pick from the repos with outstanding work and jump to one |
Install
Build and install locally with Rust and pnpm:
git clone https://github.com/diminishedprime/mindful-stage.git
cd mindful-stage
pnpm install
pnpm build
pnpm package
code --install-extension mindful-stage-*.vsix
Example keybindings (vim-mode flavored)
These are what I use, paired with vim-mode in settings.json. Convention:
<leader>g is the git namespace, lowercase = hunk, uppercase = file, c
subspace = staged ("cached"), and r within it = repo.
"vim.normalModeKeyBindingsNonRecursive": [
// Unstaged navigation
{ "before": ["<leader>", "g", "n"], "commands": ["mindfulStage.nextUnstagedHunk"] },
{ "before": ["<leader>", "g", "p"], "commands": ["mindfulStage.prevUnstagedHunk"] },
{ "before": ["<leader>", "g", "N"], "commands": ["mindfulStage.nextUnstaged"] },
{ "before": ["<leader>", "g", "P"], "commands": ["mindfulStage.prevUnstaged"] },
// Staged navigation (c = cached)
{ "before": ["<leader>", "g", "c", "n"], "commands": ["mindfulStage.nextStagedHunk"] },
{ "before": ["<leader>", "g", "c", "p"], "commands": ["mindfulStage.prevStagedHunk"] },
{ "before": ["<leader>", "g", "c", "N"], "commands": ["mindfulStage.nextStaged"] },
{ "before": ["<leader>", "g", "c", "P"], "commands": ["mindfulStage.prevStaged"] },
{ "before": ["<leader>", "g", "c", "r"], "commands": ["mindfulStage.nextStagedRepo"] },
{ "before": ["<leader>", "g", "c", "R"], "commands": ["mindfulStage.prevStagedRepo"] },
// Stage hunk at cursor, then advance to the next one (review-flow combo)
{ "before": ["<leader>", "g", "s"], "commands": ["mindfulStage.stageHunkAtCursor", "mindfulStage.nextUnstagedHunk"] },
// Start tracking the file in the active editor
{ "before": ["<leader>", "g", "t"], "commands": ["mindfulStage.startTracking"] },
// Repeat the last navigation (works for any of the jump commands above)
{ "before": ["<leader>", "."], "commands": ["mindfulStage.repeatLast"] }
],
"vim.visualModeKeyBindingsNonRecursive": [
// Stage only the selected lines, then leave visual mode
{ "before": ["<leader>", "g", "s"], "commands": ["mindfulStage.stageSelection", "extension.vim_escape"] }
]
Example global keybinding
If you want a jump that works from anywhere (not just vim normal mode), bind it
in keybindings.json. For example, Ctrl+x u to jump to the next unstaged
file:
[{ "key": "ctrl+x u", "command": "mindfulStage.nextUnstaged" }]
Full demo