phase-scope-block.ts 1.1 KB

1234567891011121314151617181920212223242526
  1. // Rest-of-block scope, all three of its edges at once: a marker inside an if-block does
  2. // not leak past the block, a marker at a block's tail claims nothing, and the enclosing
  3. // phase resumes the moment the inner block ends.
  4. phase("survey");
  5. const paths = await files.glob("src/**/*.ts");
  6. const auditor = agent("auditor");
  7. const scribe = agent("scribe");
  8. if (paths.length > 0) {
  9. phase("audit");
  10. const body = await files.read(paths[0] ?? "src/index.ts");
  11. const verdict = await auditor.ask<string>(`Audit:\n${body}`);
  12. report({ verdict });
  13. // Last statement of its block, so it claims nothing: legal, harmless, undiagnosed. It
  14. // still MINTS phase#3 (first reach numbers the ids), and the projection then drops it
  15. // for having no members — which is why the phase list below jumps to phase#4.
  16. phase("dead-tail");
  17. }
  18. // `survey` is current again here: this read belongs to it, not to `audit`.
  19. const readme = await files.read("README.md");
  20. phase("wrap");
  21. const summary = await scribe.ask<string>(`Summarize ${paths.length} files:\n${readme}`);
  22. return summary;