mindcraft/src/agent/library/index.js

24 lines
728 B
JavaScript
Raw Normal View History

import * as skills from './skills.js';
2023-11-07 20:21:19 -08:00
import * as world from './world.js';
export function docHelper(functions, module_name) {
2025-02-08 22:30:36 -08:00
let docArray = [];
for (let skillFunc of functions) {
let str = skillFunc.toString();
2025-02-08 22:30:36 -08:00
if (str.includes('/**')) {
let docEntry = `${module_name}.${skillFunc.name}\n`;
docEntry += str.substring(str.indexOf('/**') + 3, str.indexOf('**/')).trim();
docArray.push(docEntry);
2023-11-07 20:21:19 -08:00
}
}
2025-02-08 22:30:36 -08:00
return docArray;
}
2024-01-25 13:25:36 -08:00
export function getSkillDocs() {
2025-02-08 22:30:36 -08:00
let docArray = [];
docArray = docArray.concat(docHelper(Object.values(skills), 'skills'));
docArray = docArray.concat(docHelper(Object.values(world), 'world'));
return docArray;
}