apm find
Reverse-lookup: given a file path on disk, apm find reports which package(s) in apm.lock.yaml deployed it.
Synopsis
Section titled “Synopsis”apm find <PATH> [OPTIONS]PATH is the path to the deployed file you want to trace (relative path from the project root).
Description
Section titled “Description”apm find reads apm.lock.yaml, builds a reverse index from every package’s deployed_files list, and prints the name of every package that claims the file. It is the inverse of apm install: instead of asking “what does this package deploy?”, you are asking “what package deployed this file?”
The command is read-only. It performs zero network requests, zero auth calls, and zero file writes. It never modifies apm.lock.yaml or any deployed file.
When multiple packages deployed the same file (common for shared harness files such as AGENTS.md or CLAUDE.md written by several contributors), apm find lists all of them, one per line.
Options
Section titled “Options”| Flag | Default | Description |
|---|---|---|
--source |
off | After each package name, print the origin of that package on the same line: the OCI image URI, the local path, or the package with its locked ref, tag, or short commit (owner/repo@ref). |
--path |
off | After each package name, print the full dependency chain from that package up to the root (same output as apm deps why). |
Examples
Section titled “Examples”Basic lookup
Section titled “Basic lookup”apm find .github/copilot-instructions.mdOutput (file found in one package):
owner/repoShow origin source
Section titled “Show origin source”apm find .github/copilot-instructions.md --sourceOutput:
owner/repo owner/repo@v1.0.0Show full dependency chain
Section titled “Show full dependency chain”apm find .github/copilot-instructions.md --pathOutput:
owner/repo apm.yml -> owner/repoMulti-contributor file (AGENTS.md / CLAUDE.md)
Section titled “Multi-contributor file (AGENTS.md / CLAUDE.md)”Shared harness files can be contributed by more than one package. All contributors are listed:
apm find AGENTS.mdOutput:
owner/repo-aowner/repo-bCombine with --source to see where each contributor came from:
apm find AGENTS.md --sourceOutput:
owner/repo-a owner/repo-a@mainowner/repo-b oci://ghcr.io/owner/repo-b:v1.2.0Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 |
File found in at least one package’s deployed_files. |
1 |
File not found in any package’s deployed_files. |
2 |
Lockfile is missing or cannot be read. |
Error messages are written to stderr with a [x] prefix. Package names are written to stdout, one per line.
Related
Section titled “Related”apm deps why– explain why a package is installed (the--pathoutput uses the same walker).apm view --file– exact-path owners from deployment records, with active writer, ref, commit and current file status.apm install– installs packages and writesapm.lock.yaml.- Lockfile spec – the
deployed_filesfield thatapm findreads.
Copyright (c) Microsoft Corporation. General documentation: CC-BY-4.0. Software, code examples and OpenAPM: Apache-2.0. See scope and exclusions.