diff --git a/AGENTS.md b/AGENTS.md index 6f91c77..a366633 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -49,7 +49,7 @@ src/ test/ unit/ Unit tests (node:test, dependency-injected, no VS Code API) batchApply.test.ts Batch template and operation count parsing (16 tests) - binary.test.ts Binary discovery, managed install, compatibility, workspace env (64 tests) + binary.test.ts Binary discovery, managed install, compatibility, workspace env (66 tests) binaryDiscovery.test.ts Real executable discovery on PATH (13 tests) initializeProject.test.ts Status display, agents file classification, formatError (39 tests) managedLifecycle.test.ts Managed install with real file I/O (22 tests) diff --git a/README.md b/README.md index a94fe33..dc4e956 100644 --- a/README.md +++ b/README.md @@ -175,11 +175,11 @@ The extension detects outdated CLI builds and warns with upgrade guidance. It re Set `patchloom.path` in settings, or add the CLI to your `PATH`. **CLI compatibility warning / upgrade path** -The extension requires Patchloom **0.3.0** or newer; **0.28.0** is recommended. Prefer channels that track GitHub Releases the same day: +The extension requires Patchloom **0.3.0** or newer; **0.28.0** is recommended. Which fix to use depends on how the CLI was resolved (status shows Source): -1. **Patchloom: Update Patchloom** (or **Install Patchloom**) for the extension managed install (checksum-verified download from GitHub Releases) -2. **Scoop** on Windows: `scoop update patchloom` after `scoop install patchloom` -3. Homebrew / npm / cargo / the official installer script on macOS and Linux +1. **Source: managed install** → **Patchloom: Update Patchloom** (checksum-verified GitHub release into extension storage) +2. **Source: PATH** → upgrade that install in place (**Scoop** `scoop update patchloom` on Windows; Homebrew / npm / cargo / the official installer elsewhere). Managed Install will not override a PATH binary. +3. **Source: patchloom.path** → **Open Settings** and point at a current binary, or clear the setting so PATH/managed resolution can take over Do **not** rely on winget or Chocolatey to stay current. Those community packages lag moderation and Microsoft publish, so upgrades often stay stuck on older CLI versions. diff --git a/package-lock.json b/package-lock.json index 4cb611b..875574c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@vscode/test-electron": "^3.1.0", "@vscode/vsce": "^3.0.0", "fast-check": "^4.9.0", - "ovsx": "^1.1.0", + "ovsx": "^1.1.1", "typescript": "^7.0.2", "vscode-extension-tester": "^8.24.0" }, @@ -6099,9 +6099,9 @@ } }, "node_modules/ovsx": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/ovsx/-/ovsx-1.1.0.tgz", - "integrity": "sha512-portv4pwDJTlZrvgDMpLTgA+Ctu60kRQfD/cBu4JBhakXabeHVoBAzOba8jMt7RAq+4C0PMHvANalu/S3+s6+w==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ovsx/-/ovsx-1.1.1.tgz", + "integrity": "sha512-tklsCzvGVWKlM91Vc9U8tNnaQ+XacPJ12SWHjDaHGUJB49oMhoAULsJGeefhHebPvvckbcWbKqKIXODMZah5SA==", "dev": true, "license": "EPL-2.0", "dependencies": { diff --git a/package.json b/package.json index 2858fad..3f212dc 100644 --- a/package.json +++ b/package.json @@ -266,7 +266,7 @@ "@vscode/test-electron": "^3.1.0", "@vscode/vsce": "^3.0.0", "fast-check": "^4.9.0", - "ovsx": "^1.1.0", + "ovsx": "^1.1.1", "typescript": "^7.0.2", "vscode-extension-tester": "^8.24.0" } diff --git a/src/binary/patchloom.ts b/src/binary/patchloom.ts index 6e57d38..7a30c3a 100644 --- a/src/binary/patchloom.ts +++ b/src/binary/patchloom.ts @@ -187,16 +187,19 @@ export function preferredBinaryRemediationAction( } if (patchloomNeedsUpgrade(status)) { - if (status.source === "managed" || status.managedInstall?.exists) { + // Managed Update only refreshes the extension storage binary. PATH and + // patchloom.path still win resolution order, so Install/Update managed + // would not replace an active outdated PATH/setting binary. + if (status.source === "managed") { return { title: "Update Patchloom", command: "patchloom.updateBinary" }; } - if (status.managedInstall) { + if (status.source === "setting") { return { - title: "Install Patchloom", - command: "patchloom.installBinary" + title: "Open Settings", + command: "patchloom.openPatchloomSettings" }; } return { diff --git a/test/unit/binary.test.ts b/test/unit/binary.test.ts index bf9b96d..d4be303 100644 --- a/test/unit/binary.test.ts +++ b/test/unit/binary.test.ts @@ -211,6 +211,53 @@ test("preferredBinaryRemediationAction updates outdated managed install", () => }); }); +test("preferredBinaryRemediationAction opens releases for outdated PATH even when managed exists", () => { + // PATH wins resolution over managed; updating managed would not change the active binary. + const action = preferredBinaryRemediationAction({ + ready: true, + source: "path", + message: "Using Patchloom from PATH.", + binaryPath: "/usr/local/bin/patchloom", + version: "patchloom 0.0.9", + detectedVersion: "0.0.9", + compatibility: "unsupported", + minimumSupportedVersion: MINIMUM_SUPPORTED_PATCHLOOM_VERSION, + compatibilityMessage: `Patchloom 0.0.9 is older than the minimum supported version ${MINIMUM_SUPPORTED_PATCHLOOM_VERSION}.`, + managedInstall: { + exists: true, + binaryPath: "/managed/managed-bin/patchloom", + target: { + platform: "darwin", + arch: "arm64", + targetTriple: "aarch64-apple-darwin", + archiveFormat: ".tar.xz" + } + } + }); + assert.deepEqual(action, { + title: "Open Releases", + command: "patchloom.openPatchloomReleases" + }); +}); + +test("preferredBinaryRemediationAction opens settings for outdated patchloom.path", () => { + const action = preferredBinaryRemediationAction({ + ready: true, + source: "setting", + message: "Using Patchloom from patchloom.path.", + binaryPath: "/custom/old/patchloom", + version: "patchloom 0.0.9", + detectedVersion: "0.0.9", + compatibility: "unsupported", + minimumSupportedVersion: MINIMUM_SUPPORTED_PATCHLOOM_VERSION, + compatibilityMessage: `Patchloom 0.0.9 is older than the minimum supported version ${MINIMUM_SUPPORTED_PATCHLOOM_VERSION}.` + }); + assert.deepEqual(action, { + title: "Open Settings", + command: "patchloom.openPatchloomSettings" + }); +}); + test("preferredBinaryRemediationAction opens settings when no managed path exists", () => { const action = preferredBinaryRemediationAction({ ready: false, diff --git a/test/unit/initializeProject.test.ts b/test/unit/initializeProject.test.ts index 356843f..2c6e4e9 100644 --- a/test/unit/initializeProject.test.ts +++ b/test/unit/initializeProject.test.ts @@ -344,7 +344,8 @@ test("buildStatusDetails surfaces managed install failure diagnostics", () => { assert.match(details, /Managed install diagnostic: Checksum mismatch/); }); -test("preferredStatusAction points outdated PATH CLI users to managed install", () => { +test("preferredStatusAction points outdated PATH CLI users to releases", () => { + // PATH wins over managed install; Install managed would not replace the active binary. const action = preferredStatusAction({ ready: true, source: "path", @@ -368,8 +369,8 @@ test("preferredStatusAction points outdated PATH CLI users to managed install", }); assert.deepEqual(action, { - title: "Install Patchloom", - command: "patchloom.installBinary" + title: "Open Releases", + command: "patchloom.openPatchloomReleases" }); });