A lightweight CLI tool that extracts source code from your project files and formats it for use in LLM prompts. Perfect for preparing your codebase for AI analysis, code review, or documentation tasks.
The easiest way to use this tool is with npx
:
# Basic usage - will process .ts, .js, .tsx, .jsx files in current directory
npx @belov.ai/source-to-llm
# Process specific file types
npx @belov.ai/source-to-llm -p "**/*.py" "**/*.java"
# Process specific directory
npx @belov.ai/source-to-llm -d /path/to/your/project
# Exclude specific patterns
npx @belov.ai/source-to-llm -i "**/tests/**" "**/vendor/**"
# Use custom separator between files
npx @belov.ai/source-to-llm -s "===="
-p, --pattern <patterns...>
- File patterns to match (default:["**/*.ts", "**/*.js", "**/*.tsx", "**/*.jsx"]
)-i, --ignore <patterns...>
- Patterns to ignore (default:["**/node_modules/**", "**/dist/**", "**/build/**"]
)-s, --separator <string>
- Separator between files (default: 80 dashes)-d, --dir <path>
- Target directory path (default: current working directory)
File: src/components/Button.tsx
--------------------------------------------------------------------------------
import React from 'react';
export const Button = ({ children }) => {
return <button>{children}</button>;
};
--------------------------------------------------------------------------------
File: src/utils/format.ts
--------------------------------------------------------------------------------
export const formatDate = (date: Date): string => {
return date.toISOString();
};
--------------------------------------------------------------------------------
-
AI Code Review
npx @belov.ai/source-to-llm -p "src/**/*.ts" > code-for-review.txt
-
Documentation Generation
# Extract all component files npx @belov.ai/source-to-llm -p "src/components/**/*.[tj]sx" > components.txt
-
Focused Analysis
# Extract specific features or modules npx @belov.ai/source-to-llm -p "src/features/auth/**/*.ts" -i "**/*.test.ts"
-
Multi-Language Projects
# Process multiple file types npx @belov.ai/source-to-llm -p "**/*.py" "**/*.ts" "**/*.go"
- Node.js >= 18.0.0
MIT
belov.ai