codeaois 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codeaois-0.1.0/PKG-INFO +232 -0
- codeaois-0.1.0/README.md +220 -0
- codeaois-0.1.0/codeaois/__init__.py +0 -0
- codeaois-0.1.0/codeaois/agents/3d_agent.py +23 -0
- codeaois-0.1.0/codeaois/agents/coder_agent.py +25 -0
- codeaois-0.1.0/codeaois/agents/data_science_agent.py +24 -0
- codeaois-0.1.0/codeaois/agents/database_agent.py +23 -0
- codeaois-0.1.0/codeaois/agents/debugging_agent.py +23 -0
- codeaois-0.1.0/codeaois/agents/devops_agent.py +23 -0
- codeaois-0.1.0/codeaois/agents/git_agent.py +45 -0
- codeaois-0.1.0/codeaois/agents/tester_agent.py +27 -0
- codeaois-0.1.0/codeaois/app.py +1 -0
- codeaois-0.1.0/codeaois/brain/__init__.py +0 -0
- codeaois-0.1.0/codeaois/brain/embeddings.py +27 -0
- codeaois-0.1.0/codeaois/brain/memory.py +10 -0
- codeaois-0.1.0/codeaois/brain/scanner.py +49 -0
- codeaois-0.1.0/codeaois/cli/__init__.py +0 -0
- codeaois-0.1.0/codeaois/cli/main.py +351 -0
- codeaois-0.1.0/codeaois/config/settings.py +0 -0
- codeaois-0.1.0/codeaois/core/context.py +39 -0
- codeaois-0.1.0/codeaois/core/marketplace.py +65 -0
- codeaois-0.1.0/codeaois/core/memory.py +65 -0
- codeaois-0.1.0/codeaois/core/orchestrator.py +23 -0
- codeaois-0.1.0/codeaois/core/planner.py +51 -0
- codeaois-0.1.0/codeaois/core/router.py +6 -0
- codeaois-0.1.0/codeaois/models/llm_interface.py +89 -0
- codeaois-0.1.0/codeaois/utils/file_writer.py +65 -0
- codeaois-0.1.0/codeaois/utils/logger.py +5 -0
- codeaois-0.1.0/codeaois.egg-info/PKG-INFO +232 -0
- codeaois-0.1.0/codeaois.egg-info/SOURCES.txt +35 -0
- codeaois-0.1.0/codeaois.egg-info/dependency_links.txt +1 -0
- codeaois-0.1.0/codeaois.egg-info/entry_points.txt +2 -0
- codeaois-0.1.0/codeaois.egg-info/requires.txt +2 -0
- codeaois-0.1.0/codeaois.egg-info/top_level.txt +1 -0
- codeaois-0.1.0/pyproject.toml +22 -0
- codeaois-0.1.0/setup.cfg +4 -0
- codeaois-0.1.0/setup.py +37 -0
codeaois-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codeaois
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Advanced AI Developer OS
|
|
5
|
+
Author: Nikhil Nagar
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: requests
|
|
9
|
+
Requires-Dist: python-dotenv
|
|
10
|
+
Dynamic: author
|
|
11
|
+
Dynamic: requires-python
|
|
12
|
+
|
|
13
|
+
# CodeAOIS
|
|
14
|
+
|
|
15
|
+
### Advanced AI Developer Operating System
|
|
16
|
+
|
|
17
|
+
CodeAOIS is an experimental **AI-powered developer operating system** that allows developers to interact with an AI coding system directly from the terminal.
|
|
18
|
+
|
|
19
|
+
Instead of simple autocomplete tools, CodeAOIS acts like an **AI developer partner** capable of understanding instructions, generating code, and managing development workflows.
|
|
20
|
+
|
|
21
|
+
The system is designed around a **multi-agent architecture** where specialized agents collaborate to perform tasks such as coding, testing, and project management.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# ✨ Features
|
|
26
|
+
|
|
27
|
+
• Natural language coding from terminal
|
|
28
|
+
• Multi-agent AI architecture
|
|
29
|
+
• Automatic code generation
|
|
30
|
+
• Project context scanning
|
|
31
|
+
• Agent marketplace system
|
|
32
|
+
• AI memory and context tracking
|
|
33
|
+
• Modular and extensible design
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
# 🧠 How CodeAOIS Works
|
|
38
|
+
|
|
39
|
+
CodeAOIS works like an **AI operating system for developers**.
|
|
40
|
+
|
|
41
|
+
You simply describe what you want to build, and the system:
|
|
42
|
+
|
|
43
|
+
1. Understands your request
|
|
44
|
+
2. Scans the project context
|
|
45
|
+
3. Activates the appropriate AI agent
|
|
46
|
+
4. Generates code
|
|
47
|
+
5. Shows the preview before applying changes
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
# Demo
|
|
52
|
+
|
|
53
|
+
## CodeAOIS Terminal
|
|
54
|
+
|
|
55
|
+

|
|
56
|
+
|
|
57
|
+
## AI Code Generation
|
|
58
|
+
|
|
59
|
+

|
|
60
|
+
|
|
61
|
+
## Generated Login Page
|
|
62
|
+
|
|
63
|
+

|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
# 💻 Example
|
|
68
|
+
|
|
69
|
+
Start CodeAOIS:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
python app.py
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Then type instructions like:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
in file named index1.html you just make a colorful page and login page with css
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
CodeAOIS will:
|
|
82
|
+
|
|
83
|
+
• Analyze your intent
|
|
84
|
+
• Activate the coder agent
|
|
85
|
+
• Generate code
|
|
86
|
+
• Display the preview
|
|
87
|
+
|
|
88
|
+
Example output:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
[System] Analyzing intent...
|
|
92
|
+
[Code Mode] Engaging Coder agent...
|
|
93
|
+
|
|
94
|
+
Target file locked: index1.html
|
|
95
|
+
Scanning project context...
|
|
96
|
+
Generating code...
|
|
97
|
+
|
|
98
|
+
PROPOSED CODE GENERATION PREVIEW:
|
|
99
|
+
<!DOCTYPE html>
|
|
100
|
+
<html>
|
|
101
|
+
...
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
# 🧾 Available Commands
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
/help show command list
|
|
110
|
+
/marketplace view specialized AI agents
|
|
111
|
+
/install <x> install agent
|
|
112
|
+
/status show system status
|
|
113
|
+
/clear clear terminal
|
|
114
|
+
/clear_history reset conversation memory
|
|
115
|
+
/clear_user reset user profile
|
|
116
|
+
/exit exit CodeAOIS
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
# 🧩 Project Structure
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
codeaois_project
|
|
125
|
+
│
|
|
126
|
+
├── codeaois
|
|
127
|
+
│ ├── brain
|
|
128
|
+
│ │ ├── embeddings.py
|
|
129
|
+
│ │ ├── memory.py
|
|
130
|
+
│ │ └── scanner.py
|
|
131
|
+
│ │
|
|
132
|
+
│ ├── cli
|
|
133
|
+
│ │ └── main.py
|
|
134
|
+
│ │
|
|
135
|
+
│ ├── config
|
|
136
|
+
│ │ └── settings.py
|
|
137
|
+
│ │
|
|
138
|
+
│ ├── core
|
|
139
|
+
│ │ ├── context.py
|
|
140
|
+
│ │ ├── marketplace.py
|
|
141
|
+
│ │ ├── memory.py
|
|
142
|
+
│ │ ├── orchestrator.py
|
|
143
|
+
│ │ ├── planner.py
|
|
144
|
+
│ │ └── router.py
|
|
145
|
+
│ │
|
|
146
|
+
│ ├── models
|
|
147
|
+
│ │ └── llm_interface.py
|
|
148
|
+
│ │
|
|
149
|
+
│ └── utils
|
|
150
|
+
│ ├── file_writer.py
|
|
151
|
+
│ └── logger.py
|
|
152
|
+
│
|
|
153
|
+
├── app.py
|
|
154
|
+
├── requirements.txt
|
|
155
|
+
├── setup.py
|
|
156
|
+
└── pyproject.toml
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
# ⚙️ Installation
|
|
162
|
+
|
|
163
|
+
Clone repository:
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
git clone https://github.com/C0de-With-Nikhil/CODEAOIS_PROJECT.git
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Go to project folder:
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
cd CODEAOIS_PROJECT
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Create virtual environment:
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
python3 -m venv venv
|
|
179
|
+
source venv/bin/activate
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Install dependencies:
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
pip install -r requirements.txt
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Run CodeAOIS:
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
python app.py
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
# 🎯 Vision
|
|
197
|
+
|
|
198
|
+
The goal of CodeAOIS is to create a **true AI development operating system** capable of:
|
|
199
|
+
|
|
200
|
+
• autonomous coding
|
|
201
|
+
• project reasoning
|
|
202
|
+
• multi-agent collaboration
|
|
203
|
+
• automated debugging
|
|
204
|
+
• AI-driven software architecture
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
# ⚠️ Status
|
|
209
|
+
|
|
210
|
+
CodeAOIS is currently an **experimental research project** and under active development.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
# Installation
|
|
215
|
+
```bash
|
|
216
|
+
pip install codeaois
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
# Usage
|
|
220
|
+
```bash
|
|
221
|
+
codeaois
|
|
222
|
+
```
|
|
223
|
+
### 2. The Master Blueprint (`setup.py`)
|
|
224
|
+
Now we need the configuration file. You might already have a basic one from earlier, but we need the production-ready version.
|
|
225
|
+
|
|
226
|
+
Create or overwrite the `setup.py` file in your root `~/codeaois_project/` folder with this exact code:
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
|
|
230
|
+
# 👨💻 Author
|
|
231
|
+
|
|
232
|
+
Created by **Nikhil Nagar**
|
codeaois-0.1.0/README.md
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# CodeAOIS
|
|
2
|
+
|
|
3
|
+
### Advanced AI Developer Operating System
|
|
4
|
+
|
|
5
|
+
CodeAOIS is an experimental **AI-powered developer operating system** that allows developers to interact with an AI coding system directly from the terminal.
|
|
6
|
+
|
|
7
|
+
Instead of simple autocomplete tools, CodeAOIS acts like an **AI developer partner** capable of understanding instructions, generating code, and managing development workflows.
|
|
8
|
+
|
|
9
|
+
The system is designed around a **multi-agent architecture** where specialized agents collaborate to perform tasks such as coding, testing, and project management.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# ✨ Features
|
|
14
|
+
|
|
15
|
+
• Natural language coding from terminal
|
|
16
|
+
• Multi-agent AI architecture
|
|
17
|
+
• Automatic code generation
|
|
18
|
+
• Project context scanning
|
|
19
|
+
• Agent marketplace system
|
|
20
|
+
• AI memory and context tracking
|
|
21
|
+
• Modular and extensible design
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# 🧠 How CodeAOIS Works
|
|
26
|
+
|
|
27
|
+
CodeAOIS works like an **AI operating system for developers**.
|
|
28
|
+
|
|
29
|
+
You simply describe what you want to build, and the system:
|
|
30
|
+
|
|
31
|
+
1. Understands your request
|
|
32
|
+
2. Scans the project context
|
|
33
|
+
3. Activates the appropriate AI agent
|
|
34
|
+
4. Generates code
|
|
35
|
+
5. Shows the preview before applying changes
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
# Demo
|
|
40
|
+
|
|
41
|
+
## CodeAOIS Terminal
|
|
42
|
+
|
|
43
|
+

|
|
44
|
+
|
|
45
|
+
## AI Code Generation
|
|
46
|
+
|
|
47
|
+

|
|
48
|
+
|
|
49
|
+
## Generated Login Page
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
# 💻 Example
|
|
56
|
+
|
|
57
|
+
Start CodeAOIS:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
python app.py
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Then type instructions like:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
in file named index1.html you just make a colorful page and login page with css
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
CodeAOIS will:
|
|
70
|
+
|
|
71
|
+
• Analyze your intent
|
|
72
|
+
• Activate the coder agent
|
|
73
|
+
• Generate code
|
|
74
|
+
• Display the preview
|
|
75
|
+
|
|
76
|
+
Example output:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
[System] Analyzing intent...
|
|
80
|
+
[Code Mode] Engaging Coder agent...
|
|
81
|
+
|
|
82
|
+
Target file locked: index1.html
|
|
83
|
+
Scanning project context...
|
|
84
|
+
Generating code...
|
|
85
|
+
|
|
86
|
+
PROPOSED CODE GENERATION PREVIEW:
|
|
87
|
+
<!DOCTYPE html>
|
|
88
|
+
<html>
|
|
89
|
+
...
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
# 🧾 Available Commands
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
/help show command list
|
|
98
|
+
/marketplace view specialized AI agents
|
|
99
|
+
/install <x> install agent
|
|
100
|
+
/status show system status
|
|
101
|
+
/clear clear terminal
|
|
102
|
+
/clear_history reset conversation memory
|
|
103
|
+
/clear_user reset user profile
|
|
104
|
+
/exit exit CodeAOIS
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
# 🧩 Project Structure
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
codeaois_project
|
|
113
|
+
│
|
|
114
|
+
├── codeaois
|
|
115
|
+
│ ├── brain
|
|
116
|
+
│ │ ├── embeddings.py
|
|
117
|
+
│ │ ├── memory.py
|
|
118
|
+
│ │ └── scanner.py
|
|
119
|
+
│ │
|
|
120
|
+
│ ├── cli
|
|
121
|
+
│ │ └── main.py
|
|
122
|
+
│ │
|
|
123
|
+
│ ├── config
|
|
124
|
+
│ │ └── settings.py
|
|
125
|
+
│ │
|
|
126
|
+
│ ├── core
|
|
127
|
+
│ │ ├── context.py
|
|
128
|
+
│ │ ├── marketplace.py
|
|
129
|
+
│ │ ├── memory.py
|
|
130
|
+
│ │ ├── orchestrator.py
|
|
131
|
+
│ │ ├── planner.py
|
|
132
|
+
│ │ └── router.py
|
|
133
|
+
│ │
|
|
134
|
+
│ ├── models
|
|
135
|
+
│ │ └── llm_interface.py
|
|
136
|
+
│ │
|
|
137
|
+
│ └── utils
|
|
138
|
+
│ ├── file_writer.py
|
|
139
|
+
│ └── logger.py
|
|
140
|
+
│
|
|
141
|
+
├── app.py
|
|
142
|
+
├── requirements.txt
|
|
143
|
+
├── setup.py
|
|
144
|
+
└── pyproject.toml
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
# ⚙️ Installation
|
|
150
|
+
|
|
151
|
+
Clone repository:
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
git clone https://github.com/C0de-With-Nikhil/CODEAOIS_PROJECT.git
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Go to project folder:
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
cd CODEAOIS_PROJECT
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Create virtual environment:
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
python3 -m venv venv
|
|
167
|
+
source venv/bin/activate
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Install dependencies:
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
pip install -r requirements.txt
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Run CodeAOIS:
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
python app.py
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
# 🎯 Vision
|
|
185
|
+
|
|
186
|
+
The goal of CodeAOIS is to create a **true AI development operating system** capable of:
|
|
187
|
+
|
|
188
|
+
• autonomous coding
|
|
189
|
+
• project reasoning
|
|
190
|
+
• multi-agent collaboration
|
|
191
|
+
• automated debugging
|
|
192
|
+
• AI-driven software architecture
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
# ⚠️ Status
|
|
197
|
+
|
|
198
|
+
CodeAOIS is currently an **experimental research project** and under active development.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
# Installation
|
|
203
|
+
```bash
|
|
204
|
+
pip install codeaois
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
# Usage
|
|
208
|
+
```bash
|
|
209
|
+
codeaois
|
|
210
|
+
```
|
|
211
|
+
### 2. The Master Blueprint (`setup.py`)
|
|
212
|
+
Now we need the configuration file. You might already have a basic one from earlier, but we need the production-ready version.
|
|
213
|
+
|
|
214
|
+
Create or overwrite the `setup.py` file in your root `~/codeaois_project/` folder with this exact code:
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
|
|
218
|
+
# 👨💻 Author
|
|
219
|
+
|
|
220
|
+
Created by **Nikhil Nagar**
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# codeaois/agents/3d_agent.py
|
|
2
|
+
from codeaois.models.llm_interface import call_openrouter
|
|
3
|
+
|
|
4
|
+
def generate_3d_code(user_prompt: str, file_context: str = "") -> str:
|
|
5
|
+
"""Specialized 3D Agent worker."""
|
|
6
|
+
system_prompt = (
|
|
7
|
+
"You are the CodeAOIS 3D Agent. "
|
|
8
|
+
"Your job is to provide highly optimized, expert-level code strictly for your specific domain. "
|
|
9
|
+
"CRITICAL: Output ONLY the raw, complete code. Do not wrap the code in markdown blocks."
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
full_prompt = user_prompt
|
|
13
|
+
if file_context:
|
|
14
|
+
full_prompt += f"\n\nHere are the existing files for context:\n{file_context}"
|
|
15
|
+
|
|
16
|
+
response = call_openrouter(system_prompt, full_prompt)
|
|
17
|
+
|
|
18
|
+
if response.startswith("```"):
|
|
19
|
+
lines = response.split("\n")
|
|
20
|
+
if len(lines) > 2:
|
|
21
|
+
response = "\n".join(lines[1:-1])
|
|
22
|
+
|
|
23
|
+
return response.strip()
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# codeaois/agents/coder_agent.py
|
|
2
|
+
from codeaois.models.llm_interface import call_openrouter
|
|
3
|
+
|
|
4
|
+
def generate_code(user_prompt: str, file_context: str = "") -> str:
|
|
5
|
+
if file_context:
|
|
6
|
+
system_prompt = (
|
|
7
|
+
"You are the CodeAOIS Coder Agent. "
|
|
8
|
+
"1. You MUST output your code changes using the <<<<<<< SEARCH and >>>>>>> REPLACE format.\n"
|
|
9
|
+
"2. AFTER your code blocks, you MUST add the exact text '---SUMMARY---' on a new line.\n"
|
|
10
|
+
"3. AFTER the summary delimiter, write a brief, friendly explanation of how the code works and what you changed."
|
|
11
|
+
)
|
|
12
|
+
else:
|
|
13
|
+
system_prompt = (
|
|
14
|
+
"You are the CodeAOIS Coder Agent, an expert senior software engineer. "
|
|
15
|
+
"1. Output the raw, complete code first. Do not wrap the code in markdown blocks.\n"
|
|
16
|
+
"2. AFTER the code, you MUST add the exact text '---SUMMARY---' on a new line.\n"
|
|
17
|
+
"3. AFTER the summary delimiter, write a brief, friendly explanation of how the code works."
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
full_prompt = user_prompt
|
|
21
|
+
if file_context:
|
|
22
|
+
full_prompt += f"\n\nHere are the existing files for context:\n{file_context}"
|
|
23
|
+
|
|
24
|
+
response = call_openrouter(system_prompt, full_prompt, intent="code")
|
|
25
|
+
return response.strip()
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# codeaois/agents/data_science_agent.py
|
|
2
|
+
from codeaois.models.llm_interface import call_openrouter
|
|
3
|
+
|
|
4
|
+
def generate_ds_code(user_prompt: str, file_context: str = "") -> str:
|
|
5
|
+
system_prompt = (
|
|
6
|
+
"You are the CodeAOIS Data Science Agent, an elite data scientist and Python developer. "
|
|
7
|
+
"Your job is to provide highly optimized, memory-efficient code for data manipulation, "
|
|
8
|
+
"analysis, and visualization. "
|
|
9
|
+
"CRITICAL: Output ONLY the raw, complete code. Do not wrap the code in markdown blocks."
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
full_prompt = user_prompt
|
|
13
|
+
if file_context:
|
|
14
|
+
full_prompt += f"\n\nHere are the existing files for context. Modify as requested:\n{file_context}"
|
|
15
|
+
|
|
16
|
+
# Pass the data_science intent to trigger the Qwen/Step model list
|
|
17
|
+
response = call_openrouter(system_prompt, full_prompt, intent="data_science")
|
|
18
|
+
|
|
19
|
+
if response.startswith("```"):
|
|
20
|
+
lines = response.split("\n")
|
|
21
|
+
if len(lines) > 2:
|
|
22
|
+
response = "\n".join(lines[1:-1])
|
|
23
|
+
|
|
24
|
+
return response.strip()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# codeaois/agents/database_agent.py
|
|
2
|
+
from codeaois.models.llm_interface import call_openrouter
|
|
3
|
+
|
|
4
|
+
def generate_database_code(user_prompt: str, file_context: str = "") -> str:
|
|
5
|
+
"""Specialized Database Agent worker."""
|
|
6
|
+
system_prompt = (
|
|
7
|
+
"You are the CodeAOIS Database Agent. "
|
|
8
|
+
"Your job is to provide highly optimized, expert-level code strictly for your specific domain. "
|
|
9
|
+
"CRITICAL: Output ONLY the raw, complete code. Do not wrap the code in markdown blocks."
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
full_prompt = user_prompt
|
|
13
|
+
if file_context:
|
|
14
|
+
full_prompt += f"\n\nHere are the existing files for context:\n{file_context}"
|
|
15
|
+
|
|
16
|
+
response = call_openrouter(system_prompt, full_prompt)
|
|
17
|
+
|
|
18
|
+
if response.startswith("```"):
|
|
19
|
+
lines = response.split("\n")
|
|
20
|
+
if len(lines) > 2:
|
|
21
|
+
response = "\n".join(lines[1:-1])
|
|
22
|
+
|
|
23
|
+
return response.strip()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# codeaois/agents/debugging_agent.py
|
|
2
|
+
from codeaois.models.llm_interface import call_openrouter
|
|
3
|
+
|
|
4
|
+
def generate_debugging_code(user_prompt: str, file_context: str = "") -> str:
|
|
5
|
+
"""Specialized Debugging Agent worker."""
|
|
6
|
+
system_prompt = (
|
|
7
|
+
"You are the CodeAOIS Debugging Agent. "
|
|
8
|
+
"Your job is to provide highly optimized, expert-level code strictly for your specific domain. "
|
|
9
|
+
"CRITICAL: Output ONLY the raw, complete code. Do not wrap the code in markdown blocks."
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
full_prompt = user_prompt
|
|
13
|
+
if file_context:
|
|
14
|
+
full_prompt += f"\n\nHere are the existing files for context:\n{file_context}"
|
|
15
|
+
|
|
16
|
+
response = call_openrouter(system_prompt, full_prompt)
|
|
17
|
+
|
|
18
|
+
if response.startswith("```"):
|
|
19
|
+
lines = response.split("\n")
|
|
20
|
+
if len(lines) > 2:
|
|
21
|
+
response = "\n".join(lines[1:-1])
|
|
22
|
+
|
|
23
|
+
return response.strip()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# codeaois/agents/devops_agent.py
|
|
2
|
+
from codeaois.models.llm_interface import call_openrouter
|
|
3
|
+
|
|
4
|
+
def generate_devops_code(user_prompt: str, file_context: str = "") -> str:
|
|
5
|
+
"""Specialized Devops Agent worker."""
|
|
6
|
+
system_prompt = (
|
|
7
|
+
"You are the CodeAOIS Devops Agent. "
|
|
8
|
+
"Your job is to provide highly optimized, expert-level code strictly for your specific domain. "
|
|
9
|
+
"CRITICAL: Output ONLY the raw, complete code. Do not wrap the code in markdown blocks."
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
full_prompt = user_prompt
|
|
13
|
+
if file_context:
|
|
14
|
+
full_prompt += f"\n\nHere are the existing files for context:\n{file_context}"
|
|
15
|
+
|
|
16
|
+
response = call_openrouter(system_prompt, full_prompt)
|
|
17
|
+
|
|
18
|
+
if response.startswith("```"):
|
|
19
|
+
lines = response.split("\n")
|
|
20
|
+
if len(lines) > 2:
|
|
21
|
+
response = "\n".join(lines[1:-1])
|
|
22
|
+
|
|
23
|
+
return response.strip()
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# codeaois/agents/git_agent.py
|
|
2
|
+
import subprocess
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
C_YELLOW = '\033[93m'
|
|
6
|
+
C_GREEN = '\033[92m'
|
|
7
|
+
C_RESET = '\033[0m'
|
|
8
|
+
|
|
9
|
+
def run_git_command(command: list) -> tuple[bool, str]:
|
|
10
|
+
"""Quietly executes a terminal command and returns the result."""
|
|
11
|
+
try:
|
|
12
|
+
result = subprocess.run(command, capture_output=True, text=True, check=True)
|
|
13
|
+
return True, result.stdout.strip()
|
|
14
|
+
except subprocess.CalledProcessError as e:
|
|
15
|
+
return False, e.stderr.strip()
|
|
16
|
+
|
|
17
|
+
def auto_commit(file_path: str, message: str):
|
|
18
|
+
"""Automatically stages and commits a modified file."""
|
|
19
|
+
|
|
20
|
+
# 1. Check if the user is inside a Git repository
|
|
21
|
+
is_git, _ = run_git_command(["git", "rev-parse", "--is-inside-work-tree"])
|
|
22
|
+
if not is_git:
|
|
23
|
+
print(f" {C_YELLOW}⚠️ [Git Agent] No .git repository found in this folder. Skipping auto-commit.{C_RESET}")
|
|
24
|
+
return
|
|
25
|
+
|
|
26
|
+
print(f" {C_GREEN}🌿 [Git Agent] Engaging version control...{C_RESET}")
|
|
27
|
+
|
|
28
|
+
# 2. Stage only the specific file the AI just modified
|
|
29
|
+
success, err = run_git_command(["git", "add", file_path])
|
|
30
|
+
if not success:
|
|
31
|
+
print(f" {C_YELLOW}⚠️ [Git Agent] Failed to stage file: {err}{C_RESET}")
|
|
32
|
+
return
|
|
33
|
+
|
|
34
|
+
# 3. Double-check that there are actually changes to save
|
|
35
|
+
has_changes, diff = run_git_command(["git", "status", "--porcelain"])
|
|
36
|
+
if not has_changes or not diff:
|
|
37
|
+
print(f" {C_YELLOW}⚠️ [Git Agent] No actual code changes detected for {file_path}.{C_RESET}")
|
|
38
|
+
return
|
|
39
|
+
|
|
40
|
+
# 4. Commit the changes to the timeline
|
|
41
|
+
commit_success, commit_err = run_git_command(["git", "commit", "-m", message])
|
|
42
|
+
if commit_success:
|
|
43
|
+
print(f" {C_GREEN}✅ [Git Agent] Successfully committed changes to {file_path}!{C_RESET}")
|
|
44
|
+
else:
|
|
45
|
+
print(f" {C_YELLOW}⚠️ [Git Agent] Commit failed: {commit_err}{C_RESET}")
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# codeaois/agents/tester_agent.py
|
|
2
|
+
import subprocess
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
def run_test(file_path: str) -> tuple[bool, str]:
|
|
6
|
+
"""Runs a Python script and catches any terminal errors."""
|
|
7
|
+
if not file_path.endswith('.py'):
|
|
8
|
+
return True, "Not a Python file. Skipping auto-test."
|
|
9
|
+
|
|
10
|
+
try:
|
|
11
|
+
# sys.executable ensures it uses your isolated 'venv' Python, not the global Ubuntu one!
|
|
12
|
+
result = subprocess.run(
|
|
13
|
+
[sys.executable, file_path],
|
|
14
|
+
capture_output=True,
|
|
15
|
+
text=True,
|
|
16
|
+
timeout=10 # 10-second kill switch so infinite loops don't crash your computer
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
if result.returncode == 0:
|
|
20
|
+
return True, result.stdout.strip()
|
|
21
|
+
else:
|
|
22
|
+
return False, result.stderr.strip()
|
|
23
|
+
|
|
24
|
+
except subprocess.TimeoutExpired:
|
|
25
|
+
return False, "Error: Script execution timed out (possible infinite loop)."
|
|
26
|
+
except Exception as e:
|
|
27
|
+
return False, str(e)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# AI-generated code for: Modify `app.py` with instruction: create Flask API, preserving style and existing code
|
|
File without changes
|