polycodegraph 0.1.0__tar.gz
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.
- polycodegraph-0.1.0/.gitignore +44 -0
- polycodegraph-0.1.0/CHANGELOG.md +304 -0
- polycodegraph-0.1.0/LICENSE +21 -0
- polycodegraph-0.1.0/PKG-INFO +687 -0
- polycodegraph-0.1.0/README.md +629 -0
- polycodegraph-0.1.0/codegraph/__init__.py +10 -0
- polycodegraph-0.1.0/codegraph/analysis/__init__.py +30 -0
- polycodegraph-0.1.0/codegraph/analysis/_common.py +125 -0
- polycodegraph-0.1.0/codegraph/analysis/blast_radius.py +63 -0
- polycodegraph-0.1.0/codegraph/analysis/cycles.py +79 -0
- polycodegraph-0.1.0/codegraph/analysis/dataflow.py +861 -0
- polycodegraph-0.1.0/codegraph/analysis/dead_code.py +165 -0
- polycodegraph-0.1.0/codegraph/analysis/hotspots.py +68 -0
- polycodegraph-0.1.0/codegraph/analysis/infrastructure.py +439 -0
- polycodegraph-0.1.0/codegraph/analysis/metrics.py +52 -0
- polycodegraph-0.1.0/codegraph/analysis/report.py +222 -0
- polycodegraph-0.1.0/codegraph/analysis/roles.py +323 -0
- polycodegraph-0.1.0/codegraph/analysis/untested.py +79 -0
- polycodegraph-0.1.0/codegraph/cli.py +1506 -0
- polycodegraph-0.1.0/codegraph/config.py +64 -0
- polycodegraph-0.1.0/codegraph/embed/__init__.py +35 -0
- polycodegraph-0.1.0/codegraph/embed/chunker.py +120 -0
- polycodegraph-0.1.0/codegraph/embed/embedder.py +113 -0
- polycodegraph-0.1.0/codegraph/embed/query.py +181 -0
- polycodegraph-0.1.0/codegraph/embed/store.py +360 -0
- polycodegraph-0.1.0/codegraph/graph/__init__.py +0 -0
- polycodegraph-0.1.0/codegraph/graph/builder.py +212 -0
- polycodegraph-0.1.0/codegraph/graph/schema.py +69 -0
- polycodegraph-0.1.0/codegraph/graph/store_networkx.py +55 -0
- polycodegraph-0.1.0/codegraph/graph/store_sqlite.py +249 -0
- polycodegraph-0.1.0/codegraph/mcp_server/__init__.py +6 -0
- polycodegraph-0.1.0/codegraph/mcp_server/server.py +933 -0
- polycodegraph-0.1.0/codegraph/parsers/__init__.py +0 -0
- polycodegraph-0.1.0/codegraph/parsers/base.py +70 -0
- polycodegraph-0.1.0/codegraph/parsers/go.py +570 -0
- polycodegraph-0.1.0/codegraph/parsers/python.py +1707 -0
- polycodegraph-0.1.0/codegraph/parsers/typescript.py +1397 -0
- polycodegraph-0.1.0/codegraph/py.typed +0 -0
- polycodegraph-0.1.0/codegraph/resolve/__init__.py +4 -0
- polycodegraph-0.1.0/codegraph/resolve/calls.py +480 -0
- polycodegraph-0.1.0/codegraph/review/__init__.py +31 -0
- polycodegraph-0.1.0/codegraph/review/baseline.py +32 -0
- polycodegraph-0.1.0/codegraph/review/differ.py +211 -0
- polycodegraph-0.1.0/codegraph/review/hook.py +70 -0
- polycodegraph-0.1.0/codegraph/review/risk.py +219 -0
- polycodegraph-0.1.0/codegraph/review/rules.py +342 -0
- polycodegraph-0.1.0/codegraph/viz/__init__.py +17 -0
- polycodegraph-0.1.0/codegraph/viz/_style.py +45 -0
- polycodegraph-0.1.0/codegraph/viz/dashboard.py +740 -0
- polycodegraph-0.1.0/codegraph/viz/diagrams.py +370 -0
- polycodegraph-0.1.0/codegraph/viz/explore.py +453 -0
- polycodegraph-0.1.0/codegraph/viz/hld.py +683 -0
- polycodegraph-0.1.0/codegraph/viz/html.py +115 -0
- polycodegraph-0.1.0/codegraph/viz/mermaid.py +111 -0
- polycodegraph-0.1.0/codegraph/viz/svg.py +77 -0
- polycodegraph-0.1.0/codegraph/web/__init__.py +4 -0
- polycodegraph-0.1.0/codegraph/web/server.py +165 -0
- polycodegraph-0.1.0/codegraph/web/static/app.css +664 -0
- polycodegraph-0.1.0/codegraph/web/static/app.js +919 -0
- polycodegraph-0.1.0/codegraph/web/static/index.html +112 -0
- polycodegraph-0.1.0/codegraph/web/static/views/architecture.js +1671 -0
- polycodegraph-0.1.0/codegraph/web/static/views/graph3d.css +564 -0
- polycodegraph-0.1.0/codegraph/web/static/views/graph3d.js +999 -0
- polycodegraph-0.1.0/codegraph/web/static/views/graph3d_transform.js +984 -0
- polycodegraph-0.1.0/codegraph/workspace/__init__.py +34 -0
- polycodegraph-0.1.0/codegraph/workspace/config.py +110 -0
- polycodegraph-0.1.0/codegraph/workspace/operations.py +294 -0
- polycodegraph-0.1.0/pyproject.toml +109 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.egg-info/
|
|
6
|
+
.eggs/
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
.pytest_cache/
|
|
10
|
+
.mypy_cache/
|
|
11
|
+
.ruff_cache/
|
|
12
|
+
.coverage
|
|
13
|
+
htmlcov/
|
|
14
|
+
.tox/
|
|
15
|
+
|
|
16
|
+
# Virtual envs
|
|
17
|
+
.venv/
|
|
18
|
+
venv/
|
|
19
|
+
env/
|
|
20
|
+
|
|
21
|
+
# codegraph artifacts
|
|
22
|
+
.codegraph/
|
|
23
|
+
|
|
24
|
+
# OS / IDE
|
|
25
|
+
.DS_Store
|
|
26
|
+
.idea/
|
|
27
|
+
.vscode/
|
|
28
|
+
*.swp
|
|
29
|
+
|
|
30
|
+
# Secrets
|
|
31
|
+
.env
|
|
32
|
+
.env.*
|
|
33
|
+
!.env.example
|
|
34
|
+
|
|
35
|
+
# Playwright MCP session artifacts (screenshots, traces, console logs)
|
|
36
|
+
.playwright-mcp/
|
|
37
|
+
# Local screenshot scratch files (visual smoke tests)
|
|
38
|
+
three-d-*.png
|
|
39
|
+
.claude/
|
|
40
|
+
.planning/
|
|
41
|
+
!.planning/SESSION_HANDOFF.md
|
|
42
|
+
!.planning/PLAN_V0_3_UNIFIED_TRACE.md
|
|
43
|
+
.codegraph.yml
|
|
44
|
+
uv.lock
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
> 0.1.0 is in-progress / pre-release. The README, CLI, MCP server, and 3D
|
|
11
|
+
> dashboard reflect the current state of `main`, but the package has not yet
|
|
12
|
+
> been pushed to PyPI. Items below describe what has shipped on `main` and
|
|
13
|
+
> will roll into the eventual 0.1.0 tag. Install from source for now
|
|
14
|
+
> (`pip install -e .`).
|
|
15
|
+
|
|
16
|
+
### Post-launch-sprint additions (still pre-release)
|
|
17
|
+
|
|
18
|
+
#### Go language support — `.go` files parse + analyze cleanly
|
|
19
|
+
|
|
20
|
+
The Go ecosystem is the single biggest community pull outside Python/JS,
|
|
21
|
+
and a code graph that spans services + tooling + libraries was the
|
|
22
|
+
obvious next move. v1 of the Go extractor lives at
|
|
23
|
+
`codegraph/parsers/go.py` and produces the same node/edge shape as the
|
|
24
|
+
Python and TypeScript parsers, so every existing tool (`analyze`,
|
|
25
|
+
`workspace_blast_radius`, MCP queries) works on Go code immediately.
|
|
26
|
+
|
|
27
|
+
- **New module** `codegraph/parsers/go.py` — tree-sitter Go grammar via
|
|
28
|
+
`tree-sitter-go>=0.23` (added to `pyproject.toml`).
|
|
29
|
+
- **Node kinds emitted**: `MODULE` (one per `.go` file, qualname = the
|
|
30
|
+
`package X` name so files in the same package share an addressable
|
|
31
|
+
namespace), `FUNCTION` (top-level `func`), `METHOD` (qualname
|
|
32
|
+
`module.ReceiverType.Name`, with receiver + pointer-ness in metadata),
|
|
33
|
+
`CLASS` (the closest analog to Go's `type X struct {...}` and
|
|
34
|
+
`type X interface {...}`), `TEST` (`*_test.go` files).
|
|
35
|
+
- **Edge kinds emitted**: `DEFINED_IN`, `IMPORTS` (per-import-path,
|
|
36
|
+
preserves aliases as metadata), `CALLS` (bare names like `Foo`,
|
|
37
|
+
dotted-package like `fmt.Println`, receiver-method like `g.Greet`),
|
|
38
|
+
`INHERITS` (Go composition — embedded fields in a struct become
|
|
39
|
+
`INHERITS` edges to the embedded type).
|
|
40
|
+
- **Registry hookup**: `builder.py` imports `codegraph.parsers.go` at
|
|
41
|
+
module load so the `@register_extractor` decorator fires. `init`'s
|
|
42
|
+
language-detection map now includes `go: [".go"]`.
|
|
43
|
+
- **Smoke test against `spf13/cobra`**: 36 files parsed, 715 Go nodes
|
|
44
|
+
(427 functions + 168 methods + 17 structs/interfaces + 17 test files
|
|
45
|
+
+ 19 modules), 2541 CALLS edges, 190 IMPORTS, 0 errors, 0.25s.
|
|
46
|
+
- **19 new parser tests** at `tests/test_go_parser.py` covering every
|
|
47
|
+
emitted node/edge shape plus edge cases (empty file, missing file,
|
|
48
|
+
test-file detection, aliased imports, pointer receivers).
|
|
49
|
+
|
|
50
|
+
Limitations the parser is honest about up front:
|
|
51
|
+
|
|
52
|
+
- Generic type parameters land as text in metadata; not in qualnames.
|
|
53
|
+
- Interface satisfaction (does `*Foo` implement `Bar`?) is not detected
|
|
54
|
+
by the parser — that needs a whole-package pass and belongs in the
|
|
55
|
+
resolver layer, not the extractor.
|
|
56
|
+
- `init()` and `main()` get no special treatment yet.
|
|
57
|
+
|
|
58
|
+
#### Cross-repo workspace mode — treat N repos as one mental unit
|
|
59
|
+
|
|
60
|
+
Solo devs and small teams routinely switch between 3–10 repos a day. Until
|
|
61
|
+
now `codegraph` was strictly single-repo — every command resolved against
|
|
62
|
+
the `.codegraph/graph.db` in the current working directory. The new
|
|
63
|
+
`codegraph workspace` subcommand group lets you register N repos once and
|
|
64
|
+
then query them as a union.
|
|
65
|
+
|
|
66
|
+
- **New CLI subcommands** (`codegraph/cli.py`):
|
|
67
|
+
- `codegraph workspace init` — create `~/.codegraph/workspace.yml`
|
|
68
|
+
- `codegraph workspace add <repo>` — register a repo (validates that the
|
|
69
|
+
path exists and is a directory; idempotent)
|
|
70
|
+
- `codegraph workspace remove <repo>` — deregister (the per-repo
|
|
71
|
+
`.codegraph/graph.db` is untouched, only the membership)
|
|
72
|
+
- `codegraph workspace list` — table of registered repos and whether
|
|
73
|
+
each has a built graph
|
|
74
|
+
- `codegraph workspace status` — per-repo git state: branch, dirty file
|
|
75
|
+
count, last commit subject + timestamp, graph freshness, error notes
|
|
76
|
+
- `codegraph workspace sync [--only <name>]` — rebuild the graph for
|
|
77
|
+
every registered repo (or just one)
|
|
78
|
+
- **New module** at `codegraph/workspace/`:
|
|
79
|
+
- `config.py` — `WorkspaceConfig` Pydantic model + YAML load/save with
|
|
80
|
+
`CODEGRAPH_WORKSPACE_FILE` env-var override (useful for tests +
|
|
81
|
+
per-shell workspaces)
|
|
82
|
+
- `operations.py` — pure functions returning JSON-safe dicts so the CLI
|
|
83
|
+
and MCP server share one implementation
|
|
84
|
+
- **3 new MCP tools** (`codegraph/mcp_server/server.py`):
|
|
85
|
+
- `workspace_state()` — git + graph state for every registered repo
|
|
86
|
+
- `workspace_diff_since(ref="main")` — cross-repo file changes since a
|
|
87
|
+
git ref; combines committed (`<ref>...HEAD`) and uncommitted (`HEAD`)
|
|
88
|
+
- `workspace_blast_radius(symbol, depth=None)` — unioned blast radius
|
|
89
|
+
across all repos; reuses the existing single-repo `blast_radius()` so
|
|
90
|
+
behaviour matches exactly per-repo
|
|
91
|
+
- **Pollution prevention** — workspace MCP tools self-load their per-repo
|
|
92
|
+
graphs from the workspace config; the MCP `_call_tool` dispatch
|
|
93
|
+
bypasses the usual `_load_graph()` for `workspace_*` names so the
|
|
94
|
+
server doesn't materialize a stray `.codegraph/graph.db` in the cwd
|
|
95
|
+
when the user only calls workspace tools.
|
|
96
|
+
- **Conflict handling** — when the same memory `id` exists on both sides
|
|
97
|
+
with different bodies at the same `updated_at`, the conflicting remote
|
|
98
|
+
copy is saved as `<id>.conflict-<timestamp>.md` next to the local
|
|
99
|
+
file for manual merging. Sync never silently clobbers.
|
|
100
|
+
- **39 new tests** under `tests/test_workspace_{config,ops,cli,mcp}.py`
|
|
101
|
+
covering config round-trip, real-tmp git-repo state probes,
|
|
102
|
+
CliRunner-based CLI integration, and direct MCP handler invocation.
|
|
103
|
+
Full suite remains green at 576 passing (was 537).
|
|
104
|
+
- **README updated** with a new "Cross-repo Workspace mode" collapsible
|
|
105
|
+
block under CLI subcommands; MCP tools table now lists 18 total (was 15).
|
|
106
|
+
|
|
107
|
+
#### v0.3 unified trace — Architecture view shows the real chain
|
|
108
|
+
|
|
109
|
+
- **Per-handler `dataflow` field on the HLD payload** (PR #22). Each route
|
|
110
|
+
entry now carries a `dataflow.hops[]` array shaped to the v0.3 contract,
|
|
111
|
+
so the dashboard can render the actual frontend → backend → DB chain
|
|
112
|
+
without re-running analysis client-side.
|
|
113
|
+
- **Phase 4 of the Learn Mode lifecycle modal renders real hops** (PR #23).
|
|
114
|
+
The previously-generic "project-specific data layer" phase now shows
|
|
115
|
+
the actual handler → service → repo → model chain across **sequence,
|
|
116
|
+
pipeline, and diagram** modes. Empty / low-confidence states render
|
|
117
|
+
gracefully with a "no trace data" panel.
|
|
118
|
+
- **Argument-flow propagation — pick a parameter, watch it travel** (PRs #24,
|
|
119
|
+
#25). Per-hop `arg_flow: dict[str, str | None]` mapping starting keys to
|
|
120
|
+
their locally-renamed names. Frontend renders a chip-strip param picker
|
|
121
|
+
and animates the selected param along the swimlane (sequence) or the
|
|
122
|
+
bezier path (diagram, via SMIL `animateMotion`). Rename annotations
|
|
123
|
+
(`(was userId)`) surface where the local name diverges. Snake_case ↔
|
|
124
|
+
camelCase ↔ PascalCase all normalise to the same key.
|
|
125
|
+
- **ROUTE entry hop args backfilled from handler params** (PR #26). The
|
|
126
|
+
trace walker can't supply args at the entry hop (no incoming CALLS edge),
|
|
127
|
+
so URL-template handlers (e.g. `/api/users/{user_id}`) used to produce
|
|
128
|
+
empty `arg_flow`. Backfilled from the handler node's DF0 `metadata.params`
|
|
129
|
+
(skipping `self` / `cls`). Closes the launch demo's hero shot.
|
|
130
|
+
|
|
131
|
+
#### Cleanup + analyzer hardening
|
|
132
|
+
|
|
133
|
+
- **Examples directory excluded from dead-code / untested analysis**
|
|
134
|
+
(PR #19) — `examples/cross-stack-demo` is documentation, not call-graph-
|
|
135
|
+
traceable code.
|
|
136
|
+
- **Unused `_propagate_class_role_to_members` helper deleted** (PR #19).
|
|
137
|
+
- **`# pragma: codegraph-public-api` analyzer support** (PR #21). Functions
|
|
138
|
+
and classes preceded by the pragma comment (Python `#` or TypeScript
|
|
139
|
+
`//` style, with optional `# codegraph: public-api` alias) are exempted
|
|
140
|
+
from `find_dead_code()`. Applied to all 15 known intentional public-API
|
|
141
|
+
methods (`EmbeddingStore` facade, `SQLiteGraphStore.upsert_node` /
|
|
142
|
+
`vacuum`, all `to_dict` / `as_dict` serializers, `_register.decorator`
|
|
143
|
+
closure). **Self-graph dead-code count: 15 → 0**, honestly.
|
|
144
|
+
|
|
145
|
+
#### Docs & developer experience
|
|
146
|
+
|
|
147
|
+
- **README refresh** (PR #20). 15 MCP tools listed; DF1–DF4 + Architecture
|
|
148
|
+
view documented in the headline feature list; "What it doesn't do yet"
|
|
149
|
+
rewritten to drop already-shipped items; numeric stats current.
|
|
150
|
+
- **SESSION_HANDOFF.md** (PR #20) rewritten as a self-contained briefing
|
|
151
|
+
for the next session.
|
|
152
|
+
- **`PLAN_V0_3_UNIFIED_TRACE.md`** (PR #20) — concrete spec for the unified
|
|
153
|
+
trace work; now marked **shipped** as of PRs #22–#26.
|
|
154
|
+
|
|
155
|
+
#### Cross-stack data-flow tracing (DF0 → DF4)
|
|
156
|
+
|
|
157
|
+
- **DF0 — function signatures + per-call-site arguments.** Python and
|
|
158
|
+
TypeScript parsers capture parameter lists, return-type annotations,
|
|
159
|
+
and the literal text of each call-site argument and kwarg.
|
|
160
|
+
- **DF1 — HTTP routes + SQL data access.** FastAPI / Flask / aiohttp
|
|
161
|
+
`ROUTE` edges; SQLAlchemy `READS_FROM` / `WRITES_TO` edges including
|
|
162
|
+
`self.session.X` repository-pattern detection.
|
|
163
|
+
- **DF1.5 — role classification.** Functions and classes are tagged
|
|
164
|
+
`HANDLER` / `SERVICE` / `COMPONENT` / `REPO` based on framework patterns.
|
|
165
|
+
- **DF2 — frontend `FETCH_CALL` extraction.** `fetch` / `axios` / `useSWR` /
|
|
166
|
+
`useQuery` / api-client patterns emit `FETCH_CALL` edges with method,
|
|
167
|
+
url, and body-key metadata.
|
|
168
|
+
- **DF3 — URL stitcher (`match_route`).** Stitches frontend `FETCH_CALL`
|
|
169
|
+
URLs to backend `ROUTE` handlers with placeholder normalisation
|
|
170
|
+
(`/users/{id}`, `${id}`, `:id`, numeric segments) and a body-key
|
|
171
|
+
overlap bonus.
|
|
172
|
+
- **DF4 — `codegraph dataflow trace`.** Walks the call graph + cross-layer
|
|
173
|
+
edges and emits an ordered `DataFlow`. Available as a CLI subcommand and
|
|
174
|
+
the MCP `dataflow_trace` tool.
|
|
175
|
+
|
|
176
|
+
#### v0.3 embedding layer
|
|
177
|
+
|
|
178
|
+
- **`codegraph/embed/`** — chunker + embedder + LanceDB / JSON store.
|
|
179
|
+
- **`codegraph embed` CLI.** Default model `nomic-ai/CodeRankEmbed`
|
|
180
|
+
(Apache 2.0, ~140 MB, 768-dim).
|
|
181
|
+
- **MCP tools** `semantic_search` and `hybrid_search`. Hybrid reranks
|
|
182
|
+
embedding similarity by graph distance from a focus node.
|
|
183
|
+
- Optional install: `pip install -e ".[embed]"`.
|
|
184
|
+
|
|
185
|
+
#### 3D dashboard
|
|
186
|
+
|
|
187
|
+
- **3D focus-mode dashboard.** Pick any function from a role-grouped picker;
|
|
188
|
+
trace ancestors and descendants; expand or collapse inline; always-on node
|
|
189
|
+
labels via `three-spritetext`; color/role legend; hover signature tooltips;
|
|
190
|
+
edge labels with call-site args; external calls render as terminal leaves.
|
|
191
|
+
|
|
192
|
+
#### MCP surface
|
|
193
|
+
|
|
194
|
+
- **15 tools registered.** `find_symbol` (with role filter), `callers`,
|
|
195
|
+
`callees` (both surfacing params + role + per-call-site args),
|
|
196
|
+
`blast_radius`, `subgraph`, `dead_code`, `cycles`, `untested`, `hotspots`,
|
|
197
|
+
`metrics`, `semantic_search`, `hybrid_search`, `dataflow_routes`,
|
|
198
|
+
`dataflow_fetches`, `dataflow_trace`.
|
|
199
|
+
- HLD payload exposes DF0 + DF1.5 + DF1 + DF2 metadata.
|
|
200
|
+
|
|
201
|
+
#### Resolver
|
|
202
|
+
|
|
203
|
+
- **R2 patterns.** Same-file constructor calls, decorator-call edges,
|
|
204
|
+
class-annotation `self.X.Y` chains, and fresh-instance method calls
|
|
205
|
+
are now resolved on Python.
|
|
206
|
+
- **R3 patterns.** Conditional `self.X` assignments (`if/else` branches)
|
|
207
|
+
and class-level union annotations (`Foo | Bar`) bind to all candidate
|
|
208
|
+
types.
|
|
209
|
+
|
|
210
|
+
#### Analysis & quality
|
|
211
|
+
|
|
212
|
+
- **Cycles with qualnames.** Both `analyze` and the MCP `cycles` tool
|
|
213
|
+
resolve cycle node IDs to dotted qualnames.
|
|
214
|
+
- **Analyzer hardening.** Pure line-shift no longer triggers
|
|
215
|
+
`modified-signature` findings (was producing 50+ false-positives on
|
|
216
|
+
PRs that touched the top of high-traffic files like `app.js`).
|
|
217
|
+
- **Skip paths extended.** `tests/fixtures/`, `/static/`, and `examples/`
|
|
218
|
+
are auto-excluded from dead-code and untested-function analysers.
|
|
219
|
+
- **Protocol classes** are no longer flagged as dead code.
|
|
220
|
+
|
|
221
|
+
#### CI & contributor experience
|
|
222
|
+
|
|
223
|
+
- **`codegraph PR review` GitHub Actions workflow.** Builds baseline from
|
|
224
|
+
`origin/main`, builds PR head, runs `codegraph review`, posts sticky
|
|
225
|
+
PR comment (or run-summary on fork PRs), fails the check on
|
|
226
|
+
`--fail-on high`.
|
|
227
|
+
- **`ci.yml` self-explanatory failures.** Inline `::error` annotations on
|
|
228
|
+
the Files tab; every failing step writes a step-summary block with the
|
|
229
|
+
exact local-fix command.
|
|
230
|
+
- **`scripts/test-pr-review-locally.sh`** — emulates the CI review locally
|
|
231
|
+
so contributors can pre-validate before pushing.
|
|
232
|
+
- **`CONTRIBUTING.md`** — covers setup, commit / PR conventions, branch
|
|
233
|
+
protection, and the dogfood loop.
|
|
234
|
+
- **`examples/cross-stack-demo/`** — FastAPI + SQLAlchemy + React fixture
|
|
235
|
+
exercising the full DF0 → DF4 chain. 9 regression tests assert it stays
|
|
236
|
+
reproducible.
|
|
237
|
+
|
|
238
|
+
## [0.1.0] - in-progress
|
|
239
|
+
|
|
240
|
+
### Added
|
|
241
|
+
|
|
242
|
+
#### Core graph & storage
|
|
243
|
+
- SQLite-backed graph store with typed node/edge schema (file, class, function, variable, import, calls, inherits, tested-by)
|
|
244
|
+
- NetworkX adapter for in-memory graph operations (BFS, SCC, centrality)
|
|
245
|
+
- Incremental rebuild: only re-parses files whose mtime/hash has changed
|
|
246
|
+
- `codegraph init` — interactive setup: detects languages, configures ignore globs, optionally registers MCP server
|
|
247
|
+
|
|
248
|
+
#### Parsers
|
|
249
|
+
- Tree-sitter base extractor infrastructure with language dispatch table
|
|
250
|
+
- Python extractor: functions, classes, methods, variables, imports, calls
|
|
251
|
+
- TypeScript / TSX / JavaScript extractor: functions, classes, exports, imports, calls
|
|
252
|
+
- Pluggable design: adding a new language requires a single extractor file
|
|
253
|
+
|
|
254
|
+
#### Cross-file resolution
|
|
255
|
+
- Cross-file CALLS and IMPORTS resolver: links call-site nodes to definition nodes across the whole repo
|
|
256
|
+
- Handles Python relative imports and `from … import` forms
|
|
257
|
+
- Handles TypeScript path-based and package imports
|
|
258
|
+
|
|
259
|
+
#### Analysis
|
|
260
|
+
- Dead-code detection: unreferenced functions and classes with no incoming reference edges
|
|
261
|
+
- Import/call cycle detection via Tarjan SCC on the graph
|
|
262
|
+
- Hotspot ranking: callables scored by fan-in × 2 + fan-out + LOC/50
|
|
263
|
+
- Untested function detection: callables with no incoming CALLS from test modules
|
|
264
|
+
- Blast-radius query: transitive set of nodes referencing a given symbol
|
|
265
|
+
- Aggregate metrics: total nodes/edges, breakdown by kind, top files by node count
|
|
266
|
+
|
|
267
|
+
#### PR review
|
|
268
|
+
- Graph differ: computes added/removed/changed nodes and edges between two graph snapshots
|
|
269
|
+
- Risk scorer: weighted blast-radius and coupling score → 0–100 risk number
|
|
270
|
+
- YAML rule engine: user-defined rules matching on symbol patterns with configurable severity
|
|
271
|
+
- Output renderers: Markdown, JSON, SARIF (compatible with GitHub Code Scanning)
|
|
272
|
+
- `codegraph review` CLI command with `--format`, `--output`, `--baseline`, `--rules` flags
|
|
273
|
+
- `codegraph baseline save/status/push` for managing named baselines
|
|
274
|
+
- `codegraph hook install/uninstall` — pre-push git hook that auto-runs `codegraph review`
|
|
275
|
+
|
|
276
|
+
#### MCP server
|
|
277
|
+
- `codegraph mcp serve` — stdio-transport MCP server for Claude Code / any MCP client
|
|
278
|
+
- 10 curated tools: `find_symbol`, `callers`, `callees`, `blast_radius`, `subgraph`, `dead_code`, `cycles`, `untested`, `hotspots`, `metrics`
|
|
279
|
+
- Returns small, focused subgraphs — avoids flooding context windows
|
|
280
|
+
- Auto-registration option in `codegraph init` writes `.mcp.json` to project root
|
|
281
|
+
|
|
282
|
+
#### Web dashboard
|
|
283
|
+
- `codegraph serve` — local web dashboard (Starlette, no JS framework)
|
|
284
|
+
- Overview tab: node/edge counts, language breakdown, top files, dead code summary
|
|
285
|
+
- Architecture tab: interactive dependency matrix and Sankey flow diagram
|
|
286
|
+
- Call graph tab: force-directed interactive graph (pyvis)
|
|
287
|
+
- Inheritance tab: class hierarchy diagram
|
|
288
|
+
- HLD (High-Level Design) tab: layered architecture navigator with animated focus graph
|
|
289
|
+
- Collapsible sidebar, light/dark theme toggle, responsive layout
|
|
290
|
+
|
|
291
|
+
#### Visualisation
|
|
292
|
+
- `codegraph viz` — render graph as Mermaid diagram, interactive pyvis HTML, or Graphviz SVG
|
|
293
|
+
- `codegraph explore` — terminal interactive subgraph explorer
|
|
294
|
+
- Graceful fallback when optional `graphviz` system package is absent
|
|
295
|
+
- Mermaid clustering by module, density cap to avoid browser freezes
|
|
296
|
+
|
|
297
|
+
#### CLI & packaging
|
|
298
|
+
- Top-level `codegraph` command with `--version` and `--data-dir` flags
|
|
299
|
+
- `codegraph build --incremental` for fast re-runs on large repos
|
|
300
|
+
- `codegraph status` for a quick health summary
|
|
301
|
+
- `codegraph query` sub-commands: `callers`, `subgraph`, `deadcode`, `untested`, `cycles`
|
|
302
|
+
- `py.typed` PEP 561 marker so downstream type-checkers see type information
|
|
303
|
+
- Wheel includes `codegraph/web/static/` assets so `codegraph serve` works after `pip install`
|
|
304
|
+
- MIT licensed, zero telemetry, fully offline capable
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mochan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|