@brainforge/core 3.0.1 → 3.0.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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -321,6 +321,7 @@ declare class SkillRegistry {
|
|
|
321
321
|
constructor();
|
|
322
322
|
register(skill: Skill): void;
|
|
323
323
|
loadUserSkills(skillsDir: string): Promise<void>;
|
|
324
|
+
loadSkillsFile(filePath: string): Promise<void>;
|
|
324
325
|
get(id: string): Skill | undefined;
|
|
325
326
|
list(filter?: {
|
|
326
327
|
category?: SkillCategory;
|
package/dist/index.js
CHANGED
|
@@ -3308,6 +3308,20 @@ var SkillRegistry = class {
|
|
|
3308
3308
|
} catch {
|
|
3309
3309
|
}
|
|
3310
3310
|
}
|
|
3311
|
+
async loadSkillsFile(filePath) {
|
|
3312
|
+
try {
|
|
3313
|
+
const raw = await fs6.readFile(filePath, "utf-8");
|
|
3314
|
+
const data = JSON.parse(raw);
|
|
3315
|
+
const skills = Array.isArray(data) ? data : [data];
|
|
3316
|
+
for (const skill of skills) {
|
|
3317
|
+
try {
|
|
3318
|
+
this.register(skill);
|
|
3319
|
+
} catch {
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
} catch {
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3311
3325
|
get(id) {
|
|
3312
3326
|
return this.skills.get(id);
|
|
3313
3327
|
}
|