MCPcopy Index your code
hub / github.com/awesome-opencode/awesome-opencode / loadEntries

Function loadEntries

scripts/export-json.js:75–107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

73}
74
75async function loadEntries() {
76 const results = [];
77 const errors = [];
78
79 for (const category of CATEGORIES) {
80 const categoryPath = path.join(__dirname, '../data', category);
81 let entries = [];
82
83 try {
84 entries = await readYamlDir(categoryPath);
85 } catch (err) {
86 if (err.code === 'ENOENT') {
87 continue;
88 }
89 throw err;
90 }
91
92 for (const entry of entries) {
93 const result = validateEntry(entry, entry._filePath || categoryPath);
94 if (!result.valid) {
95 errors.push(formatValidationErrors(result));
96 continue;
97 }
98
99 const mapped = mapEntry(entry, category);
100 if (mapped) {
101 results.push(stripUndefined(mapped));
102 }
103 }
104 }
105
106 return { results, errors };
107}
108
109async function main() {
110 const { outputPath, pretty } = parseArgs(process.argv.slice(2));

Callers 1

mainFunction · 0.85

Calls 5

readYamlDirFunction · 0.85
validateEntryFunction · 0.85
formatValidationErrorsFunction · 0.85
mapEntryFunction · 0.85
stripUndefinedFunction · 0.85

Tested by

no test coverage detected