io-boundary.test.ts 954 B

12345678910111213141516171819202122232425
  1. import { readFile } from "node:fs/promises";
  2. import { join } from "node:path";
  3. import { describe, expect, it } from "vitest";
  4. const repoRoot = join(import.meta.dirname, "..", "..", "..");
  5. describe("core I/O boundaries", () => {
  6. it("keeps file tools and context assembly free of direct host I/O", async () => {
  7. const files = [
  8. "packages/core/src/runtime.ts",
  9. "packages/core/src/context/sections/request-user-context.ts",
  10. "packages/core/src/tool/handlers/read.ts",
  11. "packages/core/src/tool/handlers/write.ts",
  12. "packages/core/src/tool/handlers/edit.ts",
  13. "packages/core/src/tool/handlers/skill.ts",
  14. ];
  15. for (const file of files) {
  16. const content = await readFile(join(repoRoot, file), "utf8");
  17. expect(content, file).not.toMatch(
  18. /from\s+["'](?:node:fs|node:fs\/promises|fs\/promises)["']/,
  19. );
  20. expect(content, file).not.toMatch(/process\.(?:cwd|env|platform)/);
  21. }
  22. });
  23. });