feat(coding-agent/modes): added debug transcript export command to dump visible TUI conversation
- Added transcript export option to debug menu that writes visible TUI conversation to a temporary text file. - Implemented handleDebugTranscriptCommand in CommandController to render chat messages, strip ANSI codes, and write to temp directory. - Updated InteractiveModeContext interface and InteractiveMode to expose the new debug transcript command handler.
This commit is contained in:
@@ -28,6 +28,7 @@ import type { AuthStorage } from "../../session/auth-storage";
|
||||
import { createCompactionSummaryMessage } from "../../session/messages";
|
||||
import { outputMeta } from "../../tools/output-meta";
|
||||
import { resolveToCwd } from "../../tools/path-utils";
|
||||
import { replaceTabs } from "../../tools/render-utils";
|
||||
import { getChangelogPath, parseChangelog } from "../../utils/changelog";
|
||||
import { openPath } from "../../utils/open";
|
||||
|
||||
@@ -70,6 +71,25 @@ export class CommandController {
|
||||
}
|
||||
}
|
||||
|
||||
async handleDebugTranscriptCommand(): Promise<void> {
|
||||
try {
|
||||
const width = Math.max(1, this.ctx.ui.terminal.columns);
|
||||
const renderedLines = this.ctx.chatContainer.render(width).map(line => replaceTabs(Bun.stripANSI(line)));
|
||||
const rendered = renderedLines.join("\n").trimEnd();
|
||||
if (!rendered) {
|
||||
this.ctx.showError("No messages to dump yet.");
|
||||
return;
|
||||
}
|
||||
const tmpPath = path.join(os.tmpdir(), `${Snowflake.next()}-tmp.txt`);
|
||||
await Bun.write(tmpPath, `${rendered}\n`);
|
||||
this.ctx.showStatus(`Debug transcript written to:\n${tmpPath}`);
|
||||
} catch (error: unknown) {
|
||||
this.ctx.showError(
|
||||
`Failed to write debug transcript: ${error instanceof Error ? error.message : "Unknown error"}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async handleShareCommand(): Promise<void> {
|
||||
const tmpFile = path.join(os.tmpdir(), `${Snowflake.next()}.html`);
|
||||
const cleanupTempFile = async () => {
|
||||
|
||||
Reference in New Issue
Block a user