cortex-local 2.3.6__tar.gz → 2.3.8__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.
- {cortex_local-2.3.6 → cortex_local-2.3.8}/PKG-INFO +1 -1
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/mcp_server.py +27 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/tests/test_imports.py +36 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/README.md +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/__init__.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/cli.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/config.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/core/__init__.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/core/cache.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/core/chunker.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/core/code_graph.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/core/formatters.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/core/global_graph.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/core/graph.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/core/notes_graph.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/core/roslyn_analyzer.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/core/roslyn_tool/CortexAnalyzer.csproj +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/core/roslyn_tool/Program.cs +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/embedder.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/indexer.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/state.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/cortex/watcher.py +0 -0
- {cortex_local-2.3.6 → cortex_local-2.3.8}/pyproject.toml +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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|