git-log-vs-log.ts 918 B

123456789101112131415161718192021
  1. // git.log vs the top-level log(): the collision the world-read registry exists for.
  2. // Both spellings appear here, both are legal, and they must resolve to different things —
  3. // `git.log(5)` is a world-read site, `log("...")` is progress chatter with no site.
  4. const commits = await git.log(5);
  5. log(`scanning ${commits.length} commits`);
  6. const changed = await git.changedFiles();
  7. const status = await git.status();
  8. log(`branch ${status.branch ?? "(detached)"}, clean=${status.clean}`);
  9. const diff = await git.diff("HEAD", changed[0] ?? "package.json");
  10. const hits = await files.grep("TODO", "*.ts");
  11. const reviewer = agent("reviewer");
  12. const verdict = await reviewer.ask<string>(
  13. `Commits: ${commits.map((c) => c.subject).join("; ")}\n` +
  14. `Untracked: ${status.untracked.length}\n` +
  15. `Diff bytes: ${diff.length}\n` +
  16. `First TODO: ${hits[0]?.path ?? "none"}:${hits[0]?.line ?? 0}`,
  17. );
  18. return verdict;