Skip to content

Commit aa7c6f8

Browse files
authored
Settings plugin architecture with data object pattern (#1)
* Refactor to settings plugin architecture with data object pattern - Each plugin follows data object pattern (matching srcx/wrkx) - Settings plugins applied in settings.gradle.kts, tasks on root project - Per-module artifact IDs for correct Maven publishing - Kover coverage enforcement - Architecture tests verifying data object structure - Tested end-to-end: plugin applies, tasks register, CLI executes * Remove .kotlin/ from git, add to .gitignore * Add per-module READMEs, full task coverage, arg-building tests - READMEs for all 5 modules with CLI versions, install instructions, task docs - 35 new task classes (53 total across 4 agents) - Arg-building tests for run/exec tasks - Root README updated with module links * Achieve 90%+ coverage — extract buildCommand(), add comprehensive tests - Extract buildCommand() on every task for testability - Add Cli.execAndPrint() shared helper - 97 new tests across 4 modules - Kover minBound at 90% * Standardize install instructions — Homebrew + bun for all CLIs * Add bypass/dangerous flags as first-class extension properties * Align build-logic with wrkx/srcx conventions - Split conventions: clkx-module, clkx-toolchain, clkx-plugin, clkx-publish, clkx-testing, clkx-detekt, clkx-ktlint, clkx-conventions (uber) - Add ClkxSettingsPlugin for foojay toolchain resolution - Add detekt.yml config - Add slopTest source set with konsist - Kover at 90% with @TaskAction and SettingsPlugin exclusions - clkx-library for exec module (JavaLibrary publishing) * Split conventions (clkx-cover, clkx-konsist) + fix critical bugs - Split clkx-testing into clkx-testing (kotest), clkx-cover (kover), clkx-konsist (slopTest + konsist) - Fix --allowedTools to --allowed-tools (kebab-case) - Fix property name collision: -Pname to -PmcpName/-PpluginName - Fix daemon tasks (mcp serve, opencode serve) using execDaemon() - Add Cli.execDaemon() for long-running processes
1 parent 0f393f2 commit aa7c6f8

111 files changed

Lines changed: 5239 additions & 606 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.gradle/
2+
.kotlin/
23
build/
34
local.properties
45
.idea/

.kotlin/errors/errors-1775621134843.log

Lines changed: 0 additions & 84 deletions
This file was deleted.

README.md

Lines changed: 41 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,66 @@
44
[![Maven Central](https://img.shields.io/maven-central/v/zone.clanker/clkx-agents)](https://central.sonatype.com/namespace/zone.clanker)
55
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
66

7-
Gradle plugins for AI coding agents -- Claude Code, GitHub Copilot, OpenAI Codex, and OpenCode.
7+
Gradle settings plugins for AI coding agents -- Claude Code, GitHub Copilot, OpenAI Codex, and OpenCode.
88

99
## Modules
1010

11-
| Module | Plugin ID | Binary | Description |
12-
|--------|-----------|--------|-------------|
13-
| `:exec` | -- | -- | Core process execution utility |
14-
| `:claude` | `zone.clanker.claude` | `claude` | Claude Code CLI |
15-
| `:copilot` | `zone.clanker.copilot` | `copilot` | GitHub Copilot CLI |
16-
| `:codex` | `zone.clanker.codex` | `codex` | OpenAI Codex CLI |
17-
| `:opencode` | `zone.clanker.opencode` | `opencode` | OpenCode CLI |
11+
| Module | Plugin ID | Tasks | README |
12+
|--------|-----------|-------|--------|
13+
| [`:exec`](exec/) | -- | -- | [exec/README.md](exec/README.md) |
14+
| [`:claude`](claude/) | `zone.clanker.claude` | 13 | [claude/README.md](claude/README.md) |
15+
| [`:copilot`](copilot/) | `zone.clanker.copilot` | 9 | [copilot/README.md](copilot/README.md) |
16+
| [`:codex`](codex/) | `zone.clanker.codex` | 13 | [codex/README.md](codex/README.md) |
17+
| [`:opencode`](opencode/) | `zone.clanker.opencode` | 18 | [opencode/README.md](opencode/README.md) |
1818

19-
## Usage
19+
## Install the CLIs
2020

21-
Apply the plugin for the agent you want to use:
21+
```bash
22+
# Claude Code
23+
bun install -g @anthropic-ai/claude-code
24+
25+
# GitHub Copilot
26+
brew install --cask copilot-cli # or: bun install -g @github/copilot
27+
28+
# OpenAI Codex
29+
brew install --cask codex # or: bun install -g @openai/codex
30+
31+
# OpenCode
32+
brew install opencode # or: bun install -g opencode-ai
33+
```
34+
35+
## Quick Start
36+
37+
Apply the plugin for the agent you want to use in `settings.gradle.kts`:
2238

2339
```kotlin
2440
plugins {
2541
id("zone.clanker.claude") version "<version>"
2642
}
43+
44+
claude {
45+
model = "opus"
46+
effort = "high"
47+
}
2748
```
2849

29-
### Claude Code
50+
Then run tasks from the command line:
3051

3152
```bash
32-
# Run with a prompt
3353
./gradlew claude-run -Pprompt="Fix the build"
54+
```
3455

35-
# Resume a session
36-
./gradlew claude-resume -PsessionId="abc123"
56+
### Claude Code
3757

38-
# Check auth / version / health
58+
```bash
59+
./gradlew claude-run -Pprompt="Fix the build"
60+
./gradlew claude-resume -PsessionId="abc123"
3961
./gradlew claude-auth
4062
./gradlew claude-version
4163
./gradlew claude-doctor
4264
```
4365

44-
Configure defaults in `build.gradle.kts`:
45-
46-
```kotlin
47-
claude {
48-
model = "claude-sonnet-4-20250514"
49-
outputFormat = "json"
50-
permissionMode = "bypassPermissions"
51-
effort = "high"
52-
}
53-
```
66+
See [claude/README.md](claude/README.md) for all 13 tasks and configuration options.
5467

5568
### GitHub Copilot
5669

@@ -62,15 +75,7 @@ claude {
6275
./gradlew copilot-version
6376
```
6477

65-
Configure defaults:
66-
67-
```kotlin
68-
copilot {
69-
model = "gpt-4o"
70-
autopilot = true
71-
allowAll = true
72-
}
73-
```
78+
See [copilot/README.md](copilot/README.md) for all 9 tasks and configuration options.
7479

7580
### OpenAI Codex
7681

@@ -81,15 +86,7 @@ copilot {
8186
./gradlew codex-version
8287
```
8388

84-
Configure defaults:
85-
86-
```kotlin
87-
codex {
88-
model = "codex-mini-latest"
89-
fullAuto = true
90-
sandbox = "docker"
91-
}
92-
```
89+
See [codex/README.md](codex/README.md) for all 13 tasks and configuration options.
9390

9491
### OpenCode
9592

@@ -100,15 +97,7 @@ codex {
10097
./gradlew opencode-version
10198
```
10299

103-
Configure defaults:
104-
105-
```kotlin
106-
opencode {
107-
model = "anthropic/claude-sonnet-4-20250514"
108-
thinking = true
109-
format = "json"
110-
}
111-
```
100+
See [opencode/README.md](opencode/README.md) for all 18 tasks and configuration options.
112101

113102
## Building
114103

build-logic/build.gradle.kts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,25 @@ plugins {
22
`kotlin-dsl`
33
}
44

5+
repositories {
6+
mavenCentral()
7+
gradlePluginPortal()
8+
}
9+
510
dependencies {
6-
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.3.0")
11+
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${embeddedKotlinVersion}")
712
implementation("com.vanniktech:gradle-maven-publish-plugin:0.32.0")
13+
implementation("org.gradle.toolchains:foojay-resolver:1.0.0")
14+
implementation("org.jetbrains.kotlinx:kover-gradle-plugin:0.9.1")
815
implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.8")
916
implementation("org.jlleitschuh.gradle:ktlint-gradle:12.2.0")
1017
}
18+
19+
gradlePlugin {
20+
plugins {
21+
register("clkx-settings") {
22+
id = "clkx-settings"
23+
implementationClass = "zone.clanker.gradle.conventions.ClkxSettingsPlugin"
24+
}
25+
}
26+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
plugins {
2+
id("clkx-module")
3+
id("clkx-toolchain")
4+
id("clkx-plugin")
5+
id("clkx-publish")
6+
id("clkx-testing")
7+
id("clkx-cover")
8+
id("clkx-konsist")
9+
id("clkx-detekt")
10+
id("clkx-ktlint")
11+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
plugins {
2+
id("org.jetbrains.kotlinx.kover")
3+
}
4+
5+
kover {
6+
reports {
7+
filters {
8+
excludes {
9+
// @TaskAction run() methods delegate to Cli.execAndPrint — untestable without real CLIs
10+
annotatedBy("org.gradle.api.tasks.TaskAction")
11+
// Settings plugin apply() requires real Gradle Settings — tested via registerTasks
12+
classes("*\$SettingsPlugin", "*\$SettingsPlugin\$*")
13+
}
14+
}
15+
verify {
16+
rule {
17+
minBound(90)
18+
}
19+
}
20+
}
21+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
plugins {
2+
id("io.gitlab.arturbosch.detekt")
3+
}
4+
5+
detekt {
6+
config.setFrom(rootProject.file("config/detekt.yml"))
7+
buildUponDefaultConfig = true
8+
parallel = true
9+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
plugins {
2+
`java-base`
3+
}
4+
5+
val sourceSets = the<SourceSetContainer>()
6+
7+
val slopTest by sourceSets.creating {
8+
compileClasspath += sourceSets["main"].output
9+
runtimeClasspath += sourceSets["main"].output
10+
}
11+
12+
configurations[slopTest.implementationConfigurationName].extendsFrom(configurations["testImplementation"])
13+
configurations[slopTest.runtimeOnlyConfigurationName].extendsFrom(configurations["testRuntimeOnly"])
14+
15+
dependencies {
16+
"slopTestImplementation"("com.lemonappdev:konsist:0.17.3")
17+
"slopTestImplementation"("io.kotest:kotest-runner-junit5:5.9.1")
18+
"slopTestImplementation"("io.kotest:kotest-assertions-core:5.9.1")
19+
}
20+
21+
val slopTask = tasks.register<Test>("slopTest") {
22+
description = "Run slop taste tests — architecture, naming, boundaries, style"
23+
group = "verification"
24+
testClassesDirs = slopTest.output.classesDirs
25+
classpath = slopTest.runtimeClasspath
26+
useJUnitPlatform()
27+
}
28+
29+
tasks.named("check") {
30+
dependsOn(slopTask)
31+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
id("org.jlleitschuh.gradle.ktlint")
3+
}
4+
5+
ktlint {
6+
version.set("1.5.0")
7+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import com.vanniktech.maven.publish.JavaLibrary
2+
import com.vanniktech.maven.publish.JavadocJar
3+
4+
plugins {
5+
id("clkx-module")
6+
id("clkx-toolchain")
7+
id("clkx-testing")
8+
id("clkx-cover")
9+
id("clkx-konsist")
10+
id("clkx-detekt")
11+
id("clkx-ktlint")
12+
id("com.vanniktech.maven.publish")
13+
}
14+
15+
mavenPublishing {
16+
configure(JavaLibrary(javadocJar = JavadocJar.Empty()))
17+
}

0 commit comments

Comments
 (0)