List all files in the repository at a specific ref, with per-file git metadata.
Copy
Ask AI
// List files with metadata from the default branchconst metadata = await repo.listFilesWithMetadata();console.log(metadata.files[0].lastCommitSha);console.log(metadata.commits[metadata.files[0].lastCommitSha].author);// List files with metadata from a specific branch or commitconst branchMetadata = await repo.listFilesWithMetadata({ ref: "feature-branch", // branch name or commit SHA});console.log(`Files in ${branchMetadata.ref}:`, branchMetadata.files.length);// List files from the ephemeral namespaceconst ephemeralMetadata = await repo.listFilesWithMetadata({ ref: "feature/demo-work", ephemeral: true,});console.log(`Ephemeral files:`, ephemeralMetadata.files.length);
SHA of the most recent commit that modified this file. Use this key to look up the corresponding entry in commits.
Python: last_commit_sha — Go: LastCommitSHA
A map of commit SHA → commit metadata. Each SHA referenced by files[].lastCommitSha has exactly one entry here. The map is deduplicated — if many files share the same last-touching commit, that commit appears once.