Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Style updates for developer docs and README #338

Merged
merged 1 commit into from
Dec 13, 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
132 changes: 87 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
![image](https://github.com/user-attachments/assets/ab37063d-039d-4857-be88-231047a7b282)

<picture>
<source media="(prefers-color-scheme: dark)" srcset="./static/codegate-logo-white.svg">
<img alt="CodeGate logo" src="./static/codegate-logo-white.svg" width="800px" style="max-width: 100%;">
</picture>

[![CI](https://github.com/stacklok/codegate/actions/workflows/ci.yml/badge.svg)](https://github.com/stacklok/codegate/actions/workflows/ci.yml)

Codegate is a local gateway that makes AI coding assistants safer. Codegate ensures AI-generated recommendations adhere to best practices, while safeguarding your code's integrity, and protecting your individual privacy. With Codegate, you can confidently leverage AI in your development workflow without compromising security or productivity. Codegate is designed to work seamlessly with coding assistants, allowing you to safely enjoy all the benefits of AI code generation.
CodeGate is a local gateway that makes AI coding assistants safer. CodeGate
ensures AI-generated recommendations adhere to best practices, while
safeguarding your code's integrity, and protecting your individual privacy. With
CodeGate, you can confidently leverage AI in your development workflow without
compromising security or productivity. CodeGate is designed to work seamlessly
with coding assistants, allowing you to safely enjoy all the benefits of AI code
generation.

Codegate is developed by [Stacklok](https://stacklok.com), a group of security experts with many years of experience building developer friendly open source security software tools and platforms.
CodeGate is developed by [Stacklok](https://stacklok.com), a group of security
experts with many years of experience building developer friendly open source
security software tools and platforms.

## Experimental 🚧

Codegate is **experimental** and **undergoing fast iterations of development**.
CodeGate is **experimental** and **undergoing fast iterations of development**.

- Features may change frequently
- Expect possible bugs.
- Expect possible bugs
- Contributions, feedback, and testing are highly encouraged and welcomed!

## ✨ Why Codegate?
## ✨ Why CodeGate?

In today's world where AI coding assistants are becoming ubiquitous, security can't be an afterthought. Codegate sits between you and AI, actively protecting your development process by:
In today's world where AI coding assistants are becoming ubiquitous, security
can't be an afterthought. CodeGate sits between you and AI, actively protecting
your development process by:

- 🔒 Preventing accidental exposure of secrets and sensitive data
- 🛡️ Ensuring AI suggestions follow secure coding practices
Expand All @@ -26,79 +38,94 @@ In today's world where AI coding assistants are becoming ubiquitous, security ca

## 🌟 Features

### Supported AI Providers
Codegate works seamlessly with leading AI providers:
### Supported AI providers

CodeGate works seamlessly with leading AI providers:

- 🤖 Anthropic (Claude)
- 🧠 OpenAI
- ⚡ vLLM
- 💻 Local LLMs (run AI completely offline!)
- 🔮 Many more on the way!

### AI Coding Assistants
We're starting with Continue VSCode extension support, with many more AI coding assistants coming soon!
### AI coding assistants

We're starting with Continue VS Code extension support, with many more AI coding
assistants coming soon!

### Privacy first

Unlike E.T., your code never phones home! 🛸 CodeGate is designed with privacy
at its core:

### Privacy First
Unlike E.T., your code never phones home! 🛸 Codegate is designed with privacy at its core:
- 🏠 Everything stays on your machine
- 🚫 No external data collection
- 🔐 No calling home or telemetry
- 💪 Complete control over your data

## 🚀 Quick Start
## 🚀 Quickstart

### Prerequisites

Make sure you have these tools installed:

- 🐳 [Docker](https://docs.docker.com/get-docker/)
- 🛠️ [jq](https://stedolan.github.io/jq/download/)
- 💻 [VSCode](https://code.visualstudio.com/download)
- 💻 [VS Code](https://code.visualstudio.com/download)

### One-Command Setup
### One-command setup

```bash
chmod +x install.sh && ./install.sh
```

This script will:
1. Install the Continue VSCode extension

1. Install the Continue VS Code extension
2. Set up your configuration
3. Create and start necessary Docker services

## 🎯 Usage

### VSCode Integration with Continue
### VS Code integration with Continue

Simply tap the Continue button in your VS Code editor to start chatting with
your AI assistant - now protected by CodeGate!

Simply tap the Continue button in your VSCode editor to start chatting with your AI assistant - now protected by Codegate!
![Continue chat interface](./static/image.png)

![Continue Chat Interface](./static/image.png)
### Manual configuration

### Manual Configuration
#### Basic server start

#### Basic Server Start
```bash
codegate serve
```

#### Custom Settings
#### Custom settings

```bash
codegate serve --port 8989 --host localhost --log-level DEBUG
```

#### Using Config File
#### Using config file

Create a `config.yaml`:

```yaml
port: 8989
host: "localhost"
log_level: "DEBUG"
```

Then run:

```bash
codegate serve --config config.yaml
```

#### Environment Variables
#### Environment variables

```bash
export CODEGATE_APP_PORT=8989
export CODEGATE_APP_HOST=localhost
Expand All @@ -108,7 +135,8 @@ codegate serve

## 🛠️ Development

### Local Setup
### Local setup

```bash
# Get the code
git clone https://github.com/stacklok/codegate.git
Expand All @@ -124,9 +152,9 @@ pip install -e ".[dev]"

### Running locally with several network interfaces

By default weaviate is picking the default route as the ip for the cluster nodes. It may cause
some issues when dealing with multiple interfaces. To make it work, localhost needs to be the
default route:
By default weaviate is picking the default route as the ip for the cluster
nodes. It may cause some issues when dealing with multiple interfaces. To make
it work, localhost needs to be the default route:

```bash
sudo route delete default
Expand All @@ -136,48 +164,62 @@ sudo route add -net 128.0.0.0/1 <public_ip_gateway>
```

### Testing

```bash
pytest
```

## 🐳 Docker Deployment
## 🐳 Docker deployment

### Build the image

### Build the Image
```bash
make image-build
```

### Run the Container
### Run the container

```bash
# Basic usage with local image
docker run -p 8989:8989 -p 9090:80 codegate:latest

# With pre-built pulled image
docker pull ghcr.io/stacklok/codegate/codegate:latest
docker run --name codegate -d -p 8989:8989 -p 9090:80 ghcr.io/stacklok/codegate/codegate:latest
docker pull ghcr.io/stacklok/codegate:latest
docker run --name codegate -d -p 8989:8989 -p 9090:80 ghcr.io/stacklok/codegate:latest

# It will mount a volume to /app/codegate_volume
# The directory supports storing Llama CPP models under subidrectoy /models
# A sqlite DB with the messages and alerts is stored under the subdirectory /db
docker run --name codegate -d -v /path/to/volume:/app/codegate_volume -p 8989:8989 -p 9090:80 ghcr.io/stacklok/codegate/codegate:latest
docker run --name codegate -d -v /path/to/volume:/app/codegate_volume -p 8989:8989 -p 9090:80 ghcr.io/stacklok/codegate:latest
```

### Exposed parameters
- CODEGATE_VLLM_URL: URL for the inference engine (defaults to [https://inference.codegate.ai](https://inference.codegate.ai))
- CODEGATE_OPENAI_URL: URL for OpenAI inference engine (defaults to [https://api.openai.com/v1](https://api.openai.com/v1))
- CODEGATE_ANTHROPIC_URL: URL for Anthropic inference engine (defaults to [https://api.anthropic.com/v1](https://api.anthropic.com/v1))
- CODEGATE_OLLAMA_URL: URL for OLlama inference engine (defaults to [http://localhost:11434/api](http://localhost:11434/api))
- CODEGATE_APP_LOG_LEVEL: Level of debug desired when running the codegate server (defaults to WARNING, can be ERROR/WARNING/INFO/DEBUG)
- CODEGATE_LOG_FORMAT: Type of log formatting desired when running the codegate server (default to TEXT, can be JSON/TEXT)

- CODEGATE_VLLM_URL: URL for the inference engine (defaults to
[https://inference.codegate.ai](https://inference.codegate.ai))
- CODEGATE_OPENAI_URL: URL for OpenAI inference engine (defaults to
[https://api.openai.com/v1](https://api.openai.com/v1))
- CODEGATE_ANTHROPIC_URL: URL for Anthropic inference engine (defaults to
[https://api.anthropic.com/v1](https://api.anthropic.com/v1))
- CODEGATE_OLLAMA_URL: URL for OLlama inference engine (defaults to
[http://localhost:11434/api](http://localhost:11434/api))
- CODEGATE_APP_LOG_LEVEL: Level of debug desired when running the codegate
server (defaults to WARNING, can be ERROR/WARNING/INFO/DEBUG)
- CODEGATE_LOG_FORMAT: Type of log formatting desired when running the codegate
server (default to TEXT, can be JSON/TEXT)

```bash
docker run -p 8989:8989 -p 9090:80 -e CODEGATE_OLLAMA_URL=http://1.2.3.4:11434/api ghcr.io/stacklok/codegate/codegate:latest
docker run -p 8989:8989 -p 9090:80 -e CODEGATE_OLLAMA_URL=http://1.2.3.4:11434/api ghcr.io/stacklok/codegate:latest
```

## 🤝 Contributing

We welcome contributions! Whether it's bug reports, feature requests, or code contributions, please feel free to contribute to making Codegate better.
We welcome contributions! Whether it's bug reports, feature requests, or code
contributions, please feel free to contribute to making CodeGate better.

## 📜 License

This project is licensed under the terms specified in the [LICENSE](LICENSE) file.
This project is licensed under the terms specified in the [LICENSE](LICENSE)
file.

<!-- markdownlint-disable-file first-line-heading no-inline-html -->
Loading
Loading