Repository navigation
feat(desktop): show a conversation's Git history as lanes from a shared package - #1598
Merged
Merged
Conversation
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".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-huichenalso 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 inReviewPanel(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 newlist_git_commits/get_git_commitpair on the remote-peer client, a Taurigit_historycommand, and the mobile→package extraction:packages/git-graph(index.ts,palette.ts,tsconfig.json), mobile'sgitGraph.tsreduced to a re-export, mobiletheme/tokens.tstaking the palette from the package, en/zhgitHistorylocales, 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 theRemoteFilesPanel/ReviewPaneltest updates.fix(ci): run the new git-graph package through the shared pipeline—@future-os/git-graphis a source-only workspace library with no scripts of its own, soscripts/ci/typescript-checks.mjsmust 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— thedocs/guide/ci.mdinventory catches up with the workspace.Verification
Run at
35567cf4fin a detached worktree, with the pinned toolchain (rustc 1.99.1first onPATH),ulimit -n 8192, andCARGO_TARGET_DIRshared with the repository'starget/:node scripts/ci/affected.mjs <changed files>→ the plan selects@future-os/git-graphas 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 0CI_DIRECTORY=packages/git-graph node scripts/ci/typescript-checks.mjs lint→ exit 0GITHUB_ACTIONS=true CI_DIRECTORY=packages/git-graph node scripts/ci/typescript-checks.mjs test→ 20 tests passednode --test scripts/tests/ci-plan.test.mjs→ 37 pass / 0 failcd desktop && npx tsc --noEmit→ clean;cd mobile && npx tsc --noEmit→ cleancd 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 passedcargo fmt --all -- --check→ cleancargo clippy -p future-host --all-targets -- -D warnings→ clean;cargo clippy -p futureos --all-targets -- -D warnings→ cleancargo test -p future-host --lib git_history→ 12 passed / 0 failedpython3 -c "json.load(open('scripts/screenshots/scenarios.json'))"→ validUser-visible changes
desktop/src/features/review/ReviewPanel.tsx). Revert9be58cd85+8e2536ac1.mobile/src/features/chat/gitGraph.tsandmobile/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). Revert9be58cd85restores the local copies.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.Notes
packages/git-graphis a new npm workspace (package.json+package-lock.jsonupdated); it ships TypeScript sources like the other source-only packages and defines no scripts, which is why CI has to know about it explicitly.downloadRemoteFilesignature indesktop/src/features/remote-peer/remotePeerClient.tsend 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.