assistgraph 0.1.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.
- package/LICENSE +21 -0
- package/README.md +321 -0
- package/dist/cli.js +66 -0
- package/package.json +59 -0
- package/skills/claude/SKILL.md +51 -0
- package/skills/codex/SKILL.md +45 -0
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "assistgraph",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "File-level dependency knowledge graph CLI for JS/TS/Python codebases. Produces a JSON graph, an Obsidian vault, and an MCP server so agents like Claude and Codex can query your repo without grepping.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"assistgraph": "./dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"skills",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=18"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"dev": "bun run ./src/cli/index.ts",
|
|
20
|
+
"build": "bun build ./src/cli/index.ts --outfile ./dist/cli.js --target node --format esm --minify --external oxc-parser --banner \"#!/usr/bin/env node\"",
|
|
21
|
+
"prepublishOnly": "bun run typecheck && bun run build",
|
|
22
|
+
"typecheck": "tsc --noEmit",
|
|
23
|
+
"test": "bun test tests/unit",
|
|
24
|
+
"test:all": "bun run typecheck && bun test tests/unit",
|
|
25
|
+
"smoke:mcp": "cd tests/fixtures/cycles-app && bun run ../../../src/cli/index.ts build > /dev/null && cd ../../.. && bun run tests/mcp-smoke.ts tests/fixtures/cycles-app",
|
|
26
|
+
"clean:fixtures": "rm -rf tests/fixtures/*/assistgraph",
|
|
27
|
+
"prepack:inspect": "bun run build && npm pack --dry-run"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"dependency",
|
|
31
|
+
"graph",
|
|
32
|
+
"cli",
|
|
33
|
+
"obsidian",
|
|
34
|
+
"knowledge-graph",
|
|
35
|
+
"mcp",
|
|
36
|
+
"claude",
|
|
37
|
+
"codex",
|
|
38
|
+
"typescript",
|
|
39
|
+
"python",
|
|
40
|
+
"bun"
|
|
41
|
+
],
|
|
42
|
+
"author": "Andy Williamson",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"oxc-parser": "^0.124.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
49
|
+
"@types/bun": "latest",
|
|
50
|
+
"citty": "^0.2.2",
|
|
51
|
+
"graphology": "^0.26.0",
|
|
52
|
+
"graphology-types": "^0.24.8",
|
|
53
|
+
"ignore": "^7.0.5",
|
|
54
|
+
"zod": "^4.3.6"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"typescript": "^5"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: assistgraph
|
|
3
|
+
description: Query the dependency graph of the current repo or folder. Use for any question about file dependencies, what imports what, where a symbol is defined, feature boundaries, circular imports, orphan files, HTTP routes, module hierarchies — BEFORE reaching for grep.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# assistgraph
|
|
7
|
+
|
|
8
|
+
`assistgraph` is a file-level dependency knowledge graph for JS/TS/Python codebases. If the current repo has a graph (`./assistgraph/graph.json`), querying it via the MCP tools is much cheaper than reading source files and grepping imports.
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
|
|
12
|
+
Use the `mcp__assistgraph__*` tools whenever the user asks:
|
|
13
|
+
|
|
14
|
+
- "What does X depend on?" / "Who imports X?"
|
|
15
|
+
- "Where is Y defined?" / "Where is Y used?"
|
|
16
|
+
- "What files are in the auth feature?" / "Show me the feature boundary"
|
|
17
|
+
- "Is there a dependency cycle?"
|
|
18
|
+
- "What are the orphan/dead files?"
|
|
19
|
+
- "How tightly coupled are the ui and app folders?"
|
|
20
|
+
- "What's the architectural backbone of this codebase?" (top hubs)
|
|
21
|
+
- "Show me how X and Y are connected"
|
|
22
|
+
|
|
23
|
+
## Before using the tools
|
|
24
|
+
|
|
25
|
+
1. Check that `./assistgraph/graph.json` exists in the user's cwd.
|
|
26
|
+
2. If not, tell the user to run `assistgraph build` at the repo root (or in whatever folder they want scoped).
|
|
27
|
+
3. The MCP server auto-loads `assistgraph/graph.json` from the cwd where it was started.
|
|
28
|
+
|
|
29
|
+
## Tool cheat sheet
|
|
30
|
+
|
|
31
|
+
| Tool | Use when |
|
|
32
|
+
|---|---|
|
|
33
|
+
| `graph_stats` | Before doing anything else, to understand the scale of the repo |
|
|
34
|
+
| `list_files` | Enumerate files, optionally filtered by language |
|
|
35
|
+
| `get_file` | Full metadata for a known file path |
|
|
36
|
+
| `get_dependencies` | "What does X import?" — supports transitive depth |
|
|
37
|
+
| `get_dependents` | "Who imports X?" — supports transitive depth |
|
|
38
|
+
| `find_path` | "How does X reach Y?" (shortest dep path) |
|
|
39
|
+
| `search_files` | Find a file by basename or path substring |
|
|
40
|
+
| `list_communities` | Enumerate folder-based feature communities |
|
|
41
|
+
| `get_community` | All files in a community |
|
|
42
|
+
| `find_cycles` | All circular dependencies (Tarjan SCC) |
|
|
43
|
+
| `find_orphans` | Files with no dependents; each is flagged `isLikelyEntrypoint` so you can ignore legitimate entrypoints |
|
|
44
|
+
|
|
45
|
+
## Policy
|
|
46
|
+
|
|
47
|
+
- **Prefer the MCP tools over grepping imports manually.** Reading source files for import statements is wasteful when the graph already has the answer.
|
|
48
|
+
- **Only fall back to reading file contents** when you need the actual code (function bodies, comments, implementation details) — the graph has file-level metadata, not source.
|
|
49
|
+
- **Use `get_dependencies` with a `depth` > 1** to trace transitive dependencies (max depth 0 = unlimited).
|
|
50
|
+
- **Use `find_path`** when the user wants to know how two files are connected.
|
|
51
|
+
- **Before making architectural recommendations**, call `list_communities` and `find_cycles` to understand the existing structure.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: assistgraph
|
|
3
|
+
description: Query the dependency graph of the current repo for file-level imports, feature boundaries, cycles, hubs, and orphan files. Prefer this over grep for any import-graph question.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# assistgraph (Codex)
|
|
7
|
+
|
|
8
|
+
This repo may contain a pre-built dependency graph at `./assistgraph/graph.json`. When it exists, use it before grepping or reading files one by one.
|
|
9
|
+
|
|
10
|
+
## How to use
|
|
11
|
+
|
|
12
|
+
If the assistgraph MCP server is connected, prefer calls to `mcp__assistgraph__*` tools for any import-graph question:
|
|
13
|
+
|
|
14
|
+
- `mcp__assistgraph__graph_stats` — size + language breakdown
|
|
15
|
+
- `mcp__assistgraph__get_file` — full metadata for one file
|
|
16
|
+
- `mcp__assistgraph__get_dependencies` — what does this file import?
|
|
17
|
+
- `mcp__assistgraph__get_dependents` — who imports this file?
|
|
18
|
+
- `mcp__assistgraph__find_path` — shortest dependency path between two files
|
|
19
|
+
- `mcp__assistgraph__search_files` — fuzzy locate a file
|
|
20
|
+
- `mcp__assistgraph__list_communities` / `get_community` — feature boundaries
|
|
21
|
+
- `mcp__assistgraph__find_cycles` — dependency cycles
|
|
22
|
+
- `mcp__assistgraph__find_orphans` — files with no dependents (entrypoints flagged)
|
|
23
|
+
|
|
24
|
+
If the MCP server is not connected, use the CLI directly:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
assistgraph build # refresh the graph
|
|
28
|
+
assistgraph query <file> # deps + dependents
|
|
29
|
+
assistgraph stats # summary
|
|
30
|
+
assistgraph audit # cycles, coupling, hubs, orphans
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Workflow
|
|
34
|
+
|
|
35
|
+
1. `assistgraph build` at the repo root if `./assistgraph/graph.json` is missing or stale.
|
|
36
|
+
2. Use the MCP tools (or CLI) to answer structural questions.
|
|
37
|
+
3. Fall back to `rg`/`grep` only for code content, not import structure.
|
|
38
|
+
|
|
39
|
+
## What assistgraph does NOT know
|
|
40
|
+
|
|
41
|
+
- Function-level calls (file-level imports only)
|
|
42
|
+
- Runtime behaviour
|
|
43
|
+
- Type information beyond what's declared in imports
|
|
44
|
+
|
|
45
|
+
Use the graph for structure, read source files for semantics.
|