Public/New-DevProject.ps1

function New-DevProject {
    <#
    .SYNOPSIS
    Creates a development project scaffold.

    .DESCRIPTION
    Creates a contained project directory and adds the default environment
    and DevXToolkit configuration. Existing project directories are rejected.

    .PARAMETER Name
    Project directory name. Rooted paths and parent traversal are rejected.

    .PARAMETER Path
    Parent directory in which the project is created.

    .EXAMPLE
    New-DevProject -Name Demo -Path C:\projects
    #>

    [CmdletBinding(SupportsShouldProcess = $true)]
    param(
        [Parameter(Mandatory)]
        [string]$Name,

        [Parameter()]
        [string]$Path = (Get-Location).Path
    )

    $ProjectRoot = Resolve-DtContainedPath -BasePath $Path -ChildName $Name
    if (Test-Path $ProjectRoot) {
        throw "Project '$Name' already exists at $Path"
    }

    if (-not $PSCmdlet.ShouldProcess($ProjectRoot, 'Create development project')) {
        return
    }

    New-Item -ItemType Directory -Path $ProjectRoot -Force | Out-Null
    New-DevEnvironment -Path $ProjectRoot -Confirm:$false
    New-DevConfig -Path $ProjectRoot -Confirm:$false

    Write-Information "Project created: $ProjectRoot" -InformationAction Continue
}