pi-skillful 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-skillful",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Pi package with skill invocation and visibility improvements.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -60,7 +60,7 @@ export default function skillVisibility(pi: ExtensionAPI) {
60
60
 
61
61
  pi.on("session_start", async (_event, ctx) => {
62
62
  store.theme = ctx.ui.theme;
63
- await refreshHiddenSkillCache(ctx.cwd);
63
+ await pruneStaleHiddenSkills(pi, ctx.cwd);
64
64
  });
65
65
 
66
66
  pi.on("before_agent_start", async (event, ctx) => {
@@ -109,6 +109,26 @@ export default function skillVisibility(pi: ExtensionAPI) {
109
109
  });
110
110
  }
111
111
 
112
+ async function pruneStaleHiddenSkills(pi: ExtensionAPI, cwd: string): Promise<void> {
113
+ const installedNames = new Set(getSkillItems(pi).map((s) => s.name));
114
+ const scoped = await readScopedSkillfulSettings(cwd);
115
+
116
+ await Promise.all(
117
+ SCOPES.map(async (scope) => {
118
+ const current = scoped[scope].hiddenSkills;
119
+ const pruned = current.filter((name) => installedNames.has(name));
120
+ if (pruned.length < current.length) {
121
+ await writeHiddenSkills(scope, cwd, pruned);
122
+ scoped[scope] = { hiddenSkills: pruned };
123
+ }
124
+ }),
125
+ );
126
+
127
+ const hidden = new Set([...scoped.global.hiddenSkills, ...scoped.project.hiddenSkills]);
128
+ store.hiddenSkillsByCwd.set(cwd, hidden);
129
+ store.lastHiddenSkills = hidden;
130
+ }
131
+
112
132
  async function refreshHiddenSkillCache(cwd: string): Promise<Set<string>> {
113
133
  const hidden = await readEffectiveHiddenSkills(cwd);
114
134
  store.hiddenSkillsByCwd.set(cwd, hidden);