-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: add global system prompt override support #6815
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
Conversation
- Users can now define global system prompts in ~/.roo/system-prompt-{mode}
- Local project prompts still take precedence over global ones
- Updated tests to cover the new functionality
- Fixes #6813
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.
Reviewing my own code again. The existential dread of being both judge and defendant continues.
| let rawContent = await safeReadFile(localFilePath) | ||
|
|
||
| // If no local file exists, check for global system prompt | ||
| if (!rawContent) { |
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.
The implementation reads the local file even when it's empty before checking the global file. Could we optimize this by checking file existence first, then only reading if the file exists and is non-empty? This would avoid unnecessary file reads for empty files.
| } | ||
|
|
||
| /** | ||
| * Checks if there is a file-based system prompt override for the given mode |
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.
Consider adding a comment here explaining the precedence order (local > global) for future maintainers. Something like:
| @@ -1,16 +1,19 @@ | |||
| // Mocks must come first, before imports | |||
|
|
|||
| vi.mock("fs/promises") | |||
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.
The mock setup pattern here is clean, but could benefit from a comment explaining why mocks must come before imports for future test writers. This is a TypeScript/Vitest specific requirement that might not be obvious.
|
This is not planned |
Description
This PR adds support for global system prompt overrides that can be defined in the user's home directory, eliminating the need to copy system prompt files to every repository.
Changes
~/.roo/system-prompt-{mode}.roo/system-prompt-{mode}) still take precedence over global onesgetGlobalSystemPromptFilePath()helper functionloadSystemPromptFile()to check both local and global locationshasFileBasedSystemPromptOverride()to check both locationsHow it works
.roo/system-prompt-{mode}~/.roo/system-prompt-{mode}Testing
Fixes
Fixes #6813
Checklist
Important
Adds support for global system prompt overrides, prioritizing local prompts, with updates to prompt loading logic and comprehensive tests.
~/.roo/system-prompt-{mode}..roo/system-prompt-{mode}) take precedence over global ones.loadSystemPromptFile()to check both local and global locations.hasFileBasedSystemPromptOverride()to check both locations.getGlobalSystemPromptFilePath()tocustom-system-prompt.ts.custom-system-prompt.spec.tsto verify global prompt usage and precedence logic.This description was created by
for 36af94e. You can customize this summary. It will automatically update as commits are pushed.