fix: Resolve symlinked skill dirs in permission-gate
Skill locations like ~/.claude symlinked to ~/.dotfiles/ai/claude/
failed to match after realpathSync on the file being read.
Assisted-by: Claude Opus 4.6 via pi
diff --git a/.pi/agent/extensions/permission-gate.ts b/.pi/agent/extensions/permission-gate.ts
index 50744b76..261e6d3e 100644
--- a/.pi/agent/extensions/permission-gate.ts
+++ b/.pi/agent/extensions/permission-gate.ts
@@ -187,7 +187,12 @@ function getSkillsDirectories(ctx: ExtensionContext): Set<string> {
const locationRe = /<location>(.*?)<\/location>/g;
let match;
while ((match = locationRe.exec(prompt)) !== null) {
- dirs.add(path.dirname(match[1]));
+ const dir = path.dirname(match[1]);
+ dirs.add(dir);
+ // Also resolve symlinks so that paths through symlinked directories
+ // (e.g. ~/.claude -> ~/.dotfiles/ai/claude/) still match after
+ // realpathSync is applied to the file being read.
+ try { dirs.add(fs.realpathSync(dir)); } catch { /* ignore */ }
}
skillsDirs = dirs;
return skillsDirs;