Skip to content

Commit ae6cb97

Browse files
committed
fix: veadk create supports the agent_name parameter
1 parent b423f58 commit ae6cb97

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

docs/content/90.cli/2.commands.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,20 @@ navigation:
1010
使用 `veadk create` 命令在当前目录中创建一个新的智能体项目脚手架。
1111

1212
```bash
13-
veadk create [OPTIONS]
13+
veadk create [AGENT_NAME] [OPTIONS]
1414
```
1515

16-
选项包括:
16+
### 参数
17+
18+
- `AGENT_NAME`: 要创建的智能体的名称。如果未提供,将会提示您输入。
19+
20+
### 选项
1721

18-
- `--agent-name`:智能体的名称。如果未提供,将会提示您输入。
1922
- `--ark-api-key`:ARK API 密钥。如果未提供,将会提示您输入或稍后在 `config.yaml` 文件中配置。
2023

2124
执行 `veadk create` 命令后,它会:
2225

23-
1. 提示您输入智能体名称(如果未通过 `--agent-name` 提供)。
26+
1. 提示您输入智能体名称(如果未作为参数提供)。
2427
2. 提示您输入 ARK API 密钥(如果未通过 `--ark-api-key` 提供),您可以选择立即输入或稍后在生成的 `config.yaml` 文件中手动配置。
2528
3. 在当前目录下创建一个以智能体名称命名的新目录。
2629
4. 在新目录中生成以下文件:

tests/cli/test_cli_create.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
def test_create_agent_with_options():
2121
runner = CliRunner()
2222
with runner.isolated_filesystem() as temp_dir:
23-
result = runner.invoke(
24-
create, ["--agent-name", "test-agent", "--ark-api-key", "test-key"]
25-
)
23+
result = runner.invoke(create, ["test-agent", "--ark-api-key", "test-key"])
2624
assert result.exit_code == 0
2725

2826
agent_folder = Path(temp_dir) / "test-agent"
@@ -44,22 +42,20 @@ def test_create_agent_overwrite_existing_directory():
4442
runner = CliRunner()
4543
with runner.isolated_filesystem() as temp_dir:
4644
# First, create the agent
47-
runner.invoke(
48-
create, ["--agent-name", "test-agent", "--ark-api-key", "test-key"]
49-
)
45+
runner.invoke(create, ["test-agent", "--ark-api-key", "test-key"])
5046

5147
# Attempt to create it again, but cancel the overwrite
5248
result = runner.invoke(
5349
create,
54-
["--agent-name", "test-agent", "--ark-api-key", "test-key"],
50+
["test-agent", "--ark-api-key", "test-key"],
5551
input="n\n",
5652
)
5753
assert "Operation cancelled" in result.output
5854

5955
# Attempt to create it again, and confirm the overwrite
6056
result = runner.invoke(
6157
create,
62-
["--agent-name", "test-agent", "--ark-api-key", "new-key"],
58+
["test-agent", "--ark-api-key", "new-key"],
6359
input="y\n",
6460
)
6561
assert result.exit_code == 0

veadk/cli/cli_create.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def _generate_files(agent_name: str, ark_api_key: str, target_dir_path: Path) ->
9999

100100

101101
@click.command()
102-
@click.option("--agent-name", help="The name of the agent.")
102+
@click.argument("agent_name", required=False)
103103
@click.option("--ark-api-key", help="The ARK API key.")
104104
def create(agent_name: str, ark_api_key: str) -> None:
105105
"""Creates a new agent in the current folder with prepopulated agent template."""

0 commit comments

Comments
 (0)