Skip to content

[BUG] apm compile --targets with multi-target list generates GEMINI.md even when Gemini is not a requested target #1019

@tillig

Description

@tillig

Describe the bug

When using apm compile --targets with a comma-delimited list that spans multiple compiler families (e.g., claude,codex), the compile command incorrectly generates GEMINI.md even though Gemini was not included in the target list. This happens because _resolve_compile_target() in src/apm_cli/commands/compile/cli.py collapses any multi-family combination into "all", and "all" unconditionally triggers generation of all output files including GEMINI.md.

To Reproduce

  1. Run apm compile --targets claude,codex
  2. Observe that GEMINI.md is generated in the output
  3. The same occurs with any cross-family combination that does not include gemini, e.g., --targets claude,cursor

Expected behavior
Only CLAUDE.md and AGENTS.md should be generated when --targets claude,codex is specified. GEMINI.md should only be generated when the target list explicitly includes gemini, or when --targets all is used.

Environment (please complete the following information):

  • OS: macOS 26.4.1
  • Python Version: 3.14.4
  • APM Version: 0.10.0

Logs
N/A

Additional context
The root cause is in _resolve_compile_target() (src/apm_cli/commands/compile/cli.py, lines 166–198). When the target is a list, it groups targets into three families (has_agents_family, has_claude, has_gemini) and counts distinct families. If distinct >= 2, it returns "all". Downstream, should_compile_gemini_md() (src/apm_cli/core/target_detection.py, line 162) returns True for "all", so GEMINI.md is always generated.

The issue is that "all" is overloaded — it means both "the user explicitly requested all targets" and "the user requested targets from more than one compiler family." There is no way to represent "claude + agents-family but not gemini" in the current scheme.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething does not work as documented.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions