A powerful CLI tool to transform any Git repository into clean, prompt-friendly text ingests for AI analysis, training data, and search indexing.
Everything you need to generate perfect code ingests for AI models
Clone remote Git URLs or scan local directories effortlessly with a single command.
Generates clean, structured text ingests optimized for AI models and training data.
Fine-grained control using powerful glob-style include and exclude patterns.
Automatically respects your project's .gitignore rules, or override when needed.
Automatically skip files larger than your specified limit to keep outputs clean.
Access private repositories securely using GitHub Personal Access Tokens.
Install CodeTxt globally and start analyzing repositories
Install directly from the npm registry (recommended):
$ npm install -g codetxt
Requires Node.js v18 or higher. After installation, the codetxt command will be available globally.
From basic commands to advanced filtering, CodeTxt adapts to your workflow
Clone and analyze any public GitHub repository:
$ codetxt https://github.com/expressjs/express # Generates code.txt with all Express source files
Analyze your current project or any local path:
$ codetxt . -o my-project.txt # Analyzes current directory, outputs to my-project.txt
Whitelist specific file types or directories:
$ codetxt . --include-pattern "**/*.ts" --include-pattern "**/*.md" # Only TypeScript and Markdown files
Skip unwanted directories or file types:
$ codetxt . --exclude-pattern "tests/" --exclude-pattern "*.log" # Skip tests directory and log files
Combine options for maximum control
$ codetxt https://github.com/vuejs/core \ --branch main \ --include-pattern "packages/**/*.ts" \ --exclude-pattern "**/*.test.ts" \ --max-size 50000 \ -o vue-core-digest.txt
Complete reference for all available command-line options
| Flag | Alias | Description | Default |
|---|---|---|---|
--output <file> |
-o |
Specify an output file. Use - for stdout. |
code.txt |
--max-size <bytes> |
-s |
Skip files larger than this size in bytes. | 10MB |
--branch <name> |
-b |
For remote repos, specify a branch to clone. | Default repo branch |
--include-pattern <glob> |
— | Only include files/directories matching the glob pattern(s). | — |
--exclude-pattern <glob> |
— | Exclude files/directories matching the glob pattern(s). | — |
--include-gitignored |
— | Process files normally ignored by .gitignore. | false |
--force |
-f |
Overwrite existing output file without confirmation. | false |
--token <pat> |
-t |
GitHub Personal Access Token for private repositories. | — |