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 GitActionProgressEvent,
11 GitPreparePullRequestThreadInput,
12 GitPreparePullRequestThreadResult,
13 GitPullRequestRefInput,
14 GitResolvePullRequestResult,
15 GitRunStackedActionInput,
16 GitRunStackedActionResult,
17 GitStatusInput,
18 GitStatusResult,
19} from "@t3tools/contracts";
20import { ServiceMap } from "effect";
21import type { Effect } from "effect";
22import type { GitManagerServiceError } from "@t3tools/contracts";
23
24export interface GitActionProgressReporter {
25 readonly publish: (event: GitActionProgressEvent) => Effect.Effect<void, never>;
26}
27
28export interface GitRunStackedActionOptions {
29 readonly actionId?: string;
30 readonly progressReporter?: GitActionProgressReporter;
31}
32
33/**
34 * GitManagerShape - Service API for high-level Git workflow actions.
35 */
36export interface GitManagerShape {
37 /**
38 * Read current repository Git status plus open PR metadata when available.
39 */
40 readonly status: (
41 input: GitStatusInput,
42 ) => Effect.Effect<GitStatusResult, GitManagerServiceError>;
43
44 /**
45 * Resolve a pull request by URL/number against the current repository.
46 */
47 readonly resolvePullRequest: (
48 input: GitPullRequestRefInput,
49 ) => Effect.Effect<GitResolvePullRequestResult, GitManagerServiceError>;
50
51 /**
52 * Prepare a new thread workspace from a pull request in local or worktree mode.
53 */
54 readonly preparePullRequestThread: (
55 input: GitPreparePullRequestThreadInput,
56 ) => Effect.Effect<GitPreparePullRequestThreadResult, GitManagerServiceError>;
57
58 /**
59 * Run a Git action (`commit`, `push`, `create_pr`, `commit_push`, `commit_push_pr`).
60 * When `featureBranch` is set, creates and checks out a feature branch first.
61 */
62 readonly runStackedAction: (
63 input: GitRunStackedActionInput,
64 options?: GitRunStackedActionOptions,
65 ) => Effect.Effect<GitRunStackedActionResult, GitManagerServiceError>;
66}
67
68/**
69 * GitManager - Service tag for stacked Git workflow orchestration.
70 */
71export class GitManager extends ServiceMap.Service<GitManager, GitManagerShape>()(
72 "t3/git/Services/GitManager",
73) {}