feat(claude): ConversationWriter writes Claude Code session JSONL - #230
Draft
ecalifornica wants to merge 1 commit into
Draft
feat(claude): ConversationWriter writes Claude Code session JSONL#230ecalifornica wants to merge 1 commit into
ecalifornica wants to merge 1 commit into
Conversation
`ConversationWriter::write_conversation<W: Write>(&conv, w)` writes a conversation in Claude Code session-file layout: preamble lines, then entries, one JSON value per line, newline-terminated. It is the inverse of `ConversationReader::read_conversation`. Records go straight to the sink via `serde_json::to_writer`, so no intermediate String exists. The trailing newline is part of the contract: Claude Code appends to the file on resume, and without it the first appended entry lands on the last line. `p export claude` writes through the new writer; its private serialization loop in cmd_export.rs becomes a three-line adapter that collects the bytes into a String for stdout and --output. Bumps toolpath-claude to 0.12.3 (additive).
|
🔍 Preview deployed: https://7c3aa6f2.toolpath.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The last step of projecting a Claude Code
Conversationto JSONL is a loop incmd_export. That loop carries a harness-specific constraint (required trailing newline). Feels like that constraint belongs in the crate that owns the harness format. This addsConversationWriter::write_conversationand routesp export claudethrough it.Alternatives considered: a method on
Conversation, rejected becausetypes.rsholds data and infallible accessors only.Discovered this while working on a second caller: #223, #223 (comment)
toolpath-claude bumps to 0.12.3 (additive).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.