{"id":21890078,"url":"https://github.com/ejfox/code-network-gen","last_synced_at":"2026-04-15T18:03:04.797Z","repository":{"id":253119198,"uuid":"842520006","full_name":"ejfox/code-network-gen","owner":"ejfox","description":"Generate a graph of nodes/edges from your javascript code","archived":false,"fork":false,"pushed_at":"2026-01-11T04:18:57.000Z","size":272,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-03T21:49:48.134Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ejfox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-14T14:16:03.000Z","updated_at":"2026-01-11T04:19:01.000Z","dependencies_parsed_at":"2024-08-14T16:19:51.089Z","dependency_job_id":null,"html_url":"https://github.com/ejfox/code-network-gen","commit_stats":null,"previous_names":["ejfox/code-network-gen"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ejfox/code-network-gen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejfox%2Fcode-network-gen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejfox%2Fcode-network-gen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejfox%2Fcode-network-gen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejfox%2Fcode-network-gen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ejfox","download_url":"https://codeload.github.com/ejfox/code-network-gen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejfox%2Fcode-network-gen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31853279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-28T11:28:40.438Z","updated_at":"2026-04-15T18:03:04.792Z","avatar_url":"https://github.com/ejfox.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# code-network-gen\n\nparses js/vue codebases and outputs function call networks as csv or gexf files. useful for understanding code structure, dependencies, and architectural patterns.\n\n## quick start\n\nanalyze any codebase in one command:\n\n```bash\nnpx code-network-gen --path . -o my_code_network\n```\n\nthat's it. creates `my_code_network_nodes.csv` and `my_code_network_edges.csv` in seconds.\n\n## example output\n\nhere's what the tool finds when analyzing a simple CLI app with 12 functions across 4 files:\n\n**nodes.csv** (functions and methods):\n```csv\n\"id\",\"label\",\"type\",\"lines\"\n\"data.js:loadBookmarks\",\"loadBookmarks\",\"function\",\"[14-31]\"\n\"data.js:formatTableData\",\"formatTableData\",\"function\",\"[37-54]\"\n\"data.js:reloadBookmarks\",\"reloadBookmarks\",\"function\",\"[56-62]\"\n\"data.js:searchBookmarks\",\"searchBookmarks\",\"function\",\"[64-84]\"\n\"index.mjs:showLoadingScreen\",\"showLoadingScreen\",\"function\",\"[13-85]\"\n\"index.mjs:main\",\"main\",\"function\",\"[88-156]\"\n\"ui.js:viewSummary\",\"viewSummary\",\"function\",\"[21-65]\"\n\"ui.js:updateSummary\",\"updateSummary\",\"function\",\"[67-90]\"\n```\n\n**edges.csv** (function call relationships):\n```csv\n\"source\",\"target\",\"type\"\n\"data.js:global\",\"data.js:loadBookmarks\",\"calls\"\n\"index.mjs:global\",\"index.mjs:showLoadingScreen\",\"calls\"\n\"index.mjs:global\",\"data.js:loadBookmarks\",\"calls\"\n\"index.mjs:global\",\"index.mjs:main\",\"calls\"\n\"ui.js:global\",\"ui.js:viewSummary\",\"calls\"\n\"ui.js:global\",\"data.js:formatTableData\",\"calls\"\n\"ui.js:global\",\"ui.js:updateDisplay\",\"calls\"\n\"ui.js:global\",\"data.js:reloadBookmarks\",\"calls\"\n```\n\nshows clear separation between data handling (`data.js`), user interface (`ui.js`), and application entry point (`index.mjs`). perfect for understanding code architecture at a glance.\n\n**mermaid diagram** (renders directly on GitHub):\n```mermaid\nflowchart TD\n    %% Code Network Analysis - Generated by code-network-gen\n    %% Total nodes: 15, Total edges: 13\n\n    data_js_loadBookmarks[\"loadBookmarks [14-31] (function)\"]\n    data_js_formatTableData[\"formatTableData [37-54] (function)\"]\n    data_js_reloadBookmarks[\"reloadBookmarks [56-62] (function)\"]\n    data_js_searchBookmarks[\"searchBookmarks [64-84] (function)\"]\n    data_js_displayScrapJson[\"displayScrapJson [86-105] (function)\"]\n    index_mjs_showLoadingScreen[\"showLoadingScreen [13-85] (function)\"]\n    index_mjs_main[\"main [88-156] (function)\"]\n    ui_js_stopCurrentAnimation[\"stopCurrentAnimation [14-19] (function)\"]\n    ui_js_viewSummary[\"viewSummary [21-65] (function)\"]\n    ui_js_updateSummary[\"updateSummary [67-90] (function)\"]\n    ui_js_updateDisplay[\"updateDisplay [123-139] (function)\"]\n    ui_js_showBookmarkInfo[\"showBookmarkInfo [719-727] (function)\"]\n    data_js_global\u003e\"data.js (global) (global)\"]\n    index_mjs_global\u003e\"index.mjs (global) (global)\"]\n    ui_js_global\u003e\"ui.js (global) (global)\"]\n\n    %% Connections\n    data_js_global --\u003e data_js_loadBookmarks\n    index_mjs_global --\u003e index_mjs_showLoadingScreen\n    index_mjs_global --\u003e data_js_loadBookmarks\n    index_mjs_global --\u003e index_mjs_main\n    index_mjs_global --\u003e data_js_displayScrapJson\n    ui_js_global --\u003e ui_js_stopCurrentAnimation\n    ui_js_global --\u003e ui_js_viewSummary\n    ui_js_global --\u003e data_js_formatTableData\n    ui_js_global --\u003e ui_js_updateDisplay\n    ui_js_global --\u003e data_js_reloadBookmarks\n    ui_js_global --\u003e ui_js_updateSummary\n    ui_js_global --\u003e data_js_searchBookmarks\n    ui_js_global --\u003e ui_js_showBookmarkInfo\n\n    %% Styling\n    classDef functionClass fill:#e1f5fe,stroke:#01579b,stroke-width:2px\n    classDef methodClass fill:#f3e5f5,stroke:#4a148c,stroke-width:2px\n    classDef classClass fill:#fff3e0,stroke:#e65100,stroke-width:2px\n    classDef vueMethodClass fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px\n    classDef globalClass fill:#ffebee,stroke:#c62828,stroke-width:2px\n    class data_js_loadBookmarks,data_js_formatTableData,data_js_reloadBookmarks,data_js_searchBookmarks,data_js_displayScrapJson,index_mjs_showLoadingScreen,index_mjs_main,ui_js_stopCurrentAnimation,ui_js_viewSummary,ui_js_updateSummary,ui_js_updateDisplay,ui_js_showBookmarkInfo functionClass\n    class data_js_global,index_mjs_global,ui_js_global globalClass\n```\n\nthe diagram clearly shows the three-tier architecture: data layer (blue functions), UI layer (blue functions), and main entry point, with the red global nodes showing module boundaries.\n\n## usage\n\n```bash\nnpx code-network-gen --path \u003cdirectory\u003e [-o output_name] [-f format]\n# or locally: node index.js --path \u003cdirectory\u003e [-o output_name] [-f format]\n```\n\n### options\n\n- `--path` - directory to analyze (required)\n- `-o` - output file prefix (optional, outputs to console if omitted)\n- `-f, --format` - output format: `csv` (default), `gexf` (for Gephi), `graphml` (for yEd, Cytoscape), `dot` (for Graphviz), or `mermaid` (for GitHub, Notion, etc.)\n- `--include-deps` - parse import/require statements to track actual dependency usage\n\n### examples\n\nanalyze current directory:\n\n```bash\nnpx code-network-gen --path .\n```\n\nanalyze with csv output:\n\n```bash\nnpx code-network-gen --path ./src -o my_project\n# creates: my_project_nodes.csv, my_project_edges.csv\n```\n\nanalyze with gexf output for gephi:\n\n```bash\nnpx code-network-gen --path ./src -o my_project --format gexf\n# creates: my_project.gexf (ready to open in Gephi)\n```\n\nanalyze with graphml output for yed/cytoscape:\n\n```bash\nnpx code-network-gen --path ./src -o my_project --format graphml\n# creates: my_project.graphml (ready to open in yEd, Cytoscape, etc.)\n```\n\nanalyze with dot output for graphviz:\n\n```bash\nnpx code-network-gen --path ./src -o my_project --format dot\n# creates: my_project.dot (ready for Graphviz tools)\n```\n\nanalyze with mermaid output for documentation:\n\n```bash\nnpx code-network-gen --path ./src -o my_project --format mermaid\n# creates: my_project.mmd (ready to paste into GitHub, Notion, Obsidian, etc.)\n```\n\ninclude package.json dependencies in analysis:\n\n```bash\nnpx code-network-gen --path . --include-deps -o my_project\n# tracks actual import/require statements to show real dependency usage\n# creates edges like: data.js:global -\u003e package.json:axios (imports)\n```\n\n## what it finds\n\n- function declarations\n- arrow functions\n- class methods\n- vue component methods\n- function calls and their relationships\n\nsupports: `.js`, `.jsx`, `.ts`, `.tsx`, `.vue`\n\n## output formats\n\n### csv format (default)\n\n**nodes.csv**: functions and methods\n\n```csv\nid,label,type,lines\nsrc/utils.js:formatDate,formatDate,function,[15-22]\n```\n\n**edges.csv**: function call relationships\n\n```csv\nsource,target,type\nsrc/app.js:global,src/utils.js:formatDate,calls\n```\n\n### gexf format (for gephi)\n\n**output.gexf**: complete network in xml format\n\n- nodes with id, label, type, and lines attributes\n- edges with source, target, and type attributes\n- ready to import directly into gephi\n- includes proper xml schema and metadata\n\n### graphml format (for yed, cytoscape)\n\n**output.graphml**: universal graph format in xml\n\n- nodes with id, label, type, and lines attributes\n- edges with source, target, and type attributes\n- compatible with yEd, Cytoscape, and other graph tools\n- follows GraphML specification with proper key definitions\n\n### dot format (for graphviz)\n\n**output.dot**: graphviz dot format\n\n- nodes with labels, types, and color coding\n- edges with different styles based on relationship types\n- compatible with dot, neato, fdp, circo, twopi, sfdp\n- ready for rendering with Graphviz tools\n\n### mermaid format (for documentation)\n\n**output.mmd**: mermaid flowchart format\n\n- intelligent filtering to keep diagrams readable (max 50 nodes)\n- different node shapes for functions, methods, classes, vue-methods\n- color-coded styling for different node types\n- ready to paste into GitHub markdown, Notion, Obsidian, etc.\n- renders natively in many documentation platforms\n\n## development\n\n```bash\ngit clone \u003crepo\u003e\nnpm install\nnpm test  # runs meta-analysis (tool analyzes itself)\nnpm run lint\n```\n\n## import into tools\n\n**gephi**:\n\n- gexf: file → open → select the .gexf file (recommended)\n- csv: file → import → choose nodes csv, then edges csv\n\n**yed**: file → open → select the .graphml file (recommended)\n\n**cytoscape**:\n\n- graphml: file → import → network from file → select .graphml file\n- csv: file → import → network from table → select both csv files  \n  **d3/observable**: `d3.csv()` both csv files, standard network format  \n  **python networkx**:\n- gexf: `nx.read_gexf('file.gexf')`\n- graphml: `nx.read_graphml('file.graphml')`\n- csv: `pandas.read_csv()` then `nx.from_pandas_edgelist()`\n\n**r igraph**:\n\n- gexf: `read_graph('file.gexf', format='gexf')`\n- graphml: `read_graph('file.graphml', format='graphml')`\n- csv: `read.csv()` then `graph_from_data_frame()`\n\n**mermaid/documentation platforms**:\n\n- github: paste `.mmd` content into markdown files with ` ```mermaid ` blocks\n- notion: paste as mermaid diagram block\n- obsidian: paste with ` ```mermaid ` code block\n- gitbook: paste as mermaid diagram\n- confluence: use mermaid macro with `.mmd` content\n\n## how it works\n\n1. walks directory tree\n2. parses ast with acorn\n3. extracts function definitions and calls\n4. outputs network graph as csv\n\nthat's it.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fejfox%2Fcode-network-gen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fejfox%2Fcode-network-gen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fejfox%2Fcode-network-gen/lists"}