Remove repo reports and add recurrence guard
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
import { writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
import {
|
||||
buildReport,
|
||||
@@ -8,6 +7,7 @@ import {
|
||||
renderMarkdown,
|
||||
repoRoot
|
||||
} from "./src/dev-evidence-blocker-aggregator.mjs";
|
||||
import { ensureNotRepoReportsPath, tempReportPath } from "./src/report-paths.mjs";
|
||||
|
||||
function hasFlag(name) {
|
||||
return process.argv.includes(name);
|
||||
@@ -15,11 +15,17 @@ function hasFlag(name) {
|
||||
|
||||
try {
|
||||
const report = await buildReport();
|
||||
const wroteReports = hasFlag("--write-report");
|
||||
const reportFlagIndex = process.argv.indexOf("--report");
|
||||
const markdownFlagIndex = process.argv.indexOf("--markdown-report");
|
||||
const wroteReports = reportFlagIndex !== -1 || markdownFlagIndex !== -1;
|
||||
const jsonPath = reportFlagIndex !== -1
|
||||
? ensureNotRepoReportsPath(repoRoot, process.argv[reportFlagIndex + 1], "--report")
|
||||
: ensureNotRepoReportsPath(repoRoot, tempReportPath("dev-m5-gate-aggregator-v2.json"), "--report");
|
||||
const markdownPath = markdownFlagIndex !== -1
|
||||
? ensureNotRepoReportsPath(repoRoot, process.argv[markdownFlagIndex + 1], "--markdown-report")
|
||||
: ensureNotRepoReportsPath(repoRoot, tempReportPath("dev-m5-gate-aggregator-v2.md"), "--markdown-report");
|
||||
|
||||
if (wroteReports) {
|
||||
const jsonPath = path.join(repoRoot, "reports/dev-gate/dev-m5-gate-aggregator-v2.json");
|
||||
const markdownPath = path.join(repoRoot, "reports/dev-gate/dev-m5-gate-aggregator-v2.md");
|
||||
await writeFile(jsonPath, `${JSON.stringify(report, null, 2)}\n`);
|
||||
await writeFile(markdownPath, renderMarkdown(report));
|
||||
}
|
||||
@@ -32,8 +38,8 @@ try {
|
||||
process.stdout.write(`${JSON.stringify({
|
||||
...formatCheckSummary(report),
|
||||
wrote: [
|
||||
"reports/dev-gate/dev-m5-gate-aggregator-v2.json",
|
||||
"reports/dev-gate/dev-m5-gate-aggregator-v2.md"
|
||||
jsonPath,
|
||||
markdownPath
|
||||
]
|
||||
})}\n`);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user