Metadata-Version: 2.2
Name: context-generator
Version: 0.1.1
Summary: Generate file tree and file contents for coding assistance with LLMs.
Home-page: https://github.com/aldo-g/context-gen
Author: Alastair Grant
Author-email: aldo.e.george@gmail.com
Project-URL: Bug Reports, https://github.com/aldo-g/context-gen/issues
Project-URL: Source, https://github.com/aldo-g/context-gen
Keywords: context generation file tree LLMs coding assistance
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENCE
Provides-Extra: dev
Requires-Dist: pytest>=6.0.0; extra == "dev"
Requires-Dist: flake8>=3.9.2; extra == "dev"
Requires-Dist: black>=23.3.0; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-python
Dynamic: summary

# 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)

## 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).

