Repository navigation
fix(skills): update Homebrew-managed archdev with brew, never a second copy - #85
Merged
Merged
Conversation
…d copy The skill bootstrap scripts resolved `archdev` and, when it was missing, too old or failed the capability probes, ran the pinned installer with a forced ARCHDEV_INSTALL_DIR (~/.local/bin). On a Homebrew machine that left a second copy beside the keg, which later shadowed it on PATH. Now, when the archdev on PATH, or <brew --prefix>/bin/archdev, resolves into a Homebrew Cellar, the bootstrap repairs it with the keg's own brew: `brew upgrade archastro/tools/archdev` for a too-old version, `brew reinstall` for a missing, crashing or current-but-broken binary. It prints the brew command, keeps brew output off stdout, and stops with an error naming the brew-managed binary when brew is missing or fails. Installer copies and fresh installs keep the pinned installer. PowerShell mirrors this on macOS/Linux; Windows is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On a Linux machine with archdev installed by Homebrew (
/home/linuxbrew/.linuxbrew/bin/archdev→../Cellar/archdev/<v>/bin/archdev, formulaarchastro/tools/archdev), the archdev skill'sscripts/bootstrap.shinstalled a second copy at~/.local/bin/archdevtwice:#!/bin/sh/echo "archdev 3.0.0"). The stub passes the version check but fails theagents run --helpcapability probe. Bootstrap printed "Updating ArchDev: this skill requires 0.49.6+ …" and installed 0.54.14 into~/.local/bin.~/.local/bin.That second copy came first on PATH and later took over the user's daemon.
How it happened:
The bootstrap never checked who owns the binary it found. The pinned installer (
a530d21…) has no Homebrew detection either. The currentinstall.shdoes detect Homebrew (is_homebrew_binary), but only reports a brew copy and never upgrades it.Change
Before → after for the three bootstrap sources (
archdev/,tasks/,tasks-execute/scripts/bootstrap.{sh,ps1}):<brew --prefix>/bin/archdev, whose real path is underCellar/archdev/. Before, the bootstrap installed a second copy into~/.local/bin. Now it repairs the copy with the keg's ownbrew:brew upgrade archastro/tools/archdevwhen the binary reports a version older than the minimum.brew reinstallwhen the binary is missing (dangling link), crashes, or reports a current version but fails the probes (the stub case, whereupgradewould do nothing).<keg prefix>/bin/brew), not whicheverbrewcomes first on PATH. A second Homebrew prefix could otherwise install another copy.opt/archdev/binkeeps that path. Bash used to resolve it to the versioned keg, which an upgrade removes.Windows_NT.Pinned installer not bumped.
ARCHDEV_INSTALL_DIRis still forced, but now only for non-Homebrew installs, so it can no longer bypass Homebrew detection. A newer installer would not fix the problem: it only reports a brew copy and never upgrades it. It would also bring sign-in and setup into bootstrap (fc3d6d4and later), which the skill contract forbids.archdev/references/bootstrap.mdgains one sentence on the Homebrew behavior. The plugin copies underplugins/*were regenerated withtools/plugin-gen(npm run build). That is where most of this diff comes from.Risk
Medium-low. This is the path every skill session takes to resolve the CLI. Machines without a Cellar-linked archdev take the old code path. The one added call is
brew --prefix, and it runs only whenbrewis on PATH and the archdev found is not brew-managed.Two behaviors are new:
brew upgradeorbrew reinstall. It runs these in the same place it used to run the installer, under the same agent approval for installs and upgrades that the skill already requires.Testing
scripts/test-skill-bootstrap.sh: all cases pass, including 16 new Homebrew cases per skill. Each case builds a tempHOME, a fake<prefix>/Cellar/archdev/<v>/bin/archdevwithbin/andopt/links, andscripts/fake-brew, which records its calls and does nothing onupgradewhen the keg is already the latest version, like real brew. The new cases:upgrade; stub reporting 3.0.0 →reinstall; crashing binary →reinstall; dangling link →reinstall; PATH through the opt link →upgrade, opt path kept; another prefix's brew first on PATH → the keg's own brew runs, the other one never does; outdated brew copy behind an installer copy →upgrade.brew upgradefailing.HOMEchanged and that no hook was written.scripts/test-skill-bootstrap.ps1with pwsh 7.6 on Linux: 79 cases pass, the same Homebrew cases plus the existing ones.ubuntu-latest, and PowerShell onwindows-latest, where the Homebrew cases are skipped.tools/plugin-gen:npm run check,npm run typecheckandnpm testpass. One local run failed the nudge hook's "under 100 ms" timing test while the machine was loaded; the rerun passed.Known limitations
brew unlink archdev, so nobin/archdev) is not detected and falls through to the installer path.LinkTarget, so Homebrew detection there finds nothing and the bootstrap keeps the old installer behavior.🤖 Generated with Claude Code