M4.2: Changes tool window with staging and commit

A Changes tab in the bottom panel (ui/src/components/vcs/changes/): the
project's changed files from git.status in Staged, Changes and Untracked
groups, re-read on start, project open, gitChanged and vcs.refresh
(serialised). A checkbox per file and per group stages or unstages through
git.stage / git.unstage (a staged rename passes both paths); Space stages,
Enter or a double-click runs vcs.showDiff when provided, else opens the
file. A message box with Amend and Commit (also Mod+Enter) runs flushDirty()
first, cancels when a save fails, then git.commit and toasts the short hash.
All git calls go through runWaiting.

UI commands vcs.openChanges (Mod+Alt+G), vcs.commit (Mod+K, focuses the
message box) and vcs.refresh in a new Git menu group; gitChanged added to
EngineEventPayload. 19 Vitest tests; palette, menu and catalog tests follow
the new commands. Docs: architecture, gaps G8, Git parity row 4% (est.),
ui/tooling checklists, roadmap M4 row, ROADMAP depth ~5.4% and log, README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-25 17:17:39 +01:00
parent 8701f50d37
commit f67f6b9f7c
18 changed files with 1792 additions and 23 deletions

View file

@ -26,7 +26,10 @@
* results, the Terminal store the running terminals and the Problems store
* the diagnostics while they are hidden. The References tab (M3.5) shows
* when Find References runs (`lsp.references`); the nav store keeps its
* results.
* results. The Changes tab (M4.2) appears with `vcs.openChanges`
* (`Mod+Alt+G`) and `vcs.commit` (`Mod+K`, which also focuses the commit
* message box); `vcs.refresh` re-reads the Git status. Its store reads the
* status from the start, so it is current when the tab opens.
*
* A slim header bar along the top (M3.9) holds the app menu
* ({@link AppMenu}); its `header` slot can replace it.
@ -43,6 +46,8 @@ import ProblemsToolWindow from "../problems/ProblemsToolWindow.vue";
import { useProblemsStore } from "../problems/problems";
import ReferencesToolWindow from "../editor/nav/ReferencesToolWindow.vue";
import { useNavStore } from "../editor/nav/nav";
import ChangesToolWindow from "../vcs/changes/ChangesToolWindow.vue";
import { useChangesStore } from "../vcs/changes/changes";
import ProjectToolWindow from "../project/ProjectToolWindow.vue";
import StatusBar from "../StatusBar.vue";
import StructureToolWindow from "../structure/StructureToolWindow.vue";
@ -89,9 +94,10 @@ const find = useFindStore();
const terminal = useTerminalStore();
const problems = useProblemsStore();
const nav = useNavStore();
const changes = useChangesStore();
/** Tool windows of the bottom panel. */
type BottomTool = "find" | "terminal" | "problems" | "references";
type BottomTool = "find" | "terminal" | "problems" | "references" | "changes";
/** The bottom tool window last chosen. */
const bottomTool = ref<BottomTool>("find");
/** Bottom tool windows that are shown, in tab order. */
@ -101,6 +107,7 @@ const bottomTools = computed(() => {
if (terminal.visible) tools.push({ id: "terminal", title: t("terminal.toolWindow.title") });
if (problems.visible) tools.push({ id: "problems", title: t("problems.toolWindow.title") });
if (nav.visible) tools.push({ id: "references", title: t("nav.references.title") });
if (changes.visible) tools.push({ id: "changes", title: t("vcs.changes.toolWindow.title") });
return tools;
});
/** The active bottom tool window: the chosen one if shown, else the first. */
@ -116,7 +123,9 @@ const bottomStore = computed(() =>
? problems
: bottomActive.value === "references"
? nav
: find,
: bottomActive.value === "changes"
? changes
: find,
);
/** Expansion of the panel, kept per tool window by its store. */
const bottomOpen = computed({
@ -132,7 +141,7 @@ const bottomOpen = computed({
* @param id - the tool window id from the panel.
*/
function chooseBottom(id: string): void {
if (id === "find" || id === "terminal" || id === "problems" || id === "references") {
if (id === "find" || id === "terminal" || id === "problems" || id === "references" || id === "changes") {
bottomTool.value = id;
}
}
@ -149,6 +158,7 @@ onMounted(() => {
find.start();
terminal.start();
problems.start();
changes.start();
withdraw = [
commands.provide("view.toggleProjectTree", {
run: () => {
@ -174,6 +184,22 @@ onMounted(() => {
problems.open();
},
}),
commands.provide("vcs.openChanges", {
run: () => {
bottomTool.value = "changes";
changes.open();
},
}),
commands.provide("vcs.commit", {
run: () => {
bottomTool.value = "changes";
changes.focusMessage();
},
}),
commands.provide("vcs.refresh", {
run: () => changes.refresh(),
enabled: () => commands.isEnabled("git.status"),
}),
commands.provide("view.toggleStructure", {
run: () => {
toggleLeft("structure");
@ -190,6 +216,7 @@ onBeforeUnmount(() => {
find.stop();
terminal.stop();
problems.stop();
changes.stop();
});
</script>
@ -263,6 +290,7 @@ onBeforeUnmount(() => {
/>
<ProblemsToolWindow v-show="bottomActive === 'problems'" />
<ReferencesToolWindow v-show="bottomActive === 'references'" />
<ChangesToolWindow v-show="bottomActive === 'changes'" />
</BottomPanel>
<StatusBar />
</div>