Codex is a Chrome extension that helps developers understand GitHub repositories using AI. It provides summaries of repositories and explanations of code files, leveraging Chrome's built-in AI capabilities or an external API for more detailed analysis.
-
Repository Summarization: Get concise summaries of GitHub repositories, including overviews, main features, technical architecture, and getting started guides.
-
File Explanation: Understand specific code files on GitHub. Optionally select additional files for context to get more comprehensive explanations.
-
AI Chat Interface: Engage in a conversation with the AI to ask questions and receive further explanations about the repository or code.
-
Dual AI Options:
- Built-in AI Model: Uses Chrome's built-in AI capabilities for on-device analysis.
- External API (Gemini): Sends data to an external API for a more powerful analysis (requires additional setup).
-
Chrome Version: Ensure you are using Chrome Dev Channel or Chrome Canary, version 128.0.6545.0 or newer.
-
Enable Built-in AI and Prompt API:
-
Open Chrome and navigate to
chrome://flags/#optimization-guide-on-device-model.- Set Enable optimization guide on-device model downloads to Enabled BypassPerfRequirement.
-
Navigate to
chrome://flags/#prompt-api-for-gemini-nano.- Set Enable the Prompt API for Gemini Nano to Enabled.
-
Click Relaunch to restart Chrome.
-
-
Confirm Availability of Gemini Nano:
-
Open DevTools (press
Ctrl+Shift+IorCmd+Option+I). -
In the console, run:
(await ai.languageModel.capabilities()).available; ```
-
If it returns
"readily", you are all set. -
If it does not, follow these steps:
-
Run
await ai.languageModel.create();in the console (this may fail, which is expected). -
Restart Chrome.
-
Go to
chrome://componentsand check for updates for Optimization Guide On Device Model. -
Wait for the model to download, then retry checking availability.
-
-
-
Download the Extension:
- Clone or download this repository to your local machine.
-
Load the Extension in Chrome:
-
Open Chrome and navigate to
chrome://extensions/. -
Enable Developer mode by toggling the switch in the upper right corner.
-
Click Load unpacked and select the directory containing the extension's files.
-
-
Set Up Trial Tokens:
-
Important: Obtain your own trial token for the AI Language Model Origin Trial.
-
Acknowledge Google’s Generative AI Prohibited Uses Policy.
-
Visit the Chrome Origin Trials Registration page.
-
Register for the AI Language Model Origin Trial.
-
-
Add Token to
manifest.json:-
Open
manifest.jsonin the extension directory. -
Replace the placeholder in the
"trial_tokens"field with your trial token:"trial_tokens": ["YOUR_TRIAL_TOKEN_HERE"] ```
Note: Do not share or publish your trial token.
-
-
-
Navigate to GitHub:
- Open GitHub and go to a repository or file you want to analyze.
-
Open Codex Extension:
- Click on the Codex extension icon in the Chrome toolbar.
-
Select an Option:
-
Get repo summary with Built-in Model: Provides a summary using Chrome's built-in AI capabilities.
-
Get detailed repo summary with External model (Gemini): Provides a more detailed analysis using an external API (requires additional setup).
-
Explain Current File: Provides an explanation of the current code file. You can optionally select additional files for context.
-
-
Interact with the AI:
-
After the initial analysis, a chat interface will appear.
-
Type your questions or requests in the input box and click Send.
-
The AI assistant will respond, and you can continue the conversation as needed.
-
To use the external API option (e.g., Gemini), you may need to set up access to the API and update the extension code with your API endpoint and credentials.
-
Set Up API Access:
- Follow the provider's instructions to obtain access to the API.
-
Update Extension Code:
-
Open
sidepanel/panel.jsin the extension directory. -
Locate the
analyzeWithApifunction. -
Replace the
API_ENDPOINTwith your API's endpoint URL.const API_ENDPOINT = 'https://your-api-endpoint.com/analyze'; ```
-
Add any necessary headers or authentication as required by the API.
-
Contributions are welcome! Please open an issue or submit a pull request with your improvements.
This extension uses experimental features and APIs that are subject to change. Use at your own risk.
-
Built using the Chrome Extensions framework with the Prompt API for AI capabilities.
-
AI models powered by Chrome's built-in AI and external APIs.