@phi-code-admin/phi-code 0.57.7 → 0.57.8
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.
|
@@ -29,13 +29,15 @@ interface Skill {
|
|
|
29
29
|
content: string;
|
|
30
30
|
keywords: string[];
|
|
31
31
|
description: string;
|
|
32
|
-
source: "global" | "local";
|
|
32
|
+
source: "global" | "local" | "bundled";
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export default function skillLoaderExtension(pi: ExtensionAPI) {
|
|
36
36
|
let availableSkills: Skill[] = [];
|
|
37
37
|
const globalSkillsDir = join(homedir(), ".phi", "agent", "skills");
|
|
38
38
|
const localSkillsDir = join(process.cwd(), ".phi", "skills");
|
|
39
|
+
// Bundled skills shipped with the package (packages/coding-agent/skills/)
|
|
40
|
+
const bundledSkillsDir = join(__dirname, "..", "..", "..", "skills");
|
|
39
41
|
|
|
40
42
|
/**
|
|
41
43
|
* Extract keywords and description from SKILL.md content
|
|
@@ -129,7 +131,7 @@ export default function skillLoaderExtension(pi: ExtensionAPI) {
|
|
|
129
131
|
/**
|
|
130
132
|
* Load skills from a directory
|
|
131
133
|
*/
|
|
132
|
-
async function loadSkillsFromDirectory(directory: string, source: "global" | "local"): Promise<Skill[]> {
|
|
134
|
+
async function loadSkillsFromDirectory(directory: string, source: "global" | "local" | "bundled"): Promise<Skill[]> {
|
|
133
135
|
const skills: Skill[] = [];
|
|
134
136
|
|
|
135
137
|
try {
|
|
@@ -177,12 +179,23 @@ export default function skillLoaderExtension(pi: ExtensionAPI) {
|
|
|
177
179
|
* Load all available skills
|
|
178
180
|
*/
|
|
179
181
|
async function loadAllSkills(): Promise<void> {
|
|
182
|
+
const bundledSkills = await loadSkillsFromDirectory(bundledSkillsDir, "bundled");
|
|
180
183
|
const globalSkills = await loadSkillsFromDirectory(globalSkillsDir, "global");
|
|
181
184
|
const localSkills = await loadSkillsFromDirectory(localSkillsDir, "local");
|
|
182
185
|
|
|
183
|
-
|
|
186
|
+
// Merge: local > global > bundled (local overrides global overrides bundled)
|
|
187
|
+
const seen = new Set<string>();
|
|
188
|
+
availableSkills = [];
|
|
189
|
+
for (const skills of [localSkills, globalSkills, bundledSkills]) {
|
|
190
|
+
for (const skill of skills) {
|
|
191
|
+
if (!seen.has(skill.name)) {
|
|
192
|
+
seen.add(skill.name);
|
|
193
|
+
availableSkills.push(skill);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
184
197
|
|
|
185
|
-
console.log(`Loaded ${availableSkills.length} skills (${globalSkills.length} global, ${localSkills.length} local)`);
|
|
198
|
+
console.log(`Loaded ${availableSkills.length} skills (${bundledSkills.length} bundled, ${globalSkills.length} global, ${localSkills.length} local)`);
|
|
186
199
|
}
|
|
187
200
|
|
|
188
201
|
/**
|