tree-sitter-analyzer 0.9.5__py3-none-any.whl → 0.9.7__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.

@@ -356,6 +356,11 @@ ALL_QUERIES["functions"] = {
356
356
  "description": "Search all function/method declarations (alias for method)",
357
357
  }
358
358
 
359
+ ALL_QUERIES["methods"] = {
360
+ "query": JAVA_QUERIES["method"],
361
+ "description": "Search all method declarations (alias for method)",
362
+ }
363
+
359
364
  ALL_QUERIES["classes"] = {
360
365
  "query": JAVA_QUERIES["class"],
361
366
  "description": "Search all class declarations (alias for class)",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tree-sitter-analyzer
3
- Version: 0.9.5
3
+ Version: 0.9.7
4
4
  Summary: Extensible multi-language code analyzer framework using Tree-sitter with dynamic plugin architecture
5
5
  Project-URL: Homepage, https://github.com/aimasteracc/tree-sitter-analyzer
6
6
  Project-URL: Documentation, https://github.com/aimasteracc/tree-sitter-analyzer#readme
@@ -137,10 +137,11 @@ Description-Content-Type: text/markdown
137
137
 
138
138
  [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
139
139
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
140
- [![Tests](https://img.shields.io/badge/tests-1358%20passed-brightgreen.svg)](#quality-assurance)
141
- [![Coverage](https://img.shields.io/badge/coverage-74.19%25-green.svg)](#quality-assurance)
140
+ [![Tests](https://img.shields.io/badge/tests-1420%20passed-brightgreen.svg)](#quality-assurance)
141
+ [![Coverage](https://img.shields.io/badge/coverage-74.36%25-green.svg)](#quality-assurance)
142
142
  [![Quality](https://img.shields.io/badge/quality-enterprise%20grade-blue.svg)](#quality-assurance)
143
143
  [![PyPI](https://img.shields.io/pypi/v/tree-sitter-analyzer.svg)](https://pypi.org/project/tree-sitter-analyzer/)
144
+ [![Version](https://img.shields.io/badge/version-0.9.7-blue.svg)](https://github.com/aimasteracc/tree-sitter-analyzer/releases)
144
145
  [![GitHub Stars](https://img.shields.io/github/stars/aimasteracc/tree-sitter-analyzer.svg?style=social)](https://github.com/aimasteracc/tree-sitter-analyzer)
145
146
 
146
147
  ## 🚀 Break Through LLM Token Limits, Let AI Understand Code Files of Any Size
@@ -359,11 +360,54 @@ Parameters: {"file_path": "examples/BigService.java", "start_line": 100, "end_li
359
360
  }
360
361
  ```
361
362
 
363
+ #### 🔍 **Step 4: Smart Query Filtering (v0.9.6+)**
364
+
365
+ **Enhanced Error Handling (v0.9.7):**
366
+ - Improved `@handle_mcp_errors` decorator with tool name identification
367
+ - Better error context for debugging and troubleshooting
368
+ - Enhanced security validation for file paths
369
+
370
+ **Find specific methods:**
371
+ ```
372
+ Use MCP tool query_code to precisely find code elements
373
+ Parameters: {"file_path": "examples/BigService.java", "query_key": "methods", "filter": "name=main"}
374
+ ```
375
+
376
+ **Find authentication-related methods:**
377
+ ```
378
+ Use MCP tool query_code to find authentication methods
379
+ Parameters: {"file_path": "examples/BigService.java", "query_key": "methods", "filter": "name=~auth*"}
380
+ ```
381
+
382
+ **Find parameterless public methods:**
383
+ ```
384
+ Use MCP tool query_code to find getter methods
385
+ Parameters: {"file_path": "examples/BigService.java", "query_key": "methods", "filter": "params=0,public=true"}
386
+ ```
387
+
388
+ **Return Format:**
389
+ ```json
390
+ {
391
+ "success": true,
392
+ "results": [
393
+ {
394
+ "capture_name": "method",
395
+ "node_type": "method_declaration",
396
+ "start_line": 1385,
397
+ "end_line": 1418,
398
+ "content": "public static void main(String[] args) { ... }"
399
+ }
400
+ ],
401
+ "count": 1
402
+ }
403
+ ```
404
+
362
405
  #### 💡 **Important Notes**
363
406
  - **Parameter Format**: Use snake_case (`file_path`, `start_line`, `end_line`)
364
407
  - **Path Handling**: Relative paths auto-resolve to project root
365
408
  - **Security Protection**: Tool automatically performs project boundary checks
366
- - **Workflow**: Recommended to use in order: Step 1 → 2 → 3
409
+ - **Workflow**: Recommended to use in order: Step 1 → 2 → 4 (Query Filtering) → 3 (Precise Extraction)
410
+ - **Filter Syntax**: Supports `name=value`, `name=~pattern*`, `params=number`, `static/public/private=true/false`
367
411
 
368
412
  ### 🛠️ CLI Command Examples
369
413
 
@@ -379,6 +423,22 @@ uv run python -m tree_sitter_analyzer examples/BigService.java --partial-read --
379
423
 
380
424
  # Silent mode (display results only)
381
425
  uv run python -m tree_sitter_analyzer examples/BigService.java --table=full --quiet
426
+
427
+ # 🔍 Query filtering examples (v0.9.6+)
428
+ # Find specific methods
429
+ uv run python -m tree_sitter_analyzer examples/BigService.java --query-key methods --filter "name=main"
430
+
431
+ # Find authentication-related methods
432
+ uv run python -m tree_sitter_analyzer examples/BigService.java --query-key methods --filter "name=~auth*"
433
+
434
+ # Find parameterless public methods
435
+ uv run python -m tree_sitter_analyzer examples/BigService.java --query-key methods --filter "params=0,public=true"
436
+
437
+ # Find static methods
438
+ uv run python -m tree_sitter_analyzer examples/BigService.java --query-key methods --filter "static=true"
439
+
440
+ # View filter syntax help
441
+ uv run python -m tree_sitter_analyzer --filter-help
382
442
  ```
383
443
 
384
444
  ---
@@ -398,6 +458,15 @@ Get insights without reading complete files:
398
458
  - Include position metadata
399
459
  - Support efficient processing of large files
400
460
 
461
+ ### 🔍 **Advanced Query Filtering**
462
+ Powerful code element querying and filtering system:
463
+ - **Exact matching**: `--filter "name=main"` Find specific methods
464
+ - **Pattern matching**: `--filter "name=~auth*"` Find authentication-related methods
465
+ - **Parameter filtering**: `--filter "params=2"` Find methods with specific parameter counts
466
+ - **Modifier filtering**: `--filter "static=true,public=true"` Find static public methods
467
+ - **Compound conditions**: `--filter "name=~get*,params=0,public=true"` Combine multiple conditions
468
+ - **CLI/MCP consistency**: Same filtering syntax in command line and AI assistants
469
+
401
470
  ### 🔗 **AI Assistant Integration**
402
471
  Deep integration via MCP protocol:
403
472
  - Claude Desktop
@@ -482,16 +551,16 @@ Tree-sitter Analyzer automatically detects and protects project boundaries:
482
551
  ## 🏆 Quality Assurance
483
552
 
484
553
  ### 📊 **Quality Metrics**
485
- - **1,358 Tests** - 100% pass rate ✅
486
- - **74.54% Code Coverage** - Industry-leading level
554
+ - **1,420 Tests** - 100% pass rate ✅
555
+ - **74.36% Code Coverage** - Industry-leading level
487
556
  - **Zero Test Failures** - Complete CI/CD ready
488
557
  - **Cross-platform Compatible** - Windows, macOS, Linux
489
558
 
490
- ### ⚡ **Latest Quality Achievements (v0.9.4)**
491
- - ✅ **Test Suite Completely Stable** - Fixed all historical issues
492
- - ✅ **Formatter Module Breakthrough** - Coverage significantly improved
493
- - ✅ **Error Handling Optimization** - Enterprise-grade exception handling
494
- - ✅ **100+ New Comprehensive Tests** - Covering critical modules
559
+ ### ⚡ **Latest Quality Achievements (v0.9.6)**
560
+ - ✅ **Smart Query Filtering System** - 62 new tests all passed
561
+ - ✅ **Unified Architecture Design** - QueryService eliminates code duplication
562
+ - ✅ **CI Test Fixes** - All platforms test stable
563
+ - ✅ **Multi-language Documentation** - Complete updates in EN/ZH/JA
495
564
 
496
565
  ### ⚙️ **Running Tests**
497
566
  ```bash
@@ -507,9 +576,10 @@ uv run pytest tests/test_mcp_server_initialization.py -v
507
576
 
508
577
  ### 📈 **Coverage Highlights**
509
578
  - **Language Detector**: 98.41% (Excellent)
510
- - **CLI Main Entry**: 97.78% (Excellent)
579
+ - **CLI Main Entry**: 94.36% (Excellent)
580
+ - **Query Filtering System**: 96.06% (Excellent)
581
+ - **Query Service**: 86.25% (Good)
511
582
  - **Error Handling**: 82.76% (Good)
512
- - **Security Framework**: 78%+ (Reliable)
513
583
 
514
584
  ---
515
585
 
@@ -1,7 +1,7 @@
1
- tree_sitter_analyzer/__init__.py,sha256=ElX-1qL0OI5EuUf2XVkdqvLuWwRgTVYDGDnyeuLUBww,3067
1
+ tree_sitter_analyzer/__init__.py,sha256=lWzOrA7xrd-u8fEv4rQova4X-E4LRPH_pDJiajwNZCw,3067
2
2
  tree_sitter_analyzer/__main__.py,sha256=Zl79tpe4UaMu-7yeztc06tgP0CVMRnvGgas4ZQP5SCs,228
3
3
  tree_sitter_analyzer/api.py,sha256=naRtGuZ27AIVfn6Rid0zQcHDI71UpO9Nh4NQM9JyD3c,16954
4
- tree_sitter_analyzer/cli_main.py,sha256=R03sPnWD_39u1wxpr7nd97EHe8jlp2npViiPbfm_cHo,9644
4
+ tree_sitter_analyzer/cli_main.py,sha256=4uIwje6n2qQvTsX4RBgqFgznxJs8RcCnS1GQjrR5IGQ,10354
5
5
  tree_sitter_analyzer/encoding_utils.py,sha256=NHkqOt7GdrxgMsd3k0rVxSO0mWJZXODw3uwl2Qk9ufc,14803
6
6
  tree_sitter_analyzer/exceptions.py,sha256=AZryCQyKXekAg8lQZd3zqULnjhCKovBNNpnUlNGDhcI,11615
7
7
  tree_sitter_analyzer/file_handler.py,sha256=nUD17QIdOJ2bnXekuo-QzGQFv0f2rxCSJi-zWeQFSAs,6636
@@ -21,7 +21,7 @@ tree_sitter_analyzer/cli/commands/advanced_command.py,sha256=xDZI4zKTMHNdf7fc_QN
21
21
  tree_sitter_analyzer/cli/commands/base_command.py,sha256=o_xjKhn2J5bbGeNC980tALozT1WlsttI0owhLbV2hDM,6597
22
22
  tree_sitter_analyzer/cli/commands/default_command.py,sha256=RAR_eaOK3EndIqU7QL5UAn44mwyhItTN7aUaKL1WmSc,524
23
23
  tree_sitter_analyzer/cli/commands/partial_read_command.py,sha256=RGZsEBybu6PhOQDHBXuhs6l4ZlDcFaxj2bNOvSqKY80,4605
24
- tree_sitter_analyzer/cli/commands/query_command.py,sha256=vpvCKxKGOaOHiNV_7UjW7JV5tAGAAx7AB9sV2EbLEyc,3612
24
+ tree_sitter_analyzer/cli/commands/query_command.py,sha256=VFuCFJxffjSUrMa7NB_KJmMexUnJmnazpTDbw-i9Ulw,4003
25
25
  tree_sitter_analyzer/cli/commands/structure_command.py,sha256=0iJwjOgtW838hXleXogWhbu6eQFfrLR1QgKe5PFBqvU,5220
26
26
  tree_sitter_analyzer/cli/commands/summary_command.py,sha256=02WA3sOzfT83FVT6sW7nK04zVcZ9Qj_1S0WloqlTnFk,3602
27
27
  tree_sitter_analyzer/cli/commands/table_command.py,sha256=GvGpLZ_YwE5syufNMfvjPrzwt-bXUtAF7EoOQ0Dr_O0,9441
@@ -31,6 +31,8 @@ tree_sitter_analyzer/core/cache_service.py,sha256=0oZGuTpeHBKYNdnqAOVi6VlQukYMIH
31
31
  tree_sitter_analyzer/core/engine.py,sha256=VFXGowDj6EfjFSh2MQDkQIc-4ISXaOg38n4lUhVY5Os,18721
32
32
  tree_sitter_analyzer/core/parser.py,sha256=qT3yIlTRdod4tf_2o1hU_B-GYGukyM2BtaFxzSoxois,9293
33
33
  tree_sitter_analyzer/core/query.py,sha256=UhQxUmQitFobe2YM7Ifhi3X2WdHVb02KzeBunueYJ4I,16397
34
+ tree_sitter_analyzer/core/query_filter.py,sha256=PvGztAZFooFNZe6iHNmbg6RUNtMvq6f6hBZFzllig6Y,6591
35
+ tree_sitter_analyzer/core/query_service.py,sha256=lHlvtu7LoG-IEAOqQ-RwF-a5puEI9wqaGez4cnJZiO4,5704
34
36
  tree_sitter_analyzer/formatters/__init__.py,sha256=yVb4HF_4EEPRwTf3y3-vM2NllrhykG3zlvQhN-6dB4c,31
35
37
  tree_sitter_analyzer/formatters/base_formatter.py,sha256=Uv6uVgUKwbBn6of26bnvr4u6CmX2ka1a405VL17CGFU,5763
36
38
  tree_sitter_analyzer/formatters/formatter_factory.py,sha256=mCnAbEHycoSttSuF4dU78hzcxyg-h57bo0_bj00zw58,2069
@@ -46,24 +48,25 @@ tree_sitter_analyzer/languages/java_plugin.py,sha256=ZTtDgyUdv-b9fFvCMEL3xS-yr0r
46
48
  tree_sitter_analyzer/languages/javascript_plugin.py,sha256=k14kHfi5II9MRTsVuy0NQq5l2KZYncCnM1Q6T1c5q_U,15844
47
49
  tree_sitter_analyzer/languages/python_plugin.py,sha256=MJ03F_Nv-nmInIkEFmPyEXYhyGbLHyr5kCbj2taEDYk,29144
48
50
  tree_sitter_analyzer/mcp/__init__.py,sha256=Dj4aqt_6inDKQ1xmA6DNMNDQBHzToqBjSWazdAWZgCY,944
49
- tree_sitter_analyzer/mcp/server.py,sha256=e_Enu0MoEuWISFW0XQxcU-_db5jwCQY5txfVkqTO-7U,24788
51
+ tree_sitter_analyzer/mcp/server.py,sha256=93baLte6ub2rnxr5EKfeknpN1t2BWraTm6Mk4imvHVU,25068
50
52
  tree_sitter_analyzer/mcp/resources/__init__.py,sha256=SWnK8liTQkuQXlVgyRP9mf5HzpqmqohShrC98xlNnDc,1389
51
- tree_sitter_analyzer/mcp/resources/code_file_resource.py,sha256=POhQ1xPMiGBVVm6AfOQNKM29svDLvlGLA97ZPQgVoHw,6253
53
+ tree_sitter_analyzer/mcp/resources/code_file_resource.py,sha256=ZX5ZYSJfylBedpL80kTDlco2YZqgRMb5f3OW0VvOVRM,6166
52
54
  tree_sitter_analyzer/mcp/resources/project_stats_resource.py,sha256=V5-daZ99SU4rOt7qLk9GmhkzdXJpEINBobNlT14ojYY,19441
53
55
  tree_sitter_analyzer/mcp/tools/__init__.py,sha256=u7JrSLwE95y50mfjSus6HRdtdhkNbVrW8jP4AooawEU,762
54
56
  tree_sitter_analyzer/mcp/tools/analyze_scale_tool.py,sha256=cVBhq4_KxwcqdmA5s9iZLH4YDy7T_TKLNNdqqaGKnFU,27369
55
57
  tree_sitter_analyzer/mcp/tools/analyze_scale_tool_cli_compatible.py,sha256=mssed7bEfGeGxW4mOf7dg8BDS1oqHLolIBNX9DaZ3DM,8997
56
58
  tree_sitter_analyzer/mcp/tools/base_tool.py,sha256=FVSMgKIliQ5EBVQEfjYwWeqzWt9OqOFDr3dyACIDxig,1210
59
+ tree_sitter_analyzer/mcp/tools/query_tool.py,sha256=4SlK2FgiMrav64dPKCk3A98qj4henjwfwb0jfcZdpE0,8225
57
60
  tree_sitter_analyzer/mcp/tools/read_partial_tool.py,sha256=MkAeXc-n-8fxRGtE3RQ_yZOPQ1lzdUppVFKrRzBPogU,11790
58
61
  tree_sitter_analyzer/mcp/tools/table_format_tool.py,sha256=flFEcDOozJSJOtsQVHsk5eTYsutBi_T_2ft9XUpceSM,15896
59
62
  tree_sitter_analyzer/mcp/tools/universal_analyze_tool.py,sha256=RSbztW_b07DL5e1an4BE--snX744v4KmlRGab5bGj6U,21677
60
63
  tree_sitter_analyzer/mcp/utils/__init__.py,sha256=hibcoJc9PEetXqPIpvwHw1cpr1rabAm0QQaDZpxvA_g,2956
61
- tree_sitter_analyzer/mcp/utils/error_handler.py,sha256=msrQHX67K3vhJsEc3OPRz5mmWU_yoHz55Lnxy0IZuy4,18404
64
+ tree_sitter_analyzer/mcp/utils/error_handler.py,sha256=_XeGjfF331EEeHUnJ5cGvJB7WP0lHkD8RXtBayQElr4,18973
62
65
  tree_sitter_analyzer/plugins/__init__.py,sha256=ITE9bTz7NO4axnn8g5Z-1_ydhSLT0RnY6Y1J9OhUP3E,10326
63
66
  tree_sitter_analyzer/plugins/base.py,sha256=FMRAOtjtDutNV8RnB6cmFgdvcjxKRAbrrzqldBBT1yk,17167
64
67
  tree_sitter_analyzer/plugins/manager.py,sha256=PyEY3jeuCBpDVqguWhaAu7nzUZM17_pI6wml2e0Hamo,12535
65
68
  tree_sitter_analyzer/queries/__init__.py,sha256=dwDDc7PCw_UWruxSeJ8uEBjY0O5uLDBI5YqyvBhbnN0,696
66
- tree_sitter_analyzer/queries/java.py,sha256=NZTSzFADlGrm3MD0oIkOdkN_6wP2pGZpNs0Rb7I_mcw,12249
69
+ tree_sitter_analyzer/queries/java.py,sha256=avaPFeHz3Ig-yTdCDKfUKaG-5sktOEkrXG2p9_mEZVs,12388
67
70
  tree_sitter_analyzer/queries/javascript.py,sha256=pnXrgISwDE5GhPHDbUKEGI3thyLmebTeQt-l_-x4qT8,3962
68
71
  tree_sitter_analyzer/queries/python.py,sha256=L33KRUyV3sAvA3_HFkPyGgtiq0ygSpNY_n2YojodPlc,7570
69
72
  tree_sitter_analyzer/queries/typescript.py,sha256=eersyAF7TladuCWa8WE_-cO9YTF1LUSjLIl-tk2fZDo,6708
@@ -71,7 +74,7 @@ tree_sitter_analyzer/security/__init__.py,sha256=ZTqTt24hsljCpTXAZpJC57L7MU5lJLT
71
74
  tree_sitter_analyzer/security/boundary_manager.py,sha256=CUQWU5j1zdjEbN9UmArcYkq9HbemhttQzk0pVk-vxZs,8153
72
75
  tree_sitter_analyzer/security/regex_checker.py,sha256=jWK6H8PTPgzbwRPfK_RZ8bBTS6rtEbgjY5vr3YWjQ_U,9616
73
76
  tree_sitter_analyzer/security/validator.py,sha256=UPAPcrnmI2mNzbYOm0MabnJMGllK6HlOQ9KX-2bRfgU,8986
74
- tree_sitter_analyzer-0.9.5.dist-info/METADATA,sha256=j7tFOFQLvwciwHpyidLtuy4t8oKp_rkhLuKWgBMzgg8,20191
75
- tree_sitter_analyzer-0.9.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
76
- tree_sitter_analyzer-0.9.5.dist-info/entry_points.txt,sha256=U4tfLGXgCWubKm2PyEb3zxhQ2pm7zVotMyfyS0CodD8,486
77
- tree_sitter_analyzer-0.9.5.dist-info/RECORD,,
77
+ tree_sitter_analyzer-0.9.7.dist-info/METADATA,sha256=bMo6g4c50Z7KemRPJ4nWqzaxiz8O5YNyyJl87CU0iP0,22956
78
+ tree_sitter_analyzer-0.9.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
79
+ tree_sitter_analyzer-0.9.7.dist-info/entry_points.txt,sha256=U4tfLGXgCWubKm2PyEb3zxhQ2pm7zVotMyfyS0CodD8,486
80
+ tree_sitter_analyzer-0.9.7.dist-info/RECORD,,