refactor: remove CLI from crewai package and add backward-compat shim

Remove all CLI modules and tests that have been moved to the
crewai-cli package. Replace cli.py with a thin shim that re-exports
from crewai_cli when available, or shows an install hint otherwise.

Update crewai pyproject.toml to add a [cli] extra pointing to
crewai-cli and comment out the old entry point. Add py.typed marker
to crewai_cli for mypy compatibility.
This commit is contained in:
Greyson LaLonde
2026-03-14 22:12:38 -04:00
parent 3732de7b88
commit 96fc584ab8
73 changed files with 51 additions and 6835 deletions

View File

@@ -13,10 +13,16 @@ from crewai.cli.constants import (
class TestAuthenticationCommand:
def setup_method(self):
self.auth_command = AuthenticationCommand()
# Mock Settings so we always use default constants regardless of local config.
with patch("crewai.cli.authentication.main.Settings") as mock_settings:
instance = mock_settings.return_value
instance.oauth2_provider = "workos"
instance.oauth2_domain = CREWAI_ENTERPRISE_DEFAULT_OAUTH2_DOMAIN
instance.oauth2_client_id = CREWAI_ENTERPRISE_DEFAULT_OAUTH2_CLIENT_ID
instance.oauth2_audience = CREWAI_ENTERPRISE_DEFAULT_OAUTH2_AUDIENCE
instance.oauth2_extra = {}
self.auth_command = AuthenticationCommand()
# TODO: these expectations are reading from the actual settings, we should mock them.
# E.g. if you change the client_id locally, this test will fail.
@pytest.mark.parametrize(
"user_provider,expected_urls",
[
@@ -156,7 +162,7 @@ class TestAuthenticationCommand:
else:
mock_save_tokens.assert_called_once_with("test_access_token", 0)
@patch("crewai.cli.tools.main.ToolCommand")
@patch("crewai_cli.tools.main.ToolCommand")
@patch("crewai.cli.authentication.main.Settings")
@patch("crewai.cli.authentication.main.console.print")
def test_login_to_tool_repository_success(
@@ -189,7 +195,7 @@ class TestAuthenticationCommand:
]
mock_console_print.assert_has_calls(expected_calls)
@patch("crewai.cli.tools.main.ToolCommand")
@patch("crewai_cli.tools.main.ToolCommand")
@patch("crewai.cli.authentication.main.console.print")
def test_login_to_tool_repository_error(
self, mock_console_print, mock_tool_command