Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

test-infra(vm): script-driven Windows VM leg for the local 3-OS gate

Martin Vogel343582aa93ee
diff --git a/test-infrastructure/vm/README.md b/test-infrastructure/vm/README.md
index 089287853..33b29610f 100644
--- a/test-infrastructure/vm/README.md
+++ b/test-infrastructure/vm/README.md
@@ -1,39 +1,86 @@
-# VM test legs (opt-in)
+# VM test legs — real-Windows and runner-macOS
Two failure classes cannot be reproduced by the container legs and need real
-virtual machines. Both stacks are free; the legs activate automatically in
-`run.sh` when the tooling and the named VM are detected, and print setup
-guidance otherwise.
+virtual machines. Both stacks are free. The Windows VM is a first-class part
+of the mandatory local-CI gate (see the repo's local-first workflow): it is
+driven entirely over ssh by reproducible scripts in this directory.
-## Windows VM (`run.sh windows-vm`) — real ACL/token/owner semantics
+## Windows VM — real ACL/token/owner semantics (script-driven)
-Wine only compile-checks Windows: kernel-real security semantics (object
-ownership, DACLs, token identity — e.g. the Administrators-default-owner
-policy on CI runners) need real Windows.
+Wine only compile-checks Windows. Kernel-real security semantics — object
+ownership, DACLs, token identity, the Administrators-default-owner policy on
+CI runners — need real Windows. The VM turns blind CI round-trips into a
+seconds-fast local loop with full stderr/debugger visibility.
-One-time setup (~15 min interactive):
+### Files
+
+| File | Runs where | Purpose |
+|---|---|---|
+| `windows-bootstrap.ps1` | inside the VM, once | OpenSSH + host key + CI owner-policy mirror |
+| `provision-windows.sh` | on the host | zero → fully-built, idempotent (disk-loss recovery) |
+| `win.sh` | on the host | daily driver: build / test / guards / install-E2E / shell |
+
+Host-local config (never committed): `~/.claude/cbm-vm/config` with
+`CBM_VM_HOST=<ip>` and `CBM_VM_USER=<user>`; ssh keypair at
+`~/.claude/cbm-vm/id_ed25519` (generate: `ssh-keygen -t ed25519 -N "" -C
+claude-cbm-vm -f ~/.claude/cbm-vm/id_ed25519`, public half goes into
+`windows-bootstrap.ps1`).
+
+### One-time VM creation (~30 min interactive, do it once, snapshot it)
1. `brew install --cask utm` (free/open source).
-2. Download the official **Windows 11 ARM64** ISO from
- https://www.microsoft.com/software-download/windows11arm64 (pick edition
- + language; a plain resumable download). Windows runs unactivated for
- testing (cosmetic watermark); add a license if you want it clean.
-3. Open **UTM** → New VM → Virtualize → Windows → select the ISO →
- ALL host cores / 16-24 GB. vCPUs are host-scheduled, not pinned: idle
+2. Download the official **Windows 11 ARM64** ISO:
+ https://www.microsoft.com/software-download/windows11arm64
+3. UTM → New VM → Virtualize → Windows → the ISO → **all host cores**,
+ 12-16 GB RAM, 64+ GB disk. vCPUs are host-scheduled, not pinned: idle
guest cores cost nothing and nothing is seized from parallel work — no
artificial limits, speed first. RAM is the one bounded number (Windows
- commits it eagerly). Click through Windows setup (local account, e.g. `dev`).
-4. Inside Windows, run `vm/windows-bootstrap.ps1` (elevated PowerShell):
- installs msys2 + CLANG64 toolchain + git, enables OpenSSH server, and
- mirrors the GitHub-runner security policy
- (`NoDefaultAdminOwner=0` → new objects owned by BUILTIN\Administrators —
- the policy that surfaces the exact-owner validation class).
-5. Note the VM's IP (`ipconfig`) and write it to `vm/config.env`:
- `CBM_WIN_VM_SSH=dev@<ip>`.
-
-The leg then drives the VM over ssh: sync the worktree, build with the
-CLANG64 toolchain, run the requested suites — a debugger-capable local loop
-for the class that previously needed blind CI round-trips.
+ commits it eagerly).
+4. Windows setup. At "Let's connect you to a network": Shift+Fn+F10 →
+ `start ms-cxh:localonly` → create a local account (no Microsoft account,
+ no network needed).
+5. **⭐ Shut down and CLONE the VM in UTM now** ("Windows-CLEAN-backup").
+ Driver installs can brick the boot; the clone turns that into a 10-second
+ rollback instead of a reinstall. Boot the original afterwards.
+6. Install the SPICE guest tools (network driver): download
+ https://github.com/utmapp/qemu/releases/download/v7.0.0-utm/spice-guest-tools-0.164.4.iso
+ on the host, mount via UTM's CD icon, run as administrator inside the VM,
+ restart. A brief "Display output is not active" during restart is normal.
+7. Get `windows-bootstrap.ps1` into the VM via the ISO trick in its header
+ (clipboard and shared folders DO NOT work on Windows-ARM guests — the
+ SPICE vdagent/webdavd services don't exist there; don't chase them),
+ run it, note the printed ip/user, write `~/.claude/cbm-vm/config`,
+ reboot the VM once (owner policy).
+8. From the host: `test-infrastructure/vm/provision-windows.sh` — installs
+ msys2 + both toolchains, clones the repo, builds everything, smoke-checks.
+ Re-run it any time; it is the single recovery command if the disk is lost.
+
+### Daily loop
+
+```
+vm/win.sh update # sync VM repo to the pushed branch + rebuild
+vm/win.sh test cli daemon_ipc # run suites natively, seconds
+vm/win.sh guards # the Windows guard scripts
+vm/win.sh smoke-install # managed-install E2E, stderr VISIBLE
+vm/win.sh sh "cd /c/cbm && gdb ..." # anything, interactively
+vm/win.sh push-file src/cli/cli.c /c/cbm/src/cli/cli.c # WIP iteration
+```
+
+### Toolchains & honest limits
+
+- **CLANGARM64 (native, default)**: fast on all cores; OS-semantics bugs
+ (ACL/owner/paths/locks — the entire Windows tail class) reproduce
+ faithfully. Build with `SANITIZE=` (no ASan runtime exists for
+ aarch64-windows).
+- **CLANG64 (x86_64 = CI's arch, emulated)**: for arch-parity checks
+ (`win.sh asan-build` builds it). **ASan does NOT work under x64-on-ARM
+ emulation** (the runtime faults in process init) — verified, don't retry.
+ Windows sanitizer coverage therefore stays a CI-only leg; note the CI
+ windows failures have historically been logic failures, not ASan aborts.
+- The bootstrap mirrors the GitHub-runner default-owner policy
+ (`NoDefaultAdminOwner=0`) so CI-only ownership refusals reproduce locally.
+- Environment shape (runner temp paths, runneradmin profile) is
+ approximated, not identical — CI on the final SHA remains the proof.
## macOS runner VM (`run.sh mac-vm`) — the GitHub-runner macOS environment
@@ -41,19 +88,18 @@ A local Mac is not the GitHub macOS runner (different temp ancestry, ACLs,
policies): failures like the index-supervisor worker exits reproduce only
there. Cirrus Labs publishes runner-equivalent images.
-One-time setup (automated, big download):
-
1. `brew trust cirruslabs/cli && brew install tart` (free OSS).
2. `tart clone ghcr.io/cirruslabs/macos-runner:sequoia cbm-mac-runner`
(tens of GB, one time).
The leg boots the VM headless (`tart run --no-graphics cbm-mac-runner`),
-syncs the worktree over ssh (default credentials admin/admin inside the
-runner image), and executes `scripts/test.sh` — the same environment class
-GitHub schedules, locally and debuggable.
+syncs the worktree over ssh (admin/admin inside the runner image), and
+executes `scripts/test.sh`.
## Honesty rules
-- These legs are OPT-IN: absent tooling prints guidance and exits with a
- distinct status; it is never silently skipped when explicitly requested.
+- These legs never silently skip: absent tooling prints setup guidance and
+ exits with a distinct status.
- VM results complement, never replace, the CI matrix on the final SHA.
+- Everything runs over the local UTM/host network only — nothing about the
+ VM loop touches the internet except the VM's own package/repo downloads.
diff --git a/test-infrastructure/vm/provision-windows.sh b/test-infrastructure/vm/provision-windows.sh
new file mode 100644
index 000000000..66b049a1f
--- /dev/null
+++ b/test-infrastructure/vm/provision-windows.sh
@@ -0,0 +1,82 @@
+#!/usr/bin/env bash
+# provision-windows.sh — provision the Windows test VM from the macOS host.
+#
+# Idempotent: safe to re-run at any time; every step skips work already done.
+# Recovers a fresh VM (or a lost disk) to fully-built state in one command.
+#
+# Prerequisites (one-time, manual — see README.md):
+# 1. UTM VM with Windows 11 ARM64 installed, CLONED as a backup before
+# drivers, SPICE guest tools installed (network), and
+# windows-bootstrap.ps1 run inside the VM (OpenSSH + authorized key).
+# 2. Host config in ~/.claude/cbm-vm/config (KEY=VALUE):
+# CBM_VM_HOST=192.168.64.4
+# CBM_VM_USER=test
+# Key at ~/.claude/cbm-vm/id_ed25519 (see README.md to generate).
+#
+# Usage:
+# test-infrastructure/vm/provision-windows.sh # full provision
+# test-infrastructure/vm/provision-windows.sh --update # repo+build only
+set -euo pipefail
+
+CONFIG="${HOME}/.claude/cbm-vm/config"
+KEY="${HOME}/.claude/cbm-vm/id_ed25519"
+[ -f "$CONFIG" ] && . "$CONFIG"
+HOST="${CBM_VM_HOST:?set CBM_VM_HOST in ~/.claude/cbm-vm/config}"
+USER_="${CBM_VM_USER:-test}"
+BRANCH="${CBM_VM_BRANCH:-feat/shared-coordination-daemon}"
+REPO_URL="${CBM_VM_REPO:-https://github.com/DeusData/codebase-memory-mcp.git}"
+MSYS2_SFX_URL="https://repo.msys2.org/distrib/msys2-x86_64-latest.sfx.exe"
+
+SSH=(ssh -i "$KEY" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
+ -o ConnectTimeout=10 -o BatchMode=yes "${USER_}@${HOST}")
+
+# Run a command inside the given msys2 environment (clangarm64|clang64|msys).
+vm() { # vm <env> <command...>
+ local env="$1"; shift
+ "${SSH[@]}" "C:\\msys64\\msys2_shell.cmd -defterm -no-start -${env} -c \"$*\""
+}
+vm_cmd() { "${SSH[@]}" "$@"; } # plain cmd.exe
+
+step() { printf '\n\033[1m== %s ==\033[0m\n' "$*"; }
+
+step "0/6 reachability"
+vm_cmd "echo VM_OK & ver" | grep -q VM_OK || {
+ echo "FATAL: cannot reach ${USER_}@${HOST} over ssh." >&2
+ echo "Run windows-bootstrap.ps1 inside the VM first (see README.md)." >&2
+ exit 1
+}
+
+if [ "${1:-}" != "--update" ]; then
+ step "1/6 msys2 base (skip if present)"
+ if ! vm_cmd "if exist C:\\msys64\\usr\\bin\\bash.exe echo MSYS2_PRESENT" | grep -q MSYS2_PRESENT; then
+ vm_cmd "powershell -Command \"[Net.ServicePointManager]::SecurityProtocol='Tls12'; Invoke-WebRequest -Uri ${MSYS2_SFX_URL} -OutFile C:\\msys2.sfx.exe\""
+ vm_cmd "C:\\msys2.sfx.exe -y -oC:\\" >/dev/null
+ vm "msys" "pacman-key --init && pacman-key --populate msys2"
+ fi
+
+ step "2/6 pacman update (repeat-safe)"
+ vm "msys" "rm -f /var/lib/pacman/db.lck; pacman -Syu --noconfirm --noprogressbar" || true
+
+ step "3/6 toolchains: CLANGARM64 (native, fast) + CLANG64 (x86_64 = CI arch, ASan)"
+ vm "msys" "pacman -S --noconfirm --noprogressbar --needed \
+ git make coreutils \
+ mingw-w64-clang-aarch64-clang mingw-w64-clang-aarch64-zlib \
+ mingw-w64-clang-aarch64-python mingw-w64-clang-aarch64-ccache \
+ mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-compiler-rt \
+ mingw-w64-clang-x86_64-zlib mingw-w64-clang-x86_64-ccache"
+fi
+
+step "4/6 repo clone/update -> /c/cbm @ ${BRANCH}"
+if vm "clangarm64" "test -d /c/cbm/.git && echo REPO_PRESENT" | grep -q REPO_PRESENT; then
+ vm "clangarm64" "cd /c/cbm && git fetch origin ${BRANCH} && git reset --hard FETCH_HEAD && git log --oneline -1"
+else
+ vm "clangarm64" "git clone --branch ${BRANCH} --single-branch --depth 200 ${REPO_URL} /c/cbm && cd /c/cbm && git log --oneline -1"
+fi
+
+step "5/6 build: native ARM64 binary + launcher + test-runner (no ASan on arm64)"
+vm "clangarm64" "cd /c/cbm && make -j\\\$(nproc) -f Makefile.cbm CC=clang CXX=clang++ SANITIZE= cbm build/c/test-runner > /tmp/provision-build.log 2>&1 && echo BUILD_OK || (echo BUILD_FAIL; tail -15 /tmp/provision-build.log; exit 1)"
+
+step "6/6 smoke: binary + test-runner start"
+vm "clangarm64" "cd /c/cbm && ./build/c/codebase-memory-mcp.exe --version && ./build/c/test-runner --list-suites | head -3"
+
+printf '\n\033[1mPROVISION COMPLETE\033[0m — daily driving: test-infrastructure/vm/win.sh\n'
diff --git a/test-infrastructure/vm/win.sh b/test-infrastructure/vm/win.sh
new file mode 100644
index 000000000..2e523ec3c
--- /dev/null
+++ b/test-infrastructure/vm/win.sh
@@ -0,0 +1,74 @@
+#!/usr/bin/env bash
+# win.sh — daily driver for the Windows test VM (real-Windows leg of local CI).
+#
+# All commands run over ssh (local UTM network only — nothing leaves the
+# machine). Config: ~/.claude/cbm-vm/config (CBM_VM_HOST, CBM_VM_USER),
+# key: ~/.claude/cbm-vm/id_ed25519. Provision first: provision-windows.sh.
+#
+# Usage:
+# win.sh status # reachability + repo + build state
+# win.sh update # fetch+reset repo to pushed branch, rebuild
+# win.sh build # incremental native build (binary+runner)
+# win.sh test <suite...> # run test-runner suites (native ARM64)
+# win.sh guards # run the Windows guard scripts (python)
+# win.sh smoke-install # real managed-install E2E (Phase 8 class)
+# win.sh sh <command...> # arbitrary command in CLANGARM64 env
+# win.sh push-file <local> <vm> # scp one file into the VM (WIP iteration)
+# win.sh asan-build # x86_64 CLANG64 build WITH ASan (CI arch)
+set -euo pipefail
+
+CONFIG="${HOME}/.claude/cbm-vm/config"
+KEY="${HOME}/.claude/cbm-vm/id_ed25519"
+[ -f "$CONFIG" ] && . "$CONFIG"
+HOST="${CBM_VM_HOST:?set CBM_VM_HOST in ~/.claude/cbm-vm/config}"
+USER_="${CBM_VM_USER:-test}"
+BRANCH="${CBM_VM_BRANCH:-feat/shared-coordination-daemon}"
+JOBS='\$(nproc)'
+
+SSH=(ssh -i "$KEY" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
+ -o ConnectTimeout=10 -o BatchMode=yes "${USER_}@${HOST}")
+
+vm() { local env="$1"; shift
+ "${SSH[@]}" "C:\\msys64\\msys2_shell.cmd -defterm -no-start -${env} -c \"$*\""; }
+
+cmd="${1:-status}"; shift || true
+case "$cmd" in
+status)
+ "${SSH[@]}" "echo VM_REACHABLE & ver"
+ vm clangarm64 "cd /c/cbm 2>/dev/null && git log --oneline -1 && ls -la build/c/codebase-memory-mcp.exe build/c/test-runner.exe 2>/dev/null || echo 'repo/build missing — run provision-windows.sh'"
+ ;;
+update)
+ vm clangarm64 "cd /c/cbm && git fetch origin ${BRANCH} && git reset --hard FETCH_HEAD && git log --oneline -1"
+ exec "$0" build
+ ;;
+build)
+ vm clangarm64 "cd /c/cbm && make -j${JOBS} -f Makefile.cbm CC=clang CXX=clang++ SANITIZE= cbm build/c/test-runner > /tmp/win-build.log 2>&1 && echo BUILD_OK || (echo BUILD_FAIL; tail -20 /tmp/win-build.log; exit 1)"
+ ;;
+test)
+ [ $# -ge 1 ] || { echo "usage: win.sh test <suite...>" >&2; exit 2; }
+ vm clangarm64 "cd /c/cbm && ./build/c/test-runner $* 2>&1 | tail -40"
+ ;;
+guards)
+ vm clangarm64 "cd /c/cbm && for g in tests/windows/test_*.py; do echo \"== \\\$g ==\"; python \\\$g build/c/codebase-memory-mcp.exe 2>&1 | tail -6; done"
+ ;;
+smoke-install)
+ # Real managed install E2E with FULL stderr visible — the exact class the
+ # CI smoke Phase 8 exercises but cannot show (probe hides launcher stderr).
+ vm clangarm64 "cd /c/cbm && ./build/c/codebase-memory-mcp.exe install 2>&1 | tail -25"
+ ;;
+sh)
+ vm clangarm64 "$*"
+ ;;
+push-file)
+ [ $# -eq 2 ] || { echo "usage: win.sh push-file <local-path> <vm-path>" >&2; exit 2; }
+ scp -i "$KEY" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$1" "${USER_}@${HOST}:$2"
+ ;;
+asan-build)
+ # x86_64 (CI's exact arch) with ASan, runs under Windows-on-ARM emulation.
+ # Slower; use when a finding needs sanitizer confirmation or CI-arch parity.
+ vm clang64 "cd /c/cbm && make -j${JOBS} -f Makefile.cbm CC=clang CXX=clang++ build/c/test-runner > /tmp/win-asan-build.log 2>&1 && echo ASAN_BUILD_OK || (echo ASAN_BUILD_FAIL; tail -20 /tmp/win-asan-build.log; exit 1)"
+ ;;
+*)
+ echo "unknown command: $cmd (see header for usage)" >&2; exit 2
+ ;;
+esac
diff --git a/test-infrastructure/vm/windows-bootstrap.ps1 b/test-infrastructure/vm/windows-bootstrap.ps1
index 331b09709..61a00b057 100644
--- a/test-infrastructure/vm/windows-bootstrap.ps1
+++ b/test-infrastructure/vm/windows-bootstrap.ps1
@@ -1,31 +1,64 @@
-# windows-bootstrap.ps1 — one-time setup inside the Windows test VM.
-# Run in an ELEVATED PowerShell. Installs the CLANG64 toolchain, enables
-# ssh-based driving from the host, and mirrors the GitHub-runner security
-# policy that surfaces the exact-owner validation class.
+# windows-bootstrap.ps1 — ONE-TIME setup inside the Windows test VM.
+#
+# Everything else (msys2, toolchains, repo, builds) is provisioned FROM THE
+# HOST over ssh by provision-windows.sh — this script only opens that door.
+#
+# Getting this file into a fresh VM (clipboard/shared folders are unreliable
+# on Windows-ARM guests — the SPICE agent services do not exist there): build
+# a small ISO on the host and mount it via UTM's CD drive:
+# mkdir /tmp/cbmiso && cp windows-bootstrap.ps1 /tmp/cbmiso/
+# printf '@echo off\r\npowershell -NoProfile -ExecutionPolicy Bypass -File "%%~dp0windows-bootstrap.ps1"\r\n' > /tmp/cbmiso/RUN-ME.bat
+# hdiutil makehybrid -iso -joliet -default-volume-name CBMSETUP -o ~/cbm-setup.iso /tmp/cbmiso
+# Then in the VM: open the CD drive in Explorer and double-click RUN-ME.bat.
+#
+# Requires: SPICE guest tools already installed (network driver working).
+# Self-elevate so double-clicking RUN-ME.bat just works.
+if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
+ Start-Process powershell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`""
+ exit
+}
$ErrorActionPreference = "Stop"
-Write-Host "=== 1/4: msys2 + CLANG64 toolchain ==="
-winget install -e --id MSYS2.MSYS2 --accept-source-agreements --accept-package-agreements
-& C:\msys64\usr\bin\bash.exe -lc "pacman -S --noconfirm --needed mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-compiler-rt mingw-w64-clang-x86_64-zlib mingw-w64-clang-x86_64-ccache make git"
-
-Write-Host "=== 2/4: OpenSSH server (host drives the VM over ssh) ==="
-Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
-Set-Service -Name sshd -StartupType Automatic
+Write-Host "=== 1/4: OpenSSH server ===" -ForegroundColor Cyan
+Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 | Out-Null
Start-Service sshd
+Set-Service -Name sshd -StartupType Automatic
New-NetFirewallRule -Name cbm-sshd -DisplayName "OpenSSH (cbm test VM)" `
-Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 `
-ErrorAction SilentlyContinue | Out-Null
-Write-Host "=== 3/4: mirror GitHub-runner security policy ==="
+Write-Host "=== 2/4: authorize the driving host's key ===" -ForegroundColor Cyan
+# Public key of the driving host (~/.claude/cbm-vm/id_ed25519.pub there).
+# If the host key pair is ever lost, regenerate and replace this line:
+# ssh-keygen -t ed25519 -N "" -C claude-cbm-vm -f ~/.claude/cbm-vm/id_ed25519
+$k = 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHTM/DHf7YldxSfSH5/WengKm/k1mYkPry9mBjZ8SRzG claude-cbm-vm'
+$f = 'C:\ProgramData\ssh\administrators_authorized_keys'
+if (-not (Test-Path $f)) { New-Item -ItemType File -Path $f -Force | Out-Null }
+if (-not (Select-String -Path $f -Pattern 'claude-cbm-vm' -Quiet)) { Add-Content -Path $f -Value $k }
+icacls $f /inheritance:r /grant 'Administrators:F' /grant 'SYSTEM:F' | Out-Null
+
+Write-Host "=== 3/4: mirror the GitHub-runner default-owner policy ===" -ForegroundColor Cyan
# 'System objects: Default owner for objects created by members of the
-# Administrators group' = Administrators (0). This is the policy that makes
-# freshly created objects owned by BUILTIN\Administrators instead of the
-# user SID — the class the daemon's exact-owner gates must survive.
+# Administrators group' = Administrators. Windows CLIENT editions default new
+# objects to the user SID; GitHub's SERVER runners default them to BUILTIN\
+# Administrators — the class every exact-owner validation must survive.
+# Mirroring it here makes CI-only ownership refusals reproduce in this VM.
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa" `
-Name NoDefaultAdminOwner -Value 0 -Type DWord
-Write-Host "=== 4/4: workspace ==="
-New-Item -ItemType Directory -Path C:\cbm -Force | Out-Null
-Write-Host "Done. Reboot once, then from the host: ipconfig -> put"
-Write-Host "CBM_WIN_VM_SSH=<user>@<ip> into test-infrastructure/vm/config.env"
+Write-Host "=== 4/4: report ===" -ForegroundColor Cyan
+$ip = (Get-NetIPAddress -AddressFamily IPv4 |
+ Where-Object { $_.IPAddress -notlike '127.*' -and $_.IPAddress -notlike '169.254.*' } |
+ Select-Object -First 1).IPAddress
+Write-Host ""
+Write-Host "==================== SSH READY ====================" -ForegroundColor Green
+Write-Host (" user: " + $env:USERNAME) -ForegroundColor Yellow
+Write-Host (" ip: " + $ip) -ForegroundColor Yellow
+Write-Host "===================================================" -ForegroundColor Green
+Write-Host "On the host, write ~/.claude/cbm-vm/config with:"
+Write-Host " CBM_VM_HOST=$ip"
+Write-Host (" CBM_VM_USER=" + $env:USERNAME)
+Write-Host "Then run: test-infrastructure/vm/provision-windows.sh"
+Write-Host "NOTE: reboot once so the default-owner policy applies."
+Read-Host 'Press Enter to close'