Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ Initialize a new Xaibo project with recommended structure.
### Syntax

```bash
uvx xaibo init <project_name>
uvx xaibo init <project_name> [--python <version>]
```

### Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `project_name` | `str` | Yes | Name of the project directory to create |
| `--python` | `str` | No | Python version to use (e.g., `3.11`, `3.12`, `3.13`). If not specified, uv will use the version from `.python-version` file, or the first Python found on PATH |

### Generated Structure

Expand All @@ -42,6 +43,9 @@ project_name/
# Create a new project
uvx xaibo init my_agent_project

# Create a new project with specific Python version
uvx xaibo init my_agent_project --python 3.12

# Navigate to project
cd my_agent_project

Expand Down
9 changes: 8 additions & 1 deletion src/xaibo/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,12 @@ def init(args, extra_args=[]):
project_name = args.project_name
curdir = Path(os.getcwd())
project_dir = curdir / project_name
universal_run(f"uv init --bare {project_name}", cwd=curdir)

# Build uv init command with optional python version
uv_init_cmd = f"uv init --bare {project_name}"
if args.python:
uv_init_cmd += f" --python {args.python}"
universal_run(uv_init_cmd, cwd=curdir)
universal_run(f"uv add xaibo xaibo[{','.join(modules)}] pytest", cwd=project_dir)

(project_dir / "agents").mkdir()
Expand Down Expand Up @@ -509,6 +514,8 @@ def main():
# 'init' command.
init_parser = subparsers.add_parser('init', help='Initialize a Xaibo project')
init_parser.add_argument('project_name', type=str, help='Name of the project')
init_parser.add_argument('--python', type=str, default=None,
help='Python version to use (e.g., 3.11, 3.12, 3.13). If not specified, uv will use the version from .python-version file, or the first Python found on PATH.')
init_parser.set_defaults(func=init)

# 'eject' command
Expand Down