feat(opencode): add session view to print a transcript
Issue for this PR
Closes #32264
Type of change
- [x] New feature
What does this PR do?
opencode session list lists sessions but there is no way to read one from the terminal. This adds opencode session view [sessionID] - it renders a session as a Markdown transcript to stdout, paged through less when interactive. It defaults to the most recent session and takes --no-reasoning / --no-tools to trim output. It sits next to session list / session delete in the same command group and reuses Session.Service (get + messages), the same service export uses.
How did you verify your code works?
Ran bun dev against a real session: session view <id>, session view (picks the most recent, prints which on stderr), --no-tools --no-reasoning, and a bad id (prints Session not found). tsc --noEmit is clean. I also hit a yargs gotcha where options named no-* collide with yargs built-in boolean negation, and fixed it by using positive reasoning/tools booleans defaulting to true.
Screenshots / recordings
Not a UI change (CLI output).
Checklist
- [x] I have tested my changes locally
- [x] I have not included unrelated changes in this PR
Thanks for updating your PR! It now meets our contributing guidelines. :+1:
Automated PR Cleanup
Thank you for contributing to opencode.
Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.
This PR was closed because it matched the following cleanup criteria:
- The PR was created more than 1 month ago
- The PR had fewer than 2 positive reactions
- Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR
PRs created within the last month are not affected by this cleanup.
If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.
Thanks again for taking the time to contribute.