Skip to content

azd init -t should auto-create a project folder like git clone #7289

@spboyer

Description

@spboyer

Summary

When running azd init -t <template>, template files are extracted directly into the current working directory. This scatters template files among existing project files, which surprises users.

Users expect azd init -t to work like git clone — automatically creating a new folder named after the template and initializing the project inside it.

User Study Finding (from #4032)

Several participants ran init in a non-empty directory and were surprised when the template files scattered among their existing files (vs in a contained folder). "Would have preferred if it went into a folder kind of like how GitHub does when you clone things."

Proposed Behavior

# Auto-creates folder, initializes inside it
$ azd init -t todo-nodejs-mongo
Initializing project in 'todo-nodejs-mongo'...
→ creates todo-nodejs-mongo/, inits everything inside it

# Explicit folder name
$ azd init -t todo-nodejs-mongo my-project
→ creates my-project/

# Opt-in to current directory (preserves existing behavior)
$ azd init -t todo-nodejs-mongo .
→ initializes in current directory

Key Details

  • Add optional [directory] positional argument to azd init
  • Auto-derive folder name from template path (following git clone conventions)
  • os.Chdir() into the new folder within the azd process so the entire init pipeline (template extraction, azure.yaml, git init, --up) operates from inside
  • Print post-init message with cd hint for the user's shell
  • . as directory preserves current behavior
  • --from-code and --minimal modes unchanged (always use CWD)

Related

Metadata

Metadata

Labels

area/core-cliCLI commands, cmd/, internal/cmd/

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions