Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs/add updated documentation #17

Merged
merged 3 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion app/Services/ChatAssistant.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public function __construct(OnBoardingSteps $onBoardingSteps)
]);
}

/**
* @throws FatalRequestException
* @throws RequestException
*/
public function getCurrentProject(): Project
{
$projectPath = getcwd();
Expand Down Expand Up @@ -222,6 +226,10 @@ private function filterModels(Collection $models, string $value): array
: $models->take(5)->pluck('name')->toArray();
}

/**
* @throws FatalRequestException
* @throws RequestException
*/
private function selectExistingAssistant(): int
{
$assistants = Assistant::all();
Expand Down Expand Up @@ -292,4 +300,4 @@ private function ensureAPIKey(string $service): void
$this->onBoardingSteps->requestAPIKey($service);
}
}
}
}
1 change: 0 additions & 1 deletion docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export default defineConfig({
text: 'Contributing',
items: [
{ text: 'How to contribute', link: '/how-to-contribute' },
{ text: 'Architecture guide', link: '/architecture-guide' },
{ text: 'License', link: '/license' },
{ text: 'Donation', link: '/donation' }
]
Expand Down
42 changes: 27 additions & 15 deletions docs/features.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
# Features

🤖 Let me showcase my amazing features that will make your development experience smoother and more efficient. One thing I would like to mention is that I am as good as your input, if I miss something just be more specific and I will do magic! 🪄
🤖 Welcome to Droid Dev! Let's explore the powerful features that will make your development experience smoother and more efficient.

## Code Analysis
## Multiple AI Service Support

I can scan through your project files and folders to read and understand your code. This allows me to make context-aware changes that fit seamlessly into your existing codebase.
Droid Dev supports integration with multiple AI services, giving you the flexibility to choose the service and model that best fits your needs. Whether it's OpenAI, or another service, you can seamlessly switch and leverage different AI capabilities within your projects.

## Bug Fixing
## Project-Specific Assistants

Worried about bugs? Leave it to me! I automatically analyze your code to identify common issues and suggest or apply fixes, saving you time and effort. I mean with right inputs, I can do wonders!
- **Create Assistants for Each Project**: Easily create a new assistant for each of your projects using the `--new` parameter.
```sh
droid --new
```

## Test Writing
- **Diverse Assistants**: Each assistant can be configured differently with unique models, prompts, and AI services. This means you can have multiple assistants tailored to specific project requirements, all existing simultaneously.

Ensuring your code functions as expected is crucial. I generate comprehensive test cases based on your current code structure to help maintain high-quality code.
## Local Conversation Storage

## File Creation
All conversations are now stored locally in a SQLite database. This enhancement offers two primary benefits:
- **Cost Efficiency**: Reduces reliance on external API calls, thereby lowering costs.
- **Improved Speed**: Faster access to stored conversations enhances overall performance.

Need new files or components? I create them adhering to your project's existing patterns and conventions, ensuring consistency across your codebase.
## Key Capabilities

## Latest Features (Updated on 2024-07-07)
- **Code Analysis**: I can scan through your project files and folders to read and understand your code, making context-aware changes that fit seamlessly into your existing codebase.

- **Bug Fixing**: Automatically analyze your code to identify common issues and suggest or apply fixes, saving you time and effort.

- **Test Writing**: Generate comprehensive test cases based on your current code structure to help maintain high-quality code.

- **File Creation**: Create new files or components adhering to your project's existing patterns and conventions, ensuring consistency across the codebase.

- Ability to create a new assistant for each project.
- Moved away from Chat Assistants API to Chat Completions API.
- Stores conversations locally in a SQLite database.
- The database, config file, and cache files are stored in the `home directory/.droid`.
## Latest Enhancements (Updated on 2024-07-07)

Let's work together to build something amazing!
- **Assistant Creation**: Ability to create a new assistant for each project using the `--new` parameter.
- **Chat Completions API**: Transitioned from Assistants API to Chat Completions API for improved speed and cost efficiency.
- **Local Storage**: Conversations are now stored locally in a SQLite database. The database, config file, and cache files are stored in the `home directory/.droid`.

Let's work together to build something amazing!
10 changes: 9 additions & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,12 @@ Once installed, activate me with the following command:
droid
```

I will display all my available commands and options. Dive into the documentation to explore my full capabilities and features.
Running this command will start the onboarding process, allowing you to create an assistant by choosing a model, service, and prompt. The assistant will be created at the project level. If you want to create a new assistant at any time, you can pass the `--new` parameter:

```sh
droid --new
```

## Onboarding

During the onboarding process, you'll now have the ability to select your preferred AI service and the respective models. Additionally, conversations will be stored locally in a SQLite database for improved speed and cost efficiency. Follow the steps in the [Onboarding Guide](onboarding.md) to configure me for your project.
28 changes: 19 additions & 9 deletions docs/how-to-contribute.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


We appreciate your interest in contributing to droid.dev! There are several ways you can get involved in the project:

## Reporting Issues
Expand Down Expand Up @@ -46,23 +44,35 @@ We welcome pull requests! To submit a pull request, follow these steps:

To maintain consistency, please ensure your code adheres to the following standards:

- Follow the [JavaScript Standard Style](https://standardjs.com/).
- Follow the [PSR-12 Coding Standard](https://www.php-fig.org/psr/psr-12/).
- Use [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to automatically fix coding standards issues.
- Document your code thoroughly with comments.
- Write tests for new features and bug fixes.
- Write tests for new features and bug fixes using [PHPUnit](https://phpunit.de/).
- Ensure all tests pass before submitting a pull request.

## Improving Documentation

You can also contribute by improving our documentation. If you find any errors or areas that need clarification, follow these steps:

1. **Fork and Clone the Repository** (same steps as above).
2. **Navigate to the Documentation Directory:**
2. **Install Dependencies:**
```bash
cd docs
cd droid
npm install
```
3. **Make Your Changes:**
- Edit the markdown files to improve the content.
4. **Push Your Changes** and **Create a Pull Request** (same steps as above).

3. **Run the Documentation Locally:**
```bash
npm run docs:dev
```

This will start a local server using Vite, allowing you to view and edit the documentation in real-time.

4. **Editing Markdown Files:**
- The documentation is written in Markdown files located in the `docs` directory.
- Make your changes to the relevant `.md` files.

5. **Push Your Changes** and **Create a Pull Request** (same steps as above).

## Join the Community

Expand Down
6 changes: 4 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ layout: home
hero:
name: "Droid Dev"
text: "AI Driven Development"
tagline: "Automate your development tasks with ease"
tagline: "Automate your development tasks with ease using your preferred AI service"
actions:
- theme: brand
text: What is Droid Dev
Expand All @@ -26,4 +26,6 @@ features:
details: Writes test cases to ensure functionality.
- title: File Creation
details: Creates new files and adopts to your existing code structure.
---
- title: AI Service Integration
details: Supports multiple AI services and their respective models for enhanced flexibility.
---
97 changes: 74 additions & 23 deletions docs/onboarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,88 @@

Hello, human! Droid here to walk you through my setup process. Let's get started!

## Step 1: Configure API Key
## Step 1: Initialize the Onboarding Process

### Description
You'll need an OpenAI API key to authenticate your requests with OpenAI's services.
In your terminal, navigate to your project’s working directory. To begin the onboarding process, simply run the following command:

### Instructions to get OpenAI API Key
1. Navigate to the [OpenAI API Keys Dashboard](https://platform.openai.com/api-keys).
2. Sign in to your OpenAI account. If you don't have one, you'll need to create it first.
3. After signing in, click the **Create new secret key** button.
4. Copy the generated API key.
5. Enter the copied API key when I prompt you to do so.
```sh
droid
```

## Step 2: Select Default Model
Since this is your first time running the command, I will guide you through setting up a new assistant.

Choose a default model from the available options: `gpt-4o`, `gpt-4-turbo` and more. The model determines my capabilities and pricing.
## Step 2: Create a New Assistant

## Step 3: Define Prompt
You'll be prompted to create a new assistant. Here's what you'll need to provide:

A default prompt will be provided, which you can modify to suit your needs.
- Edit the prompt as required. You can add extra context or details to generate more accurate responses.
- Press `Ctrl + D` to save your changes.
1. **Assistant Name**: What should we call your assistant?

## Step 4: Create or Validate Assistant
Here, you'll create or verify the existence of your assistant.
Example: `MyFirstAssistant`

### Actions
If no assistant exists:
- I'll ask you if you want to create one.
- If you confirm, I'll create the assistant with your provided API key.
- If you decline, the onboarding process will end, but you can run the setup anytime.
2. **Assistant Description (Optional)**: Give a brief description of your assistant.

---
Example: `This assistant helps with daily coding tasks.`

## Step 3: Choose the AI Service and Model

1. **Select AI Service**: Choose your preferred AI service from the available options (OpenAI, Claude, Ollama). This selection will affect the models you can choose from.

2. **Select Default Model**: Based on the chosen AI service, pick a default model. The model defines my capabilities and costs. You can always create a new assistant with a different service and prompt later by running the `droid --new`.

## Step 4: Enter Your API Key

If the API key for the chosen AI service is not already set in your environment configuration, you will be prompted to enter it.

1. **Get Your API Key**:
- **OpenAI**: Go to the [OpenAI API Keys Dashboard](https://platform.openai.com/api-keys).
- **Claude**: Go to the [Claude API Keys Dashboard](https://claude.com/api-keys).

2. **Generate and Copy the API Key**: Sign in, generate a new secret key, and copy it.

3. **Enter the API Key**: Paste the copied API key when prompted. The key will be added to your environment configuration file.

## Step 5: Customize the Prompt

1. **Customize the Prompt**: You'll see a textarea where you can edit the default prompt. Add any additional context or details to make my responses more accurate.

### Default Prompt:
```md
You are an AI assistant called Droid, skilled in software development and code generation.
You will receive instructions on a feature request or bug fix.
Your task is to generate the necessary code changes for a web application to implement the feature and write the changes to the files.
Follow the workflow outlined below and use the provided tools to achieve the desired outcome.

Workflow
Understand the Feature Request

Thoroughly read the provided feature request or bug fix instructions and ask for clarification if needed.
List Existing Files and Directories to Understand the Codebase and Structure and if any framework is used.

Use the list_files function to list all files and subdirectories in the specified path to understand the current structure.
Create or Update Necessary Files

Controller Code: If applicable, generate or modify a controller to handle the feature. If the file already exists, use the read_file function to get the current content, apply the changes, and then use the update_file function.
Route Definitions: Define the necessary routes and ensure they are appended to the existing routes file without replacing existing content. Use read_file and update_file functions as needed.
Views: Generate or modify view files. Before creating new view files, use the list_files function to check the resources directory and understand any existing frontend technologies or design patterns. Use read_file to follow similar code styles and design. Reuse layouts and components where possible.
Model Code: If applicable, generate or modify models. Use read_file and update_file functions if the file exists.
Migrations: Create or modify database migrations.
Tests: Write feature tests to ensure the new functionality works as expected. Do not make changes to .env files.
Instructions to the user: Provide clear instructions on how to test the new feature or bug fix and suggest any additional manual steps needed like runnign a command.
Ensure that any new code is properly formatted and follows best practices. If existing files need to be modified, append the new code appropriately without overwriting the existing content.
Always provide the answers in html format when not using the tools provided.
```


Once you are satisfied with the prompt, save your changes.

## Step 6: Finalize the Setup

Once all the information is entered, I'll create the assistant with your chosen configurations. The assistant will be created at the project level.

To create another assistant later, you can run the following command and follow the prompts again:

```sh
droid --new
```

Follow these steps to effectively set me up for your project. Let's make development smoother together!
20 changes: 15 additions & 5 deletions docs/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

4. **Write To File**: Writes content to an existing file.

5. **Execute Command**: Executes a terminal command and returns the output. Use this when you need to execute a terminal command like git and other framework commands.

# Custom Tools

To add a custom tool, follow these steps:
Expand All @@ -21,10 +23,15 @@ Sample PHP Code:
```php
<?php

namespace App\Tools;
namespace App

tools;

use App\Attributes\Description;
use function Termwind\render;
use App
ttributes
description;
use function Termwind
ender;

#[Description('List all files and sub directories in the specified path. Use this when you need to list all files and directories.')]
final class ListFiles
Expand All @@ -40,6 +47,7 @@ final class ListFiles

?>
```

## Register the Custom Tool

To use the custom tool in ChatAssistant, follow these steps:
Expand All @@ -49,7 +57,9 @@ To use the custom tool in ChatAssistant, follow these steps:

```php
// Import the custom tool file inside ChatAssistant
use App\Tools\ListFiles;
use App
tools
deiles;

class ChatAssistant {
// Other code
Expand All @@ -69,4 +79,4 @@ class ChatAssistant {
}
}

```
```