(req: http.IncomingMessage, res: http.ServerResponse, urlPath: string)
| 1404 | } |
| 1405 | |
| 1406 | private handleSkillUpdate(req: http.IncomingMessage, res: http.ServerResponse, urlPath: string): void { |
| 1407 | const skillId = urlPath.replace("/api/skill/", ""); |
| 1408 | this.readBody(req, (body) => { |
| 1409 | try { |
| 1410 | const data = JSON.parse(body); |
| 1411 | const skill = this.store.getSkill(skillId); |
| 1412 | if (!skill) { res.writeHead(404, { "Content-Type": "application/json" }); res.end(JSON.stringify({ error: "Skill not found" })); return; } |
| 1413 | this.store.updateSkill(skillId, { |
| 1414 | description: data.description ?? skill.description, |
| 1415 | version: skill.version, |
| 1416 | status: data.status ?? skill.status, |
| 1417 | installed: skill.installed, |
| 1418 | qualityScore: skill.qualityScore, |
| 1419 | }); |
| 1420 | this.jsonResponse(res, { ok: true, skillId }); |
| 1421 | } catch (err) { |
| 1422 | res.writeHead(400, { "Content-Type": "application/json" }); |
| 1423 | res.end(JSON.stringify({ error: String(err) })); |
| 1424 | } |
| 1425 | }); |
| 1426 | } |
| 1427 | |
| 1428 | private async handleSkillDisable(res: http.ServerResponse, urlPath: string): Promise<void> { |
| 1429 | const skillId = urlPath.split("/")[3]; |
no test coverage detected