$ErrorActionPreference = "Stop" $archiveUrl = "https://dev.ast.ltr.kz/Logos/codex-plugins/archive/main.zip" $installRoot = Join-Path $env:LOCALAPPDATA "Logos\codex-plugins" $tempRoot = Join-Path ([IO.Path]::GetTempPath()) ("logos-codex-plugins-" + [guid]::NewGuid()) $zipPath = Join-Path $tempRoot "marketplace.zip" $extractRoot = Join-Path $tempRoot "extract" New-Item -ItemType Directory -Path $tempRoot, $extractRoot -Force | Out-Null try { Invoke-WebRequest -UseBasicParsing -Uri $archiveUrl -OutFile $zipPath Expand-Archive -Path $zipPath -DestinationPath $extractRoot -Force $sourceRoot = Join-Path $extractRoot "codex-plugins" $sourceMarketplace = Join-Path $sourceRoot ".agents\plugins\marketplace.json" if (-not (Test-Path $sourceMarketplace)) { throw "В загруженном архиве не найден marketplace.json." } New-Item -ItemType Directory -Path (Split-Path $installRoot -Parent) -Force | Out-Null if (Test-Path $installRoot) { Remove-Item -Path $installRoot -Recurse -Force } Move-Item -Path $sourceRoot -Destination $installRoot } finally { if (Test-Path $tempRoot) { Remove-Item -Path $tempRoot -Recurse -Force } } $marketplacePath = Join-Path $installRoot ".agents\plugins\marketplace.json" $encodedPath = [uri]::EscapeDataString($marketplacePath) $pluginUrl = "codex://plugins/tax-code-research?marketplacePath=$encodedPath" Start-Process $pluginUrl Write-Host "Карточка плагина открыта. Нажмите «Установить», затем откройте новый рабочий чат." -ForegroundColor Green