largefile 0.1.2__tar.gz → 0.1.4__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 (76) hide show
  1. largefile-0.1.4/PKG-INFO +171 -0
  2. largefile-0.1.4/README.md +136 -0
  3. {largefile-0.1.2 → largefile-0.1.4}/codecov.yml +13 -2
  4. largefile-0.1.4/docs/API.md +468 -0
  5. {largefile-0.1.2 → largefile-0.1.4}/pyproject.toml +5 -4
  6. {largefile-0.1.2 → largefile-0.1.4}/src/data_models.py +14 -2
  7. {largefile-0.1.2 → largefile-0.1.4}/src/file_access.py +121 -0
  8. {largefile-0.1.2 → largefile-0.1.4}/src/mcp_schemas.py +85 -21
  9. {largefile-0.1.2 → largefile-0.1.4}/src/search_engine.py +128 -18
  10. {largefile-0.1.2 → largefile-0.1.4}/src/tools.py +246 -167
  11. {largefile-0.1.2 → largefile-0.1.4}/tests/integration/test_codebase_workflows.py +8 -7
  12. {largefile-0.1.2 → largefile-0.1.4}/tests/integration/test_documentation_workflows.py +49 -24
  13. {largefile-0.1.2 → largefile-0.1.4}/tests/integration/test_performance_strategies.py +4 -2
  14. {largefile-0.1.2 → largefile-0.1.4}/tests/integration/test_real_world_examples.py +2 -4
  15. largefile-0.1.4/tests/unit/test_file_access.py +768 -0
  16. largefile-0.1.4/tests/unit/test_search_engine.py +352 -0
  17. largefile-0.1.4/tests/unit/test_tools.py +457 -0
  18. {largefile-0.1.2 → largefile-0.1.4}/tests/unit/test_tree_parser.py +140 -0
  19. {largefile-0.1.2 → largefile-0.1.4}/uv.lock +1 -1
  20. largefile-0.1.2/.codecov.yml +0 -17
  21. largefile-0.1.2/PKG-INFO +0 -321
  22. largefile-0.1.2/README.md +0 -287
  23. largefile-0.1.2/docs/API.md +0 -415
  24. largefile-0.1.2/tests/unit/test_batch_edit_tool.py +0 -190
  25. largefile-0.1.2/tests/unit/test_file_access.py +0 -367
  26. largefile-0.1.2/tests/unit/test_search_engine.py +0 -98
  27. {largefile-0.1.2 → largefile-0.1.4}/.gitattributes +0 -0
  28. {largefile-0.1.2 → largefile-0.1.4}/.github/workflows/ci.yml +0 -0
  29. {largefile-0.1.2 → largefile-0.1.4}/.github/workflows/release.yml +0 -0
  30. {largefile-0.1.2 → largefile-0.1.4}/.gitignore +0 -0
  31. {largefile-0.1.2 → largefile-0.1.4}/.python-version +0 -0
  32. {largefile-0.1.2 → largefile-0.1.4}/docs/3rd-party/python-mcp-sdk.md +0 -0
  33. {largefile-0.1.2 → largefile-0.1.4}/docs/3rd-party/research-llm-file-editing-apis.md +0 -0
  34. {largefile-0.1.2 → largefile-0.1.4}/docs/3rd-party/tree-sitter.md +0 -0
  35. {largefile-0.1.2 → largefile-0.1.4}/docs/CONTRIBUTING.md +0 -0
  36. {largefile-0.1.2 → largefile-0.1.4}/docs/configuration.md +0 -0
  37. {largefile-0.1.2 → largefile-0.1.4}/docs/design.md +0 -0
  38. {largefile-0.1.2 → largefile-0.1.4}/docs/examples.md +0 -0
  39. {largefile-0.1.2 → largefile-0.1.4}/scripts/.gitignore +0 -0
  40. {largefile-0.1.2 → largefile-0.1.4}/scripts/pre-push +0 -0
  41. {largefile-0.1.2 → largefile-0.1.4}/src/__init__.py +0 -0
  42. {largefile-0.1.2 → largefile-0.1.4}/src/config.py +0 -0
  43. {largefile-0.1.2 → largefile-0.1.4}/src/editor.py +0 -0
  44. {largefile-0.1.2 → largefile-0.1.4}/src/exceptions.py +0 -0
  45. {largefile-0.1.2 → largefile-0.1.4}/src/main.py +0 -0
  46. {largefile-0.1.2 → largefile-0.1.4}/src/server.py +0 -0
  47. {largefile-0.1.2 → largefile-0.1.4}/src/tree_parser.py +0 -0
  48. {largefile-0.1.2 → largefile-0.1.4}/src/utils.py +0 -0
  49. {largefile-0.1.2 → largefile-0.1.4}/tests/__init__.py +0 -0
  50. {largefile-0.1.2 → largefile-0.1.4}/tests/integration/test_editor_operations.py +0 -0
  51. {largefile-0.1.2 → largefile-0.1.4}/tests/integration/test_file_strategies.py +0 -0
  52. {largefile-0.1.2 → largefile-0.1.4}/tests/integration/test_mcp_server.py +0 -0
  53. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/LICENSES.md +0 -0
  54. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/README.md +0 -0
  55. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/csharp/aspnet-controller.cs +0 -0
  56. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/go/docker-daemon.go +0 -0
  57. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/java/spring-application.java +0 -0
  58. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/javascript/lodash-utility.js +0 -0
  59. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/markdown/anthropic-readme.md +0 -0
  60. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/markdown/fastapi-docs.md +0 -0
  61. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/markdown/nodejs-readme.md +0 -0
  62. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/markdown/openai-readme.md +0 -0
  63. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/markdown/pytorch-readme.md +0 -0
  64. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/php/laravel-model.php +0 -0
  65. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/python/django-models.py +0 -0
  66. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/rust/serde-derive.rs +0 -0
  67. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/text/rfc-specification.txt +0 -0
  68. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/text/shakespeare-complete.txt +0 -0
  69. {largefile-0.1.2 → largefile-0.1.4}/tests/test_data/typescript/vscode-extension.ts +0 -0
  70. {largefile-0.1.2 → largefile-0.1.4}/tests/unit/__init__.py +0 -0
  71. {largefile-0.1.2 → largefile-0.1.4}/tests/unit/test_backup_management.py +0 -0
  72. {largefile-0.1.2 → largefile-0.1.4}/tests/unit/test_editor.py +0 -0
  73. {largefile-0.1.2 → largefile-0.1.4}/tests/unit/test_revert_edit.py +0 -0
  74. {largefile-0.1.2 → largefile-0.1.4}/tests/unit/test_tree_parser_verification.py +0 -0
  75. {largefile-0.1.2 → largefile-0.1.4}/tests/utils/__init__.py +0 -0
  76. {largefile-0.1.2 → largefile-0.1.4}/tests/utils/env_override.py +0 -0
@@ -0,0 +1,171 @@
1
+ Metadata-Version: 2.4
2
+ Name: largefile
3
+ Version: 0.1.4
4
+ Summary: MCP server for AI assistants to navigate, search, and edit large codebases, logs, and data files with semantic code analysis
5
+ Project-URL: Homepage, https://github.com/peteretelej/largefile
6
+ Project-URL: Repository, https://github.com/peteretelej/largefile.git
7
+ Project-URL: Issues, https://github.com/peteretelej/largefile/issues
8
+ Project-URL: Documentation, https://github.com/peteretelej/largefile#readme
9
+ Author-email: Peter Etelej <peter@etelej.com>
10
+ Maintainer-email: Peter Etelej <peter@etelej.com>
11
+ License: MIT
12
+ Keywords: ai-tools,code-navigation,large-files,llm,log-analysis,mcp,semantic-analysis,tree-sitter
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Topic :: Text Processing
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: chardet>=5.0.0
25
+ Requires-Dist: click>=8.2.1
26
+ Requires-Dist: mcp>=1.10.1
27
+ Requires-Dist: rapidfuzz>=3.0.0
28
+ Requires-Dist: tree-sitter-go>=0.21.0
29
+ Requires-Dist: tree-sitter-javascript>=0.21.0
30
+ Requires-Dist: tree-sitter-python>=0.21.0
31
+ Requires-Dist: tree-sitter-rust>=0.21.0
32
+ Requires-Dist: tree-sitter-typescript>=0.21.0
33
+ Requires-Dist: tree-sitter>=0.21.0
34
+ Description-Content-Type: text/markdown
35
+
36
+ # Largefile MCP Server
37
+
38
+ Navigate, search, and edit large codebases, logs, and data files that exceed AI context limits.
39
+
40
+ [![CI](https://img.shields.io/github/actions/workflow/status/peteretelej/largefile/ci.yml?branch=main&logo=github)](https://github.com/peteretelej/largefile/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/peteretelej/largefile/branch/main/graph/badge.svg)](https://codecov.io/gh/peteretelej/largefile) [![PyPI version](https://img.shields.io/pypi/v/largefile.svg)](https://pypi.org/project/largefile/) [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
41
+
42
+ ## Why Largefile?
43
+
44
+ - **Go beyond context limits** - Read, search, and edit files too large to fit in AI context windows
45
+ - **Semantic code navigation** - Tree-sitter extracts functions/classes for Python, JS/TS, Rust, Go
46
+ - **Fewer LLM errors** - Search/replace editing eliminates line number mistakes common with line-based edits
47
+ - **Smart search** - Fuzzy matching, regex, case-insensitive, inverted, and count-only modes
48
+ - **No size limits** - Handles multi-GB files via tiered memory strategy (RAM → mmap → streaming)
49
+
50
+ ## Quick Start
51
+
52
+ **Prerequisite:** Install [uv](https://docs.astral.sh/uv/getting-started/installation/) for the `uvx` command.
53
+
54
+ ```json
55
+ {
56
+ "mcpServers": {
57
+ "largefile": {
58
+ "command": "uvx",
59
+ "args": ["--from", "largefile", "largefile-mcp"]
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ ## Tools
66
+
67
+ | Tool | Use For |
68
+ | ---------------- | ------------------------------------------------------ |
69
+ | `get_overview` | File structure and semantic outline before diving in |
70
+ | `search_content` | Finding patterns, counting occurrences, regex matching |
71
+ | `read_content` | Reading specific sections; tail/head modes for logs |
72
+ | `edit_content` | Safe search/replace with automatic backups |
73
+ | `revert_edit` | Recovering from bad edits |
74
+
75
+ ## When to Use Largefile
76
+
77
+ **Use when:**
78
+
79
+ - File exceeds ~1000 lines or 100KB (supports multi-GB files)
80
+ - Navigating large codebases with semantic structure
81
+ - Analyzing log files (especially recent entries with tail mode)
82
+ - Making search/replace edits across large files
83
+ - Counting occurrences without loading full content
84
+
85
+ **Don't use for:**
86
+
87
+ - Small files that fit in context (AI doesn't need help with those)
88
+ - Binary files (images, executables, compressed)
89
+
90
+ ## Usage Examples
91
+
92
+ ### Large Codebase Navigation
93
+
94
+ ```pythonß
95
+ # Get semantic structure of a large Python file
96
+ overview = get_overview("/path/to/large_module.py")
97
+ # Returns: 2,847 lines, 15 classes, function outline via Tree-sitter
98
+
99
+ # Find all class definitions
100
+ classes = search_content("/path/to/large_module.py", "class ", fuzzy=False)
101
+
102
+ # Read complete class with semantic chunking
103
+ code = read_content("/path/to/large_module.py", pattern="class UserModel", mode="semantic")
104
+ ```
105
+
106
+ ### Batch Refactoring
107
+
108
+ ```python
109
+ # Preview rename across file
110
+ preview = edit_content("/path/to/api.py", changes=[
111
+ {"search": "process_data", "replace": "transform_data"},
112
+ {"search": "old_endpoint", "replace": "new_endpoint"}
113
+ ], preview=True)
114
+
115
+ # Apply changes (creates automatic backup)
116
+ result = edit_content("/path/to/api.py", changes=[...], preview=False)
117
+
118
+ # Undo if needed
119
+ revert_edit("/path/to/api.py")
120
+ ```
121
+
122
+ ### Log Analysis
123
+
124
+ ```python
125
+ # Get log file overview
126
+ overview = get_overview("/var/log/app.log")
127
+ # Returns: 150,000 lines, 2.1GB
128
+
129
+ # Read last 500 lines efficiently
130
+ recent = read_content("/var/log/app.log", limit=500, mode="tail")
131
+
132
+ # Count errors without loading content
133
+ error_count = search_content("/var/log/app.log", "ERROR", count_only=True, fuzzy=False)
134
+
135
+ # Find errors with regex
136
+ errors = search_content("/var/log/app.log", r"ERROR.*timeout", regex=True)
137
+ ```
138
+
139
+ ## Supported Languages
140
+
141
+ Tree-sitter semantic analysis for: **Python**, **JavaScript/JSX**, **TypeScript/TSX**, **Rust**, **Go**
142
+
143
+ Other file types use text-based analysis with graceful fallback.
144
+
145
+ ## File Size Handling
146
+
147
+ | Size | Strategy |
148
+ | -------- | --------------------------------------- |
149
+ | < 50MB | Full memory loading with AST caching |
150
+ | 50-500MB | Memory-mapped access |
151
+ | > 500MB | Streaming (tail/head modes recommended) |
152
+
153
+ ## Configuration
154
+
155
+ Environment variables for tuning:
156
+
157
+ ```bash
158
+ LARGEFILE_MEMORY_THRESHOLD_MB=50 # RAM loading limit
159
+ LARGEFILE_MMAP_THRESHOLD_MB=500 # Memory mapping limit
160
+ LARGEFILE_FUZZY_THRESHOLD=0.8 # Match sensitivity (0.0-1.0)
161
+ LARGEFILE_MAX_SEARCH_RESULTS=20 # Results per search
162
+ LARGEFILE_BACKUP_DIR=~/.largefile/backups
163
+ ```
164
+
165
+ ## Documentation
166
+
167
+ - [API Reference](docs/API.md) - Detailed tool documentation
168
+ - [Configuration Guide](docs/configuration.md) - All environment variables
169
+ - [Examples](docs/examples.md) - More workflow examples
170
+ - [Design Document](docs/design.md) - Architecture details
171
+ - [Contributing](docs/CONTRIBUTING.md) - Development setup
@@ -0,0 +1,136 @@
1
+ # Largefile MCP Server
2
+
3
+ Navigate, search, and edit large codebases, logs, and data files that exceed AI context limits.
4
+
5
+ [![CI](https://img.shields.io/github/actions/workflow/status/peteretelej/largefile/ci.yml?branch=main&logo=github)](https://github.com/peteretelej/largefile/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/peteretelej/largefile/branch/main/graph/badge.svg)](https://codecov.io/gh/peteretelej/largefile) [![PyPI version](https://img.shields.io/pypi/v/largefile.svg)](https://pypi.org/project/largefile/) [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ ## Why Largefile?
8
+
9
+ - **Go beyond context limits** - Read, search, and edit files too large to fit in AI context windows
10
+ - **Semantic code navigation** - Tree-sitter extracts functions/classes for Python, JS/TS, Rust, Go
11
+ - **Fewer LLM errors** - Search/replace editing eliminates line number mistakes common with line-based edits
12
+ - **Smart search** - Fuzzy matching, regex, case-insensitive, inverted, and count-only modes
13
+ - **No size limits** - Handles multi-GB files via tiered memory strategy (RAM → mmap → streaming)
14
+
15
+ ## Quick Start
16
+
17
+ **Prerequisite:** Install [uv](https://docs.astral.sh/uv/getting-started/installation/) for the `uvx` command.
18
+
19
+ ```json
20
+ {
21
+ "mcpServers": {
22
+ "largefile": {
23
+ "command": "uvx",
24
+ "args": ["--from", "largefile", "largefile-mcp"]
25
+ }
26
+ }
27
+ }
28
+ ```
29
+
30
+ ## Tools
31
+
32
+ | Tool | Use For |
33
+ | ---------------- | ------------------------------------------------------ |
34
+ | `get_overview` | File structure and semantic outline before diving in |
35
+ | `search_content` | Finding patterns, counting occurrences, regex matching |
36
+ | `read_content` | Reading specific sections; tail/head modes for logs |
37
+ | `edit_content` | Safe search/replace with automatic backups |
38
+ | `revert_edit` | Recovering from bad edits |
39
+
40
+ ## When to Use Largefile
41
+
42
+ **Use when:**
43
+
44
+ - File exceeds ~1000 lines or 100KB (supports multi-GB files)
45
+ - Navigating large codebases with semantic structure
46
+ - Analyzing log files (especially recent entries with tail mode)
47
+ - Making search/replace edits across large files
48
+ - Counting occurrences without loading full content
49
+
50
+ **Don't use for:**
51
+
52
+ - Small files that fit in context (AI doesn't need help with those)
53
+ - Binary files (images, executables, compressed)
54
+
55
+ ## Usage Examples
56
+
57
+ ### Large Codebase Navigation
58
+
59
+ ```pythonß
60
+ # Get semantic structure of a large Python file
61
+ overview = get_overview("/path/to/large_module.py")
62
+ # Returns: 2,847 lines, 15 classes, function outline via Tree-sitter
63
+
64
+ # Find all class definitions
65
+ classes = search_content("/path/to/large_module.py", "class ", fuzzy=False)
66
+
67
+ # Read complete class with semantic chunking
68
+ code = read_content("/path/to/large_module.py", pattern="class UserModel", mode="semantic")
69
+ ```
70
+
71
+ ### Batch Refactoring
72
+
73
+ ```python
74
+ # Preview rename across file
75
+ preview = edit_content("/path/to/api.py", changes=[
76
+ {"search": "process_data", "replace": "transform_data"},
77
+ {"search": "old_endpoint", "replace": "new_endpoint"}
78
+ ], preview=True)
79
+
80
+ # Apply changes (creates automatic backup)
81
+ result = edit_content("/path/to/api.py", changes=[...], preview=False)
82
+
83
+ # Undo if needed
84
+ revert_edit("/path/to/api.py")
85
+ ```
86
+
87
+ ### Log Analysis
88
+
89
+ ```python
90
+ # Get log file overview
91
+ overview = get_overview("/var/log/app.log")
92
+ # Returns: 150,000 lines, 2.1GB
93
+
94
+ # Read last 500 lines efficiently
95
+ recent = read_content("/var/log/app.log", limit=500, mode="tail")
96
+
97
+ # Count errors without loading content
98
+ error_count = search_content("/var/log/app.log", "ERROR", count_only=True, fuzzy=False)
99
+
100
+ # Find errors with regex
101
+ errors = search_content("/var/log/app.log", r"ERROR.*timeout", regex=True)
102
+ ```
103
+
104
+ ## Supported Languages
105
+
106
+ Tree-sitter semantic analysis for: **Python**, **JavaScript/JSX**, **TypeScript/TSX**, **Rust**, **Go**
107
+
108
+ Other file types use text-based analysis with graceful fallback.
109
+
110
+ ## File Size Handling
111
+
112
+ | Size | Strategy |
113
+ | -------- | --------------------------------------- |
114
+ | < 50MB | Full memory loading with AST caching |
115
+ | 50-500MB | Memory-mapped access |
116
+ | > 500MB | Streaming (tail/head modes recommended) |
117
+
118
+ ## Configuration
119
+
120
+ Environment variables for tuning:
121
+
122
+ ```bash
123
+ LARGEFILE_MEMORY_THRESHOLD_MB=50 # RAM loading limit
124
+ LARGEFILE_MMAP_THRESHOLD_MB=500 # Memory mapping limit
125
+ LARGEFILE_FUZZY_THRESHOLD=0.8 # Match sensitivity (0.0-1.0)
126
+ LARGEFILE_MAX_SEARCH_RESULTS=20 # Results per search
127
+ LARGEFILE_BACKUP_DIR=~/.largefile/backups
128
+ ```
129
+
130
+ ## Documentation
131
+
132
+ - [API Reference](docs/API.md) - Detailed tool documentation
133
+ - [Configuration Guide](docs/configuration.md) - All environment variables
134
+ - [Examples](docs/examples.md) - More workflow examples
135
+ - [Design Document](docs/design.md) - Architecture details
136
+ - [Contributing](docs/CONTRIBUTING.md) - Development setup
@@ -12,8 +12,19 @@ coverage:
12
12
  threshold: 10%
13
13
  paths:
14
14
  - "src/"
15
+ ignore:
16
+ - "tests/test_data"
17
+ - "scripts"
18
+ - "htmlcov"
19
+ - ".coverage"
20
+ - "coverage.xml"
15
21
 
16
22
  comment:
17
- behavior: default
18
23
  layout: "reach,diff,flags,tree"
19
- require_changes: false
24
+ behavior: default
25
+ require_changes: false
26
+ require_base: false
27
+ require_head: true
28
+
29
+ github_checks:
30
+ annotations: true