feat: improve github issue lifecycle cli

This commit is contained in:
Codex
2026-06-02 02:17:10 +00:00
parent 8be605aac3
commit db8b1b64af
4 changed files with 385 additions and 45 deletions
+3 -2
View File
@@ -80,7 +80,7 @@ function shouldSuppressStack(prefix: string): boolean {
function renderEnvelope<T>(command: string, envelope: JsonEnvelope<T>): string {
const fullText = `${JSON.stringify(envelope, null, 2)}\n`;
if (!shouldDumpLargeOutput(command, fullText)) return fullText;
if (!shouldDumpLargeOutput(command, fullText, envelope)) return fullText;
const dump = dumpLargeOutput(command, fullText);
const compactPayload = {
@@ -96,9 +96,10 @@ function renderEnvelope<T>(command: string, envelope: JsonEnvelope<T>): string {
return `${JSON.stringify(compactEnvelope, null, 2)}\n`;
}
function shouldDumpLargeOutput(command: string, text: string): boolean {
function shouldDumpLargeOutput(command: string, text: string, envelope: JsonEnvelope<unknown>): boolean {
if (!(command === "gh" || command.startsWith("gh "))) return false;
if (process.env.UNIDESK_CLI_GH_OUTPUT_DUMP_DISABLED === "1") return false;
if (typeof envelope.data === "object" && envelope.data !== null && (envelope.data as { noDump?: unknown }).noDump === true) return false;
const threshold = configuredDumpThresholdBytes();
return Buffer.byteLength(text, "utf8") > threshold;
}