From d6f21f9c1d9f827f9ae29e20a9c112c611083f2c Mon Sep 17 00:00:00 2001 From: Sami Fouad Date: Wed, 14 Oct 2026 17:47:38 -0600 Subject: [PATCH] The gild VM's gild follows yours: setup installs your version; an upgrade here updates it there --- CHANGELOG.md | 4 ++++ src/isolation/multipass.ts | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05aedca..4a89666 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.6.15 + +- The gild VM (Multipass) keeps its gild at the same version as yours: setup installs your version, and after you upgrade, the next `--vm` updates the VM's copy first (a shown step). + ## 0.6.13 - `gild spawn --vm` works on Apple silicon: gild publishes a linux-arm64 build (`@gildforge/cli-linux-arm64`, with its node-pty prebuild), so the agent inside the arm64 Multipass VM has its own `gild` for git credentials and pull requests. Before, every `gild` call in that VM failed with "no build for linux-arm64". diff --git a/src/isolation/multipass.ts b/src/isolation/multipass.ts index 5a8e34e..efae210 100644 --- a/src/isolation/multipass.ts +++ b/src/isolation/multipass.ts @@ -6,6 +6,7 @@ // repo-scoped token, so the agent clones, pushes and opens pull requests from // inside the VM. Your own gild key never enters it. Work leaves the VM through // git; the session's copy stays in the VM until you remove it. +import pkg from '../../package.json' import { spawn, spawnSync } from 'node:child_process' import { readFileSync } from 'node:fs' import { readFile } from 'node:fs/promises' @@ -43,7 +44,7 @@ const SETUP = `set -e export DEBIAN_FRONTEND=noninteractive sudo apt-get update -qq sudo apt-get install -y -qq git nodejs npm python3 build-essential ca-certificates >/dev/null -sudo npm install -g --silent @anthropic-ai/claude-code gildforge +sudo npm install -g --silent @anthropic-ai/claude-code gildforge@${pkg.version} touch ${READY}` /** The multipass binary's full path: the pty helper runs a path, not a name. */ @@ -218,7 +219,7 @@ export async function ensureVm(log: (line: string) => void = () => {}) { ]), ) const setup = () => - log('setting up the gild VM (first time only, about two minutes)') + log('setting up the gild VM (first time only, a few minutes)') if (fresh) { setup() await step( @@ -241,7 +242,35 @@ export async function ensureVm(log: (line: string) => void = () => {}) { ) } else if (state !== 'Running') await step('Start the gild VM', ['start', MULTIPASS_VM], log) - if (isReady()) return + if (isReady()) { + // The VM's gild follows this one: an agent in the VM signs, clones and + // pushes with it, so an upgrade here upgrades it there. + const inside = mp([ + 'exec', + MULTIPASS_VM, + '--', + 'gild', + '--version', + ]).stdout.trim() + if (inside !== pkg.version) + await step( + `Update gild in the VM to ${pkg.version}`, + [ + 'exec', + MULTIPASS_VM, + '--', + 'sudo', + 'npm', + 'install', + '-g', + '--silent', + '--prefer-online', + `gildforge@${pkg.version}`, + ], + log, + ) + return + } if (!fresh) setup() await step( 'Install Node, git, Claude Code and gild',