Invoke-MkCi.ps1

function Invoke-MkCi {
    <#
    .SYNOPSIS
    Creates a minimal CI/CD pipeline skeleton file.
 
    .DESCRIPTION
    Generates provider-specific CI skeletons for GitHub Actions, Azure Pipelines, or GitLab CI.
    Parent folders are created as needed. Existing files are not overwritten unless -Force is used.
 
    .PARAMETER Provider
    CI provider to scaffold. Supported values: GitHub, Azure, GitLab.
 
    .PARAMETER Force
    Overwrites CI file if it already exists.
 
    .EXAMPLE
    mkci -Provider GitHub
    #>

    [CmdletBinding()]
    [Alias('mkci')]
    param(
        [Parameter(Mandatory = $true)]
        [ValidateSet('GitHub', 'Azure', 'GitLab')]
        [string]$Provider,

        [switch]$Force
    )

    $cwd = Get-Location
    $path = $null
    $content = $null

    switch ($Provider) {
        'GitHub' {
            $workflowDir = Join-Path -Path $cwd -ChildPath '.github/workflows'
            if (-not (Test-Path -LiteralPath $workflowDir)) {
                New-DtDirectory -Path $workflowDir -Force:$Force | Out-Null
            }
            $path = Join-Path -Path $workflowDir -ChildPath 'main.yml'
            $content = @"
name: ci
 
on:
  push:
  pull_request:
 
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: TODO build
        run: echo "TODO: add build/test steps"
"@

        }
        'Azure' {
            $path = Join-Path -Path $cwd -ChildPath '.azure-pipelines.yml'
            $content = @"
trigger:
- main
 
pool:
  vmImage: ubuntu-latest
 
steps:
- checkout: self
- script: echo "TODO: add build/test steps"
  displayName: TODO build
"@

        }
        'GitLab' {
            $path = Join-Path -Path $cwd -ChildPath '.gitlab-ci.yml'
            $content = @"
stages:
  - build
 
build:
  stage: build
  script:
    - echo "TODO: add build/test steps"
"@

        }
    }

    Set-DtFileContent -Path $path -Content $content -Force:$Force | Out-Null

    if (Test-Path -LiteralPath $path) {
        Get-Item -LiteralPath $path
    }
}