Skip to content

feat(opencode): add markdown output to export command#32262

Open
molloyzak13 wants to merge 3 commits into
anomalyco:devfrom
molloyzak13:feat/export-markdown
Open

feat(opencode): add markdown output to export command#32262
molloyzak13 wants to merge 3 commits into
anomalyco:devfrom
molloyzak13:feat/export-markdown

Conversation

@molloyzak13

@molloyzak13 molloyzak13 commented Jun 14, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #9387

Type of change

  • New feature

What does this PR do?

opencode export only emitted JSON. This adds -f/--format json|markdown and -o/--output <file>, so a session can be saved as a readable Markdown transcript instead of only JSON. The default stays json, 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 a MessageV2 import 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 plain export <id> to confirm the JSON output is byte-for-byte unchanged. tsc --noEmit is clean.

Screenshots / recordings

Not a UI change (CLI output).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jun 14, 2026
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jun 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@molloyzak13

Copy link
Copy Markdown
Author

Small heads-up on the diff: I also dropped the MessageV2 import on line 3. It was already unused before this PR — once I edited the file the typecheck flagged it as dead, so I cleaned it up rather than leave it sitting there. It is a one-liner and unrelated to the markdown logic, so if you would rather this PR stay purely additive I am happy to pull it into a separate change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: opencode session export to markdown or json

1 participant