get_circular_imports
Identify circular import chains that cause dependency cycles, enabling you to refactor and break them. Uses SCC analysis, ignores non-import edges, and skips test files by default.
Instructions
Find circular dependency chains in the import graph (Kosaraju SCC algorithm). Considers only import-typed edges (esm_imports / imports / py_imports / py_reexports); call, reference, member_of, and test_covers edges are NOT walked. Test files (paths matching tests/**, **/.test., **/.spec., /tests/) are excluded by default to suppress spurious test↔source cycles — pass include_tests: true to opt in. Use to detect and break dependency cycles. Read-only. Returns JSON: { total_cycles, cycles: [{ files, length }] }.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_tests | No | Include test files in cycle detection. Default false — paths matching tests/**, **/*.test.*, **/*.spec.*, **/__tests__/** are excluded because they routinely produce spurious cycles (test imports source, while an indexer scan adds a reverse imports edge into the fixture). |