Skip to main content

🐖 PIG-T3 – AI Context Generator & Patcher

PIG-T3 is a powerful desktop application (GUI) that helps you work with large codebases together with AI assistants (ChatGPT, Claude, DeepSeek, local Ollama models).

It generates a context report containing the full project structure and source code, ready to be sent to any LLM. It then allows you to apply the AI's JSON-based code changes automatically – including creating, editing, moving and deleting files – with full undo/redo support.

Additionally, PIG-T3 includes:

  • 📝 AI Plan Manager – generate step-by-step implementation plans and execute them automatically.
  • 🔍 Code Quality Scanner – analyse your Python code (complexity, maintainability, lint score, security).
  • 🧠 Context Optimizer – select only the most relevant files for a given task using dependency graphs and AI ranking.
  • 🎨 Multiple themes (dark, light, pink, eye-care) and Git integration.

✨ Features

🏠 Context Generator

  • Scan a project folder, ignore binary/unwanted files, collect source code.
  • Produce a single .txt or .md file with XML-like tags for each file.
  • Optionally include line numbers and an AI instruction prompt for JSON patching.
  • Copy the output file directly to the clipboard.

✏️ JSON Patcher (Editor)

  • Paste the LLM's response (JSON array of actions).
  • Validate and pretty-print the JSON.
  • Apply changes to the disk: create, delete, move, edit (replace_lines, insert_after_line, replace_text).
  • Built-in Ollama Auto-Fix – if the LLM returns malformed JSON, let a local model repair it.
  • Full Undo/Redo history (files are backed up inside .pig/backups).

📝 AI Plan Manager

  • Describe your project goal in natural language – PIG-T3 will generate a detailed step-by-step plan.
  • Each step can be executed automatically:
    • The app prepares an optimized context.
    • An LLM (local or web) generates the necessary code changes in JSON format.
    • Changes are applied immediately (or sent to the Editor for manual review).
  • Supports retries on errors, plan validation, and Git auto-commit before each step.

📊 Code Quality Analysis

  • Scans all Python files in the project.
  • Calculates:
    • Cyclomatic Complexity (Radon CC)
    • Maintainability Index (Radon MI)
    • Pylint Score (custom penalty-based score)
    • Security Issues (Bandit)
  • Displays results in a sortable tree with color-coded statuses.

🧠 Context Optimizer

  • Given a task description, selects the most important files for the AI to understand.
  • Uses a dependency graph (imports) with BFS and an LLM-based relevance ranking.
  • Helps keep the context size within token limits while retaining crucial information.

🤖 Supported AI Backends

  • Ollama – any local model (e.g., qwen2.5-coder).
  • Web APIs – DeepSeek (Chat), Gemini (AI Studio) via browser automation.
  • BomjAPI – a manual testing tool (opens a window where you paste responses by hand).

📦 Installation

PIG-T3 requires Python 3.8+. Install directly from PyPI:

pip install pig-t3

If you plan to use the Web API backends (DeepSeek, Gemini), you also need to install a Chromium browser for Playwright:

playwright install chromium

Dependencies

These are installed automatically: requests, radon, pylint, vulture, bandit, Pillow, majorchik-api (Playwright-based web automation), networkx.


🚀 Quick Start

  1. Launch the application:
    pig-t3
    
  2. Select your project folder (or let it auto-detect).
  3. In the Generator tab, optionally adjust extensions and ignore list, then click Generate Context.
  4. Copy the generated file and send it to your favourite AI assistant.
  5. Paste the AI's JSON response into the Editor tab, click Apply Changes.

🧩 How It Works

Workflow

  1. Scan → Collect all source files into a single report.
  2. Send → The report is given to an LLM along with the editing instructions (optionally).
  3. Receive JSON → The LLM returns a JSON array of file operations.
  4. Apply → PIG-T3 parses the JSON, backs up affected files, and performs the changes.

JSON Actions Reference

A typical LLM response looks like this:

[
  {
    "action": "create",
    "path": "utils/helper.py",
    "content": "def help():\n    return True"
  },
  {
    "action": "edit",
    "path": "main.py",
    "operations": [
      {
        "type": "replace_lines",
        "start": 10,
        "end": 12,
        "content": "    new_code()"
      },
      {
        "type": "insert_after_line",
        "line": 15,
        "content": "    logger.info('Done')"
      }
    ]
  }
]

Full specification is available in the Info / JSON Specs tab inside the app.


⚙️ Configuration

All settings are saved in app_config.json (global) and in .pig/state.json (per project). You can tweak:

  • Theme, font size, tree row height.
  • Context optimizer parameters (BFS depth, LLM weighting).
  • Git integration (auto-commit, auto-push, branch mode).
  • LLM timeouts and retry settings.

🐙 Git Integration

When enabled in settings, PIG-T3 can:

  • Automatically create a new Git branch before executing a plan step.
  • Commit all changes with a descriptive message.
  • Push to remote after each successful step.

🧪 Development & Building

To build a standalone executable (Windows):

pyinstaller --noconsole --onefile --icon=PIG_T3/icon.png --add-data "PIG_T3/logo.png;." --add-data "PIG_T3/icon.png;." --name PIG PIG_T3/main.py

📄 License

PIG-T3 is released under the MIT License. See the LICENSE file for details.


🙏 Acknowledgements

This project uses several open-source libraries and tools: Radon, Pylint, Vulture, Bandit, NetworkX, Playwright, and others. Special thanks to the Ollama project for local AI capabilities.


Made with ❤️ by Loki (gosoftware2025@gmail.com)

Metadata

Release files for pig-t3 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pig-t3 1.1.3
File Size Uploaded Provenance Actions
pig_t3-1.1.3.tar.gz 2.4 MB Without provenance Details for pig_t3-1.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pig-t3 1.1.3
File Interpreter ABI Platform Actions
pig_t3-1.1.3-py3-none-any.whl Python 3 none any Details for pig_t3-1.1.3-py3-none-any.whl

Total release size: 4.8 MB

Release files / pig_t3-1.1.3.tar.gz

Download URL pig_t3-1.1.3.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
dd8573d9358739cc45cab8dd5e541df18228fa5f2e53209f1ad6ab2cfedc094c
BLAKE2b-256 checksum
How to use checksums
248a64aaad404a629f8ac764241a7701cb92a2061c3b3eb07323c2ed47bbb7a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.6

Release files / pig_t3-1.1.3-py3-none-any.whl

Download URL pig_t3-1.1.3-py3-none-any.whl
Size 2.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
f046ee37f62d915f01940eef9739b660f131067719914188ae4ab09c1799ae96
BLAKE2b-256 checksum
How to use checksums
e1d7b18915fb7452c11e99990a71e538f6969888c9ba22a9dbaaeaff41e863d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.6

Security for pig-t3 1.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page