Skip to content

Comments

feat(cli): support OpenCode SQLite parsing with JSON fallback#13

Open
agusmdev wants to merge 3 commits intomainfrom
feat/opencode-sqlite-dual-read
Open

feat(cli): support OpenCode SQLite parsing with JSON fallback#13
agusmdev wants to merge 3 commits intomainfrom
feat/opencode-sqlite-dual-read

Conversation

@agusmdev
Copy link
Owner

What changed

  • Updated OpenCodeParser to read usage messages from OpenCode's current SQLite database (opencode.db) by parsing rows from the message table.
  • Kept backward compatibility with legacy JSON message files under storage/message.
  • Added deduplication by message ID when both SQLite and JSON data are present, avoiding double-counting.
  • Extended incremental sync behavior to track both SQLite file metadata and JSON file checkpoints.
  • Updated CLI help/docs text to describe the new primary OpenCode data location and fallback.
  • Added integration tests covering SQLite-only, JSON-only, and mixed-mode parsing.

Why

OpenCode migrated storage to SQLite, so the parser needs to support the new source format while preserving compatibility for users on older versions or mixed local data.

Validation

  • Ran: bun test src/parsers/opencode.integration.test.ts
  • Result: 3 tests passed
  • Note: full typecheck could not be completed in this environment due missing local TS type dependencies setup (bun-types/@types/node).

Created with Open-Inspect

Read OpenCode usage from the new opencode.db message table while keeping legacy storage/message JSON compatibility for existing users and mixed environments.
Replace CommonJS require calls with ESM imports, remove unused fs imports in cronjob utilities, and reorder test imports to satisfy import-order rules.
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