phase-markers.ts 787 B

12345678910111213141516171819
  1. // Phase markers erase: the sandbox has no `phase` binding to call, so every marker must
  2. // lower to `void 0` — a leftover free identifier is a run-time ReferenceError. The markers
  3. // here stand in every position that survives to the sandbox: script top, inside a block,
  4. // and right before the return. Comments survive lowering, so this one deliberately avoids
  5. // spelling the marker as a call: the suite greps the lowered text for one.
  6. phase("preflight");
  7. const paths = await files.glob("src/**/*.ts");
  8. const reviewer = agent("reviewer");
  9. if (paths.length > 0) {
  10. phase("review");
  11. const first = paths[0] ?? "src/index.ts";
  12. const verdict = await reviewer.ask<string>(`Review ${first}`);
  13. report({ first, verdict });
  14. log("reviewed");
  15. }
  16. phase("wrap-up");
  17. return paths.length;