Skip to content

Replace defaultAgent with agents list#5

Merged
ClankerGuru merged 3 commits into
mainfrom
fix/replace-defaultagent-with-agents-list
Apr 15, 2026
Merged

Replace defaultAgent with agents list#5
ClankerGuru merged 3 commits into
mainfrom
fix/replace-defaultagent-with-agents-list

Conversation

@ClankerGuru
Copy link
Copy Markdown
Owner

@ClankerGuru ClankerGuru commented Apr 15, 2026

Summary

  • Remove defaultAgent: String from SettingsExtension
  • Add agents: List<Agent> — configure which agents get generated files
  • Add skillDirectories: List<String> — additional skill source dirs
  • Add agentDirectories: List<String> — additional agent source dirs
  • First agent in list used for dispatch (propose, apply, verify)
  • Empty list = nothing generated, sync logs warning
  • All agents in list get symlinks, instruction files, and agent definitions

DSL

import zone.clanker.opsx.model.Agent

opsx {
    agents = listOf(Agent.CLAUDE, Agent.COPILOT)
    skillDirectories = listOf("company/skills")
    agentDirectories = listOf("company/agents")
}

Test plan

  • ./gradlew build passes (detekt, ktlint, tests, kover)
  • Multi-agent test: listOf(CLAUDE, COPILOT) generates both sets of files
  • Empty list test: sync does nothing
  • Single agent test: only that agent's files generated

Change proposed via opsx

opsx-propose + opsx-apply (11/11 tasks completed, 0 failed).

Summary by CodeRabbit

  • Refactor

    • Gradle plugin now supports configuring and using multiple agents simultaneously, replacing the previous single agent limitation. Skills, agent definitions, and instruction files are now generated for all configured agents independently.
  • Tests

    • Added comprehensive test coverage for multi-agent synchronization, skill generation, and edge cases including empty agent configurations.

Remove defaultAgent from SettingsExtension. Add agents: List<Agent>
(default empty), skillDirectories: List<String>, agentDirectories:
List<String>. First agent in list dispatches. All agents get symlinks,
instruction files, and agent definitions. Empty list = nothing generated.

SkillGenerator iterates over all configured agents for symlinks,
instruction files, and agent definitions. SyncTask wires the full
list from extension. Tests cover multi-agent and empty-list scenarios.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

Warning

Rate limit exceeded

@ClankerGuru has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 34 minutes and 44 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 34 minutes and 44 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f0b868ea-d449-413c-ad73-5b4cad93e4d6

📥 Commits

Reviewing files that changed from the base of the PR and between 13aeb18 and ee6d85c.

📒 Files selected for processing (7)
  • src/main/kotlin/zone/clanker/opsx/Opsx.kt
  • src/main/kotlin/zone/clanker/opsx/skill/SkillGenerator.kt
  • src/main/kotlin/zone/clanker/opsx/task/SyncTask.kt
  • src/main/kotlin/zone/clanker/opsx/workflow/AgentDispatcher.kt
  • src/main/kotlin/zone/clanker/opsx/workflow/TaskExecutor.kt
  • src/test/kotlin/zone/clanker/opsx/OpsxPluginTest.kt
  • src/test/kotlin/zone/clanker/opsx/workflow/AtomicTaskLifecycleTest.kt
📝 Walkthrough

Walkthrough

The PR replaces a single defaultAgent string configuration in the opsx Gradle plugin with three configurable list properties: agents, skillDirectories, and agentDirectories. Core components (SkillGenerator, SyncTask) are updated to operate over multiple agents instead of a single default agent, with corresponding test updates.

Changes

Cohort / File(s) Summary
Configuration Extension
src/main/kotlin/zone/clanker/opsx/Opsx.kt
Replaced defaultAgent: String with three mutable list properties: agents, skillDirectories, agentDirectories. Task configuration updated to populate these from extension and resolve dispatch agent to first element of agents list.
Skill Generation
src/main/kotlin/zone/clanker/opsx/skill/SkillGenerator.kt
Constructor changed from single defaultAgent: Agent to agents: List<Agent>. Now generates skill markdown symlinks, instruction files (AGENTS.md, per-agent instruction files), and agent definitions (opsx.md) for all configured agents. Added support for copying additional agent directories per agent.
Sync & Clean Tasks
src/main/kotlin/zone/clanker/opsx/task/SyncTask.kt
Replaced defaultAgent: Property<String> with agents: ListProperty<String>. Added skillDirectories and agentDirectories properties. Task now parses all agents, cleans/generates skills for each, applies ignore patterns per agent, and reports all agent IDs in logs.
Integration Tests
src/test/kotlin/zone/clanker/opsx/OpsxPluginSyncTest.kt
New test suite verifying SyncTask behavior with empty and populated agent configurations, including skill directory creation, .gitignore generation, CleanTask cleanup of OPSX markers, and filesystem isolation.
Configuration & Dispatch Tests
src/test/kotlin/zone/clanker/opsx/OpsxPluginTest.kt
Updated to verify new list-based configuration properties and their mutability. Replaced infrastructure task tests with new dispatch agent resolution test asserting ProposeTask resolves to first agent in list.
Generator Agent Tests
src/test/kotlin/zone/clanker/opsx/skill/SkillGeneratorAgentTest.kt, src/test/kotlin/zone/clanker/opsx/skill/SkillGeneratorTest.kt
Updated SkillGenerator instantiation to use agents lists. Added multi-agent scenarios verifying definition files and symlinks created for each configured agent, plus empty agents list edge case.
Task Initialization
src/test/kotlin/zone/clanker/opsx/task/SyncTaskTest.kt
Extended test setup to initialize new collection properties (agents, skillDirectories, agentDirectories) before task invocation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • opsx#2: Modifies SkillGenerator and SyncTask with related multi-agent enhancements; directly extends prior agent-handling work.
  • opsx#4: Updates the same core files (Opsx.SettingsExtension, SkillGenerator, SyncTask) with overlapping multi-agent property changes.
  • opsx#1: Implements concurrent multi-agent refactoring in SkillGenerator and SyncTask, sharing architectural patterns with this PR.

Poem

🐰 One agent danced alone, but now we hop with many—
Claude, Copilot, and beyond in directories so sunny!
Lists of skill and symlinks bloom for each dear friend,
The rabbit's burrow grows: multi-agent bliss without end! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: replacing a single defaultAgent string with a configurable agents list across the entire codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/replace-defaultagent-with-agents-list

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/kotlin/zone/clanker/opsx/Opsx.kt`:
- Around line 59-61: The public property agents in Opsx.kt is typed as
MutableList<String> but the DSL uses Agent values (e.g., listOf(Agent.CLAUDE,
Agent.COPILOT)), so change the public property agents to MutableList<Agent>
(rather than MutableList<String>) and update any wiring/serialization logic that
consumes agents to map Agent -> String id (e.g., when creating tasks or wiring
agents, call a mapping like agents.map { it.id } or the appropriate identifier
getter). Ensure usages that currently expect String (wiring code, task creation)
are updated to accept or derive the agent id from the Agent instances; keep
skillDirectories/agentDirectories unchanged unless they have the same mismatch.
- Around line 106-110: In Opsx.kt replace the empty-string fallback in the
provider block that inspects SettingsExtension.agents (the
.orElse(rootProject.provider { extension.agents.firstOrNull() ?: "" }) pattern)
so it does not inject "" as an agent id; instead fail fast with a clear
configuration error (e.g. throw a GradleException/IllegalStateException with a
message like "No opsx.agent configured and opsx.agents is empty; please set
-Pzone.clanker.opsx.agent or configure opsx.agents") or supply a real default
agent value; ensure the change is localized to the provider/orElse call so the
code that reads the agent id no longer receives an empty string.

In `@src/main/kotlin/zone/clanker/opsx/skill/SkillGenerator.kt`:
- Around line 188-197: The current flow writes the generated agent definition
via buildAgentDefinition(file.writeText(...)) and then copies all *.md from
additionalAgentDirs with overwrite = true, which allows an extra opsx.md to
silently replace the generated file; update the additionalAgentDirs copy logic
in SkillGenerator (the block iterating additionalAgentDirs /
extraDir.listFiles()) to either perform the copy before calling
file.writeText(buildAgentDefinition(agent)) or (preferably) filter out files
named "opsx.md" (case-insensitive) so you skip copying any opsx.md into dir,
ensuring the generated opsx.md produced by buildAgentDefinition is never
overwritten.

In `@src/main/kotlin/zone/clanker/opsx/task/SyncTask.kt`:
- Around line 87-104: cleanAgentSymlinks currently only iterates parsedAgents so
removed agents' symlinks remain; update cleanAgentSymlinks to walk all known
agent skill dirs (not just parsedAgents) — e.g., derive the list from the
canonical agent registry (Agent.values() or the same source used by
SkillGenerator.generateInstructionFiles()/generateAgentDefinitions()) and for
each agent build File(home, agent.skillDir) and File(root, agent.skillDir), then
filter exists(), listFiles(), isOpsxSymlink(it, sourceDir) and delete matching
symlinks; keep isOpsxSymlink protection so user files are not removed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1d83c9f9-ed56-434c-a031-a179f43f8477

📥 Commits

Reviewing files that changed from the base of the PR and between 994b5e9 and 13aeb18.

📒 Files selected for processing (8)
  • src/main/kotlin/zone/clanker/opsx/Opsx.kt
  • src/main/kotlin/zone/clanker/opsx/skill/SkillGenerator.kt
  • src/main/kotlin/zone/clanker/opsx/task/SyncTask.kt
  • src/test/kotlin/zone/clanker/opsx/OpsxPluginSyncTest.kt
  • src/test/kotlin/zone/clanker/opsx/OpsxPluginTest.kt
  • src/test/kotlin/zone/clanker/opsx/skill/SkillGeneratorAgentTest.kt
  • src/test/kotlin/zone/clanker/opsx/skill/SkillGeneratorTest.kt
  • src/test/kotlin/zone/clanker/opsx/task/SyncTaskTest.kt

Comment thread src/main/kotlin/zone/clanker/opsx/Opsx.kt Outdated
Comment thread src/main/kotlin/zone/clanker/opsx/Opsx.kt
Comment thread src/main/kotlin/zone/clanker/opsx/skill/SkillGenerator.kt
Comment thread src/main/kotlin/zone/clanker/opsx/task/SyncTask.kt
Agent stdout goes to log file only — no longer mixed with task
progress in the terminal. TaskExecutor shows clear numbered progress:
[1/11] [running] → [done] with elapsed time, separator lines, and
summary. Users see task-by-task status without agent noise.
…ean all dirs

- SettingsExtension.agents is now MutableList<Agent>, not String
- Empty agents list fails fast with clear config error message
- Additional agent dirs skip opsx.md (reserved for generated)
- Sync cleans ALL agent skill dirs, not just configured ones
@ClankerGuru ClankerGuru merged commit 12753db into main Apr 15, 2026
2 checks passed
@ClankerGuru ClankerGuru deleted the fix/replace-defaultagent-with-agents-list branch April 15, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant