52 lines
1.8 KiB
PowerShell
52 lines
1.8 KiB
PowerShell
#requires -Version 5.1
|
|
<#
|
|
.SYNOPSIS
|
|
Compatibility wrapper for the Plan-21 global `casan init` workflow.
|
|
|
|
.DESCRIPTION
|
|
New deployments should run `install.ps1` once and then `casan init` in each
|
|
project. This wrapper remains for existing automation, but delegates all
|
|
merge, pin, bootstrap, doctor, and VS Code behavior to the canonical CLI.
|
|
#>
|
|
[CmdletBinding()]
|
|
param(
|
|
[ValidateSet('install', 'doctor', 'uninstall')] [string]$Action = 'install',
|
|
[ValidateSet('claude', 'codex', 'vscode-copilot', 'all')] [string]$Client = 'all',
|
|
[string]$Target = (Get-Location).Path,
|
|
[ValidateSet('observe', 'enforce')] [string]$Mode = 'enforce'
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
function Resolve-Casan {
|
|
$command = Get-Command casan -ErrorAction SilentlyContinue
|
|
if ($command) { return $command.Source }
|
|
$home = if ($env:CASAN_HOME) { $env:CASAN_HOME } else { Join-Path $env:LOCALAPPDATA 'casan' }
|
|
$fallback = Join-Path $home 'bin\casan.cmd'
|
|
if (Test-Path $fallback) { return $fallback }
|
|
throw 'CASAN global launcher not found. Run install.ps1 first, then restart the shell.'
|
|
}
|
|
|
|
$casan = Resolve-Casan
|
|
$Target = (Resolve-Path $Target).Path
|
|
|
|
switch ($Action) {
|
|
'install' {
|
|
& $casan init --target $Target --client $Client --mode $Mode --non-interactive --vscode-install auto
|
|
exit $LASTEXITCODE
|
|
}
|
|
'doctor' {
|
|
& $casan doctor --target $Target --client $Client
|
|
exit $LASTEXITCODE
|
|
}
|
|
'uninstall' {
|
|
# Safe compatibility behavior: remove only CASAN handlers/recommendations.
|
|
# Runtime evidence and pin/config are retained for audit/re-adoption.
|
|
& $casan init --target $Target --client none --level 1 --non-interactive --vscode-install no
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host '[casan] integrations disabled; audit state and .casan pin retained.'
|
|
}
|
|
exit $LASTEXITCODE
|
|
}
|
|
}
|