Back to Repomix

Command Line Options

website/client/src/en/guide/command-line-options.md

1.17.08.1 KB
Original Source

Command Line Options

Basic Options

  • -v, --version: Show version information and exit

CLI Input/Output Options

OptionDescription
--verboseEnable detailed debug logging (shows file processing, token counts, and configuration details)
--quietSuppress all console output except errors (useful for scripting)
--stdoutWrite packed output directly to stdout instead of a file (suppresses all logging)
--stdinRead file paths from stdin, one per line (specified files are processed directly)
--copyCopy the generated output to system clipboard after processing
--token-count-tree [threshold]Show file tree with token counts; optional threshold to show only files with ≥N tokens (e.g., --token-count-tree 100)
--top-files-len <number>Number of largest files to show in summary (default: 5)

Repomix Output Options

OptionDescription
-o, --output <file>Output file path (default: repomix-output.xml, use "-" for stdout)
--style <style>Output format: xml, markdown, json, or plain (default: xml)
--output-file-path-style <style>How file paths are shown in output: target-relative or cwd-relative (default: target-relative)
--parsable-styleEscape special characters to ensure valid XML/Markdown (needed when output contains code that breaks formatting)
--compressExtract essential code structure (classes, functions, interfaces) using Tree-sitter parsing
--output-show-line-numbersPrefix each line with its line number in the output
--no-file-summaryOmit the file summary section from output
--no-directory-structureOmit the directory tree visualization from output
--no-filesGenerate metadata only without file contents (useful for repository analysis)
--remove-commentsStrip all code comments before packing
--remove-empty-linesRemove blank lines from all files
--truncate-base64Truncate long base64 data strings to reduce output size
--header-text <text>Custom text to include at the beginning of the output
--instruction-file-path <path>Path to file containing custom instructions to include in output
--split-output <size>Split output into multiple numbered files (e.g., repomix-output.1.xml); size like 500kb, 2mb, or 1.5mb
--include-empty-directoriesInclude folders with no files in directory structure
--include-full-directory-structureShow entire repository tree in the Directory Structure section, even when using --include patterns
--no-git-sort-by-changesDon't sort files by git change frequency (default: most changed files first)
--include-diffsAdd git diff section showing working tree and staged changes
--include-logsAdd git commit history with messages and changed files
--include-logs-count <count>Number of recent commits to include with --include-logs (default: 50)

File Selection Options

OptionDescription
--include <patterns>Include only files matching these glob patterns (comma-separated, e.g., "src/**/*.js,*.md")
-i, --ignore <patterns>Additional patterns to exclude (comma-separated, e.g., "*.test.js,docs/**")
--no-gitignoreDon't use .gitignore rules for filtering files
--no-dot-ignoreDon't use .ignore rules for filtering files
--no-default-patternsDon't apply built-in ignore patterns (node_modules, .git, build dirs, etc.)

Remote Repository Options

OptionDescription
--remote <url>Clone and pack a remote repository (GitHub URL or user/repo format)
--remote-branch <name>Specific branch, tag, or commit to use (default: repository's default branch)
--remote-trust-configTrust and load config files from remote repositories. A trusted config can run commands and read local files, so use it only for repositories you fully trust (disabled by default for security). On an interactive terminal, the config is shown and you are asked to confirm

Configuration Options

OptionDescription
-c, --config <path>Use custom config file instead of repomix.config.json
--initCreate a new repomix.config.json file with defaults
--globalWith --init, create config in home directory instead of current directory

Security Options

  • --no-security-check: Skip scanning for sensitive data like API keys and passwords (use with caution; may expose secrets in output)

Token Count Options

  • --token-count-encoding <encoding>: Tokenizer model for counting: o200k_base (GPT-4o), cl100k_base (GPT-3.5/4), etc. (default: o200k_base)
  • --token-budget <number>: Fail with a non-zero exit code when the packed output exceeds N tokens. Useful as a guard in CI pipelines and agent workflows to keep output within a target model's context window. The output is still generated; only the exit code signals the overflow.

MCP Options

  • --mcp: Run as Model Context Protocol server for AI tool integration

Agent Skills Generation Options

OptionDescription
--skill-generate [name]Generate Claude Agent Skills format output to .claude/skills/<name>/ directory (name auto-generated if omitted)
--skill-project-name <name>Override the project name used in generated Skills descriptions
--skill-output <path>Specify skill output directory path directly (skips location prompt)
-f, --forceSkip all confirmation prompts (skill directory overwrite, remote config trust)

Watch Mode Options

  • -w, --watch: Watch for file changes and automatically re-pack. New, changed, and deleted files are detected, rapid changes are debounced (300 ms), and a timestamp is printed after each rebuild. Press Ctrl+C to stop.

Watch mode only works with local directories, so it cannot be combined with --remote, a positional remote repository URL, --stdout, --stdin, --split-output, --skill-generate, or --copy. These restrictions apply whether the option is set on the command line or in your config file.

Examples

bash
# Basic usage
repomix

# Custom output file and format
repomix -o my-output.md --style markdown
repomix -o my-output.json --style json

# Output to stdout
repomix --stdout > custom-output.txt

# Send output to stdout, then pipe into another command (for example, simonw/llm)
repomix --stdout | llm "Please explain what this code does."

# Custom output with compression
repomix --compress

# Split output into multiple files (max size per part)
repomix --split-output 20mb

# Process specific files with patterns
repomix --include "src/**/*.ts,*.md" --ignore "*.test.js,docs/**"

# Remote repository with branch
repomix --remote https://github.com/user/repo/tree/main

# Remote repository with commit
repomix --remote https://github.com/user/repo/commit/836abcd7335137228ad77feb28655d85712680f1

# Remote repository with shorthand
repomix --remote user/repo

# Remote repository with shorthand (auto-detected, no --remote needed)
repomix user/repo

# Using stdin for file list
find src -name "*.ts" -type f | repomix --stdin
git ls-files "*.js" | repomix --stdin
echo -e "src/index.ts\nsrc/utils.ts" | repomix --stdin

# Git integration
repomix --include-diffs  # Include git diffs for uncommitted changes
repomix --include-logs   # Include git logs (last 50 commits by default)
repomix --include-logs --include-logs-count 10  # Include last 10 commits
repomix --include-diffs --include-logs  # Include both diffs and logs

# Token count analysis
repomix --token-count-tree
repomix --token-count-tree 1000  # Only show files/directories with 1000+ tokens

# Watch mode — automatically re-pack on file changes
repomix --watch
repomix -w --include "src/**/*.ts"