Import & Dependency Graph Extractor

Paste one or more source files and map every import — file-to-file edges, external packages, dependents, orphans, leaves, and circular dependencies. JS/TS, Python, Rust, and Go; text, JSON, Graphviz DOT, or Mermaid. Runs entirely in your browser.

Try:
Dependency graph

About this tool

Import Graph Extractor turns pasted source files into a dependency graph you can read, diff, or paste into a graph renderer. It is designed for quick architecture checks when you cannot or do not want to run a project-wide crawler: paste a few files, add === path/to/file.ext === headers, and see which files import each other.

The parser extracts common dependency forms across:

For JavaScript/TypeScript, relative imports are resolved against pasted file paths, including extensionless and index.* imports. For Python, dotted module names are matched to pasted .py files and package __init__.py files. Rust mod name; declarations resolve to sibling module files. Go imports and Rust crate:: / super:: paths are listed, but not resolved to arbitrary project files.

Worked example

Paste this input:

=== src/app.js ===
import { greet } from './util/greet';
import React from 'react';
const fs = require('fs');

=== src/util/greet.js ===
export const greet = () => 'hi';

With Language = auto, Output format = text, Include external dependencies = on, and Detect circular dependencies = on, the report includes:

Output formats

Limits and edge cases

This is a pasted-source analyzer, not a full package manager or compiler. It does not crawl directories, read node_modules, parse tsconfig path aliases, run Python import hooks, evaluate conditional imports, or render SVG/PNG images. Aliases and dynamic expressions that are not string literals are intentionally ignored. The input cap is about 2 MB so the browser stays responsive.

For command-line use, the same functionality is available through the generated CLI. Example:

gizza tool import-graph-extractor input="=== a.js ===
import './b';
=== b.js ===
export const b = 1;" language=auto format=text include_external=true detect_cycles=true

FAQ

How do I paste multiple files?

Put a header line before each file, using either === path/to/file.ext === or --- path/to/file.ext ---. The path becomes the graph node name, and in auto language mode the extension (.js, .ts, .py, .rs, or .go) tells the analyzer which import rules to use for that file.

Can it find circular dependencies?

Yes. When Detect circular dependencies is enabled, the tool computes cycles among pasted files and shows loops such as pkg/a.py -> pkg/b.py -> pkg/a.py. External packages are not part of cycle detection because they are not pasted source files.

Why are some imports listed as unresolved?

An import is unresolved when it looks like a file reference but no matching pasted file was provided, or when the language feature needs project context the tool does not have. For example, ./missing in JavaScript, mod helper; without helper.rs, or Rust use crate::... paths may appear there.

Does it replace project-wide tools like dependency graph crawlers?

No. It complements them for quick, local checks on selected files. Full crawlers can read a filesystem, package manager config, TypeScript path aliases, and generated files; this browser tool only analyzes the source text you paste.

Developer & Automation Access

Run it from the terminal

Same engine as this page, headless — via the gizza CLI:

gizza tool import-graph-extractor "=== src/app.js ===
import { greet } from './util/greet';
import React from 'react';

=== src/util/greet.js ===
export const greet = () => 'hi';"

New to the CLI? Get gizza →

Open it by URL

Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:

https://gizza.ai/tools/import-graph-extractor/?input=%3D%3D%3D%20src%2Fapp.js%20%3D%3D%3D%0Aimport%20%7B%20greet%20%7D%20from%20%27.%2Futil%2Fgreet%27%3B%0Aimport%20React%20from%20%27react%27%3B%0A%0A%3D%3D%3D%20src%2Futil%2Fgreet.js%20%3D%3D%3D%0Aexport%20const%20greet%20%3D%20%28%29%20%3D%3E%20%27hi%27%3B&language=auto&format=text&include_external=true&detect_cycles=true

Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.