/** * GitManager - Effect service contract for stacked Git workflows. * * Orchestrates status inspection and commit/push/PR flows by composing * lower-level Git and external tool services. * * @module GitManager */ import { GitActionProgressEvent, GitPreparePullRequestThreadInput, GitPreparePullRequestThreadResult, GitPullRequestRefInput, GitResolvePullRequestResult, GitRunStackedActionInput, GitRunStackedActionResult, GitStatusLocalResult, GitStatusRemoteResult, GitStatusInput, GitStatusResult, } from "@t3tools/contracts"; import { Context } from "effect"; import type { Effect } from "effect"; import type { GitManagerServiceError } from "@t3tools/contracts"; export interface GitActionProgressReporter { readonly publish: (event: GitActionProgressEvent) => Effect.Effect; } export interface GitRunStackedActionOptions { readonly actionId?: string; readonly progressReporter?: GitActionProgressReporter; } /** * GitManagerShape - Service API for high-level Git workflow actions. */ export interface GitManagerShape { /** * Read current repository Git status plus open PR metadata when available. */ readonly status: ( input: GitStatusInput, ) => Effect.Effect; /** * Read local repository status without remote hosting enrichment. */ readonly localStatus: ( input: GitStatusInput, ) => Effect.Effect; /** * Read remote tracking / PR status for a repository. */ readonly remoteStatus: ( input: GitStatusInput, ) => Effect.Effect; /** * Clear any cached local status snapshot for a repository. */ readonly invalidateLocalStatus: (cwd: string) => Effect.Effect; /** * Clear any cached remote status snapshot for a repository. */ readonly invalidateRemoteStatus: (cwd: string) => Effect.Effect; /** * Clear any cached status snapshot for a repository so the next read is fresh. */ readonly invalidateStatus: (cwd: string) => Effect.Effect; /** * Resolve a pull request by URL/number against the current repository. */ readonly resolvePullRequest: ( input: GitPullRequestRefInput, ) => Effect.Effect; /** * Prepare a new thread workspace from a pull request in local or worktree mode. */ readonly preparePullRequestThread: ( input: GitPreparePullRequestThreadInput, ) => Effect.Effect; /** * Run a Git action (`commit`, `push`, `create_pr`, `commit_push`, `commit_push_pr`). * When `featureBranch` is set, creates and checks out a feature branch first. */ readonly runStackedAction: ( input: GitRunStackedActionInput, options?: GitRunStackedActionOptions, ) => Effect.Effect; } /** * GitManager - Service tag for stacked Git workflow orchestration. */ export class GitManager extends Context.Service()( "t3/git/Services/GitManager", ) {}