Skip to content
8 changes: 7 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,12 @@ find src -name "*.ts" -type f | repomix --stdin
# Using git to get tracked files
git ls-files "*.ts" | repomix --stdin

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

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

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

Expand Down
4 changes: 2 additions & 2 deletions src/cli/actions/defaultAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ export const handleStdinProcessing = async (
);
}

const spinner = new Spinner('Reading file paths from stdin...', cliOptions);
spinner.start();
const spinner = new Spinner('', cliOptions);
Comment thread
yamadashy marked this conversation as resolved.
Outdated

let packResult: PackResult;

try {
const stdinResult = await readFilePathsFromStdin(cwd);

spinner.start();
Comment thread
yamadashy marked this conversation as resolved.
spinner.update('Packing files...');
Comment thread
yamadashy marked this conversation as resolved.

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

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) {
Comment thread
yamadashy marked this conversation as resolved.
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
15 changes: 15 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,12 @@ find src -name "*.ts" -type f | repomix --stdin
# Mit Git für verfolgte Dateien
git ls-files "*.ts" | repomix --stdin

# Mit ripgrep zum Dateien finden
rg --files --type ts | repomix --stdin
Comment thread
yamadashy marked this conversation as resolved.
Outdated

# Mit fd zum Dateien finden
fd -e ts | repomix --stdin
Comment thread
yamadashy marked this conversation as resolved.
Outdated

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

Expand All @@ -64,6 +70,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
6 changes: 6 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,12 @@ find src -name "*.ts" -type f | repomix --stdin
# Using git to get tracked files
git ls-files "*.ts" | repomix --stdin

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

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

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

Expand Down
15 changes: 15 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,12 @@ find src -name "*.ts" -type f | repomix --stdin
# Usando git para obtener archivos rastreados
git ls-files "*.ts" | repomix --stdin

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

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

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

Expand All @@ -64,6 +70,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
6 changes: 6 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,12 @@ find src -name "*.ts" -type f | repomix --stdin
# En utilisant git pour obtenir les fichiers suivis
git ls-files "*.ts" | repomix --stdin

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

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

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

Expand Down
6 changes: 6 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,12 @@ find src -name "*.ts" -type f | repomix --stdin
# git का उपयोग करके ट्रैक्ड फ़ाइलें प्राप्त करने के लिए
git ls-files "*.ts" | repomix --stdin

# फ़ाइलें खोजने के लिए ripgrep का उपयोग करके
rg --files --type ts | repomix --stdin
Comment thread
yamadashy marked this conversation as resolved.
Outdated

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

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

Expand Down
6 changes: 6 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,12 @@ find src -name "*.ts" -type f | repomix --stdin
# Menggunakan git untuk mendapatkan file yang terlacak
git ls-files "*.ts" | repomix --stdin

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

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

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

Expand Down
6 changes: 6 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,12 @@ find src -name "*.ts" -type f | repomix --stdin
# gitを使用してトラッキングされているファイルを取得
git ls-files "*.ts" | repomix --stdin

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

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

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

Expand Down
31 changes: 10 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,12 @@ find src -name "*.ts" -type f | repomix --stdin
# git을 사용하여 추적된 파일 가져오기
git ls-files "*.ts" | repomix --stdin

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

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

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

Expand All @@ -64,32 +70,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

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

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

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

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

## 출력 형식

### XML (기본값)
Expand Down
31 changes: 10 additions & 21 deletions website/client/src/pt-br/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ find src -name "*.ts" -type f | repomix --stdin
# Usando git para obter arquivos rastreados
git ls-files "*.ts" | repomix --stdin

# Usando ripgrep para encontrar arquivos
rg --files --type ts | repomix --stdin

# Usando fd para encontrar arquivos
fd -e ts | repomix --stdin

# Usando ls com padrões glob
ls src/**/*.ts | repomix --stdin

Expand All @@ -64,32 +70,15 @@ A opção `--stdin` permite que você canalize uma lista de caminhos de arquivos
> [!NOTE]
> Ao usar `--stdin`, os caminhos de arquivos podem ser relativos ou absolutos, e o Repomix tratará automaticamente da resolução de caminhos e deduplicação.

### Entrada de Lista de Arquivos (stdin)

Passe caminhos de arquivos via stdin para máxima flexibilidade:
### Compressão de Código

```bash
# Usando o comando find
find src -name "*.ts" -type f | repomix --stdin

# Usando git para obter arquivos rastreados
git ls-files "*.ts" | repomix --stdin

# Usando ls com padrões glob
ls src/**/*.ts | repomix --stdin

# De um arquivo contendo caminhos de arquivos
cat file-list.txt | repomix --stdin
repomix --compress

# Entrada direta com echo
echo -e "src/index.ts\nsrc/utils.ts" | repomix --stdin
# Você também pode usar com repositórios remotos:
repomix --remote yamadashy/repomix --compress
```

A opção `--stdin` permite canalizar uma lista de caminhos de arquivos para o Repomix, oferecendo máxima flexibilidade na seleção de quais arquivos compactar.

> [!NOTE]
> Ao usar `--stdin`, os caminhos de arquivos podem ser relativos ou absolutos, e o Repomix irá automaticamente lidar com a resolução de caminhos e desduplicação.

## Formatos de Saída

### XML (Padrão)
Expand Down
6 changes: 6 additions & 0 deletions website/client/src/vi/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ find src -name "*.ts" -type f | repomix --stdin
# Sử dụng git để lấy các tệp được theo dõi
git ls-files "*.ts" | repomix --stdin

# Sử dụng ripgrep để tìm tệp
rg --files --type ts | repomix --stdin

# Sử dụng fd để tìm tệp
fd -e ts | repomix --stdin

# Sử dụng ls với các mẫu glob
ls src/**/*.ts | repomix --stdin

Expand Down
15 changes: 15 additions & 0 deletions website/client/src/zh-cn/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ find src -name "*.ts" -type f | repomix --stdin
# 使用 git 获取跟踪的文件
git ls-files "*.ts" | repomix --stdin

# 使用 ripgrep 查找文件
rg --files --type ts | repomix --stdin

# 使用 fd 查找文件
fd -e ts | repomix --stdin

# 使用 ls 和 glob 模式
ls src/**/*.ts | repomix --stdin

Expand All @@ -64,6 +70,15 @@ echo -e "src/index.ts\nsrc/utils.ts" | repomix --stdin
> [!NOTE]
> 使用 `--stdin` 时,文件路径可以是相对路径或绝对路径,Repomix 会自动处理路径解析和去重。

### 代码压缩

```bash
repomix --compress

# 您也可以将其用于远程仓库:
repomix --remote yamadashy/repomix --compress
```
Comment thread
yamadashy marked this conversation as resolved.

## 输出格式

### XML(默认)
Expand Down
15 changes: 15 additions & 0 deletions website/client/src/zh-tw/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ find src -name "*.ts" -type f | repomix --stdin
# 使用 git 獲取追蹤的文件
git ls-files "*.ts" | repomix --stdin

# 使用 ripgrep 查找文件
rg --files --type ts | repomix --stdin

# 使用 fd 查找文件
fd -e ts | repomix --stdin

# 使用 ls 和 glob 模式
ls src/**/*.ts | repomix --stdin

Expand All @@ -64,6 +70,15 @@ echo -e "src/index.ts\nsrc/utils.ts" | repomix --stdin
> [!NOTE]
> 使用 `--stdin` 時,文件路徑可以是相對路徑或絕對路徑,Repomix 會自動處理路徑解析和去重。

### 程式碼壓縮

```bash
repomix --compress

# 您也可以將其用於遠端倉庫:
repomix --remote yamadashy/repomix --compress
```

## 輸出格式

### XML(預設)
Expand Down
Loading