-
Notifications
You must be signed in to change notification settings - Fork 24
findSkillkitBin() fails to discover skillkit installed via pnpm #18
Description
Problem
When @crafter/skillkit is installed globally via pnpm (pnpm install -g @crafter/skillkit), the Agentfiles plugin reports "skillkit not found" in the dashboard's Scan Sessions feature.
This happens because findSkillkitBin() in src/skillkit.ts searches a hardcoded list of directories that does not include pnpm's global binary directory.
Root Cause
The current search paths include:
/usr/local/bin/opt/homebrew/bin~/.local/bin~/.bun/bin~/.nvm/versions/node/*/bin/~/.local/share/mise/installs/{node,bun}/*/bin/
But pnpm installs global binaries to:
- macOS:
~/Library/pnpm/ - Linux:
~/.local/share/pnpm/
These paths are not searched, so the plugin cannot find skillkit.
Why symlinks don't work as a workaround
A natural workaround would be to symlink skillkit into one of the searched directories (e.g., ~/.local/bin/skillkit -> ~/Library/pnpm/skillkit). However, this also fails because the pnpm-generated skillkit shell wrapper uses $0 to compute basedir:
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")When invoked via symlink, $0 resolves to the symlink location (e.g., ~/.local/bin), not the actual pnpm directory. This causes all relative paths in the script (e.g., $basedir/global/5/.pnpm/...) to break.
The only working workaround is to create a wrapper script instead of a symlink:
#!/bin/sh
exec ~/Library/pnpm/skillkit "$@"Suggested Fix
Add pnpm's global bin directories to the search list in findSkillkitBin():
// macOS
path.join(home, "Library", "pnpm"),
// Linux / Windows
path.join(home, ".local", "share", "pnpm"),Alternatively, you could also detect the pnpm global bin directory dynamically:
try {
const pnpmBin = execSync("pnpm bin -g", { encoding: "utf-8" }).trim();
if (pnpmBin) dirs.push(pnpmBin);
} catch {}Environment
- macOS 15 (Darwin 25.3.0, arm64)
- pnpm 10.33.0
@crafter/skillkit0.10.3- Agentfiles plugin (latest from Obsidian community plugins)