Skip to content

feat(git): in-app source control panel#19

Merged
mertbekci merged 1 commit into
mainfrom
feat/git-integration
Apr 14, 2026
Merged

feat(git): in-app source control panel#19
mertbekci merged 1 commit into
mainfrom
feat/git-integration

Conversation

@mertbekci

Copy link
Copy Markdown
Member

Kapatır #18.

Workspace bir git reposu olduğunda VS Code tarzı kaynak kontrol panelini çalıştırır. Yeni runtime bağımlılığı yok — tüm git çağrıları child_process.execFile ile array-arg olarak yapılır, shell'den geçmez.

Ana eklemeler

  • Yeni IPC kanalları (git:status, git:diff, git:stage, git:unstage, git:discard, git:commit, git:push, git:pull) — main + preload + ScrapemanBridge tipleri.
  • Porcelain parser @scrapeman/http-core/src/git/porcelain.ts içinde saf fonksiyon olarak; electron olmadan test edilebilir. 8 yeni vitest case (branch, ahead/behind, rename, untracked, staged+dirty, detached HEAD).
  • SourceControlPanel — staged/unstaged listeler, per-row stage/unstage/discard, commit textarea + buton, push/pull (ahead/behind göstergeli, işlem sırasında disabled), refresh, inline diff viewer (+/- renklendirme).
  • Sidebar Files/Git tab switcher'ı + dirty badge; file tree'de M/A/D/U/R rozetleri.
  • Store slice gitStatus + tüm aksiyonlar; saveActive sonrası otomatik refresh.
  • git:discard için renderer tarafında confirm dialog.

Kapsam dışı (V2)

  • Hunk / satır bazlı staging
  • Merge conflict UI
  • Branch switch / create / history view
  • Stash, rebase, cherry-pick
  • Credential prompting (kullanıcının git credential helper'ına güveniyoruz)
  • Workspace git repo değilse git init + remote ekleme akışı (issue'daki Mod B)

Doğrulama

  • pnpm -r typecheck temiz
  • pnpm -r test — 145 / 145 (yeni 8 parser testi dahil)
  • pnpm --filter=@scrapeman/desktop build başarılı

Adds a VS Code-style source control MVP for workspaces that are git
repositories. No new runtime dependencies — all git work shells out
via child_process.execFile with array args.

IPC channels (main + preload):
- git:status  — parses `git status --porcelain=v1 -b -z`
- git:diff    — `git diff` / `git diff --cached`, pseudo-diff for untracked
- git:stage   — `git add`
- git:unstage — `git restore --staged` (reset HEAD fallback)
- git:discard — checkout HEAD for tracked / fs unlink for untracked
- git:commit  — `git commit -m`
- git:push    — `git push`, returns { ok, message }
- git:pull    — `git pull --ff-only`, returns { ok, message }

Shared types: GitFileChange, GitFileChangeStatus, GitStatus, GitOpResult
added to ScrapemanBridge. Porcelain parser lives in @scrapeman/http-core
(src/git/porcelain.ts) so it can be unit-tested without electron.

UI:
- New SourceControlPanel component with staged/unstaged sections,
  per-row stage/unstage/discard actions, commit message textarea,
  commit button, push/pull with ahead/behind counts, refresh, inline
  diff viewer with +/- coloring.
- Sidebar gains a Files/Git tab switcher; git tab shows dirty badge.
- File tree shows M/A/D/U/R badges next to modified files.
- Store slice gitStatus/loadGitStatus/stageFile/unstageFile/discardFile/
  commitChanges/gitPush/gitPull; saveActive triggers an auto-refresh
  so edits show up in the panel immediately.

Tests: 8 new vitest cases for the porcelain parser covering branch
parsing, ahead/behind, renames, untracked, staged+dirty, detached HEAD.

Out of scope (follow-ups): hunk-level staging, merge conflict UI,
branch switching/history, stash/rebase, credential prompts, git init
flow for non-repo workspaces.
@mertbekci mertbekci added the ready for review PR ready for review label Apr 14, 2026
@mertbekci mertbekci self-assigned this Apr 14, 2026
@mertbekci mertbekci added the ready for review PR ready for review label Apr 14, 2026
@mertbekci
mertbekci merged commit 1b6f661 into main Apr 14, 2026
3 checks passed
@mertbekci
mertbekci deleted the feat/git-integration branch April 14, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review PR ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant