Parroty: AI Documentation Assistant
About The Project
Parroty is an innovative Visual Studio Code extension designed to streamline the documentation process for developers. Leveraging the power of Google's Generative AI (Gemini), Parroty acts as an intelligent assistant that helps you generate various forms of documentation directly within your VS Code environment. Whether you need quick code comments, comprehensive function docstrings, or even an initial README.md
for your project, Parroty aims to reduce the manual effort involved in keeping your codebase well-documented and understandable.
Getting Started
To get a local copy of Parroty up and running, follow these steps. This project consists of a Python backend that interacts with the AI model and a TypeScript-based VS Code extension.
Prerequisites
Ensure you have the following software installed on your system:
- Node.js & npm: For building and running the VS Code extension.
- LTS version recommended. You can download it from nodejs.org.
- Verify installation:
node -v
npm -v
- Python 3.8+ & pip: For the AI backend.
- Download from python.org.
- Verify installation:
python3 -V
pip3 -V
- Visual Studio Code: The editor for which this extension is developed.
- Google Gemini API Key: Parroty uses the Google Gemini API.
Installation
Clone the repository:
git clone https://github.com/DouglasC2627/parroty.git
cd parroty
Run the setup script:
The project includes a setup.sh
script to automate the installation of dependencies for both the backend and the extension.
chmod +x setup.sh
./setup.sh
This script will attempt to set up a Python virtual environment for the backend and install Node.js dependencies for the extension.
Manual Installation (if setup.sh
fails or for detailed control):
- Backend Setup:
Navigate to the
backend
directory, create a virtual environment, activate it, and install Python dependencies:
cd backend
python3 -m venv venv
source venv/bin/activate # On Windows, use `.\venv\Scripts\activate`
pip install -r requirements.txt
cd .. # Go back to the root directory
- VS Code Extension Setup:
Navigate to the
extension
directory and install Node.js dependencies:
cd extension
npm install
npm run compile # This builds the extension's JavaScript files
cd .. # Go back to the root directory
Usage
Once installed, you can launch and use the Parroty extension within VS Code.
Open the Project in VS Code:
Open the root parroty
folder in Visual Studio Code.
Configure Gemini API Key:
The extension requires your Google Gemini API key to function.
- Open VS Code Settings (
File > Preferences > Settings
or Code > Preferences > Settings
on macOS, or Ctrl+,
/ Cmd+,
).
- Search for "Parroty".
- Locate the
Parroty: Gemini Api Key
setting and paste your Google Gemini API key into the input field.
Run the Extension (for development):
If you are running from source for development:
- Go to the Run and Debug view (
Ctrl+Shift+D
or Cmd+Shift+D
).
- Select "Run Extension" from the dropdown at the top.
- Click the green play button. This will launch a new VS Code window (Extension Development Host) with the Parroty extension activated.
Using the AI Documentation Assistant:
Generate Comment:
- Select a block of code (function, class, or a few lines) in your active editor.
- Right-click on the selection.
- Choose "Parroty > Generate Comment" from the context menu.
- The AI will generate a comment or a brief explanation for the selected code.
Generate Docstring:
- Place your cursor inside a function or class definition.
- Right-click.
- Choose "Parroty > Generate Docstring".
- The AI will attempt to generate a suitable docstring for the selected code element.
Generate README.md
:
- Open the Command Palette (
Ctrl+Shift+P
or Cmd+Shift+P
).
- Type "Parroty" and select "Parroty > Generate README.md".
- The extension will analyze your open project and generate a draft
README.md
file based on its understanding of the project structure and content. This will be created in your project's root directory.
Contributing
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also open an issue with the tag "enhancement".
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
)
- Commit your Changes (
git commit -m 'Add some AmazingFeature'
)
- Push to the Branch (
git push origin feature/AmazingFeature
)
- Open a Pull Request