Add GitHub and local Git diff viewer#12
Merged
Merged
Conversation
1. Primary Changes and Intent: Added a read-only GitHub PR diff viewer that accepts GitHub pull request URLs at startup and renders typed PR diffs inside chilla with a current-directory changed-file browser and multiple diff viewing modes. 2. Key Technical Concepts: - Tauri command contracts for PR diff loading - GitHub REST API adapter behind a Rust service trait - Typed Rust and TypeScript PR diff models - Solid.js PR diff workspace state and render modes - Hunk-level left/right diff alignment and segment-local horizontal scrolling - Temporary cache behavior for GitHub PR diff retrieval - macOS Computer Use verification skill for visible runtime checks 3. Files and Code Sections: - src-tauri/src/github_pr_diff.rs: Added PR URL parsing, GitHub client trait, API-backed retrieval, diff patch parsing, cache handling, status enum modeling, and unit-testable mock boundaries. - src-tauri/src/cli/mod.rs, src-tauri/src/viewer/types.rs, src-tauri/src/viewer/service.rs: Added GitHub PR URL startup classification and viewer wiring. - src-tauri/src/commands/document.rs, src-tauri/src/lib.rs: Registered PR diff load commands and full-file text loading. - src/lib/tauri/document.ts: Added TypeScript PR diff types and invoke wrappers. - src/features/pr-diff/PrDiffWorkspace.tsx: Added PR workspace UI, yazi-style changed-file browser, hunk-level left/right diff, full-file and stack modes, syntax highlighting, GitHub jump action, and keyboard shortcuts. - src/app/App.css: Added PR workspace styling and horizontal overflow behavior for diff and local file previews. - src/features/workspace/WorkspaceShell.tsx: Routed GitHub PR targets into PR diff workspace mode. - tests and fixtures: Added Rust and DOM coverage for PR parsing, GitHub API mocking, cache behavior, browser projection, mode switching, and hunk-level scroll behavior. - design-docs and impl-plans: Documented architecture, command contract, implementation plan, QA notes, and qraftbox behavioral references. - .agents/skills/macos-computer-use-verify/SKILL.md: Added project-scope runtime verification skill for macOS Computer Use checks. 4. Problem Solving: Addressed PR URL handling for both /pull/<number> and /pull/<number>/files forms, exposed merged state, avoided tree-style file browsing, added syntax-aware diff rendering, isolated GitHub API logic behind a trait for mockable tests, and changed side-by-side rendering to align by hunk rather than scrolling the whole diff as one unit. 5. Impact: chilla can now open public GitHub PR URLs as read-only diff workspaces while preserving local file-browser interaction patterns and keeping GitHub network access in the Rust backend. 6. Unresolved TODOs: - [ ] None
1. Primary Changes and Intent: Added source-aware diff viewing so chilla can open GitHub pull request, commit, and compare URLs, switch an opened local Git repository into uncommitted worktree diff mode, and launch local commit or range diffs from a git directory plus revision spec. 2. Key Technical Concepts: - Source-aware diff target modeling for GitHub and local Git inputs - GitHub REST diff retrieval with cache identity per source kind - Local Git command execution without shell interpolation - Shared left/right, stack, and full-file diff UI modes - Tauri command contracts and TypeScript payload normalization - Keyboard shortcut support for local Git diff toggling 3. Files and Code Sections: - src-tauri/src/github_pr_diff.rs: Extended GitHub diff parsing, metadata loading, caching, and source identity support for pull requests, commits, and compares. - src-tauri/src/git_diff.rs: Added local Git repository detection and worktree, commit, and range diff snapshot loading. - src-tauri/src/cli/mod.rs: Added GitHub diff URL parsing updates, no-cache aliases, and local git-dir plus commit-or-range startup parsing. - src-tauri/src/commands/document.rs, src-tauri/src/viewer/service.rs, src-tauri/src/viewer/types.rs, src-tauri/src/lib.rs: Added local Git diff commands and startup context wiring. - src/lib/tauri/document.ts and related tests: Added source-aware diff payload normalization and invoke wrappers. - src/features/pr-diff/PrDiffWorkspace.tsx and tests: Reused one diff workspace across GitHub and local Git sources, added source-aware labels/actions, and maintained diff mode behavior. - src/features/workspace/WorkspaceShell.tsx: Added local Git diff switching from directory file view and G shortcut toggle. - src/app/App.css: Added diff viewer visual support for updated controls and states. - README.md, design-docs/, impl-plans/: Updated usage, design, QA notes, and implementation tracking. - package.json: Scoped Bun unit test command to the non-DOM test files that are compatible with the Bun runner. 4. Problem Solving: Enables reviewing GitHub URLs beyond pull requests, reviewing local uncommitted work without leaving chilla, and validating commit/range diffs from startup while preserving the existing local file browsing workflow. 5. Impact: chilla now has a unified diff workspace for remote GitHub sources and local Git sources, with repository-scoped local browsing and documented keyboard/CLI usage. 6. Unresolved TODOs: - [ ] None
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.
Summary
Verification