* 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>
305 lines
9.7 KiB
TypeScript
305 lines
9.7 KiB
TypeScript
import { describe, expect, test } from "bun:test"
|
|
import { convertClaudeToCodex } from "../src/converters/claude-to-codex"
|
|
import { parseFrontmatter } from "../src/utils/frontmatter"
|
|
import type { ClaudePlugin } from "../src/types/claude"
|
|
|
|
const fixturePlugin: ClaudePlugin = {
|
|
root: "/tmp/plugin",
|
|
manifest: { name: "fixture", version: "1.0.0" },
|
|
agents: [
|
|
{
|
|
name: "Security Reviewer",
|
|
description: "Security-focused agent",
|
|
capabilities: ["Threat modeling", "OWASP"],
|
|
model: "claude-sonnet-4-20250514",
|
|
body: "Focus on vulnerabilities.",
|
|
sourcePath: "/tmp/plugin/agents/security-reviewer.md",
|
|
},
|
|
],
|
|
commands: [
|
|
{
|
|
name: "workflows:plan",
|
|
description: "Planning command",
|
|
argumentHint: "[FOCUS]",
|
|
model: "inherit",
|
|
allowedTools: ["Read"],
|
|
body: "Plan the work.",
|
|
sourcePath: "/tmp/plugin/commands/workflows/plan.md",
|
|
},
|
|
],
|
|
skills: [
|
|
{
|
|
name: "existing-skill",
|
|
description: "Existing skill",
|
|
sourceDir: "/tmp/plugin/skills/existing-skill",
|
|
skillPath: "/tmp/plugin/skills/existing-skill/SKILL.md",
|
|
},
|
|
],
|
|
hooks: undefined,
|
|
mcpServers: {
|
|
local: { command: "echo", args: ["hello"] },
|
|
},
|
|
}
|
|
|
|
describe("convertClaudeToCodex", () => {
|
|
test("converts commands to prompts and agents to skills", () => {
|
|
const bundle = convertClaudeToCodex(fixturePlugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "none",
|
|
})
|
|
|
|
expect(bundle.prompts).toHaveLength(1)
|
|
const prompt = bundle.prompts[0]
|
|
expect(prompt.name).toBe("workflows-plan")
|
|
|
|
const parsedPrompt = parseFrontmatter(prompt.content)
|
|
expect(parsedPrompt.data.description).toBe("Planning command")
|
|
expect(parsedPrompt.data["argument-hint"]).toBe("[FOCUS]")
|
|
expect(parsedPrompt.body).toContain("$workflows-plan")
|
|
expect(parsedPrompt.body).toContain("Plan the work.")
|
|
|
|
expect(bundle.skillDirs[0]?.name).toBe("existing-skill")
|
|
expect(bundle.generatedSkills).toHaveLength(2)
|
|
|
|
const commandSkill = bundle.generatedSkills.find((skill) => skill.name === "workflows-plan")
|
|
expect(commandSkill).toBeDefined()
|
|
const parsedCommandSkill = parseFrontmatter(commandSkill!.content)
|
|
expect(parsedCommandSkill.data.name).toBe("workflows-plan")
|
|
expect(parsedCommandSkill.data.description).toBe("Planning command")
|
|
expect(parsedCommandSkill.body).toContain("Allowed tools")
|
|
|
|
const agentSkill = bundle.generatedSkills.find((skill) => skill.name === "security-reviewer")
|
|
expect(agentSkill).toBeDefined()
|
|
const parsedSkill = parseFrontmatter(agentSkill!.content)
|
|
expect(parsedSkill.data.name).toBe("security-reviewer")
|
|
expect(parsedSkill.data.description).toBe("Security-focused agent")
|
|
expect(parsedSkill.body).toContain("Capabilities")
|
|
expect(parsedSkill.body).toContain("Threat modeling")
|
|
})
|
|
|
|
test("passes through MCP servers", () => {
|
|
const bundle = convertClaudeToCodex(fixturePlugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "none",
|
|
})
|
|
|
|
expect(bundle.mcpServers?.local?.command).toBe("echo")
|
|
expect(bundle.mcpServers?.local?.args).toEqual(["hello"])
|
|
})
|
|
|
|
test("transforms Task agent calls to skill references", () => {
|
|
const plugin: ClaudePlugin = {
|
|
...fixturePlugin,
|
|
commands: [
|
|
{
|
|
name: "plan",
|
|
description: "Planning with agents",
|
|
body: `Run these agents in parallel:
|
|
|
|
- Task repo-research-analyst(feature_description)
|
|
- Task learnings-researcher(feature_description)
|
|
|
|
Then consolidate findings.
|
|
|
|
Task best-practices-researcher(topic)`,
|
|
sourcePath: "/tmp/plugin/commands/plan.md",
|
|
},
|
|
],
|
|
agents: [],
|
|
skills: [],
|
|
}
|
|
|
|
const bundle = convertClaudeToCodex(plugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "none",
|
|
})
|
|
|
|
const commandSkill = bundle.generatedSkills.find((s) => s.name === "plan")
|
|
expect(commandSkill).toBeDefined()
|
|
const parsed = parseFrontmatter(commandSkill!.content)
|
|
|
|
// Task calls should be transformed to skill references
|
|
expect(parsed.body).toContain("Use the $repo-research-analyst skill to: feature_description")
|
|
expect(parsed.body).toContain("Use the $learnings-researcher skill to: feature_description")
|
|
expect(parsed.body).toContain("Use the $best-practices-researcher skill to: topic")
|
|
|
|
// Original Task syntax should not remain
|
|
expect(parsed.body).not.toContain("Task repo-research-analyst")
|
|
expect(parsed.body).not.toContain("Task learnings-researcher")
|
|
})
|
|
|
|
test("transforms slash commands to prompts syntax", () => {
|
|
const plugin: ClaudePlugin = {
|
|
...fixturePlugin,
|
|
commands: [
|
|
{
|
|
name: "plan",
|
|
description: "Planning with commands",
|
|
body: `After planning, you can:
|
|
|
|
1. Run /deepen-plan to enhance
|
|
2. Run /plan_review for feedback
|
|
3. Start /workflows:work to implement
|
|
|
|
Don't confuse with file paths like /tmp/output.md or /dev/null.`,
|
|
sourcePath: "/tmp/plugin/commands/plan.md",
|
|
},
|
|
],
|
|
agents: [],
|
|
skills: [],
|
|
}
|
|
|
|
const bundle = convertClaudeToCodex(plugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "none",
|
|
})
|
|
|
|
const commandSkill = bundle.generatedSkills.find((s) => s.name === "plan")
|
|
expect(commandSkill).toBeDefined()
|
|
const parsed = parseFrontmatter(commandSkill!.content)
|
|
|
|
// Slash commands should be transformed to /prompts: syntax
|
|
expect(parsed.body).toContain("/prompts:deepen-plan")
|
|
expect(parsed.body).toContain("/prompts:plan_review")
|
|
expect(parsed.body).toContain("/prompts:workflows-work")
|
|
|
|
// File paths should NOT be transformed
|
|
expect(parsed.body).toContain("/tmp/output.md")
|
|
expect(parsed.body).toContain("/dev/null")
|
|
})
|
|
|
|
test("excludes commands with disable-model-invocation from prompts and skills", () => {
|
|
const plugin: ClaudePlugin = {
|
|
...fixturePlugin,
|
|
commands: [
|
|
{
|
|
name: "normal-command",
|
|
description: "Normal command",
|
|
body: "Normal body.",
|
|
sourcePath: "/tmp/plugin/commands/normal.md",
|
|
},
|
|
{
|
|
name: "disabled-command",
|
|
description: "Disabled command",
|
|
disableModelInvocation: true,
|
|
body: "Disabled body.",
|
|
sourcePath: "/tmp/plugin/commands/disabled.md",
|
|
},
|
|
],
|
|
agents: [],
|
|
skills: [],
|
|
}
|
|
|
|
const bundle = convertClaudeToCodex(plugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "none",
|
|
})
|
|
|
|
// Only normal command should produce a prompt
|
|
expect(bundle.prompts).toHaveLength(1)
|
|
expect(bundle.prompts[0].name).toBe("normal-command")
|
|
|
|
// Only normal command should produce a generated skill
|
|
const commandSkills = bundle.generatedSkills.filter((s) => s.name === "normal-command" || s.name === "disabled-command")
|
|
expect(commandSkills).toHaveLength(1)
|
|
expect(commandSkills[0].name).toBe("normal-command")
|
|
})
|
|
|
|
test("rewrites .claude/ paths to .codex/ in command skill bodies", () => {
|
|
const plugin: ClaudePlugin = {
|
|
...fixturePlugin,
|
|
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",
|
|
},
|
|
],
|
|
agents: [],
|
|
skills: [],
|
|
}
|
|
|
|
const bundle = convertClaudeToCodex(plugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "none",
|
|
})
|
|
|
|
const commandSkill = bundle.generatedSkills.find((s) => s.name === "review")
|
|
expect(commandSkill).toBeDefined()
|
|
const parsed = parseFrontmatter(commandSkill!.content)
|
|
|
|
// Tool-agnostic path in project root — no rewriting needed
|
|
expect(parsed.body).toContain("compound-engineering.local.md")
|
|
})
|
|
|
|
test("rewrites .claude/ paths in agent skill bodies", () => {
|
|
const plugin: ClaudePlugin = {
|
|
...fixturePlugin,
|
|
commands: [],
|
|
skills: [],
|
|
agents: [
|
|
{
|
|
name: "config-reader",
|
|
description: "Reads config",
|
|
body: "Read `compound-engineering.local.md` for config.",
|
|
sourcePath: "/tmp/plugin/agents/config-reader.md",
|
|
},
|
|
],
|
|
}
|
|
|
|
const bundle = convertClaudeToCodex(plugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "none",
|
|
})
|
|
|
|
const agentSkill = bundle.generatedSkills.find((s) => s.name === "config-reader")
|
|
expect(agentSkill).toBeDefined()
|
|
const parsed = parseFrontmatter(agentSkill!.content)
|
|
|
|
// Tool-agnostic path in project root — no rewriting needed
|
|
expect(parsed.body).toContain("compound-engineering.local.md")
|
|
})
|
|
|
|
test("truncates generated skill descriptions to Codex limits and single line", () => {
|
|
const longDescription = `Line one\nLine two ${"a".repeat(2000)}`
|
|
const plugin: ClaudePlugin = {
|
|
...fixturePlugin,
|
|
agents: [
|
|
{
|
|
name: "Long Description Agent",
|
|
description: longDescription,
|
|
body: "Body",
|
|
sourcePath: "/tmp/plugin/agents/long.md",
|
|
},
|
|
],
|
|
commands: [],
|
|
skills: [],
|
|
}
|
|
|
|
const bundle = convertClaudeToCodex(plugin, {
|
|
agentMode: "subagent",
|
|
inferTemperature: false,
|
|
permissions: "none",
|
|
})
|
|
|
|
const generated = bundle.generatedSkills[0]
|
|
const parsed = parseFrontmatter(generated.content)
|
|
const description = String(parsed.data.description ?? "")
|
|
expect(description.length).toBeLessThanOrEqual(1024)
|
|
expect(description).not.toContain("\n")
|
|
expect(description.endsWith("...")).toBe(true)
|
|
})
|
|
})
|