feat(windows): add shell detection and fix cmd.exe escaping issues#412
Closed
Orinks wants to merge 2 commits intoCodebuffAI:mainfrom
Closed
feat(windows): add shell detection and fix cmd.exe escaping issues#412Orinks wants to merge 2 commits intoCodebuffAI:mainfrom
Orinks wants to merge 2 commits intoCodebuffAI:mainfrom
Conversation
- Add shared shell detection utility in common/src/util/detect-shell.ts - Update CLI to re-export shell detection from common - SDK now uses detected shell (PowerShell/cmd.exe/bash) instead of hardcoding - Report actual detected shell in systemInfo for better LLM guidance - Fix git commit syntax to use cross-platform format (no HEREDOC) - Add shell-specific Windows notes (PowerShell vs cmd.exe guidance) - Update WINDOWS.md documentation with shell detection info
- Add detailed escaping rules for special chars (^ for & | < > ^, %% for %) - Explain that nested quotes and multi-line strings are unreliable - Recommend file-based approach for complex content - Add practical examples for git commits and complex echo 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
Contributor
|
Hi @Orinks, thanks for creating this PR. I looked into your solution, and for now I think I prefer the following solution, which is what Claude Code uses: #413 My PR basically requires bash, but shows you an error message for how you can install it if you do not already have it on your Windows PC. Bash is preferred because the coding agents are trained on it. They won't be as good with powershell. Many of our Windows users already have Git Bash and so don't need to take any action for it to work optimally. If you are able to build codebuff locally, could you try out my PR and see if it works for you? |
Contributor
|
Thanks Orinks, your PR got me to look into this and now it is solved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR improves Windows compatibility for Codebuff by:
Shell Detection
common/src/util/detect-shell.ts) that detects cmd.exe, PowerShell, bash, zsh, and fishCross-Platform Git Commits
.codebuff-commit-msg.txttemp file withgit commit -FflagEnhanced cmd.exe System Prompts
^for special chars,%%for percentUpdated Documentation
Testing
/cargs)Files Changed
common/src/util/detect-shell.ts(new)cli/src/utils/detect-shell.ts(re-exports from common)sdk/src/tools/run-terminal-command.tssdk/src/run-state.tscommon/src/tools/params/tool/run-terminal-command.tspackages/agent-runtime/src/system-prompt/prompts.tsWINDOWS.md