codecompass-mcp 6.0.2__tar.gz → 6.0.3__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 (40) hide show
  1. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/PKG-INFO +1 -1
  2. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/codecompass_mcp.egg-info/PKG-INFO +1 -1
  3. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/main.py +14 -2
  4. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/pi_setup.py +4 -1
  5. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/pyproject.toml +1 -1
  6. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/tests/test_descriptions.py +2 -1
  7. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/tests/test_init.py +29 -0
  8. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/LICENSE +0 -0
  9. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/README.md +0 -0
  10. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/codecompass_mcp.egg-info/SOURCES.txt +0 -0
  11. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/codecompass_mcp.egg-info/dependency_links.txt +0 -0
  12. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/codecompass_mcp.egg-info/entry_points.txt +0 -0
  13. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/codecompass_mcp.egg-info/requires.txt +0 -0
  14. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/codecompass_mcp.egg-info/top_level.txt +0 -0
  15. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/config.py +0 -0
  16. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/graph/__init__.py +0 -0
  17. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/graph/code_graph_client.py +0 -0
  18. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/graph/code_queries.py +0 -0
  19. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/graph/vector_store.py +0 -0
  20. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/ingestion/__init__.py +0 -0
  21. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/ingestion/agent_writes.py +0 -0
  22. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/ingestion/code_normalizer.py +0 -0
  23. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/ingestion/code_parser.py +0 -0
  24. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/ingestion/file_watcher.py +0 -0
  25. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/ingestion/hierarchy_builder.py +0 -0
  26. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/ingestion/source_context.py +0 -0
  27. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/mcp_server.py +0 -0
  28. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/models/__init__.py +0 -0
  29. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/models/code_types.py +0 -0
  30. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/setup.cfg +0 -0
  31. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/tests/test_accuracy_fixes.py +0 -0
  32. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/tests/test_agent_writes.py +0 -0
  33. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/tests/test_block_hook.py +0 -0
  34. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/tests/test_code_parser.py +0 -0
  35. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/tests/test_ingest_progress.py +0 -0
  36. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/tests/test_lit_css_parser.py +0 -0
  37. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/tests/test_mcp_server.py +0 -0
  38. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/tests/test_php_parser.py +0 -0
  39. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/tests/test_pi_setup.py +0 -0
  40. {codecompass_mcp-6.0.2 → codecompass_mcp-6.0.3}/tests/test_vector_store.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codecompass-mcp
3
- Version: 6.0.2
3
+ Version: 6.0.3
4
4
  Summary: Structural code context for AI coding agents — a local code knowledge graph for blast radius, impact, deps, dead code, and flow tracing
5
5
  Author: CodeCompass contributors
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codecompass-mcp
3
- Version: 6.0.2
3
+ Version: 6.0.3
4
4
  Summary: Structural code context for AI coding agents — a local code knowledge graph for blast radius, impact, deps, dead code, and flow tracing
5
5
  Author: CodeCompass contributors
6
6
  License: MIT
@@ -407,12 +407,24 @@ export default function (pi: ExtensionAPI) {
407
407
  '''
408
408
 
409
409
 
410
+ def _pi_installed() -> bool:
411
+ """True if pi is on this machine — PATH is not a reliable signal.
412
+
413
+ When pi spawns the MCP server it usually doesn't pass its own bin directory
414
+ down (node lives under nvm), so `which("pi")` returns None inside the very
415
+ process pi asked to run `init`, and the repo silently gets no .pi/ files.
416
+ pi's home directory is the durable marker, so fall back to that.
417
+ """
418
+ return (shutil.which("pi") is not None
419
+ or os.path.isdir(os.path.join(os.path.expanduser("~"), ".pi")))
420
+
421
+
410
422
  def _ensure_pi_extension(repo_path: str) -> None:
411
423
  """Drop the pi guard extension into <repo>/.pi/extensions/ so pi blocks
412
424
  grep/cat/rg the same way the Claude hook does. No-op when pi is not
413
425
  installed. Rewrites copies init previously installed so old versions
414
426
  auto-update; leaves user-authored extensions alone."""
415
- if shutil.which("pi") is None:
427
+ if not _pi_installed():
416
428
  return
417
429
  ext_dir = os.path.join(repo_path, ".pi", "extensions")
418
430
  ext_path = os.path.join(ext_dir, "codecompass-guard.ts")
@@ -427,7 +439,7 @@ def _ensure_pi_agents_md(repo_path: str) -> None:
427
439
  """Drop .pi/agent/AGENTS.md pointing at the root AGENTS.md so pi picks up
428
440
  the CodeCompass instructions. No-op when pi is not installed. Rewrites
429
441
  copies init previously installed so old versions auto-update."""
430
- if shutil.which("pi") is None:
442
+ if not _pi_installed():
431
443
  return
432
444
  agents_path = os.path.join(repo_path, ".pi", "agent", "AGENTS.md")
433
445
  if os.path.exists(agents_path):
@@ -123,7 +123,10 @@ point it at another repo.
123
123
 
124
124
 
125
125
  def _pi_available() -> bool:
126
- return shutil.which("pi") is not None
126
+ """pi is on this machine. PATH alone lies: when pi spawns the MCP server it
127
+ usually doesn't pass its own bin directory down, so `which` finds nothing in
128
+ the very process pi launched. Its home directory is the durable marker."""
129
+ return shutil.which("pi") is not None or (Path.home() / ".pi").is_dir()
127
130
 
128
131
 
129
132
  def _adapter_installed() -> bool:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codecompass-mcp"
3
- version = "6.0.2"
3
+ version = "6.0.3"
4
4
  description = "Structural code context for AI coding agents — a local code knowledge graph for blast radius, impact, deps, dead code, and flow tracing"
5
5
  readme = "README.md"
6
6
  license = {text = "MIT"}
@@ -42,7 +42,8 @@ def _init(tmp_path, monkeypatch, source):
42
42
  repo.mkdir()
43
43
  (repo / "a.py").write_text(source)
44
44
  monkeypatch.setenv("CODECOMPASS_REPOS", str(tmp_path / "repos"))
45
- monkeypatch.setattr("shutil.which", lambda _: None) # skip pi/claude extras
45
+ monkeypatch.setattr("shutil.which", lambda _: None) # skip claude extras
46
+ monkeypatch.setattr("main._pi_installed", lambda: False) # and pi's
46
47
  init_project(str(repo))
47
48
  ingest_code(str(repo))
48
49
  return repo
@@ -44,3 +44,32 @@ def test_init_refreshes_generated_keeps_user_and_graph(tmp_path, monkeypatch):
44
44
  assert user_ext.read_text() == "// mine\n"
45
45
  assert overview.read_text() == "# my notes\n"
46
46
  assert graph.read_text() == '{"sentinel": true}\n'
47
+
48
+
49
+ def test_pi_files_land_even_when_pi_is_not_on_path(tmp_path, monkeypatch):
50
+ """pi spawning the MCP server doesn't pass its own bin dir down, so `which`
51
+ finds nothing in the process pi asked to run init. ~/.pi is the real signal."""
52
+ repo = tmp_path / "repo"
53
+ repo.mkdir()
54
+ home = tmp_path / "home"
55
+ (home / ".pi").mkdir(parents=True)
56
+ monkeypatch.setenv("CODECOMPASS_REPOS", str(tmp_path / "repos"))
57
+ monkeypatch.setenv("HOME", str(home))
58
+ monkeypatch.setattr("shutil.which", lambda _: None) # pi is installed, just not visible
59
+
60
+ init_project(str(repo))
61
+
62
+ assert (repo / ".pi" / "extensions" / "codecompass-guard.ts").exists()
63
+ assert (repo / ".pi" / "agent" / "AGENTS.md").exists()
64
+
65
+
66
+ def test_no_pi_no_pi_files(tmp_path, monkeypatch):
67
+ repo = tmp_path / "repo"
68
+ repo.mkdir()
69
+ monkeypatch.setenv("CODECOMPASS_REPOS", str(tmp_path / "repos"))
70
+ monkeypatch.setenv("HOME", str(tmp_path / "home")) # no ~/.pi
71
+ monkeypatch.setattr("shutil.which", lambda _: None)
72
+
73
+ init_project(str(repo))
74
+
75
+ assert not (repo / ".pi").exists()
File without changes