How the `--also` Flag Enables Multi-Target Plugin Conversion in Compound Engineering Plugin

The --also flag allows the compound-engineering-plugin CLI to convert a Claude Code plugin to multiple target platforms in a single command by parsing comma-separated target names and running the conversion pipeline for each additional target after the primary conversion completes.

The compound-engineering-plugin repository provides a CLI tool that transforms Claude Code plugins into formats compatible with other AI coding agents. While the --to flag specifies the primary conversion target, multi-target plugin conversion requires the --also flag to generate additional output bundles without running separate commands.

Parsing the --also Flag

When you append --also codex,pi to a conversion command, the CLI hands the raw string value to parseExtraTargets in src/commands/convert.ts (lines 27-33). This utility function splits the comma-separated input into an array of clean target names, trimming whitespace and filtering empty values.

The parsed array feeds directly into the main conversion loop, ensuring each extra target receives the same treatment as the primary target specified by --to.

Iterating Over Extra Targets

After the primary conversion finishes, the CLI iterates over the array of extra targets produced by parseExtraTargets. This loop (lines 99-103 in src/commands/convert.ts) treats every entry as a first-class conversion pipeline.

Target Registry Lookup

For each extra target, the CLI looks up the handler in the central targets registry exported from src/targets/index.ts (lines 28-65). This registry maps target names to their convert and write implementations. If a target name does not exist in the registry, the CLI skips it with a warning message (lines 104-110) and continues processing valid targets.

Conversion and Writing

Valid targets trigger the same convert function used for the primary target, passing the identical plugin object and conversion options (lines 111-113). This ensures consistent behavior across all outputs. The CLI then determines the correct output directory for that specific target via resolveTargetOutputRoot (lines 116-119), which knows special root paths for platforms like Codex and Pi.

Finally, the target's write implementation serializes the generated bundle to disk (lines 120-121), and the CLI logs the successful conversion path.

Unified Configuration Across Targets

All targets—primary and secondary—share the same conversion options defined in the options object (lines 84-88 in src/commands/convert.ts). This includes agent mode settings, temperature inference parameters, and permission mapping configurations. Because the --also flag reuses these options for every target, you guarantee consistent plugin behavior across different AI agent platforms without duplicating configuration flags.

Post-Conversion Housekeeping

If any processed target—including those specified via --also—includes codex, the CLI performs additional cleanup. It invokes ensureCodexAgentsFile (lines 121-123) to verify that the Codex agents configuration file exists and contains valid entries. This housekeeping step ensures that multi-target conversions involving Codex remain compatible with the Codex CLI tooling.

Practical Usage Examples

Convert a Claude plugin to OpenCode as the primary target while also generating Codex and Pi outputs:

compound-engineering-plugin convert ./my-claude-plugin \
  --to opencode \
  --also codex,pi \
  --output ./generated

Use Gemini as the non-default primary target while producing Cursor and Droid bundles simultaneously:

compound-engineering-plugin convert ./my-claude-plugin \
  --to gemini \
  --also cursor,droid \
  --output ./out

In both examples, the CLI executes loadClaudePlugin, runs the primary conversion, parses --also, resolves each extra target through the registry, and writes all bundles to their respective output roots.

Summary

  • The --also flag accepts comma-separated target names parsed by parseExtraTargets in src/commands/convert.ts.
  • Each extra target undergoes the same conversion pipeline as the primary target, using the shared targets registry from src/targets/index.ts.
  • The CLI reuses conversion options (agent mode, temperature, permissions) across all targets to ensure consistency.
  • Unknown targets trigger warnings and are skipped without halting the conversion process.
  • Post-conversion steps like ensureCodexAgentsFile run if Codex is included in the target list.

Frequently Asked Questions

What happens if I specify an invalid target with --also?

The CLI looks up each target name in the central registry defined in src/targets/index.ts. If a target does not exist, the code at lines 104-110 in src/commands/convert.ts logs a warning message and skips that specific target, continuing to process any valid remaining targets.

Do all targets generated with --also use the same configuration options?

Yes. The conversion options—including agent mode, temperature inference settings, and permission mappings—are defined once in the options object (lines 84-88 in src/commands/convert.ts) and passed to every target conversion, ensuring consistent behavior across the primary and all secondary outputs.

Can I use --also without specifying a primary --to target?

No. The --to flag defines the primary conversion target and is required for the command to execute. The --also flag only supplements this primary target with additional conversions. If you omit --to, the CLI will error before reaching the multi-target logic in src/commands/convert.ts.

How does the CLI determine where to write files for each --also target?

For each extra target, the CLI calls resolveTargetOutputRoot (lines 116-119 in src/commands/convert.ts), which calculates the output directory based on the target type and any special root paths (such as --codex-home or --pi-home). The target's specific write implementation then serializes the bundle to that location.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →