Ingest some data - stakwork/stakgraph GitHub Wiki

how to get repo data into a graph

LSP:

Check the main README.md file on how to install LSPs. Install the Go and Typescript ones

Run the code parser:

export REPO_URL="https://github.com/stakwork/demo-repo.git"
export LSP_SKIP_POST_CLONE=1
export USE_LSP=false
OUTPUT_FORMAT=jsonl cargo run --bin index

this will clone the demo-repo into your /tmp directory, and parse it, creating 2 jsonl files (nodes and edges) in ast/examples

in mcp directory:

Bring up neo4j:

docker-compose up -d

Run the server:

yarn

yarn dev

in main dir

curl -X POST \
 -F "nodes=@./ast/examples/demo-repo-nodes.jsonl" \
 -F "edges=@./ast/examples/demo-repo-edges.jsonl" \
 http://localhost:3000/upload

You can see in the server logs, it takes a second to write the data to neo4j

Navigate to

http://localhost:3000/map?name=App&node_type=Function

In your browser to see a simple sub-tree of links from the main App component in the frontend

You can also go to http://localhost:7474/browser/ in your browser to query your codebase in the neo4j UI (username neo4j, password testtest):

MATCH (root {name: 'App'})-[:CALLS|HANDLER|CONTAINS*]->(child)
RETURN root,child

screenshot