* feat(commands): add /compound-engineering-setup for configurable agents Adds a new setup command that allows users to configure which review agents to use instead of hardcoding them in workflows. This enables: - Multi-step onboarding with AskUserQuestion for easy setup - Auto-detection of project type (Rails, Python, TypeScript, etc.) - Three setup modes: Quick (smart defaults), Advanced, and Minimal - Configuration stored in .claude/compound-engineering.json - Support for both global (~/.claude/) and project-specific config Updated workflows to read from config: - /workflows:review - reads reviewAgents from config - /plan_review - reads planReviewAgents from config - /workflows:work - references config for reviewer agents - /workflows:compound - references config for specialized agents 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat: auto-trigger setup when no config exists Workflows now detect missing config and offer inline quick setup: - "Quick Setup" - auto-detect project type, create config, continue - "Full Setup" - run /compound-engineering-setup for customization - "Skip" - use defaults just this once This ensures users get onboarded automatically when running any workflow for the first time, without needing to know about the setup command beforehand. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(review): wire all conditionalAgents categories Extended /workflows:review to invoke conditional agents for: - migrations (existing) - frontend (new): JS/TS/Stimulus changes - architecture (new): structural changes, 10+ files - data (new): model/ActiveRecord changes Each category reads from conditionalAgents.* config key and runs appropriate specialized agents when file patterns match. Resolves: todos/001-ready-p2-conditional-agents-not-invoked.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: mark todo #001 as complete * feat(setup): add custom agent discovery and modify flow - Auto-detect custom agents in .claude/agents/ and ~/.claude/agents/ - Add modify existing config flow (add/remove agents, view config) - Include guide for creating custom review agents - Add customAgents mapping in config to track agent file paths - Update changelog with new config schema including customAgents Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: remove completed todos directory Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * [2.29.1] Improve /workflows:brainstorm question flow - Add "Ask more questions" option at handoff phase - Clarify that Claude should ask the user questions (not wait for user) - Require resolving ALL open questions before offering to proceed Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Simplify plugin settings: replace 486-line wizard with .local.md pattern - Rewrite setup.md (486 → 95 lines): detect project type, create .claude/compound-engineering.local.md with smart defaults - Make review.md and work.md config-aware: read agents from .local.md frontmatter, fall back to auto-detected defaults - Wire schema-drift-detector into review.md migrations conditional block - Delete technical_review.md (duplicated /plan_review) - Add disable-model-invocation to setup.md - Bump to v2.32.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Rewrite .claude/ paths for OpenCode/Codex targets, add npm publish workflow - Converters now rewrite .claude/ → .opencode/ (OpenCode) and .codex/ (Codex) in command bodies and agent bodies so .local.md settings work cross-platform - Apply transformContentForCodex to agent bodies (was only commands before) - Add GitHub Action to auto-publish to npm on version bump merge to main - Bump to v0.4.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(workflows-work): require post-deploy monitoring section Add a mandatory Post-Deploy Monitoring & Validation section to the /workflows:work PR template, include no-impact fallback guidance, and enforce it in the quality checklist. * Add learnings-researcher to review workflow, fix docs site counts - Add learnings-researcher as parallel agent #14 in /workflows:review so past solutions from docs/solutions/ are surfaced during code review - Make /release-docs command invocable (remove disable-model-invocation) - Fix stale counts across docs site (agents 28→29, commands 19→24, skills 15→18, MCP servers 2→1) - Bump version to 2.32.1 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Move /release-docs to local .claude/commands/, bump to 2.32.2 Repo maintenance command doesn't need to be distributed to plugin users. Update command count 24 → 23 across plugin.json, marketplace.json, and docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Move settings to project root: compound-engineering.local.md Tool-agnostic location — works for Claude, Codex, OpenCode without path rewriting. No global fallback, just project root. Update commands (setup, review, work) and converter tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Make /compound-engineering-setup interactive with auto-detect fast path Two paths: "Auto-configure" (one click, smart defaults) or "Customize" (pick stack, focus areas, review depth). Uses AskUserQuestion throughout. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Replace /compound-engineering-setup command with setup skill Setup is now a skill invoked on-demand when compound-engineering.local.md doesn't exist. Review and work commands just say "invoke the setup skill" instead of inlining the full setup flow. - Remove commands/setup.md (command) - Add skills/setup/SKILL.md (skill with interactive AskUserQuestion flow) - Simplify review.md and work.md to reference the skill - Counts: 29 agents, 22 commands, 19 skills Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Prepare v2.33.0 release: setup skill, configurable review agents - Bump version to 2.33.0 - Consolidate CHANGELOG entries for this branch - Fix README: update counts (29/22/19), add setup + resolve-pr-parallel skills - Remove stale /compound-engineering-setup command reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
248 lines
8.3 KiB
TypeScript
248 lines
8.3 KiB
TypeScript
import { describe, expect, test } from "bun:test"
|
|
import path from "path"
|
|
import { loadClaudePlugin } from "../src/parsers/claude"
|
|
import { convertClaudeToOpenCode } from "../src/converters/claude-to-opencode"
|
|
import { parseFrontmatter } from "../src/utils/frontmatter"
|
|
import type { ClaudePlugin } from "../src/types/claude"
|
|
|
|
const fixtureRoot = path.join(import.meta.dir, "fixtures", "sample-plugin")
|
|
|
|
describe("convertClaudeToOpenCode", () => {
|
|
test("maps commands, permissions, and agents", async () => {
|
|
const plugin = await loadClaudePlugin(fixtureRoot)
|
|
const bundle = convertClaudeToOpenCode(plugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "from-commands",
|
|
})
|
|
|
|
expect(bundle.config.command?.["workflows:review"]).toBeDefined()
|
|
expect(bundle.config.command?.["plan_review"]).toBeDefined()
|
|
|
|
const permission = bundle.config.permission as Record<string, string | Record<string, string>>
|
|
expect(Object.keys(permission).sort()).toEqual([
|
|
"bash",
|
|
"edit",
|
|
"glob",
|
|
"grep",
|
|
"list",
|
|
"patch",
|
|
"question",
|
|
"read",
|
|
"skill",
|
|
"task",
|
|
"todoread",
|
|
"todowrite",
|
|
"webfetch",
|
|
"write",
|
|
])
|
|
expect(permission.edit).toBe("allow")
|
|
expect(permission.write).toBe("allow")
|
|
const bashPermission = permission.bash as Record<string, string>
|
|
expect(bashPermission["ls *"]).toBe("allow")
|
|
expect(bashPermission["git *"]).toBe("allow")
|
|
expect(permission.webfetch).toBe("allow")
|
|
|
|
const readPermission = permission.read as Record<string, string>
|
|
expect(readPermission["*"]).toBe("deny")
|
|
expect(readPermission[".env"]).toBe("allow")
|
|
|
|
expect(permission.question).toBe("allow")
|
|
expect(permission.todowrite).toBe("allow")
|
|
expect(permission.todoread).toBe("allow")
|
|
|
|
const agentFile = bundle.agents.find((agent) => agent.name === "repo-research-analyst")
|
|
expect(agentFile).toBeDefined()
|
|
const parsed = parseFrontmatter(agentFile!.content)
|
|
expect(parsed.data.mode).toBe("subagent")
|
|
})
|
|
|
|
test("normalizes models and infers temperature", async () => {
|
|
const plugin = await loadClaudePlugin(fixtureRoot)
|
|
const bundle = convertClaudeToOpenCode(plugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: true,
|
|
permissions: "none",
|
|
})
|
|
|
|
const securityAgent = bundle.agents.find((agent) => agent.name === "security-sentinel")
|
|
expect(securityAgent).toBeDefined()
|
|
const parsed = parseFrontmatter(securityAgent!.content)
|
|
expect(parsed.data.model).toBe("anthropic/claude-sonnet-4-20250514")
|
|
expect(parsed.data.temperature).toBe(0.1)
|
|
|
|
const modelCommand = bundle.config.command?.["workflows:work"]
|
|
expect(modelCommand?.model).toBe("openai/gpt-4o")
|
|
})
|
|
|
|
test("converts hooks into plugin file", async () => {
|
|
const plugin = await loadClaudePlugin(fixtureRoot)
|
|
const bundle = convertClaudeToOpenCode(plugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "none",
|
|
})
|
|
|
|
const hookFile = bundle.plugins.find((file) => file.name === "converted-hooks.ts")
|
|
expect(hookFile).toBeDefined()
|
|
expect(hookFile!.content).toContain("\"tool.execute.before\"")
|
|
expect(hookFile!.content).toContain("\"tool.execute.after\"")
|
|
expect(hookFile!.content).toContain("\"session.created\"")
|
|
expect(hookFile!.content).toContain("\"session.deleted\"")
|
|
expect(hookFile!.content).toContain("\"session.idle\"")
|
|
expect(hookFile!.content).toContain("\"experimental.session.compacting\"")
|
|
expect(hookFile!.content).toContain("\"permission.requested\"")
|
|
expect(hookFile!.content).toContain("\"permission.replied\"")
|
|
expect(hookFile!.content).toContain("\"message.created\"")
|
|
expect(hookFile!.content).toContain("\"message.updated\"")
|
|
expect(hookFile!.content).toContain("echo before")
|
|
expect(hookFile!.content).toContain("echo before two")
|
|
expect(hookFile!.content).toContain("// timeout: 30s")
|
|
expect(hookFile!.content).toContain("// Prompt hook for Write|Edit")
|
|
expect(hookFile!.content).toContain("// Agent hook for Write|Edit: security-sentinel")
|
|
})
|
|
|
|
test("converts MCP servers", async () => {
|
|
const plugin = await loadClaudePlugin(fixtureRoot)
|
|
const bundle = convertClaudeToOpenCode(plugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "none",
|
|
})
|
|
|
|
const mcp = bundle.config.mcp ?? {}
|
|
expect(mcp["local-tooling"]).toEqual({
|
|
type: "local",
|
|
command: ["echo", "fixture"],
|
|
environment: undefined,
|
|
enabled: true,
|
|
})
|
|
expect(mcp.context7).toEqual({
|
|
type: "remote",
|
|
url: "https://mcp.context7.com/mcp",
|
|
headers: undefined,
|
|
enabled: true,
|
|
})
|
|
})
|
|
|
|
test("permission modes set expected keys", async () => {
|
|
const plugin = await loadClaudePlugin(fixtureRoot)
|
|
const noneBundle = convertClaudeToOpenCode(plugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "none",
|
|
})
|
|
expect(noneBundle.config.permission).toBeUndefined()
|
|
|
|
const broadBundle = convertClaudeToOpenCode(plugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "broad",
|
|
})
|
|
expect(broadBundle.config.permission).toEqual({
|
|
read: "allow",
|
|
write: "allow",
|
|
edit: "allow",
|
|
bash: "allow",
|
|
grep: "allow",
|
|
glob: "allow",
|
|
list: "allow",
|
|
webfetch: "allow",
|
|
skill: "allow",
|
|
patch: "allow",
|
|
task: "allow",
|
|
question: "allow",
|
|
todowrite: "allow",
|
|
todoread: "allow",
|
|
})
|
|
})
|
|
|
|
test("supports primary agent mode", async () => {
|
|
const plugin = await loadClaudePlugin(fixtureRoot)
|
|
const bundle = convertClaudeToOpenCode(plugin, {
|
|
agentMode: "primary",
|
|
inferTemperature: false,
|
|
permissions: "none",
|
|
})
|
|
|
|
const agentFile = bundle.agents.find((agent) => agent.name === "repo-research-analyst")
|
|
const parsed = parseFrontmatter(agentFile!.content)
|
|
expect(parsed.data.mode).toBe("primary")
|
|
})
|
|
|
|
test("excludes commands with disable-model-invocation from command map", async () => {
|
|
const plugin = await loadClaudePlugin(fixtureRoot)
|
|
const bundle = convertClaudeToOpenCode(plugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "none",
|
|
})
|
|
|
|
// deploy-docs has disable-model-invocation: true, should be excluded
|
|
expect(bundle.config.command?.["deploy-docs"]).toBeUndefined()
|
|
|
|
// Normal commands should still be present
|
|
expect(bundle.config.command?.["workflows:review"]).toBeDefined()
|
|
})
|
|
|
|
test("rewrites .claude/ paths to .opencode/ in command bodies", () => {
|
|
const plugin: ClaudePlugin = {
|
|
root: "/tmp/plugin",
|
|
manifest: { name: "fixture", version: "1.0.0" },
|
|
agents: [],
|
|
commands: [
|
|
{
|
|
name: "review",
|
|
description: "Review command",
|
|
body: `Read \`compound-engineering.local.md\` in the project root.
|
|
|
|
If no settings file exists, auto-detect project type.
|
|
|
|
Run \`/compound-engineering-setup\` to create a settings file.`,
|
|
sourcePath: "/tmp/plugin/commands/review.md",
|
|
},
|
|
],
|
|
skills: [],
|
|
}
|
|
|
|
const bundle = convertClaudeToOpenCode(plugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "none",
|
|
})
|
|
|
|
const template = bundle.config.command?.["review"]?.template ?? ""
|
|
|
|
// Tool-agnostic path in project root — no rewriting needed
|
|
expect(template).toContain("compound-engineering.local.md")
|
|
})
|
|
|
|
test("rewrites .claude/ paths in agent bodies", () => {
|
|
const plugin: ClaudePlugin = {
|
|
root: "/tmp/plugin",
|
|
manifest: { name: "fixture", version: "1.0.0" },
|
|
agents: [
|
|
{
|
|
name: "test-agent",
|
|
description: "Test agent",
|
|
body: "Read `compound-engineering.local.md` for config.",
|
|
sourcePath: "/tmp/plugin/agents/test-agent.md",
|
|
},
|
|
],
|
|
commands: [],
|
|
skills: [],
|
|
}
|
|
|
|
const bundle = convertClaudeToOpenCode(plugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "none",
|
|
})
|
|
|
|
const agentFile = bundle.agents.find((a) => a.name === "test-agent")
|
|
expect(agentFile).toBeDefined()
|
|
// Tool-agnostic path in project root — no rewriting needed
|
|
expect(agentFile!.content).toContain("compound-engineering.local.md")
|
|
})
|
|
})
|