lean-lsp-mcp 0.16.0__tar.gz → 0.16.1__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 (30) hide show
  1. {lean_lsp_mcp-0.16.0/src/lean_lsp_mcp.egg-info → lean_lsp_mcp-0.16.1}/PKG-INFO +1 -1
  2. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/pyproject.toml +1 -1
  3. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp/server.py +37 -31
  4. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1/src/lean_lsp_mcp.egg-info}/PKG-INFO +1 -1
  5. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/LICENSE +0 -0
  6. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/README.md +0 -0
  7. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/setup.cfg +0 -0
  8. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp/__init__.py +0 -0
  9. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp/__main__.py +0 -0
  10. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp/client_utils.py +0 -0
  11. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp/file_utils.py +0 -0
  12. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp/instructions.py +0 -0
  13. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp/loogle.py +0 -0
  14. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp/models.py +0 -0
  15. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp/outline_utils.py +0 -0
  16. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp/search_utils.py +0 -0
  17. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp/utils.py +0 -0
  18. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp.egg-info/SOURCES.txt +0 -0
  19. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp.egg-info/dependency_links.txt +0 -0
  20. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp.egg-info/entry_points.txt +0 -0
  21. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp.egg-info/requires.txt +0 -0
  22. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/src/lean_lsp_mcp.egg-info/top_level.txt +0 -0
  23. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/tests/test_diagnostic_line_range.py +0 -0
  24. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/tests/test_editor_tools.py +0 -0
  25. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/tests/test_file_caching.py +0 -0
  26. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/tests/test_logging.py +0 -0
  27. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/tests/test_misc_tools.py +0 -0
  28. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/tests/test_outline.py +0 -0
  29. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/tests/test_project_tools.py +0 -0
  30. {lean_lsp_mcp-0.16.0 → lean_lsp_mcp-0.16.1}/tests/test_search_tools.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lean-lsp-mcp
3
- Version: 0.16.0
3
+ Version: 0.16.1
4
4
  Summary: Lean Theorem Prover MCP
5
5
  Author-email: Oliver Dressler <hey@oli.show>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "lean-lsp-mcp"
3
- version = "0.16.0"
3
+ version = "0.16.1"
4
4
  description = "Lean Theorem Prover MCP"
5
5
  authors = [{name="Oliver Dressler", email="hey@oli.show"}]
6
6
  readme = "README.md"
@@ -9,7 +9,6 @@ from dataclasses import dataclass
9
9
  import urllib
10
10
  import orjson
11
11
  import functools
12
- import subprocess
13
12
  import uuid
14
13
  from pathlib import Path
15
14
 
@@ -196,7 +195,7 @@ def rate_limited(category: str, max_requests: int, per_seconds: int):
196
195
  annotations=ToolAnnotations(
197
196
  title="Build Project",
198
197
  readOnlyHint=False,
199
- destructiveHint=False,
198
+ destructiveHint=True,
200
199
  idempotentHint=True,
201
200
  openWorldHint=False,
202
201
  ),
@@ -207,6 +206,9 @@ async def lsp_build(
207
206
  Optional[str], Field(description="Path to Lean project")
208
207
  ] = None,
209
208
  clean: Annotated[bool, Field(description="Run lake clean first (slow)")] = False,
209
+ output_lines: Annotated[
210
+ int, Field(description="Return last N lines of build log (0=none)")
211
+ ] = 20,
210
212
  ) -> BuildResult:
211
213
  """Build the Lean project and restart LSP. Use only if needed (e.g. new imports)."""
212
214
  if not lean_project_path:
@@ -220,7 +222,7 @@ async def lsp_build(
220
222
  "Lean project path not known yet. Provide `lean_project_path` explicitly or call another tool first."
221
223
  )
222
224
 
223
- output_lines: List[str] = []
225
+ log_lines: List[str] = []
224
226
  errors: List[str] = []
225
227
 
226
228
  try:
@@ -230,13 +232,21 @@ async def lsp_build(
230
232
  client.close()
231
233
 
232
234
  if clean:
233
- subprocess.run(["lake", "clean"], cwd=lean_project_path_obj, check=False)
234
- logger.info("Ran `lake clean`")
235
+ await ctx.report_progress(
236
+ progress=1, total=16, message="Running `lake clean`"
237
+ )
238
+ clean_proc = await asyncio.create_subprocess_exec(
239
+ "lake", "clean", cwd=lean_project_path_obj
240
+ )
241
+ await clean_proc.wait()
235
242
 
236
- # Fetch cache
237
- subprocess.run(
238
- ["lake", "exe", "cache", "get"], cwd=lean_project_path_obj, check=False
243
+ await ctx.report_progress(
244
+ progress=2, total=16, message="Running `lake exe cache get`"
245
+ )
246
+ cache_proc = await asyncio.create_subprocess_exec(
247
+ "lake", "exe", "cache", "get", cwd=lean_project_path_obj
239
248
  )
249
+ await cache_proc.wait()
240
250
 
241
251
  # Run build with progress reporting
242
252
  process = await asyncio.create_subprocess_exec(
@@ -248,32 +258,24 @@ async def lsp_build(
248
258
  stderr=asyncio.subprocess.STDOUT,
249
259
  )
250
260
 
251
- while True:
252
- line = await process.stdout.readline()
253
- if not line:
254
- break
255
-
261
+ while line := await process.stdout.readline():
256
262
  line_str = line.decode("utf-8", errors="replace").rstrip()
257
- output_lines.append(line_str)
258
263
 
259
- # Collect error lines
264
+ if line_str.startswith("trace:") or "LEAN_PATH=" in line_str:
265
+ continue
266
+
267
+ log_lines.append(line_str)
260
268
  if "error" in line_str.lower():
261
269
  errors.append(line_str)
262
270
 
263
- # Parse progress: look for pattern like "[2/8]" or "[10/100]"
264
- match = re.search(r"\[(\d+)/(\d+)\]", line_str)
265
- if match:
266
- current_job = int(match.group(1))
267
- total_jobs = int(match.group(2))
268
-
269
- # Extract what's being built
270
- desc_match = re.search(
271
- r"\[\d+/\d+\]\s+(.+?)(?:\s+\(\d+\.?\d*[ms]+\))?$", line_str
272
- )
273
- description = desc_match.group(1) if desc_match else "Building"
274
-
271
+ # Parse progress: "[2/8] Building Foo (1.2s)" -> (2, 8, "Building Foo")
272
+ if m := re.search(
273
+ r"\[(\d+)/(\d+)\]\s*(.+?)(?:\s+\(\d+\.?\d*[ms]+\))?$", line_str
274
+ ):
275
275
  await ctx.report_progress(
276
- progress=current_job, total=total_jobs, message=description
276
+ progress=int(m.group(1)),
277
+ total=int(m.group(2)),
278
+ message=m.group(3) or "Building",
277
279
  )
278
280
 
279
281
  await process.wait()
@@ -281,7 +283,7 @@ async def lsp_build(
281
283
  if process.returncode != 0:
282
284
  return BuildResult(
283
285
  success=False,
284
- output="\n".join(output_lines),
286
+ output="\n".join(log_lines[-output_lines:]) if output_lines else "",
285
287
  errors=errors
286
288
  or [f"Build failed with return code {process.returncode}"],
287
289
  )
@@ -295,12 +297,16 @@ async def lsp_build(
295
297
  logger.info("Built project and re-started LSP client")
296
298
  ctx.request_context.lifespan_context.client = client
297
299
 
298
- return BuildResult(success=True, output="\n".join(output_lines), errors=[])
300
+ return BuildResult(
301
+ success=True,
302
+ output="\n".join(log_lines[-output_lines:]) if output_lines else "",
303
+ errors=[],
304
+ )
299
305
 
300
306
  except Exception as e:
301
307
  return BuildResult(
302
308
  success=False,
303
- output="\n".join(output_lines),
309
+ output="\n".join(log_lines[-output_lines:]) if output_lines else "",
304
310
  errors=[str(e)],
305
311
  )
306
312
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lean-lsp-mcp
3
- Version: 0.16.0
3
+ Version: 0.16.1
4
4
  Summary: Lean Theorem Prover MCP
5
5
  Author-email: Oliver Dressler <hey@oli.show>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes