Skip to content

feat(desktop): show a conversation's Git history as lanes from a shared package - #1598

Merged
huichen merged 6 commits into
mainfrom
pr/huichen
Nov 12, 2026
Merged

huichen merged 6 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

What this does

The desktop Review panel gains a History tab: a conversation's own workspace, read as a Git history drawn as coloured lanes with a commit detail view (stat and patch). The lane geometry, the glyph decoding and the lane palette move out of mobile into a new workspace package, @future-os/git-graph, so the desktop and the phone draw one picture of one repository from one implementation. dev-huichen also carries the CI registration that package needs.

Why it matters: the two front ends previously each owned a copy of (or, on desktop, had none of) the drawing logic. The host already computes the glyph grid and ships it over the remote protocol, so the drawing belongs in one shared place rather than in a screen.

Commits

  • feat(desktop): show a conversation's Git history as lanes — the History tab in ReviewPanel (a fourth tab, offered only when the workspace is a Git repository and the thread's own workspace path is known), GitHistoryPanel + LaneGraph + laneMetrics + gitHistorySource, a new list_git_commits / get_git_commit pair on the remote-peer client, a Tauri git_history command, and the mobile→package extraction: packages/git-graph (index.ts, palette.ts, tsconfig.json), mobile's gitGraph.ts reduced to a re-export, mobile theme/tokens.ts taking the palette from the package, en/zh gitHistory locales, plus screenshot scenarios for the new page.
  • test(desktop): capture the Git history page, local and not-a-repo — harness scenarios and mock-data support for the two history states, GitHistoryPanel.test.tsx, gitHistorySource.test.ts, and the RemoteFilesPanel / ReviewPanel test updates.
  • fix(ci): run the new git-graph package through the shared pipeline — @future-os/git-graph is a source-only workspace library with no scripts of its own, so scripts/ci/typescript-checks.mjs must list it as a shared package; without that, the project the affected-plan selects fails with @future-os/git-graph must define typecheck. packages/markdown/vitest.config.ts's header comment now describes the package set it actually runs.
  • docs(ci): list git-graph and peer-icons in the TypeScript project table — the docs/guide/ci.md inventory catches up with the workspace.

Verification

Run at 35567cf4f in a detached worktree, with the pinned toolchain (rustc 1.99.1 first on PATH), ulimit -n 8192, and CARGO_TARGET_DIR shared with the repository's target/:

  • node scripts/ci/affected.mjs <changed files> → the plan selects @future-os/git-graph as a TypeScript project (this is what the CI fix above is for)
  • CI_DIRECTORY=packages/git-graph node scripts/ci/typescript-checks.mjs typecheck → exit 0
  • CI_DIRECTORY=packages/git-graph node scripts/ci/typescript-checks.mjs lint → exit 0
  • GITHUB_ACTIONS=true CI_DIRECTORY=packages/git-graph node scripts/ci/typescript-checks.mjs test → 20 tests passed
  • node --test scripts/tests/ci-plan.test.mjs → 37 pass / 0 fail
  • cd desktop && npx tsc --noEmit → clean; cd mobile && npx tsc --noEmit → clean
  • cd desktop && npx vitest run src/features/git-history src/features/remote-peer/RemoteFilesPanel.test.tsx src/features/remote-peer/remotePanelExtras.test.tsx src/features/review/ReviewPanel.test.tsx → 5 files / 61 tests passed
  • cargo fmt --all -- --check → clean
  • cargo clippy -p future-host --all-targets -- -D warnings → clean; cargo clippy -p futureos --all-targets -- -D warnings → clean
  • cargo test -p future-host --lib git_history → 12 passed / 0 failed
  • python3 -c "json.load(open('scripts/screenshots/scenarios.json'))" → valid

User-visible changes

  • Desktop, new History tab in the Review panel. Before: a conversation's workspace could be reviewed as a branch diff, uncommitted changes, or the last run, with no way to see its commit history. After: a fourth tab, History, draws the history as coloured lanes and opens a commit's stat and patch. It appears only when the workspace is a Git repository and the thread's own workspace path has resolved — a thread whose workspace is still unresolved shows the tab with three items exactly as before, because reading another project's log under this conversation's title is worse than showing nothing (desktop/src/features/review/ReviewPanel.tsx). Revert 9be58cd85 + 8e2536ac1.
  • Mobile, unchanged drawing, one owner. Before: mobile owned the lane geometry, glyph decoder and palette in mobile/src/features/chat/gitGraph.ts and mobile/src/theme/tokens.ts. After: it imports them from @future-os/git-graph; the same six colours, the same geometry, so no visible change on the phone in this PR (the mobile panel itself landed in feat(remote): Git lane graph on mobile, and queue rows that keep their attachments #1597). Revert 9be58cd85 restores the local copies.
  • Remote conversations can now read the host's Git history through two new remote commands (list_git_commits, get_git_commit). An older host that does not know them answers unsupported, and the view states that instead of failing silently.
  • No default, permission, privacy, migration or performance-policy change in this PR.

Notes

  • packages/git-graph is a new npm workspace (package.json + package-lock.json updated); it ships TypeScript sources like the other source-only packages and defines no scripts, which is why CI has to know about it explicitly.
  • Cosmetic only, but worth a line: the JSDoc closing and the downloadRemoteFile signature in desktop/src/features/remote-peer/remotePeerClient.ts end up on one line (*/export function …) in this diff. Behaviour is unaffected and lint is clean; it is a formatting slip in an otherwise formatted file.

The phone has had a lane picture of its workspace's history since the
`git_graph_v1` capability landed; the desktop had only the working-tree
and branch diff. Both machines now draw the same picture, and they draw
it from one implementation.

The geometry moves out of the phone app into `packages/git-graph`, which
the desktop and the phone both consume: a lane algorithm written twice
drifts into two subtly different drawings of one history, and the whole
point of the picture is that a reader who has learned to read it once can
read it anywhere. The package holds the decoder, the lane drawing (now
with real turns and crossings) and the six-colour palette, which was
already duplicated between the two front ends.

Two entry points, because a conversation's workspace lives in one of two
places:

- locally, a new `get_git_history` / `get_git_commit` Tauri command pair
  over `future_host::git_history`, offered as a fourth tab in the review
  panel. It is gated on the thread's *own* `workspacePath` as well as
  `isGitWorkspace`, because the read is rooted at that path and a tab
  opened on a stale one would show another workspace's log.
- remotely, the existing `list_git_commits` / `get_git_commit` peer
  commands the phone already uses, offered as a Files/History switch in
  the peer panel. The probe is that same read, so a plain directory costs
  one round trip and no tab, and it is re-asked on each open so a
  workspace the agent `git init`s starts offering the tab.

`future_host::git_history` becomes a library-level module (it was inside
`remote_host`, which is the phone's route); `remote_host` keeps a
`pub(crate) use` alias so the phone's path is unchanged.

Tests: the decoder's 20 cases move with it; the panel and the source are
covered for both machines through the one seam they share, and the
"no tab outside a repository" decision is verified by breaking it.
Three scenarios for the lane picture: the local history tab open, one commit
open onto its patch, and the same panel where the workspace is not a
repository.

The gutters in the demo data are the *output* of `host/src/git_history.rs`'s own
layout function, not hand-drawn: the decoder reads glyphs, so an invented grid
decodes into a picture nobody asked for. The demo history is a trunk with three
branches feeding it — one merged back, one still open beside it, one joining
later — which is the smallest shape containing every glyph the drawer has, and
which puts three colours on screen so a picture that came out in one colour is
visibly wrong.

`?norepo=1` answers `isGitWorkspace: false` from the capability read as well as
`isRepo: false` from the history read. Both are what the panel gates on, and a
demo workspace that is a plain directory has to be one in every read: with only
the second switched, the tab still appeared and the scenario caught it.

The assertions are on strokes, not on text: pictures, stroke count, distinct
lane colours, and at least one rounded turn, plus the absence of any
box-drawing character in the DOM.
`@future-os/git-graph` is a source-only workspace package (TypeScript
sources, no scripts of its own), but it was not registered in the `shared`
list of scripts/ci/typescript-checks.mjs. The planner already selects it as
its own TypeScript project, so every phase fell through to `script(...)` and
the job failed with "@future-os/git-graph must define typecheck" (same shape
for lint and test) — a deterministic red, not a flake.

Register it so typecheck emits through tsc, lint through the shared ESLint
config and test through the shared vitest project, and update the test
project's header comment to name the packages it now covers.

Verified in the worktree: typecheck/lint/test phases of
scripts/ci/typescript-checks.mjs exit 0 for CI_DIRECTORY=packages/git-graph
(20 tests), the shared vitest project still reports 20 passed,
node --test scripts/tests/ci-plan.test.mjs passes 37/37 and
cargo fmt --all -- --check is clean. Each phase was also falsified with a
temporary broken file before being accepted.
The table names every TS workspace project and its direct workspace
dependencies, which is how readers understand what the planner selects, but
two source-only packages were missing: `peer-icons` (an older omission) and
`git-graph` (the package whose absence from the `shared` list of
scripts/ci/typescript-checks.mjs just turned dev-branch CI red).

Add both rows and a note above the table saying a new package must be
registered there *and* in that `shared` list, with the symptom an unregistered
one produces (`must define typecheck`, same for lint and test). Nothing
validates this table, so the note also says `make check-docs` covers placement
and links only.

`make check-docs` passes (417 docs, links and pairing OK); the new link was
falsified by pointing it at a missing file, which the gate rejected with
"missing local target".
@huichen
huichen enabled auto-merge (squash) November 12, 2026 17:22
@huichen
huichen merged commit 3903edc into main Nov 12, 2026
51 of 53 checks passed
@huichen
huichen deleted the pr/huichen branch November 12, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant