Skip to content

Update workspace name error messages #728

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

Merged
merged 3 commits into from
Jan 22, 2025
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
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@
</picture>

---
[![CI](https://github.com/stacklok/codegate/actions/workflows/run-on-push.yml/badge.svg)](https://github.com/stacklok/codegate/actions/workflows/run-on-push.yml) | [![License: Apache 2.0](https://img.shields.io/badge/License-Apache2.0-brightgreen.svg)](https://opensource.org/licenses/Apache-2.0) | [![](https://dcbadge.vercel.app/api/server/RkzVuTp3WK?logo=discord&label=Discord&color=5865&style=flat)](https://discord.gg/RkzVuTp3WK)

[![CI](https://github.com/stacklok/codegate/actions/workflows/run-on-push.yml/badge.svg)](https://github.com/stacklok/codegate/actions/workflows/run-on-push.yml)
|
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache2.0-brightgreen.svg)](https://opensource.org/licenses/Apache-2.0)
|
[![Discord](https://dcbadge.vercel.app/api/server/RkzVuTp3WK?logo=discord&label=Discord&color=5865&style=flat)](https://discord.gg/RkzVuTp3WK)

---

## Introduction

<img src="./assets/codegate.gif" style="width: 70%; height: 70%;" />
<img src="./assets/codegate.gif" style="width: 70%; height: 70%;" alt="Animated gif of CodeGate detecting a malicious package in a Continue AI chat" />

CodeGate is a local gateway that makes AI coding assistants safer. CodeGate
ensures AI-generated recommendations adhere to best practices, while
Expand Down Expand Up @@ -76,7 +82,6 @@ With Aider, you can choose from two leading AI model providers:
- 💻 Local LLMs with [Ollama](https://ollama.com/)
- 🧠 [OpenAI API](https://openai.com/api/)


### Privacy first

Unlike E.T., your code never phones home! 🛸 CodeGate is designed with privacy
Expand All @@ -94,7 +99,6 @@ Check out the quickstart guides to get up and running quickly!
- [Quickstart guide for GitHub Copilot with VS Code](https://docs.codegate.ai/quickstart)
- [Quickstart guide for Continue with VS Code and Ollama](https://docs.codegate.ai/quickstart-continue)


## 🎯 Usage

### IDE integration
Expand Down Expand Up @@ -139,19 +143,22 @@ pip install -e ".[dev]"
### Testing

To run the unit tests, execute this command:

```bash
pytest
```

To run the integration tests, create a `.env` file in the repo root directory and add the
following properties to it:
```
To run the integration tests, create a `.env` file in the repo root directory
and add the following properties to it:

```plain
ENV_OPENAI_KEY=<YOUR_KEY>
ENV_VLLM_KEY=<YOUR_KEY>
ENV_ANTHROPIC_KEY=<YOUR_KEY>
```

Then the integration tests can be executed by running:

```bash
python tests/integration/integration_tests.py
```
Expand Down
6 changes: 4 additions & 2 deletions src/codegate/api/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ async def create_new_workspace(
raise HTTPException(
status_code=400,
detail=(
"Invalid workspace name. " "Please use only alphanumeric characters and dashes"
"Invalid workspace name. "
"Please use only alphanumeric characters, hyphens, or underscores."
),
)
except crud.WorkspaceCrudError as e:
Expand All @@ -106,7 +107,8 @@ async def rename_workspace(
raise HTTPException(
status_code=400,
detail=(
"Invalid workspace name. " "Please use only alphanumeric characters and dashes"
"Invalid workspace name. "
"Please use only alphanumeric characters, hyphens, or underscores."
),
)
except crud.WorkspaceCrudError as e:
Expand Down
2 changes: 1 addition & 1 deletion src/codegate/pipeline/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ async def _add_workspace(self, flags: Dict[str, str], args: List[str]) -> str:
try:
ws = await self.workspace_crud.add_workspace(new_workspace_name)
except ValidationError:
return "Invalid workspace name: It should be alphanumeric and dashes"
return "Invalid workspace name: It should be alphanumeric with hyphens or underscores"
except AlreadyExistsError:
return f"Workspace **{new_workspace_name}** already exists"
except crud.WorkspaceCrudError:
Expand Down
Loading