Async Kotlin/JVM client built on Ktor + kotlinx.serialization. Every I/O
method is a `suspend` function; the client is `Closeable` for `use { }`.
Sealed `ForgeException` hierarchy enables exhaustive `when` over auth,
run-failure, generic-API, and transport errors. Models use `@SerialName`
to bridge idiomatic camelCase Kotlin properties to the snake_case wire
format. `RunResult.result` is a `JsonElement` so callers can narrow with
the standard `kotlinx.serialization.json` extensions.
- Kotlin 1.9.25 / JVM 17 toolchain
- Ktor 2.3.12 client (CIO engine; pluggable via ForgeOptions.engine)
- kotlinx-serialization 1.6.3, kotlinx-coroutines 1.8.1
- 14 tests (JUnit 5 + Ktor MockEngine), all green
- `./gradlew build` clean, `publishToMavenLocal` works
- MIT license declared in publishing block
Mirrors the surface of the Go and Rust SDKs (healthz, run, uploadFile,
admin tokens CRUD).
81 lines
2 KiB
Kotlin
81 lines
2 KiB
Kotlin
plugins {
|
|
kotlin("jvm") version "1.9.25"
|
|
kotlin("plugin.serialization") version "1.9.25"
|
|
`java-library`
|
|
`maven-publish`
|
|
}
|
|
|
|
group = "com.clawdforge"
|
|
version = "0.1.0"
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion.set(JavaLanguageVersion.of(17))
|
|
}
|
|
withSourcesJar()
|
|
}
|
|
|
|
kotlin {
|
|
jvmToolchain(17)
|
|
explicitApi()
|
|
}
|
|
|
|
val ktorVersion = "2.3.12"
|
|
|
|
dependencies {
|
|
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
|
|
api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
|
|
|
|
api("io.ktor:ktor-client-core:$ktorVersion")
|
|
api("io.ktor:ktor-client-content-negotiation:$ktorVersion")
|
|
api("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
|
|
implementation("io.ktor:ktor-client-cio:$ktorVersion")
|
|
|
|
testImplementation(kotlin("test"))
|
|
testImplementation("org.junit.jupiter:junit-jupiter:5.10.3")
|
|
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.1")
|
|
testImplementation("io.ktor:ktor-client-mock:$ktorVersion")
|
|
}
|
|
|
|
tasks.test {
|
|
useJUnitPlatform()
|
|
testLogging {
|
|
events("passed", "skipped", "failed")
|
|
}
|
|
}
|
|
|
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
|
compilerOptions {
|
|
freeCompilerArgs.addAll(
|
|
"-Xjsr305=strict",
|
|
"-opt-in=kotlin.RequiresOptIn",
|
|
)
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
create<MavenPublication>("maven") {
|
|
from(components["java"])
|
|
artifactId = "clawdforge"
|
|
|
|
pom {
|
|
name.set("clawdforge-kotlin")
|
|
description.set(
|
|
"Async Kotlin client for the clawdforge HTTP service " +
|
|
"(a LAN bearer-token-gated wrapper around `claude -p`).",
|
|
)
|
|
licenses {
|
|
license {
|
|
name.set("MIT License")
|
|
url.set("https://opensource.org/licenses/MIT")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|