Skip to content
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ repomix --remote https://github.com/yamadashy/repomix/commit/836abcd7335137228ad

```

To pack files from a file list (via stdin):
To pack files from a file list (pipe via stdin):

```bash
# Using find command
Expand All @@ -225,6 +225,24 @@ find src -name "*.ts" -type f | repomix --stdin
# Using git to get tracked files
git ls-files "*.ts" | repomix --stdin

# Using grep to find files containing specific content
grep -l "TODO" **/*.ts | repomix --stdin

# Using ripgrep to find files with specific content
rg -l "TODO|FIXME" --type ts | repomix --stdin

# Using ripgrep (rg) to find files
rg --files --type ts | repomix --stdin

# Using sharkdp/fd to find files
fd -e ts | repomix --stdin

# Using fzf to select from all files
fzf -m | repomix --stdin

# Interactive file selection with fzf
find . -name "*.ts" -type f | fzf -m | repomix --stdin

# Using ls with glob patterns
ls src/**/*.ts | repomix --stdin

Expand Down
2 changes: 1 addition & 1 deletion src/cli/actions/defaultAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ export const handleStdinProcessing = async (
}

const spinner = new Spinner('Reading file paths from stdin...', cliOptions);
spinner.start();

let packResult: PackResult;

try {
const stdinResult = await readFilePathsFromStdin(cwd);

spinner.start();
spinner.update('Packing files...');

// Use pack with predefined files from stdin
Expand Down
7 changes: 5 additions & 2 deletions src/cli/cliRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,11 @@ export const runCli = async (directories: string[], cwd: string, options: CliOpt
return;
}

const version = await getVersion();
logger.log(pc.dim(`\n📦 Repomix v${version}\n`));
// Skip version header in stdin mode to avoid interfering with piped output from interactive tools like fzf
if (!options.stdin) {
const version = await getVersion();
logger.log(pc.dim(`\n📦 Repomix v${version}\n`));
}

if (options.init) {
await runInitAction(cwd, options.global || false);
Expand Down
19 changes: 14 additions & 5 deletions src/core/file/fileStdin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

/**
* Reads lines from a readable stream using readline interface.
* Waits for EOF before returning all collected lines.
* Handles interactive tools like fzf that may take time to provide output.
*/
export const readLinesFromStream = async (
input: Readable,
Expand All @@ -45,11 +47,18 @@
const rl = createInterface({ input });
const lines: string[] = [];

for await (const line of rl) {
lines.push(line);
try {
for await (const line of rl) {
lines.push(line);
}
// The for-await loop naturally waits for EOF before completing
return lines;
} finally {
// Safely close the readline interface if it has a close method
if (rl && typeof rl.close === 'function') {
rl.close();
}

Check warning on line 60 in src/core/file/fileStdin.ts

View check run for this annotation

Codecov / codecov/patch

src/core/file/fileStdin.ts#L59-L60

Added lines #L59 - L60 were not covered by tests
}

return lines;
};

/**
Expand All @@ -74,7 +83,7 @@
throw new RepomixError('No data provided via stdin. Please pipe file paths to repomix when using --stdin flag.');
}

// Read all lines from stdin
// Read all lines from stdin (wait for EOF)
const rawLines = await readLinesFromStream(stdin as Readable, createReadlineInterface);

// Filter out empty lines and comments
Expand Down
27 changes: 27 additions & 0 deletions website/client/src/de/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ find src -name "*.ts" -type f | repomix --stdin
# Mit Git für verfolgte Dateien
git ls-files "*.ts" | repomix --stdin

# Mit ripgrep (rg) zum Finden von Dateien
rg --files --type ts | repomix --stdin

# Mit grep zum Finden von Dateien mit bestimmten Inhalten
grep -l "TODO" **/*.ts | repomix --stdin

# Mit ripgrep zum Finden von Dateien mit bestimmten Inhalten
rg -l "TODO|FIXME" --type ts | repomix --stdin

# Mit sharkdp/fd zum Finden von Dateien
fd -e ts | repomix --stdin

# Mit fzf aus allen Dateien auswählen
fzf -m | repomix --stdin

# Interaktive Dateiauswahl mit fzf
find . -name "*.ts" -type f | fzf -m | repomix --stdin

# Mit ls und Glob-Mustern
ls src/**/*.ts | repomix --stdin

Expand All @@ -64,6 +82,15 @@ Die `--stdin`-Option ermöglicht es Ihnen, eine Liste von Dateipfaden an Repomix
> [!NOTE]
> Bei der Verwendung von `--stdin` können Dateipfade relativ oder absolut angegeben werden, und Repomix übernimmt automatisch die Pfadauflösung und Deduplizierung.

### Code-Komprimierung

```bash
repomix --compress

# Sie können es auch mit Remote-Repositories verwenden:
repomix --remote yamadashy/repomix --compress
```

## Ausgabeformate

### XML (Standard)
Expand Down
18 changes: 18 additions & 0 deletions website/client/src/en/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ find src -name "*.ts" -type f | repomix --stdin
# Using git to get tracked files
git ls-files "*.ts" | repomix --stdin

# Using ripgrep (rg) to find files
rg --files --type ts | repomix --stdin

# Using grep to find files containing specific content
grep -l "TODO" **/*.ts | repomix --stdin

# Using ripgrep to find files with specific content
rg -l "TODO|FIXME" --type ts | repomix --stdin

# Using sharkdp/fd to find files
fd -e ts | repomix --stdin

# Using fzf to select from all files
fzf -m | repomix --stdin

# Interactive file selection with fzf
find . -name "*.ts" -type f | fzf -m | repomix --stdin

# Using ls with glob patterns
ls src/**/*.ts | repomix --stdin

Expand Down
27 changes: 27 additions & 0 deletions website/client/src/es/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ find src -name "*.ts" -type f | repomix --stdin
# Usando git para obtener archivos rastreados
git ls-files "*.ts" | repomix --stdin

# Usando ripgrep (rg) para encontrar archivos
rg --files --type ts | repomix --stdin

# Usando grep para encontrar archivos que contienen contenido específico
grep -l "TODO" **/*.ts | repomix --stdin

# Usando ripgrep para encontrar archivos con contenido específico
rg -l "TODO|FIXME" --type ts | repomix --stdin

# Usando sharkdp/fd para encontrar archivos
fd -e ts | repomix --stdin

# Usando fzf para seleccionar de todos los archivos
fzf -m | repomix --stdin

# Selección interactiva de archivos con fzf
find . -name "*.ts" -type f | fzf -m | repomix --stdin

# Usando ls con patrones glob
ls src/**/*.ts | repomix --stdin

Expand All @@ -64,6 +82,15 @@ La opción `--stdin` te permite canalizar una lista de rutas de archivos a Repom
> [!NOTE]
> Cuando uses `--stdin`, las rutas de archivos pueden ser relativas o absolutas, y Repomix manejará automáticamente la resolución de rutas y la eliminación de duplicados.

### Compresión de código

```bash
repomix --compress

# También puedes usarlo con repositorios remotos:
repomix --remote yamadashy/repomix --compress
```

## Formatos de salida

### XML (predeterminado)
Expand Down
18 changes: 18 additions & 0 deletions website/client/src/fr/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,24 @@ find src -name "*.ts" -type f | repomix --stdin
# En utilisant git pour obtenir les fichiers suivis
git ls-files "*.ts" | repomix --stdin

# En utilisant grep pour trouver des fichiers contenant du contenu spécifique
grep -l "TODO" **/*.ts | repomix --stdin

# En utilisant ripgrep pour trouver des fichiers avec du contenu spécifique
rg -l "TODO|FIXME" --type ts | repomix --stdin

# En utilisant ripgrep (rg) pour trouver des fichiers
rg --files --type ts | repomix --stdin

# En utilisant sharkdp/fd pour trouver des fichiers
fd -e ts | repomix --stdin

# En utilisant fzf pour sélectionner à partir de tous les fichiers
fzf -m | repomix --stdin

# Sélection interactive de fichiers avec fzf
find . -name "*.ts" -type f | fzf -m | repomix --stdin

# En utilisant ls avec des motifs glob
ls src/**/*.ts | repomix --stdin

Expand Down
18 changes: 18 additions & 0 deletions website/client/src/hi/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@ find src -name "*.ts" -type f | repomix --stdin
# git का उपयोग करके ट्रैक्ड फ़ाइलें प्राप्त करने के लिए
git ls-files "*.ts" | repomix --stdin

# विशिष्ट सामग्री वाली फ़ाइलें खोजने के लिए grep का उपयोग करके
grep -l "TODO" **/*.ts | repomix --stdin

# विशिष्ट सामग्री वाली फ़ाइलें खोजने के लिए ripgrep का उपयोग करके
rg -l "TODO|FIXME" --type ts | repomix --stdin

# फ़ाइलें खोजने के लिए ripgrep (rg) का उपयोग करके
rg --files --type ts | repomix --stdin

# फ़ाइलें खोजने के लिए sharkdp/fd का उपयोग करके
fd -e ts | repomix --stdin

# सभी फ़ाइलों से चुनने के लिए fzf का उपयोग करके
fzf -m | repomix --stdin

# fzf के साथ इंटरैक्टिव फ़ाइल चयन
find . -name "*.ts" -type f | fzf -m | repomix --stdin

# glob पैटर्न के साथ ls का उपयोग करके
ls src/**/*.ts | repomix --stdin

Expand Down
18 changes: 18 additions & 0 deletions website/client/src/id/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ find src -name "*.ts" -type f | repomix --stdin
# Menggunakan git untuk mendapatkan file yang terlacak
git ls-files "*.ts" | repomix --stdin

# Menggunakan grep untuk mencari file yang berisi konten tertentu
grep -l "TODO" **/*.ts | repomix --stdin

# Menggunakan ripgrep untuk mencari file dengan konten tertentu
rg -l "TODO|FIXME" --type ts | repomix --stdin

# Menggunakan ripgrep (rg) untuk mencari file
rg --files --type ts | repomix --stdin

# Menggunakan sharkdp/fd untuk mencari file
fd -e ts | repomix --stdin

# Menggunakan fzf untuk memilih dari semua file
fzf -m | repomix --stdin

# Pemilihan file interaktif dengan fzf
find . -name "*.ts" -type f | fzf -m | repomix --stdin

# Menggunakan ls dengan pola glob
ls src/**/*.ts | repomix --stdin

Expand Down
18 changes: 18 additions & 0 deletions website/client/src/ja/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ find src -name "*.ts" -type f | repomix --stdin
# gitを使用してトラッキングされているファイルを取得
git ls-files "*.ts" | repomix --stdin

# ripgrep (rg) を使用してファイルを検索
rg --files --type ts | repomix --stdin

# grepを使用して特定の内容を含むファイルを検索
grep -l "TODO" **/*.ts | repomix --stdin

# ripgrepを使用して特定の内容を含むファイルを検索
rg -l "TODO|FIXME" --type ts | repomix --stdin

# sharkdp/fd を使用してファイルを検索
fd -e ts | repomix --stdin

# fzfを使用してすべてのファイルから選択
fzf -m | repomix --stdin

# fzfを使用したインタラクティブなファイル選択
find . -name "*.ts" -type f | fzf -m | repomix --stdin

# globパターンを使用したls
ls src/**/*.ts | repomix --stdin

Expand Down
43 changes: 22 additions & 21 deletions website/client/src/ko/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ find src -name "*.ts" -type f | repomix --stdin
# git을 사용하여 추적된 파일 가져오기
git ls-files "*.ts" | repomix --stdin

# ripgrep (rg) 을 사용하여 파일 찾기
rg --files --type ts | repomix --stdin

# grep을 사용하여 특정 내용을 포함하는 파일 찾기
grep -l "TODO" **/*.ts | repomix --stdin

# ripgrep을 사용하여 특정 내용을 포함하는 파일 찾기
rg -l "TODO|FIXME" --type ts | repomix --stdin

# sharkdp/fd 를 사용하여 파일 찾기
fd -e ts | repomix --stdin

# fzf를 사용하여 모든 파일에서 선택
fzf -m | repomix --stdin

# fzf를 사용한 대화형 파일 선택
find . -name "*.ts" -type f | fzf -m | repomix --stdin

# glob 패턴과 함께 ls 사용
ls src/**/*.ts | repomix --stdin

Expand All @@ -64,32 +82,15 @@ echo -e "src/index.ts\nsrc/utils.ts" | repomix --stdin
> [!NOTE]
> `--stdin`을 사용할 때 파일 경로는 상대 경로 또는 절대 경로가 될 수 있으며, Repomix가 자동으로 경로 해석과 중복 제거를 처리합니다.

### 파일 목록 입력 (stdin)

최대한의 유연성을 위해 stdin을 통해 파일 경로를 전달하세요:
### 코드 압축

```bash
# find 명령어 사용
find src -name "*.ts" -type f | repomix --stdin

# git을 사용하여 추적된 파일 가져오기
git ls-files "*.ts" | repomix --stdin

# glob 패턴과 함께 ls 사용
ls src/**/*.ts | repomix --stdin
repomix --compress

# 파일 경로가 포함된 파일에서
cat file-list.txt | repomix --stdin

# echo를 사용한 직접 입력
echo -e "src/index.ts\nsrc/utils.ts" | repomix --stdin
# 원격 저장소에서도 사용할 수 있습니다:
repomix --remote yamadashy/repomix --compress
```

`--stdin` 옵션을 사용하면 파일 경로 목록을 Repomix에 파이프할 수 있어 패킹할 파일을 선택하는 데 최대한의 유연성을 제공합니다.

> [!NOTE]
> `--stdin` 사용 시 파일 경로는 상대 경로 또는 절대 경로일 수 있으며, Repomix가 자동으로 경로 해석과 중복 제거를 처리합니다.

## 출력 형식

### XML (기본값)
Expand Down
Loading
Loading