tree-sitter-analyzer 0.9.1__py3-none-any.whl → 0.9.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.

Files changed (64) hide show
  1. tree_sitter_analyzer/__init__.py +132 -132
  2. tree_sitter_analyzer/__main__.py +11 -11
  3. tree_sitter_analyzer/api.py +533 -533
  4. tree_sitter_analyzer/cli/__init__.py +39 -39
  5. tree_sitter_analyzer/cli/__main__.py +12 -12
  6. tree_sitter_analyzer/cli/commands/__init__.py +26 -26
  7. tree_sitter_analyzer/cli/commands/advanced_command.py +88 -88
  8. tree_sitter_analyzer/cli/commands/base_command.py +181 -178
  9. tree_sitter_analyzer/cli/commands/structure_command.py +138 -138
  10. tree_sitter_analyzer/cli/commands/summary_command.py +101 -101
  11. tree_sitter_analyzer/cli_main.py +7 -3
  12. tree_sitter_analyzer/core/__init__.py +15 -15
  13. tree_sitter_analyzer/core/analysis_engine.py +91 -87
  14. tree_sitter_analyzer/core/cache_service.py +320 -320
  15. tree_sitter_analyzer/core/engine.py +566 -566
  16. tree_sitter_analyzer/core/parser.py +293 -293
  17. tree_sitter_analyzer/encoding_utils.py +459 -459
  18. tree_sitter_analyzer/file_handler.py +210 -210
  19. tree_sitter_analyzer/formatters/__init__.py +1 -1
  20. tree_sitter_analyzer/formatters/base_formatter.py +167 -167
  21. tree_sitter_analyzer/formatters/formatter_factory.py +78 -78
  22. tree_sitter_analyzer/formatters/java_formatter.py +18 -18
  23. tree_sitter_analyzer/formatters/python_formatter.py +19 -19
  24. tree_sitter_analyzer/interfaces/__init__.py +9 -9
  25. tree_sitter_analyzer/interfaces/cli.py +528 -528
  26. tree_sitter_analyzer/interfaces/cli_adapter.py +344 -343
  27. tree_sitter_analyzer/interfaces/mcp_adapter.py +206 -206
  28. tree_sitter_analyzer/language_detector.py +53 -53
  29. tree_sitter_analyzer/languages/__init__.py +10 -10
  30. tree_sitter_analyzer/languages/java_plugin.py +1 -1
  31. tree_sitter_analyzer/languages/javascript_plugin.py +446 -446
  32. tree_sitter_analyzer/languages/python_plugin.py +755 -755
  33. tree_sitter_analyzer/mcp/__init__.py +34 -45
  34. tree_sitter_analyzer/mcp/resources/__init__.py +44 -44
  35. tree_sitter_analyzer/mcp/resources/code_file_resource.py +209 -209
  36. tree_sitter_analyzer/mcp/server.py +623 -568
  37. tree_sitter_analyzer/mcp/tools/__init__.py +30 -30
  38. tree_sitter_analyzer/mcp/tools/analyze_scale_tool.py +681 -673
  39. tree_sitter_analyzer/mcp/tools/analyze_scale_tool_cli_compatible.py +247 -247
  40. tree_sitter_analyzer/mcp/tools/base_tool.py +54 -54
  41. tree_sitter_analyzer/mcp/tools/read_partial_tool.py +310 -308
  42. tree_sitter_analyzer/mcp/tools/table_format_tool.py +386 -379
  43. tree_sitter_analyzer/mcp/tools/universal_analyze_tool.py +563 -559
  44. tree_sitter_analyzer/mcp/utils/__init__.py +107 -107
  45. tree_sitter_analyzer/models.py +10 -10
  46. tree_sitter_analyzer/output_manager.py +253 -253
  47. tree_sitter_analyzer/plugins/__init__.py +280 -280
  48. tree_sitter_analyzer/plugins/base.py +529 -529
  49. tree_sitter_analyzer/plugins/manager.py +379 -379
  50. tree_sitter_analyzer/project_detector.py +330 -317
  51. tree_sitter_analyzer/queries/__init__.py +26 -26
  52. tree_sitter_analyzer/queries/java.py +391 -391
  53. tree_sitter_analyzer/queries/javascript.py +148 -148
  54. tree_sitter_analyzer/queries/python.py +285 -285
  55. tree_sitter_analyzer/queries/typescript.py +229 -229
  56. tree_sitter_analyzer/query_loader.py +257 -257
  57. tree_sitter_analyzer/security/boundary_manager.py +57 -51
  58. tree_sitter_analyzer/security/validator.py +246 -241
  59. tree_sitter_analyzer/utils.py +294 -277
  60. {tree_sitter_analyzer-0.9.1.dist-info → tree_sitter_analyzer-0.9.3.dist-info}/METADATA +13 -13
  61. tree_sitter_analyzer-0.9.3.dist-info/RECORD +77 -0
  62. {tree_sitter_analyzer-0.9.1.dist-info → tree_sitter_analyzer-0.9.3.dist-info}/entry_points.txt +1 -0
  63. tree_sitter_analyzer-0.9.1.dist-info/RECORD +0 -77
  64. {tree_sitter_analyzer-0.9.1.dist-info → tree_sitter_analyzer-0.9.3.dist-info}/WHEEL +0 -0
@@ -1,107 +1,107 @@
1
- #!/usr/bin/env python3
2
- """
3
- MCP Utils Module
4
-
5
- This module provides utility functions and classes for the MCP server
6
- including error handling and other utilities.
7
-
8
- Note: Cache and performance monitoring functionality has been moved to
9
- the unified core services for better architecture.
10
- """
11
-
12
- from typing import Any
13
-
14
- # Export main utility classes and functions
15
- from .error_handler import (
16
- AnalysisError,
17
- ErrorCategory,
18
- ErrorHandler,
19
- ErrorSeverity,
20
- FileAccessError,
21
- MCPError,
22
- ParsingError,
23
- ResourceError,
24
- ValidationError,
25
- get_error_handler,
26
- handle_mcp_errors,
27
- )
28
-
29
- # Module metadata
30
- __version__ = "2.0.0"
31
- __author__ = "Tree-Sitter Analyzer Team"
32
-
33
- # MCP Utils capabilities
34
- MCP_UTILS_CAPABILITIES = {
35
- "version": "2.0.0",
36
- "features": [
37
- "Comprehensive Error Handling",
38
- "Unified Core Services Integration",
39
- ],
40
- "deprecated_features": [
41
- "LRU Cache with TTL (moved to core.cache_service)",
42
- "Performance Monitoring (moved to core.analysis_engine)",
43
- ],
44
- }
45
-
46
- # Import unified services for backward compatibility
47
- try:
48
- from ...core.analysis_engine import UnifiedAnalysisEngine
49
- from ...core.cache_service import CacheService as UnifiedCacheService
50
-
51
- # Provide backward compatibility aliases
52
- class BackwardCompatibleCacheManager:
53
- """Backward compatible cache manager wrapper"""
54
-
55
- def __init__(self) -> None:
56
- self._cache_service = UnifiedCacheService()
57
-
58
- def clear_all_caches(self) -> None:
59
- """Backward compatibility: clear all caches"""
60
- return self._cache_service.clear()
61
-
62
- def get_cache_stats(self) -> dict[str, Any]:
63
- """Backward compatibility: get cache statistics"""
64
- return self._cache_service.get_stats()
65
-
66
- def __getattr__(self, name: str) -> Any:
67
- """Delegate other methods to the cache service"""
68
- return getattr(self._cache_service, name)
69
-
70
- def get_cache_manager() -> Any:
71
- """Backward compatibility: Get unified cache service"""
72
- return BackwardCompatibleCacheManager()
73
-
74
- def get_performance_monitor() -> Any:
75
- """Backward compatibility: Get unified analysis engine for performance monitoring"""
76
- return UnifiedAnalysisEngine()
77
-
78
- except ImportError:
79
- # Fallback if core services are not available
80
- def get_cache_manager() -> Any:
81
- """Fallback cache manager"""
82
- return None
83
-
84
- def get_performance_monitor() -> Any:
85
- """Fallback performance monitor"""
86
- return None
87
-
88
-
89
- __all__ = [
90
- # Error handling
91
- "ErrorHandler",
92
- "MCPError",
93
- "FileAccessError",
94
- "ParsingError",
95
- "AnalysisError",
96
- "ValidationError",
97
- "ResourceError",
98
- "ErrorSeverity",
99
- "ErrorCategory",
100
- "handle_mcp_errors",
101
- "get_error_handler",
102
- # Backward compatibility
103
- "get_cache_manager",
104
- "get_performance_monitor",
105
- # Module metadata
106
- "MCP_UTILS_CAPABILITIES",
107
- ]
1
+ #!/usr/bin/env python3
2
+ """
3
+ MCP Utils Module
4
+
5
+ This module provides utility functions and classes for the MCP server
6
+ including error handling and other utilities.
7
+
8
+ Note: Cache and performance monitoring functionality has been moved to
9
+ the unified core services for better architecture.
10
+ """
11
+
12
+ from typing import Any
13
+
14
+ # Export main utility classes and functions
15
+ from .error_handler import (
16
+ AnalysisError,
17
+ ErrorCategory,
18
+ ErrorHandler,
19
+ ErrorSeverity,
20
+ FileAccessError,
21
+ MCPError,
22
+ ParsingError,
23
+ ResourceError,
24
+ ValidationError,
25
+ get_error_handler,
26
+ handle_mcp_errors,
27
+ )
28
+
29
+ # Module metadata
30
+ __version__ = "2.0.0"
31
+ __author__ = "Tree-Sitter Analyzer Team"
32
+
33
+ # MCP Utils capabilities
34
+ MCP_UTILS_CAPABILITIES = {
35
+ "version": "2.0.0",
36
+ "features": [
37
+ "Comprehensive Error Handling",
38
+ "Unified Core Services Integration",
39
+ ],
40
+ "deprecated_features": [
41
+ "LRU Cache with TTL (moved to core.cache_service)",
42
+ "Performance Monitoring (moved to core.analysis_engine)",
43
+ ],
44
+ }
45
+
46
+ # Import unified services for backward compatibility
47
+ try:
48
+ from ...core.analysis_engine import UnifiedAnalysisEngine
49
+ from ...core.cache_service import CacheService as UnifiedCacheService
50
+
51
+ # Provide backward compatibility aliases
52
+ class BackwardCompatibleCacheManager:
53
+ """Backward compatible cache manager wrapper"""
54
+
55
+ def __init__(self) -> None:
56
+ self._cache_service = UnifiedCacheService()
57
+
58
+ def clear_all_caches(self) -> None:
59
+ """Backward compatibility: clear all caches"""
60
+ return self._cache_service.clear()
61
+
62
+ def get_cache_stats(self) -> dict[str, Any]:
63
+ """Backward compatibility: get cache statistics"""
64
+ return self._cache_service.get_stats()
65
+
66
+ def __getattr__(self, name: str) -> Any:
67
+ """Delegate other methods to the cache service"""
68
+ return getattr(self._cache_service, name)
69
+
70
+ def get_cache_manager() -> Any:
71
+ """Backward compatibility: Get unified cache service"""
72
+ return BackwardCompatibleCacheManager()
73
+
74
+ def get_performance_monitor() -> Any:
75
+ """Backward compatibility: Get unified analysis engine for performance monitoring"""
76
+ return UnifiedAnalysisEngine()
77
+
78
+ except ImportError:
79
+ # Fallback if core services are not available
80
+ def get_cache_manager() -> Any:
81
+ """Fallback cache manager"""
82
+ return None
83
+
84
+ def get_performance_monitor() -> Any:
85
+ """Fallback performance monitor"""
86
+ return None
87
+
88
+
89
+ __all__ = [
90
+ # Error handling
91
+ "ErrorHandler",
92
+ "MCPError",
93
+ "FileAccessError",
94
+ "ParsingError",
95
+ "AnalysisError",
96
+ "ValidationError",
97
+ "ResourceError",
98
+ "ErrorSeverity",
99
+ "ErrorCategory",
100
+ "handle_mcp_errors",
101
+ "get_error_handler",
102
+ # Backward compatibility
103
+ "get_cache_manager",
104
+ "get_performance_monitor",
105
+ # Module metadata
106
+ "MCP_UTILS_CAPABILITIES",
107
+ ]
@@ -139,7 +139,7 @@ class JavaAnnotation:
139
139
  raw_text: str = ""
140
140
 
141
141
  def to_summary_item(self) -> dict[str, Any]:
142
- """要約アイテムとして辞書を返す"""
142
+ """Return dictionary for summary item"""
143
143
  return {
144
144
  "name": self.name,
145
145
  "type": "annotation",
@@ -168,7 +168,7 @@ class JavaMethod:
168
168
  file_path: str = ""
169
169
 
170
170
  def to_summary_item(self) -> dict[str, Any]:
171
- """要約アイテムとして辞書を返す"""
171
+ """Return dictionary for summary item"""
172
172
  return {
173
173
  "name": self.name,
174
174
  "type": "method",
@@ -196,7 +196,7 @@ class JavaClass:
196
196
  file_path: str = ""
197
197
 
198
198
  def to_summary_item(self) -> dict[str, Any]:
199
- """要約アイテムとして辞書を返す"""
199
+ """Return dictionary for summary item"""
200
200
  return {
201
201
  "name": self.name,
202
202
  "type": "class",
@@ -220,7 +220,7 @@ class JavaField:
220
220
  file_path: str = ""
221
221
 
222
222
  def to_summary_item(self) -> dict[str, Any]:
223
- """要約アイテムとして辞書を返す"""
223
+ """Return dictionary for summary item"""
224
224
  return {
225
225
  "name": self.name,
226
226
  "type": "field",
@@ -322,11 +322,11 @@ class AnalysisResult:
322
322
 
323
323
  def to_summary_dict(self, types: list[str] | None = None) -> dict[str, Any]:
324
324
  """
325
- 分析結果の要約を辞書として返します。
326
- 指定された型('classes', 'methods', 'fields'など)の要素のみを含みます。
325
+ Return analysis summary as a dictionary.
326
+ Only include specified element types (e.g., 'classes', 'methods', 'fields').
327
327
  """
328
328
  if types is None:
329
- types = ["classes", "methods"] # デフォルト値
329
+ types = ["classes", "methods"] # default
330
330
 
331
331
  summary: dict[str, Any] = {"file_path": self.file_path, "summary_elements": []}
332
332
 
@@ -341,7 +341,7 @@ class AnalysisResult:
341
341
  for type_name, elements in all_elements.items():
342
342
  if "all" in types or type_name in types:
343
343
  for element in elements:
344
- # 各要素モデルの to_summary_item() を呼び出し
344
+ # Call each element model's to_summary_item()
345
345
  summary["summary_elements"].append(element.to_summary_item())
346
346
 
347
347
  return summary
@@ -362,10 +362,10 @@ class AnalysisResult:
362
362
 
363
363
  def to_mcp_format(self) -> dict[str, Any]:
364
364
  """
365
- MCP形式での出力を生成
365
+ Produce output in MCP-compatible format
366
366
 
367
367
  Returns:
368
- MCP形式の分析結果辞書
368
+ MCP-style result dictionary
369
369
  """
370
370
  # packageの安全な処理
371
371
  package_info = None