MCPcopy Create free account
hub / github.com/Fibi66/FeiControl / countFiles

Function countFiles

src/lib/skill-parser.ts:115–137  ·  view source on GitHub ↗

* Count files in a skill folder (excluding hidden files)

(skillPath: string)

Source from the content-addressed store, hash-verified

113 * Count files in a skill folder (excluding hidden files)
114 */
115function countFiles(skillPath: string): { count: number; files: string[] } {
116 try {
117 const files: string[] = [];
118
119 function scanDir(dir: string, prefix: string = '') {
120 const entries = fs.readdirSync(dir, { withFileTypes: true });
121 for (const entry of entries) {
122 if (entry.name.startsWith('.')) continue;
123 const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
124 if (entry.isDirectory()) {
125 scanDir(path.join(dir, entry.name), relativePath);
126 } else {
127 files.push(relativePath);
128 }
129 }
130 }
131
132 scanDir(skillPath);
133 return { count: files.length, files };
134 } catch {
135 return { count: 0, files: [] };
136 }
137}
138
139/**
140 * Parse a single skill from its directory

Callers 1

parseSkillFunction · 0.85

Calls 1

scanDirFunction · 0.85

Tested by

no test coverage detected