Forge
powershelldeeb25a2
1#!/usr/bin/env pwsh
2# Копирует собранный kb-base-cide.zip в KbBase/ (резервный путь: publish встроен в agent-notes scripts/build-kb-base-cide.ps1).
3# Используй, если сборка была с -SkipPublishToCascadeIde или zip лежит не в dist по умолчанию.
4# Пример из корня cascade-ide: pwsh ./tools/publish-kb-base-embed.ps1
5# Пример с явными путями: pwsh ./tools/publish-kb-base-embed.ps1 -SourceZip D:\repos\agent-notes\dist\kb-base-cide.zip
6
7param(
8 [Parameter(HelpMessage = "Прямой путь к kb-base-cide.zip")]
9 [string] $SourceZip = "",
10
11 [Parameter(HelpMessage = "Корень репозитория agent-notes (ожидается dist/kb-base-cide.zip)")]
12 [string] $AgentNotesRoot = ""
13)
14
15Set-StrictMode -Version Latest
16$ErrorActionPreference = "Stop"
17
18$cascadeIdeRoot = Split-Path -Parent $PSScriptRoot
19$targetDir = Join-Path $cascadeIdeRoot "KbBase"
20$targetZip = Join-Path $targetDir "kb-base-cide.zip"
21
22$openRoot = Split-Path -Parent $cascadeIdeRoot
23$defaultAgentNotesDist = Join-Path $openRoot "agent-notes/dist/kb-base-cide.zip"
24
25$resolvedSource = ""
26if ($SourceZip -ne "") {
27 $resolvedSource = (Resolve-Path -LiteralPath $SourceZip).Path
28}
29elseif ($AgentNotesRoot -ne "") {
30 $candidate = Join-Path $AgentNotesRoot "dist/kb-base-cide.zip"
31 $resolvedSource = (Resolve-Path -LiteralPath $candidate).Path
32}
33elseif (Test-Path -LiteralPath $defaultAgentNotesDist) {
34 $resolvedSource = (Resolve-Path -LiteralPath $defaultAgentNotesDist).Path
35}
36
37if ([string]::IsNullOrWhiteSpace($resolvedSource) -or -not (Test-Path -LiteralPath $resolvedSource)) {
38 Write-Error @"
39Не найден источник zip. Укажи один из вариантов:
40 -SourceZip <полный путь к kb-base-cide.zip>
41 -AgentNotesRoot <корень agent-notes>
42Или положи сборку по пути sibling: $defaultAgentNotesDist
43"@
44 exit 2
45}
46
47New-Item -ItemType Directory -Force -Path $targetDir | Out-Null
48Copy-Item -LiteralPath $resolvedSource -Destination $targetZip -Force
49Write-Host "OK -> $targetZip"
50Write-Host " <- $resolvedSource"
51
View only · write via MCP/CIDE