codenib.scip_interface
¶
Language-specific SCIP indexing and decoding.
The public classes stay lazy so importing an LSP-shaped provider does not load the optional igraph runtime or every language backend.
Modules:
| Name | Description |
|---|---|
lsp_occurrence_index |
Exact position index for LSP-shaped navigation over decoded SCIP data. |
rust_analyzer |
Helpers for invoking rust-analyzer consistently. |
scip_decode_core |
Thin Python wrapper around the |
scip_decode_csharp |
SCIP decoder for C# projects indexed by scip-dotnet. |
scip_decode_go |
SCIP decoder for Go projects. |
scip_decode_java |
SCIP decoder for JVM projects indexed by scip-java. |
scip_decode_php |
SCIP decoder for PHP projects indexed by scip-php. |
scip_decode_python |
SCIP decoder for Python projects. |
scip_decode_ruby |
SCIP decoder for Ruby projects indexed by scip-ruby. |
scip_decode_rust |
SCIP decoder for Rust projects. |
scip_decode_ts |
|
scip_decode_utils |
Shared normalization helpers for SCIP TextFormat decoders. |
scip_indexer_base |
Base class for SCIP indexers across different languages. |
scip_indexer_csharp |
SCIP indexer for C# projects using scip-dotnet. |
scip_indexer_go |
SCIP indexer for Go projects using scip-go. |
scip_indexer_java |
SCIP indexers for JVM projects using scip-java. |
scip_indexer_php |
SCIP-backed PHP graph routes using scip-php. |
scip_indexer_python |
SCIP indexer for Python projects using scip-python. |
scip_indexer_ruby |
SCIP-backed Ruby graph routes using scip-ruby. |
scip_indexer_rust |
SCIP indexer for Rust projects using rust-analyzer. |
scip_indexer_ts |
SCIP indexer for TypeScript and JavaScript projects using scip-typescript. |
scip_pb2 |
Generated protocol buffer code. |
Classes:
| Name | Description |
|---|---|
SCIPLocation |
Repository-relative location returned by the occurrence index. |
SCIPOccurrence |
One SCIP symbol occurrence with an exact half-open source range. |
SCIPOccurrenceIndex |
Resolve exact source positions to SCIP definitions and references. |
SCIPCSharpGraphDecoder |
Decode scip-dotnet TextFormat output into CodeGraph. |
SCIPJavaGraphDecoder |
Decode scip-java TextFormat output into CodeGraph. |
SCIPPHPGraphDecoder |
Decode scip-php TextFormat output into CodeGraph. |
SCIPPythonGraphDecoder |
Decoder for Python SCIP indices. |
SCIPRubyGraphDecoder |
Decode scip-ruby TextFormat output into CodeGraph. |
SCIPRustGraphDecoder |
Decoder for Rust SCIP indices. |
SCIPTypeScriptGraphDecoder |
|
SCIPIndexerBase |
Abstract base class for SCIP indexers. |
SCIPCSharpIndexer |
Run scip-dotnet for the active C# graph backend. |
SCIPJavaIndexer |
Run scip-java for Java and JVM candidate routes. |
SCIPKotlinIndexer |
Candidate scip-java indexer for Kotlin projects. |
SCIPScalaIndexer |
Candidate scip-java indexer for Scala projects. |
PHPHybridIndexer |
Active PHP graph route: SCIP for Composer projects, LSP fallback otherwise. |
SCIPPHPIndexer |
Pure scip-php route used by candidate gates and the active hybrid route. |
SCIPPythonIndexer |
SCIP indexer for Python projects. |
RubyHybridIndexer |
Active Ruby graph route: prepared scip-ruby bundles, LSP fallback otherwise. |
SCIPRubyIndexer |
Pure scip-ruby route used by candidate gates and active hybrid routing. |
SCIPRustIndexer |
SCIP indexer for Rust projects. |
SCIPTypeScriptIndexer |
SCIP indexer for TypeScript and JavaScript projects. |
SCIPLocation
dataclass
¶
SCIPLocation(
file_path: str,
start_line: int,
start_character: int,
end_line: int,
end_character: int,
)
Repository-relative location returned by the occurrence index.
SCIPOccurrence
dataclass
¶
SCIPOccurrence(
file_path: str,
start_line: int,
start_character: int,
end_line: int,
end_character: int,
symbol: str,
symbol_roles: int = 0,
)
One SCIP symbol occurrence with an exact half-open source range.
SCIPOccurrenceIndex
¶
SCIPOccurrenceIndex(
occurrences: Iterable[SCIPOccurrence], *, position_encoding: str = "UTF8"
)
Resolve exact source positions to SCIP definitions and references.
Source code in codenib/scip_interface/lsp_occurrence_index.py
SCIPCSharpGraphDecoder
¶
Bases: SCIPJavaGraphDecoder
Decode scip-dotnet TextFormat output into CodeGraph.
Source code in codenib/scip_interface/scip_decode_java.py
SCIPJavaGraphDecoder
¶
Decode scip-java TextFormat output into CodeGraph.
Source code in codenib/scip_interface/scip_decode_java.py
SCIPPHPGraphDecoder
¶
Bases: SCIPJavaGraphDecoder
Decode scip-php TextFormat output into CodeGraph.
Source code in codenib/scip_interface/scip_decode_java.py
SCIPPythonGraphDecoder
¶
Decoder for Python SCIP indices.
Parses decoded SCIP index files and builds a CodeGraph representing: - Classes - Methods and fields within classes - Module-level functions - References between symbols
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index_file_path
|
Path to the decoded SCIP index file |
required | |
project_root
|
Root directory of the Python project |
None
|
Methods:
| Name | Description |
|---|---|
decode |
Decode the SCIP index and build the CodeGraph. |
save_graph |
Save the code graph to a file. |
Source code in codenib/scip_interface/scip_decode_python.py
decode
¶
Decode the SCIP index and build the CodeGraph.
Returns:
| Name | Type | Description |
|---|---|---|
CodeGraph |
The constructed code graph |
Source code in codenib/scip_interface/scip_decode_python.py
save_graph
¶
Save the code graph to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
Path where the graph should be saved |
required |
SCIPRubyGraphDecoder
¶
Bases: SCIPJavaGraphDecoder
Decode scip-ruby TextFormat output into CodeGraph.
Source code in codenib/scip_interface/scip_decode_ruby.py
SCIPRustGraphDecoder
¶
Decoder for Rust SCIP indices.
Parses decoded SCIP index files and builds a CodeGraph representing: - Structs as classes - Traits as classes - Impl blocks and their methods - Free functions - References between symbols
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index_file_path
|
Path to the decoded SCIP index file |
required | |
project_root
|
Root directory of the Rust project |
None
|
Methods:
| Name | Description |
|---|---|
decode |
Decode the SCIP index and build the CodeGraph. |
save_graph |
Save the code graph to a file. |
Source code in codenib/scip_interface/scip_decode_rust.py
decode
¶
Decode the SCIP index and build the CodeGraph.
Returns:
| Name | Type | Description |
|---|---|---|
CodeGraph |
The constructed code graph |
Source code in codenib/scip_interface/scip_decode_rust.py
save_graph
¶
Save the code graph to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
Path where the graph should be saved |
required |
SCIPTypeScriptGraphDecoder
¶
Source code in codenib/scip_interface/scip_decode_ts.py
SCIPIndexerBase
¶
SCIPIndexerBase(
project_root: str | Path,
output_dir: str | Path | None = None,
exclude_patterns: list | None = None,
profiler: Profiler | None = None,
language: str = "unknown",
decoder_backend: str | None = None,
)
Bases: ABC
Abstract base class for SCIP indexers.
This class provides common functionality for all SCIP indexers, while allowing language-specific implementations to customize the indexing process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
str | Path
|
Root directory of the project to index |
required |
output_dir
|
str | Path | None
|
Directory to store output files |
None
|
exclude_patterns
|
list | None
|
List of patterns to exclude from indexing |
None
|
profiler
|
Profiler | None
|
Profiler instance for performance tracking |
None
|
language
|
str
|
Language being indexed (for logging) |
'unknown'
|
decoder_backend
|
str | None
|
Which decoder to use when |
None
|
Methods:
| Name | Description |
|---|---|
generate_index |
Generate SCIP index for the project. |
decode_index |
Decode the SCIP index with the packaged protobuf descriptor. |
process_index |
Process the decoded SCIP index into a more usable format. |
run_pipeline |
Run the complete SCIP indexing pipeline: generate, decode, and process. |
clear_cache |
Clear cache files at different levels. |
Source code in codenib/scip_interface/scip_indexer_base.py
generate_index
¶
Generate SCIP index for the project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Language-specific options |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if index generation was successful, False otherwise |
Source code in codenib/scip_interface/scip_indexer_base.py
decode_index
¶
Decode the SCIP index with the packaged protobuf descriptor.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if decoding was successful, False otherwise |
Source code in codenib/scip_interface/scip_indexer_base.py
process_index
¶
process_index(output_file: str | None = None) -> CodeGraph | None
Process the decoded SCIP index into a more usable format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_file
|
str | None
|
Path to write the processed data to |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
CodeGraph |
CodeGraph | None
|
Processed graph object |
Source code in codenib/scip_interface/scip_indexer_base.py
run_pipeline
¶
run_pipeline(
output_file: str | None = None,
skip_level: str | None = None,
*,
reset_profiler: bool = True,
report_profile: bool = True,
**kwargs
) -> CodeGraph | None
Run the complete SCIP indexing pipeline: generate, decode, and process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_file
|
str | None
|
Path to write the processed data to (if None, uses self.graph_file) |
None
|
skip_level
|
str | None
|
Cache/skip level - 'graph', 'decode', 'raw', or None - 'graph': Check if graph.pkl exists, load and return it if found - 'decode': Check if index.decoded exists, skip to processing if found - 'raw': Check if index.scip exists, skip to decoding if found - None: Run full pipeline from scratch (default) |
None
|
reset_profiler
|
bool
|
Clear profiler stats before running the pipeline |
True
|
report_profile
|
bool
|
Emit profiler summary automatically after the run |
True
|
**kwargs
|
Language-specific options passed to generate_index |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
CodeGraph |
CodeGraph | None
|
Processed graph object |
Source code in codenib/scip_interface/scip_indexer_base.py
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | |
clear_cache
¶
Clear cache files at different levels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
str
|
Preserve cache up to this pipeline stage, remove above. Pipeline: raw (index.scip) → decode (index.decoded) → graph (graph.pkl) - 'graph': keep everything (raw + decoded + graph) - 'decode': keep raw + decoded, remove graph - 'raw': keep raw, remove decoded + graph - 'all': remove all cache files (default) |
'all'
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if cache clearing was successful, False otherwise |
Source code in codenib/scip_interface/scip_indexer_base.py
SCIPCSharpIndexer
¶
SCIPCSharpIndexer(
project_root: str | Path,
output_dir: str | Path | None = None,
exclude_patterns: list | None = None,
profiler: Profiler | None = None,
decoder_backend: str | None = None,
)
Bases: SCIPIndexerBase
Run scip-dotnet for the active C# graph backend.
Source code in codenib/scip_interface/scip_indexer_csharp.py
SCIPJavaIndexer
¶
SCIPJavaIndexer(
project_root: str | Path,
output_dir: str | Path | None = None,
exclude_patterns: list | None = None,
profiler: Profiler | None = None,
decoder_backend: str | None = None,
scip_language: str = "java",
)
Bases: SCIPIndexerBase
Run scip-java for Java and JVM candidate routes.
Source code in codenib/scip_interface/scip_indexer_java.py
SCIPKotlinIndexer
¶
SCIPKotlinIndexer(
project_root: str | Path,
output_dir: str | Path | None = None,
exclude_patterns: list | None = None,
profiler: Profiler | None = None,
decoder_backend: str | None = None,
)
Bases: SCIPJavaIndexer
Candidate scip-java indexer for Kotlin projects.
Source code in codenib/scip_interface/scip_indexer_java.py
SCIPScalaIndexer
¶
SCIPScalaIndexer(
project_root: str | Path,
output_dir: str | Path | None = None,
exclude_patterns: list | None = None,
profiler: Profiler | None = None,
decoder_backend: str | None = None,
)
Bases: SCIPJavaIndexer
Candidate scip-java indexer for Scala projects.
Source code in codenib/scip_interface/scip_indexer_java.py
PHPHybridIndexer
¶
PHPHybridIndexer(
project_root: str | Path,
output_dir: str | Path | None = None,
exclude_patterns: list | None = None,
profiler: Profiler | None = None,
decoder_backend: str | None = None,
)
Active PHP graph route: SCIP for Composer projects, LSP fallback otherwise.
Source code in codenib/scip_interface/scip_indexer_php.py
SCIPPHPIndexer
¶
SCIPPHPIndexer(
project_root: str | Path,
output_dir: str | Path | None = None,
exclude_patterns: list | None = None,
profiler: Profiler | None = None,
decoder_backend: str | None = None,
)
Bases: SCIPIndexerBase
Pure scip-php route used by candidate gates and the active hybrid route.
Source code in codenib/scip_interface/scip_indexer_php.py
SCIPPythonIndexer
¶
SCIPPythonIndexer(
project_root: str | Path,
output_dir: str | Path | None = None,
exclude_patterns: list | None = None,
profiler: Profiler | None = None,
decoder_backend: str | None = None,
)
Bases: SCIPIndexerBase
SCIP indexer for Python projects.
Uses a scip-python executable already available on PATH when
possible. The historical managed Conda environment remains a fallback for
development and CI environments that do not expose the tool directly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
str | Path
|
Root directory of the Python project |
required |
output_dir
|
str | Path | None
|
Directory to store output files |
None
|
exclude_patterns
|
list | None
|
List of patterns to exclude from indexing |
None
|
profiler
|
Profiler | None
|
Profiler instance for performance tracking |
None
|
decoder_backend
|
str | None
|
|
None
|
Methods:
| Name | Description |
|---|---|
generate_index |
Generate SCIP index for the Python project. |
run_pipeline |
Run Python pipeline while ignoring non-Python kwargs. |
Source code in codenib/scip_interface/scip_indexer_python.py
generate_index
¶
generate_index(
cwd: str | None = None,
project_name: str | None = None,
target_dir: str | None = None,
**kwargs
) -> bool
Generate SCIP index for the Python project.
Uses the resolved PATH executable, with Conda as a compatibility fallback.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cwd
|
str | None
|
Working directory (defaults to project_root) |
None
|
project_name
|
str | None
|
Project name to use in the index |
None
|
target_dir
|
str | None
|
Optional subdirectory to target for indexing |
None
|
**kwargs
|
Additional arguments (ignored) |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if index generation was successful, False otherwise |
Source code in codenib/scip_interface/scip_indexer_python.py
run_pipeline
¶
run_pipeline(
output_file: str | None = None,
skip_level: str | None = None,
*,
reset_profiler: bool = True,
report_profile: bool = True,
**kwargs
)
Run Python pipeline while ignoring non-Python kwargs.
Source code in codenib/scip_interface/scip_indexer_python.py
RubyHybridIndexer
¶
RubyHybridIndexer(
project_root: str | Path,
output_dir: str | Path | None = None,
exclude_patterns: list | None = None,
profiler: Profiler | None = None,
decoder_backend: str | None = None,
)
Active Ruby graph route: prepared scip-ruby bundles, LSP fallback otherwise.
Source code in codenib/scip_interface/scip_indexer_ruby.py
SCIPRubyIndexer
¶
SCIPRubyIndexer(
project_root: str | Path,
output_dir: str | Path | None = None,
exclude_patterns: list | None = None,
profiler: Profiler | None = None,
decoder_backend: str | None = None,
)
Bases: SCIPIndexerBase
Pure scip-ruby route used by candidate gates and active hybrid routing.
Source code in codenib/scip_interface/scip_indexer_ruby.py
SCIPRustIndexer
¶
SCIPRustIndexer(
project_root: str | Path,
output_dir: str | Path | None = None,
exclude_patterns: list | None = None,
profiler: Profiler | None = None,
decoder_backend: str | None = None,
)
Bases: SCIPIndexerBase
SCIP indexer for Rust projects.
Uses the rust-analyzer tool to generate SCIP indices for Rust codebases. rust-analyzer scip generates a SCIP index from Rust source code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
str | Path
|
Root directory of the Rust project (must contain Cargo.toml) |
required |
output_dir
|
str | Path | None
|
Directory to store output files (defaults to /tmp/project_name) |
None
|
exclude_patterns
|
list | None
|
List of patterns to exclude from indexing |
None
|
profiler
|
Profiler | None
|
Profiler instance for performance tracking |
None
|
decoder_backend
|
str | None
|
|
None
|
Methods:
| Name | Description |
|---|---|
generate_index |
Generate SCIP index for the Rust project. |
run_pipeline |
Run Rust pipeline while ignoring Python-specific kwargs. |
Source code in codenib/scip_interface/scip_indexer_rust.py
generate_index
¶
Generate SCIP index for the Rust project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
str | None
|
Path to a JSON configuration file for customizing cargo behavior |
None
|
exclude_vendored_libraries
|
bool
|
Exclude code from vendored libraries from the index |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if index generation was successful, False otherwise |
Source code in codenib/scip_interface/scip_indexer_rust.py
run_pipeline
¶
run_pipeline(
output_file: str | None = None,
skip_level: str | None = None,
*,
reset_profiler: bool = True,
report_profile: bool = True,
**kwargs
)
Run Rust pipeline while ignoring Python-specific kwargs.
Source code in codenib/scip_interface/scip_indexer_rust.py
SCIPTypeScriptIndexer
¶
SCIPTypeScriptIndexer(
project_root: str | Path,
output_dir: str | Path | None = None,
exclude_patterns: list | None = None,
profiler: Profiler | None = None,
decoder_backend: str | None = None,
)
Bases: SCIPIndexerBase
SCIP indexer for TypeScript and JavaScript projects.
Uses the scip-typescript tool to generate SCIP indices for TypeScript/JavaScript codebases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_root
|
str | Path
|
Root directory of the TypeScript/JavaScript project |
required |
output_dir
|
str | Path | None
|
Directory to store output files (defaults to ~/.codenib/{project_name}) |
None
|
exclude_patterns
|
list | None
|
List of patterns to exclude from indexing |
None
|
profiler
|
Profiler | None
|
Profiler instance for performance tracking |
None
|
decoder_backend
|
str | None
|
|
None
|
Methods:
| Name | Description |
|---|---|
generate_index |
Generate SCIP index for the TypeScript/JavaScript project. |
run_pipeline |
Run TypeScript pipeline with language-specific defaults. |
Source code in codenib/scip_interface/scip_indexer_ts.py
generate_index
¶
generate_index(
project_name: str | None = None,
infer_tsconfig: bool = False,
yarn_workspaces: bool = False,
pnpm_workspaces: bool = False,
npm_workspaces: bool = False,
patched_tsconfig: str | None = None,
) -> bool
Generate SCIP index for the TypeScript/JavaScript project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_name
|
str | None
|
Project name (not used by scip-typescript) |
None
|
infer_tsconfig
|
bool
|
Infer tsconfig for JavaScript projects without tsconfig.json |
False
|
yarn_workspaces
|
bool
|
Enable Yarn workspaces support |
False
|
pnpm_workspaces
|
bool
|
Enable pnpm workspaces support |
False
|
npm_workspaces
|
bool
|
Enable npm workspaces support |
False
|
patched_tsconfig
|
str | None
|
Path to a patched tsconfig file to use |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if index generation was successful, False otherwise |
Source code in codenib/scip_interface/scip_indexer_ts.py
run_pipeline
¶
run_pipeline(
output_file: str | None = None,
skip_level: str | None = None,
*,
reset_profiler: bool = True,
report_profile: bool = True,
**kwargs
)
Run TypeScript pipeline with language-specific defaults.
If neither tsconfig.json nor jsconfig.json exists, enable --infer-tsconfig automatically unless caller explicitly sets it.
Source code in codenib/scip_interface/scip_indexer_ts.py
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 | |