/** * GitHubCli - Effect service contract for `gh` process interactions. * * Provides thin command execution helpers used by Git workflow orchestration. * * @module GitHubCli */ import { ServiceMap } from "effect"; import type { Effect } from "effect"; import type { ProcessRunResult } from "../../processRunner"; import type { GitHubCliError } from "../Errors.ts"; export interface GitHubPullRequestSummary { readonly number: number; readonly title: string; readonly url: string; readonly baseRefName: string; readonly headRefName: string; } /** * GitHubCliShape - Service API for executing GitHub CLI commands. */ export interface GitHubCliShape { /** * Execute a GitHub CLI command and return full process output. */ readonly execute: (input: { readonly cwd: string; readonly args: ReadonlyArray; readonly timeoutMs?: number; }) => Effect.Effect; /** * List open pull requests for a head branch. */ readonly listOpenPullRequests: (input: { readonly cwd: string; readonly headBranch: string; readonly limit?: number; }) => Effect.Effect, GitHubCliError>; /** * Create a pull request from branch context and body file. */ readonly createPullRequest: (input: { readonly cwd: string; readonly baseBranch: string; readonly headBranch: string; readonly title: string; readonly bodyFile: string; }) => Effect.Effect; /** * Resolve repository default branch through GitHub metadata. */ readonly getDefaultBranch: (input: { readonly cwd: string; }) => Effect.Effect; } /** * GitHubCli - Service tag for GitHub CLI process execution. */ export class GitHubCli extends ServiceMap.Service()( "t3/git/Services/GitHubCli", ) {}