Skip to content
 
 

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Graphify Toolkit

Part of AgentStack

Turn any codebase into a queryable knowledge graph.
One command. Zero cloud dependencies. Works offline.

MIT License CI GitHub Stars


Graphify builds a JSON knowledge graph from your source code, documentation, and project structure. Query it from your terminal — find dependencies, trace impact, discover architectural bottlenecks.

No SaaS account. No API keys. Just bash, jq, and python3.

Quick Start

# Install
git clone https://github.com/FvdHMBAI/graphify-toolkit.git
cd graphify-toolkit && bash install.sh

# Build a graph
graphify-core.sh /path/to/your/project

# Query it
graphify-query.sh search "auth"
graphify-query.sh impact "src/auth/middleware.ts"
graphify-query.sh path "login" "database"
graphify-query.sh god-nodes --top 10

Three commands from zero to a fully queryable knowledge graph.

What It Does

Graphify extracts nodes (files, functions, classes, tables, headings) and edges (imports, exports, contains, depends_on) from your codebase:

your-project/
  src/auth/middleware.ts    →  [file] middleware.ts
    export authMiddleware   →    [function] authMiddleware()
    import verifyToken      →    [edge] imports → jwt.ts
  src/utils/jwt.ts          →  [file] jwt.ts
    export verifyToken      →    [function] verifyToken()

Output: graphify-out/graph.json — a portable JSON file you can query, merge, visualize, or feed into any tool.

Supported Languages

Language Extraction
TypeScript / JavaScript imports, exports, require()
Python import/from, def/class
Go imports, exported functions
Bash source/. commands, function definitions
SQL CREATE TABLE, FROM/JOIN references
Markdown links, headings
YAML / JSON / TOML structure
Dockerfile / Terraform structure

Query Commands

Search

Find nodes matching a term:

$ graphify-query.sh search "auth"

Found 6 nodes matching 'auth':

  [file        ] middleware.ts                             src/auth/middleware.ts
  [function    ] authMiddleware()                          src/auth/middleware.ts
  [function    ] requireAdmin()                            src/auth/middleware.ts
  [class       ] AuthContext                               src/auth/middleware.ts
  [directory   ] auth                                      src/auth

Impact Analysis

The killer feature. Before you touch a file, see what breaks:

$ graphify-query.sh impact "middleware.ts"

  File: middleware.ts
  Direct nodes: 4
  Affected (depth 2): 16
    [directory] api, docs, utils, auth
    [file] jwt.ts, users.ts, architecture.md
    [function] createToken(), verifyToken(), listUsers(), createUser(), getUserById()
    [heading] Security, Data flow, Architecture, Overview

  WARNING: HIGH IMPACT — 16 affected nodes!

Or check all uncommitted changes at once:

graphify-query.sh impact --diff

Shortest Path

Trace how two concepts are connected:

$ graphify-query.sh path "middleware" "jwt"

Path from 'middleware.ts' to 'jwt.ts' (2 hops):

     middleware.ts                              (file)
  -> authMiddleware()                           (function) [exports]
  -> jwt.ts                                     (file) [imports]

God Nodes

Find the most connected modules — your architectural bottlenecks:

$ graphify-query.sh god-nodes --top 5

=== Top 5 most connected nodes ===

    8 connections  [file      ]  middleware.ts            src/auth/middleware.ts
    6 connections  [file      ]  users.ts                src/api/users.ts
    5 connections  [file      ]  jwt.ts                  src/utils/jwt.ts

Statistics

$ graphify-query.sh stats

=== Graph Statistics ===

  Nodes:       22
  Edges:       23
  Communities: 1

  Node types:
    function                 8
    file                     5
    directory                4

  Edge types:
    exports                 13
    contains                 5
    imports                  5

Multi-Repo Support

Build graphs across multiple repositories and merge them into one system-wide graph:

# Set your repos
export GRAPHIFY_REPOS="/path/to/api:/path/to/frontend:/path/to/shared-lib"

# Build all + merge
graphify-build.sh

# Query across everything
graphify-query-all.sh "Which services call the payment API?"

The merge engine detects when two repos share function signatures (e.g., an API client calling an API server) and creates shares_implementation edges automatically — revealing architectural dependencies no single-repo analysis can surface.

CI/CD Integration

Pre-Commit Impact Gate

Block commits that affect too many nodes:

cp examples/ci-integration.sh .git/hooks/pre-commit
export GRAPHIFY_IMPACT_THRESHOLD=15

Incremental Builds

Only re-extract changed files (uses git diff internally):

graphify-core.sh /path/to/project --update

Nightly Cron

0 4 * * * graphify-build.sh /path/to/repo1 /path/to/repo2 >> /var/log/graphify.log 2>&1

GitHub Actions

- name: Build knowledge graph
  run: |
    sudo apt-get install -y jq
    ./graphify-toolkit/core/graphify-core.sh .
    ./graphify-toolkit/core/graphify-query.sh stats

Claude Code Skill

Graphify Toolkit includes a drop-in Claude Code skill for interactive graph exploration:

# Install the skill
cp -r skill/* ~/.claude/skills/graphify/

# Then in Claude Code:
/graphify                              # build graph for current directory
/graphify query "How does auth work?"  # query the graph
/graphify path "AuthModule" "Database" # shortest path

Architecture

graphify-toolkit/
  core/
    graphify-core.sh         # Graph builder: code → graph.json (standalone)
    graphify-query.sh        # Query engine: search, path, impact, stats, god-nodes
  bin/
    graphify-build.sh        # Multi-repo build orchestrator
    graphify-merge.sh        # Cross-repo graph merger (auto cross-links)
    graphify-impact.sh       # Standalone impact analysis
    graphify-query-all.sh    # Cross-repo query
    graphify-auto-rebuild.sh # Incremental rebuild (cron/hook)
  examples/
    sample-project/          # Working example with TS + Markdown
    output/                  # Example graph.json
    ci-integration.sh        # Pre-commit hook example
  tests/
    test-graphify.sh         # Test suite (31 tests)
  skill/
    SKILL.md                 # Claude Code skill integration

Graph Format

{
  "nodes": [
    {
      "id": "src_auth_middleware_ts",
      "label": "middleware.ts",
      "type": "file",
      "file_type": "typescript",
      "source_file": "src/auth/middleware.ts",
      "metadata": { "language": "typescript", "lines": 18, "kind": "file" },
      "community": "0"
    }
  ],
  "links": [
    {
      "source": "src_auth_middleware_ts",
      "target": "src_utils_jwt_ts",
      "relation": "imports",
      "confidence": "EXTRACTED",
      "weight": 1.0
    }
  ],
  "stats": { "total_nodes": 22, "total_edges": 23, "communities": 1 }
}

Compatible with D3.js, Gephi, Neo4j, Obsidian Canvas, or any tool that reads JSON graphs.

How It Compares

Feature Graphify Toolkit Sourcegraph GitHub Code Search grep
Self-hosted Yes Enterprise only No Yes
Dependencies bash + jq + python3 Docker + infra N/A None
Knowledge graph Full (nodes + edges + communities) Code Intel (limited) No No
Impact analysis Depth-configurable, pre-commit gate Limited No No
Multi-repo merge Auto cross-repo edge detection Yes Yes Manual
Offline Yes No No Yes
Cost Free $$$ Free (limited) Free
Setup time 30 seconds Hours N/A N/A

Optional: Semantic Enrichment

The standalone core uses pure AST extraction (free, no API key). For richer semantic analysis, install the graphify Python package:

pip install graphifyy
export GEMINI_API_KEY="..."  # optional: enables semantic extraction
graphify-build.sh /path/to/project  # uses graphify if available, falls back to core

Environment Variables

Variable Default Description
GRAPHIFY_GRAPH Auto-detected Path to graph.json for queries
GRAPHIFY_PROJECT Current directory Project root
GRAPHIFY_REPOS Colon-separated repo paths for multi-repo
GRAPHIFY_SYSTEM_DIR ./system-graph Merged graph output directory
GRAPHIFY_IMPACT_THRESHOLD 20 Impact warning threshold
GEMINI_API_KEY Optional: semantic extraction via Gemini

Requirements

  • Bash 4+
  • jq
  • Python 3.8+ (stdlib only, no pip packages)
  • Linux or macOS

License

MIT


Built by Prompt & Build.
Used in production to orchestrate knowledge graphs across 7 repositories and 15+ applications.

If Graphify Toolkit helps you understand your codebase, consider giving it a star. It helps others find it.

About

Multi-repo knowledge graph orchestration — extends graphify with cross-repo merge, impact analysis, CI/CD integration, and Claude Code skill

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages