Skip to content

Add GitHub and local Git diff viewer#12

Merged
tacogips merged 2 commits into
mainfrom
feature/github-pr-diff-view
Jun 2, 2026
Merged

Add GitHub and local Git diff viewer#12
tacogips merged 2 commits into
mainfrom
feature/github-pr-diff-view

Conversation

@tacogips

@tacogips tacogips commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • add source-aware GitHub diff support for pull requests, commits, and compare URLs
  • add local Git worktree, commit, and range diff viewing with shared diff UI modes
  • add repository file-view to Git diff switching with the G shortcut
  • update README, design docs, QA notes, and implementation plan artifacts

Verification

  • bun run typecheck
  • bun run test
  • bun run test:dom
  • CARGO_TERM_QUIET=true cargo check
  • CARGO_TERM_QUIET=true cargo test
  • git diff --check
  • Computer Use debug app validation for local Git range startup and worktree Git diff switching

tacogips added 2 commits June 2, 2026 11:42
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
@tacogips tacogips merged commit 4cfc75c into main Jun 2, 2026
1 of 3 checks passed
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