Skip to main content
// List files with metadata from the default branch
const 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 commit
const 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 namespace
const ephemeralMetadata = await repo.listFilesWithMetadata({
  ref: "feature/demo-work",
  ephemeral: true,
});
console.log(`Ephemeral files:`, ephemeralMetadata.files.length);

Options

ref
string
Branch name or commit SHA. Defaults to the default branch.
ephemeral
boolean
When true, resolves the ref under the ephemeral namespace.
ttl
number
Time-to-live in seconds for the JWT used in the request.

Response

files
array
One entry per file in the tree at the resolved ref.
commits
object
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.
ref
string
The ref the server resolved and used, regardless of what was passed in options.