From 778130cfc718443c17bbece586f493b0e1b3cce4 Mon Sep 17 00:00:00 2001 From: Greyson Lalonde Date: Tue, 5 May 2026 03:50:09 +0800 Subject: [PATCH] fix: resolve mypy errors after merge - Re-export get_crewai_version explicitly so consumers stop getting attr-defined. - Drop the telemetry call in TemplateCommand.add_template; the standalone CLI's BaseCommand intentionally has no _telemetry, matching the choice already made for DeployCommand. - Add the user_identifier kwarg to crewai_cli's PlusAPI.login_to_tool_repository so tools.main.login keeps working and the surface matches crewai.plus_api. - Update the lib/cli login tests for the new json={} payload. --- lib/cli/src/crewai_cli/plus_api.py | 9 +++++++-- lib/cli/src/crewai_cli/remote_template/main.py | 2 -- lib/cli/src/crewai_cli/version.py | 2 +- lib/cli/tests/test_plus_api.py | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/cli/src/crewai_cli/plus_api.py b/lib/cli/src/crewai_cli/plus_api.py index aa05f2ad5..43ac71c63 100644 --- a/lib/cli/src/crewai_cli/plus_api.py +++ b/lib/cli/src/crewai_cli/plus_api.py @@ -48,8 +48,13 @@ class PlusAPI: with httpx.Client(trust_env=False, verify=verify) as client: return client.request(method, url, headers=self.headers, **kwargs) - def login_to_tool_repository(self) -> httpx.Response: - return self._make_request("POST", f"{self.TOOLS_RESOURCE}/login") + def login_to_tool_repository( + self, user_identifier: str | None = None + ) -> httpx.Response: + payload = {} + if user_identifier: + payload["user_identifier"] = user_identifier + return self._make_request("POST", f"{self.TOOLS_RESOURCE}/login", json=payload) def get_tool(self, handle: str) -> httpx.Response: return self._make_request("GET", f"{self.TOOLS_RESOURCE}/{handle}") diff --git a/lib/cli/src/crewai_cli/remote_template/main.py b/lib/cli/src/crewai_cli/remote_template/main.py index a7db81191..b2b7527f3 100644 --- a/lib/cli/src/crewai_cli/remote_template/main.py +++ b/lib/cli/src/crewai_cli/remote_template/main.py @@ -131,8 +131,6 @@ class TemplateCommand(BaseCommand): zip_bytes = self._download_zip(repo_name) self._extract_zip(zip_bytes, dest) - self._telemetry.template_installed_span(repo_name.removeprefix(TEMPLATE_PREFIX)) - console.print( f"\n [green]\u2713[/green] Installed template [bold white]{folder_name}[/bold white]" f" [dim](source: github.com/{GITHUB_ORG}/{repo_name})[/dim]\n" diff --git a/lib/cli/src/crewai_cli/version.py b/lib/cli/src/crewai_cli/version.py index 60023a125..bae5d0eef 100644 --- a/lib/cli/src/crewai_cli/version.py +++ b/lib/cli/src/crewai_cli/version.py @@ -10,7 +10,7 @@ from urllib import request from urllib.error import URLError import appdirs -from crewai.utilities.version import get_crewai_version +from crewai.utilities.version import get_crewai_version as get_crewai_version from packaging.version import InvalidVersion, Version, parse diff --git a/lib/cli/tests/test_plus_api.py b/lib/cli/tests/test_plus_api.py index e13082dab..e3f938362 100644 --- a/lib/cli/tests/test_plus_api.py +++ b/lib/cli/tests/test_plus_api.py @@ -28,7 +28,7 @@ class TestPlusAPI(unittest.TestCase): response = self.api.login_to_tool_repository() mock_make_request.assert_called_once_with( - "POST", "/crewai_plus/api/v1/tools/login" + "POST", "/crewai_plus/api/v1/tools/login", json={} ) self.assertEqual(response, mock_response) @@ -67,7 +67,7 @@ class TestPlusAPI(unittest.TestCase): response = self.api.login_to_tool_repository() self.assert_request_with_org_id( - mock_client_instance, "POST", "/crewai_plus/api/v1/tools/login" + mock_client_instance, "POST", "/crewai_plus/api/v1/tools/login", json={} ) self.assertEqual(response, mock_response)