researching-external-repositories
Researching external repositories
Answer the brief's question from the repository's own source, not from memory. Clone what you need, read it, and report findings the caller can verify from the links and from the local clones you leave behind.
Where to look depends on the question. How it works: the source. How to use it: the docs for that version, and the source when the docs are unclear. Why or when it changed: git log and git blame, then the issues and pull requests the commits mention. A copy inside the workspace, such as node_modules or a vendored directory, tells you the version; read the code in the clone.
Cloning
Run git with shell_command, always with workdir set. Clone every repository you study into its own directory under /tmp/amp-librarian/ named <owner>__<repo> (on Windows, under %TEMP%\amp-librarian\). Reuse the directory when it already exists (test -d "$dir/.git"). For owner/repo or a github.com URL, clone https://github.com/<owner>/<repo>.git; for another host, clone the URL as given. Private repositories the user can reach clone with the environment's git credentials; if a clone is denied, report that instead of guessing at the code.
Clone shallow and blobless so the clone is fast and small:
git clone --depth 1 --filter=blob:none --no-tags --quiet <url> <dir>
Add --branch <ref> when the question names a branch or tag. For a very large repository add --sparse, then git sparse-checkout add <dir>... for the directories you need.
Pin the revision to the one that matters. For a dependency, read the version the local project resolves in its lockfile or manifest and clone that tag; the default branch may differ from what the project runs. State the revision you inspected in the report.