Doriandarko / o1-engineer

o1-engineer is a command-line tool designed to assist developers in managing and interacting with their projects efficiently. Leveraging the power of OpenAI's API, this tool provides functionalities such as code generation, file editing, and project planning to streamline your development workflow.
2.83k stars 293 forks source link

🛠️ o1-engineer

Updated Features

A command-line tool designed to assist developers in managing and interacting with their projects efficiently. Leveraging the power of OpenAI's API, o1-engineer provides functionalities such as code generation, file editing, project planning, and code review to streamline your development workflow.

NEW

Added Grok Engineer to the repo. Make sure you add your XAI_API_KEY in your .env file. Added Streaming.

🛠️ Updated Features

✨ Features

💡 How the Script Works

  1. Initialization: The script initializes global variables and sets up the OpenAI client using the provided API key.

  2. Handling User Commands: It listens for user commands such as /edit, /create, /add, /review, and the new /planning command, processing them accordingly.

  3. Processing File and Folder Modifications: Based on the user's instructions, the script modifies files and folders, adds new content, or creates new files and folders as needed. The /add and /edit commands have been enhanced to support both files and folders, providing greater flexibility in project management.

  4. Project Planning: The newly introduced /planning command allows users to create comprehensive project plans, which the script can use to generate files and directories systematically using the /create command.

  5. AI-Generated Instructions: The tool interacts with OpenAI's API to generate instructions and suggestions for code generation, editing, project planning, and reviewing.

  6. Applying Changes: Changes are applied to the project files and folders based on the AI-generated instructions, ensuring that the project stays up-to-date and well-maintained.

  7. Managing Conversation History and Added Files: The script manages the conversation history and keeps track of files and folders added to the context, allowing users to reset or modify the history as needed.

📥 Installation

Prerequisites

🔧 Steps

  1. Clone the Repository:

    git clone https://github.com/doriandarko/o1-engineer.git
  2. Navigate to the Project Directory:

    cd o1-engineer
  3. Install Dependencies:

    pip install -r requirements.txt
  4. Configure APIs:

    Add your API key at the top of the script

    client = OpenAI(api_key="YOUR API")

📚 Usage

Launch the application using the following command:

python o1-eng.py

🎮 Available Commands

🚀 Advanced Workflows

Here's an example workflow that demonstrates using /planning followed by /create to generate files based on the created plan:

  1. Planning the Project:

    You: /planning Create a basic web application with the following structure:
    
    - A frontend folder containing HTML, CSS, and JavaScript files.
    
    - A backend folder with server-side scripts.
    
    - A README.md file with project documentation.
  2. Creating the Project Structure based on the Plan:

    You: /create Generate the project structure based on the above plan.

This demonstrates how to use the new /planning command to define a project structure, and then /create to generate the files and folders accordingly.

📝 Examples

You: /add src/main.py src/utils/helper.py src/models/

You: /planning Outline a RESTful API project with separate folders for models, views, and controllers.

You: /create Set up the basic structure for a RESTful API project with models, views, and controllers folders, including initial files.

You: /edit src/main.py src/models/user.py src/views/user_view.py

🤝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository.

  2. Create a new branch (git checkout -b feature/YourFeature).

  3. Commit your changes (git commit -m 'Add some feature').

  4. Push to the branch (git push origin feature/YourFeature).

  5. Open a pull request.

🙏 Acknowledgments

Star History

Star History Chart