/**
 * Skill management REST routes.
 *
 * GET    /api/skills          — list all discovered skills
 * PATCH  /api/skills/:id      — update skill (enable/disable)
 * POST   /api/skills/scan     — re-scan skill directories
 */
export function registerSkillRoutes(app, skillRegistry) {
    /** List all discovered skills. */
    app.get("/api/skills", async () => {
        return skillRegistry.list().map((s) => ({
            id: s.id,
            name: s.name,
            description: s.description,
            filePath: s.filePath,
            source: s.source,
            enabled: s.enabled,
        }));
    });
    /** Toggle a skill's enabled state. */
    app.patch("/api/skills/:id", async (req, reply) => {
        const skill = skillRegistry.get(req.params.id);
        if (!skill)
            return reply.status(404).send({ error: "Skill not found" });
        const body = req.body;
        if (body && typeof body.enabled === "boolean") {
            skillRegistry.setEnabled(req.params.id, body.enabled);
        }
        return {
            id: skill.id,
            name: skill.name,
            description: skill.description,
            filePath: skill.filePath,
            source: skill.source,
            enabled: skill.enabled,
        };
    });
}
//# sourceMappingURL=skills.js.map