tscode-kg 0.7.0__tar.gz → 0.8.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.
Files changed (37) hide show
  1. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/PKG-INFO +12 -10
  2. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/README.md +10 -7
  3. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/pyproject.toml +4 -9
  4. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/__init__.py +1 -1
  5. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/analysis.py +3 -1
  6. tscode_kg-0.8.0/src/tscode_kg/cli/cmd_mcp.py +35 -0
  7. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/cli/main.py +3 -2
  8. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/explain.py +2 -2
  9. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/mcp_server.py +231 -450
  10. tscode_kg-0.7.0/src/tscode_kg/cli/cmd_mcp.py +0 -35
  11. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/LICENSE +0 -0
  12. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/__main__.py +0 -0
  13. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/app.py +0 -0
  14. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/bridge.py +0 -0
  15. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/centrality.py +0 -0
  16. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/cli/__init__.py +0 -0
  17. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/cli/cmd_analyze.py +0 -0
  18. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/cli/cmd_bridges.py +0 -0
  19. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/cli/cmd_build.py +0 -0
  20. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/cli/cmd_centrality.py +0 -0
  21. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/cli/cmd_explain.py +0 -0
  22. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/cli/cmd_framework_nodes.py +0 -0
  23. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/cli/cmd_hooks.py +0 -0
  24. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/cli/cmd_init.py +0 -0
  25. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/cli/cmd_model.py +0 -0
  26. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/cli/cmd_query.py +0 -0
  27. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/cli/cmd_snapshot.py +0 -0
  28. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/cli/cmd_viz.py +0 -0
  29. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/coderank.py +0 -0
  30. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/config.py +0 -0
  31. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/extractor.py +0 -0
  32. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/framework_detector.py +0 -0
  33. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/kg.py +0 -0
  34. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/layout3d.py +0 -0
  35. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/snapshots.py +0 -0
  36. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/viz3d.py +0 -0
  37. {tscode_kg-0.7.0 → tscode_kg-0.8.0}/src/tscode_kg/viz3d_timeline.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tscode-kg
3
- Version: 0.7.0
3
+ Version: 0.8.0
4
4
  Summary: Knowledge graph for TypeScript/JavaScript codebases — AST extraction, hybrid semantic+structural search
5
5
  License-Expression: Elastic-2.0
6
6
  License-File: LICENSE
@@ -19,9 +19,8 @@ Provides-Extra: viz
19
19
  Provides-Extra: viz3d
20
20
  Requires-Dist: PyQt5 (>=5.15.11,<5.16) ; extra == "viz3d"
21
21
  Requires-Dist: click (>=8.1.0,<9)
22
- Requires-Dist: kgmodule-utils[semantic,sqlite-vec] (>=0.23.0)
22
+ Requires-Dist: kgmodule-utils[mcp,semantic,sqlite-vec] (>=0.29.0)
23
23
  Requires-Dist: markdown (>=3.10,<3.11) ; extra == "viz3d"
24
- Requires-Dist: mcp (>=1.3.0,<2)
25
24
  Requires-Dist: networkx (>=3.0)
26
25
  Requires-Dist: param (>=2.4,<2.5) ; extra == "viz3d"
27
26
  Requires-Dist: plotly (>=6.8.0,<6.9) ; extra == "viz"
@@ -42,7 +41,7 @@ Description-Content-Type: text/markdown
42
41
  [![Python](https://img.shields.io/badge/python-3.12%20%7C%203.13-blue.svg)](https://www.python.org/)
43
42
  [![License: Elastic-2.0](https://img.shields.io/badge/License-Elastic%202.0-blue.svg)](https://www.elastic.co/licensing/elastic-license)
44
43
  [![PyPI](https://img.shields.io/pypi/v/tscode-kg.svg)](https://pypi.org/project/tscode-kg/)
45
- [![Version](https://img.shields.io/badge/version-0.7.0-blue.svg)](https://github.com/Flux-Frontiers/tscode_kg/releases)
44
+ [![Version](https://img.shields.io/badge/version-0.8.0-blue.svg)](https://github.com/Flux-Frontiers/tscode_kg/releases)
46
45
  [![CI](https://github.com/Flux-Frontiers/tscode_kg/actions/workflows/ci.yml/badge.svg)](https://github.com/Flux-Frontiers/tscode_kg/actions/workflows/ci.yml)
47
46
  [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
48
47
  [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.22559450-blue.svg)](https://doi.org/10.5281/zenodo.22559450)
@@ -132,10 +131,13 @@ are equivalent.
132
131
  ## MCP tools
133
132
 
134
133
  The MCP server exposes the full PyCodeKG toolkit, applied to TypeScript/JavaScript
135
- codebases: `graph_stats`, `query_codebase`, `pack_snippets`, `callers`, `get_node`,
136
- `list_nodes`, `find_node`, `centrality`, `bridge_centrality`, `framework_nodes`,
137
- `find_definition_at`, `analyze_repo`, `explain`, `rank_nodes`, `query_ranked`,
138
- `explain_rank`, `snapshot_list`, `snapshot_show`, and `snapshot_diff`.
134
+ codebases, as 20 tools. The first five are the fleet's canonical tools, named the
135
+ same on every KG server: `stats`, `query`, `pack`, `get_node` and `neighbors`.
136
+ The other fifteen are TypeScriptKG's own: `callers`, `list_nodes`, `find_node`,
137
+ `centrality`, `bridge_centrality`, `framework_nodes`, `find_definition_at`,
138
+ `analyze_repo`, `explain`, `rank_nodes`, `query_ranked`, `explain_rank`,
139
+ `snapshot_list`, `snapshot_show`, and `snapshot_diff`. `tscodekg mcp --manifest`
140
+ prints the live list as JSON without opening the graph.
139
141
 
140
142
  See `docs/MCP.md` for setup and `docs/CHEATSHEET.md` for a query cookbook.
141
143
  Repo-local Claude Code skills live in `skills/`.
@@ -195,13 +197,13 @@ If you use TypeScriptKG in your research or project, please cite it:
195
197
 
196
198
  [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.22559450-blue.svg)](https://doi.org/10.5281/zenodo.22559450)
197
199
 
198
- > Suchanek, E. G. (2026). *TypeScriptKG: Semantic Knowledge Graph for TypeScript/JavaScript Codebases* (Version 0.7.0) [Software]. Flux-Frontiers. https://doi.org/10.5281/zenodo.22559450
200
+ > Suchanek, E. G. (2026). *TypeScriptKG: Semantic Knowledge Graph for TypeScript/JavaScript Codebases* (Version 0.8.0) [Software]. Flux-Frontiers. https://doi.org/10.5281/zenodo.22559450
199
201
 
200
202
  ```bibtex
201
203
  @software{suchanek_tscode_kg,
202
204
  author = {Suchanek, Eric G.},
203
205
  title = {{TypeScriptKG}: Semantic Knowledge Graph for TypeScript/JavaScript Codebases},
204
- version = {0.7.0},
206
+ version = {0.8.0},
205
207
  year = {2026},
206
208
  publisher = {Flux-Frontiers},
207
209
  doi = {10.5281/zenodo.22559450},
@@ -3,7 +3,7 @@
3
3
  [![Python](https://img.shields.io/badge/python-3.12%20%7C%203.13-blue.svg)](https://www.python.org/)
4
4
  [![License: Elastic-2.0](https://img.shields.io/badge/License-Elastic%202.0-blue.svg)](https://www.elastic.co/licensing/elastic-license)
5
5
  [![PyPI](https://img.shields.io/pypi/v/tscode-kg.svg)](https://pypi.org/project/tscode-kg/)
6
- [![Version](https://img.shields.io/badge/version-0.7.0-blue.svg)](https://github.com/Flux-Frontiers/tscode_kg/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.8.0-blue.svg)](https://github.com/Flux-Frontiers/tscode_kg/releases)
7
7
  [![CI](https://github.com/Flux-Frontiers/tscode_kg/actions/workflows/ci.yml/badge.svg)](https://github.com/Flux-Frontiers/tscode_kg/actions/workflows/ci.yml)
8
8
  [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
9
9
  [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.22559450-blue.svg)](https://doi.org/10.5281/zenodo.22559450)
@@ -93,10 +93,13 @@ are equivalent.
93
93
  ## MCP tools
94
94
 
95
95
  The MCP server exposes the full PyCodeKG toolkit, applied to TypeScript/JavaScript
96
- codebases: `graph_stats`, `query_codebase`, `pack_snippets`, `callers`, `get_node`,
97
- `list_nodes`, `find_node`, `centrality`, `bridge_centrality`, `framework_nodes`,
98
- `find_definition_at`, `analyze_repo`, `explain`, `rank_nodes`, `query_ranked`,
99
- `explain_rank`, `snapshot_list`, `snapshot_show`, and `snapshot_diff`.
96
+ codebases, as 20 tools. The first five are the fleet's canonical tools, named the
97
+ same on every KG server: `stats`, `query`, `pack`, `get_node` and `neighbors`.
98
+ The other fifteen are TypeScriptKG's own: `callers`, `list_nodes`, `find_node`,
99
+ `centrality`, `bridge_centrality`, `framework_nodes`, `find_definition_at`,
100
+ `analyze_repo`, `explain`, `rank_nodes`, `query_ranked`, `explain_rank`,
101
+ `snapshot_list`, `snapshot_show`, and `snapshot_diff`. `tscodekg mcp --manifest`
102
+ prints the live list as JSON without opening the graph.
100
103
 
101
104
  See `docs/MCP.md` for setup and `docs/CHEATSHEET.md` for a query cookbook.
102
105
  Repo-local Claude Code skills live in `skills/`.
@@ -156,13 +159,13 @@ If you use TypeScriptKG in your research or project, please cite it:
156
159
 
157
160
  [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.22559450-blue.svg)](https://doi.org/10.5281/zenodo.22559450)
158
161
 
159
- > Suchanek, E. G. (2026). *TypeScriptKG: Semantic Knowledge Graph for TypeScript/JavaScript Codebases* (Version 0.7.0) [Software]. Flux-Frontiers. https://doi.org/10.5281/zenodo.22559450
162
+ > Suchanek, E. G. (2026). *TypeScriptKG: Semantic Knowledge Graph for TypeScript/JavaScript Codebases* (Version 0.8.0) [Software]. Flux-Frontiers. https://doi.org/10.5281/zenodo.22559450
160
163
 
161
164
  ```bibtex
162
165
  @software{suchanek_tscode_kg,
163
166
  author = {Suchanek, Eric G.},
164
167
  title = {{TypeScriptKG}: Semantic Knowledge Graph for TypeScript/JavaScript Codebases},
165
- version = {0.7.0},
168
+ version = {0.8.0},
166
169
  year = {2026},
167
170
  publisher = {Flux-Frontiers},
168
171
  doi = {10.5281/zenodo.22559450},
@@ -38,7 +38,7 @@ packages = [{ include = "tscode_kg", from = "src" }]
38
38
 
39
39
  [project]
40
40
  name = "tscode-kg"
41
- version = "0.7.0"
41
+ version = "0.8.0"
42
42
  description = "Knowledge graph for TypeScript/JavaScript codebases — AST extraction, hybrid semantic+structural search"
43
43
  readme = "README.md"
44
44
  license = "Elastic-2.0"
@@ -68,15 +68,10 @@ dependencies = [
68
68
  # manager is now the package_name class attribute, where it used to be an
69
69
  # __init__ that only forwarded to super(). Against 0.19.x the manager
70
70
  # reports itself as "kg-utils" in every snapshot's tool field.
71
- "kgmodule-utils[semantic,sqlite-vec]>=0.23.0",
71
+ # 0.29.0: the MCP server is kg_utils.mcp's ([mcp] brings mcp itself),
72
+ # stats() is the fleet stats shape, and LanceDB is gone.
73
+ "kgmodule-utils[semantic,sqlite-vec,mcp]>=0.29.0",
72
74
  "click>=8.1.0,<9",
73
- # Upper-bounded: mcp 2.0 removed the bundled `mcp.server.fastmcp` module
74
- # (FastMCP was split out into the standalone `fastmcp` package) and rebuilt
75
- # mcp.server around new submodules. src/tscode_kg/mcp_server.py imports
76
- # FastMCP from mcp, so an unbounded floor lets a clean install pull 2.x and
77
- # break `tscodekg-mcp` at import time. Lift this only alongside a port to
78
- # the standalone fastmcp package.
79
- "mcp>=1.3.0,<2",
80
75
  "networkx>=3.0",
81
76
  ]
82
77
 
@@ -18,7 +18,7 @@ KGExtractor SDK::
18
18
  from tscode_kg import TSCodeExtractor
19
19
  """
20
20
 
21
- __version__ = "0.7.0"
21
+ __version__ = "0.8.0"
22
22
  __author__ = "Eric G. Suchanek, PhD"
23
23
 
24
24
  from tscode_kg.extractor import TSCodeExtractor
@@ -43,6 +43,7 @@ from collections.abc import Callable
43
43
  from dataclasses import asdict, dataclass
44
44
  from pathlib import Path
45
45
 
46
+ from kg_utils.stats import flat_stats
46
47
  from rich.console import Console
47
48
 
48
49
  logging.basicConfig(level=logging.INFO)
@@ -304,7 +305,8 @@ class TSCodeKGAnalyzer:
304
305
  def _analyze_baseline(self) -> None:
305
306
  """Phase 1: Establish baseline node and edge counts."""
306
307
  try:
307
- self.stats = self.kg.stats()
308
+ # The report reads the store's flat keys (total_nodes, node_counts, ...).
309
+ self.stats = flat_stats(self.kg.stats())
308
310
  n = self.stats.get("total_nodes", "?")
309
311
  e = self.stats.get("total_edges", "?")
310
312
  self._phase_result = f"nodes={n} edges={e}"
@@ -0,0 +1,35 @@
1
+ """
2
+ cli/cmd_mcp.py -- ``tscodekg mcp``, the fleet's standard MCP command, from :mod:`kg_utils.mcp`:
3
+
4
+ tscodekg mcp [--repo DIR] [--db FILE] [--vectors FILE] [--model NAME]
5
+ [--transport stdio|streamable-http] [--host H] [--port N]
6
+ [--manifest]
7
+
8
+ ``cli/main.py`` registers it with ``add_mcp_command(cli, build_mcp_server)``.
9
+ Registering it imports neither ``mcp`` nor the server module, so every other
10
+ ``tscodekg`` command starts as fast as before.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ from pathlib import Path
16
+ from typing import TYPE_CHECKING
17
+
18
+ if TYPE_CHECKING:
19
+ from kg_utils.mcp import KGServer
20
+
21
+
22
+ def build_mcp_server(
23
+ repo: Path, db: Path | None, vectors: Path | None, model: str | None
24
+ ) -> KGServer:
25
+ """Build the server only when ``tscodekg mcp`` runs.
26
+
27
+ :param repo: Repository root, absolute.
28
+ :param db: Graph database, absolute; ``None`` for the default.
29
+ :param vectors: Vector store, absolute; ``None`` for the default.
30
+ :param model: Embedding model; ``None`` for the default.
31
+ :return: The server, with its graph not yet opened.
32
+ """
33
+ from tscode_kg.mcp_server import build_server # noqa: PLC0415 -- see the module docstring
34
+
35
+ return build_server(repo, db, vectors, model)
@@ -16,6 +16,7 @@ Usage::
16
16
  from __future__ import annotations
17
17
 
18
18
  import click
19
+ from kg_utils.mcp import add_mcp_command
19
20
 
20
21
  from tscode_kg.cli.cmd_analyze import analyze
21
22
  from tscode_kg.cli.cmd_bridges import bridges
@@ -25,7 +26,7 @@ from tscode_kg.cli.cmd_explain import explain
25
26
  from tscode_kg.cli.cmd_framework_nodes import framework_nodes
26
27
  from tscode_kg.cli.cmd_hooks import install_hooks
27
28
  from tscode_kg.cli.cmd_init import init
28
- from tscode_kg.cli.cmd_mcp import mcp_cmd
29
+ from tscode_kg.cli.cmd_mcp import build_mcp_server
29
30
  from tscode_kg.cli.cmd_model import download_model
30
31
  from tscode_kg.cli.cmd_query import pack, query
31
32
  from tscode_kg.cli.cmd_snapshot import snapshot
@@ -56,4 +57,4 @@ cli.add_command(viz3d)
56
57
  cli.add_command(viz_timeline, name="viz-timeline")
57
58
  cli.add_command(install_hooks)
58
59
  cli.add_command(download_model)
59
- cli.add_command(mcp_cmd, name="mcp")
60
+ mcp_command = add_mcp_command(cli, build_mcp_server)
@@ -30,7 +30,7 @@ def render_explain(
30
30
  node_id: str,
31
31
  *,
32
32
  limit: int = 10,
33
- snippets_hint: str = "pack_snippets()",
33
+ snippets_hint: str = "pack()",
34
34
  ) -> str:
35
35
  """
36
36
  Render a Markdown natural-language explanation of a code node.
@@ -41,7 +41,7 @@ def render_explain(
41
41
  (e.g. ``fn:src/utils/helpers.ts:formatDate``).
42
42
  :param limit: Maximum callers and callees to list. Pass 0 to list all.
43
43
  :param snippets_hint: Closing call-to-action shown to the consumer for
44
- retrieving the full source — ``"pack_snippets()"``
44
+ retrieving the full source — ``"pack()"``
45
45
  for MCP, ``"tscodekg pack"`` for CLI.
46
46
  :return: Markdown string, or a "Node Not Found" header when the ID does
47
47
  not exist in the knowledge graph.