Pipeline.Codebase.QueryEngine (pipeline v0.0.1)

View Source

Core query engine for intelligent codebase analysis.

Provides high-level query operations that combine discovery, analysis, and relationship mapping to answer complex questions about code structure and dependencies.

Summary

Functions

Analyze the impact of changes to a file.

Find dependencies for a given file or the entire project.

Find files based on various criteria.

Find functions, classes, and other code constructs.

Find files related to a given file.

Functions

analyze_impact(context, config)

@spec analyze_impact(
  Pipeline.Codebase.Context.t(),
  keyword()
) :: %{
  directly_affected: [String.t()],
  potentially_affected: [String.t()],
  test_files: [String.t()],
  impact_score: non_neg_integer()
}

Analyze the impact of changes to a file.

Config Options

  • file: File to analyze impact for
  • include_tests: Include test files in impact analysis
  • max_depth: Maximum depth for dependency traversal

find_dependencies(context, config)

@spec find_dependencies(
  Pipeline.Codebase.Context.t(),
  keyword()
) :: %{
  direct: [String.t()],
  transitive: [String.t()],
  file_specific: %{required(String.t()) => [String.t()]}
}

Find dependencies for a given file or the entire project.

Config Options

  • for_file: Specific file to analyze dependencies for
  • include_transitive: Include transitive dependencies
  • type: "direct", "transitive", "all"
  • language: Filter by programming language

find_files(context, criteria)

@spec find_files(
  Pipeline.Codebase.Context.t(),
  keyword()
) :: [String.t()]

Find files based on various criteria.

Criteria Options

  • type: "main", "test", "config", "source"
  • pattern: Glob pattern to match
  • language: Programming language
  • extension: File extension
  • contains: String that must be in file path
  • exclude_tests: Boolean to exclude test files
  • related_to: Find files related to given file
  • modified_since: Date string (ISO format)
  • size_min: Minimum file size in bytes
  • size_max: Maximum file size in bytes

find_functions(context, config)

@spec find_functions(
  Pipeline.Codebase.Context.t(),
  keyword()
) :: [
  %{
    name: String.t(),
    type: String.t(),
    file: String.t(),
    line: non_neg_integer() | nil,
    signature: String.t() | nil
  }
]

Find functions, classes, and other code constructs.

Config Options

  • name: Function/class name to search for
  • pattern: Regex pattern to match
  • type: "function", "class", "module", "constant"
  • in_file: Specific file to search in
  • in_files: List of files to search in
  • language: Programming language filter