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

Commit a099f02

Browse files
comment changes
1 parent 3cd60e8 commit a099f02

File tree

3 files changed

+22
-23
lines changed

3 files changed

+22
-23
lines changed

src/codegate/db/connection.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,9 @@ async def update_workspace(self, workspace: Workspace) -> Workspace:
284284
RETURNING *
285285
"""
286286
)
287-
updated_workspace = await self._execute_update_pydantic_model(workspace, sql, should_raise=True)
287+
updated_workspace = await self._execute_update_pydantic_model(
288+
workspace, sql, should_raise=True
289+
)
288290
return updated_workspace
289291

290292
async def update_session(self, session: Session) -> Optional[Session]:

src/codegate/db/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Workspace(BaseModel):
4747

4848
@field_validator("name", mode="plain")
4949
@classmethod
50-
def validate_name(cls, value):
50+
def name_must_be_alphanumeric(cls, value):
5151
if not re.match(r"^[a-zA-Z0-9_-]+$", value):
5252
raise ValueError("name must be alphanumeric and can only contain _ and -")
5353
return value

src/codegate/pipeline/cli/commands.py

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
class NoFlagValueError(Exception):
1212
pass
1313

14+
1415
class NoSubcommandError(Exception):
1516
pass
1617

18+
1719
class CodegateCommand(ABC):
1820
@abstractmethod
1921
async def run(self, args: List[str]) -> str:
@@ -46,10 +48,10 @@ def command_name(self) -> str:
4648
@property
4749
def help(self) -> str:
4850
return (
49-
"### CodeGate Version\n"
51+
"### CodeGate Version\n\n"
5052
"Prints the version of CodeGate.\n\n"
51-
"*args*: None\n\n"
5253
"**Usage**: `codegate version`\n\n"
54+
"*args*: None"
5355
)
5456

5557

@@ -74,7 +76,7 @@ def _parse_flags_and_subocomand(self, args: List[str]) -> Tuple[Dict[str, str],
7476
flag_name = args[i]
7577
if i + 1 >= len(args):
7678
raise NoFlagValueError(f"Flag {flag_name} needs a value, but none provided.")
77-
read_flags[flag_name] = args[i+1]
79+
read_flags[flag_name] = args[i + 1]
7880
i += 2
7981
else:
8082
# Once we encounter something that's not a recognized flag,
@@ -165,11 +167,11 @@ async def _add_workspace(self, flags: Dict[str, str], args: List[str]) -> str:
165167
except ValidationError:
166168
return "Invalid workspace name: It should be alphanumeric and dashes"
167169
except AlreadyExistsError:
168-
return f"Workspace `{new_workspace_name}` already exists"
170+
return f"Workspace **{new_workspace_name}** already exists"
169171
except Exception:
170172
return "An error occurred while adding the workspace"
171173

172-
return f"Workspace `{new_workspace_name}` has been added"
174+
return f"Workspace **{new_workspace_name}** has been added"
173175

174176
async def _activate_workspace(self, flags: Dict[str, str], args: List[str]) -> str:
175177
"""
@@ -195,21 +197,18 @@ async def _activate_workspace(self, flags: Dict[str, str], args: List[str]) -> s
195197
@property
196198
def help(self) -> str:
197199
return (
198-
"### CodeGate Workspace\n"
200+
"### CodeGate Workspace\n\n"
199201
"Manage workspaces.\n\n"
200202
"**Usage**: `codegate workspace <command> [args]`\n\n"
201-
"Available commands:\n"
202-
"- `list`: List all workspaces\n"
203-
" - *args*: None\n"
204-
" - **Usage**: `codegate workspace list`\n"
205-
"- `add`: Add a workspace\n"
206-
" - *args*:\n"
207-
" - `workspace_name`\n"
208-
" - **Usage**: `codegate workspace add <workspace_name>`\n"
209-
"- `activate`: Activate a workspace\n"
210-
" - *args*:\n"
211-
" - `workspace_name`\n"
212-
" - **Usage**: `codegate workspace activate <workspace_name>`\n"
203+
"Available commands:\n\n"
204+
"- `list`: List all workspaces\n\n"
205+
" - *args*: None\n\n"
206+
"- `add`: Add a workspace\n\n"
207+
" - *args*:\n\n"
208+
" - `workspace_name`\n\n"
209+
"- `activate`: Activate a workspace\n\n"
210+
" - *args*:\n\n"
211+
" - `workspace_name`"
213212
)
214213

215214

@@ -265,9 +264,7 @@ async def _show_system_prompt(self, flags: Dict[str, str], args: List[str]) -> s
265264
try:
266265
workspace = await self.workspace_crud.get_workspace_by_name(workspace_name)
267266
except crud.WorkspaceDoesNotExistError:
268-
return (
269-
f"Workspace `{workspace_name}` doesn't exist"
270-
)
267+
return f"Workspace `{workspace_name}` doesn't exist"
271268

272269
return f"Workspace **{workspace.name}** system prompt:\n\n{workspace.system_prompt}."
273270

0 commit comments

Comments
 (0)