MCPcopy Index your code
hub / github.com/Microck/opencode-studio / loadPluginsFromDir

Function loadPluginsFromDir

server/index.js:802–829  ·  view source on GitHub ↗
(dirInfo)

Source from the content-addressed store, hash-verified

800};
801
802const loadPluginsFromDir = (dirInfo) => {
803 const plugins = [];
804 if (!fs.existsSync(dirInfo.path)) return plugins;
805
806 try {
807 const files = fs.readdirSync(dirInfo.path)
808 .filter(f => f.endsWith('.js') || f.endsWith('.ts'));
809
810 for (const file of files) {
811 const filePath = path.join(dirInfo.path, file);
812 const content = fs.readFileSync(filePath, 'utf8');
813 const name = path.basename(file, path.extname(file));
814
815 plugins.push({
816 name,
817 filename: file,
818 content,
819 source: dirInfo.source,
820 path: filePath,
821 root: dirInfo.root
822 });
823 }
824 } catch (e) {
825 console.warn(`Failed to load plugins from ${dirInfo.path}:`, e.message);
826 }
827
828 return plugins;
829};
830
831const loadSkillsFromDir = (dirInfo) => {
832 const skills = [];

Callers 1

aggregatePluginsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected