Skip to content

feat(provider): add OpenCodeProvider for discover command#1523

Open
TorratDev wants to merge 13 commits intortk-ai:developfrom
TorratDev:develop
Open

feat(provider): add OpenCodeProvider for discover command#1523
TorratDev wants to merge 13 commits intortk-ai:developfrom
TorratDev:develop

Conversation

@TorratDev
Copy link
Copy Markdown

Summary

  • Add OpenCodeProvider struct implementing SessionProvider trait to read commands from OpenCode SQLite database
  • Add DiscoverProvider enum in discover::mod.rs to select between Claude and OpenCode providers
  • Add OPENCODE_DB_PATH constant to hooks::constants.rs

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test → 21 passed
  • Manual testing: rtk discover --provider opencode -v → 757 Bash commands extracted (on my expirience)

Tests added

  • test_opencode_discover_sessions_empty — empty DB returns no sessions
  • test_opencode_discover_sessions_with_filter — project filter substring matching
  • test_opencode_discover_sessions_since_days — date filter with cutoff
  • test_opencode_extract_tool_commands — extract bash tool from OpenCode JSON format
  • test_opencode_extract_multiple_tools — multiple tool calls ordered by timestamp
  • test_opencode_extract_error_tool — error detection in tool output
  • test_opencode_malformed_json_handling — graceful handling of invalid JSON
  • test_opencode_empty_directory_handling — NULL/empty directory filtering

I'm not an expert in Rust, so feedback and suggestions are very welcome.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ aeppling
✅ TorratDev
❌ github-actions[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

@pszymkowiak pszymkowiak added effort-medium 1-2 jours, quelques fichiers enhancement New feature or request labels Apr 25, 2026
@pszymkowiak
Copy link
Copy Markdown
Collaborator

[w] wshm · Automated triage by AI

📊 Automated PR Analysis

Type feature
🟡 Risk medium

Summary

Adds an OpenCodeProvider that reads session/command history from an OpenCode SQLite database, alongside a DiscoverProvider enum to select between Claude and OpenCode providers in the discover command. Also includes a UTF-8 char boundary helper fix and version bumps to 0.37.2.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Analyzed automatically by wshm · This is an automated analysis, not a human review.

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

Labels

effort-medium 1-2 jours, quelques fichiers enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants