adds claude-generated commit messages and a recent commits panel to the git view - adds log tailing in the explorer, branch merging and a clean up button

This commit is contained in:
2026-11-04 10:07:52 +01:00
parent 600d4874d2
commit cc6651c08a
49 changed files with 1944 additions and 180 deletions
@@ -112,6 +112,21 @@ public actor GitService: GitServicing {
return "\(name) <\(email)>"
}
public func recentCommits() async -> [GitCommitSummary] {
guard let result = try? await Self.run(GitCommitLogParsing.arguments, root: root, runner: runner), result.succeeded else {
return []
}
return GitCommitLogParsing.commits(result.stdout)
}
/// No external diff driver, so the patch is git's own text whatever the user configured.
public func stagedDiff() async -> StagedDiff? {
async let stat = try? Self.run(["diff", "--cached", "--no-color", "--no-ext-diff", "--stat"], root: root, runner: runner)
async let patch = try? Self.run(["diff", "--cached", "--no-color", "--no-ext-diff"], root: root, runner: runner)
guard let stat = await stat, stat.succeeded, let patch = await patch, patch.succeeded else { return nil }
return StagedDiff(stat: stat.stdout, patch: patch.stdout)
}
private func configValue(_ key: String) async -> String? {
guard let result = try? await Self.run(["config", "--get", key], root: root, runner: runner), result.succeeded else { return nil }
let value = result.stdout.trimmingCharacters(in: .whitespacesAndNewlines)
@@ -31,6 +31,10 @@ public protocol GitServicing: Sendable {
func branches() async -> GitBranchList
/// `user.name <user.email>` from git config, nil when unset.
func author() async -> String?
/// The last 30 commits of HEAD, newest first; empty without commits or outside a repository.
func recentCommits() async -> [GitCommitSummary]
/// `git diff --cached` as stat and patch; nil when git fails, e.g. outside a repository.
func stagedDiff() async -> StagedDiff?
}
extension GitServicing {