Replace defaultAgent with agents list#5
Conversation
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.
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe PR replaces a single Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (8)
src/main/kotlin/zone/clanker/opsx/Opsx.ktsrc/main/kotlin/zone/clanker/opsx/skill/SkillGenerator.ktsrc/main/kotlin/zone/clanker/opsx/task/SyncTask.ktsrc/test/kotlin/zone/clanker/opsx/OpsxPluginSyncTest.ktsrc/test/kotlin/zone/clanker/opsx/OpsxPluginTest.ktsrc/test/kotlin/zone/clanker/opsx/skill/SkillGeneratorAgentTest.ktsrc/test/kotlin/zone/clanker/opsx/skill/SkillGeneratorTest.ktsrc/test/kotlin/zone/clanker/opsx/task/SyncTaskTest.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
Summary
defaultAgent: StringfromSettingsExtensionagents: List<Agent>— configure which agents get generated filesskillDirectories: List<String>— additional skill source dirsagentDirectories: List<String>— additional agent source dirsDSL
Test plan
./gradlew buildpasses (detekt, ktlint, tests, kover)listOf(CLAUDE, COPILOT)generates both sets of filesChange proposed via opsx
opsx-propose+opsx-apply(11/11 tasks completed, 0 failed).Summary by CodeRabbit
Refactor
Tests