Skip to content
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
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ jobs:
mkdir -p ~/.config/acp
cp clusters.yaml.example ~/.config/acp/clusters.yaml

- name: Run ruff (lint and format check)
- name: Run ruff (autofix, then verify)
run: |
uv run ruff check .
uv run ruff format --check .
uv run ruff check --fix .
uv run ruff format .
git diff --exit-code || (echo "ruff made changes — commit them locally before pushing" && exit 1)

# TODO: Enable mypy once type annotations are complete
# - name: Run mypy (type checking)
Expand Down
47 changes: 24 additions & 23 deletions src/mcp_acp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ def _get_token(self, cluster_config: dict[str, Any]) -> str:

if not token:
raise ValueError(
"No authentication token available. "
"Set 'token' in clusters.yaml or ACP_TOKEN environment variable."
"No authentication token available. Set 'token' in clusters.yaml or ACP_TOKEN environment variable."
)

return token
Expand Down Expand Up @@ -162,9 +161,7 @@ def _validate_input(self, value: str, field_name: str, max_length: int = 253) ->
if len(value) > max_length:
raise ValueError(f"{field_name} exceeds maximum length of {max_length}")
if not re.match(r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", value):
raise ValueError(
f"{field_name} contains invalid characters. Must match DNS-1123 format."
)
raise ValueError(f"{field_name} contains invalid characters. Must match DNS-1123 format.")

def _validate_bulk_operation(self, items: list[str], operation_name: str) -> None:
"""Enforce item limit for bulk operations."""
Expand Down Expand Up @@ -311,9 +308,7 @@ async def delete_session(self, project: str, session: str, dry_run: bool = False
"message": f"Failed to delete session: {str(e)}",
}

async def bulk_delete_sessions(
self, project: str, sessions: list[str], dry_run: bool = False
) -> dict[str, Any]:
async def bulk_delete_sessions(self, project: str, sessions: list[str], dry_run: bool = False) -> dict[str, Any]:
"""Delete multiple sessions (max 3).

Args:
Expand All @@ -332,15 +327,19 @@ async def bulk_delete_sessions(

if dry_run:
if result.get("success", True):
dry_run_info["would_execute"].append({
"session": session,
"info": result.get("session_info"),
})
dry_run_info["would_execute"].append(
{
"session": session,
"info": result.get("session_info"),
}
)
else:
dry_run_info["skipped"].append({
"session": session,
"reason": result.get("message"),
})
dry_run_info["skipped"].append(
{
"session": session,
"reason": result.get("message"),
}
)
else:
if result.get("deleted"):
success.append(session)
Expand All @@ -360,13 +359,15 @@ def list_clusters(self) -> dict[str, Any]:
default_cluster = self.clusters_config.default_cluster

for name, cluster in self.clusters_config.clusters.items():
clusters.append({
"name": name,
"server": cluster.server,
"description": cluster.description or "",
"default_project": cluster.default_project,
"is_default": name == default_cluster,
})
clusters.append(
{
"name": name,
"server": cluster.server,
"description": cluster.description or "",
"default_project": cluster.default_project,
"is_default": name == default_cluster,
}
)

return {"clusters": clusters, "default_cluster": default_cluster}

Expand Down
Loading
Loading