feat(opencode): add markdown output to export command#32262
Open
molloyzak13 wants to merge 3 commits into
Open
feat(opencode): add markdown output to export command#32262molloyzak13 wants to merge 3 commits into
molloyzak13 wants to merge 3 commits into
Conversation
Adds -f/--format markdown|json (default json) and -o/--output <file> to opencode export. Default stays json so existing usage is unchanged. Closes anomalyco#9387
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Author
|
Small heads-up on the diff: I also dropped the |
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.
Issue for this PR
Closes #9387
Type of change
What does this PR do?
opencode exportonly emitted JSON. This adds-f/--format json|markdownand-o/--output <file>, so a session can be saved as a readable Markdown transcript instead of only JSON. The default staysjson, so existing usage and scripts are unchanged. The markdown path walks the v1 part union (text, reasoning, tool) and writes a session-header table plus each turn. It also removes aMessageV2import in the same file that was already unused.How did you verify your code works?
Built the CLI (
packages/opencode/script/build.ts --single) and ran the binary against a real session:export <id> -f markdown(stdout),-f markdown -o <file>(writes the file), and plainexport <id>to confirm the JSON output is byte-for-byte unchanged.tsc --noEmitis clean.Screenshots / recordings
Not a UI change (CLI output).
Checklist