From e80a8e1d128d31401b21d2dd9dbadb725066335a Mon Sep 17 00:00:00 2001 From: Jordan Harrison Date: Tue, 30 Jun 2026 09:33:35 +0100 Subject: [PATCH 1/5] feat: add git panel source control workflows --- README.md | 8 +- .../components/mockups/workbench-mockup.tsx | 162 ++- apps/web/components/sections/cta.tsx | 2 +- apps/web/components/sections/features.tsx | 8 +- apps/web/components/sections/how-it-works.tsx | 7 +- apps/web/lib/site.ts | 2 +- docs/developer/AGENT_RUNTIME.md | 2 +- docs/developer/ARCHITECTURE.md | 8 +- docs/developer/TOOL_PROTOCOL.md | 44 +- docs/user/CLI.md | 10 +- docs/user/INTRODUCTION.md | 5 +- docs/user/SPACES.md | 6 +- docs/user/TOOLS.md | 6 +- docs/user/USING_MEITH.md | 19 +- docs/user/WORKING_WITH_AGENTS.md | 12 +- packages/cli/src/commands.ts | 72 +- packages/desktop/src/bridge.ts | 4 + .../desktop/src/main/__tests__/agent.test.ts | 14 +- .../src/main/__tests__/gitTools.test.ts | 183 ++- .../desktop/src/main/__tests__/spaces.test.ts | 12 +- .../src/main/__tests__/storage.test.ts | 10 +- .../desktop/src/main/agent/systemPrompt.ts | 6 +- packages/desktop/src/main/agent/types.ts | 4 +- .../desktop/src/main/services/AgentService.ts | 45 +- .../src/main/services/BrowserTabService.ts | 19 +- .../desktop/src/main/storage/migrations.ts | 6 +- packages/desktop/src/main/tools/fileTools.ts | 2 +- packages/desktop/src/main/tools/gitTools.ts | 1051 ++++++++++++++++- .../desktop/src/main/tools/settingsTools.ts | 12 +- packages/desktop/src/main/tools/spaceTools.ts | 12 +- packages/desktop/src/renderer/src/App.tsx | 37 +- packages/desktop/src/renderer/src/bridge.ts | 125 +- .../components/{DiffView.tsx => GitPanel.tsx} | 531 ++++++++- .../src/components/OverlayDropdown.tsx | 93 +- .../renderer/src/components/SettingsView.tsx | 332 +++++- .../src/components/TopBarBranchSwitcher.tsx | 286 +++++ ...TopBarGitDiff.tsx => TopBarGitChanges.tsx} | 31 +- .../hooks/{useGitDiff.ts => useGitChanges.ts} | 18 +- .../desktop/src/renderer/src/lib/workspace.ts | 6 +- .../src/renderer/src/overlay/OverlayApp.tsx | 53 +- .../desktop/src/renderer/src/overlay/icons.ts | 2 +- packages/shared/src/schemas.ts | 47 +- 42 files changed, 2957 insertions(+), 357 deletions(-) rename packages/desktop/src/renderer/src/components/{DiffView.tsx => GitPanel.tsx} (54%) create mode 100644 packages/desktop/src/renderer/src/components/TopBarBranchSwitcher.tsx rename packages/desktop/src/renderer/src/components/{TopBarGitDiff.tsx => TopBarGitChanges.tsx} (71%) rename packages/desktop/src/renderer/src/hooks/{useGitDiff.ts => useGitChanges.ts} (89%) diff --git a/README.md b/README.md index b02c381..e9f1194 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ Meith is a desktop AI workbench for building web apps. -It puts the pieces of web app work in one desktop window: project folders, code files, terminals, run commands, dev-server logs, a built-in browser, plugins, and agent chats. A shared tool system connects them. The visual app, CLI, plugins, and agents all work against the same project state, so an agent can edit code, start your dev server, open the app in the browser, click through the UI, read console output, and show you the diff. +It puts the pieces of web app work in one desktop window: project folders, code files, terminals, run commands, dev-server logs, a built-in browser, plugins, and agent chats. A shared tool system connects them. The visual app, CLI, plugins, and agents all work against the same project state, so an agent can edit code, start your dev server, open the app in the browser, click through the UI, read console output, and surface Git changes. -Codex and Claude Code can write code. Meith gives them a place to work: the browser, terminal, logs, files, diffs, and permissions all sit in the same workbench the agent can use. +Codex and Claude Code can write code. Meith gives them a place to work: the browser, terminal, logs, files, Git changes, and permissions all sit in the same workbench the agent can use. Meith doesn't lock you into one AI provider. The agent runtime uses an adapter interface and connects to external agents via ACP (Agent Client Protocol), keeping the desktop app independent of any specific model vendor or SDK. @@ -20,7 +20,7 @@ The name comes from the Irish *meitheal*: a group of people coming together to w * Watch browser state and dev-server logs in the same window. * Split panes to arrange your browser, editor, terminal, or agent side by side. * Ask an agent to build features in the context of your current project: editing files, running the dev server, and checking the app in the browser. -* Review working-tree changes in the built-in Diff tab, with summary counts in the top bar and patches loaded only when you select a file. +* Review and manage working-tree changes in the built-in Git panel, with a top-bar branch switcher, staged and unstaged sections, inline diffs, commit identity switching, commits, and guarded restore actions. * Install web-app plugins and explicitly approve the APIs they can use. * Use the `meith` terminal command to inspect and control a running app instance. @@ -146,7 +146,7 @@ pnpm cli call app_health The CLI covers the registered desktop tool catalog: browser tabs and automation, spaces/workspace tabs, projects/templates, workspace files, -git diff, terminals/dev servers, settings, storage, plugins, and runtime +git status/diff, terminals/dev servers, settings, storage, plugins, and runtime diagnostics. `pnpm cli call ` is the fallback for scripts and tools without a named CLI command yet. diff --git a/apps/web/components/mockups/workbench-mockup.tsx b/apps/web/components/mockups/workbench-mockup.tsx index 4132fa6..0c93071 100644 --- a/apps/web/components/mockups/workbench-mockup.tsx +++ b/apps/web/components/mockups/workbench-mockup.tsx @@ -10,6 +10,7 @@ import { FilePlus, Folder, FolderOpen, + GitBranch, GitCompare, Hand, Paperclip, @@ -38,7 +39,13 @@ const workspaceToggles = [ const agentSessions = [ { title: "Pricing Section", active: true, status: "running", updated: "just now" }, - { title: "Hero Polish", active: false, status: "idle", updated: "12 min ago", unread: true }, + { + title: "Hero Polish", + active: false, + status: "idle", + updated: "12 min ago", + unread: true, + }, { title: "Nav Cleanup", active: false, status: "idle", updated: "31 min ago" }, ]; @@ -91,6 +98,11 @@ export function WorkbenchMockup({ className }: { className?: string }) { ))}
+
+ + main + +
@@ -173,7 +185,9 @@ export function WorkbenchMockup({ className }: { className?: string }) {
- 8 conversations + + 8 conversations +
{agentSessions.map((session) => ( @@ -235,69 +249,73 @@ export function WorkbenchMockup({ className }: { className?: string }) {
-
-
-
- Agent - streaming -
-
-
-
- Thoughts - - · Checking the existing layout and section spacing - - -
-
-
- Thoughts - - 2 updates +
+
+
+ Agent + streaming +
+
+
+
+ + Thoughts + + + · Checking the existing layout and section spacing - +
-
-
- +
+
- Ran 3 commands + Thoughts + + + 2 updates - + +
+
+
+ + + Ran 3 commands + + +
-
-
-
- - Permission required -
-

- The agent wants to run{" "} - project_run to - start a process. -

- -
- - Allow - - - Deny - +
+
+ + Permission required +
+

+ The agent wants to run{" "} + project_run{" "} + to start a process. +

+
+ + Remember for this tool in this session +
+
+ + Allow + + + Deny + +
-
@@ -333,7 +351,7 @@ export function WorkbenchMockup({ className }: { className?: string }) {
- Diff + Git
@@ -343,7 +361,9 @@ export function WorkbenchMockup({ className }: { className?: string }) { +107 - -12 + + -12 +
@@ -393,33 +413,51 @@ export function WorkbenchMockup({ className }: { className?: string }) { @@ -12,3 +12,4 @@
- 12 - 12 + + 12 + + + 12 + {""}
- 13 + + 13 + - {"-"} + + {"-"} +
- 13 + + 13 + {"+"}
- 14 + + 14 + {"+"}
- 14 - 15 - {""} + + 14 + + + 15 + + + {""} +
diff --git a/apps/web/components/sections/cta.tsx b/apps/web/components/sections/cta.tsx index 6a5db0a..96b1e5c 100644 --- a/apps/web/components/sections/cta.tsx +++ b/apps/web/components/sections/cta.tsx @@ -19,7 +19,7 @@ export function Cta() {

Free and open source. Use meith to give your agent the editor, terminal, - browser, logs, and diffs it needs to build and check the app. + browser, logs, and Git panel it needs to build and check the app.

- AI agents can write code. meith gives them the rest of the loop: - files, terminal, a browser they can control, logs, diffs, and permissions in + AI agents can write code. meith gives them the rest of the loop: files, + terminal, a browser they can control, logs, Git changes, and permissions in one desktop app.

diff --git a/apps/web/components/sections/how-it-works.tsx b/apps/web/components/sections/how-it-works.tsx index cf1786f..0fd42b2 100644 --- a/apps/web/components/sections/how-it-works.tsx +++ b/apps/web/components/sections/how-it-works.tsx @@ -65,7 +65,12 @@ export function HowItWorks() {
- {["app state", "files and diffs", "browser control", "permissions & audit"].map((label) => ( + {[ + "app state", + "files and Git", + "browser control", + "permissions & audit", + ].map((label) => (
.json` records live runtime instances so the CLI can list, target, or kill them. - `/state.json` stores spaces, projects, browser tabs, workspace tabs - (including editor file focus and diff-tab selected file), file edit events, + (including editor file focus and git-tab selected file), file edit events, plugins, and app settings. - `/logs.jsonl` stores app logs. - `/audit.jsonl` stores tool authorization/audit records. @@ -177,9 +177,9 @@ Major surfaces: - `TerminalView` for PTY sessions. - `AgentView` for session list, transcript, composer, stop button, and permission cards. -- `DiffView` for a working-tree diff tab with a folder tree, refreshed summary - counts, persisted selected-file state, and lazy patch loading for the selected - file. +- `GitPanel` for the Git tab with staged/unstaged trees, commit + controls, guarded restore actions, refreshed summary counts, persisted + selected-file state, and lazy patch loading for the selected file. - `SettingsView` for app preferences, per-project run commands, agent config, plugin management, and about info. - `DebugPanel` for tool runner, state, logs, and output diagnostics. diff --git a/docs/developer/TOOL_PROTOCOL.md b/docs/developer/TOOL_PROTOCOL.md index b55d848..f4ca204 100644 --- a/docs/developer/TOOL_PROTOCOL.md +++ b/docs/developer/TOOL_PROTOCOL.md @@ -238,33 +238,61 @@ The current agent approval gate prompts for `writes-files`, `controls-browser`, declared capability model and audit trail, and plugins still need approved capabilities that cover the tools they call. -## Diff Tool Shape +## Git Tool Shape `git_diff` is the built-in read-only working-tree diff tool. It reports staged -and unstaged changes against `HEAD` plus untracked files: +and unstaged changes against `HEAD` plus untracked files. Pass `scope: +"staged"` or `scope: "unstaged"` to fetch a section-specific diff: ```json { "cwd": "/work/project", - "includePatches": false + "includePatches": false, + "scope": "all" } ``` `includePatches: false` returns file status and line-count summaries without -patch bodies. The renderer uses that cheap summary for the top-bar diff chip and -visible diff tab, refreshing while they are shown. The diff tab then requests a +patch bodies. `git_status` returns the corresponding branch, ahead/behind, and +staged/unstaged/untracked sections used by the Git panel. The renderer uses +these cheap summaries for the top-bar Git changes chip and visible Git tab, +refreshing while they are shown. The tab then requests a selected file on demand: ```json { "cwd": "/work/project", "includePatches": true, - "path": "src/app/page.tsx" + "path": "src/app/page.tsx", + "scope": "unstaged" } ``` -This keeps large repositories responsive while preserving the same structured -tool result for the CLI, renderer, plugins, and agents. +Mutating git tools are capability-gated. `git_stage`, `git_unstage`, +`git_commit`, `git_branch`, and `git_worktree` declare `writes-files`. +`git_restore` and `git_checkpoint_restore` declare `destructive` and require a +literal `confirm: true` argument. + +The top-header branch switcher uses `git_branch` with `action: "list"` to show +the current branch, `action: "switch"` to change branches, and `action: +"create"` followed by `switch` when creating a new branch. + +`git_commit` reads the active Git identity profile from app settings. When a +profile is selected, Meith passes that profile as the commit author and +committer for commits created through the tool. When no profile is selected, +Git's repository/global config decides the identity. + +`git_identity_detect` is read-only. It proposes commit identity profiles from +repo/effective Git config, global Git config, and installed provider CLI account +state such as `gh auth status` or `glab auth status`. It does not read credential +helper secrets, tokens, or private key material; the renderer only saves a +suggestion after the user explicitly adds it. + +Checkpoints are hidden git commit objects stored under +`refs/meith/checkpoints/*` with metadata in `.git/meith/checkpoints.json`. +`AgentService` creates a `git_checkpoint_create` snapshot before each agent run +and records the agent `sessionId`; callers can later list, compare, or restore +those checkpoints without moving the current branch ref. ## Caller Identity diff --git a/docs/user/CLI.md b/docs/user/CLI.md index 235c310..4570440 100644 --- a/docs/user/CLI.md +++ b/docs/user/CLI.md @@ -65,7 +65,15 @@ available with `meith --help`; common groups include: `meith create-project