Skip to content

Commit

Permalink
Filter out organizations that cannot be used for sync
Browse files Browse the repository at this point in the history
  • Loading branch information
jahwag committed Aug 1, 2024
1 parent b2f4b79 commit 13304ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "claudesync"
version = "0.3.9"
version = "0.4.0"
authors = [
{name = "Jahziah Wagner", email = "[email protected]"},
]
Expand Down
14 changes: 9 additions & 5 deletions src/claudesync/cli/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ def organization():
@click.pass_obj
@handle_errors
def ls(config):
"""List all available organizations."""
"""List all available organizations with required capabilities."""
provider = validate_and_get_provider(config, require_org=False)
organizations = provider.get_organizations()
if not organizations:
click.echo("No organizations found.")
click.echo(
"No organizations with required capabilities (chat and claude_pro) found."
)
else:
click.echo("Available organizations:")
click.echo("Available organizations with required capabilities:")
for idx, org in enumerate(organizations, 1):
click.echo(f" {idx}. {org['name']} (ID: {org['id']})")

Expand All @@ -32,9 +34,11 @@ def select(config):
provider = validate_and_get_provider(config, require_org=False)
organizations = provider.get_organizations()
if not organizations:
click.echo("No organizations found.")
click.echo(
"No organizations with required capabilities (chat and claude_pro) found."
)
return
click.echo("Available organizations:")
click.echo("Available organizations with required capabilities:")
for idx, org in enumerate(organizations, 1):
click.echo(f" {idx}. {org['name']} (ID: {org['id']})")
selection = click.prompt("Enter the number of the organization to select", type=int)
Expand Down
6 changes: 5 additions & 1 deletion src/claudesync/providers/base_claude_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ def get_organizations(self):
response = self._make_request("GET", "/organizations")
if not response:
raise ProviderError("Unable to retrieve organization information")
return [{"id": org["uuid"], "name": org["name"]} for org in response]
return [
{"id": org["uuid"], "name": org["name"]}
for org in response
if set(["chat", "claude_pro"]).issubset(set(org.get("capabilities", [])))
]

def get_projects(self, organization_id, include_archived=False):
response = self._make_request(
Expand Down

0 comments on commit 13304ff

Please sign in to comment.