tscode-kg 0.2.0__py3-none-any.whl
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.
- tscode_kg/__init__.py +42 -0
- tscode_kg/__main__.py +6 -0
- tscode_kg/analysis.py +1829 -0
- tscode_kg/app.py +1355 -0
- tscode_kg/bridge.py +114 -0
- tscode_kg/centrality.py +434 -0
- tscode_kg/cli/__init__.py +1 -0
- tscode_kg/cli/cmd_analyze.py +69 -0
- tscode_kg/cli/cmd_bridges.py +38 -0
- tscode_kg/cli/cmd_build.py +86 -0
- tscode_kg/cli/cmd_centrality.py +124 -0
- tscode_kg/cli/cmd_explain.py +58 -0
- tscode_kg/cli/cmd_framework_nodes.py +43 -0
- tscode_kg/cli/cmd_hooks.py +125 -0
- tscode_kg/cli/cmd_init.py +234 -0
- tscode_kg/cli/cmd_mcp.py +35 -0
- tscode_kg/cli/cmd_model.py +52 -0
- tscode_kg/cli/cmd_query.py +75 -0
- tscode_kg/cli/cmd_snapshot.py +431 -0
- tscode_kg/cli/cmd_viz.py +175 -0
- tscode_kg/cli/main.py +56 -0
- tscode_kg/coderank.py +564 -0
- tscode_kg/config.py +36 -0
- tscode_kg/explain.py +270 -0
- tscode_kg/extractor.py +827 -0
- tscode_kg/framework_detector.py +106 -0
- tscode_kg/kg.py +193 -0
- tscode_kg/layout3d.py +492 -0
- tscode_kg/mcp_server.py +1412 -0
- tscode_kg/snapshots.py +64 -0
- tscode_kg/viz3d.py +1457 -0
- tscode_kg/viz3d_timeline.py +369 -0
- tscode_kg-0.2.0.dist-info/METADATA +196 -0
- tscode_kg-0.2.0.dist-info/RECORD +37 -0
- tscode_kg-0.2.0.dist-info/WHEEL +4 -0
- tscode_kg-0.2.0.dist-info/entry_points.txt +15 -0
- tscode_kg-0.2.0.dist-info/licenses/LICENSE +24 -0
tscode_kg/snapshots.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""
|
|
2
|
+
snapshots.py — Temporal Snapshots of TypeScriptKG Metrics
|
|
3
|
+
|
|
4
|
+
Thin layer over the shared ``kg_utils.snapshots`` module. The shared module
|
|
5
|
+
provides the canonical ``Snapshot``, ``SnapshotManifest``, ``SnapshotManager``,
|
|
6
|
+
and ``PruneResult`` backed by free-form metric dicts; this module re-exports
|
|
7
|
+
those types and adds a ``SnapshotManager`` subclass that defaults
|
|
8
|
+
``package_name`` to ``"tscode-kg"`` so version auto-detection resolves to this
|
|
9
|
+
package.
|
|
10
|
+
|
|
11
|
+
Snapshots are stored in ``.tscodekg/snapshots/{tree_hash}.json`` with a
|
|
12
|
+
``manifest.json`` tracking all snapshots and their metrics — the same layout
|
|
13
|
+
PyCodeKG uses under ``.pycodekg/snapshots/``.
|
|
14
|
+
|
|
15
|
+
Usage
|
|
16
|
+
-----
|
|
17
|
+
>>> from tscode_kg.snapshots import SnapshotManager
|
|
18
|
+
>>> mgr = SnapshotManager(".tscodekg/snapshots")
|
|
19
|
+
>>> snapshot = mgr.capture(version="0.1.0", branch="develop", graph_stats_dict=stats)
|
|
20
|
+
>>> mgr.save_snapshot(snapshot)
|
|
21
|
+
>>> manifest = mgr.load_manifest()
|
|
22
|
+
|
|
23
|
+
Author: Eric G. Suchanek, PhD
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
from __future__ import annotations
|
|
27
|
+
|
|
28
|
+
from pathlib import Path
|
|
29
|
+
|
|
30
|
+
from kg_utils.snapshots import (
|
|
31
|
+
PruneResult, # noqa: F401 re-exported
|
|
32
|
+
Snapshot, # noqa: F401 re-exported
|
|
33
|
+
SnapshotManifest, # noqa: F401 re-exported
|
|
34
|
+
)
|
|
35
|
+
from kg_utils.snapshots import SnapshotManager as _BaseSnapshotManager
|
|
36
|
+
|
|
37
|
+
__all__ = [
|
|
38
|
+
"Snapshot",
|
|
39
|
+
"SnapshotManifest",
|
|
40
|
+
"SnapshotManager",
|
|
41
|
+
"PruneResult",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class SnapshotManager(_BaseSnapshotManager):
|
|
46
|
+
"""Snapshot manager bound to the ``tscode-kg`` package.
|
|
47
|
+
|
|
48
|
+
Identical to :class:`kg_utils.snapshots.SnapshotManager` except that
|
|
49
|
+
version auto-detection resolves against the installed ``tscode-kg``
|
|
50
|
+
package instead of ``kg-utils``.
|
|
51
|
+
|
|
52
|
+
:param snapshots_dir: Directory holding snapshot JSON files and manifest.
|
|
53
|
+
:param package_name: Package whose installed version stamps snapshots.
|
|
54
|
+
:param db_path: Optional SQLite graph path for per-module node counts.
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
def __init__(
|
|
58
|
+
self,
|
|
59
|
+
snapshots_dir: Path | str,
|
|
60
|
+
*,
|
|
61
|
+
package_name: str = "tscode-kg",
|
|
62
|
+
db_path: Path | str | None = None,
|
|
63
|
+
) -> None:
|
|
64
|
+
super().__init__(snapshots_dir, package_name=package_name, db_path=db_path)
|