Skip to content

feat: add session-context support for Copilot CLI and opencode#273

Merged
rhuanbarreto merged 2 commits into
mainfrom
feat/session-context-copilot-opencode
May 5, 2026
Merged

feat: add session-context support for Copilot CLI and opencode#273
rhuanbarreto merged 2 commits into
mainfrom
feat/session-context-copilot-opencode

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

  • Add session-context copilot subcommand — reads Copilot CLI session transcripts from ~/.copilot/session-state/, matching sessions by cwd field in workspace.yaml and parsing events.jsonl
  • Add session-context opencode subcommand — reads opencode session transcripts from ~/.local/share/opencode/storage/, matching sessions by project path field in session metadata and reading individual message JSON files
  • Add copilotSessionStateDir() and opencodeStorageDir() path resolution helpers
  • Export shared utilities (TranscriptEntry, getContentPreview, RELEVANT_ROLES) from session-context.ts for reuse by per-editor reader modules
  • Update EN and pt-br reference docs with new subcommand sections

This closes the gap noted in build-opencode-plugin.ts where session-context opencode was referenced but didn't exist yet.

Test plan

  • bun run validate passes (lint, typecheck, format, 728 tests, 23/23 ADR checks, build)
  • session-context claude-code still works (verified with live session)
  • session-context copilot returns proper error when no matching sessions exist
  • session-context copilot finds sessions by cwd match (verified with real ~/.copilot/session-state/)
  • session-context opencode returns proper error when storage is empty
  • session-context --help shows all 4 subcommands
  • Manual test with a real Copilot CLI conversation session (events.jsonl)
  • Manual test with a real opencode conversation session

Extend the `session-context` command with two new subcommands:

- `session-context copilot` — reads Copilot CLI session transcripts
  from `~/.copilot/session-state/`, matching sessions by workspace
  `cwd` field via `workspace.yaml` + `events.jsonl`
- `session-context opencode` — reads opencode session transcripts from
  `~/.local/share/opencode/storage/`, matching sessions by project
  `path` field in session metadata + individual message JSON files

Both support `--max-entries` and `--session-id` options, following the
existing Cursor subcommand pattern.

Also:
- Add `copilotSessionStateDir()` and `opencodeStorageDir()` path helpers
- Export shared utilities (TranscriptEntry, getContentPreview, RELEVANT_ROLES)
  from session-context.ts for reuse by per-editor reader modules
- Split new readers into separate files to stay under max-lines lint rule
- Update EN and pt-br reference docs with new subcommand sections

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 5, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 61503cf
Status: ✅  Deploy successful!
Preview URL: https://e9bb86f2.archgate-cli.pages.dev
Branch Preview URL: https://feat-session-context-copilot.archgate-cli.pages.dev

View logs

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@rhuanbarreto rhuanbarreto merged commit 03e9746 into main May 5, 2026
11 checks passed
@rhuanbarreto rhuanbarreto deleted the feat/session-context-copilot-opencode branch May 5, 2026 20:05
@archgatebot archgatebot Bot mentioned this pull request May 5, 2026
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.

1 participant