codecortex 0.8.3__tar.gz → 0.8.4__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.

Potentially problematic release.


This version of codecortex might be problematic. Click here for more details.

Files changed (69) hide show
  1. {codecortex-0.8.3/src/codecortex.egg-info → codecortex-0.8.4}/PKG-INFO +1 -1
  2. {codecortex-0.8.3 → codecortex-0.8.4/src/codecortex.egg-info}/PKG-INFO +1 -1
  3. {codecortex-0.8.3 → codecortex-0.8.4}/src/codecortex.egg-info/SOURCES.txt +1 -0
  4. codecortex-0.8.4/src/codeintel/__init__.py +1 -0
  5. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/server.py +44 -5
  6. codecortex-0.8.4/tests/test_mcp_server.py +42 -0
  7. codecortex-0.8.3/src/codeintel/__init__.py +0 -1
  8. {codecortex-0.8.3 → codecortex-0.8.4}/LICENSE +0 -0
  9. {codecortex-0.8.3 → codecortex-0.8.4}/README.md +0 -0
  10. {codecortex-0.8.3 → codecortex-0.8.4}/pyproject.toml +0 -0
  11. {codecortex-0.8.3 → codecortex-0.8.4}/setup.cfg +0 -0
  12. {codecortex-0.8.3 → codecortex-0.8.4}/src/codecortex.egg-info/dependency_links.txt +0 -0
  13. {codecortex-0.8.3 → codecortex-0.8.4}/src/codecortex.egg-info/entry_points.txt +0 -0
  14. {codecortex-0.8.3 → codecortex-0.8.4}/src/codecortex.egg-info/requires.txt +0 -0
  15. {codecortex-0.8.3 → codecortex-0.8.4}/src/codecortex.egg-info/top_level.txt +0 -0
  16. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/__main__.py +0 -0
  17. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/auth.py +0 -0
  18. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/cache.py +0 -0
  19. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/config.py +0 -0
  20. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/doctor.py +0 -0
  21. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/gateway.py +0 -0
  22. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/http_server.py +0 -0
  23. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/indexer.py +0 -0
  24. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/injector.py +0 -0
  25. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/installer.py +0 -0
  26. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/logconfig.py +0 -0
  27. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/mapper.py +0 -0
  28. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/metrics.py +0 -0
  29. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/onboarding.py +0 -0
  30. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/policy.py +0 -0
  31. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/provider.py +0 -0
  32. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/providers/__init__.py +0 -0
  33. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/providers/graph.py +0 -0
  34. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/providers/lsp.py +0 -0
  35. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/providers/none.py +0 -0
  36. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/providers/semantic.py +0 -0
  37. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/reindexer.py +0 -0
  38. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/reset.py +0 -0
  39. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/searcher.py +0 -0
  40. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/semantic_db.py +0 -0
  41. {codecortex-0.8.3 → codecortex-0.8.4}/src/codeintel/term.py +0 -0
  42. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_cache.py +0 -0
  43. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_chunking.py +0 -0
  44. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_config.py +0 -0
  45. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_doctor.py +0 -0
  46. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_e2e.py +0 -0
  47. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_enterprise.py +0 -0
  48. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_gateway.py +0 -0
  49. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_graph_provider.py +0 -0
  50. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_graph_real.py +0 -0
  51. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_graph_stdin.py +0 -0
  52. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_hardening.py +0 -0
  53. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_http_auth.py +0 -0
  54. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_http_server.py +0 -0
  55. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_installer.py +0 -0
  56. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_integration.py +0 -0
  57. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_lsp_provider.py +0 -0
  58. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_lsp_real.py +0 -0
  59. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_mapper.py +0 -0
  60. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_model_dimension.py +0 -0
  61. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_never_raise.py +0 -0
  62. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_onboarding.py +0 -0
  63. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_rbac.py +0 -0
  64. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_reindexer.py +0 -0
  65. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_rerank.py +0 -0
  66. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_reset.py +0 -0
  67. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_semantic_provider.py +0 -0
  68. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_term.py +0 -0
  69. {codecortex-0.8.3 → codecortex-0.8.4}/tests/test_treesitter.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codecortex
3
- Version: 0.8.3
3
+ Version: 0.8.4
4
4
  Summary: Local-first, MCP-native code-intelligence server — graph, LSP, and semantic search behind one safe code.query tool for coding agents.
5
5
  Author: Shammai Hamilton
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codecortex
3
- Version: 0.8.3
3
+ Version: 0.8.4
4
4
  Summary: Local-first, MCP-native code-intelligence server — graph, LSP, and semantic search behind one safe code.query tool for coding agents.
5
5
  Author: Shammai Hamilton
6
6
  License-Expression: MIT
@@ -53,6 +53,7 @@ tests/test_integration.py
53
53
  tests/test_lsp_provider.py
54
54
  tests/test_lsp_real.py
55
55
  tests/test_mapper.py
56
+ tests/test_mcp_server.py
56
57
  tests/test_model_dimension.py
57
58
  tests/test_never_raise.py
58
59
  tests/test_onboarding.py
@@ -0,0 +1 @@
1
+ __version__ = "0.8.4"
@@ -218,10 +218,32 @@ def code_map_handler(args: dict) -> dict:
218
218
  return {"ok": True, "path": None, "size_bytes": 0, "note": "map-error"}
219
219
 
220
220
 
221
+ # Surfaced by the MCP client to the model on connect (the standard `instructions` field): this is
222
+ # how codeintel becomes the *default* way an agent understands code after `codeintel install`,
223
+ # rather than just an available tool the agent may ignore in favor of grep/file-read.
224
+ _MCP_INSTRUCTIONS = (
225
+ "codeintel unifies three code-intelligence engines — graph (call/import structure), LSP "
226
+ "(precise symbols/references), and semantic (embedding search) — behind one never-raise "
227
+ "`code.query` tool.\n\n"
228
+ "Prefer `code.query` as your FIRST step for understanding an unfamiliar or large codebase, "
229
+ "instead of grepping or reading files one by one: use it for who-calls-X (callers), what-X-calls "
230
+ "(callees), impact of a change, where-a-symbol-is-defined, how a call chain flows, and "
231
+ "natural-language 'find the code that does Y' search. It is graph-augmented and ranked, so it "
232
+ "beats raw grep for locating and relating code.\n\n"
233
+ "Orient on a new repo with `code.map` (ranked architecture: top symbols, entry points, routes). "
234
+ "If results look empty, call `code.doctor` — it says exactly what to index or install. "
235
+ "`code.status` reports engine health.\n\n"
236
+ "Every result is a safe envelope: `ok` is always true; a null `result` with a `reason` means "
237
+ "'nothing found / not indexed yet', NOT an error — read the `reason`/`hint` and, if it says the "
238
+ "repo isn't indexed, that resolves on the first query or via `codeintel index`."
239
+ )
240
+
241
+
221
242
  def run() -> None:
243
+ from codeintel import __version__
222
244
  from codeintel.logconfig import configure_logging
223
245
  configure_logging() # logs to stderr; stdout is the MCP protocol channel
224
- mcp = MCPServer(name="codeintel")
246
+ mcp = MCPServer(name="codeintel", version=__version__, instructions=_MCP_INSTRUCTIONS)
225
247
 
226
248
  async def _code_query(
227
249
  op: str = "",
@@ -243,9 +265,26 @@ def run() -> None:
243
265
  async def _code_map(project_root: str = "", budget: int = 32768, inject: bool = False) -> dict:
244
266
  return code_map_handler({"project_root": project_root, "budget": budget, "inject": inject})
245
267
 
246
- mcp.add_tool(_code_query, name="code.query", description="Query the code intelligence engine")
247
- mcp.add_tool(_code_status, name="code.status", description="Return engine status")
248
- mcp.add_tool(_code_doctor, name="code.doctor", description="Diagnose engine health + repo index status with remediation")
249
- mcp.add_tool(_code_map, name="code.map", description="Generate or refresh CODE_INTEL.md orientation file")
268
+ mcp.add_tool(_code_query, name="code.query", description=(
269
+ "Understand code across graph + LSP + semantic engines — prefer this over grep/file-read "
270
+ "for locating and relating code. ops: `search` (natural-language or symbol semantic search), "
271
+ "`symbol` (definition/signature), `callers`, `callees`, `impact`, `chain` (\"A->B\" call "
272
+ "path), `pattern` (graph-augmented grep), `overview` (architecture), `context` (fan-out). "
273
+ "`target` is the symbol/query; optional `engine` (auto|graph|lsp|semantic), `project_root`. "
274
+ "Never raises: `ok` is always true; a null `result` + `reason` means not-found/not-indexed."
275
+ ))
276
+ mcp.add_tool(_code_status, name="code.status", description=(
277
+ "Which engines (graph/LSP/semantic) are available and whether this repo is indexed. Check "
278
+ "this first if code.query keeps returning nothing."
279
+ ))
280
+ mcp.add_tool(_code_doctor, name="code.doctor", description=(
281
+ "Diagnose engine health + this repo's index status, with a concrete fix for each gap (what "
282
+ "to install or index). Run when code.query results look empty or an engine seems missing."
283
+ ))
284
+ mcp.add_tool(_code_map, name="code.map", description=(
285
+ "Generate/refresh CODE_INTEL.md — a ranked architecture overview (node/edge counts, top "
286
+ "symbols by caller count, entry points, routes). A great first call to orient on an "
287
+ "unfamiliar repo."
288
+ ))
250
289
 
251
290
  anyio.run(mcp.run_stdio_async)
@@ -0,0 +1,42 @@
1
+ """MCP server advertisement (0.8.4).
2
+
3
+ `codeintel install` only makes the tools *available*; for an agent to actually reach for them
4
+ instead of grep/file-read, the server must advertise itself — the standard MCP `instructions`
5
+ field plus tool descriptions that say when to use each. These assert that wiring.
6
+ """
7
+ from __future__ import annotations
8
+
9
+ import codeintel.server as srv
10
+
11
+
12
+ def test_server_advertises_instructions_and_rich_tool_descriptions(monkeypatch):
13
+ captured: dict = {"kwargs": None, "tools": {}}
14
+
15
+ class _FakeMCP:
16
+ def __init__(self, **kwargs):
17
+ captured["kwargs"] = kwargs
18
+
19
+ def add_tool(self, fn, name=None, description=None):
20
+ captured["tools"][name] = description or ""
21
+
22
+ async def run_stdio_async(self): # pragma: no cover - never awaited (anyio.run stubbed)
23
+ pass
24
+
25
+ monkeypatch.setattr(srv, "MCPServer", _FakeMCP)
26
+ monkeypatch.setattr(srv.anyio, "run", lambda *a, **k: None) # don't block on stdio
27
+
28
+ srv.run()
29
+
30
+ kw = captured["kwargs"]
31
+ assert kw["name"] == "codeintel"
32
+ assert kw.get("version") # server reports its version
33
+ instr = kw.get("instructions") or ""
34
+ assert "code.query" in instr
35
+ assert "grep" in instr.lower() # explicitly steers the agent away from grep/file-read
36
+ assert "reason" in instr # explains the never-raise safe-null envelope
37
+
38
+ tools = captured["tools"]
39
+ assert set(tools) == {"code.query", "code.status", "code.doctor", "code.map"}
40
+ # the primary tool sells when to use it, not the old throwaway one-liner
41
+ q = tools["code.query"]
42
+ assert "callers" in q and "grep" in q.lower() and len(q) > 100
@@ -1 +0,0 @@
1
- __version__ = "0.8.3"
File without changes
File without changes
File without changes
File without changes
File without changes