Reduce script logging suppressions and Feishu any casts

This commit is contained in:
Tak Hoffman
2026-03-27 01:46:34 -05:00
parent f5643544c2
commit 23fae00fad
7 changed files with 135 additions and 149 deletions

View File

@@ -3,6 +3,10 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { homedir } from "node:os";
import { dirname, join } from "node:path";
function writeStdoutLine(message = ""): void {
process.stdout.write(`${message}\n`);
}
const BUG_LABEL = "bug";
const ENHANCEMENT_LABEL = "enhancement";
const SUPPORT_LABEL = "r: support";
@@ -231,25 +235,20 @@ function parseArgs(argv: string[]): ScriptOptions {
}
function logHeader(title: string) {
// eslint-disable-next-line no-console
console.log(`\n${title}`);
// eslint-disable-next-line no-console
console.log("=".repeat(title.length));
writeStdoutLine(`\n${title}`);
writeStdoutLine("=".repeat(title.length));
}
function logStep(message: string) {
// eslint-disable-next-line no-console
console.log(`${message}`);
writeStdoutLine(`${message}`);
}
function logSuccess(message: string) {
// eslint-disable-next-line no-console
console.log(`${message}`);
writeStdoutLine(`${message}`);
}
function logInfo(message: string) {
// eslint-disable-next-line no-console
console.log(` ${message}`);
writeStdoutLine(` ${message}`);
}
function createEmptyState(): LoadedState {
@@ -748,8 +747,7 @@ async function main() {
logInfo(`Processing ${pendingIssues.length} issues (scanned so far: ${scannedCount}).`);
for (const issue of pendingIssues) {
// eslint-disable-next-line no-console
console.log(`\n#${issue.number}${issue.title}`);
writeStdoutLine(`\n#${issue.number}${issue.title}`);
const labels = new Set(issue.labels.map((label) => label.name));
logInfo(`Existing labels: ${Array.from(labels).toSorted().join(", ") || "none"}`);
@@ -824,8 +822,7 @@ async function main() {
);
for (const pullRequest of pendingPullRequests) {
// eslint-disable-next-line no-console
console.log(`\n#${pullRequest.number}${pullRequest.title}`);
writeStdoutLine(`\n#${pullRequest.number}${pullRequest.title}`);
const labels = new Set(pullRequest.labels.map((label) => label.name));
logInfo(`Existing labels: ${Array.from(labels).toSorted().join(", ") || "none"}`);