refactor(lib): use runGitCommand helper instead of Bun.spawn#272
Conversation
Replace direct Bun.spawn calls with the centralized runGitCommand helper in git-workflow.ts and repo-manager.ts for consistency with the codebase. - getAllLinkedBranches(): use runGitCommand for git and gh api calls - startDevelopWorkflow(): use runGitCommand for gh issue develop - fetchBranch(): use runGitCommand for git fetch and branch operations - isInGitRepo(): use runGitCommand for git rev-parse - getGitDir(): use runGitCommand for git rev-parse - cloneBareRepo(): use runGitCommand for gh repo clone - getCurrentRepoInfo(): use runGitCommand for gh repo view Issue: #267
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary of ChangesHello @amondnet, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors how external Git and GitHub CLI commands are executed within the application. By introducing and utilizing a dedicated Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This is an excellent refactoring to centralize git command execution with the runGitCommand helper. Replacing direct Bun.spawn calls greatly improves consistency, testability, and maintainability. The changes in git-workflow.ts and repo-manager.ts are clean and effective. I've identified one minor opportunity for cleanup in git-workflow.ts where the refactoring has highlighted some redundant code. Overall, this is a valuable improvement to the codebase.
Remove redundant git command and check that was ineffective since the code unconditionally returns empty array regardless of outcome. Co-authored-by: gemini-code-assist[bot] <162626009+gemini-code-assist[bot]@users.noreply.github.com>
|
Restore the .please/**/*.md eslint ignore that exists on main but was missing on this branch, fixing the lint check. Wrap runGitCommand calls in isInGitRepo/getGitDir with try/catch so a subprocess spawn failure returns false/null instead of throwing, matching their documented boolean/nullable contract and fixing the Unit Tests check failure surfaced in CI at repo-manager.ts:55.
|
Warning Review limit reached
Next review available in: 2 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 4 |
| Duplication | -8 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
… handling runGitCommand is used to spawn both git and gh CLI commands, so the name was misleading. Renamed to runCliCommand across git-exec, git-workflow, git-workflow-worktree, and repo-manager. Also wrap cloneBareRepo/getCurrentRepoInfo's runCliCommand calls in try/catch, matching the pattern already used in isInGitRepo/getGitDir, so a spawn failure (e.g. gh missing from PATH) surfaces a clear error instead of an unhandled rejection.
|



Summary
Replace direct
Bun.spawncalls with the centralizedrunGitCommandhelper ingit-workflow.tsandrepo-manager.tsfor consistency, testability, and maintainability.Changes
src/lib/git-workflow.ts:
getAllLinkedBranches()- Convert to userunGitCommandfor git and gh api callsstartDevelopWorkflow()- Convert to userunGitCommandfor gh issue developfetchBranch()- Convert to userunGitCommandfor git fetch and branch operationssrc/lib/repo-manager.ts:
isInGitRepo()- Convert to userunGitCommandfor git rev-parsegetGitDir()- Convert to userunGitCommandfor git rev-parsecloneBareRepo()- Convert to userunGitCommandfor gh repo clonegetCurrentRepoInfo()- Convert to userunGitCommandfor gh repo viewBenefits:
Test Plan
Related Issues
Closes #267
Summary by cubic
Refactored all git/gh CLI calls in
git-workflow.ts,git-workflow-worktree.ts, andrepo-manager.tsto use the sharedrunCliCommandhelper (renamed fromrunGitCommand) for consistency and easier testing. Removed dead code ingetAllLinkedBranches, hardenedisInGitRepo/getGitDirandcloneBareRepo/getCurrentRepoInfoerror handling, and restored the.please/**/*.mdESLint ignore; addresses #267 with no behavior changes.Written for commit acbec2e. Summary will update on new commits.