git-agent for Scala

Conventional commits for Scala and functional programming projects

git-agent understands Scala's type-level programming, ZIO and Cats Effect patterns, and sbt build definitions, producing atomic conventional commits for Scala codebases of any size.

diff --git a/src/main/scala/com/example/user/UserService.scala b/src/main/scala/com/example/user/UserService.scala index 7f2c3a1..4b9d8e6 100644 --- a/src/main/scala/com/example/user/UserService.scala +++ b/src/main/scala/com/example/user/UserService.scala @@ -1,20 +1,26 @@ package com.example.user -import scala.concurrent.{ExecutionContext, Future} -import com.example.db.Database +import zio.* -class UserService(db: Database)(implicit ec: ExecutionContext) { - def getUser(id: String): Future[Option[User]] = { - db.query[User]("SELECT * FROM users WHERE id = ?", id) - } +class UserService(db: Database) { + def getUser(id: String): ZIO[Any, AppError, User] = { + for + row <- db.query[User]("SELECT * FROM users WHERE id = ?", id) + user <- ZIO.fromOption(row).orElseFail(AppError.NotFound(id)) + yield user + } - def createUser(data: CreateUser): Future[User] = { - db.execute("INSERT INTO users ...", data).map { _ => - User(id = UUID.randomUUID(), name = data.name) - } + def createUser(data: CreateUser): ZIO[Any, AppError, User] = { + for + id <- Random.nextUUID + _ <- db.execute("INSERT INTO users ...", data) + yield User(id = id, name = data.name) + } + + def deleteUser(id: String): ZIO[Any, AppError, Unit] = { + db.execute("DELETE FROM users WHERE id = ?", id).unit } }
git-agent output
refactor(users): migrate UserService from Future to ZIO effect system - replace implicit ExecutionContext with ZIO's built-in fiber-based concurrency - make getUser return ZIO[Any, AppError, User] with explicit NotFound error - replace UUID.randomUUID() with ZIO Random service for testability - add deleteUser method with proper error channel typing - remove implicit parameter list in favour of ZIO environment The Future-based API hid errors in failed futures and required global ExecutionContext threading; the ZIO migration makes the error channel explicit, eliminates implicit dependencies, and enables structured concurrency with interruption support.
  • Understands sbt multi-project builds and provides per-module scope suggestions
  • Recognises ZIO and Cats Effect type signatures for accurate commit descriptions
  • Separates Scala 2 and Scala 3 source compatibility changes into distinct commits
  • Handles Scala macro and compile-time reflection changes correctly
brew install gitagenthq/brew/git-agent # inside your Scala project git-agent init # reads build.sbt subproject definitions for scope suggestions
Does git-agent handle Scala 3 syntax alongside Scala 2?
Yes. The LLM understands both Scala 2 and Scala 3 syntax including indentation-based syntax, enums, given/using, and extension methods. Migration diffs between the two versions are described accurately.
How does git-agent handle ZIO effectful code with for-comprehensions?
ZIO for-comprehension changes are recognised as sequential effect composition. The LLM understands the ZIO type parameters (R, E, A) and accurately describes the error channel and dependency changes.
Can git-agent work with Scala.js and Scala Native projects?
Yes. Cross-platform projects with sbt-crossproject are handled correctly. Platform-specific source directories are recognised, and changes to shared vs platform-specific code are committed appropriately.