From e4b6f7ee9d8a24ff4163fea8a1b146616c23c9c4 Mon Sep 17 00:00:00 2001 From: ZGaetano Date: Tue, 2 Jun 2026 18:22:05 -0400 Subject: [PATCH] fix: remove .annotations() call, not available in this Effect version --- skill_group.ts | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 skill_group.ts diff --git a/skill_group.ts b/skill_group.ts new file mode 100644 index 0000000..97707d9 --- /dev/null +++ b/skill_group.ts @@ -0,0 +1,67 @@ +import { Schema } from "effect" +import { HttpApi, HttpApiEndpoint, HttpApiError, HttpApiGroup, OpenApi } from "effect/unstable/httpapi" +import { Authorization } from "../middleware/authorization" +import { InstanceContextMiddleware } from "../middleware/instance-context" +import { WorkspaceRoutingMiddleware, WorkspaceRoutingQuery } from "../middleware/workspace-routing" +import { described } from "./metadata" + +const root = "/skill" + +export const SkillInfo = Schema.Struct({ + name: Schema.String, + description: Schema.optional(Schema.String), + location: Schema.String, + content: Schema.String, +}) + +export const SkillApi = HttpApi.make("skill") + .add( + HttpApiGroup.make("skill") + .add( + HttpApiEndpoint.get("list", root, { + query: WorkspaceRoutingQuery, + success: described(Schema.Array(SkillInfo), "List of installed skills"), + }).annotateMerge( + OpenApi.annotations({ identifier: "skill.list", summary: "List all installed skills" }), + ), + HttpApiEndpoint.post("install", `${root}/install`, { + query: WorkspaceRoutingQuery, + payload: Schema.Struct({ url: Schema.String }), + success: described(SkillInfo, "Installed skill"), + error: HttpApiError.BadRequest, + }).annotateMerge( + OpenApi.annotations({ identifier: "skill.install", summary: "Install skill from URL or owner/repo" }), + ), + HttpApiEndpoint.post("upload", `${root}/upload`, { + query: WorkspaceRoutingQuery, + payload: Schema.Struct({ name: Schema.String, content: Schema.String }), + success: described(SkillInfo, "Uploaded skill"), + error: HttpApiError.BadRequest, + }).annotateMerge( + OpenApi.annotations({ identifier: "skill.upload", summary: "Upload a SKILL.md file directly" }), + ), + HttpApiEndpoint.del("remove", `${root}/:name`, { + query: WorkspaceRoutingQuery, + success: described(Schema.Literal(true), "Skill removed"), + error: HttpApiError.NotFound, + }).annotateMerge( + OpenApi.annotations({ identifier: "skill.remove", summary: "Remove an installed skill" }), + ), + ) + .annotateMerge( + OpenApi.annotations({ + title: "skill", + description: "Skills management: list, install, upload, and remove SKILL.md files.", + }), + ) + .middleware(InstanceContextMiddleware) + .middleware(WorkspaceRoutingMiddleware) + .middleware(Authorization), + ) + .annotateMerge( + OpenApi.annotations({ + title: "opencode experimental HttpApi", + version: "0.0.1", + description: "Experimental HttpApi surface for selected instance routes.", + }), + )