All skills
Skillintermediate

Configuration

Repomix can be configured using a configuration file or command-line options. The configuration file allows you to customize various aspects of how Repomix processes and outputs your codebase.

Claude Code Knowledge Pack7/10/2026

Overview

Configuration

Repomix can be configured using a configuration file or command-line options. The configuration file allows you to customize various aspects of how Repomix processes and outputs your codebase.

Configuration File Formats

Repomix supports multiple configuration file formats for flexibility and ease of use.

Repomix will automatically search for configuration files in the following priority order:

  1. TypeScript (repomix.config.ts, repomix.config.mts, repomix.config.cts)
  2. JavaScript/ES Module (repomix.config.js, repomix.config.mjs, repomix.config.cjs)
  3. JSON (repomix.config.json5, repomix.config.jsonc, repomix.config.json)

JSON Configuration

Create a configuration file in your project directory:

repomix --init

This will create a repomix.config.json file with default settings. You can also create a global configuration file that will be used as a fallback when no local configuration is found:

repomix --init --global

TypeScript Configuration

TypeScript configuration files provide the best developer experience with full type checking and IDE support.

Installation:

To use TypeScript or JavaScript configuration with defineConfig, you need to install Repomix as a dev dependency:

npm install -D repomix

Example:

// repomix.config.ts

  output: {
    filePath: 'output.xml',
    style: 'xml',
    removeComments: true,
  },
  ignore: {
    customPatterns: ['**/node_modules/**', '**/dist/**'],
  },
});

Benefits:

  • ✅ Full TypeScript type checking in your IDE
  • ✅ Excellent IDE autocomplete and IntelliSense
  • ✅ Use dynamic values (timestamps, environment variables, etc.)

Dynamic Values Example:

// repomix.config.ts

// Generate timestamp-based filename
const timestamp = new Date().toISOString().slice(0, 19).replace(/[:.]/g, '-');

  output: {
    filePath: `output-${timestamp}.xml`,
    style: 'xml',
  },
});

JavaScript Configuration

JavaScript configuration files work the same as TypeScript, supporting defineConfig and dynamic values.

Configuration Options

OptionDescriptionDefault
input.maxFileSizeMaximum file size in bytes to process. Files larger than this will be skipped. Useful for excluding large binary files or data files50000000
output.filePathThe name of the output file. Supports XML, Markdown, and plain text formats"repomix-output.xml"
output.styleThe style of the output (xml, markdown, json, plain). Each format has its own advantages for different AI tools"xml"
output.parsableStyleWhether to escape the output based on the chosen style schema. Enables better parsing but may increase token countfalse
output.compressWhether to perform intelligent code extraction using Tree-sitter to reduce token count while preserving structurefalse
output.headerTextCustom text to include in the file header. Useful for providing context or instructions for AI toolsnull
output.instructionFilePathPath to a file containing detailed custom instructions for AI processingnull
output.fileSummaryWhether to include a summary section at the beginning showing file counts, sizes, and other metricstrue
output.directoryStructureWhether to include the directory structure in the output. Helps AI understand the project organizationtrue
output.filesWhether to include file contents in the output. Set to false to only include structure and metadatatrue
output.removeCommentsWhether to remove comments from supported file types. Can reduce noise and token countfalse
output.removeEmptyLinesWhether to remove empty lines from the output to reduce token countfalse
output.showLineNumbersWhether to add line numbers to each line. Helpful for referencing specific parts of codefalse
output.truncateBase64Whether to truncate long base64 data strings (e.g., images) to reduce token countfalse
output.copyToClipboardWhether to copy the output to system clipboard in addition to saving the filefalse
output.splitOutputSplit output into multiple numbered files by maximum size per part (e.g., 1000000 for ~1MB). CLI accepts human-readable sizes like 500kb or 2mb. Keeps each file under the limit and avoids splitting files across partsNot set
output.topFilesLengthNumber of top files to display in the summary. If set to 0, no summary will be displayed5
output.includeEmptyDirectoriesWhether to include empty directories in the repository structurefalse
output.includeFullDirectoryStructureWhen using include patterns, whether to display the complete directory tree (respecting ignore patterns) while still processing only the included files. Provides full repository context for AI analysisfalse
output.git.sortByChangesWhether to sort files by git change count. Files with more changes appear at the bottomtrue
output.git.sortByChangesMaxCommitsMaximum number of commits to analyze for git changes. Limits the history depth for performance100
output.git.includeDiffsWhether to include git diffs in the output. Shows both work tree and staged changes separatelyfalse
output.git.includeLogsWhether to include git logs in the output. Shows commit history with dates, messages, and file pathsfalse
output.git.includeLogsCountNumber of git log commits to include in the output50
includePatterns of files to include using glob patterns[]
ignore.useGitignoreWhether to use patterns from the project's .gitignore filetrue
ignore.useDotIgnoreWhether to use patterns from the project's .ignore filetrue
ignore.useDefaultPatternsWhether to use default ignore patterns (node_modules, .git, etc.)true
ignore.customPatternsAdditional patterns to ignore using glob patterns[]
security.enableSecurityCheckWhether to perform security checks using Secretlint to detect sensitive informationtrue
tokenCount.encodingToken count encoding for OpenAI-compatible tokenization (e.g., o200k_base for GPT-4o, cl100k_base for GPT-4/3.5). Powered by gpt-tokenizer."o200k_base"

The configuration file supports JSON5 syntax, which allows:

  • Comments (both single-line and multi-line)
  • Trailing commas in objects and arrays
  • Unquoted property names
  • More relaxed string syntax

Schema Validation

You can enable schema validation for your configuration file by adding the $schema property:

{
  "$schema": "https://repomix.com/schemas/latest/schema.json",
  "output": {
    "filePath": "repomix-output.xml",
    "style": "xml"
  }
}

This provides auto-completion and validation in editors that support JSON schema.

Example Configuration File

Here's an example of a complete configuration file (repomix.config.json):

{
  "$schema": "https://repomix.com/schemas/latest/schema.json",
  "input": {
    "maxFileSize": 50000000
  },
  "output": {
    "filePath": "repomix-output.xml",
    "style": "xml",
    "parsableStyle": false,
    "compress": false,
    "headerText": "Custom header information for the packed file.",
    "fileSummary": true,
    "directoryStructure": true,
    "files": true,
    "removeComments": false,
    "removeEmptyLines": false,
    "topFilesLength": 5,
    "showLineNumbers": false,
    "truncateBase64": false,
    "copyToClipboard": false,
    "includeEmptyDirectories": false,
    "git": {
      "sortByChanges": true,
      "sortByChangesMaxCommits": 100,
      "includeDiffs": false,
      "includeLogs": false,
      "includeLogsCount": 50
    }
  },
  "include": ["**/*"],
  "ignore": {
    "useGitignore": true,
    "useDefaultPatterns": true,
    // Patterns can also be specified in .repomixignore
    "customPatterns": [
      "additional-folder",
      "**/*.log"
    ],
  },
  "security": {
    "enableSecurityCheck": true
  },
  "tokenCount": {
    "encoding": "o200k_base"
  }
}

Configuration File Locations

Repomix looks for configuration files in the following order:

  1. Local configuration file in the current directory (priority order: TS > JS > JSON)
    • TypeScript: repomix.config.ts, repomix.config.mts, repomix.config.cts
    • JavaScript: repomix.config.js, repomix.config.mjs, repomix.config.cjs
    • JSON: repomix.config.json5, repomix.config.jsonc, repomix.config.json
  2. Global configuration file (priority order: TS > JS > JSON)
    • Windows:
      • TypeScript: %LOCALAPPDATA%\\Repomix\\repomix.config.ts, .mts, .cts
      • JavaScript: %LOCALAPPDATA%\\Repomix\\repomix.config.js, .mjs, .cjs
      • JSON: %LOCALAPPDATA%\\Repomix\\repomix.config.json5, .jsonc, .json
    • macOS/Linux:
      • TypeScript: ~/.config/repomix/repomix.config.ts, .mts, .cts
      • JavaScript: ~/.config/repomix/repomix.config.js, .mjs, .cjs
      • JSON: ~/.config/repomix/repomix.config.json5, .jsonc, .json

Command-line options take precedence over configuration file settings.

Include Patterns

Repomix supports specifying files to include using glob patterns. This allows for more flexible and powerful file selection:

  • Use **/*.js to include all JavaScript files in any directory
  • Use src/**/* to include all files within the src directory and its subdirectories
  • Combine multiple patterns like ["src/**/*.js", "**/*.md"] to include JavaScript files in src and all Markdown files

You can specify include patterns in your configuration file:

{
  "include": ["src/**/*", "tests/**/*.test.js"]
}

Or use the --include command-line option for one-time filtering.

Ignore Patterns

Repomix offers multiple methods to set ignore patterns for excluding specific files or directories during the packing process:

  • .gitignore: By default, patterns listed in your project's .gitignore files and .git/info/exclude are used. This behavior can be controlled with the ignore.useGitignore setting or the --no-gitignore CLI option.
  • .ignore: You can use a .ignore file in your project root, following the same format as .gitignore. This file is respected by tools like ripgrep and the silver searcher, reducing the need to maintain multiple ignore files. This behavior can be controlled with the ignore.useDotIgnore setting or the --no-dot-ignore CLI option.
  • Default patterns: Repomix includes a default list of commonly excluded files and directories (e.g., node_modules, .git, binary files). This feature can be controlled with the ignore.useDefaultPatterns setting or the --no-default-patterns CLI option. Please see defaultIgnore.ts for more details.
  • .repomixignore: You can create a .repomixignore file in your project root to define Repomix-specific ignore patterns. This file follows the same format as .gitignore.
  • Custom patterns: Additional ignore patterns can be specified using the ignore.customPatterns option in the configuration file. You can overwrite this setting with the -i, --ignore command line option.

Priority Order (from highest to lowest):

  1. Custom patterns (ignore.customPatterns)
  2. Ignore files (.repomixignore, .ignore, .gitignore, and .git/info/exclude):
    • When in nested directories, files in deeper directories have higher priority
    • When in the same directory, these files are merged in no particular order
  3. Default patterns (if ignore.useDefaultPatterns is true and --no-default-patterns is not used)

This approach allows for flexible file exclusion configuration based on your project's needs. It helps optimize the size of the generated pack file by ensuring the exclusion of security-sensitive files and large binary files, while preventing the leakage of confidential information.

Note: Binary files are not included in the packed output by default, but their paths are listed in the "Repository Structure" section of the output file. This provides a complete overview of the repository structure while keeping the packed file efficient and text-based. See Binary Files Handling for more details.

Example of .repomixignore:

# Cache directories
.cache/
tmp/

# Build outputs
dist/
build/

#