Skip to content

Commit d81e9a6

Browse files
first version
1 parent 6d084d3 commit d81e9a6

32 files changed

+7043
-15
lines changed

DOCS.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Cerebras Coding Agent
2+
3+
## Overview
4+
5+
The Cerebras Coding Agent is an AI-powered tool that translates natural language instructions into code changes. It acts as a bridge between human intent and code implementation, helping developers work more efficiently with their codebase.
6+
7+
## Core Capabilities
8+
9+
1. **Repository Analysis** - Understands codebase structure, dependencies, and patterns
10+
2. **Natural Language Processing** - Converts plain English instructions into actionable steps
11+
3. **Code Generation & Modification** - Creates or updates code based on instructions
12+
4. **Error Detection & Fixing** - Analyzes error messages and suggests appropriate fixes
13+
5. **Contextual Awareness** - Follows existing project conventions and patterns
14+
6. **Change Management** - Tracks modifications with option to revert changes
15+
16+
## Architecture
17+
18+
The agent is built on a modular architecture with four key components:
19+
20+
- **Core Agent (CerebrasAgent)** - Central controller that manages all operations
21+
- **File Operations** - Handles file system interactions
22+
- **CLI Interface** - Command-line interface for user interaction
23+
- **Cerebras LLM API Integration** - Connects to AI language models
24+
25+
## Workflow
26+
27+
1. User provides instruction via natural language
28+
2. Agent analyzes repository for context
29+
3. Agent creates plan with file changes/shell commands
30+
4. User reviews and accepts/rejects changes
31+
5. Changes are applied to codebase
32+
6. Agent can validate changes with follow-up commands
33+
34+
## Key Features
35+
36+
### Error Handling
37+
38+
The agent can detect, analyze, and fix errors across multiple languages:
39+
- Parse error output from different tools and languages
40+
- Identify error type, location, and root cause
41+
- Generate appropriate fix approaches
42+
- Execute and validate solutions
43+
44+
### Context Management
45+
46+
To work effectively with larger codebases:
47+
- Intelligent context compression for token optimization
48+
- Selective file analysis based on relevance
49+
- Semantic prioritization of important files
50+
- Intelligent parsing of key configuration files
51+
52+
### Extension Points
53+
54+
The agent is designed to be extensible:
55+
- Support for additional language/framework errors
56+
- Custom CLI commands
57+
- Integration with development tools
58+
59+
## Usage Best Practices
60+
61+
1. Provide clear, specific instructions
62+
2. Start with smaller tasks before complex ones
63+
3. Maintain well-organized repositories
64+
4. Always review suggested changes
65+
5. Use version control for safety
66+
67+
## Configuration
68+
69+
Configure via:
70+
- Environment variables
71+
- Command-line options
72+
- Configuration files
73+
74+
Key settings include API key, repository path, file inclusion/exclusion patterns, and context compression options.

LICENSE

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,7 @@
175175

176176
END OF TERMS AND CONDITIONS
177177

178-
APPENDIX: How to apply the Apache License to your work.
179-
180-
To apply the Apache License to your work, attach the following
181-
boilerplate notice, with the fields enclosed by brackets "[]"
182-
replaced with your own identifying information. (Don't include
183-
the brackets!) The text should be enclosed in the appropriate
184-
comment syntax for the file format. We also recommend that a
185-
file or class name and description of purpose be included on the
186-
same "printed page" as the copyright notice for easier
187-
identification within third-party archives.
188-
189-
Copyright [yyyy] [name of copyright owner]
178+
Copyright 2024 Cerebras Systems
190179

191180
Licensed under the Apache License, Version 2.0 (the "License");
192181
you may not use this file except in compliance with the License.
@@ -198,4 +187,4 @@
198187
distributed under the License is distributed on an "AS IS" BASIS,
199188
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200189
See the License for the specific language governing permissions and
201-
limitations under the License.
190+
limitations under the License.

MANIFEST.in

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
include LICENSE
2+
include README.md
3+
include requirements*.txt
4+
recursive-include cerebras_agent *.py
5+
recursive-include cerebras_agent *.json
6+
recursive-include cerebras_agent *.yaml
7+
recursive-include cerebras_agent *.yml
8+
recursive-include cerebras_agent *.txt
9+
recursive-exclude tests *
10+
recursive-exclude * __pycache__
11+
recursive-exclude * *.py[cod]
12+
recursive-exclude * *$py.class
13+
recursive-exclude * .*.sw*
14+
recursive-exclude * .DS_Store

README.md

Lines changed: 126 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,126 @@
1-
# cerebras-coding-agent
2-
A Cerebras AI LLM coding agent for the command line
1+
# Cerebras Coding Agent
2+
3+
```
4+
██████╗ ██████╗ ██████╗ ███████╗██████╗
5+
██╔════╝██╔═══██╗██╔══██╗██╔════╝██╔══██╗
6+
██║ ██║ ██║██║ ██║█████╗ ██████╔╝
7+
██║ ██║ ██║██║ ██║██╔══╝ ██╔══██╗
8+
╚██████╗╚██████╔╝██████╔╝███████╗██║ ██║
9+
╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝
10+
11+
Cerebras Agent - Your AI coding assistant
12+
```
13+
14+
A local agent for code development using the Cerebras API. This tool allows you to interact with your codebase through natural language, helping you understand, modify, and extend your code more efficiently.
15+
16+
## Features
17+
18+
- Code generation and modification based on natural language instructions
19+
- Repository analysis and question answering
20+
- Interactive command-line interface
21+
- Automatic error detection and fixing
22+
- Support for multiple programming languages and frameworks
23+
- Proper handling of project file structures
24+
25+
## Installation
26+
27+
### From PyPI (Recommended)
28+
29+
```bash
30+
pip install cerebras-agent
31+
```
32+
33+
### From Source
34+
35+
```bash
36+
# Clone the repository
37+
git clone https://github.com/jio-gl/cerebras-coding-agent.git
38+
cd cerebras-coding-agent
39+
40+
# Option 1: Use the installation script
41+
./install.sh
42+
43+
# Option 2: Use the installation script with virtual environment
44+
./install.sh --venv
45+
46+
# Option 3: Manual installation
47+
pip install -e .
48+
```
49+
50+
## Configuration
51+
52+
1. Get a Cerebras API key from [Cerebras Cloud](https://cloud.cerebras.ai/)
53+
54+
2. Create a `.env` file in your project root:
55+
```bash
56+
CEREBRAS_API_KEY=your_api_key_here
57+
```
58+
59+
3. Alternatively, set your API key as an environment variable:
60+
```bash
61+
export CEREBRAS_API_KEY=your_api_key_here
62+
```
63+
64+
## Usage
65+
66+
### Command Line Interface
67+
68+
```bash
69+
# Start the agent in interactive mode
70+
cerebras-agent
71+
72+
# Ask a specific question about the repository without making changes
73+
cerebras-agent --ask "How does this codebase handle authentication?"
74+
cerebras-agent -a "How does this codebase handle authentication?"
75+
76+
# Prompt the agent to perform changes in the repository
77+
cerebras-agent --agent "Add error handling to all database functions"
78+
cerebras-agent -g "Add error handling to all database functions"
79+
80+
# Specify a repository path (default: current directory)
81+
cerebras-agent --repo /path/to/your/repo
82+
cerebras-agent -r /path/to/your/repo
83+
```
84+
85+
### Interactive Commands
86+
87+
Once in the interactive mode, you can use the following commands:
88+
89+
- **`<prompt>`**: Enter any natural language prompt to generate code changes
90+
- **`ask <question>`**: Ask a question about the repository without making changes
91+
- **`checkpoint`**: Show current checkpoint and change history
92+
- **`revert <number>`**: Revert to a specific checkpoint number
93+
- **`help`**: Show available commands
94+
- **`exit`**: Exit the program
95+
96+
## Development
97+
98+
1. Clone the repository:
99+
```bash
100+
git clone https://github.com/jio-gl/cerebras-coding-agent.git
101+
cd cerebras-coding-agent
102+
```
103+
104+
2. Install development dependencies:
105+
```bash
106+
pip install -e ".[dev]"
107+
```
108+
109+
3. Run tests:
110+
```bash
111+
./run_tests.sh
112+
```
113+
114+
4. Run integration tests (requires API key):
115+
```bash
116+
export CEREBRAS_API_KEY=your_api_key_here
117+
./run_integration_tests.sh
118+
```
119+
120+
## License
121+
122+
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.
123+
124+
## Contributing
125+
126+
Contributions are welcome! Please feel free to submit a Pull Request.

cerebras_agent/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"""
2+
Cerebras Agent - A local agent for code development using Cerebras API.
3+
"""
4+
5+
from .agent import CerebrasAgent
6+
7+
__version__ = "0.1.0"
8+
__all__ = ["CerebrasAgent"]
358 Bytes
Binary file not shown.
56.1 KB
Binary file not shown.
12.1 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)