cortex-local 2.3.7__tar.gz → 2.3.9__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 (23) hide show
  1. {cortex_local-2.3.7 → cortex_local-2.3.9}/PKG-INFO +1 -1
  2. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/mcp_server.py +27 -0
  3. {cortex_local-2.3.7 → cortex_local-2.3.9}/tests/test_imports.py +36 -0
  4. {cortex_local-2.3.7 → cortex_local-2.3.9}/README.md +0 -0
  5. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/__init__.py +0 -0
  6. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/cli.py +0 -0
  7. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/config.py +0 -0
  8. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/core/__init__.py +0 -0
  9. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/core/cache.py +0 -0
  10. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/core/chunker.py +0 -0
  11. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/core/code_graph.py +0 -0
  12. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/core/formatters.py +0 -0
  13. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/core/global_graph.py +0 -0
  14. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/core/graph.py +0 -0
  15. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/core/notes_graph.py +0 -0
  16. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/core/roslyn_analyzer.py +0 -0
  17. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/core/roslyn_tool/CortexAnalyzer.csproj +0 -0
  18. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/core/roslyn_tool/Program.cs +0 -0
  19. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/embedder.py +0 -0
  20. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/indexer.py +0 -0
  21. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/state.py +0 -0
  22. {cortex_local-2.3.7 → cortex_local-2.3.9}/cortex/watcher.py +0 -0
  23. {cortex_local-2.3.7 → cortex_local-2.3.9}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cortex-local
3
- Version: 2.3.7
3
+ Version: 2.3.9
4
4
  Summary: Local semantic search MCP server — notes + code, embedded Qdrant, fastembed
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: click>=8.0.0
@@ -1,6 +1,8 @@
1
1
  """Cortex local MCP server — stdio transport, all 8 tools, embedded Qdrant."""
2
2
 
3
3
  import json
4
+ import logging
5
+ import logging.handlers
4
6
  import threading
5
7
  import time
6
8
  from pathlib import Path
@@ -413,8 +415,33 @@ def list_workspaces() -> str:
413
415
  return "\n".join(lines)
414
416
 
415
417
 
418
+ @mcp.tool()
419
+ def get_log(lines: int = 100) -> str:
420
+ """Return path and tail of the cortex log file. Share output with developer for troubleshooting."""
421
+ log_path = data_dir() / "cortex.log"
422
+ if not log_path.exists():
423
+ return f"No log yet. Will be created at: {log_path}"
424
+ try:
425
+ all_lines = log_path.read_text(errors="replace").splitlines()
426
+ tail = "\n".join(all_lines[-lines:])
427
+ return f"Log: {log_path}\n\n{tail}"
428
+ except Exception as e:
429
+ return f"Error reading log: {e}\nPath: {log_path}"
430
+
431
+
416
432
  def run() -> None:
417
433
  """Entry point for stdio MCP server."""
434
+ log_path = data_dir() / "cortex.log"
435
+ data_dir().mkdir(parents=True, exist_ok=True)
436
+ logging.basicConfig(
437
+ level=logging.INFO,
438
+ format="%(asctime)s [%(name)s] %(message)s",
439
+ datefmt="%H:%M:%S",
440
+ handlers=[logging.handlers.RotatingFileHandler(
441
+ log_path, maxBytes=5 * 1024 * 1024, backupCount=3,
442
+ )],
443
+ force=True,
444
+ )
418
445
  cfg = get_config()
419
446
  if cfg["watch"]["enabled"]:
420
447
  last = cfg["index"].get("last_path", "")
@@ -39,6 +39,42 @@ def test_cli_module():
39
39
  assert cli is not None
40
40
 
41
41
 
42
+ def test_config_data_dir():
43
+ from cortex.config import data_dir, WORKSPACES_DIR
44
+ d = data_dir()
45
+ assert str(WORKSPACES_DIR) in str(d)
46
+
47
+
48
+ def test_walk_code_files_skips_dirs():
49
+ import os, tempfile
50
+ from pathlib import Path
51
+ from cortex.indexer import _walk_code_files
52
+ with tempfile.TemporaryDirectory() as tmp:
53
+ root = Path(tmp)
54
+ (root / "node_modules").mkdir()
55
+ (root / "node_modules" / "lib.js").write_text("x")
56
+ (root / "src").mkdir()
57
+ (root / "src" / "main.py").write_text("x")
58
+ found = _walk_code_files(root, [])
59
+ paths = [str(p) for p in found]
60
+ assert any("main.py" in p for p in paths)
61
+ assert not any("node_modules" in p for p in paths)
62
+
63
+
64
+ def test_is_excluded_patterns():
65
+ from cortex.core.chunker import _is_excluded
66
+ assert _is_excluded("tmp/foo.log", ["tmp/*"])
67
+ assert not _is_excluded("src/main.py", ["tmp/*"])
68
+ assert _is_excluded("dist/bundle.js", ["dist/*"])
69
+
70
+
71
+ def test_fmt_stats_returns_string():
72
+ from cortex.core.formatters import fmt_stats
73
+ result = fmt_stats("2.3.8", {}, current=True)
74
+ assert isinstance(result, str)
75
+ assert len(result) > 0
76
+
77
+
42
78
  if __name__ == "__main__":
43
79
  import traceback
44
80
  tests = [v for k, v in list(globals().items()) if k.startswith("test_")]
File without changes
File without changes