• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

agentic-dev-library / thumbcode / 21933729139

12 Feb 2026 04:36AM UTC coverage: 28.401% (+0.7%) from 27.702%
21933729139

Pull #116

github

web-flow
Merge b9d1b07d1 into c6c31bd07
Pull Request #116: refactor: decompose 9 monolith files into focused modules

406 of 2268 branches covered (17.9%)

Branch coverage included in aggregate %.

365 of 845 new or added lines in 22 files covered. (43.2%)

1 existing line in 1 file now uncovered.

1120 of 3105 relevant lines covered (36.07%)

7.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

32.5
/packages/core/src/git/GitCommitService.ts
1
/**
2
 * Git Commit Service
3
 *
4
 * Handles commit operations: commit, stage, unstage, log.
5
 */
6

7
import git from 'isomorphic-git';
8

9
import { fs } from './git-fs';
10
import type {
11
  CommitInfo,
12
  CommitOptions,
13
  GitResult,
14
  StageOptions,
15
} from './types';
16

17
class GitCommitServiceClass {
18
  /**
19
   * Create a commit
20
   */
21
  async commit(options: CommitOptions): Promise<GitResult<string>> {
22
    const { dir, message, author, committer } = options;
2✔
23

24
    try {
2✔
25
      const sha = await git.commit({
2✔
26
        fs,
27
        dir,
28
        message,
29
        author: {
30
          name: author.name,
31
          email: author.email,
32
          timestamp: author.timestamp,
33
        },
34
        committer: committer
2!
35
          ? {
36
              name: committer.name,
37
              email: committer.email,
38
              timestamp: committer.timestamp,
39
            }
40
          : undefined,
41
      });
42

43
      return { success: true, data: sha };
2✔
44
    } catch (error) {
NEW
45
      return {
×
46
        success: false,
47
        error: error instanceof Error ? error.message : 'Commit failed',
×
48
      };
49
    }
50
  }
51

52
  /**
53
   * Stage files
54
   */
55
  async stage(options: StageOptions): Promise<GitResult<void>> {
56
    const { dir, filepath } = options;
2✔
57
    const paths = Array.isArray(filepath) ? filepath : [filepath];
2!
58

59
    try {
2✔
60
      for (const path of paths) {
2✔
61
        await git.add({
200✔
62
          fs,
63
          dir,
64
          filepath: path,
65
        });
66
      }
67

68
      return { success: true };
2✔
69
    } catch (error) {
NEW
70
      return {
×
71
        success: false,
72
        error: error instanceof Error ? error.message : 'Stage failed',
×
73
      };
74
    }
75
  }
76

77
  /**
78
   * Unstage files
79
   */
80
  async unstage(options: StageOptions): Promise<GitResult<void>> {
NEW
81
    const { dir, filepath } = options;
×
NEW
82
    const paths = Array.isArray(filepath) ? filepath : [filepath];
×
83

NEW
84
    try {
×
NEW
85
      for (const path of paths) {
×
NEW
86
        await git.remove({
×
87
          fs,
88
          dir,
89
          filepath: path,
90
        });
91
      }
92

NEW
93
      return { success: true };
×
94
    } catch (error) {
NEW
95
      return {
×
96
        success: false,
97
        error: error instanceof Error ? error.message : 'Unstage failed',
×
98
      };
99
    }
100
  }
101

102
  /**
103
   * Get commit log
104
   */
105
  async log(dir: string, depth = 20): Promise<GitResult<CommitInfo[]>> {
×
NEW
106
    try {
×
NEW
107
      const commits = await git.log({
×
108
        fs,
109
        dir,
110
        depth,
111
      });
112

NEW
113
      const commitInfos: CommitInfo[] = commits.map((commit) => ({
×
114
        oid: commit.oid,
115
        message: commit.commit.message,
116
        author: {
117
          name: commit.commit.author.name,
118
          email: commit.commit.author.email,
119
          timestamp: commit.commit.author.timestamp,
120
        },
121
        committer: {
122
          name: commit.commit.committer.name,
123
          email: commit.commit.committer.email,
124
          timestamp: commit.commit.committer.timestamp,
125
        },
126
        parents: commit.commit.parent,
127
      }));
128

NEW
129
      return { success: true, data: commitInfos };
×
130
    } catch (error) {
NEW
131
      return {
×
132
        success: false,
133
        error: error instanceof Error ? error.message : 'Failed to get log',
×
134
      };
135
    }
136
  }
137
}
138

139
export const GitCommitService = new GitCommitServiceClass();
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc