Describe the bug
apm compile --targets claude generates a # Dependencies section in the root CLAUDE.md that references @apm_modules/{owner}/{package}/CLAUDE.md for every package directory found in apm_modules/ — regardless of whether a CLAUDE.md file actually exists in that directory. Many installed packages won't have one (e.g., skill collections, single-file packages, or packages that only target Copilot/AGENTS.md).
To Reproduce
- Create an
apm.yml with at least one dependency that doesn't ship a CLAUDE.md (e.g., a skill collection or a package that only provides AGENTS.md)
- Run
apm install
- Run
apm compile --targets claude
- Inspect the generated root
CLAUDE.md — the # Dependencies section lists @apm_modules/{owner}/{package}/CLAUDE.md paths that don't exist on disk
Expected behavior
The Dependencies section should only list @import paths for CLAUDE.md files that actually exist in apm_modules/. Packages without a CLAUDE.md should be omitted from the list.
Environment (please complete the following information):
- OS: macOS
- Python Version: 3.12
- APM Version: 0.10.0
Additional context
The root cause is in _collect_dependencies(). The method iterates apm_modules/{owner}/{package}/ directories and constructs import paths without checking whether the target file exists:
for package_dir in owner_dir.iterdir():
if not package_dir.is_dir() or package_dir.name.startswith('.'):
continue
# Build the @import path
import_path = f"@apm_modules/{owner_dir.name}/{package_dir.name}/CLAUDE.md"
dependencies.append(import_path)
The comment on line 223 says "Scan for CLAUDE.md files" — the intent was to find existing files, but the existence check is missing. A fix would be adding if (package_dir / "CLAUDE.md").exists() before appending.
Describe the bug
apm compile --targets claudegenerates a# Dependenciessection in the root CLAUDE.md that references@apm_modules/{owner}/{package}/CLAUDE.mdfor every package directory found inapm_modules/— regardless of whether aCLAUDE.mdfile actually exists in that directory. Many installed packages won't have one (e.g., skill collections, single-file packages, or packages that only target Copilot/AGENTS.md).To Reproduce
apm.ymlwith at least one dependency that doesn't ship aCLAUDE.md(e.g., a skill collection or a package that only provides AGENTS.md)apm installapm compile --targets claudeCLAUDE.md— the# Dependenciessection lists@apm_modules/{owner}/{package}/CLAUDE.mdpaths that don't exist on diskExpected behavior
The Dependencies section should only list
@importpaths for CLAUDE.md files that actually exist inapm_modules/. Packages without a CLAUDE.md should be omitted from the list.Environment (please complete the following information):
Additional context
The root cause is in
_collect_dependencies(). The method iteratesapm_modules/{owner}/{package}/directories and constructs import paths without checking whether the target file exists:The comment on line 223 says "Scan for CLAUDE.md files" — the intent was to find existing files, but the existence check is missing. A fix would be adding
if (package_dir / "CLAUDE.md").exists()before appending.