Cody AI by Sourcegraph
Cody is an AI code assistant that writes code and answers questions for you by reading your entire codebase and the code graph.
Status: beta (join the open beta)
Full documentation
Not the extension you're looking for? Download our Search extension.
Features
- 🤖 Chatbot that knows your code: Writes code and answers questions with knowledge of your entire codebase, following your project's code conventions and architecture better than other AI code chatbots.
- ✨ Fixup code: Interactively writes and refactors code for you, based on quick natural-language instructions.
- 📖 Recipes: Generates unit tests, documentation, and more, with full codebase awareness.
Usage
- Install the Cody VS Code extension.
- Open Cody (from the activity bar or by pressing Alt+//Opt+/) and sign in.
- Start using it! Read on to learn about the chatbot, fixups, and recipes.
🤖 Chatbot that knows your code
📽️ Demo
To start chatting with Cody, click on the Cody icon in the activity bar (or press Alt+//Opt+/, or run the Cody: Focus on Chat View
command).
Examples of the kinds of questions Cody can handle:
- How is our app's secret storage implemented on Linux?
- Where is the CI config for the web integration tests?
- Write a new GraphQL resolver for the AuditLog.
- Why is the UserConnectionResolver giving an error
unknown user
, and how do I fix it?
Cody tells you which code files it read to generate its response. (If Cody gives a wrong answer, please share feedback so we can improve it.)
✨ Fixup code
📽️ Demo
Just sprinkle your code with instructions in natural language, select the code, and run Cody: Fixup
(Ctrl+Alt+//Ctrl+Opt+/). Cody will figure out what edits to make.
Examples of the kinds of fixup instructions Cody can handle:
- "Factor out any common helper functions" (when multiple functions are selected)
- "Use the imported CSS module's class names"
- "Extract the list item to a separate React component"
- "Handle errors better"
- "Add helpful debug log statements"
- "Make this work" (seriously, it often works--try it!)
📖 Recipes
Select the recipes tab or right-click on a selection of code and choose one of the Ask Cody > ...
recipes, such as:
- Explain code
- Generate unit test
- Generate docstring
- Improve variable names
- Translate to different language
- Summarize recent code changes
- Detect code smells
- Generate release notes
We welcome PRs that contribute new, useful recipes.
Feedback
Development
See CONTRIBUTING.md.
License
Cody's code is open source (Apache License 2.0).