A simple tool to help you create detailed context files in your repository's directory structure.
npm install contextify-cliContextify is a CLI tool designed to facilitate Context-Driven Development by automatically generating and maintaining CONTEXT.md files throughout your codebase. It uses Google Gemini to analyze your code and create hierarchical documentation, making it easier for AI agents and human developers to understand the project structure.
* Bottom-Up Generation: Starts from the deepest subdirectories and bubbles up context to the root, ensuring high-level documentation reflects low-level details.
* Automatic Updates: Smartly updates existing CONTEXT.md files, preserving manual developer notes while refreshing technical details.
* Respects Ignore Files: Honors .gitignore and supports a custom .contextignore to exclude specific files or folders from analysis.
* Large File Handling: Automatically truncates files larger than 200KB to fit within the context window, keeping the most relevant parts (head and tail).
* Gemini Powered: Uses Google's Gemini models for high-quality summarization.
``bash`
npm install -g contextifyOR run directly with npx
npx contextify run
First, you need to set your Google Gemini API Key. You can do this via the CLI or by setting an environment variable.
`bash`
contextify init
Follow the prompts to enter your API Key.
Alternatively, set GEMINI_API_KEY in your environment or a .env file.
Navigate to the root of your project and run:
`bash`
contextify run
This will:
1. Traverse your directory tree (bottom-up).
2. Read file contents (respecting ignores).
3. Read existing CONTEXT.md files from subdirectories.CONTEXT.md
4. Generate or Update the for the current directory using Gemini.
* .gitignore: Files listed here are ignored.
* .contextignore`: Add this file to your project root to ignore specific files/folders only for Contextify (e.g., if you want to ignore documentation files but keep them in git).
* Node.js >= 18
* Google Gemini API Key