Compare commits

...

3 Commits

Author SHA1 Message Date
lorenzejay
00342c405f Merge branch 'main' of github.com:crewAIInc/crewAI into lorenze/crewai-create-tool-cli 2025-07-09 14:06:55 -07:00
lorenzejay
323027e597 Merge branch 'main' of github.com:crewAIInc/crewAI into lorenze/crewai-create-tool-cli 2025-07-08 13:35:06 -07:00
lorenzejay
6d6cdc7844 feat: extend create command to support tool creation
Updated the CLI to allow the creation of tools in addition to crews and flows. The command now accepts a new argument type "tool" and includes appropriate error handling for invalid types. This enhancement improves the flexibility of the CLI for users managing various components.
2025-07-08 13:31:45 -07:00
3 changed files with 11 additions and 8 deletions

View File

@@ -40,7 +40,7 @@ This installs the tool and adds it to `pyproject.toml`.
To create a new tool project: To create a new tool project:
```bash ```bash
crewai tool create <tool-name> crewai create tool <tool-name>
``` ```
This generates a scaffolded tool project locally. This generates a scaffolded tool project locally.

View File

@@ -40,7 +40,7 @@ Isso instala a ferramenta e a adiciona ao `pyproject.toml`.
Para criar um novo projeto de ferramenta: Para criar um novo projeto de ferramenta:
```bash ```bash
crewai tool create <nome-da-ferramenta> crewai create tool <nome-da-ferramenta>
``` ```
Isso gera um projeto de ferramenta estruturado localmente. Isso gera um projeto de ferramenta estruturado localmente.

View File

@@ -33,18 +33,21 @@ def crewai():
@crewai.command() @crewai.command()
@click.argument("type", type=click.Choice(["crew", "flow"])) @click.argument("type", type=click.Choice(["crew", "flow", "tool"]))
@click.argument("name") @click.argument("name")
@click.option("--provider", type=str, help="The provider to use for the crew") @click.option("--provider", type=str, help="The provider to use for the crew")
@click.option("--skip_provider", is_flag=True, help="Skip provider validation") @click.option("--skip_provider", is_flag=True, help="Skip provider validation")
def create(type, name, provider, skip_provider=False): def create(type, name, provider, skip_provider=False):
"""Create a new crew, or flow.""" """Create a new crew, flow, or tool."""
if type == "crew": if type == "crew":
create_crew(name, provider, skip_provider) create_crew(name, provider, skip_provider)
elif type == "flow": elif type == "flow":
create_flow(name) create_flow(name)
elif type == "tool":
tool_cmd = ToolCommand()
tool_cmd.create(name)
else: else:
click.secho("Error: Invalid type. Must be 'crew' or 'flow'.", fg="red") click.secho("Error: Invalid type. Must be 'crew', 'flow', or 'tool'.", fg="red")
@crewai.command() @crewai.command()
@@ -357,7 +360,7 @@ def chat():
and using the Chat LLM to generate responses. and using the Chat LLM to generate responses.
""" """
click.secho( click.secho(
"\nStarting a conversation with the Crew\n" "Type 'exit' or Ctrl+C to quit.\n", "\nStarting a conversation with the Crew\nType 'exit' or Ctrl+C to quit.\n",
) )
run_chat() run_chat()