git-agent for KotlinConventional commits for Kotlin Android and server-side projects
git-agent handles Kotlin coroutine-based code, Android Jetpack patterns, and Ktor server changes, producing conventional commit messages that reflect modern Kotlin idioms.
diff example
diff --git a/app/src/main/kotlin/com/example/data/UserRepository.kt b/app/src/main/kotlin/com/example/data/UserRepository.kt
index 3e1f8b2..7d4c9a5 100644
--- a/app/src/main/kotlin/com/example/data/UserRepository.kt
+++ b/app/src/main/kotlin/com/example/data/UserRepository.kt
@@ -5,12 +5,24 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
+import kotlinx.coroutines.flow.catch
+import kotlinx.coroutines.flow.onStart
class UserRepository(private val api: UserApi, private val dao: UserDao) {
- fun getUser(id: String): Flow<User> = flow {
- emit(api.getUser(id))
- }
+ fun getUser(id: String): Flow<Result<User>> = flow {
+ emit(Result.success(api.getUser(id)))
+ }
+ .onStart { emit(Result.success(dao.getUser(id) ?: return@onStart)) }
+ .catch { emit(Result.failure(it)) }
}git-agent output
feat(data): wrap UserRepository flow emissions in Result for error propagation
- change return type from Flow<User> to Flow<Result<User>> for explicit error handling
- emit cached db result via onStart before network fetch for instant UI update
- catch network errors and emit Result.failure instead of crashing the flow
Collectors previously had to handle uncaught exceptions at the catch
operator level; wrapping in Result moves error handling into the type
system and enables consistent loading/error/success UI states.Why it works for Kotlin
- Understands Kotlin coroutine and Flow patterns for accurate commit descriptions
- Recognises Android Jetpack components (ViewModel, Repository, Room) for scope naming
- Handles Gradle Kotlin DSL (build.gradle.kts) dependency changes as chore commits
- Works with Kotlin Multiplatform projects and platform-specific source sets
install
brew install gitagenthq/brew/git-agent
# inside your Kotlin project
git-agent init # detects Gradle module structure and suggests scopesFAQ
Does git-agent understand Kotlin data classes and sealed classes?Yes. The LLM understands Kotlin-specific constructs including data classes, sealed classes, and object declarations, and generates accurate descriptions for changes to them.
Can git-agent handle Android resource file changes?Yes. XML layout files, string resources, and drawable changes are recognised as resource changes and committed separately from Kotlin code changes.
Does git-agent work with Ktor server projects?Yes. Ktor route definitions, plugins, and application.conf changes are all handled correctly. The tool works with any Kotlin project regardless of the framework.