fix(launch): include Pi native skill roots in 'all' mode; dedup 'discover' force-loads #556
Reference in New Issue
Block a user
Delete Branch "fix/pi-skill-args-all-discover"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fast-follow for the two code-review findings on #555 (
buildPiSkillArgs).Finding 1 —
allmode dropped Pi's native skill roots.mosaiclaunches Pi with--no-skills, which suppresses Pi's own native auto-discovery. Theallcatalog therefore has to re-enumerate the native roots (~/.pi/agent/skills/and<cwd>/.pi/skills/) explicitly, or any skill living only under those roots is silently dropped.discoverPiSkillsnow scans them. This also fixes a latent bug in the enumerator: it skipped symlinked entries (!entry.isDirectory()), but synced fleet skills land as symlinks — so they were being dropped on every launch.Finding 2 —
discovermode double-loaded.discoverkeeps Pi's native auto-discovery ON (no--no-skills), but it force-loaded the fleet skills unconditionally, registering anything Pi already finds natively twice. It now filters force-loads against the native-root realpath set.Approach
Realpath-based dedup throughout, so a skill reached via a symlink and via its canonical path collapse to one
--skill:skillRealPath—realpathSyncwith literal-path fallback (broken/missing links degrade gracefully).piNativeSkillRoots(cwd)— the two roots Pi auto-discovers.enumerateSkillDirs(roots)— scans roots, accepts dirs and symlinks bearing aSKILL.md, dedups by realpath. Exported for test coverage.piNativeSkillRealPaths(cwd)— realpaths Pi will auto-discover, for the discover-mode filter.mergeSkillArgs— now dedups by realpath.buildPiSkillArgs— gains an injectable 5th param (nativeSkillRealPaths) so the discover-mode filter is deterministic under test.No launcher/passthrough behavior changes;
nonemode is unchanged.Tests
enumerateSkillDirsreal-FS coverage: symlinked-skill acceptance (the regression), cross-root realpath dedup, andSKILL.md/missing-root gating.pnpm typecheck41/41,pnpm lint23/23,prettier --checkclean.Review
Independent review (author ≠ reviewer) completed before open: APPROVE-WITH-NITS; all three SHOULD-FIX nits (discover intra-set dedup consistency + the two missing-coverage items) remediated in this branch.
🤖 Generated with Claude Code