-
-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #358 from yamadashy/docs/code-compression
docs(website): Code Compression docs
- Loading branch information
Showing
30 changed files
with
1,319 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Code-Komprimierung | ||
|
||
Die Code-Komprimierung ist eine leistungsstarke Funktion, die wichtige Code-Strukturen intelligent extrahiert und dabei Implementierungsdetails entfernt. Dies ist besonders nützlich, um die Token-Anzahl zu reduzieren und gleichzeitig wichtige strukturelle Informationen über Ihre Codebasis beizubehalten. | ||
|
||
## Grundlegende Verwendung | ||
|
||
Aktivieren Sie die Code-Komprimierung mit der Option `--compress`: | ||
|
||
```bash | ||
repomix --compress | ||
``` | ||
|
||
Sie können sie auch mit Remote-Repositories verwenden: | ||
|
||
```bash | ||
repomix --remote user/repo --compress | ||
``` | ||
|
||
## Funktionsweise | ||
|
||
Der Komprimierungsalgorithmus verarbeitet Code mithilfe von Tree-Sitter-Parsing, um wesentliche strukturelle Elemente zu extrahieren und zu bewahren, während Implementierungsdetails entfernt werden. | ||
|
||
Die Komprimierung bewahrt: | ||
- Funktions- und Methodensignaturen | ||
- Schnittstellen- und Typdefinitionen | ||
- Klassenstrukturen und Eigenschaften | ||
- Wichtige strukturelle Elemente | ||
|
||
Während sie entfernt: | ||
- Funktions- und Methodenimplementierungen | ||
- Details zu Schleifen- und Bedingungslogik | ||
- Interne Variablendeklarationen | ||
- Implementierungsspezifischen Code | ||
|
||
### Beispiel | ||
|
||
Ursprünglicher TypeScript-Code: | ||
|
||
```typescript | ||
const calculateTotal = (items: ShoppingItem[]) => { | ||
let total = 0; | ||
for (const item of items) { | ||
total += item.price * item.quantity; | ||
} | ||
return total; | ||
} | ||
interface Item { | ||
name: string; | ||
price: number; | ||
quantity: number; | ||
} | ||
``` | ||
|
||
Nach der Komprimierung: | ||
|
||
```typescript | ||
const calculateTotal = (items: ShoppingItem[]) => { | ||
interface Item { | ||
``` | ||
## Konfiguration | ||
Sie können die Komprimierung in Ihrer Konfigurationsdatei aktivieren: | ||
```json | ||
{ | ||
"output": { | ||
"compress": true | ||
} | ||
} | ||
``` | ||
## Anwendungsfälle | ||
Die Code-Komprimierung ist besonders nützlich wenn: | ||
- Code-Struktur und Architektur analysiert werden | ||
- Token-Anzahl für LLM-Verarbeitung reduziert werden soll | ||
- Hochrangige Dokumentation erstellt wird | ||
- Code-Muster und Signaturen verstanden werden sollen | ||
- API- und Schnittstellendesigns geteilt werden | ||
## Verwandte Optionen | ||
Sie können die Komprimierung mit anderen Optionen kombinieren: | ||
- `--remove-comments`: Code-Kommentare entfernen | ||
- `--remove-empty-lines`: Leere Zeilen entfernen | ||
- `--output-show-line-numbers`: Zeilennummern zur Ausgabe hinzufügen |
Oops, something went wrong.