Metadata-Version: 2.4
Name: anything-to-text
Version: 0.3.3
Summary: Export source code and project files into AI-friendly text bundles with manifest
Project-URL: Homepage, https://github.com/asjnaang/anything-to-text
Project-URL: Documentation, https://github.com/asjnaang/anything-to-text#readme
Project-URL: Repository, https://github.com/asjnaang/anything-to-text
Project-URL: Issues, https://github.com/asjnaang/anything-to-text/issues
Author: ASJN
License-Expression: MIT
License-File: LICENSE
Keywords: ai,code,copilot,export,llm,source-code,text
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: pathspec>=0.9.0
Requires-Dist: questionary>=1.10.0
Requires-Dist: rich>=10.0.0
Provides-Extra: all
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# anything-to-text

Export source code and project files into AI-friendly text bundles with a compact manifest.

**Commands:** `anything-to-text` or `att` (short alias)

## Features

- **Multi-language support**: Python, TypeScript, JavaScript, Java, Kotlin, Swift, HTML/CSS, and more
- **AI-optimized output**: Creates bundle files with embedded metadata for AI assistants
- **Smart filtering**: Respects `.gitignore` and skips build/cache directories automatically
- **Manifest generation**: Produces `MANIFEST.json` with precise file location mappings
- **Project overview**: Optional `PROJECT_OVERVIEW.txt` for architecture insights
- **Secret protection**: Skips `.env`, keys, certificates, and other sensitive files by default
- **Fancy interactive UI**: Checkbox-style selection with questionary
- **Large file handling**: Automatically splits large files into manageable chunks

## Installation

```bash
pip install anything-to-text
```

## Quick Start

### CLI Usage

```bash
# Show version
anything-to-text --version
att --version

# Interactive mode - scan current directory
anything-to-text
att

# Specify project root
anything-to-text /path/to/project
att /path/to/project

# Non-interactive mode with specific categories
anything-to-text /path/to/project --non-interactive --categories python typescript
att /path/to/project --non-interactive --categories python typescript

# Export specific files or folders
anything-to-text . --non-interactive --paths src main.py
att . --non-interactive --paths src main.py

# Generate project overview
anything-to-text . --project-overview
att . --project-overview

# Use fancy interactive UI
anything-to-text . --fancy-ui
att . --fancy-ui

# Set custom output directory
anything-to-text . --output-dir ./my-bundles
att . --output-dir ./my-bundles

# Adjust max lines per bundle
anything-to-text . --max-lines 10000
att . --max-lines 10000

# Include secret files (use with caution)
anything-to-text . --include-secret-files
att . --include-secret-files
```

### Python API

```python
from pathlib import Path
from anything_to_text import CodeExporter, ExportConfig

# Simple export
exporter = CodeExporter()
result = exporter.export(
    project_root="/path/to/project",
    categories=["python", "typescript"],
    interactive=False,
    project_overview=True,
)

print(f"Created {result.bundles_created} bundles")
print(f"Exported {result.files_exported} files")
print(f"Output directory: {result.output_dir}")

# Or use configuration object
config = ExportConfig(
    project_root=Path("/path/to/project"),
    max_lines=10000,
    include_secret_files=False,
    categories=["python", "web_ui"],
    interactive=False,
)

exporter = CodeExporter(config)
result = exporter.export()
```

## Output Files

After running, you'll get:

| File | Description |
|------|-------------|
| `bundle_001.txt`, `bundle_002.txt`, ... | Text bundles containing your source code |
| `MANIFEST.json` | Maps files to bundles and line ranges |
| `README_EXPORT.txt` | Summary of the export |
| `PROJECT_OVERVIEW.txt` | (Optional) Architecture overview |

## Categories

| Category | Description | Extensions |
|----------|-------------|------------|
| `python` | Python backend / scripts | `.py` |
| `typescript` | TypeScript / TSX | `.ts`, `.tsx` |
| `javascript` | JavaScript / JSX | `.js`, `.jsx`, `.mjs`, `.cjs` |
| `java_kotlin` | Android / JVM | `.java`, `.kt`, `.kts`, `.gradle` |
| `ios_apple` | iOS / Apple platform | `.swift`, `.m`, `.h`, etc. |
| `web_ui` | HTML / CSS / UI | `.html`, `.css`, `.scss`, `.vue`, etc. |
| `config_docs` | Config / metadata | `.json`, `.yaml`, `.xml`, `.toml`, `.md` |

### Category Aliases

| Alias | Maps to |
|-------|---------|
| `py` | `python` |
| `ts`, `tsx` | `typescript` |
| `js`, `jsx` | `javascript` |
| `java`, `kotlin`, `android` | `java_kotlin` |
| `ios`, `swift`, `apple` | `ios_apple` |
| `web`, `frontend`, `ui` | `web_ui` |
| `config`, `docs` | `config_docs` |

## Usage Examples

### Export Python and TypeScript code for AI review

```bash
att /my-project --non-interactive --categories python typescript --project-overview
```

### Export specific folders

```bash
att . --non-interactive --paths src/components src/utils
```

### Full export with all features

```bash
att /path/to/project \
    --non-interactive \
    --categories python typescript web_ui \
    --max-lines 10000 \
    --project-overview \
    --output-dir ./ai-review-bundles
```

### Interactive mode with fancy UI

```bash
att . --fancy-ui
```

### Use with AI assistants

After running the exporter:

1. **Attach bundles**: Upload `bundle_001.txt` (and others) to your AI assistant
2. **Include manifest**: Upload `MANIFEST.json` so the assistant understands file mappings
3. **Add overview**: Upload `PROJECT_OVERVIEW.txt` for architecture context
4. **Ask questions**: The assistant can now reference exact file locations and line numbers

## Security

By default, the following files are **skipped** to protect sensitive data:

- `.env` files and variants (`*.env.*`)
- Private keys (`*.pem`, `*.key`, `id_rsa`, `id_ed25519`)
- Certificates (`*.crt`, `*.cer`, `*.der`)
- Keystores (`*.jks`, `*.keystore`, `*.p12`, `*.pfx`)
- Mobile provisioning (`*.mobileprovision`)
- Firebase/Google config (`google-services.json`, `GoogleService-Info.plist`)

Use `--include-secret-files` to override this behavior (use with caution).

## CLI Options

```
usage: anything-to-text [-h] [--max-lines MAX_LINES] [--output-dir OUTPUT_DIR]
                        [--non-interactive] [--categories [CATEGORIES ...]]
                        [--paths [PATHS ...]] [--include-secret-files]
                        [--fancy-ui] [--project-overview] [--version]
                        [project_root]

positional arguments:
  project_root          Project root to scan (default: current directory)

options:
  -h, --help            Show help message
  --version             Show version
  --max-lines N         Max lines per bundle (default: 8000)
  --output-dir DIR      Custom output directory
  --non-interactive     Run without prompts
  --categories CATS     Categories to export (e.g., python typescript)
  --paths PATHS         Specific files/folders to export
  --include-secret-files Include secret-like files
  --fancy-ui            Use checkbox-style interactive UI
  --project-overview    Generate PROJECT_OVERVIEW.txt
```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

MIT License - see LICENSE file for details.
