Skip to content

Commit d952be3

Browse files
committed
feat(windows): add curl benchmark launcher [skip jenkins] [skip ci]
1 parent 5cc6996 commit d952be3

3 files changed

Lines changed: 99 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,21 @@ MCP client configuration. Afterward, run `codebase-memory-cli install
168168
`codebase-memory-cli install-hooks` separately only if you explicitly want
169169
CLI-owned agent hooks.
170170

171+
To download the latest published Windows package, install its exact bytes, and
172+
run the five-repository benchmark in one command, review and run the launcher
173+
from the Windows benchmark runbook:
174+
175+
```powershell
176+
$launcher = Join-Path $env:TEMP 'cbm-fetch-benchmark.ps1'
177+
curl.exe -fsSL https://raw.githubusercontent.com/ngallodev/codebase-memory-cli/main/scripts/qualification/fetch-install-run-windows-benchmark.ps1 -o $launcher
178+
pwsh.exe -NoProfile -File $launcher -ReleaseTag <exact-release-tag>
179+
```
180+
181+
It verifies the package against `checksums.txt`, uses the matching source tag,
182+
installs the native executable, and stores timestamped benchmark evidence under
183+
`C:\cbm-benchmark`. See [`docs/WINDOWS_BENCHMARK_RUNBOOK.md`](docs/WINDOWS_BENCHMARK_RUNBOOK.md)
184+
for prerequisites and the full qualification path.
185+
171186
## Human and machine output
172187

173188
Human-readable output is the default. `--json` is the stable machine-oriented surface for the canonical commands in this slice.

‎docs/WINDOWS_BENCHMARK_RUNBOOK.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ Record the hash and ensure it matches the draft-release artifact/evidence.
4242

4343
## Preferred one-command RC qualification
4444

45+
For a published release, a Windows machine can fetch the launcher from `main` and run the
46+
package-install plus corpus benchmark without building source locally. Review the downloaded
47+
script before executing it; pin `-ReleaseTag` for reproducible runs:
48+
49+
```powershell
50+
$launcher = Join-Path $env:TEMP 'cbm-fetch-benchmark.ps1'
51+
curl.exe -fsSL https://raw.githubusercontent.com/ngallodev/codebase-memory-cli/main/scripts/qualification/fetch-install-run-windows-benchmark.ps1 -o $launcher
52+
pwsh.exe -NoProfile -File $launcher -ReleaseTag <exact-release-tag>
53+
```
54+
55+
The launcher verifies `codebase-memory-cli-windows-amd64.zip` against `checksums.txt`, installs the
56+
exact package, clones the matching source tag, and runs the five-repository corpus. Evidence is
57+
kept under a timestamped directory below `C:\cbm-benchmark`.
58+
4559
For the first CLI-first Windows RC, use the top-level orchestrator from a **clean checkout of the exact RC source/tag**. It acquires the draft Windows artifact when local paths are not supplied, verifies archive/executable identity, captures machine state, runs portable/recovery/installed-product qualification, executes the retained Windows guards against the supplied executable, freezes/runs the five-repository corpus, and creates promotion-compatible evidence.
4660

4761
```powershell
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
[CmdletBinding()]
2+
param(
3+
[string]$Repository = 'ngallodev/codebase-memory-cli',
4+
[string]$ReleaseTag = '',
5+
[string]$Root = 'C:\cbm-benchmark',
6+
[int]$Repeats = 5
7+
)
8+
9+
$ErrorActionPreference = 'Stop'
10+
if ($PSVersionTable.PSVersion.Major -lt 7) { throw 'PowerShell 7 or newer is required' }
11+
foreach ($command in @('git.exe', 'python.exe')) {
12+
if (-not (Get-Command $command -ErrorAction SilentlyContinue)) { throw "$command is required" }
13+
}
14+
15+
$stamp = [DateTime]::UtcNow.ToString('yyyyMMddTHHmmssZ')
16+
$runRoot = Join-Path $Root "run-$stamp"
17+
$sourceRoot = Join-Path $runRoot 'source'
18+
$artifactRoot = Join-Path $runRoot 'artifact'
19+
$installRoot = Join-Path $runRoot 'install'
20+
$workspaceRoot = Join-Path $runRoot 'repos'
21+
$resultsRoot = Join-Path $runRoot 'results'
22+
New-Item -ItemType Directory -Force $artifactRoot, $installRoot, $workspaceRoot, $resultsRoot | Out-Null
23+
24+
$apiRoot = "https://api.github.com/repos/$Repository/releases"
25+
$release = if ($ReleaseTag) {
26+
Invoke-RestMethod -Uri "$apiRoot/tags/$ReleaseTag" -Headers @{ 'User-Agent' = 'codebase-memory-cli-benchmark' }
27+
} else {
28+
Invoke-RestMethod -Uri "$apiRoot/latest" -Headers @{ 'User-Agent' = 'codebase-memory-cli-benchmark' }
29+
}
30+
$ReleaseTag = [string]$release.tag_name
31+
if (-not $ReleaseTag) { throw 'GitHub release has no tag name' }
32+
$zipAsset = @($release.assets | Where-Object name -eq 'codebase-memory-cli-windows-amd64.zip')
33+
$sumAsset = @($release.assets | Where-Object name -eq 'checksums.txt')
34+
if ($zipAsset.Count -ne 1 -or $sumAsset.Count -ne 1) { throw "release $ReleaseTag is missing the Windows package or checksums.txt" }
35+
$zipPath = Join-Path $artifactRoot $zipAsset[0].name
36+
$sumPath = Join-Path $artifactRoot $sumAsset[0].name
37+
Invoke-WebRequest -Uri $zipAsset[0].browser_download_url -OutFile $zipPath
38+
Invoke-WebRequest -Uri $sumAsset[0].browser_download_url -OutFile $sumPath
39+
$publishedHash = (Select-String -LiteralPath $sumPath -Pattern "^([0-9A-Fa-f]{64})\s+\*?$([regex]::Escape($zipAsset[0].name))$").Matches | Select-Object -First 1
40+
if (-not $publishedHash) { throw "checksums.txt has no entry for $($zipAsset[0].name)" }
41+
$actualHash = (Get-FileHash -LiteralPath $zipPath -Algorithm SHA256).Hash.ToLowerInvariant()
42+
if ($actualHash -ne $publishedHash.Groups[1].Value.ToLowerInvariant()) { throw 'Windows package checksum mismatch' }
43+
44+
$extractRoot = Join-Path $artifactRoot 'extracted'
45+
Expand-Archive -LiteralPath $zipPath -DestinationPath $extractRoot
46+
$candidate = @(Get-ChildItem -LiteralPath $extractRoot -Recurse -File -Filter 'codebase-memory-cli.exe')
47+
if ($candidate.Count -ne 1) { throw "expected one codebase-memory-cli.exe, found $($candidate.Count)" }
48+
49+
& git.exe clone --depth 1 --branch $ReleaseTag "https://github.com/$Repository.git" $sourceRoot
50+
if ($LASTEXITCODE) { throw "could not clone source tag $ReleaseTag" }
51+
$sourceCommit = (& git.exe -C $sourceRoot rev-parse HEAD).Trim()
52+
53+
$setup = Join-Path $sourceRoot 'scripts\setup-windows.ps1'
54+
& pwsh.exe -NoProfile -File $setup -Binary $candidate[0].FullName -InstallDir $installRoot -NoPathPrompt
55+
if ($LASTEXITCODE) { throw 'binary installation failed' }
56+
$installed = Join-Path $installRoot 'codebase-memory-cli.exe'
57+
58+
$corpus = Join-Path $sourceRoot 'scripts\qualification\run-windows-benchmark-corpus.ps1'
59+
& pwsh.exe -NoProfile -File $corpus `
60+
-CandidateBinary $installed `
61+
-WorkspaceRoot $workspaceRoot `
62+
-ResultsRoot $resultsRoot `
63+
-CodebaseMemoryRef $sourceCommit `
64+
-Repeats $Repeats `
65+
-Initialize
66+
if ($LASTEXITCODE) { throw 'Windows benchmark failed' }
67+
68+
Write-Host "Benchmark complete: $runRoot"
69+
Write-Host "Release tag: $ReleaseTag"
70+
Write-Host "Source commit: $sourceCommit"

0 commit comments

Comments
 (0)