Forge
powershelldeeb25a2
1# Регистрация cide:// для dev (ADR 0157). Запуск от текущего пользователя (HKCU).
2param(
3 [string]$ExePath = "",
4 [switch]$Unregister
5)
6
7$ErrorActionPreference = "Stop"
8
9if ([string]::IsNullOrWhiteSpace($ExePath)) {
10 $repoRoot = Split-Path -Parent $PSScriptRoot
11 $candidates = @(
12 (Join-Path $repoRoot "bin\Debug\net10.0\win-x64\CascadeIDE.exe"),
13 (Join-Path $repoRoot "bin\Debug\net10.0\CascadeIDE.exe"),
14 "D:\cascade-ide-debug\CascadeIDE.exe"
15 )
16 foreach ($c in $candidates) {
17 if (Test-Path -LiteralPath $c) {
18 $ExePath = (Resolve-Path -LiteralPath $c).Path
19 break
20 }
21 }
22}
23
24if ([string]::IsNullOrWhiteSpace($ExePath) -or -not (Test-Path -LiteralPath $ExePath)) {
25 Write-Error "CascadeIDE.exe not found. Pass -ExePath or publish debug first."
26}
27
28$scheme = "cide"
29$baseKey = "Registry::HKEY_CURRENT_USER\Software\Classes\$scheme"
30
31if ($Unregister) {
32 if (Test-Path -LiteralPath $baseKey) {
33 Remove-Item -LiteralPath $baseKey -Recurse -Force
34 Write-Host "Removed $scheme:// protocol registration."
35 }
36 return
37}
38
39New-Item -Path $baseKey -Force | Out-Null
40Set-ItemProperty -Path $baseKey -Name "(Default)" -Value "URL:Cascade IDE Magic Link"
41Set-ItemProperty -Path $baseKey -Name "URL Protocol" -Value ""
42
43$iconKey = Join-Path $baseKey "DefaultIcon"
44New-Item -Path $iconKey -Force | Out-Null
45Set-ItemProperty -Path $iconKey -Name "(Default)" -Value "$ExePath,0"
46
47$commandKey = Join-Path $baseKey "shell\open\command"
48New-Item -Path $commandKey -Force | Out-Null
49$command = "`"$ExePath`" `"%1`""
50Set-ItemProperty -Path $commandKey -Name "(Default)" -Value $command
51
52Write-Host "Registered $scheme:// -> $ExePath"
53Write-Host "Example: ${scheme}://reveal?root=$( [uri]::EscapeDataString($repoRoot) )&f=Program.cs&l=1"
54
View only · write via MCP/CIDE