fix Windows cp1252 crash, str.parent crash, mcp error message, god_nodes relative import
- Replace non-ASCII → with -> in __main__.py print statements (#992) - Coerce paths to Path objects at extract() entry to fix str.parent crash (#988) - Fix serve.py ImportError to recommend graphifyy[mcp] extra (#967) - Change relative import in _tool_god_nodes to absolute to fix script invocation (#966) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
990ac706d8
commit
461e346f3a
@@ -1334,7 +1334,7 @@ def _clone_repo(url: str, branch: str | None = None, out_dir: Path | None = None
|
||||
print(f"warning: git pull failed:\n{result.stderr}", file=sys.stderr)
|
||||
else:
|
||||
dest.parent.mkdir(parents=True, exist_ok=True)
|
||||
print(f"Cloning {url} → {dest} ...", flush=True)
|
||||
print(f"Cloning {url} -> {dest} ...", flush=True)
|
||||
cmd = ["git", "clone", "--depth", "1"]
|
||||
if branch:
|
||||
cmd += ["--branch", branch]
|
||||
@@ -2439,7 +2439,7 @@ def main() -> None:
|
||||
out_data = _jg.node_link_data(merged)
|
||||
out_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
out_path.write_text(json.dumps(out_data, indent=2), encoding="utf-8")
|
||||
print(f"Merged {len(graphs)} graphs → {merged.number_of_nodes()} nodes, {merged.number_of_edges()} edges")
|
||||
print(f"Merged {len(graphs)} graphs -> {merged.number_of_nodes()} nodes, {merged.number_of_edges()} edges")
|
||||
print(f"Written to: {out_path}")
|
||||
|
||||
elif cmd == "clone":
|
||||
|
||||
@@ -7526,6 +7526,7 @@ def extract(
|
||||
max_workers: max subprocess count. Defaults to cpu_count (or the
|
||||
value of GRAPHIFY_MAX_WORKERS if set), bounded by len(uncached_work).
|
||||
"""
|
||||
paths = [Path(p) for p in paths]
|
||||
_check_tree_sitter_version()
|
||||
_raise_recursion_limit()
|
||||
# Workspace package manifests/globs can change during watch or repeated extraction.
|
||||
|
||||
+2
-2
@@ -402,7 +402,7 @@ def serve(graph_path: str = "graphify-out/graph.json") -> None:
|
||||
from mcp import types
|
||||
from mcp.types import AnyUrl
|
||||
except ImportError as e:
|
||||
raise ImportError("mcp not installed. Run: pip install mcp") from e
|
||||
raise ImportError('mcp not installed. Run: pip install "graphifyy[mcp]"') from e
|
||||
|
||||
G = _load_graph(graph_path)
|
||||
communities = _communities_from_graph(G)
|
||||
@@ -644,7 +644,7 @@ def serve(graph_path: str = "graphify-out/graph.json") -> None:
|
||||
return "\n".join(lines)
|
||||
|
||||
def _tool_god_nodes(arguments: dict) -> str:
|
||||
from .analyze import god_nodes as _god_nodes
|
||||
from graphify.analyze import god_nodes as _god_nodes
|
||||
nodes = _god_nodes(G, top_n=int(arguments.get("top_n", 10)))
|
||||
lines = ["God nodes (most connected):"]
|
||||
lines += [f" {i}. {n['label']} - {n['degree']} edges" for i, n in enumerate(nodes, 1)]
|
||||
|
||||
Reference in New Issue
Block a user