generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add repo URL parameter to content processing functions
- Loading branch information
Showing
4 changed files
with
30 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,45 @@ | ||
export async function renderPrompt(originalContent: string, parserCode: string, manifests: string): Promise<string> { | ||
export async function renderPrompt(originalContent: string, parserCode: string, manifests: string, repoUrl: string): Promise<string> { | ||
// eslint-disable-next-line sonarjs/prefer-immediate-return | ||
const prompt = [ | ||
` | ||
- You are to act as a YAML configuration editor. | ||
- Your goal is to modify the provided YAML file according to the user's instructions while ensuring that the syntax remains valid and no necessary formatting is lost. | ||
- Be especially careful with list indicators (like hyphens) and ensure they are preserved appropriately. | ||
- **Important:** Do **not** remove any hyphens (\`-\`) that indicate items in a list (e.g., plugins). These hyphens are critical for YAML syntax and must be retained. | ||
- Additionally, correct any syntax errors present in the original YAML file. | ||
`As a YAML configuration editor, modify the following YAML file according to the user's instructions, ensuring valid syntax and preserving formatting. Pay special attention to list indicators (hyphens \`-\`); ensure they are retained and not removed, especially for list items like plugins. Correct any syntax errors in the original YAML. | ||
- **Do not alter any URLs in the configuration file. Assume that all URLs provided are correct and must remain unchanged unless the user specifically requests a modification to URLs otherwise.** | ||
- Here is the original YAML configuration file:`, | ||
**Do not alter any URLs in the configuration unless explicitly instructed.** | ||
Here is the original YAML configuration file for ${repoUrl}:`, | ||
|
||
originalContent, | ||
|
||
`Provide the modified YAML file without any additional explanation or extraneous characters. Do not include any headers, footers, code block markers (like triple backticks), or language identifiers (like 'yaml'). **Only output the modified YAML content.** | ||
`Provide only the modified YAML content without any additional explanation, headers, footers, code block markers, or language identifiers. | ||
**Example of correct plugin formatting:** | ||
- uses: | ||
- plugin: ubiquibot/issue-comment-embeddings@main | ||
Ensure that the hyphens before each plugin are retained as shown above. **Remember, do not change any URLs in the configuration.** and do not remove comments intended for human readers; only remove commented-out YAML code. Finally, for additional context, here is the source code of the yml configuration parser for your reference:`, | ||
Ensure the hyphens before each plugin are retained as shown above. | ||
Remember: | ||
• Do not change any URLs unless instructed. | ||
• Keep all comments intended for human readers—including any URLs within them. | ||
• Only remove commented-out YAML code. Do not remove or alter any other comments, notes, or URLs intended for documentation or human understanding. | ||
**Example of a comment with a URL that should be preserved:** | ||
# This is a comment with a URL that should be preserved: https://example.com/documentation | ||
**Ensure all human-readable comments and their contents, especially URLs, are left unchanged unless explicit instructions are provided to modify them.** | ||
For additional context, here is the source code of the YAML configuration parser:`, | ||
|
||
parserCode, | ||
|
||
`Lastly, here are the manifests for every plugin in the configuration file. Be sure to include a default value for any missing fields in the configuration file.`, | ||
`Below are the manifests for the plugins in the configuration. Include default values for any missing fields.`, | ||
|
||
manifests, | ||
].join("\n\n===\n\n"); | ||
|
||
// console.trace(prompt); | ||
console.trace(prompt); | ||
|
||
return prompt; | ||
} |
This file contains 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