Skip to content

Commit 309630c

Browse files
feat: add veadk init command in CLI module (#10)
* feat: add remote agent * feat: add veadk init command in CLI * fix: fix typos
1 parent d95de54 commit 309630c

File tree

10 files changed

+31
-5
lines changed

10 files changed

+31
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ print(res)
5959

6060
VeADK provides several useful command line tools for faster deployment and optimization, such as:
6161

62-
- `veadk deploy`: deploy your project to Volcengine VeFaaS platform
62+
- `veadk deploy`: deploy your project to Volcengine VeFaaS platform (you can use `veadk init` to init a demo project first)
6363
- `veadk prompt`: otpimize the system prompt of your agent by PromptPilot
6464

6565
## Contribution

veadk/a2a/remote_ve_agent.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,4 @@ def __init__(self, name: str, url: str):
1616

1717
agent_card_object = AgentCard.model_validate_json(str(agent_card_json_str))
1818

19-
super().__init__(
20-
name=name, description="weather reporter", agent_card=agent_card_object
21-
)
19+
super().__init__(name=name, agent_card=agent_card_object)

veadk/cli/main.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import importlib.util
1818
import os
19+
import shutil
1920
import sys
2021
from pathlib import Path
2122

@@ -30,6 +31,33 @@
3031
app = typer.Typer(name="vego")
3132

3233

34+
@app.command()
35+
def init():
36+
"""Init a veadk project that can be deployed to Volcengine VeFaaS."""
37+
from rich.prompt import Confirm, Prompt
38+
39+
cwd = Path.cwd()
40+
template_dir = Path(__file__).parent.resolve() / "services" / "vefaas" / "template"
41+
42+
name = Prompt.ask("Project name", default="veadk-cloud-agent")
43+
44+
target_dir = cwd / name
45+
46+
if target_dir.exists():
47+
response = Confirm.ask(
48+
f"Target directory '{target_dir}' already exists, do you want to overwrite it?: "
49+
)
50+
if not response:
51+
print("Operation cancelled.")
52+
return
53+
else:
54+
shutil.rmtree(target_dir) # 删除旧目录
55+
print(f"Deleted existing directory: {target_dir}")
56+
57+
shutil.copytree(template_dir, target_dir)
58+
print(f"Created new project: {name}")
59+
60+
3361
# @app.command()
3462
# def web(
3563
# path: str = typer.Option(".", "--path", help="Agent project path"),

samples/template-project-for-vefaas/README.md renamed to veadk/cli/services/vefaas/template/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ You must export your agent and short-term memory in `src/config.py`.
1919

2020
## Deploy
2121

22-
We recommand you deploy this project by the `cloud` module of VeADK.
22+
We recommend you deploy this project by the `cloud` module of VeADK.
2323

2424
```bash
2525
python deploy.py

samples/template-project-for-vefaas/config.yaml.example renamed to veadk/cli/services/vefaas/template/config.yaml.example

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

samples/template-project-for-vefaas/src/requirements.txt renamed to veadk/cli/services/vefaas/template/src/requirements.txt

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)