Enhance prompt.txt parsing: Path resolution fix and @file@ syntax support#277
Merged
Merged
Conversation
- Use os.path.expanduser to correctly resolve user directory - Wrap command prompts return value in a list for consistency - Address issues with finding `prompt.txt`
- Added import statements for re and os modules - Implemented logic to replace @file@ syntax with actual file content
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.
This pull request introduces two key enhancements to the parsing of
prompt.txtfiles used in our workflow processes. It addresses the issues outlined in #276 by improving path resolution and adding support for the@file@syntax within the content ofprompt.txt.Improvements:
Path Resolution: We've fixed the issue where the parser was failing to accurately locate
prompt.txt. The use ofos.path.expanduserensures that user directories are correctly resolved, enhancing the reliability of path access across different environments.@file@ Syntax Support: The new parsing logic recognizes and substitutes the
@file@tags with the content of the actual files referenced. This allows for more dynamic and flexible workflow scripting, as files can be directly embedded into the context provided byprompt.txt.Notes:
Special attention has been paid to ensuring that, if a referenced file does not exist or cannot be accessed, the
@file@tag remains unaltered, preserving the original intent.A thorough testing strategy was followed to validate these improvements across various environments.
The documentation will need to be updated to reflect the new features and the modifications to the parsing process.
Closes #276.