

























@@ -5,8 +5,8 @@ import path from "node:path";
55import { fileURLToPath, pathToFileURL } from "node:url";
66import { promisify } from "node:util";
77import {
8+CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR,
89createHappyPathPromptSnapshotFiles,
9-HAPPY_PATH_PROMPT_SNAPSHOT_DIR,
1010} from "../test/helpers/agents/happy-path-prompt-snapshots.js";
11111212const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
@@ -40,7 +40,7 @@ async function writeSnapshotFiles(root: string, files: PromptSnapshotFile[]) {
40404141async function formatSnapshotFiles(root: string, files: PromptSnapshotFile[]) {
4242const filePaths = files
43-.filter((file) => file.path.endsWith(".json"))
43+.filter((file) => file.path.endsWith(".md") || file.path.endsWith(".json"))
4444.map((file) => path.resolve(root, file.path));
4545if (filePaths.length === 0) {
4646return;
@@ -62,7 +62,9 @@ async function readSnapshotFiles(root: string, files: PromptSnapshotFile[]) {
6262async function listCommittedSnapshotArtifactPaths(root: string): Promise<string[]> {
6363let committedEntries: string[];
6464try {
65-committedEntries = await fs.readdir(path.resolve(root, HAPPY_PATH_PROMPT_SNAPSHOT_DIR));
65+committedEntries = await fs.readdir(
66+path.resolve(root, CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR),
67+);
6668} catch (error) {
6769if (!hasErrorCode(error, "ENOENT")) {
6870throw error;
@@ -71,7 +73,7 @@ async function listCommittedSnapshotArtifactPaths(root: string): Promise<string[
7173}
7274return committedEntries
7375.filter((entry) => entry.endsWith(".md") || entry.endsWith(".json"))
74-.map((entry) => path.join(HAPPY_PATH_PROMPT_SNAPSHOT_DIR, entry));
76+.map((entry) => path.join(CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR, entry));
7577}
76787779export async function deleteStalePromptSnapshotFiles(
@@ -100,7 +102,9 @@ export async function createFormattedPromptSnapshotFiles(): Promise<PromptSnapsh
100102101103async function writeSnapshots() {
102104const files = await createFormattedPromptSnapshotFiles();
103-await fs.mkdir(path.resolve(repoRoot, HAPPY_PATH_PROMPT_SNAPSHOT_DIR), { recursive: true });
105+await fs.mkdir(path.resolve(repoRoot, CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR), {
106+recursive: true,
107+});
104108const deleted = await deleteStalePromptSnapshotFiles(repoRoot, files);
105109await writeSnapshotFiles(repoRoot, files);
106110const deletedSummary = deleted.length > 0 ? ` Deleted ${deleted.length} stale file(s).` : "";
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。