new_project
What it is
A click command (new project) that scaffolds a new Naas ABI project directory from templates, creates an initial module under src/, optionally generates local deployment scaffolding, installs dependencies via uv, and validates ABI configuration.
Public API
new_project(project_name: str | None, project_path: str | None, with_local_deploy: bool, with_headscale: bool)- Registered as
new projectunder thenewcommand group. - Responsibilities:
- Normalize and default
project_name/project_path. - Ensure target directory exists and is empty.
- Copy project template files into destination.
- Create a module in
<project_path>/srcvianew_module(..., quiet=True). - Optionally run
setup_local_deploy(..., include_headscale=...). - Run
uv add ...to install dependencies. - Run
uv run abi config validateto validate configuration.
- Normalize and default
- Registered as
CLI inputs:
- Arguments:
project-name(optional): Project name; converted to kebab-case. Defaults to current directory name.project-path(optional): Base path; defaults to current working directory.
- Options:
--with-local-deploy / --without-local-deploy(default: enabled)--with-headscale / --without-headscale(default: disabled)
Configuration/Dependencies
- Template source directory (internal):
<naas_abi_cli package>/cli/new/templates/project
- External commands executed (must be available in
PATH):uv(used foruv addanduv run ...)abi(invoked viauv run abi config validate)
- Python-level dependencies used:
clicknaas_abi_clinaas_abi_cli.cli.deploy.local.setup_local_deploynaas_abi_cli.cli.utils.Copier.Copiernew_modulefrom sibling module
Dependencies installed into the generated project (via uv add):
naas-abi-core[all]naas-abi-marketplace[ai-chatgpt]naas-abinaas-abi-cli
Usage
Run via the CLI entrypoint that exposes the new command group:
# Create a project in ./my-project (folder will be created if missing)
abi new project my-project .
# Create using defaults (name = current folder name, path = current folder)
abi new project
# Disable local deploy scaffolding
abi new project my-project . --without-local-deploy
# Include headscale in local deploy scaffolding
abi new project my-project . --with-headscaleCaveats
- The destination folder must be empty; if it exists and contains files, the command prints an error and exits with code
1. project_pathis normalized to an absolute path, and the final directory is forced to end with the (kebab-cased)project_name.- The command runs
uvsubprocesses withcheck=True; failures in dependency install or config validation will raise an error and stop execution.