Skip to content

Commit

Permalink
Merge pull request #358 from yamadashy/docs/code-compression
Browse files Browse the repository at this point in the history
docs(website): Code Compression docs
  • Loading branch information
yamadashy authored Feb 16, 2025
2 parents 1f610a5 + e6682df commit 300ccb2
Show file tree
Hide file tree
Showing 30 changed files with 1,319 additions and 231 deletions.
24 changes: 12 additions & 12 deletions website/client/.vitepress/config/configDe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import { type DefaultTheme, defineConfig } from 'vitepress';

export const configDe = defineConfig({
lang: 'de',
description: 'Verpacken Sie Ihren Code in AI-freundliche Formate',
description: 'Paketieren Sie Ihre Codebasis in KI-freundliche Formate',
themeConfig: {
nav: [
// guide
{ text: 'Anleitung', link: '/de/guide/' },
{ text: 'Discord beitreten', link: 'https://discord.gg/wNYzTwZFku' },
],
Expand All @@ -16,14 +15,15 @@ export const configDe = defineConfig({
items: [
{ text: 'Erste Schritte', link: '/de/guide/' },
{ text: 'Installation', link: '/de/guide/installation' },
{ text: 'Verwendung', link: '/de/guide/usage' },
{ text: 'Grundlegende Verwendung', link: '/de/guide/usage' },
{ text: 'Prompt-Beispiele', link: '/de/guide/prompt-examples' },
{ text: 'Ausgabeformate', link: '/de/guide/output' },
{ text: 'Befehlszeilenoptionen', link: '/de/guide/command-line-options' },
{ text: 'Kommandozeilenoptionen', link: '/de/guide/command-line-options' },
{ text: 'Remote-Repository-Verarbeitung', link: '/de/guide/remote-repository-processing' },
{ text: 'Konfiguration', link: '/de/guide/configuration' },
{ text: 'Benutzerdefinierte Anweisungen', link: '/de/guide/custom-instructions' },
{ text: 'Kommentarentfernung', link: '/de/guide/comment-removal' },
{ text: 'Kommentare entfernen', link: '/de/guide/comment-removal' },
{ text: 'Code-Komprimierung', link: '/de/guide/code-compress' },
{ text: 'Sicherheit', link: '/de/guide/security' },
{
text: 'Tipps & Tricks',
Expand All @@ -32,7 +32,7 @@ export const configDe = defineConfig({
{
text: 'Entwicklung',
items: [
{ text: 'Beitragen', link: '/de/guide/development/' },
{ text: 'Mitwirken', link: '/de/guide/development/' },
{ text: 'Einrichtung', link: '/de/guide/development/setup' },
],
},
Expand All @@ -51,14 +51,14 @@ export const configDeSearch: DefaultTheme.LocalSearchOptions['locales'] = {
buttonAriaLabel: 'Suchen',
},
modal: {
displayDetails: 'Detaillierte Liste anzeigen',
noResultsText: 'Keine Ergebnisse gefunden',
resetButtonTitle: 'Suche zurücksetzen',
backButtonTitle: 'Schließen',
noResultsText: 'Keine Ergebnisse für',
backButtonTitle: 'Zurück',
displayDetails: 'Details anzeigen',
footer: {
selectText: 'zum Auswählen',
navigateText: 'zur Navigation',
closeText: 'zum Schließen',
selectText: 'Auswählen',
navigateText: 'Navigieren',
closeText: 'Schließen',
},
},
},
Expand Down
1 change: 1 addition & 0 deletions website/client/.vitepress/config/configEnUs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const configEnUs = defineConfig({
{ text: 'Configuration', link: '/guide/configuration' },
{ text: 'Custom Instructions', link: '/guide/custom-instructions' },
{ text: 'Comment Removal', link: '/guide/comment-removal' },
{ text: 'Code Compression', link: '/guide/code-compress' },
{ text: 'Security', link: '/guide/security' },
{
text: 'Tips & Tricks',
Expand Down
20 changes: 10 additions & 10 deletions website/client/.vitepress/config/configEs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@ import { type DefaultTheme, defineConfig } from 'vitepress';

export const configEs = defineConfig({
lang: 'es',
description: 'Empaqueta tu código en formatos compatibles con la inteligencia artificial',
description: 'Empaqueta tu código en formatos amigables para IA',
themeConfig: {
nav: [
// guía
{ text: 'Guía', link: '/es/guide/' },
{ text: 'Únete a Discord', link: 'https://discord.gg/wNYzTwZFku' },
{ text: 'Unirse a Discord', link: 'https://discord.gg/wNYzTwZFku' },
],
sidebar: {
'/es/guide/': [
{
text: 'Guía',
items: [
{ text: 'Introducción', link: '/es/guide/' },
{ text: 'Comenzar', link: '/es/guide/' },
{ text: 'Instalación', link: '/es/guide/installation' },
{ text: 'Uso Básico', link: '/es/guide/usage' },
{ text: 'Ejemplos de Prompt', link: '/es/guide/prompt-examples' },
{ text: 'Ejemplos de Prompts', link: '/es/guide/prompt-examples' },
{ text: 'Formatos de Salida', link: '/es/guide/output' },
{ text: 'Opciones de Línea de Comando', link: '/es/guide/command-line-options' },
{ text: 'Opciones de Línea de Comandos', link: '/es/guide/command-line-options' },
{ text: 'Procesamiento de Repositorios Remotos', link: '/es/guide/remote-repository-processing' },
{ text: 'Configuración', link: '/es/guide/configuration' },
{ text: 'Instrucciones Personalizadas', link: '/es/guide/custom-instructions' },
{ text: 'Eliminación de Comentarios', link: '/es/guide/comment-removal' },
{ text: 'Compresión de Código', link: '/es/guide/code-compress' },
{ text: 'Seguridad', link: '/es/guide/security' },
{
text: 'Consejos y Trucos',
Expand All @@ -33,7 +33,7 @@ export const configEs = defineConfig({
text: 'Desarrollo',
items: [
{ text: 'Contribuir', link: '/es/guide/development/' },
{ text: 'Configuración Inicial', link: '/es/guide/development/setup' },
{ text: 'Configuración', link: '/es/guide/development/setup' },
],
},
],
Expand All @@ -51,9 +51,9 @@ export const configEsSearch: DefaultTheme.LocalSearchOptions['locales'] = {
buttonAriaLabel: 'Buscar',
},
modal: {
noResultsText: 'Sin resultados',
resetButtonTitle: 'Restablecer búsqueda',
backButtonTitle: 'Volver',
noResultsText: 'No se encontraron resultados',
resetButtonTitle: 'Reiniciar búsqueda',
backButtonTitle: 'Atrás',
displayDetails: 'Mostrar detalles',
footer: {
selectText: 'Seleccionar',
Expand Down
1 change: 1 addition & 0 deletions website/client/.vitepress/config/configJa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const configJa = defineConfig({
{ text: '設定', link: '/ja/guide/configuration' },
{ text: 'カスタム指示', link: '/ja/guide/custom-instructions' },
{ text: 'コメントの削除', link: '/ja/guide/comment-removal' },
{ text: 'コード圧縮', link: '/ja/guide/code-compress' },
{ text: 'セキュリティ', link: '/ja/guide/security' },
{
text: 'ヒント&テクニック',
Expand Down
13 changes: 7 additions & 6 deletions website/client/.vitepress/config/configKo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type DefaultTheme, defineConfig } from 'vitepress';

export const configKo = defineConfig({
lang: 'ko-KR',
lang: 'ko',
description: '코드베이스를 AI 친화적인 형식으로 패키징',
themeConfig: {
nav: [
Expand All @@ -18,11 +18,12 @@ export const configKo = defineConfig({
{ text: '기본 사용법', link: '/ko/guide/usage' },
{ text: '프롬프트 예제', link: '/ko/guide/prompt-examples' },
{ text: '출력 형식', link: '/ko/guide/output' },
{ text: '명령행 옵션', link: '/ko/guide/command-line-options' },
{ text: '명령줄 옵션', link: '/ko/guide/command-line-options' },
{ text: '원격 저장소 처리', link: '/ko/guide/remote-repository-processing' },
{ text: '설정', link: '/ko/guide/configuration' },
{ text: '사용자 지정 지시사항', link: '/ko/guide/custom-instructions' },
{ text: '사용자 정의 지침', link: '/ko/guide/custom-instructions' },
{ text: '주석 제거', link: '/ko/guide/comment-removal' },
{ text: '코드 압축', link: '/ko/guide/code-compress' },
{ text: '보안', link: '/ko/guide/security' },
{
text: '팁과 요령',
Expand Down Expand Up @@ -50,10 +51,10 @@ export const configKoSearch: DefaultTheme.LocalSearchOptions['locales'] = {
buttonAriaLabel: '검색',
},
modal: {
noResultsText: '결과 없음',
resetButtonTitle: '검색 재설정',
noResultsText: '검색 결과가 없습니다',
resetButtonTitle: '검색 초기화',
backButtonTitle: '뒤로',
displayDetails: '세부 정보 표시',
displayDetails: '상세 정보 표시',
footer: {
selectText: '선택',
navigateText: '이동',
Expand Down
18 changes: 9 additions & 9 deletions website/client/.vitepress/config/configPtBr.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { type DefaultTheme, defineConfig } from 'vitepress';

export const configPtBr = defineConfig({
lang: 'pt-br',
description: 'Empacote seu código em formatos compatíveis com IA',
lang: 'pt-BR',
description: 'Empacote sua base de código em formatos amigáveis para IA',
themeConfig: {
nav: [
// guia
{ text: 'Guia', link: '/pt-br/guide/' },
{ text: 'Entrar no Discord', link: 'https://discord.gg/wNYzTwZFku' },
],
Expand All @@ -14,16 +13,17 @@ export const configPtBr = defineConfig({
{
text: 'Guia',
items: [
{ text: 'Introdução', link: '/pt-br/guide/' },
{ text: 'Começando', link: '/pt-br/guide/' },
{ text: 'Instalação', link: '/pt-br/guide/installation' },
{ text: 'Uso Básico', link: '/pt-br/guide/usage' },
{ text: 'Exemplos de Prompt', link: '/pt-br/guide/prompt-examples' },
{ text: 'Formatos de Saída', link: '/pt-br/guide/output' },
{ text: 'Opções de Linha de Comando', link: '/pt-br/guide/command-line-options' },
{ text: 'Processamento de Repositórios Remotos', link: '/pt-br/guide/remote-repository-processing' },
{ text: 'Processamento de Repositório Remoto', link: '/pt-br/guide/remote-repository-processing' },
{ text: 'Configuração', link: '/pt-br/guide/configuration' },
{ text: 'Instruções Personalizadas', link: '/pt-br/guide/custom-instructions' },
{ text: 'Remoção de Comentários', link: '/pt-br/guide/comment-removal' },
{ text: 'Compressão de Código', link: '/pt-br/guide/code-compress' },
{ text: 'Segurança', link: '/pt-br/guide/security' },
{
text: 'Dicas e Truques',
Expand All @@ -33,7 +33,7 @@ export const configPtBr = defineConfig({
text: 'Desenvolvimento',
items: [
{ text: 'Contribuindo', link: '/pt-br/guide/development/' },
{ text: 'Configuração Inicial', link: '/pt-br/guide/development/setup' },
{ text: 'Configuração', link: '/pt-br/guide/development/setup' },
],
},
],
Expand All @@ -44,15 +44,15 @@ export const configPtBr = defineConfig({
});

export const configPtBrSearch: DefaultTheme.LocalSearchOptions['locales'] = {
'pt-br': {
'pt-BR': {
translations: {
button: {
buttonText: 'Pesquisar',
buttonAriaLabel: 'Pesquisar',
},
modal: {
noResultsText: 'Sem resultados',
resetButtonTitle: 'Redefinir pesquisa',
noResultsText: 'Nenhum resultado encontrado',
resetButtonTitle: 'Limpar pesquisa',
backButtonTitle: 'Voltar',
displayDetails: 'Mostrar detalhes',
footer: {
Expand Down
19 changes: 10 additions & 9 deletions website/client/.vitepress/config/configZhCn.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { type DefaultTheme, defineConfig } from 'vitepress';

export const configZhCn = defineConfig({
lang: 'zh-cn',
lang: 'zh-CN',
description: '将代码库打包成AI友好的格式',
themeConfig: {
nav: [
{ text: '指南', link: '/zh-cn/guide/' },
{ text: '加入Discord', link: 'https://discord.gg/wNYzTwZFku' },
{ text: '加入 Discord', link: 'https://discord.gg/wNYzTwZFku' },
],
sidebar: {
'/zh-cn/guide/': [
{
text: '指南',
items: [
{ text: '入门指南', link: '/zh-cn/guide/' },
{ text: '开始使用', link: '/zh-cn/guide/' },
{ text: '安装', link: '/zh-cn/guide/installation' },
{ text: '基本用法', link: '/zh-cn/guide/usage' },
{ text: '提示示例', link: '/zh-cn/guide/prompt-examples' },
Expand All @@ -23,6 +23,7 @@ export const configZhCn = defineConfig({
{ text: '配置', link: '/zh-cn/guide/configuration' },
{ text: '自定义指令', link: '/zh-cn/guide/custom-instructions' },
{ text: '注释移除', link: '/zh-cn/guide/comment-removal' },
{ text: '代码压缩', link: '/zh-cn/guide/code-compress' },
{ text: '安全性', link: '/zh-cn/guide/security' },
{
text: '技巧与窍门',
Expand All @@ -31,8 +32,8 @@ export const configZhCn = defineConfig({
{
text: '开发',
items: [
{ text: '参与贡献', link: '/zh-cn/guide/development/' },
{ text: '环境搭建', link: '/zh-cn/guide/development/setup' },
{ text: '贡献指南', link: '/zh-cn/guide/development/' },
{ text: '环境配置', link: '/zh-cn/guide/development/setup' },
],
},
],
Expand All @@ -43,20 +44,20 @@ export const configZhCn = defineConfig({
});

export const configZhCnSearch: DefaultTheme.LocalSearchOptions['locales'] = {
'zh-cn': {
'zh-CN': {
translations: {
button: {
buttonText: '搜索',
buttonAriaLabel: '搜索',
},
modal: {
noResultsText: '无结果',
resetButtonTitle: '重置搜索',
noResultsText: '未找到相关结果',
resetButtonTitle: '清除搜索',
backButtonTitle: '返回',
displayDetails: '显示详情',
footer: {
selectText: '选择',
navigateText: '导航',
navigateText: '切换',
closeText: '关闭',
},
},
Expand Down
87 changes: 87 additions & 0 deletions website/client/src/de/guide/code-compress.md
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
Loading

0 comments on commit 300ccb2

Please sign in to comment.