Files
AirCoding/AirPlan/docs/spec/AirPlan-ParaV2/install_aircontext_local.ps1
AirCoding ae44be31d5 chore: push all design docs, V2 plan specs, and current working state
Includes AirPlan design documents, AircOding-alpha1-plan, AirPlanV2,
AirPlan-ParaV2, AirPlan-Para V1 reference docs, and all working code
changes across packages.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-12 17:12:29 +08:00

53 lines
2.0 KiB
PowerShell
Executable File

$ErrorActionPreference = "Stop"
$bundleRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
$homeRoot = [Environment]::GetFolderPath("UserProfile")
$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
$backupRoot = Join-Path $homeRoot "airplan-backups\$timestamp"
$sourceRoot = Join-Path $bundleRoot "AirContextServer"
$targetRoot = Join-Path $homeRoot "AirContextServer"
$snippetPath = Join-Path $bundleRoot "aircontext-settings-snippet.json"
function Backup-ItemIfExists {
param(
[Parameter(Mandatory = $true)][string]$SourcePath,
[Parameter(Mandatory = $true)][string]$BackupRelativePath
)
if (-not (Test-Path -LiteralPath $SourcePath)) {
return
}
$backupPath = Join-Path $backupRoot $BackupRelativePath
$backupParent = Split-Path -Parent $backupPath
if ($backupParent) {
New-Item -ItemType Directory -Path $backupParent -Force | Out-Null
}
Copy-Item -LiteralPath $SourcePath -Destination $backupPath -Recurse -Force
}
function Replace-Directory {
param(
[Parameter(Mandatory = $true)][string]$SourcePath,
[Parameter(Mandatory = $true)][string]$TargetPath
)
$targetParent = Split-Path -Parent $TargetPath
if ($targetParent) {
New-Item -ItemType Directory -Path $targetParent -Force | Out-Null
}
if (Test-Path -LiteralPath $TargetPath) {
Remove-Item -LiteralPath $TargetPath -Recurse -Force
}
Copy-Item -LiteralPath $SourcePath -Destination $TargetPath -Recurse -Force
}
New-Item -ItemType Directory -Path $backupRoot -Force | Out-Null
Backup-ItemIfExists -SourcePath $targetRoot -BackupRelativePath "AirContextServer"
Replace-Directory -SourcePath $sourceRoot -TargetPath $targetRoot
Write-Output "aircontext_stage=completed"
Write-Output ("aircontext_root=" + $targetRoot)
Write-Output ("settings_snippet=" + $snippetPath)
Write-Output "next_step=merge the snippet into %USERPROFILE%\.claude\settings.json or settings.local.json and enable aircontext@aircontext-mkt"