Generates a structured overview of your project for AI context. The script scans your codebase and creates a single file containing your project's structure and content, making it easy to provide context to Large Language Models.
-
Place
project2context.pyorproject2context.jsin your project's root directory -
Run the script:
# Python version python project2context.py # Node.js version node project2context.js
-
Find the generated
project-context.txtin your project root
You can limit processing to a specific subdirectory:
# Process only subdirectories
node project2context.js [target_directory]
# Examples
node project2context.js frontend
node project2context.js frontend/css- Python 3.6+ or Node.js 12.0+
- No additional packages required
Edit these sets at the start of the script to customize:
EXCLUDED_DIRS: Directories to skip (e.g., node_modules)EXCLUDED_FILES: Specific files to ignoreTEXT_EXTENSIONS: File types to includeEXCLUDED_EXTENSIONS: File types to skip
The script generates project-context.txt containing:
- Directory tree structure
- Content of all text files