Open History to see the last commit
1/**
2 * GitManager - Effect service contract for stacked Git workflows.
3 *
4 * Orchestrates status inspection and commit/push/PR flows by composing
5 * lower-level Git and external tool services.
6 *
7 * @module GitManager
8 */
9import {
10 GitPreparePullRequestThreadInput,
11 GitPreparePullRequestThreadResult,
12 GitPullRequestRefInput,
13 GitResolvePullRequestResult,
14 GitRunStackedActionInput,
15 GitRunStackedActionResult,
16 GitStatusInput,
17 GitStatusResult,
18} from "@t3tools/contracts";
19import { ServiceMap } from "effect";
20import type { Effect } from "effect";
21import type { GitManagerServiceError } from "../Errors.ts";
22
23/**
24 * GitManagerShape - Service API for high-level Git workflow actions.
25 */
26export interface GitManagerShape {
27 /**
28 * Read current repository Git status plus open PR metadata when available.
29 */
30 readonly status: (
31 input: GitStatusInput,
32 ) => Effect.Effect<GitStatusResult, GitManagerServiceError>;
33
34 /**
35 * Resolve a pull request by URL/number against the current repository.
36 */
37 readonly resolvePullRequest: (
38 input: GitPullRequestRefInput,
39 ) => Effect.Effect<GitResolvePullRequestResult, GitManagerServiceError>;
40
41 /**
42 * Prepare a new thread workspace from a pull request in local or worktree mode.
43 */
44 readonly preparePullRequestThread: (
45 input: GitPreparePullRequestThreadInput,
46 ) => Effect.Effect<GitPreparePullRequestThreadResult, GitManagerServiceError>;
47
48 /**
49 * Run a stacked Git action (`commit`, `commit_push`, `commit_push_pr`).
50 * When `featureBranch` is set, creates and checks out a feature branch first.
51 */
52 readonly runStackedAction: (
53 input: GitRunStackedActionInput,
54 ) => Effect.Effect<GitRunStackedActionResult, GitManagerServiceError>;
55}
56
57/**
58 * GitManager - Service tag for stacked Git workflow orchestration.
59 */
60export class GitManager extends ServiceMap.Service<GitManager, GitManagerShape>()(
61 "t3/git/Services/GitManager",
62) {}