Architecture No native equivalent

find_circular_deps

Detect circular dependencies in the import graph via DFS. Returns file-level cycles with full import chain.

What it does

find_circular_deps runs depth-first search on the import graph to find circular dependency chains. A → B → C → A is a cycle that can cause initialization order bugs, bundler issues, and architectural confusion.

No native equivalent

Detecting import cycles requires building and traversing the full import graph. No shell command does this. Manual detection involves reading every import statement and mentally tracing chains — impractical in codebases with hundreds of files.

What the output contains

Each cycle includes:

  • Full chain — the file path sequence forming the cycle (e.g., A → B → C → A)
  • Cycle length — number of files involved

When to use it

  • Before refactoring — circular deps constrain how code can be split
  • Architecture audits — cycles indicate tangled module boundaries
  • Build issues — circular imports cause subtle initialization bugs in Node.js and bundler warnings in webpack/vite
  • After detect_communities — cycles often cross community boundaries, suggesting architectural problems

Use file_pattern to scope the search to specific directories.

Benchmark note

This benchmark compares CodeSift against the closest practical native workflow an agent would use for the same task. For some tools, that baseline is a direct shell equivalent such as rg or find. For AST-aware, graph-aware, and LSP-backed tools, the baseline is a multi-step workflow rather than a strictly identical command. Results should be read as agent-workflow comparisons: token cost, call count, and practical context efficiency.