Spot the bug in context collection

from Agent context management
Node 24 intermediate 6 min 3 issues to find

Find the context-selection failures in this generated collector.

JavaScript
const files = [
  { path: ".env", text: "TOKEN=demo-secret" },
  { path: "dist/app.js", text: "generated bundle" },
  { path: "src/cart.js", text: "export function total() {}" },
];

function buildContext(entries) {
  return entries
    .map((file) => `## ${file.path}\n${file.text}`)
    .join("\n\n");
}

console.log(buildContext(files));
Open in playground
Report an error