tsort
Perform topological sorting of dependency pairs to determine build order or resolve dependencies, detecting cycles and reporting errors.
Instructions
Perform topological sort on whitespace-separated dependency pairs (partial order), detecting cycles. Read-only, no side effects. Returns JSON with the sorted order; reports cycles with specific node information on error. Use for dependency resolution and build-order calculation. Not for lexical sorting — use 'sort' for alphabetical or numerical ordering. See also 'sort'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| encoding | No | Text encoding. | utf-8 |
| max_lines | No | Maximum JSON lines to emit. | |
| paths | No | Files to sort, or '-' for stdin. Defaults to stdin. | |
| raw | No | Write sorted nodes without a JSON envelope. |