Skip to content

feat: git add files from code review UI#257

Merged
backnotprop merged 4 commits intomainfrom
feat/code-review-git-add
Mar 9, 2026
Merged

feat: git add files from code review UI#257
backnotprop merged 4 commits intomainfrom
feat/code-review-git-add

Conversation

@backnotprop
Copy link
Owner

Summary

Closes #254

  • Adds a "Git Add" button in the file header (next to "Viewed" and "Copy Diff") that runs git add on the current file
  • Clicking "Added" again unstages the file (git reset HEAD)
  • Adds "Staged changes" and "Unstaged changes" to the diff type dropdown, enabling the workflow: review → git add approved files → switch to "Unstaged" to see only remaining work
  • Staging a file auto-marks it as viewed
  • Sidebar file tree shows a left-border indicator and counter for staged files
  • Button is hidden for diff types where staging doesn't apply (last-commit, branch)
  • Full worktree support

Test plan

  • bun run build:hook compiles cleanly
  • Make changes in a test repo, run /plannotator-review
  • Click "Git Add" on a file → verify git status shows it staged
  • Click "Added" again → verify it's unstaged
  • Switch diff dropdown to "Unstaged changes" → git-added file should be gone
  • Switch to "Staged changes" → only git-added files shown
  • Verify button doesn't appear in "Last commit" or branch diff views
  • Test with worktrees if available

🤖 Generated with Claude Code

backnotprop and others added 2 commits March 9, 2026 07:05
Adds the ability to `git add` individual files directly from the code
review interface. Users can stage approved files then switch to the new
"Unstaged changes" diff view to see only remaining work.

- POST /api/git-add endpoint with worktree support
- gitAddFile/gitResetFile utilities in packages/server/git.ts
- "Staged changes" and "Unstaged changes" added to diff type dropdown
- useGitAdd hook encapsulating all staging state and API logic
- "Git Add" / "Added" toggle button in FileHeader (next to Viewed)
- Visual indicator (left border) for staged files in sidebar FileTree

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@backnotprop
Copy link
Owner Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

backnotprop and others added 2 commits March 9, 2026 07:24
Adds "staged" and "unstaged" to worktree sub-type allowlists (server parser,
client parser, and runGitDiff switch), displays stageError in FileHeader,
and documents /api/git-add in CLAUDE.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… dedup validation

- useGitAdd: use ref for stagedFiles to stabilize stageFile callback,
  clear error timeout on reset, drop unnecessary useMemo
- App.tsx: wrap onFileViewed in useCallback
- FileTree: merge duplicate staged count conditionals
- review.ts: reuse exported validateFilePath for /api/file-content

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@backnotprop backnotprop merged commit d29dd08 into main Mar 9, 2026
2 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.

Feature Request: Git Add Files

1 participant