Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

feat(changes): add staging, commit & push and file revert to sidebar#1349

Open
jschwxrz wants to merge 2 commits intogeneralaction:mainfrom
jschwxrz:emdash/feat-reintroduce-sidebar-version-control-capabilites-8dg
Open

feat(changes): add staging, commit & push and file revert to sidebar#1349
jschwxrz wants to merge 2 commits intogeneralaction:mainfrom
jschwxrz:emdash/feat-reintroduce-sidebar-version-control-capabilites-8dg

Conversation

@jschwxrz
Copy link
Collaborator

@jschwxrz jschwxrz commented Mar 7, 2026

  • reintroduces staging, commit & push and file revert to sidebar

@vercel
Copy link

vercel bot commented Mar 7, 2026

@jschwxrz is attempting to deploy a commit to the General Action Team on Vercel.

A member of the Team first needs to authorize it.

@jschwxrz
Copy link
Collaborator Author

jschwxrz commented Mar 7, 2026

@arnestrickmann

this draft reintroduces staging, commit & push and file revert to the sidebar. should we keep the commiting, pushing, pulling, undo etc. logic in the diff viewer? Or get rid of that and only keep the minimal staging/commiting/reverting logic in the sidebar?

lmk and I will either create the PR or kick that out and then open it

@arnestrickmann
Copy link
Contributor

Hey @jschwxrz - I think we can do both.

Keep the diff viewer as it is with the commit and push functionalities on the left (which we can also move to the right at some point but thats a different topic) + staging / unstaging and commit + push in the normal right changes panel as well.

@jschwxrz jschwxrz marked this pull request as ready for review March 7, 2026 20:07
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 7, 2026

Greptile Summary

This PR re-introduces inline git workflow controls to the FileChangesPanel sidebar: per-file stage/unstage buttons, a "Stage All" shortcut, a commit-message input with a Commit & Push action, and a confirmation-gated file revert — all backed by existing Electron IPC calls (stageFile, unstageFile, stageAllFiles, gitCommitAndPush, revertFile).

Key observations:

  • isStagingAll omitted from task-change reset — the useEffect that clears loading/pending state when the active task changes resets stagingFiles, revertingFiles, and commitMessage but not isStagingAll. Switching tasks mid-operation leaves the Stage All button briefly disabled/spinning on the new task.
  • Revert on staged files is potentially destructive — the revert button is enabled for staged files. If revertFile only restores the working tree (git checkout -- <file>), the staged copy is left untouched and the user loses their working-tree changes without a visible effect on the staged diff, contradicting the dialog copy ("restore it to the last committed version").
  • "View all changes" entry-point removed — the onOpenChanges / FileDiff button that previously opened the all-changes modal is now only rendered in the empty-state (!hasChanges) branch. When changes are present, users can open per-file diffs by clicking rows but have no way to trigger the aggregated all-changes view.
  • The telemetry event rename from pr_viewedpr_created in handlePrAction appears to be a correct bug-fix (the event fires when the user creates a PR, not views one).
  • Task-switch guards using taskPathRef in handleCommitAndPush are well-structured; isCommitting is always cleaned up via the finally block.

Confidence Score: 3/5

  • Merge with caution — the revert-on-staged-file behaviour needs verification before shipping to avoid silent data loss.
  • The core staging and commit/push logic is straightforward and well-guarded against task switches, but the revert action on already-staged files has an unverified destructive path that depends on the revertFile IPC implementation. The missing onOpenChanges button in the hasChanges branch is a usability regression, and the omitted isStagingAll reset is a minor state-management gap.
  • src/renderer/components/FileChangesPanel.tsx — specifically the executeRestore handler and the isStagingAll reset logic.

Important Files Changed

Filename Overview
src/renderer/components/FileChangesPanel.tsx Adds per-file stage/unstage, a "Stage All" shortcut, a commit-message input with Commit & Push, and a confirmation-gated file revert. Three issues: isStagingAll omitted from the task-change reset; the revert button is active on already-staged files whose behaviour depends on the (unverified) revertFile IPC implementation; and the onOpenChanges (FileDiff) button is no longer reachable when there are uncommitted changes.

Sequence Diagram

sequenceDiagram
    participant User
    participant FileChangesPanel
    participant electronAPI

    User->>FileChangesPanel: Click stage/unstage button
    FileChangesPanel->>FileChangesPanel: setStagingFiles.add(path)
    alt stage
        FileChangesPanel->>electronAPI: stageFile({taskPath, filePath})
    else unstage
        FileChangesPanel->>electronAPI: unstageFile({taskPath, filePath})
    end
    electronAPI-->>FileChangesPanel: result
    FileChangesPanel->>FileChangesPanel: setStagingFiles.delete(path)
    FileChangesPanel->>FileChangesPanel: refreshChanges()

    User->>FileChangesPanel: Click "Stage All"
    FileChangesPanel->>FileChangesPanel: setIsStagingAll(true)
    FileChangesPanel->>electronAPI: stageAllFiles({taskPath})
    electronAPI-->>FileChangesPanel: result
    FileChangesPanel->>FileChangesPanel: setIsStagingAll(false) + refreshChanges()

    User->>FileChangesPanel: Enter commit message + click "Commit & Push"
    FileChangesPanel->>FileChangesPanel: setIsCommitting(true)
    FileChangesPanel->>electronAPI: gitCommitAndPush({taskPath, commitMessage})
    electronAPI-->>FileChangesPanel: result
    alt success
        FileChangesPanel->>FileChangesPanel: setCommitMessage('') + refreshChanges()
        FileChangesPanel->>electronAPI: refreshPr()
        FileChangesPanel->>electronAPI: getBranchStatus()
        FileChangesPanel->>FileChangesPanel: setBranchAhead(ahead)
    else failure
        FileChangesPanel->>User: toast error
    end
    FileChangesPanel->>FileChangesPanel: setIsCommitting(false)

    User->>FileChangesPanel: Click revert button
    FileChangesPanel->>FileChangesPanel: setRestoreTarget(path)
    User->>FileChangesPanel: Confirm in AlertDialog
    FileChangesPanel->>FileChangesPanel: setRestoreTarget(null)
    FileChangesPanel->>FileChangesPanel: setRevertingFiles.add(path)
    FileChangesPanel->>electronAPI: revertFile({taskPath, filePath})
    electronAPI-->>FileChangesPanel: result
    FileChangesPanel->>FileChangesPanel: dispatchFileChangeEvent + refreshChanges()
    FileChangesPanel->>FileChangesPanel: setRevertingFiles.delete(path)
Loading

Last reviewed commit: 90d7cb3

@jschwxrz
Copy link
Collaborator Author

jschwxrz commented Mar 7, 2026

Alright, this should do it. I fixed the valid issues greptile found

@arnestrickmann
Copy link
Contributor

Thanks man, will check it out

@arnestrickmann
Copy link
Contributor

Will review soon, @jschwxrz!

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.

2 participants