Skip to content

Version v2.5.0

Choose a tag to compare

@MrDoe MrDoe released this 20 Oct 09:29
· 40 commits to main since this release

Configurable parser per file extension

chunking.parsers maps a file extension to a parser (chunker) language, so the
extension → parser mapping is no longer hard-coded:

{
  "chunking": {
    "parsers": {
      ".c": "cpp",
      ".cu": "cpp"
    }
  }
}

Keys normalize (lowercased, leading dot added), so "CXX" and ".cxx" are the
same entry. Values must be a registered parser language (typescript, cpp,
python, … plus text for the fallback parser) — unknown names surface as
config warnings listing the valid ones. Both new extensions and existing
mappings can be remapped.

The override is resolved per call and never mutates the process-wide chunker
registry, so it stays workspace-scoped and coexists safely with pluggable
chunkers[]. It applies consistently to indexing/chunking, get_file_skeleton
(plugin tool and MCP), read-tool code fences and the embedding metadata header.
Extensions named in the map are implicitly added to the scanned set.

Set it in opencode-rag.json, in the TUI settings editor (Chunking → Parser
overrides
), or via the dashboard API (PUT /api/config). opencode-rag init
now emits an empty chunking section so the key is discoverable.

Fixes

  • The TUI's live parser-override edit was a silent dead write —
    applyRuntimeOverrides() had no chunking branch, so the change never took
    effect.
  • The runtime-override reload interval had drifted from the documented 5s to
    1h, which made every "live" TUI edit look broken.
  • The embedding metadata header kept its own extension → label table, so a
    remapped .c file was embedded as [c] while its chunk language was cpp.
  • The eval fast-indexer dropped the parser and node-type overrides, so eval
    chunk boundaries diverged from production.
  • PUT /api/config now accepts a chunking section.
  • A no-op override (.tsx → typescript) no longer degrades the skeleton
    recipe — the extension keeps its own, more specific recipe.

Note: changing a mapping changes chunk boundaries for already-indexed
files without changing their content hashes. Re-run
opencode-rag index --force after editing.

Closes #29.


Full Changelog: v2.4.5...v2.5.0