Skip to content

Latest commit

 

History

History
78 lines (56 loc) · 3.55 KB

README.md

File metadata and controls

78 lines (56 loc) · 3.55 KB

vis-graphify

Build a code knowledge graph in Vis with graphify. Search code, trace the effect of changes, make exact refactors, and keep concepts and documents in a knowledge base.

Install

Requires Vis (vis-agent) 0.8.0 or newer and Python 3.12 or newer.

vis-agent extension install Blockether/vis-graphify --trust

Run /reload in your Vis session.

Use

Ask in chat, for example, "Who calls run-tests in this project?" Graphify builds the code graph from tree-sitter syntax trees. A build makes no model call and sends no code.

Tool Result
graphify.build Create or update the local code graph.
graphify.status Show node, edge, and file counts and the build time.
graphify.search Find code, knowledge nodes, and documents.
graphify.explain Show a node, its connections, and its notes.
graphify.shortest_path Find the shortest link between two nodes.
graphify.hubs List the nodes with the most calls.
graphify.affected Find callers, importers, and other users of a symbol.
graphify.references Find each exact reference to a symbol.
graphify.rename Rename a symbol and update its references.
graphify.add_parameter Add a parameter and pass a value at each call.
graphify.move Move a definition and update its references.
graphify.move_file Move a file and rename its module or namespace.
graphify.domain Map service commands, queries, and events.
graphify.crap Rank Clojure and Python functions by complexity and test coverage.
graphify.write Add or edit knowledge records.
graphify.ingest Add a document to the knowledge base.
graphify.validate Check the knowledge base against its ontology.
graphify.undo Reverse a knowledge base edit.
graphify.snapshot Copy a knowledge source for offline use.
graphify.publish Export the knowledge base as static HTML.
graphify.serve Open or stop the knowledge base server.

Refactor tools show a preview by default. Set apply=True to write the changes. See the code graph reference and knowledge base guide for options and examples.

From your code

py3 calls the tools as await graphify.affected("src/app/util.py::load"). The SDK calls are synchronous and work inside a Vis extension callback:

from blockether import vis


class Impact:
    """Report what a change to one symbol can break."""

    def report(self, node: str, within: str = "") -> list[str]:
        """List the functions that a change to `node` can affect."""
        impact = vis.tools.graphify.affected(node, within=within)
        return list(impact.functions)


ext = vis.Extension("impact-check", description="Blast radius of a symbol.")
ext.expose(Impact(), name="impact_check")

ImpactResult also holds impacts (nearest first), private, files and truncated; check the field names with doc("graphify.affected"). vis.tools.graphify raises vis.errors.NoCall in code that Vis does not call, and vis.errors.NotBound outside Vis.

Configuration

To use a hosted knowledge base by default, set Knowledge base server and Knowledge base token in Vis Settings under Extensions, then vis-graphify. A project can set GRAPHIFY_KB_URL and GRAPHIFY_KB_TOKEN instead, as Connect without the form shows.

Development

uv sync
uvx ruff format --check . && uvx ruff check .
uv run --with pytest pytest tests -q