- Overview
- Features
- Installation
- Configuration
- Usage
- Mitigating Common Issues in Automated Code Development
- Todo List
- Contributing
- License
The Automated Code Development Assistant is a Python-based tool designed to streamline and enhance the software development process. By leveraging the power of the Groq API (compatible with OpenAI's GPT models) and ensuring Aider compatibility, this script assists developers in tasks such as implementing features, debugging, optimizing code, and generating coding conventions.
- Enhance Developer Productivity: Automate repetitive and time-consuming tasks to allow developers to focus on more critical aspects of software development.
- Maintain Code Quality: Generate and enforce coding standards through automated documentation and code reviews.
- Ensure Compatibility and Flexibility: Support integration with various Language Learning Models (LLMs) and automated coding assistance tools, promoting a versatile development environment.
- Mitigate Risks of LLMs Overriding Code Logic: Address the challenge where LLMs may unintentionally alter or override existing code logic during automated processes, ensuring that critical codebases remain intact and function as intended.
- Facilitate Seamless Collaboration: Provide interactive prompts and documentation that aid in team collaboration and knowledge sharing.
Aider is an advanced AI-driven development tool that enhances coding efficiency and accuracy. This assistant is designed to be Aider compatible, meaning it can seamlessly integrate with Aider's ecosystem to provide enhanced functionalities such as intelligent code suggestions, real-time error detection, and automated refactoring. By ensuring compatibility, the Automated Code Development Assistant allows developers to leverage the strengths of both tools, creating a more robust and efficient development workflow.
While Large Language Models (LLMs) like those provided by OpenAI offer powerful capabilities in automated code generation and assistance, they come with the inherent risk of inadvertently overriding or altering existing code logic. This can lead to unintended behaviors, bugs, or even security vulnerabilities within the software. The Automated Code Development Assistant tackles this issue through:
- Selective File Processing: Users can designate sensitive files that should remain untouched, preventing LLMs from making unintended modifications.
- Interactive Prompts: By involving the developer in the decision-making process through prompts, the assistant ensures that changes align with the developer's intentions.
- Contextual Awareness: Incorporating context from
context.txt
helps the LLM understand the existing codebase better, reducing the likelihood of conflicting changes. - Comprehensive Documentation: Generating detailed documentation like
CONVENTIONS.md
ensures that coding standards are maintained, guiding the LLM to adhere to predefined guidelines.
These measures collectively help maintain the integrity of the codebase while benefiting from the automation and assistance provided by LLMs.
- API Key Management: Ensures secure access by verifying the presence of the
GROQ_API_KEY
environment variable. - Interactive File Selection: Allows users to select specific files for processing and designate sensitive files that should remain unmodified.
- Action-Focused Prompts: Guides users to select actions (e.g., Implement, Debug), focus areas (e.g., Login System, API Endpoint), and subjects (e.g., Python, Vue.js) to tailor the assistance provided.
- Contextual Prompts: Incorporates contextual information from a
context.txt
file to provide more accurate and relevant assistance. - Conventions Documentation: Automatically generates or updates a
CONVENTIONS.md
file based on user inputs and task descriptions to enforce coding standards. - Interactive Assistant Loop: Engages in a conversational loop with the user, asking clarifying questions and refining outputs until the task is satisfactorily addressed.
- User-Agent Verification: Retrieves and displays the current user-agent string for transparency in API interactions.
- Aider Compatibility: Seamlessly integrates with Aider, enhancing functionalities such as intelligent code suggestions and real-time error detection.
- Multi-LLM Support: Designed to accommodate integration with various LLMs and automated coding assistance tools, providing flexibility and versatility.
-
Clone the Repository
git clone https://github.com/yourusername/automated-code-dev-assistant.git cd automated-code-dev-assistant
-
Create a Virtual Environment (Optional but Recommended)
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
If
requirements.txt
is not provided, install the necessary packages manually:pip install requests questionary inquirer
-
Set the Groq API Key
The script requires a Groq API key to interact with the Groq/OpenAI API. Set the
GROQ_API_KEY
environment variable:-
Unix/Linux/macOS
export GROQ_API_KEY='your_api_key_here'
-
Windows (Command Prompt)
set GROQ_API_KEY=your_api_key_here
-
Windows (PowerShell)
$env:GROQ_API_KEY = "your_api_key_here"
Alternatively, you can add this line to your shell profile (e.g.,
.bashrc
,.zshrc
) to set it permanently. -
-
Prepare Context File
Create a
context.txt
file in the script's directory containing any relevant context or background information that the assistant might need to provide more accurate assistance.nano context.txt
Add your context information and save the file.
-
Run the Script
python groq_code_development_assistant.py
Replace
groq_code_development_assistant.py
with the actual name of the Python script. -
Follow the Interactive Prompts
- Select an Action: Choose from options like Implement, Debug, Optimize, etc.
- Select a Focus: Select the specific area of focus such as Login System, API Endpoint, etc.
- Select a Subject: Choose the programming language or framework involved.
- Select Files: Choose which files in the current directory and subdirectories to include in the process.
- Specify Sensitive Files: Designate files that should not be modified.
- Provide Intent: Describe the intent or goal of the changes you intend to make.
-
Review Generated Files
initial_prompt.md
: Contains the structured prompt sent to the assistant.CONVENTIONS.md
: Generated or updated coding conventions based on your inputs.prompt.txt
: Stores the assistant's replies for reference.
-
Interactive Assistant Loop
The script engages in a conversational loop with the assistant. If the assistant asks a question, respond accordingly. Type
'exit'
to terminate the session. -
Manual Review
After execution, manually review the generated files to ensure accuracy and relevance before proceeding with any code changes.
Automated code development tools, while powerful, can introduce several challenges. This script incorporates several strategies to mitigate common issues:
-
API Key Verification
- Issue: Unauthorized access or accidental exposure of API keys.
- Mitigation: The script checks for the presence of the
GROQ_API_KEY
environment variable before execution, ensuring that the key is set securely and reducing the risk of accidental exposure.
-
Selective File Processing
- Issue: Unintended modifications to critical or sensitive files can break the application.
- Mitigation: Users can specify sensitive files that the script should not modify, safeguarding important parts of the codebase.
-
Contextual Awareness
- Issue: Lack of context can lead to irrelevant or incorrect suggestions.
- Mitigation: By incorporating a
context.txt
file, the assistant gains a better understanding of the project's specifics, leading to more accurate and relevant assistance.
-
Interactive Prompts
- Issue: Automated tools might make incorrect assumptions about developer intentions.
- Mitigation: The script uses interactive prompts to gather precise information about the desired actions, focus areas, and subjects, ensuring that the assistance provided aligns with the developer's actual needs.
-
Documentation Generation
- Issue: Inconsistent coding standards can lead to maintenance challenges.
- Mitigation: Automatically generating or updating a
CONVENTIONS.md
file enforces coding standards and best practices, promoting consistency across the codebase.
-
Error Handling
- Issue: Unhandled errors can cause the script to fail silently or behave unpredictably.
- Mitigation: The script includes comprehensive error handling, such as checking for the existence of necessary files and handling API response errors gracefully.
-
User-Agent Transparency
- Issue: Lack of transparency in API interactions can complicate debugging and security audits.
- Mitigation: The script retrieves and displays the current user-agent string used in API requests, enhancing transparency and aiding in troubleshooting.
-
Preventing LLMs from Overriding Code Logic
- Issue: LLMs may unintentionally modify or override existing code logic, leading to bugs or security vulnerabilities.
- Mitigation: Through selective file processing, contextual awareness, and interactive prompts, the script ensures that critical code segments remain untouched unless explicitly intended by the developer.
Enhancing the Automated Code Development Assistant is an ongoing process. Below is a list of planned features and improvements:
-
Enhanced Security Features
- Encrypt sensitive configuration files.
- Implement OAuth2 for secure API authentication.
-
Support for Multiple APIs
- Integrate with other AI models and APIs for broader functionality.
-
Advanced File Management
- Implement version control integration (e.g., Git hooks) to automate certain tasks.
- Add functionality to exclude directories or file types via configuration.
-
Improved User Interface
- Develop a graphical user interface (GUI) for a more user-friendly experience.
- Implement command-line arguments for non-interactive usage.
-
Extended Documentation Generation
- Automatically generate additional documentation files such as
README.md
,CHANGELOG.md
, etc. - Support for customizable documentation templates.
- Automatically generate additional documentation files such as
-
Task Automation
- Automate repetitive tasks like testing, linting, and deployment based on user inputs.
-
Logging and Reporting
- Implement detailed logging for easier debugging and auditing.
- Generate reports summarizing the changes and suggestions made by the assistant.
-
Internationalization
- Support multiple languages for broader accessibility.
-
Plugin Architecture
- Allow users to develop and integrate custom plugins to extend functionality.
-
Performance Optimization
- Optimize the script for faster execution and lower resource consumption.
-
Multi-LLM Support
- Extend compatibility to support various LLMs beyond Groq, providing flexibility in choosing preferred AI models.
-
Aider Integration Enhancements
- Deepen integration with Aider to leverage its advanced features fully.
-
Community Contributions
- Encourage and incorporate contributions from the developer community to expand feature sets and improve existing functionalities.
Contributions are welcome! If you have ideas for new features, bug fixes, or improvements, please open an issue or submit a pull request.
-
Fork the Repository
-
Create a New Branch
git checkout -b feature/YourFeature
-
Commit Your Changes
git commit -m "Add your message here"
-
Push to the Branch
git push origin feature/YourFeature
-
Open a Pull Request
Please ensure that your contributions adhere to the project's coding standards and include relevant tests where applicable.
This project is licensed under the MIT License.
Please note: This script is still in development. While it aims to assist with automated code development, it's essential to manually review all generated files and changes to ensure accuracy and adherence to your project's standards. Additionally, integration with other LLMs and automated coding assistance tools is encouraged to enhance the tool's versatility and effectiveness.