The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import type * as Issues from "@distilled.cloud/github/issues"; |
| 2 | import * as Binding from "alchemy/Binding"; |
| 3 | import type { RuntimeContext } from "alchemy/RuntimeContext"; |
| 4 | import type * as Effect from "effect/Effect"; |
| 5 | import type { Repository } from "./Repository.ts"; |
| 6 | |
| 7 | export interface CreateIssueRequest extends Omit<Issues.CreateRequest, "owner" | "repo"> {} |
| 8 | |
| 9 | export type CreateIssueResponse = Issues.Issue; |
| 10 | |
| 11 | /** |
| 12 | * Open an issue in the bound repository (`issues.create`). |
| 13 | * |
| 14 | * Provide `GitHub.CreateIssueHttp` on a Worker or Function, or |
| 15 | * `GitHub.CreateIssueLocal` on an Action. |
| 16 | * |
| 17 | * ### Opening Issues at Runtime |
| 18 | * **Example:** Open an issue from a Worker |
| 19 | * ```typescript |
| 20 | * const createIssue = yield* GitHub.CreateIssue(yield* Repo); |
| 21 | * const issue = yield* createIssue({ |
| 22 | * title: "Deploy failed", |
| 23 | * body: "See the logs for details.", |
| 24 | * labels: ["incident"], |
| 25 | * }); |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | * @product Issue |
| 30 | */ |
| 31 | export interface CreateIssue extends Binding.Service< |
| 32 | CreateIssue, |
| 33 | "GitHub.CreateIssue", |
| 34 | ( |
| 35 | repo: Repository, |
| 36 | ) => Effect.Effect< |
| 37 | ( |
| 38 | request: CreateIssueRequest, |
| 39 | ) => Effect.Effect<CreateIssueResponse, Issues.CreateError, RuntimeContext> |
| 40 | > |
| 41 | > {} |
| 42 | |
| 43 | export const CreateIssue = Binding.Service<CreateIssue>("GitHub.CreateIssue"); |