Cross platform commit helper #291
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem Solved
The original issue was that heredoc syntax (
<<'EOF') used in git commit commands only works in bash/Unix shells and fails on Windows Command Prompt, causing commit failures for Windows users.Solution
This PR implements a comprehensive cross-platform commit helper that resolves heredoc issues and ensures consistent git commit behavior across all platforms.
Key Changes
🔧 Core Implementation
scripts/commit-helper.js- Main Node.js script with ES module support for cross-platform commitsscripts/commit.bat- Windows batch wrapper for easy CLI usagescripts/commit.sh- Unix/Linux/macOS shell wrappercommon/src/util/git-cross-platform.ts- TypeScript utilities for programmatic usescripts/COMMIT_HELPER_README.md- Comprehensive documentation🤖 Agent Integration
backend/src/system-prompt/prompts.ts) to instruct agents to use the commit helper automaticallycommon/src/util/git.ts) to use the helper as the primary commit method✅ Features
git commit -Fto avoid shell escaping issues entirely🎯 Usage
Command Line
Programmatic
🔍 Technical Details
The helper works by:
git commit -F tempfileto avoid all shell parsing issuesThis approach eliminates:
✅ Testing
🎉 Result
The heredoc issue is completely resolved! Codebuff agents now automatically use the cross-platform commit helper for all git commits, ensuring reliable operation across Windows, macOS, and Linux without any manual intervention required.
Users can now ask agents to commit changes and it will work seamlessly on any platform without heredoc syntax errors.