Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(parse): treat .cc files as processable in directory scan (#1008)

Qin Haojief0689e1e8e44
diff --git a/openviking/parse/parsers/constants.py b/openviking/parse/parsers/constants.py
index 174df57b9..cb0bf7012 100644
--- a/openviking/parse/parsers/constants.py
+++ b/openviking/parse/parsers/constants.py
@@ -97,6 +97,7 @@ CODE_EXTENSIONS = {
".py",
".java",
".cpp",
+ ".cc",
".c",
".h",
".hpp",
diff --git a/tests/parse/test_directory_parser_routing.py b/tests/parse/test_directory_parser_routing.py
index 622f772d7..f7ebb6e3a 100644
--- a/tests/parse/test_directory_parser_routing.py
+++ b/tests/parse/test_directory_parser_routing.py
@@ -83,6 +83,7 @@ def tmp_all_parsers(tmp_path: Path) -> Path:
bundle.zip -> ZipParser
code/
app.py -> text-fallback (is_text_file)
+ engine.cc -> text-fallback
main.js -> text-fallback
style.css -> text-fallback
config/
@@ -112,6 +113,7 @@ def tmp_all_parsers(tmp_path: Path) -> Path:
(tmp_path / "code").mkdir()
(tmp_path / "code" / "app.py").write_text("print(1)", encoding="utf-8")
+ (tmp_path / "code" / "engine.cc").write_text("int main() { return 0; }", encoding="utf-8")
(tmp_path / "code" / "main.js").write_text("console.log(1)", encoding="utf-8")
(tmp_path / "code" / "style.css").write_text("body{}", encoding="utf-8")
@@ -166,7 +168,7 @@ class TestParserSelection:
# Extensions that are *processable* (via is_text_file) but have no
# dedicated parser in the registry – they fall back to TextParser at
# parse-time via ``ParserRegistry.parse``.
- TEXT_FALLBACK_EXTENSIONS = {".py", ".js", ".css", ".yaml", ".json", ".toml"}
+ TEXT_FALLBACK_EXTENSIONS = {".py", ".cc", ".js", ".css", ".yaml", ".json", ".toml"}
def test_dedicated_parsers_resolve(self, registry: ParserRegistry) -> None:
"""get_parser_for_file returns the correct class for each extension."""
diff --git a/tests/parse/test_directory_scan.py b/tests/parse/test_directory_scan.py
index cd440dca0..3ec2fc66f 100644
--- a/tests/parse/test_directory_scan.py
+++ b/tests/parse/test_directory_scan.py
@@ -35,6 +35,7 @@ def tmp_tree(tmp_path: Path) -> Path:
# text (code/config, no dedicated parser or text parser only): .py, .yaml
(tmp_path / "main.py").write_text("print(1)", encoding="utf-8")
+ (tmp_path / "engine.cc").write_text("int main() { return 0; }", encoding="utf-8")
(tmp_path / "config.yaml").write_text("key: value", encoding="utf-8")
# unsupported: unknown extension
@@ -136,6 +137,7 @@ class TestScanDirectoryClassification:
result: DirectoryScanResult = scan_directory(tmp_tree, registry=registry, strict=False)
processable_rel = [f.rel_path for f in result.processable]
assert "main.py" in processable_rel
+ assert "engine.cc" in processable_rel
assert "config.yaml" in processable_rel
assert "src/app.py" in processable_rel