-
Notifications
You must be signed in to change notification settings - Fork 136
Fix Windows compatibility and deprecated -p flag #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,16 +87,12 @@ ${prompt_processed} | |
| prompt_processed = changeModeInstructions; | ||
| } | ||
|
|
||
| const args = []; | ||
| const args = ['-y']; // YOLO mode for non-interactive | ||
| if (model) { args.push(CLI.FLAGS.MODEL, model); } | ||
| if (sandbox) { args.push(CLI.FLAGS.SANDBOX); } | ||
|
|
||
| // Ensure @ symbols work cross-platform by wrapping in quotes if needed | ||
| const finalPrompt = prompt_processed.includes('@') && !prompt_processed.startsWith('"') | ||
| ? `"${prompt_processed}"` | ||
| : prompt_processed; | ||
|
|
||
| args.push(CLI.FLAGS.PROMPT, finalPrompt); | ||
|
|
||
| // Use positional prompt (not -p flag which is deprecated) | ||
| args.push(prompt_processed); | ||
|
Comment on lines
+91
to
+96
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic for constructing the arguments array is nearly identical here and in the |
||
|
|
||
| try { | ||
| return await executeCommand(CLI.COMMANDS.GEMINI, args, onProgress); | ||
|
|
@@ -105,18 +101,14 @@ ${prompt_processed} | |
| if (errorMessage.includes(ERROR_MESSAGES.QUOTA_EXCEEDED) && model !== MODELS.FLASH) { | ||
| Logger.warn(`${ERROR_MESSAGES.QUOTA_EXCEEDED}. Falling back to ${MODELS.FLASH}.`); | ||
| await sendStatusMessage(STATUS_MESSAGES.FLASH_RETRY); | ||
| const fallbackArgs = []; | ||
| const fallbackArgs = ['-y']; // YOLO mode | ||
| fallbackArgs.push(CLI.FLAGS.MODEL, MODELS.FLASH); | ||
| if (sandbox) { | ||
| fallbackArgs.push(CLI.FLAGS.SANDBOX); | ||
| } | ||
|
|
||
| // Same @ symbol handling for fallback | ||
| const fallbackPrompt = prompt_processed.includes('@') && !prompt_processed.startsWith('"') | ||
| ? `"${prompt_processed}"` | ||
| : prompt_processed; | ||
|
|
||
| fallbackArgs.push(CLI.FLAGS.PROMPT, fallbackPrompt); | ||
|
|
||
| // Use positional prompt | ||
| fallbackArgs.push(prompt_processed); | ||
| try { | ||
| const result = await executeCommand(CLI.COMMANDS.GEMINI, fallbackArgs, onProgress); | ||
| Logger.warn(`Successfully executed with ${MODELS.FLASH} fallback.`); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enabling
shell: trueunconditionally can introduce security vulnerabilities if the command or arguments are not properly sanitized, especially on non-Windows platforms where it might not be necessary. Since this change is intended for Windows compatibility, it's safer to enable the shell only when running on Windows. This minimizes the potential attack surface of command injection.