style(coding-agent): reuse fs namespace in HTML export

This commit is contained in:
usr-bin-roygbiv
2026-07-27 01:22:17 +00:00
parent f0ebf3463a
commit bf04d8207d
2 changed files with 6 additions and 5 deletions
@@ -1,5 +1,4 @@
import * as fs from "node:fs";
import * as fsPromises from "node:fs/promises";
import * as path from "node:path";
import type { AgentState } from "@oh-my-pi/pi-agent-core";
import { APP_NAME, isEnoent } from "@oh-my-pi/pi-utils";
@@ -210,7 +209,7 @@ async function collectSubSessionsFromDir(
): Promise<void> {
let names: string[];
try {
names = await fsPromises.readdir(dir);
names = await fs.promises.readdir(dir);
} catch (err) {
if (isEnoent(err)) return;
throw err;
@@ -160,9 +160,11 @@ describe("HTML export template", () => {
]);
expect(exitCode, stderr).toBe(0);
const [packResult] = JSON.parse(stdout) as NpmPackResult[];
const packedAssets = packResult!.files.map(file => file.path).filter(filePath =>
/^dist\/(?:template-[^.]+\.(?:css|html|js)|tool-views\.generated-[^.]+\.js)$/.test(filePath),
);
const packedAssets = packResult!.files
.map(file => file.path)
.filter(filePath =>
/^dist\/(?:template-[^.]+\.(?:css|html|js)|tool-views\.generated-[^.]+\.js)$/.test(filePath),
);
expect(packedAssets).toHaveLength(4);
expect(packedAssets.filter(filePath => /^dist\/template-[^.]+\.css$/.test(filePath))).toHaveLength(1);
expect(packedAssets.filter(filePath => /^dist\/template-[^.]+\.html$/.test(filePath))).toHaveLength(1);