microsoft / microsoft/apm

[BUG] Claude compilation omits CLAUDE.md from three-level dependencies

Open
#2,951 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/multi-target status/accepted triage/recommended type/bug
Dominant language
Python
Stars
3.8k
Forks
362
Avg merge
1d 17h
Merged PRs (30d)
132

Description

Describe the bug

apm compile --target claude does not import dependency CLAUDE.md files when the dependency is materialized more than two directory levels below apm_modules.

Azure DevOps dependencies use paths such as apm_modules/<org>/<project>/<repo>, but Claude compilation only checks apm_modules/<owner>/<package>/CLAUDE.md.

To Reproduce

Steps to reproduce the behavior:

  1. Install an Azure DevOps dependency that contains a root CLAUDE.md.
  2. Confirm the dependency is materialized at apm_modules/org/project/repo/CLAUDE.md.
  3. Run apm compile --target claude.
  4. Inspect the generated root CLAUDE.md.
  5. Observe that it does not contain @apm_modules/org/project/repo/CLAUDE.md.

A minimal filesystem probe containing both two-level and three-level dependencies returns only:

['@apm_modules/owner/package/CLAUDE.md']

Expected behavior

The generated root CLAUDE.md should include an import for every installed dependency containing a root CLAUDE.md, including:

@apm_modules/org/project/repo/CLAUDE.md

Environment (please complete the following information):

  • OS: Windows
  • Python Version: 3.12.13
  • APM Version: 0.30.0

Logs

No error is reported. The dependency import is silently omitted from the generated root CLAUDE.md.

Additional context

src/apm_cli/compilation/claude_formatter.py method _collect_dependencies scans exactly two directory levels below apm_modules and checks only <owner>/<package>/CLAUDE.md.

src/apm_cli/models/dependency/materialization.py materializes Azure DevOps dependencies at <org>/<project>/<repo> and supports deeper repository paths for other hosts.

Dependency imports should be derived from installed package roots or lockfile/materialization records instead of assuming exactly two path components.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/apm_cli/compilation/claude_formatter.py at _collect_dependencies and compare its two-level scan with the paths produced by src/apm_cli/models/dependency/materialization.py. Reproduce with two-level and three-level installed dependencies, then run the relevant compilation tests or probe. Done means the generated root CLAUDE.md imports every installed dependency root that contains CLAUDE.md, including @apm_modules/org/project/repo/CLAUDE.md.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.