Generate LLM context from your codebase with .llmignore
npm install llmignoreA Node.js tool built with Bun and TypeScript to generate LLM context from a codebase using a .llmignore file. This tool helps developers working with large codebases by creating a structured file tree and including relevant file contents, while excluding unnecessary files like node_modules, lock files, and binaries.
- 🚀 Smart Template System: Auto-detects project type and suggests appropriate templates
- 📝 Custom Configuration: Define project info and file patterns via .llmignore
- 🌳 Structured Output: Generates file tree and contents with clear delimiters
- 👀 Watch Mode: Automatically regenerate context when files change
- 📊 Progress Tracking: Real-time progress bars and token counting
- 📏 Size Control: Skip files larger than a specified size
- 🎨 Language Support: Built-in templates for Node.js, Python, Go, Rust, Java, C++, and PHP
``bashInstall globally with npm
npm install -g llmignore
Commands
$3
`bash
Create a new .llmignore file with interactive prompts
llmignore initUse a specific language template
llmignore init --template node
`$3
`bash
Basic usage - generates llm-context.txt
llmignore generateSpecify output file
llmignore generate -o custom-context.txtSkip large files (size in bytes)
llmignore generate --max-size 1048576Watch for changes
llmignore generate --watchShow detailed logs
llmignore generate --verbose
`Configuration:
.llmignore FileThe
.llmignore file defines how your codebase is processed:`ini
Optional: specify starting directory (defaults to ./)
Project information for context
[project_info]
name: My Project
description: A sample project
version: 1.0.0
author: Your NameFiles and directories to exclude
[exclude]
node_modules/
dist/
*.log
*.svg
*.png
*.jpg
*.binFiles and directories to include
[include]
src/
*.ts
*.js
*.json
*.md
`$3
- folder/: Matches directories and their contents
- *.ext: Matches files with the specified extension
- Exact paths match specific files/directories
- Comments start with #
- Empty lines are ignoredOutput Format
The generated
llm-context.txt includes:1. Project Context
`
=== PROJECT CONTEXT ===
Project Information:
name: My Project
description: A sample project
...
=====================
`2. File Tree
`
=== PROCESSED FILE TREE ===
src/
src/index.ts
src/utils/
src/utils/helper.ts
README.md
=====================
`3. File Contents
`
=== BEGIN FILE: src/index.ts ===
Path: /absolute/path/to/src/index.ts
// File contents here
=== END FILE: src/index.ts ===
`Development
1. Clone and install dependencies:
`bash
git clone https://github.com/dilsayar/llmignore.git
cd llmignore
bun install
`2. Run in development:
`bash
bun run src/index.ts
`3. Build for production:
`bash
bun run build
``- Node.js ≥ 18
- Bun (recommended) or npm/pnpm
MIT License. See LICENSE for details.
Feel free to submit issues and pull requests on GitHub.
Hüseyin Demirtaş