replace sqlite query opencode native commands#439
Conversation
PR SummaryMedium Risk Overview Extends checkpoint storage and session restore flows to carry optional agent Updates summarization/condensation and transcript scoping to understand OpenCode’s JSONL schema (prompts, tool calls, token usage), and expands uninstall/detection/integration tests to cover OpenCode hooks and end-to-end strategy flows. Written by Cursor Bugbot for commit fff26c6. Configure here. |
Entire-Checkpoint: d5cbd5b0342d
fff26c6 to
58d768c
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds first-class OpenCode support across the Entire CLI pipeline (hooks → lifecycle → checkpointing/condensation → resume/rewind → summarization), including persisting OpenCode-native export data so sessions can be restored into OpenCode’s SQLite-backed store.
Changes:
- Introduces a new
opencodeagent implementation (hooks, transcript parsing, token usage, and native import/export integration). - Extends checkpoint storage + restore flows to persist and restore optional agent
ExportData(e.g., OpenCode export JSON). - Adds unit + integration coverage for OpenCode summarization, hook flows, and strategy composition.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/summarize/summarize_test.go | Adds OpenCode condensed-transcript tests; updates Gemini tool-detail helper naming. |
| cmd/entire/cli/summarize/summarize.go | Adds OpenCode transcript condensation and generalizes tool-detail extraction across Gemini/OpenCode. |
| cmd/entire/cli/strategy/manual_commit_types.go | Adds ExportData to extracted session data for checkpoint persistence. |
| cmd/entire/cli/strategy/manual_commit_rewind.go | Restores sessions via agent WriteSession (supports native import via ExportData). |
| cmd/entire/cli/strategy/manual_commit_condensation.go | Reads export data from session metadata; adds OpenCode prompt + token usage extraction. |
| cmd/entire/cli/strategy/common.go | Extends agent detection heuristics to recognize OpenCode projects. |
| cmd/entire/cli/setup.go | Includes OpenCode in uninstall detection and hook removal. |
| cmd/entire/cli/rewind.go | Restores export data from committed checkpoints / shadow commits and uses WriteSession when present. |
| cmd/entire/cli/resume.go | Plumbs export data through resume path into AgentSession. |
| cmd/entire/cli/paths/paths.go | Adds export.json filename constant for checkpoint/session metadata. |
| cmd/entire/cli/lifecycle.go | Copies OpenCode export JSON into session metadata directory at turn end. |
| cmd/entire/cli/integration_test/testenv.go | Adds OpenCode project dir to integration test environment and removes unsupported agent setting. |
| cmd/entire/cli/integration_test/opencode_hooks_test.go | New integration tests for OpenCode hook flow, rewind, and condensation. |
| cmd/entire/cli/integration_test/hooks.go | Adds an OpenCode hook runner + helpers for generating OpenCode JSONL transcripts in tests. |
| cmd/entire/cli/integration_test/agent_test.go | Registers OpenCode agent and adds OpenCode agent detection/hook/session tests. |
| cmd/entire/cli/hooks_cmd.go | Registers the OpenCode agent so hook subcommands are available. |
| cmd/entire/cli/explain.go | Treats OpenCode transcript offsets like JSONL (line-based) for scoping/offset computation. |
| cmd/entire/cli/checkpoint/temporary.go | Adds ability to read export data from shadow-branch commit trees. |
| cmd/entire/cli/checkpoint/committed.go | Writes/reads optional export data in committed checkpoints and extends session log lookup. |
| cmd/entire/cli/checkpoint/checkpoint.go | Adds ExportData to committed write options and session content model. |
| cmd/entire/cli/agent/session.go | Adds ExportData to AgentSession for native restore/import flows. |
| cmd/entire/cli/agent/registry.go | Adds OpenCode agent name/type constants. |
| cmd/entire/cli/agent/opencode/types.go | New OpenCode transcript + hook payload types. |
| cmd/entire/cli/agent/opencode/transcript_test.go | New unit tests for JSONL parsing, prompts/files extraction, chunking, and token accounting. |
| cmd/entire/cli/agent/opencode/transcript.go | New JSONL parser + transcript analyzer/token calculator implementation for OpenCode. |
| cmd/entire/cli/agent/opencode/plugin.go | Embeds the OpenCode TypeScript plugin template. |
| cmd/entire/cli/agent/opencode/opencode.go | New OpenCode agent implementation, including best-effort native import via opencode import. |
| cmd/entire/cli/agent/opencode/lifecycle_test.go | New unit tests for mapping OpenCode hooks to normalized lifecycle events. |
| cmd/entire/cli/agent/opencode/lifecycle.go | New hook handler mapping OpenCode hook verbs to normalized lifecycle events. |
| cmd/entire/cli/agent/opencode/hooks_test.go | New tests for installing/uninstalling the OpenCode plugin file. |
| cmd/entire/cli/agent/opencode/hooks.go | Installs/removes the OpenCode plugin file under .opencode/plugins/. |
| cmd/entire/cli/agent/opencode/entire_plugin.ts | New OpenCode plugin that emits hook events and writes JSONL + export JSON. |
| cmd/entire/cli/agent/opencode/cli_commands.go | Wraps opencode session delete and opencode import with timeouts for native restore. |
Comments suppressed due to low confidence (1)
cmd/entire/cli/agent/opencode/opencode.go:123
os.ReadFile(input.SessionRef)will likely trigger gosec G304 (file path provided as variable). Other code paths reading hook-provided paths annotate this with//nolint:gosecplus a short justification or validate the path before reading to satisfy lint/CI.
return &agent.AgentSession{
AgentName: a.Name(),
SessionID: input.SessionID,
SessionRef: input.SessionRef,
NativeData: data,
ModifiedFiles: modifiedFiles,
}, nil
No description provided.