Ragex.Analyzers.SCIP.Adapter (Ragex v0.15.0)

View Source

Translates parsed SCIP analysis results into Ragex knowledge graph operations.

Takes the output of Ragex.Analyzers.SCIP.Parser.parse/2 and feeds it into Ragex.Graph.Store via add_node/3 and add_edge/4, making SCIP-indexed code available to all existing Ragex tools (search, graph algorithms, impact analysis, etc.).

Node type mapping

  • SCIP modules -> :module nodes (with source: :scip metadata)
  • SCIP functions -> :function nodes
  • SCIP files -> :file nodes

Edge type mapping

  • SCIP definitions -> :defines edges (module -> function)
  • SCIP references -> :calls edges (function -> function)
  • SCIP imports -> :imports edges (module -> module)

Summary

Functions

Full pipeline: index a project with SCIP, parse, and ingest into the graph.

Ingest a parsed SCIP analysis result into the knowledge graph.

Ingest from an existing SCIP index file (e.g. generated by CI).

Functions

index_and_ingest(project_dir, language, opts \\ [])

@spec index_and_ingest(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

Full pipeline: index a project with SCIP, parse, and ingest into the graph.

Parameters

  • project_dir -- absolute path to the project
  • language -- language to index (e.g. "go", "rust", "java")
  • opts -- passed to Indexer.index/3 and ingest/2

Returns

{:ok, stats} or {:error, reason}

ingest(analysis, opts \\ [])

@spec ingest(
  map(),
  keyword()
) :: {:ok, map()}

Ingest a parsed SCIP analysis result into the knowledge graph.

Parameters

  • analysis -- the result from Parser.parse/2
  • opts -- options:
    • :generate_embeddings -- whether to generate embeddings (default false)

Returns

{:ok, stats} with counts of nodes and edges added.

ingest_from_file(project_dir, index_path, opts \\ [])

@spec ingest_from_file(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

Ingest from an existing SCIP index file (e.g. generated by CI).

Parameters

  • project_dir -- project root
  • index_path -- path to the index.scip file
  • opts -- passed to ingest/2