Skip to content

Comments

refactor: move git functionality to package, improve git rollbacks#712

Merged
jonathanlab merged 6 commits intomainfrom
feat/git-package
Feb 3, 2026
Merged

refactor: move git functionality to package, improve git rollbacks#712
jonathanlab merged 6 commits intomainfrom
feat/git-package

Conversation

@jonathanlab
Copy link
Contributor

@jonathanlab jonathanlab commented Jan 30, 2026

Context: https://posthog.slack.com/archives/C09G8Q32R6F/p1769699024978149

We need to move our git operations into a package so we can:

  • Use a shared git client for all of these
  • Make git easier to debug/test
  • Turn almost every git operation into a saga
  • Have no git logic inside agent/electron

We are now not directly calling the git CLI anymore using execAsync but instead use https://github.com/steveukx/git-js/ for a typed wrapper around Git.

I've also checked/adjusted every git saga to ensure they don't have destructive/unintended rollbacks, or were missing a rollback

This should make solving #599 easier along with #522 , #374 and #702

@jonathanlab jonathanlab requested a review from a team as a code owner January 30, 2026 15:19
- Resolved conflicts in git/service.ts (kept git package implementation)
- Removed packages/agent/src/worktree-manager.ts (functionality moved to @twig/git)
- Included PR #754 changes: symlink CLAUDE.local.md to worktrees
- Add @twig/git as workspace dependency in agent package.json
- Pass logger from parent saga to GitApplyTreeSaga and GitCaptureTreeSaga
- Fix CaptureTreeSaga to clean up archive on upload failure using try/finally
- Update tests to not check nested saga step names (only check error messages)
@jonathanlab jonathanlab merged commit 00ff51c into main Feb 3, 2026
12 checks passed
@jonathanlab jonathanlab deleted the feat/git-package branch February 3, 2026 14:54
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