(res: http.ServerResponse, urlPath: string)
| 1140 | } |
| 1141 | |
| 1142 | private serveSkillFiles(res: http.ServerResponse, urlPath: string): void { |
| 1143 | const skillId = urlPath.replace("/api/skill/", "").replace("/files", ""); |
| 1144 | const skill = this.store.getSkill(skillId); |
| 1145 | if (!skill) { |
| 1146 | res.writeHead(404, { "Content-Type": "application/json" }); |
| 1147 | res.end(JSON.stringify({ error: "Skill not found" })); |
| 1148 | return; |
| 1149 | } |
| 1150 | |
| 1151 | if (!fs.existsSync(skill.dirPath)) { |
| 1152 | this.jsonResponse(res, { files: [], error: "Skill directory not found" }); |
| 1153 | return; |
| 1154 | } |
| 1155 | |
| 1156 | const files = this.walkDir(skill.dirPath, skill.dirPath); |
| 1157 | this.jsonResponse(res, { files }); |
| 1158 | } |
| 1159 | |
| 1160 | private walkDir(dir: string, root: string): Array<{ path: string; type: string; size: number }> { |
| 1161 | const results: Array<{ path: string; type: string; size: number }> = []; |
no test coverage detected