Skip to content

Commit adc8274

Browse files
authored
Added first approach for documentation. (#341)
* Added first approach for documentation. * Documented repository configurations. * Improved configurations.md documentation.
1 parent a13b46d commit adc8274

File tree

14 files changed

+1594
-1035
lines changed

14 files changed

+1594
-1035
lines changed

.github/workflows/docs.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- '**'
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
publish:
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 30
18+
19+
steps:
20+
- name: Checkout current branch
21+
uses: actions/checkout@v4
22+
23+
- uses: astral-sh/setup-uv@v5
24+
with:
25+
python-version: '3.12'
26+
27+
- run: uv sync --group docs
28+
29+
- name: Set git credentials
30+
run: |
31+
git config --global user.name "${{ github.actor }}"
32+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
33+
34+
- run: uv run mike deploy dev --push
35+
if: github.ref == 'refs/heads/main'
36+
37+
- run: uv run mike deploy ${{ github.ref_name }} latest --update-aliases --push
38+
if: ${{ startsWith(github.ref, 'refs/tags/') }}

daiv/codebase/indexes.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ def update(self, repo_id: str, ref: str | None = None):
8383

8484
loader_limit_paths_to = []
8585

86-
try:
87-
with transaction.atomic():
88-
# For the default branch, the index is fully updated on the first run, otherwise,
89-
# For other branches, the index is updated only with changed files.
86+
with transaction.atomic():
87+
try:
88+
# If the namespace is new, the index is fully updated on the first run, after that,
89+
# the index is updated only with changed files.
9090
if not created and namespace.sha != repo_head_sha:
9191
new_files, changed_files, deleted_files = self.repo_client.get_commit_changed_files(
9292
namespace.repository_info.external_slug, namespace.sha, repo_head_sha
@@ -131,17 +131,17 @@ def update(self, repo_id: str, ref: str | None = None):
131131
if documents:
132132
self.semantic_search_engine.add_documents(namespace, documents)
133133
self.lexical_search_engine.add_documents(namespace, documents)
134-
except Exception:
135-
logger.exception("Error indexing repo %s[%s]", namespace.repository_info.external_slug, ref)
136-
namespace.status = CodebaseNamespace.Status.FAILED
137-
namespace.save(update_fields=["status", "modified"])
138-
else:
139-
namespace.status = CodebaseNamespace.Status.INDEXED
140-
namespace.save(update_fields=["status", "modified"])
141-
logger.info("Index finished for repo %s[%s]", namespace.repository_info.external_slug, ref)
142-
finally:
143-
# Clear the cache for the namespace retrieval as it might have changed
144-
self._get_codebase_namespace.cache_clear()
134+
except Exception:
135+
logger.exception("Error indexing repo %s[%s]", namespace.repository_info.external_slug, ref)
136+
namespace.status = CodebaseNamespace.Status.FAILED
137+
namespace.save(update_fields=["status", "modified"])
138+
else:
139+
namespace.status = CodebaseNamespace.Status.INDEXED
140+
namespace.save(update_fields=["status", "modified"])
141+
logger.info("Index finished for repo %s[%s]", namespace.repository_info.external_slug, ref)
142+
finally:
143+
# Clear the cache for the namespace retrieval as it might have changed
144+
self._get_codebase_namespace.cache_clear()
145145

146146
def _delete_documents(self, repo_id: str, ref: str, source_files: list[str]):
147147
"""
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 💬 Code Review Addressor
2+
3+
The Code Review Addressor is an AI agent that assists with code review comments. It provides context-aware answers or directly applies requested changes to the code. This reduces the overhead of going back and forth on merge requests.
4+

docs/ai-agents/codebase-chat.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 🧠 Codebase Chat
2+
3+
The Codebase Chat is a feature that allows you to chat with your codebase. It is a ChatGPT-like experience to chat with your codebase and get answers.
4+

docs/ai-agents/issue-addressor.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 🚀 Issue Addressor
2+
3+
The Issue Addressor is an AI agent that assists with issue implementation. It provides a step-by-step plan to address the issue. After the plan is approved, it can execute the code changes and open a merge request for you to review.
4+
5+

docs/ai-agents/pipeline-fixing.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 🔧 Pipeline Fixing
2+
3+
The Pipeline Fixer is an AI agent that troubleshoots failed pipelines and tries to fix them automatically.
4+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Supported Providers
2+
3+
DAIV currently has integrated support for the following providers:
4+
5+
- [OpenRouter](https://openrouter.ai)
6+
- [OpenAI](https://openai.com)
7+
- [Anthropic](https://anthropic.com)
8+
- [Gemini](https://gemini.google.com)
9+
10+
## OpenRouter
11+
12+
## OpenAI
13+
14+
## Anthropic
15+
16+
## Gemini
17+

docs/community.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Community
2+
3+
DAIV is a community-driven project. We greatly appreciate contributions from you. This document describes the different ways you can contribute to DAIV.
4+
5+
## Contributing
6+
7+
[WIP]
8+
9+
## Reporting Issues
10+
11+
[WIP]
12+

docs/configurations.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Configurations
2+
3+
Customize DAIV for your repository using a `.daiv.yml` file.
4+
5+
This file lets you control features, code formatting, and more.
6+
7+
## Example Configuration
8+
9+
Below is a complete example of a `.daiv.yml` file.
10+
11+
You can copy and modify this template for your repository.
12+
13+
```yaml
14+
# Repository settings
15+
default_branch: main
16+
repository_description: "Python web application using Django and React. Follows PEP 8 standards and the Airbnb style guide for JavaScript."
17+
branch_name_convention: "Use 'feat/' for features, 'fix/' for bugfixes, 'docs/' for documentation"
18+
19+
# Feature toggles
20+
features:
21+
auto_address_review_enabled: true
22+
auto_address_issues_enabled: true
23+
autofix_pipeline_enabled: true
24+
25+
# Code management
26+
extend_exclude_patterns:
27+
- "**/tests/**"
28+
- "**/*.test.ts"
29+
- "coverage/**"
30+
- "*.min.js"
31+
32+
# Sandbox commands
33+
commands:
34+
base_image: "python:3.12-alpine"
35+
install_dependencies: "pip install -r requirements.txt"
36+
format_code: "ruff check --fix && ruff format"
37+
```
38+
39+
## Configure Repository Settings
40+
41+
Repository settings control the default branch, repository description, and branch naming convention.
42+
43+
| Option | Type | Default | Description |
44+
|--------------------------|--------|------------------------|-----------------------------------------------------------------------------|
45+
| `default_branch` | `str | null` | Repository default branch | The branch DAIV uses by default to load the `.daiv.yml` file. |
46+
| `repository_description` | `str` | `""` | A brief description to help agents understand your repository. Max 400 chars. |
47+
| `branch_name_convention` | `str` | `"always start with 'daiv/' followed by a short description."` | Naming convention for generating pull request branches. |
48+
49+
!!! tip
50+
- Use clear and simple branch-naming conventions.
51+
- Keep descriptions concise and informative.
52+
53+
54+
## Enable or Disable Features
55+
56+
Control which DAIV features are active in your repository.
57+
58+
Under your `.daiv.yml` file's `features:` section, configure the following keys:
59+
60+
| Feature | Type | Default | Description |
61+
|-----------------------------------|---------|---------|------------------------------------------------------------------|
62+
| `auto_address_review_enabled` | `bool` | `true` | Enable the [code review addressor agent](ai-agents/code-review-addressor.md). |
63+
| `auto_address_issues_enabled` | `bool` | `true` | Enable the [issue addressor agent](ai-agents/issue-addressor.md). |
64+
| `autofix_pipeline_enabled` | `bool` | `true` | Enable the [pipeline fixing agent](ai-agents/pipeline-fixing.md). |
65+
66+
!!! tip
67+
Disable features you do not need to reduce noise and speed up processing.
68+
69+
## Customize Code Indexing
70+
71+
Control which files DAIV indexes for context.
72+
73+
!!! warning
74+
Files excluded from indexing will not be available to DAIV's AI agents.
75+
76+
| Option | Type | Default | Description |
77+
|--------------------------|---------|------------------------|-----------------------------------------------------------------------------|
78+
| `extend_exclude_patterns` | `list[str]` | `[]` | Add patterns to exclude more files from indexing. |
79+
| `exclude_patterns` | `list[str]` | `["*package-lock.json", "*.lock", "*.svg", "*.pyc", "*.log", "*.zip", "*.coverage", "*.sql", "**/.git/**", "**/.mypy_cache/**", "**/.tox/**", "**/vendor/**", "**/venv/**", "**/.venv/**", "**/.env/**", "**/node_modules/**", "**/dist/**", "**/__pycache__/**", "**/data/**", "**/.idea/**", "**/.pytest_cache/**", "**/.ruff_cache/**"]` | Override the default exclude patterns. |
80+
81+
!!! tip
82+
Exclude sensitive files and build artifacts.
83+
Prefer using `extend_exclude_patterns` to add more patterns.
84+
85+
## Set Up Sandbox Commands
86+
87+
To use sandbox commands, you must have a `daiv-sandbox` instance running (see the [daiv-sandbox](https://github.com/srtab/daiv-sandbox) repository for more information), and **all three options below (`base_image`, `install_dependencies`, and `format_code`) must be set**.
88+
89+
Under your `.daiv.yml` file's `commands:` section, configure the following keys:
90+
91+
| Option | Type | Default | Description |
92+
|-----------------------|--------|---------|-----------------------------------------------------------|
93+
| `base_image` | `str` | `null` | Docker image for the sandbox. Use distro images only. |
94+
| `install_dependencies`| `str` | `null` | Command to install project dependencies. |
95+
| `format_code` | `str` | `null` | Command to format code before committing. |
96+
97+
**Here's how it works:**
98+
99+
Before **committing code generated by DAIV**, DAIV will call `daiv-sandbox` to:
100+
101+
- Create a container from the `base_image`.
102+
- Execute the `install_dependencies` command in the container.
103+
- Execute the `format_code` command in the container after the `install_dependencies` command executed successfully.
104+
105+
!!! warning
106+
If any of the commands fail, DAIV will commit the code as is to be manually fixed, if needed.
107+
108+
!!! tip
109+
Use specific image versions for reproducibility.

docs/getting-started.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Getting Started
2+
3+
## Installation
4+
5+
[WIP]
6+
7+
## Environment Variables
8+
9+
[WIP]
10+
11+
## Usage
12+
13+
[WIP]

0 commit comments

Comments
 (0)