The best way to control Claude Code, Codex and more from any computer or phone

main
ts 45 lines 1.48 KB
Raw
1 import type * as Search from "@distilled.cloud/github/search";
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 /**
8 * GitHub search syntax without the repository qualifier; the binding adds
9 * `repo:{owner}/{name}`.
10 */
11 export interface SearchIssuesRequest extends Search.IssuesAndPullRequestsRequest {}
12
13 export type SearchIssuesResponse = Search.IssuesAndPullRequestsResponse;
14
15 /**
16 * Search issues and pull requests in the bound repository
17 * (`search.issuesAndPullRequests`). The binding prefixes `q` with
18 * `repo:{owner}/{name}`. GitHub's search index lags writes by a few seconds.
19 *
20 * Provide `GitHub.SearchIssuesHttp` on a Worker or Function, or
21 * `GitHub.SearchIssuesLocal` on an Action.
22 *
23 * ### Searching Issues at Runtime
24 * **Example:** Find open bugs by title
25 * ```typescript
26 * const searchIssues = yield* GitHub.SearchIssues(yield* Repo);
27 * const { items } = yield* searchIssues({ q: "is:open label:bug crash in:title" });
28 * ```
29 *
30 * @binding
31 * @product Issue
32 */
33 export interface SearchIssues extends Binding.Service<
34 SearchIssues,
35 "GitHub.SearchIssues",
36 (
37 repo: Repository,
38 ) => Effect.Effect<
39 (
40 request: SearchIssuesRequest,
41 ) => Effect.Effect<SearchIssuesResponse, Search.IssuesAndPullRequestsError, RuntimeContext>
42 >
43 > {}
44
45 export const SearchIssues = Binding.Service<SearchIssues>("GitHub.SearchIssues");