-
Notifications
You must be signed in to change notification settings - Fork 739
CHALLENGE: show me your best wiki prompt #231
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?
Conversation
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.
Summary of Changes
Hello @sng-asyncfunc, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request focuses on enhancing the AI's ability to generate high-quality, technically detailed, and well-structured wiki documentation. The changes primarily involve refining the prompts that guide the AI in both determining the overall wiki structure and generating the content for individual wiki pages, aiming for deeper technical insight and better source traceability.
Highlights
- Enhanced Wiki Page Generation Prompt: I've significantly updated the prompt for generating individual wiki pages to ensure the content is unique, non-overlapping, and provides deep technical analysis. This includes new instructions for focusing on specific implementation details, architectural decisions, and concrete code examples, as well as how components integrate.
- Improved Wiki Structure Determination Prompt: The prompt used to determine the overall wiki structure has been expanded into a multi-step process. It now guides the AI to perform a more thorough repository analysis, architectural understanding, and a design for a wiki structure that offers deep technical insight, rather than superficial overviews.
- Intelligent File Mapping and Source Citation: New instructions have been added for intelligent file mapping, requiring the AI to identify at least 8-10 highly relevant source files for each wiki page. Additionally, source citations within the generated wiki content will now include proper, clickable GitHub URLs for better traceability.
- New Utility for GitHub File URLs: I've introduced a
createFileUrl
helper function to dynamically generate correct GitHub file URLs, which is used for both the initial list of relevant files and for in-line source citations within the generated wiki content.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
The pull request introduces significant improvements to wiki generation, including detailed prompts and a helper function for creating GitHub URLs. Key areas for improvement include addressing the hardcoded branch name, optimizing performance with a map lookup, and enhancing security by storing tokens securely.
const createFileUrl = useCallback((filePath: string) => { | ||
if (effectiveRepoInfo.type === 'local') { | ||
// For local repos, just return the path as-is | ||
return filePath; | ||
} else if (effectiveRepoInfo.repoUrl && effectiveRepoInfo.repoUrl.includes('github.com')) { | ||
// For GitHub repos, create proper GitHub file URL | ||
const baseUrl = effectiveRepoInfo.repoUrl.replace(/\.git$/, ''); | ||
return `${baseUrl}/blob/main/${filePath}`; | ||
} else if (effectiveRepoInfo.owner && effectiveRepoInfo.repo && effectiveRepoInfo.type === 'github') { | ||
// Fallback for GitHub repos without full URL | ||
return `https://github.com/${effectiveRepoInfo.owner}/${effectiveRepoInfo.repo}/blob/main/${filePath}`; | ||
} else { | ||
// For other repo types or unknown, just return the path | ||
return filePath; | ||
} | ||
}, [effectiveRepoInfo]); |
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.
const relatedPagesContext = page.relatedPages | ||
.map(relatedId => { | ||
const relatedPage = wikiStructure?.pages.find(p => p.id === relatedId); | ||
return relatedPage ? `- ${relatedPage.title}: ${relatedPage.description || 'No description'}` : ''; | ||
}) | ||
.filter(Boolean) | ||
.join('\n'); |
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 .find()
method inside .map()
results in O(M*N) complexity. For large wikis, this could be slow. Create a Map
of pages by ID for O(1) lookup.
// For performance, create a map of pages for faster lookups.
const pagesById = new Map(wikiStructure?.pages.map(p => [p.id, p]));
const relatedPagesContext = page.relatedPages
.map(relatedId => {
const relatedPage = pagesById.get(relatedId);
return relatedPage ? `- ${relatedPage.title}: ${relatedPage.description || 'No description'}` : '';
})
.filter(Boolean)
.join('\n');
@@ -414,7 +452,7 @@ Based ONLY on the content of the \`[RELEVANT_SOURCE_FILES]\`: | |||
6. **Source Citations (EXTREMELY IMPORTANT):** | |||
* For EVERY piece of significant information, explanation, diagram, table entry, or code snippet, you MUST cite the specific source file(s) and relevant line numbers from which the information was derived. | |||
* Place citations at the end of the paragraph, under the diagram/table, or after the code snippet. | |||
* Use the exact format: \`Sources: [filename.ext:start_line-end_line]()\` for a range, or \`Sources: [filename.ext:line_number]()\` for a single line. Multiple files can be cited: \`Sources: [file1.ext:1-10](), [file2.ext:5](), [dir/file3.ext]()\` (if the whole file is relevant and line numbers are not applicable or too broad). | |||
* Use the exact format with proper GitHub URLs: For GitHub repositories, use \`Sources: [filename.ext:start_line-end_line](https://github.com/${effectiveRepoInfo.owner}/${effectiveRepoInfo.repo}/blob/main/filename.ext#Lstart_line-Lend_line)\` for a range, or \`Sources: [filename.ext:line_number](https://github.com/${effectiveRepoInfo.owner}/${effectiveRepoInfo.repo}/blob/main/filename.ext#Lline_number)\` for a single line. For local repositories, use \`Sources: [filename.ext:start_line-end_line]()\`. Multiple files can be cited: \`Sources: [file1.ext:1-10](URL1), [file2.ext:5](URL2), [dir/file3.ext](URL3)\` (if the whole file is relevant and line numbers are not applicable or too broad). |
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.
So we opened up this branch: challenge/best-wiki-prompt
Not to talk.
But to test.
This is where you drop your best prompt.
The one you’d bet on in a zero-shot showdown.
The one that makes DeepWiki look like it actually gets it.
💡 How to contribute:
Add your prompt to /challenges/best-wiki-prompt-[your name] PR.
Briefly explain what it’s supposed to do and why it’s powerful.
Submit your PR to this branch
We’re not picking a winner right now. But everyone will know who showed up.
Let the wiki whisperers step forward.
P/S: This PR contains a simple example of improved Wiki prompt