Description
Extend the /export command to support exporting conversation transcripts as structured JSON (/export --json or /export <filename>.json).
Use Case
Currently, /export only writes a Markdown representation (.md). In the Markdown export, tool execution structures, parameter JSON, image attachments, reasoning blocks, and provider token usage snapshots are flattened or omitted. Developers and researchers benchmarking models or evaluating agents often need the complete, unaltered message history in JSON format for replays, evaluations, or test harness integration.
Proposed Solution
- In
source/commands/export.tsx:
- Inspect args for
--json or a filename ending in .json.
- When JSON format is requested, serialize the
Message[] array with session metadata (session date, provider, model, total tokens, session cwd).
- Use atomic write to save the JSON export file.
- Example usage:
/export --json -> exports to nanocoder-chat-YYYY-MM-DD.json
/export benchmark-run.json
Alternatives Considered
Manually locating the internal .nanocoder-sessions storage files, but users often work with unsaved/ephemeral sessions or want to export directly from the active TUI.
Additional Context
Description
Extend the
/exportcommand to support exporting conversation transcripts as structured JSON (/export --jsonor/export <filename>.json).Use Case
Currently,
/exportonly writes a Markdown representation (.md). In the Markdown export, tool execution structures, parameter JSON, image attachments, reasoning blocks, and provider token usage snapshots are flattened or omitted. Developers and researchers benchmarking models or evaluating agents often need the complete, unaltered message history in JSON format for replays, evaluations, or test harness integration.Proposed Solution
source/commands/export.tsx:--jsonor a filename ending in.json.Message[]array with session metadata (session date, provider, model, total tokens, session cwd)./export --json-> exports tonanocoder-chat-YYYY-MM-DD.json/export benchmark-run.jsonAlternatives Considered
Manually locating the internal
.nanocoder-sessionsstorage files, but users often work with unsaved/ephemeral sessions or want to export directly from the active TUI.Additional Context