Bun Global Upgrade Symlink Detection
Bun Global Upgrade Symlink Detection
Initial Debt
@punks/cli@2.2.1 installed through Bun could report manager-not-detected for dp upgrade. A reproduced isolated install had bin/dp as a symlink to install/global/node_modules/@punks/cli/dist/index.js, but install-manager detection only inspected the raw command path.
Why It Matters
dp upgrade is the recovery path when a global CLI is stale or a just-published fix is needed. If the command cannot detect the package manager that installed it, operators must manually reinstall the CLI at exactly the moment automation should help them recover.
Resolution
CLI self-update detection now ignores non-path argv entries, resolves the entrypoint symlink with realpathSync, and recognizes Bun's install/global/node_modules/@punks/cli layout before generic npm detection.
Validation
- RED: isolated
BUN_INSTALL=$(mktemp -d)install of@punks/cli@2.2.1reproducedmanager-not-detectedfor$tmp/bin/dp upgrade --json. - RED: focused regression test expected
bunfor abin/dpsymlink and failed before the fix. - GREEN:
npm --prefix apps/cli test - GREEN:
npm --prefix apps/cli run check-types - GREEN:
npm --prefix apps/cli run check - GREEN: publish-shaped temp Bun global install of local
2.2.3returnedpackageManager: "bun"fordp upgrade --force --json
Closeout
Resolved by adding symlink-aware install-manager detection, recording the release note for @punks/cli@2.2.3, and updating operator docs for dp upgrade.