# Context Generator
![PyPI](https://img.shields.io/pypi/v/context-generator)
![Python Versions](https://img.shields.io/pypi/pyversions/context-generator)
![License](https://img.shields.io/pypi/l/context-generator)
![GitHub Issues](https://img.shields.io/github/issues/aldo-g/context-generator)
![GitHub Forks](https://img.shields.io/github/forks/aldo-g/context-generator)
![GitHub Stars](https://img.shields.io/github/stars/aldo-g/context-generator)
![GitHub License](https://img.shields.io/github/license/aldo-g/context-generator)
## Table of Contents
- [Introduction](#introduction)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Generating Context](#generating-context)
- [Calibrating Configuration](#calibrating-configuration)
- [Configuration](#configuration)
- [Examples](#examples)
- [Integration with VSCode](#integration-with-vscode)
- [Contributing](#contributing)
- [License](#license)
- [Contact](#contact)
## Introduction
**Context Generator** is a Python CLI tool designed to generate a comprehensive file tree and collect file contents from your project. This tool is used to give a comprehensive context of your project to an LLM for improved responses.
for an example of the output please look in the img dir
## Features
- **File Tree Generation:** Visual representation of your project's directory structure.
- **Content Collection:** Aggregates contents of selected files for easy reference.
- **Exclusion Options:** Customize which files or directories to exclude from the context.
- **Hidden Files Handling:** Option to include or exclude hidden files and directories.
- **Configuration Management:** Easily configure default settings through a JSON file.
- **VSCode Integration:** Seamlessly integrate with Visual Studio Code via a dedicated extension (planned).
- **Cross-Platform Support:** Works on Windows, macOS, and Linux.
## Installation
### Prerequisites
- **Python 3.7+**: Ensure you have Python installed. You can download it from [python.org](https://www.python.org/downloads/).
### Install via PyPI
```bash
pip install context-generator
```
## Usage
### Generating Context
To generate a file tree and collect contents:
```bash
generate-context generate <directory> --output <output_file>
```
**Options:**
- `directory`: The root directory to scan. Defaults to the current working directory.
- `--output`: Specify the output file for the generated context.
- `--exclude-files`: List filenames to exclude from the context.
- `--exclude-paths`: List directory paths to exclude from the context.
- `--include-hidden`: Include hidden files and directories in the output.
### Example
Generate a context file for your project:
```bash
generate-context generate . --output context.txt --exclude-files .env --exclude-paths .git
```
### Calibrating Configuration
To edit the default configuration file:
```bash
generate-context calibrate
```
This opens the configuration file located at `~/.generate_context_config.json` in your default editor. Adjust the settings as needed.
## Configuration
The configuration file is stored at `~/.generate_context_config.json`. Below is an example configuration:
```json
{
"exclude_files": [".env", "package-lock.json", "LICENSE"],
"exclude_paths": [".git", "__pycache__"],
"output_file": "file_context.txt",
"exclude_hidden": true
}
```
**Fields:**
- `exclude_files`: Files to exclude from the context generation.
- `exclude_paths`: Directories to exclude.
- `output_file`: Default output file name.
- `exclude_hidden`: Whether to exclude hidden files and directories.
## Examples
1. **Basic File Tree Generation:**
```bash
generate-context generate .
```
2. **Excluding Specific Files and Directories:**
```bash
generate-context generate ./src --exclude-files .env --exclude-paths .git
```
3. **Including Hidden Files:**
```bash
generate-context generate ./ --include-hidden
```
## Integration with VSCode
- Planned integration with Visual Studio Code to provide an extension for generating context directly from the editor.
## Contributing
We welcome contributions! Feel free to submit issues and pull requests on [GitHub](https://github.com/aldo-g/context-generator).
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Contact
For questions or support, reach out to **Alastair Grant** at [aldo.e.george@gmail.com](mailto:aldo.e.george@gmail.com).
Raw data
{
"_id": null,
"home_page": "https://github.com/aldo-g/context-gen",
"name": "context-generator",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "context generation file tree LLMs coding assistance",
"author": "Alastair Grant",
"author_email": "aldo.e.george@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/31/93/61c24fd7e0247fd0ef569bec43a77d23624cebbc64c6e0533a578965f88e/context_generator-0.1.0.tar.gz",
"platform": null,
"description": "# Context Generator\n\n![PyPI](https://img.shields.io/pypi/v/context-generator)\n![Python Versions](https://img.shields.io/pypi/pyversions/context-generator)\n![License](https://img.shields.io/pypi/l/context-generator)\n![GitHub Issues](https://img.shields.io/github/issues/aldo-g/context-generator)\n![GitHub Forks](https://img.shields.io/github/forks/aldo-g/context-generator)\n![GitHub Stars](https://img.shields.io/github/stars/aldo-g/context-generator)\n![GitHub License](https://img.shields.io/github/license/aldo-g/context-generator)\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n - [Generating Context](#generating-context)\n - [Calibrating Configuration](#calibrating-configuration)\n- [Configuration](#configuration)\n- [Examples](#examples)\n- [Integration with VSCode](#integration-with-vscode)\n- [Contributing](#contributing)\n- [License](#license)\n- [Contact](#contact)\n\n## Introduction\n\n**Context Generator** is a Python CLI tool designed to generate a comprehensive file tree and collect file contents from your project. This tool is used to give a comprehensive context of your project to an LLM for improved responses.\n\nfor an example of the output please look in the img dir\n\n## Features\n\n- **File Tree Generation:** Visual representation of your project's directory structure.\n- **Content Collection:** Aggregates contents of selected files for easy reference.\n- **Exclusion Options:** Customize which files or directories to exclude from the context.\n- **Hidden Files Handling:** Option to include or exclude hidden files and directories.\n- **Configuration Management:** Easily configure default settings through a JSON file.\n- **VSCode Integration:** Seamlessly integrate with Visual Studio Code via a dedicated extension (planned).\n- **Cross-Platform Support:** Works on Windows, macOS, and Linux.\n\n## Installation\n\n### Prerequisites\n\n- **Python 3.7+**: Ensure you have Python installed. You can download it from [python.org](https://www.python.org/downloads/).\n\n### Install via PyPI\n\n```bash\npip install context-generator\n```\n\n## Usage\n\n### Generating Context\n\nTo generate a file tree and collect contents:\n\n```bash\ngenerate-context generate <directory> --output <output_file>\n```\n\n**Options:**\n- `directory`: The root directory to scan. Defaults to the current working directory.\n- `--output`: Specify the output file for the generated context.\n- `--exclude-files`: List filenames to exclude from the context.\n- `--exclude-paths`: List directory paths to exclude from the context.\n- `--include-hidden`: Include hidden files and directories in the output.\n\n### Example\n\nGenerate a context file for your project:\n\n```bash\ngenerate-context generate . --output context.txt --exclude-files .env --exclude-paths .git\n```\n\n### Calibrating Configuration\n\nTo edit the default configuration file:\n\n```bash\ngenerate-context calibrate\n```\n\nThis opens the configuration file located at `~/.generate_context_config.json` in your default editor. Adjust the settings as needed.\n\n## Configuration\n\nThe configuration file is stored at `~/.generate_context_config.json`. Below is an example configuration:\n\n```json\n{\n \"exclude_files\": [\".env\", \"package-lock.json\", \"LICENSE\"],\n \"exclude_paths\": [\".git\", \"__pycache__\"],\n \"output_file\": \"file_context.txt\",\n \"exclude_hidden\": true\n}\n```\n\n**Fields:**\n- `exclude_files`: Files to exclude from the context generation.\n- `exclude_paths`: Directories to exclude.\n- `output_file`: Default output file name.\n- `exclude_hidden`: Whether to exclude hidden files and directories.\n\n## Examples\n\n1. **Basic File Tree Generation:**\n\n ```bash\n generate-context generate .\n ```\n\n2. **Excluding Specific Files and Directories:**\n\n ```bash\n generate-context generate ./src --exclude-files .env --exclude-paths .git\n ```\n\n3. **Including Hidden Files:**\n\n ```bash\n generate-context generate ./ --include-hidden\n ```\n\n## Integration with VSCode\n\n- Planned integration with Visual Studio Code to provide an extension for generating context directly from the editor.\n\n## Contributing\n\nWe welcome contributions! Feel free to submit issues and pull requests on [GitHub](https://github.com/aldo-g/context-generator).\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contact\n\nFor questions or support, reach out to **Alastair Grant** at [aldo.e.george@gmail.com](mailto:aldo.e.george@gmail.com).\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Generate file tree and file contents for coding assistance with LLMs.",
"version": "0.1.0",
"project_urls": {
"Bug Reports": "https://github.com/aldo-g/context-gen/issues",
"Homepage": "https://github.com/aldo-g/context-gen",
"Source": "https://github.com/aldo-g/context-gen"
},
"split_keywords": [
"context",
"generation",
"file",
"tree",
"llms",
"coding",
"assistance"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "89b8bc99bffc2f81323f6ae3b0e72c4a295123b9a6a544c132f8d6130eb6c822",
"md5": "9aada297051a67e8f0e2030c6cfb0683",
"sha256": "3aefdeea8d0519a7334c9deeeab2f332ea385a1faf006ce1bd462db0be4880ca"
},
"downloads": -1,
"filename": "context_generator-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9aada297051a67e8f0e2030c6cfb0683",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 10122,
"upload_time": "2025-01-20T00:42:34",
"upload_time_iso_8601": "2025-01-20T00:42:34.312057Z",
"url": "https://files.pythonhosted.org/packages/89/b8/bc99bffc2f81323f6ae3b0e72c4a295123b9a6a544c132f8d6130eb6c822/context_generator-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "319361c24fd7e0247fd0ef569bec43a77d23624cebbc64c6e0533a578965f88e",
"md5": "efb4e1e2ea98221f21efdfeb08ab7770",
"sha256": "b6098e9d033c200b381f2c31319b41d73e0345d406344a73c8783856ff0f9722"
},
"downloads": -1,
"filename": "context_generator-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "efb4e1e2ea98221f21efdfeb08ab7770",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 9198,
"upload_time": "2025-01-20T00:42:36",
"upload_time_iso_8601": "2025-01-20T00:42:36.108605Z",
"url": "https://files.pythonhosted.org/packages/31/93/61c24fd7e0247fd0ef569bec43a77d23624cebbc64c6e0533a578965f88e/context_generator-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-20 00:42:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aldo-g",
"github_project": "context-gen",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "context-generator"
}