Skip to content
Merged
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
31 changes: 19 additions & 12 deletions agentstack/cli/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,31 @@
- install dependencies
- insert Tasks, Agents and Tools
"""
# TODO prevent the user from passing the --path argument to init
if template and use_wizard:
raise Exception("Template and wizard flags cannot be used together")

Check warning on line 81 in agentstack/cli/init.py

View check run for this annotation

Codecov / codecov/patch

agentstack/cli/init.py#L81

Added line #L81 was not covered by tests

require_uv()
welcome_message()

Check warning on line 84 in agentstack/cli/init.py

View check run for this annotation

Codecov / codecov/patch

agentstack/cli/init.py#L84

Added line #L84 was not covered by tests

# TODO prevent the user from passing the --path argument to init
if slug_name:
if not is_snake_case(slug_name):
raise Exception("Project name must be snake_case")
conf.set_path(conf.PATH / slug_name)
else:
raise Exception("No project directory specified.\n Run `agentstack init <project_name>`")
if not slug_name:
log.info(

Check warning on line 87 in agentstack/cli/init.py

View check run for this annotation

Codecov / codecov/patch

agentstack/cli/init.py#L87

Added line #L87 was not covered by tests
"Provide a project name. This will be used to create a new directory in the "
"current path and will be used as the project name. 🐍 Must be snake_case."
)
slug_name = inquirer.text(

Check warning on line 91 in agentstack/cli/init.py

View check run for this annotation

Codecov / codecov/patch

agentstack/cli/init.py#L91

Added line #L91 was not covered by tests
message="Project name (snake_case)",
)

if not slug_name:
raise Exception("Project name cannot be empty")

Check warning on line 96 in agentstack/cli/init.py

View check run for this annotation

Codecov / codecov/patch

agentstack/cli/init.py#L96

Added line #L96 was not covered by tests
if not is_snake_case(slug_name):
raise Exception("Project name must be snake_case")

Check warning on line 98 in agentstack/cli/init.py

View check run for this annotation

Codecov / codecov/patch

agentstack/cli/init.py#L98

Added line #L98 was not covered by tests

conf.set_path(conf.PATH / slug_name)

Check warning on line 100 in agentstack/cli/init.py

View check run for this annotation

Codecov / codecov/patch

agentstack/cli/init.py#L100

Added line #L100 was not covered by tests
if os.path.exists(conf.PATH): # cookiecutter requires the directory to not exist
raise Exception(f"Directory already exists: {conf.PATH}")

if template and use_wizard:
raise Exception("Template and wizard flags cannot be used together")

welcome_message()

if use_wizard:
log.debug("Initializing new project with wizard.")
template_data = run_wizard(slug_name)
Expand Down