chore: 规范化 DOCX 发布门禁产出目录并新增清理脚本

问题修复:verify-docx-release-gate-suite.mjs 默认输出目录此前写死为
output/docx-release-gate-v0.6.2,版本升级后需要手工改字符串。改为从根
package.json 动态读取版本号,生成 output/docx-release-gate/v<version>/,
环境变量 MD_TO_PDF_RELEASE_GATE_OUTPUT_DIR 覆盖行为不变。

新增能力:新增 npm run clean:docx-gate-output,清理新目录结构及历史遗留的
output/docx-release-gate-v* 旧命名目录。

验证结果:test:docx-release-gate-suites、test:docx-real-world-corpus 通过;
本机手工构造新旧两种命名目录验证清理脚本均能正确删除且不误删其他 output
子目录。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K5N6pcbjV4jVfXrcH3NcLP
This commit is contained in:
SkyJourney
2026-08-26 20:05:00 +08:00
co-authored by Claude Sonnet 5
parent c4df499680
commit 7533226366
3 changed files with 33 additions and 1 deletions
+4 -1
View File
@@ -16,10 +16,13 @@ import {
const execFileAsync = promisify(execFile);
const repositoryDirectory = path.resolve(import.meta.dirname, "..");
const matrixScript = path.join(repositoryDirectory, "scripts", "verify-docx-layout-visual-matrix.mjs");
const repositoryVersion = JSON.parse(
fs.readFileSync(path.join(repositoryDirectory, "package.json"), "utf8")
).version;
const outputRoot = path.resolve(
repositoryDirectory,
process.env.MD_TO_PDF_RELEASE_GATE_OUTPUT_DIR?.trim() ||
"output/docx-release-gate-v0.6.2"
path.join("output", "docx-release-gate", `v${repositoryVersion}`)
);
const requestedSuiteId = process.env.MD_TO_PDF_RELEASE_GATE_SUITE?.trim() || "next";
const selectedCaseId = process.env.MD_TO_PDF_RELEASE_GATE_CASE?.trim() || undefined;