pi-skillful 0.2.0 → 0.2.2
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtensionAPI } from "@
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import inlineSkillInvocation from "../../src/extensions/inline-skill-invocation.js";
|
|
3
3
|
import skillVisibility from "../../src/extensions/skill-visibility.js";
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-skillful",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Pi package with skill invocation and visibility improvements.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"CODE_OF_CONDUCT.md"
|
|
36
36
|
],
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
38
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
39
|
+
"@earendil-works/pi-tui": "*"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
42
|
+
"@earendil-works/pi-coding-agent": "^0.74.0",
|
|
43
|
+
"@earendil-works/pi-tui": "^0.74.0",
|
|
44
44
|
"@types/node": "^25.6.0",
|
|
45
45
|
"typescript": "^6.0.3"
|
|
46
46
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtensionAPI } from "@
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { readSkillBlock, sourceInfoToSkill, type SkillCommandInfo } from "../skills.js";
|
|
3
3
|
|
|
4
4
|
const SKILL_INVOCATION_PATTERN = /(^|[^\w/-])\/skill:([a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?)(?=$|[^a-z0-9-])/g;
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
type ExtensionAPI,
|
|
7
7
|
type Skill,
|
|
8
8
|
type Theme,
|
|
9
|
-
} from "@
|
|
10
|
-
import { type Component, Key, matchesKey, type SettingItem, SettingsList, truncateToWidth, type TUI } from "@
|
|
9
|
+
} from "@earendil-works/pi-coding-agent";
|
|
10
|
+
import { type Component, Key, matchesKey, type SettingItem, SettingsList, truncateToWidth, type TUI } from "@earendil-works/pi-tui";
|
|
11
11
|
import {
|
|
12
12
|
normalizeSkillName,
|
|
13
13
|
normalizeSkillNames,
|
|
@@ -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
|
|
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);
|