tree-sitter-analyzer 0.8.1__py3-none-any.whl → 0.8.3__py3-none-any.whl
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 tree-sitter-analyzer might be problematic. Click here for more details.
- tree_sitter_analyzer/__init__.py +1 -1
- tree_sitter_analyzer/cli/commands/base_command.py +3 -1
- tree_sitter_analyzer/cli/commands/query_command.py +1 -1
- tree_sitter_analyzer/mcp/server.py +29 -1
- tree_sitter_analyzer/mcp/tools/analyze_scale_tool.py +677 -673
- tree_sitter_analyzer/mcp/tools/analyze_scale_tool_cli_compatible.py +4 -9
- tree_sitter_analyzer/mcp/utils/error_handler.py +18 -0
- tree_sitter_analyzer/project_detector.py +317 -317
- tree_sitter_analyzer/security/__init__.py +22 -22
- tree_sitter_analyzer/security/boundary_manager.py +44 -2
- tree_sitter_analyzer/security/regex_checker.py +292 -292
- tree_sitter_analyzer/security/validator.py +5 -2
- {tree_sitter_analyzer-0.8.1.dist-info → tree_sitter_analyzer-0.8.3.dist-info}/METADATA +35 -7
- {tree_sitter_analyzer-0.8.1.dist-info → tree_sitter_analyzer-0.8.3.dist-info}/RECORD +16 -16
- {tree_sitter_analyzer-0.8.1.dist-info → tree_sitter_analyzer-0.8.3.dist-info}/WHEEL +0 -0
- {tree_sitter_analyzer-0.8.1.dist-info → tree_sitter_analyzer-0.8.3.dist-info}/entry_points.txt +0 -0
|
@@ -99,14 +99,12 @@ class AnalyzeScaleToolCLICompatible:
|
|
|
99
99
|
logger.info(f"Analyzing code scale for {file_path} (language: {language})")
|
|
100
100
|
|
|
101
101
|
try:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
# Use AdvancedAnalyzer for comprehensive analysis
|
|
102
|
+
# Use higher precision timer and measure ONLY the engine call
|
|
103
|
+
start_time = time.perf_counter()
|
|
105
104
|
analysis_result = await self.analysis_engine.analyze_file(file_path)
|
|
105
|
+
analysis_time_ms = round((time.perf_counter() - start_time) * 1000, 2)
|
|
106
106
|
|
|
107
107
|
# Handle potential None result (for testing purposes with mocked engine)
|
|
108
|
-
# This can only happen in tests where the engine is mocked to return None
|
|
109
|
-
# Use cast to tell MyPy this is possible in testing scenarios
|
|
110
108
|
if cast(Any, analysis_result) is None:
|
|
111
109
|
return {
|
|
112
110
|
"file_path": file_path,
|
|
@@ -119,13 +117,10 @@ class AnalyzeScaleToolCLICompatible:
|
|
|
119
117
|
"fields": 0,
|
|
120
118
|
"annotations": 0,
|
|
121
119
|
},
|
|
122
|
-
"analysis_time_ms":
|
|
120
|
+
"analysis_time_ms": analysis_time_ms,
|
|
123
121
|
"error_message": f"Failed to analyze file: {file_path}",
|
|
124
122
|
}
|
|
125
123
|
|
|
126
|
-
# Calculate analysis time
|
|
127
|
-
analysis_time_ms = round((time.time() - start_time) * 1000, 2)
|
|
128
|
-
|
|
129
124
|
# Build CLI-compatible result structure (exact match with CLI --advanced --statistics)
|
|
130
125
|
result = {
|
|
131
126
|
"file_path": file_path,
|
|
@@ -491,6 +491,24 @@ def handle_mcp_errors(
|
|
|
491
491
|
async def async_wrapper(*args: Any, **kwargs: Any) -> Any:
|
|
492
492
|
try:
|
|
493
493
|
return await func(*args, **kwargs)
|
|
494
|
+
except RuntimeError as e:
|
|
495
|
+
# Handle initialization errors specifically
|
|
496
|
+
if "not fully initialized" in str(e):
|
|
497
|
+
logger.warning(f"Request received before initialization complete: {operation}")
|
|
498
|
+
raise MCPError(
|
|
499
|
+
"Server is still initializing. Please wait a moment and try again.",
|
|
500
|
+
category=ErrorCategory.CONFIGURATION,
|
|
501
|
+
severity=ErrorSeverity.LOW
|
|
502
|
+
) from e
|
|
503
|
+
# Handle other runtime errors normally
|
|
504
|
+
error_handler = get_error_handler()
|
|
505
|
+
context = {
|
|
506
|
+
"function": func.__name__,
|
|
507
|
+
"args": str(args)[:200], # Limit length
|
|
508
|
+
"kwargs": str(kwargs)[:200],
|
|
509
|
+
}
|
|
510
|
+
error_info = error_handler.handle_error(e, context, operation)
|
|
511
|
+
raise
|
|
494
512
|
except Exception as e:
|
|
495
513
|
error_handler = get_error_handler()
|
|
496
514
|
context = {
|