largefile 0.3.0__tar.gz → 0.4.0__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 (84) hide show
  1. {largefile-0.3.0 → largefile-0.4.0}/.github/workflows/ci.yml +1 -1
  2. largefile-0.4.0/CHANGELOG.md +34 -0
  3. largefile-0.4.0/LICENSE +21 -0
  4. {largefile-0.3.0 → largefile-0.4.0}/PKG-INFO +34 -12
  5. {largefile-0.3.0 → largefile-0.4.0}/README.md +31 -10
  6. {largefile-0.3.0 → largefile-0.4.0}/docs/API.md +186 -95
  7. {largefile-0.3.0 → largefile-0.4.0}/docs/CONTRIBUTING.md +1 -1
  8. {largefile-0.3.0 → largefile-0.4.0}/docs/configuration.md +52 -77
  9. {largefile-0.3.0 → largefile-0.4.0}/docs/design.md +149 -76
  10. {largefile-0.3.0 → largefile-0.4.0}/docs/examples.md +84 -45
  11. {largefile-0.3.0 → largefile-0.4.0}/pyproject.toml +4 -1
  12. {largefile-0.3.0 → largefile-0.4.0}/scripts/pre-push +2 -1
  13. {largefile-0.3.0 → largefile-0.4.0}/src/config.py +3 -2
  14. {largefile-0.3.0 → largefile-0.4.0}/src/editor.py +46 -6
  15. largefile-0.4.0/src/file_access.py +949 -0
  16. {largefile-0.3.0 → largefile-0.4.0}/src/search_engine.py +70 -18
  17. {largefile-0.3.0 → largefile-0.4.0}/src/server.py +34 -21
  18. {largefile-0.3.0 → largefile-0.4.0}/src/tools.py +318 -76
  19. {largefile-0.3.0 → largefile-0.4.0}/src/tree_parser.py +151 -15
  20. {largefile-0.3.0 → largefile-0.4.0}/tests/integration/test_get_overview_diff.py +5 -13
  21. {largefile-0.3.0 → largefile-0.4.0}/tests/integration/test_search_directory_workflows.py +6 -2
  22. {largefile-0.3.0 → largefile-0.4.0}/tests/unit/test_backup_management.py +47 -2
  23. {largefile-0.3.0 → largefile-0.4.0}/tests/unit/test_editor.py +124 -0
  24. {largefile-0.3.0 → largefile-0.4.0}/tests/unit/test_file_access.py +89 -5
  25. {largefile-0.3.0 → largefile-0.4.0}/tests/unit/test_revert_edit.py +82 -1
  26. {largefile-0.3.0 → largefile-0.4.0}/tests/unit/test_search_engine.py +42 -5
  27. {largefile-0.3.0 → largefile-0.4.0}/tests/unit/test_tools.py +179 -5
  28. {largefile-0.3.0 → largefile-0.4.0}/tests/unit/test_tools_search_directory.py +19 -0
  29. {largefile-0.3.0 → largefile-0.4.0}/tests/unit/test_tree_parser.py +9 -7
  30. {largefile-0.3.0 → largefile-0.4.0}/tests/unit/test_tree_parser_verification.py +2 -2
  31. largefile-0.4.0/tests/unit/test_v040_fixes.py +519 -0
  32. largefile-0.4.0/tests/unit/test_v040_review_fixes.py +396 -0
  33. largefile-0.4.0/uv.lock +2503 -0
  34. largefile-0.3.0/src/file_access.py +0 -708
  35. largefile-0.3.0/uv.lock +0 -1135
  36. {largefile-0.3.0 → largefile-0.4.0}/.gitattributes +0 -0
  37. {largefile-0.3.0 → largefile-0.4.0}/.github/workflows/release.yml +0 -0
  38. {largefile-0.3.0 → largefile-0.4.0}/.gitignore +0 -0
  39. {largefile-0.3.0 → largefile-0.4.0}/.python-version +0 -0
  40. {largefile-0.3.0 → largefile-0.4.0}/codecov.yml +0 -0
  41. {largefile-0.3.0 → largefile-0.4.0}/docs/3rd-party/python-mcp-sdk.md +0 -0
  42. {largefile-0.3.0 → largefile-0.4.0}/docs/3rd-party/research-llm-file-editing-apis.md +0 -0
  43. {largefile-0.3.0 → largefile-0.4.0}/docs/3rd-party/tree-sitter.md +0 -0
  44. {largefile-0.3.0 → largefile-0.4.0}/scripts/.gitignore +0 -0
  45. {largefile-0.3.0 → largefile-0.4.0}/src/__init__.py +0 -0
  46. {largefile-0.3.0 → largefile-0.4.0}/src/change_marker.py +0 -0
  47. {largefile-0.3.0 → largefile-0.4.0}/src/data_models.py +0 -0
  48. {largefile-0.3.0 → largefile-0.4.0}/src/exceptions.py +0 -0
  49. {largefile-0.3.0 → largefile-0.4.0}/src/main.py +0 -0
  50. {largefile-0.3.0 → largefile-0.4.0}/src/utils.py +0 -0
  51. {largefile-0.3.0 → largefile-0.4.0}/tests/__init__.py +0 -0
  52. {largefile-0.3.0 → largefile-0.4.0}/tests/integration/test_codebase_workflows.py +0 -0
  53. {largefile-0.3.0 → largefile-0.4.0}/tests/integration/test_directory_workflows.py +0 -0
  54. {largefile-0.3.0 → largefile-0.4.0}/tests/integration/test_documentation_workflows.py +0 -0
  55. {largefile-0.3.0 → largefile-0.4.0}/tests/integration/test_editor_operations.py +0 -0
  56. {largefile-0.3.0 → largefile-0.4.0}/tests/integration/test_file_strategies.py +0 -0
  57. {largefile-0.3.0 → largefile-0.4.0}/tests/integration/test_mcp_server.py +0 -0
  58. {largefile-0.3.0 → largefile-0.4.0}/tests/integration/test_performance_strategies.py +0 -0
  59. {largefile-0.3.0 → largefile-0.4.0}/tests/integration/test_read_enclosing.py +0 -0
  60. {largefile-0.3.0 → largefile-0.4.0}/tests/integration/test_real_world_examples.py +0 -0
  61. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/LICENSES.md +0 -0
  62. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/README.md +0 -0
  63. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/csharp/aspnet-controller.cs +0 -0
  64. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/go/docker-daemon.go +0 -0
  65. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/java/spring-application.java +0 -0
  66. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/javascript/lodash-utility.js +0 -0
  67. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/javascript/nested_arrow.js +0 -0
  68. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/markdown/anthropic-readme.md +0 -0
  69. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/markdown/fastapi-docs.md +0 -0
  70. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/markdown/nodejs-readme.md +0 -0
  71. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/markdown/openai-readme.md +0 -0
  72. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/markdown/pytorch-readme.md +0 -0
  73. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/php/laravel-model.php +0 -0
  74. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/python/django-models.py +0 -0
  75. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/python/nested_class.py +0 -0
  76. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/rust/serde-derive.rs +0 -0
  77. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/text/rfc-specification.txt +0 -0
  78. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/text/shakespeare-complete.txt +0 -0
  79. {largefile-0.3.0 → largefile-0.4.0}/tests/test_data/typescript/vscode-extension.ts +0 -0
  80. {largefile-0.3.0 → largefile-0.4.0}/tests/unit/__init__.py +0 -0
  81. {largefile-0.3.0 → largefile-0.4.0}/tests/unit/test_change_marker.py +0 -0
  82. {largefile-0.3.0 → largefile-0.4.0}/tests/unit/test_tools_list_directory.py +0 -0
  83. {largefile-0.3.0 → largefile-0.4.0}/tests/utils/__init__.py +0 -0
  84. {largefile-0.3.0 → largefile-0.4.0}/tests/utils/env_override.py +0 -0
@@ -12,7 +12,7 @@ jobs:
12
12
  strategy:
13
13
  matrix:
14
14
  os: ${{ github.event_name == 'pull_request' && fromJSON('["ubuntu-latest"]') || fromJSON('["ubuntu-latest", "macos-latest", "windows-latest"]') }}
15
- python-version: ["3.11"]
15
+ python-version: ["3.10", "3.11", "3.12"]
16
16
 
17
17
  steps:
18
18
  - name: Checkout code
@@ -0,0 +1,34 @@
1
+ # Changelog
2
+
3
+ Notable changes to the Largefile MCP Server are documented here. For versions
4
+ 0.1.0-0.3.0, see the [GitHub release notes](https://github.com/peteretelej/largefile/releases).
5
+
6
+ ## Unreleased
7
+
8
+ ## 0.4.0
9
+
10
+ ### Search and Read
11
+
12
+ - Regex and fuzzy search auto-resolution: `regex=true` disables fuzzy automatically; explicit `fuzzy=true` alongside regex is ignored with a warning in the response instead of an error.
13
+ - Regex search now runs under a time budget (`LARGEFILE_SEARCH_TIMEOUT`, default 5s, clamped to a minimum of 1) so pathological patterns cannot hang a session; the timer fires on POSIX main threads (how the server dispatches tools), elsewhere the budget is best-effort between lines. Exhaustion raises an error rather than returning a truncation flag.
14
+ - `search_content` `max_results` ceiling raised to 500.
15
+ - Documented `read_enclosing`: find the complete function/class containing a given line, with depth and context-window fallback.
16
+ - Response byte budgets: large responses are capped with explicit `truncated` flags (and `next_offset` where a read can be resumed); context and match lines are capped at 500 characters.
17
+ - UTF-8-first decoding with explicit fallback: non-UTF-8 files decode via detected encoding and surface an `encoding_warning` instead of failing.
18
+
19
+ ### Edit and Safety
20
+
21
+ - Fuzzy edit fix: multi-line fuzzy replacements no longer corrupt newline handling.
22
+ - Collision-proof backups: backup names use an MD5 path hash plus a unique epoch-based timestamp, stored under `~/.largefile/backups/`.
23
+ - Atomic `revert_edit`: current state is always saved as a new backup before reverting, so a revert is itself reversible.
24
+ - Line-ending preservation: edits keep a file's existing CRLF/LF style.
25
+ - Encoding preservation: edits write back in the file's detected encoding (BOMs kept, no silent UTF-8 transcoding); files with undecodable bytes refuse the edit instead of being silently corrupted, and backups are byte-exact copies so reverts restore original bytes.
26
+ - Edit validation with loud failures: invalid change objects, failed matches, and failed batches raise tool errors instead of returning silent no-op results; batches are all-or-nothing.
27
+ - `preview` now defaults to `false`: `edit_content` applies changes immediately (with automatic backup and a unified diff in the response for verification); pass `preview=true` for a dry run.
28
+
29
+ ### Outline and Platform
30
+
31
+ - Tree-sitter outline fixes for Go and Markdown, plus an `outline_status` field on `get_overview` so callers can tell semantic outlines from fallbacks: `parse_failed` means the semantic parse failed (e.g. the file has syntax errors) and a plain-text fallback outline was returned. Markdown headings inside fenced code blocks are no longer counted as headings.
32
+ - Lazy imports for faster server startup.
33
+ - Added `LICENSE` (MIT).
34
+ - CI now tests Python 3.10, 3.11, and 3.12 (matching the supported versions claimed in `pyproject.toml`).
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Peter Etelej
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: largefile
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: MCP server for AI assistants to navigate, search, and edit large codebases, logs, and data files with semantic code analysis
5
5
  Project-URL: Homepage, https://github.com/peteretelej/largefile
6
6
  Project-URL: Repository, https://github.com/peteretelej/largefile.git
@@ -9,6 +9,7 @@ Project-URL: Documentation, https://github.com/peteretelej/largefile#readme
9
9
  Author-email: Peter Etelej <peter@etelej.com>
10
10
  Maintainer-email: Peter Etelej <peter@etelej.com>
11
11
  License: MIT
12
+ License-File: LICENSE
12
13
  Keywords: ai-tools,code-navigation,large-files,llm,log-analysis,mcp,semantic-analysis,tree-sitter
13
14
  Classifier: Development Status :: 5 - Production/Stable
14
15
  Classifier: Intended Audience :: Developers
@@ -43,7 +44,7 @@ Navigate, search, and edit large codebases, logs, and data files that exceed AI
43
44
  ## Why Largefile?
44
45
 
45
46
  - **Go beyond context limits** - Read, search, and edit files too large to fit in AI context windows
46
- - **Semantic code navigation** - Tree-sitter extracts functions/classes for Python, JS/TS, Rust, Go
47
+ - **Semantic code navigation** - Tree-sitter extracts functions/classes for Python, JS/TS, Rust, Go, Java
47
48
  - **Fewer LLM errors** - Search/replace editing eliminates line number mistakes common with line-based edits
48
49
  - **Smart search** - Fuzzy matching, regex, case-insensitive, inverted, and count-only modes
49
50
  - **No size limits** - Handles multi-GB files via tiered memory strategy (RAM → mmap → streaming)
@@ -63,6 +64,20 @@ Navigate, search, and edit large codebases, logs, and data files that exceed AI
63
64
  }
64
65
  ```
65
66
 
67
+ Alternative: install with pip and run the server directly (`largefile` package, `largefile-mcp` command):
68
+
69
+ ```bash
70
+ pip install largefile
71
+ largefile-mcp
72
+ ```
73
+
74
+ Windows tip: `uvx` has a slow cold start there. Prefer installing the tools once instead:
75
+
76
+ ```bash
77
+ uv tool install largefile
78
+ uv tool install diffchunk
79
+ ```
80
+
66
81
  ## Tools
67
82
 
68
83
  | Tool | Use For |
@@ -70,6 +85,7 @@ Navigate, search, and edit large codebases, logs, and data files that exceed AI
70
85
  | `get_overview` | File structure and semantic outline before diving in |
71
86
  | `search_content` | Finding patterns, counting occurrences, regex matching |
72
87
  | `read_content` | Reading specific sections; tail/head modes for logs |
88
+ | `read_enclosing` | Full function/class containing a given line |
73
89
  | `edit_content` | Safe search/replace with automatic backups |
74
90
  | `revert_edit` | Recovering from bad edits |
75
91
  | `list_directory` | Browse directory trees with recursive depth control |
@@ -94,7 +110,7 @@ Navigate, search, and edit large codebases, logs, and data files that exceed AI
94
110
 
95
111
  ### Large Codebase Navigation
96
112
 
97
- ```pythonß
113
+ ```python
98
114
  # Get semantic structure of a large Python file
99
115
  overview = get_overview("/path/to/large_module.py")
100
116
  # Returns: 2,847 lines, 15 classes, function outline via Tree-sitter
@@ -102,18 +118,22 @@ overview = get_overview("/path/to/large_module.py")
102
118
  # Find all class definitions
103
119
  classes = search_content("/path/to/large_module.py", "class ", fuzzy=False)
104
120
 
105
- # Read complete class with semantic chunking
106
- code = read_content("/path/to/large_module.py", pattern="class UserModel", mode="semantic")
121
+ # Read the class containing a specific line
122
+ code = read_enclosing("/path/to/large_module.py", line=412)
107
123
  ```
108
124
 
109
125
  ### Batch Refactoring
110
126
 
111
127
  ```python
112
128
  # Preview rename across file
113
- preview = edit_content("/path/to/api.py", changes=[
114
- {"search": "process_data", "replace": "transform_data"},
115
- {"search": "old_endpoint", "replace": "new_endpoint"}
116
- ], preview=True)
129
+ preview = edit_content(
130
+ "/path/to/api.py",
131
+ changes=[
132
+ {"search": "process_data", "replace": "transform_data"},
133
+ {"search": "old_endpoint", "replace": "new_endpoint"},
134
+ ],
135
+ preview=True,
136
+ )
117
137
 
118
138
  # Apply changes (creates automatic backup)
119
139
  result = edit_content("/path/to/api.py", changes=[...], preview=False)
@@ -155,14 +175,16 @@ Other file types use text-based analysis with graceful fallback.
155
175
 
156
176
  ## Configuration
157
177
 
158
- Environment variables for tuning:
178
+ Environment variables for tuning (see the [Configuration Guide](docs/configuration.md) for the full list):
159
179
 
160
180
  ```bash
161
181
  LARGEFILE_MEMORY_THRESHOLD_MB=50 # RAM loading limit
162
182
  LARGEFILE_MMAP_THRESHOLD_MB=500 # Memory mapping limit
163
183
  LARGEFILE_FUZZY_THRESHOLD=0.8 # Match sensitivity (0.0-1.0)
164
- LARGEFILE_MAX_SEARCH_RESULTS=20 # Results per search
184
+ LARGEFILE_MAX_OUTPUT_BYTES=16000 # Response byte budget per tool call
165
185
  LARGEFILE_BACKUP_DIR=~/.largefile/backups
186
+ LARGEFILE_MAX_BACKUPS=10 # Backups kept per file
187
+ LARGEFILE_SEARCH_TIMEOUT=5 # Regex search time budget (seconds)
166
188
  ```
167
189
 
168
190
  ## Documentation
@@ -7,7 +7,7 @@ Navigate, search, and edit large codebases, logs, and data files that exceed AI
7
7
  ## Why Largefile?
8
8
 
9
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
10
+ - **Semantic code navigation** - Tree-sitter extracts functions/classes for Python, JS/TS, Rust, Go, Java
11
11
  - **Fewer LLM errors** - Search/replace editing eliminates line number mistakes common with line-based edits
12
12
  - **Smart search** - Fuzzy matching, regex, case-insensitive, inverted, and count-only modes
13
13
  - **No size limits** - Handles multi-GB files via tiered memory strategy (RAM → mmap → streaming)
@@ -27,6 +27,20 @@ Navigate, search, and edit large codebases, logs, and data files that exceed AI
27
27
  }
28
28
  ```
29
29
 
30
+ Alternative: install with pip and run the server directly (`largefile` package, `largefile-mcp` command):
31
+
32
+ ```bash
33
+ pip install largefile
34
+ largefile-mcp
35
+ ```
36
+
37
+ Windows tip: `uvx` has a slow cold start there. Prefer installing the tools once instead:
38
+
39
+ ```bash
40
+ uv tool install largefile
41
+ uv tool install diffchunk
42
+ ```
43
+
30
44
  ## Tools
31
45
 
32
46
  | Tool | Use For |
@@ -34,6 +48,7 @@ Navigate, search, and edit large codebases, logs, and data files that exceed AI
34
48
  | `get_overview` | File structure and semantic outline before diving in |
35
49
  | `search_content` | Finding patterns, counting occurrences, regex matching |
36
50
  | `read_content` | Reading specific sections; tail/head modes for logs |
51
+ | `read_enclosing` | Full function/class containing a given line |
37
52
  | `edit_content` | Safe search/replace with automatic backups |
38
53
  | `revert_edit` | Recovering from bad edits |
39
54
  | `list_directory` | Browse directory trees with recursive depth control |
@@ -58,7 +73,7 @@ Navigate, search, and edit large codebases, logs, and data files that exceed AI
58
73
 
59
74
  ### Large Codebase Navigation
60
75
 
61
- ```pythonß
76
+ ```python
62
77
  # Get semantic structure of a large Python file
63
78
  overview = get_overview("/path/to/large_module.py")
64
79
  # Returns: 2,847 lines, 15 classes, function outline via Tree-sitter
@@ -66,18 +81,22 @@ overview = get_overview("/path/to/large_module.py")
66
81
  # Find all class definitions
67
82
  classes = search_content("/path/to/large_module.py", "class ", fuzzy=False)
68
83
 
69
- # Read complete class with semantic chunking
70
- code = read_content("/path/to/large_module.py", pattern="class UserModel", mode="semantic")
84
+ # Read the class containing a specific line
85
+ code = read_enclosing("/path/to/large_module.py", line=412)
71
86
  ```
72
87
 
73
88
  ### Batch Refactoring
74
89
 
75
90
  ```python
76
91
  # Preview rename across file
77
- preview = edit_content("/path/to/api.py", changes=[
78
- {"search": "process_data", "replace": "transform_data"},
79
- {"search": "old_endpoint", "replace": "new_endpoint"}
80
- ], preview=True)
92
+ preview = edit_content(
93
+ "/path/to/api.py",
94
+ changes=[
95
+ {"search": "process_data", "replace": "transform_data"},
96
+ {"search": "old_endpoint", "replace": "new_endpoint"},
97
+ ],
98
+ preview=True,
99
+ )
81
100
 
82
101
  # Apply changes (creates automatic backup)
83
102
  result = edit_content("/path/to/api.py", changes=[...], preview=False)
@@ -119,14 +138,16 @@ Other file types use text-based analysis with graceful fallback.
119
138
 
120
139
  ## Configuration
121
140
 
122
- Environment variables for tuning:
141
+ Environment variables for tuning (see the [Configuration Guide](docs/configuration.md) for the full list):
123
142
 
124
143
  ```bash
125
144
  LARGEFILE_MEMORY_THRESHOLD_MB=50 # RAM loading limit
126
145
  LARGEFILE_MMAP_THRESHOLD_MB=500 # Memory mapping limit
127
146
  LARGEFILE_FUZZY_THRESHOLD=0.8 # Match sensitivity (0.0-1.0)
128
- LARGEFILE_MAX_SEARCH_RESULTS=20 # Results per search
147
+ LARGEFILE_MAX_OUTPUT_BYTES=16000 # Response byte budget per tool call
129
148
  LARGEFILE_BACKUP_DIR=~/.largefile/backups
149
+ LARGEFILE_MAX_BACKUPS=10 # Backups kept per file
150
+ LARGEFILE_SEARCH_TIMEOUT=5 # Regex search time budget (seconds)
130
151
  ```
131
152
 
132
153
  ## Documentation