You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,7 @@ And ingest web URLs.
20
20
21
21
- Traverse directory structures and generate a tree view
22
22
- Include/exclude files based on glob patterns
23
+
- Compress code using Tree-sitter to extract key structural information while omitting implementation details
23
24
- Estimate vRAM requirements and check model compatibility using another package I've created called [quantest](https://github.com/sammcj/quantest)
24
25
- Parse output directly to LLMs such as Ollama or any OpenAI compatible API for processing
25
26
- Generate and include git diffs and logs
@@ -209,6 +210,44 @@ You can provide a prompt suffix to append to the generated prompt:
209
210
ingest --llm -p "explain this code" /path/to/project
210
211
```
211
212
213
+
## Code Compression with Tree-sitter
214
+
215
+
**Experimental**
216
+
217
+
Ingest can compress source code files by extracting key structural information while omitting implementation details. This is useful for reducing token usage while preserving the important parts of the code structure.
218
+
219
+
```shell
220
+
ingest --compress /path/to/project
221
+
```
222
+
223
+
The compression extracts:
224
+
- Package/module declarations
225
+
- Import statements
226
+
- Function/method signatures (without bodies)
227
+
- Class definitions (without method bodies)
228
+
- Type definitions
229
+
- Comments
230
+
231
+
Currently supported languages:
232
+
- Go
233
+
- Python
234
+
- JavaScript (including arrow functions and ES6 module syntax)
235
+
- Bash
236
+
- C
237
+
- CSS
238
+
239
+
Example of compressed JavaScript:
240
+
241
+
```
242
+
// This is a JavaScript comment
243
+
import { something } from 'module';
244
+
export class MyJSClass { ... } // Body removed
245
+
constructor(name) { ... } // Body removed
246
+
greet(message) { ... } // Body removed
247
+
export function myJSFunction(x, y) { ... } // Body removed
248
+
const myArrowFunc = (a, b) => { ... } // Body removed
249
+
```
250
+
212
251
## Web Crawling & Ingestion
213
252
214
253
Crawl with explicit web mode
@@ -272,6 +311,7 @@ These directories will be created automatically on first run, along with README
272
311
273
312
### Flags
274
313
314
+
-`--compress`: **New** Enable code compression using Tree-sitter to extract key structural information while omitting implementation details
275
315
-`--config`: Opens the config file in the default editor
276
316
-`--context`: Specify the context length for VRAM estimation
277
317
-`--exclude-from-tree`: Exclude files/folders from the source tree based on exclude patterns
0 commit comments