feat(diff): add task diff view components and live-sync hook#140
Open
djsdg wants to merge 3 commits into
Open
Conversation
Adds the right-side task diff surface, the react-query live-sync that
invalidates branch diff queries when the chat store observes completed
file-change tool calls, and the supporting Rust contracts (TaskDiffScope,
CommitTaskChanges/PushTaskBranch, GetTaskWorkspace*) plus regenerated
TypeScript bindings.
Frontend:
- packages/app-shell/src/features/diff/{task-diff-view,task-diff-file-tree,task-diff-collapse}
- packages/app-shell/src/state/hooks/use-task-diff{,-live-sync}
- packages/app-shell/src/state/hooks/use-task-workspace
- packages/app-shell/src/state/hooks/query-keys adds task diff keys
- packages/app-shell/src/test/mock-client adds task diff client ops
- packages/app-shell/src/global.d.ts declares side-effect css imports
- packages/app-shell/package.json adds react-diff-view dep
Contracts:
- crates/contracts/src/task_diff adds TaskDiffScope + CommitTaskChanges/PushTaskBranch types
- crates/contracts/src/task adds GetTaskWorkspace Request/Response + TaskWorkspace
- crates/contracts/src/frontend registers path constants and endpoint metadata
- crates/contracts/src/lib re-exports the new contracts
- xtask/src/export_contracts maps the new contract types to module files
The backend commit/push/scope handlers and worktree lifecycle hardening
remain on the codex branch and will land in a follow-up PR; this PR only
exposes the Rust contracts and frontend components so the diff surface
ships without depending on the in-flight worktree refactor.
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
Adds the right-side task diff surface for the Ora demo: the React diff view, file tree, collapse state, the live-sync hook that invalidates branch diff queries when the chat store observes completed file-change tool calls, and the minimal Rust contracts (
TaskDiffScope,CommitTaskChanges/PushTaskBranch,GetTaskWorkspace*) plus regenerated TypeScript bindings generated bycargo xtask export-contracts.Scoped to the diff surface only — no workspace-view mount, no i18n strings, no worktree lifecycle hardening. Backend commit/push handlers stay on the codex branch and land in a follow-up PR.
Why
Mirrors the Codex/Claude Code event-driven single-refresh model: agent tool completion → 400ms debounce →
queryClient.invalidateQueries({ taskDiffs(taskId) }). No fs.watch, no polling. This keeps the diff view responsive to agent edits without coupling it to Git internals or worktree lifecycle work in flight on other branches.Changes
Frontend (pure additive)
packages/app-shell/src/features/diff/—task-diff-view,task-diff-file-tree,task-diff-collapse+ tests + csspackages/app-shell/src/state/hooks/use-task-diff.ts,use-task-diff-live-sync.ts(+tests),use-task-workspace.tspackages/app-shell/src/state/hooks/query-keys.ts— add task diff keyspackages/app-shell/src/test/mock-client.ts— add task diff client opspackages/app-shell/src/global.d.ts— declare side-effect css importspackages/app-shell/package.json— addreact-diff-viewdepRust contracts (minimum diff/commit/push surface)
crates/contracts/src/task_diff.rs—TaskDiffScope,CommitTaskChanges*,PushTaskBranch*crates/contracts/src/task.rs—GetTaskWorkspaceRequest/Response,TaskWorkspacecrates/contracts/src/frontend.rs— register path constants and endpoint metadatacrates/contracts/src/lib.rs— re-exportsxtask/src/export_contracts.rs— map new contract typesGenerated TS bindings (regenerated)
packages/contracts/src/{task,task_diff,endpoints,client}.tsOut of scope (intentionally excluded per "only right-side diff" constraint)
GitTaskGitWriter/TaskGitContext/CommitTaskChangesHandler/PushTaskBranchHandlerWorktreeActivitytoWorktreeLifecycle(would breakcrates/backendothers are still optimizing)POST /api/tasks/{taskId}/git/{commit,push}route wiring (commit/push buttons 404 until follow-up PR)?scope=...query parsing on the backend (currently ignored; frontend tracks scope but server returns branch only)