tree-sitter-analyzer 1.0.0__py3-none-any.whl → 1.1.1__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 (29) hide show
  1. tree_sitter_analyzer/__init__.py +132 -132
  2. tree_sitter_analyzer/api.py +542 -542
  3. tree_sitter_analyzer/cli/commands/base_command.py +181 -181
  4. tree_sitter_analyzer/cli/commands/partial_read_command.py +139 -139
  5. tree_sitter_analyzer/cli/info_commands.py +124 -124
  6. tree_sitter_analyzer/cli_main.py +327 -327
  7. tree_sitter_analyzer/core/analysis_engine.py +584 -584
  8. tree_sitter_analyzer/core/query_service.py +162 -162
  9. tree_sitter_analyzer/file_handler.py +212 -212
  10. tree_sitter_analyzer/formatters/base_formatter.py +169 -169
  11. tree_sitter_analyzer/interfaces/cli.py +535 -535
  12. tree_sitter_analyzer/mcp/__init__.py +1 -1
  13. tree_sitter_analyzer/mcp/resources/__init__.py +0 -1
  14. tree_sitter_analyzer/mcp/resources/project_stats_resource.py +16 -5
  15. tree_sitter_analyzer/mcp/server.py +655 -655
  16. tree_sitter_analyzer/mcp/tools/__init__.py +28 -30
  17. tree_sitter_analyzer/mcp/utils/__init__.py +1 -2
  18. tree_sitter_analyzer/mcp/utils/error_handler.py +569 -569
  19. tree_sitter_analyzer/mcp/utils/path_resolver.py +414 -414
  20. tree_sitter_analyzer/output_manager.py +257 -257
  21. tree_sitter_analyzer/project_detector.py +330 -330
  22. tree_sitter_analyzer/security/boundary_manager.py +260 -260
  23. tree_sitter_analyzer/security/validator.py +257 -257
  24. tree_sitter_analyzer/table_formatter.py +710 -710
  25. tree_sitter_analyzer/utils.py +335 -335
  26. {tree_sitter_analyzer-1.0.0.dist-info → tree_sitter_analyzer-1.1.1.dist-info}/METADATA +12 -12
  27. {tree_sitter_analyzer-1.0.0.dist-info → tree_sitter_analyzer-1.1.1.dist-info}/RECORD +29 -29
  28. {tree_sitter_analyzer-1.0.0.dist-info → tree_sitter_analyzer-1.1.1.dist-info}/WHEEL +0 -0
  29. {tree_sitter_analyzer-1.0.0.dist-info → tree_sitter_analyzer-1.1.1.dist-info}/entry_points.txt +0 -0
@@ -15,7 +15,7 @@ try:
15
15
  __version__ = main_version
16
16
  except ImportError:
17
17
  # Fallback version if main package not available
18
- __version__ = "0.9.1"
18
+ __version__ = "1.1.1"
19
19
 
20
20
  __author__ = "Tree-sitter Analyzer Team"
21
21
 
@@ -19,7 +19,6 @@ from .code_file_resource import CodeFileResource
19
19
  from .project_stats_resource import ProjectStatsResource
20
20
 
21
21
  # Resource metadata
22
- __version__ = "1.0.0"
23
22
  __author__ = "Tree-Sitter Analyzer Team"
24
23
 
25
24
  # MCP Resource capabilities
@@ -123,8 +123,8 @@ class ProjectStatsResource:
123
123
 
124
124
  self._project_path = project_path
125
125
 
126
- # Initialize analyzers with the project path
127
- self._advanced_analyzer = get_analysis_engine()
126
+ # Note: analysis_engine is already initialized in __init__
127
+ # No need to reinitialize here
128
128
 
129
129
  logger.debug(f"Set project path to: {project_path}")
130
130
 
@@ -336,16 +336,27 @@ class ProjectStatsResource:
336
336
 
337
337
  # Use appropriate analyzer based on language
338
338
  if language == "java":
339
- # Use advanced analyzer for Java
340
- # 使用 await 调用异步方法
341
- file_analysis = await self._advanced_analyzer.analyze_file(
339
+ # Use analysis engine for Java
340
+ file_analysis = await self.analysis_engine.analyze_file(
342
341
  str(file_path)
343
342
  )
344
343
  if file_analysis and hasattr(file_analysis, "methods"):
344
+ # Extract complexity from methods if available
345
345
  complexity = sum(
346
346
  method.complexity_score or 0
347
347
  for method in file_analysis.methods
348
348
  )
349
+ elif file_analysis and hasattr(file_analysis, "elements"):
350
+ # Extract complexity from elements for new architecture
351
+ methods = [
352
+ e
353
+ for e in file_analysis.elements
354
+ if hasattr(e, "complexity_score")
355
+ ]
356
+ complexity = sum(
357
+ getattr(method, "complexity_score", 0) or 0
358
+ for method in methods
359
+ )
349
360
  else:
350
361
  complexity = 0
351
362
  else: