Add OpenCode provider support with dashboard#7
Closed
biyiklioglu wants to merge 4 commits into
Closed
Conversation
Introduce a top-bar dashboard view that surfaces provider, project, session, message, bookmark, token, tool-call, model, and recent-activity aggregates in a new renderer layout. Adds hero metrics, provider throughput, category composition, activity skyline, and top project/model sections while fitting the existing app shell patterns. Add a dashboard:getStats IPC contract and query-service aggregation path that combines SQLite-backed session metrics with bookmark totals and provider activity rollups. Wire the request through bootstrap, preload, the shared bridge, and renderer types so the desktop app can fetch the dashboard through the existing typed boundary. Cover the new behavior with query-service, IPC-contract, App-shell, focus restoration, TopBar, and DashboardView tests, including top-bar navigation and dashboard refresh/error handling.
Extend the dashboard:getStats response with AI code-writing metrics derived from explicit tool_edit events. Adds a shared helper that parses stored tool-call payloads into per-file write summaries, including change type counts, file and extension rollups, line additions/deletions, and recent write activity. Expand the dashboard UI with a dedicated AI Code Activity section that surfaces write KPIs, coverage notes, write velocity, change profile, provider write throughput, top written files, and top file types while staying within the existing dashboard card and chart patterns. Refresh dashboard data whenever the view is reopened instead of loading it only once per app session. Cover the new behavior with shared helper, query-service, IPC-contract, dashboard renderer, and App-shell tests, including partial coverage, empty-state, and dashboard reopen refresh scenarios.
Adjust the rebased AI code activity aggregation to support upstream's move change type in parsed tool edit payloads. Extend the dashboard IPC contract, default state, fixtures, and query-service rollups so move operations are counted explicitly instead of surfacing as invalid change-type totals. Update the dashboard change profile and focused tests to reflect the wider write classification model introduced on upstream/main while keeping the rebased dashboard and AI analytics behavior green.
Introduce OpenCode as a first-class provider across discovery, parsing, indexing, search, settings, dashboard stats, and history rendering. Add a SQLite-backed OpenCode adapter that reads session data from , normalizes it through the existing provider pipeline, and preserves generic tool/edit payloads so diff rendering, tool-call indexing, and AI code activity stats work without provider-specific branches. Extend materialized-source handling so providers can use stable logical source keys while still tracking a real backing path for change detection. Add OpenCode change expansion, changed-db session cleanup, provider metadata/default roots, and provider-count/search plumbing so OpenCode participates in refresh, filtering, exports, and aggregate stats alongside the existing providers. Surface OpenCode in the desktop app through provider styling, settings labels, dashboard/provider displays, and raw edit rendering. Heal legacy saved indexing state so older default provider selections automatically enable OpenCode on startup without overriding intentional custom subsets, and cover the new behavior with discovery, parser, indexing, app-state, settings, dashboard, search, and app shell tests.
Owner
|
@copilot resolve the merge conflicts in this pull request |
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.
Summary
Adds OpenCode as a first-class provider in Code Trail.
This PR brings OpenCode into the same indexing and desktop UX flow as the existing providers, covering discovery, parsing, indexing, search, provider filters, dashboard stats, settings, edit rendering, and exports. It also includes a small app-state migration so older saved configs automatically pick up the new provider instead of silently leaving it disabled.
What Changed
opencodeto the canonical provider surface and provider-driven contractsopencodeRootdiscovery config and default platform pathsopencode.dbWhy
OpenCode stores session history differently from the file-backed providers already supported in Code Trail. Without provider-aware materialized discovery and backing-path handling, the app could not reliably treat individual OpenCode sessions as indexable sources.
The app-state migration is included because older installs persisted the pre-OpenCode default enabled-provider list. That left OpenCode supported in code but still disabled in practice until users manually changed settings.
Impact
Users can now index and explore OpenCode sessions in the same way they already use Claude, Codex, Gemini, Cursor, and Copilot history.
That includes:
Test Coverage
opencodeto older default saved configs, and confirms intentional custom provider subsets are preserved.OpenCode data rootdiscovery path.filePath,oldString,newString, andcontentnormalize into the existing edit renderer/tool parsing flow.opencodeprovider.opencodeand the related discovery/settings structures.opencode.db, plus changed-path expansion from the DB file to logical session sources.user,assistant,thinking,tool_use,tool_edit, andtool_result, including timestamps and tool payload preservation.Validation
Passed focused OpenCode coverage across discovery, parsing, indexing, search, app state, settings, dashboard, and app shell:
ELECTRON_RUN_AS_NODE=1 ./apps/desktop/node_modules/.bin/electron ./node_modules/vitest/vitest.mjs run apps/desktop/src/main/appStateStore.test.ts packages/core/src/discovery/discoverSingleFile.test.ts packages/core/src/discovery/discoverSessionFiles.test.ts packages/core/src/parsing/providerParsers.test.ts packages/core/src/indexing/indexSessions.integration.test.ts packages/core/src/contracts/ipc.test.ts apps/desktop/src/main/data/queryService.test.ts apps/desktop/src/renderer/components/messages/toolParsing.test.ts apps/desktop/src/renderer/components/SettingsView.test.tsx apps/desktop/src/renderer/features/DashboardView.test.tsx apps/desktop/src/renderer/App.test.tsx packages/core/src/search/searchMessages.integration.test.tsbun run desktop:buildScreenshots