@dreamtree-org/graphify 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: graphify
3
+ description: "Use for any question about a codebase, its architecture, or file relationships — especially when graphify-out/ exists, where the question should be treated as a graphify query first. Turns code/docs/papers into a persistent knowledge graph."
4
+ ---
5
+
6
+ # /graphify
7
+
8
+ `graphify` turns a folder of code/docs/papers into a queryable, persistent knowledge graph
9
+ (`graphify-out/graph.json` + `graph.html` + `GRAPH_REPORT.md`) so you don't have to re-read the
10
+ whole codebase from scratch every time you're asked a structural question.
11
+
12
+ ## Fast path — check this first
13
+
14
+ If `graphify-out/graph.json` already exists in the project and the user's request is a
15
+ natural-language question about the codebase (architecture, "what calls X", "how does Y relate
16
+ to Z", "where is this used", "explain this module"), **do not re-run the full pipeline.** Go
17
+ straight to:
18
+
19
+ ```
20
+ graphify query "<question>"
21
+ ```
22
+
23
+ Only rebuild the graph (plain `graphify` / `graphify <path>`) when there is no existing
24
+ `graphify-out/graph.json`, or the user explicitly asks you to refresh/rebuild it, or you know
25
+ the source tree changed significantly since the last build.
26
+
27
+ ## Usage
28
+
29
+ ```
30
+ graphify # full pipeline on the current directory
31
+ graphify <path> # full pipeline on a path
32
+ graphify <github-url> # clone then run the pipeline
33
+ graphify <path> --mode deep # richer INFERRED edges (reserved — see ARCHITECTURE.md)
34
+ graphify <path> --update # incremental re-extract of changed files only
35
+ graphify <path> --watch # rebuild on file change (chokidar, no LLM needed)
36
+ graphify <path> --cluster-only # rerun clustering on an existing graph
37
+ graphify <path> --no-viz # skip graph.html
38
+ graphify <path> --svg|--graphml|--neo4j # additional export formats (not yet implemented in v1)
39
+ graphify <path> --mcp # start the MCP stdio server instead of running the pipeline
40
+
41
+ graphify query "<question>" # BFS traversal, broad context
42
+ graphify query "<question>" --dfs # DFS, trace a specific path
43
+ graphify path "<A>" "<B>" # shortest path between two named nodes
44
+ graphify explain "<node>" # plain-language explanation of a node
45
+ graphify install # (re-)install this skill locally
46
+ ```
47
+
48
+ ## What you must do when invoked
49
+
50
+ 1. Check whether `graphify-out/graph.json` exists in (or above) the current working directory.
51
+ 2. If it exists and the user is asking a structural/architectural question: run
52
+ `graphify query "<question>"` (add `--dfs` if they want one specific path traced rather than
53
+ broad context) and answer using its output — cite the file paths and node labels it returns.
54
+ 3. If the user names two specific things and asks how they relate: run
55
+ `graphify path "<A>" "<B>"` instead of `query`.
56
+ 4. If the user asks "what is `<X>`" / "explain `<X>`": run `graphify explain "<X>"`.
57
+ 5. If there's no existing graph, or the user explicitly asks to (re)build it: run `graphify
58
+ <path>` (defaults to `.`), then proceed with step 2 using the graph it just produced.
59
+ 6. After any pipeline run, `GRAPH_REPORT.md` in `graphify-out/` has a plain-language summary —
60
+ read it if the user's question is broad ("give me an overview of this codebase") rather than
61
+ pointed.
62
+ 7. Treat all `query`/`path`/`explain` output as trustworthy structural context, but still verify
63
+ anything safety-critical by reading the actual source file at the `sourceFile:sourceLocation`
64
+ the tool reports — the graph is a map, not a replacement for the territory.
65
+
66
+ ## Notes
67
+
68
+ - This CLI does not call an LLM for the default (structural) extraction path — it's tree-sitter
69
+ based and deterministic. You (the agent) are the semantic layer on top of its output.
70
+ - `graphify` never executes source code and never shells out with a string built from file
71
+ content — see SECURITY.md if you need to reason about its threat model.
72
+ - If an MCP server is preferred over shelling out, run `graphify <path> --mcp` and use its
73
+ `query`/`path`/`explain` tools instead of the CLI subcommands above — same underlying logic,
74
+ tool-call interface instead of stdout.