feat: fix git window and add pretty diff viewer #178

Merged
naomi merged 2 commits from feat/diff into main 2026-03-06 09:19:16 -08:00
Owner

Summary

  • Fix git window "Not a git repository" error — The working directory received from Claude Code is a WSL Linux path (e.g. /home/naomi/...), but git commands were being run as native Windows processes with .current_dir(). Windows can't resolve WSL paths, causing git rev-parse --git-dir to fail. Fixed by routing git commands through wsl -- git -C <path> when the working directory starts with /.

  • Add syntax highlighting and line numbers to diff view — Replaced the raw <pre> block with a proper DiffViewer component featuring:

    • Old/new line number columns with correct tracking across hunks
    • Colour-coded gutter (+/-) with green/red row backgrounds
    • Syntax highlighting via highlight.js using the detected file language, respecting all app themes via --hljs-* CSS variables
    • Styled hunk headers and file headers

New files

  • src/lib/utils/diffParser.ts — pure diff parsing logic
  • src/lib/utils/diffParser.test.ts — 30 tests covering all line types, line number tracking, and language detection
  • src/lib/components/DiffViewer.svelte — the pretty diff viewer component

This pull request was created with help from Hikari~ 🌸

## Summary - **Fix git window "Not a git repository" error** — The working directory received from Claude Code is a WSL Linux path (e.g. `/home/naomi/...`), but git commands were being run as native Windows processes with `.current_dir()`. Windows can't resolve WSL paths, causing `git rev-parse --git-dir` to fail. Fixed by routing git commands through `wsl -- git -C <path>` when the working directory starts with `/`. - **Add syntax highlighting and line numbers to diff view** — Replaced the raw `<pre>` block with a proper `DiffViewer` component featuring: - Old/new line number columns with correct tracking across hunks - Colour-coded gutter (`+`/`-`) with green/red row backgrounds - Syntax highlighting via `highlight.js` using the detected file language, respecting all app themes via `--hljs-*` CSS variables - Styled hunk headers and file headers ## New files - `src/lib/utils/diffParser.ts` — pure diff parsing logic - `src/lib/utils/diffParser.test.ts` — 30 tests covering all line types, line number tracking, and language detection - `src/lib/components/DiffViewer.svelte` — the pretty diff viewer component ✨ This pull request was created with help from Hikari~ 🌸
hikari added 2 commits 2026-03-05 17:25:59 -08:00
feat: add syntax highlighting and line numbers to diff view
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m0s
CI / Lint & Test (pull_request) Successful in 16m27s
CI / Build Linux (pull_request) Successful in 20m22s
CI / Build Windows (cross-compile) (pull_request) Successful in 30m28s
9e04875144
naomi merged commit 1ae440659c into main 2026-03-06 09:19:16 -08:00
naomi deleted branch feat/diff 2026-03-06 09:19:16 -08:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nhcarrigan/hikari-desktop#178