refactor: remove cli/ from crewai package and relocate to proper modules

Move framework infrastructure out of crewai/cli/ to dedicated modules:
- cli/authentication/ → crewai/auth/
- cli/config.py → crewai/settings.py
- cli/constants.py → crewai/constants.py
- cli/plus_api.py → crewai/plus_api.py
- cli/version.py → crewai/version.py
- cli/crew_chat.py → crewai/utilities/crew_chat.py
- cli/reset_memories_command.py → crewai/utilities/reset_memories.py
- cli/utils.py (framework parts) → crewai/utilities/project_utils.py

Delete CLI-only duplicates (command.py, git.py, provider.py) already
present in crewai_cli. Replace _login_to_tool_repository with a
_post_login() hook in AuthenticationCommand. Update all imports and
mock.patch paths across both packages and tests.
This commit is contained in:
Greyson Lalonde
2026-03-15 19:39:55 -04:00
parent cf1636c300
commit 7afca5daab
57 changed files with 324 additions and 1025 deletions

View File

@@ -1,7 +1,7 @@
"""Wrapper for the crew chat command.
Delegates to ``crewai.cli.crew_chat.run_chat`` when the full crewai package is
installed, otherwise prints a helpful error message.
Delegates to ``crewai.utilities.crew_chat.run_chat`` when the full crewai
package is installed, otherwise prints a helpful error message.
"""
from __future__ import annotations
@@ -11,7 +11,7 @@ import click
def run_chat() -> None:
try:
from crewai.cli.crew_chat import run_chat as _run_chat
from crewai.utilities.crew_chat import run_chat as _run_chat
except ImportError:
click.secho(
"The 'chat' command requires the full crewai package.\n"

View File

@@ -1,6 +1,6 @@
"""Wrapper for the reset-memories command.
Delegates to ``crewai.cli.reset_memories_command`` when the full crewai
Delegates to ``crewai.utilities.reset_memories`` when the full crewai
package is installed, otherwise prints a helpful error message.
"""
@@ -17,7 +17,7 @@ def reset_memories_command(
all: bool,
) -> None:
try:
from crewai.cli.reset_memories_command import (
from crewai.utilities.reset_memories import (
reset_memories_command as _reset,
)
except ImportError:

View File

@@ -246,7 +246,7 @@ def is_valid_tool(obj: Any) -> bool:
Falls back to crewai's ``is_valid_tool`` when available.
"""
try:
from crewai.cli.utils import is_valid_tool as _core_is_valid_tool
from crewai.utilities.project_utils import is_valid_tool as _core_is_valid_tool
return _core_is_valid_tool(obj)
except ImportError: