Commit graph

4 commits

Author SHA1 Message Date
ethernet
db5cbff884 feat(desktop): detect and surface gone branches for cleanup
Add `gone` branch detection (upstream tracking ref deleted on remote) to
the composer coding rail and the sidebar project tree, plus a bulk archive
action for sessions on gone branches.

Part 1 — composer "gone" indicator:
- Add `_branch_gone()` to `web_git.py` (remote/REST path) and
  `branchGone()` to `git-review-ops.ts` (Electron local path), both using
  `git for-each-ref --format=%(upstream:track)`.
- Add `gone: boolean` to `HermesRepoStatus` type.
- Show amber "gone" badge in `CodingStatusRow` next to the branch name.
- Rides existing repo-status refresh edges (cwd change, workspace change
  tick, busy→idle, window focus) — no new polling.

Part 2a — session DB staleness fix:
- Re-probe `git_branch`/`git_repo_root` at turn-complete (gateway
  `_run_prompt_submit` finally block) and on session resume (both
  deferred and eager paths), using the existing `_persist_session_git_meta`
  daemon-thread helper. Keeps the session DB's branch column fresh so the
  sidebar tree and gone-branch cleanup are accurate.

Part 2b — sidebar gone-branch detection + cleanup UI:
- Add `gone_branches()` to `git_probe.py` (one `for-each-ref` per repo).
- Add `gone_fn` parameter to `project_tree.build_tree()` + `_annotate_gone()`
  helper that marks branch lanes with `gone: True`.
- Wire `_gone_branches_for_repo` into the gateway's `_build_project_tree`.
- Add `gone?: boolean` to `SidebarSessionGroup` (renderer type).
- Show amber "gone" badge on sidebar branch lanes in `WorkspaceHeader`.
- Add bulk "Archive sessions" action to `WorkspaceMenu` for gone lanes:
  confirms, optimistically tombstones, calls `setSessionArchived` per
  session, surfaces success/failure toasts.
- i18n strings for all 4 locales (en, ja, zh, zh-hant).

Tests:
- `test_status_gone_after_remote_branch_deleted` — E2E with bare remote,
  push, delete, fetch --prune, verify gone=true.
- `test_gone_fn_annotates_branch_lanes` — project tree annotation.
- `test_gone_fn_absent_leaves_no_gone_field` — no spurious gone field.
- Updated `sampleStatus` in coding-status.test.ts with `gone: false`.
2026-07-15 17:41:31 -04:00
Brooklyn Nicholson
f9b469d7de test(web_git): assert default branch invariant, not hardcoded main
CI git init defaults to master on some runners; compare branch to
defaultBranch instead of pinning a branch name.
2026-06-28 16:29:52 -05:00
Brooklyn Nicholson
4e9439cc3b fix(desktop): route composer context picking through remote-aware fs
Second pass on the remote-project flow: the project dialog and git cockpit were
remote-aware, but the composer's Add file/folder context picker still called the
native Electron picker directly. Route it through selectDesktopPaths so remote
sessions use the backend-aware picker instead of local disk paths; preserve local
multi-select behavior and keep remote folder selection single because the in-app
remote picker only supports one directory.

Also use readDesktopFileDataUrl for image previews so an already-known backend
image path can be read through /api/fs/read-data-url, and add focused coverage
for backend file-diff routing plus the plain-folder git init/worktree path.
2026-06-28 14:35:23 -05:00
Brooklyn Nicholson
fc86e35764 feat(desktop): make the git cockpit work over a remote gateway
After the folder picker fix, an added remote folder was still half-usable:
the desktop's git GUI (coding-rail status, worktree lanes, review pane,
branch switch, file diff) all ran Electron-local git on the USER's machine,
so against a remote-gateway repo they silently degraded to empty.

Mirror the whole surface over the dashboard REST API so it acts on the
BACKEND repo where sessions actually run:

- hermes_cli/web_git.py: git/gh logic (status, worktrees, branches, review
  list/diff/stage/unstage/revert/commit/commit-context/push/ship-info/
  create-pr, file-diff, worktree add/remove, branch switch) shelling to the
  system git, mirroring the Electron ops' shapes.
- web_server.py: /api/git/* routes (same auth gate + _fs_path hardening as
  /api/fs, executor-offloaded, mutations -> 400).
- apps/desktop desktop-git.ts: remote-aware facade exposing the same shape as
  window.hermesDesktop.git; coding-status / review / projects / model /
  desktop-fs route through desktopGit() so local stays Electron, remote hits
  /api/git/*.

Tests: tests/hermes_cli/test_web_server_git.py (real repo: status counts,
review classification, diff incl. untracked all-add, stage+commit roundtrip,
worktree/branch lifecycle, commit-context, gh-absent ship-info, auth) and
desktop-git.test.ts (local vs remote routing, envelope unwrap, POST bodies).
2026-06-28 14:26:09 -05:00