Extract functions, source imports, and cross-function calls from a .sh file.
(path: Path)
| 260 | |
| 261 | |
| 262 | def extract_bash(path: Path) -> dict: |
| 263 | """Extract functions, source imports, and cross-function calls from a .sh file.""" |
| 264 | try: |
| 265 | import tree_sitter_bash as tsbash # noqa: F401 |
| 266 | except ImportError: |
| 267 | return {"nodes": [], "edges": [], "error": "tree-sitter-bash not installed"} |
| 268 | try: |
| 269 | source = _read_source_bytes(path) |
| 270 | except Exception as e: |
| 271 | return {"nodes": [], "edges": [], "error": str(e)} |
| 272 | return extract_bash_source(source, source_path=path, scan_root=active_scan_root()) |
| 273 | |
| 274 | |
| 275 | def extract_bash_source( |