Metadata-Version: 2.4
Name: sanchousf-ai-toolkit
Version: 0.8.0
Summary: AI-Toolkit: Manager CLI and meta-package for modular CAD, video, and engineering tools
Home-page: https://github.com/sanchousf/ai-toolkit
Author: sanchousf
Author-email: sanchousf@gmail.com
License: MIT
Project-URL: Homepage, https://github.com/sanchousf/ai-toolkit
Project-URL: Repository, https://github.com/sanchousf/ai-toolkit
Project-URL: Issues, https://github.com/sanchousf/ai-toolkit/issues
Project-URL: Documentation, https://github.com/sanchousf/ai-toolkit#readme
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: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: cad
Requires-Dist: sanchousf-ai-toolkit-cad; extra == "cad"
Provides-Extra: cad-all
Requires-Dist: sanchousf-ai-toolkit-cad[all]; extra == "cad-all"
Provides-Extra: video
Requires-Dist: sanchousf-ai-toolkit-video; extra == "video"
Provides-Extra: all
Requires-Dist: sanchousf-ai-toolkit-cad; extra == "all"
Requires-Dist: sanchousf-ai-toolkit-video; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-python
Dynamic: summary

# AI Toolkit

A modular repository of specialized engineering and media tools, automation workflows, and AI agent skills designed for **human–AI collaboration** first, and autonomous automation where it shines.

![3D CAD & Scene Viewer — Exploded Electronics Enclosure Assembly](https://raw.githubusercontent.com/sanchousf/ai-toolkit/v0.8.0/docs/images/cad_viewer_assembly.png)

---

## Philosophy: Building *Together* With AI

The core idea behind **AI Toolkit** is that a person and an AI agent should be able to **work side-by-side on the same live artifact** — not treat AI as a black-box one-shot generator. Achieving full automation on a task is always a win, but real engineering and creative work is iterative: you want to inspect, sketch, tweak by hand, and hand control back and forth effortlessly.

That is why every tool in this repository pairs **first-class manual & visual interfaces** with **machine-readable agent interfaces** over the exact same state:

- **Shared Live Workspace**: An artist or engineer can open the interactive 3D viewer, draw directly on a model with the **3D Scratchpad**, expose **custom per-scene UI controls** (sliders, toggles, pose controls), or drag **Auto-Rig Guide Pins** and bones by hand — while an AI agent reads those exact strokes, parameters, and pins over **CollabBridge (`cad-bridge`)** and continues the work in real time.
- **Editable Pipelines, Not Black Boxes**: Automated steps (such as auto-rigging, cavity solidification, or mesh slicing) produce transparent, editable intermediate states (e.g., draggable 3D Guide Pins, parametric scene scripts, and in-memory previews) so either the human or the agent can refine any detail before committing to disk.
- **In-Memory First, Save When Ready**: Agents prototype, verify, and hot-reload changes in memory without touching your files until you review the result and ask to save.

---

## Toolkits & Modules

| Module | PyPI Package | Description | Quick Links |
|---|---|---|---|
| **AI-Toolkit Manager** (`ai_toolkit/`) | `sanchousf-ai-toolkit` | Unified CLI (`ai-toolkit`) to install, update, inspect, uninstall subprojects, and install bundled AI agent skills. | [Installation](#installation--quick-start) • [CLI Manager](#ai-toolkit-cli-manager) |
| **[3D CAD Toolkit](https://github.com/sanchousf/ai-toolkit/blob/v0.8.0/cad/README.md)** (`cad/`) | [`sanchousf-ai-toolkit-cad`](https://pypi.org/project/sanchousf-ai-toolkit-cad/) | Hardware-accelerated 3D CAD viewer, procedural & parametric modeling, Manifold3D CSG booleans, SDF meshing, cavity solidification, skeletal rigging & FBX I/O, 3D printability analysis, and AI Agent CollabBridge. | [Documentation](https://github.com/sanchousf/ai-toolkit/blob/v0.8.0/cad/README.md) • [Interactive Viewer](https://github.com/sanchousf/ai-toolkit/blob/v0.8.0/cad/README.md#3-launching-the-interactive-3d-viewer) • [AI Bridge](https://github.com/sanchousf/ai-toolkit/blob/v0.8.0/cad/README.md#5-ai-agent-collabbridge-cad-bridge) |
| **[Video Toolkit](https://github.com/sanchousf/ai-toolkit/blob/v0.8.0/video/README.md)** (`video/`) | [`sanchousf-ai-toolkit-video`](https://pypi.org/project/sanchousf-ai-toolkit-video/) | Fast, lossless (**zero-reencode**) video container and audio/subtitle track manipulation CLI & Python API powered by MKVToolNix and FFmpeg. | [Documentation](https://github.com/sanchousf/ai-toolkit/blob/v0.8.0/video/README.md) • [Track Commands](https://github.com/sanchousf/ai-toolkit/blob/v0.8.0/video/README.md#quick-start) • [Backend Setup](https://github.com/sanchousf/ai-toolkit/blob/v0.8.0/video/README.md#installation--backend-setup) |

---

## Installation & Quick Start

Install the lightweight `ai-toolkit` manager CLI (or include toolkits directly via extras):

```bash
# Install only the manager CLI
pip install sanchousf-ai-toolkit

# Or install along with specific toolkits
pip install "sanchousf-ai-toolkit[cad]"
pip install "sanchousf-ai-toolkit[cad-all]"   # includes optional remesh (pyvista) & blender (bpy)
pip install "sanchousf-ai-toolkit[video]"
pip install "sanchousf-ai-toolkit[all]"       # installs both CAD and Video toolkits
```

### AI-Toolkit CLI Manager

Once installed, use the `ai-toolkit` command to manage subprojects and bundled AI agent skills:

```bash
# List available and installed subprojects (supports --installed and --json)
ai-toolkit list

# Install subprojects (supports extras such as cad[remesh], cad[all], or 'all')
ai-toolkit install cad video
ai-toolkit install all

# Update all installed subprojects (pass --self to also update sanchousf-ai-toolkit)
ai-toolkit update --self

# Install bundled AI agent skills for all installed subprojects
ai-toolkit install-skills                              # workspace scope, antigravity (default)
ai-toolkit install-skills --scope global --agent claude

# Preview any action without modifying packages or files
ai-toolkit install cad --dry-run

# Uninstall subprojects
ai-toolkit uninstall video -y
```

---

## Highlights

### 3D CAD Toolkit (`cad/`)

The **[CAD Toolkit](https://github.com/sanchousf/ai-toolkit/blob/v0.8.0/cad/README.md)** provides an end-to-end 3D modeling, validation, and visualization suite built for autonomous AI agents and interactive engineering workflows:

- **Interactive 3D Viewport**: Cross-platform Dear PyGui UI with hardware-accelerated OpenGL offscreen rendering (plus CPU fallback), adaptive camera navigation with pickable 3D orbit pivot (`P` / `Alt+Click` / Middle-Click), configurable selection highlight modes (`AABB Box`, `Silhouette`, `Corner Brackets`, `Origin Halo`, `None`), layered Workspace/Global editor settings (`cad config`), mouse bone & Guide Pin dragging with `Shift+Click` surface-midpoint placement, global Undo/Redo (`Ctrl+Z` / `Ctrl+Y`), live cross-section slicing planes, 3D scratchpad annotations with stroke eraser, and measurement calipers.
- **In-Memory Authoring & AI Agent CollabBridge**: Zero-disk-footprint `--code` workflows and an HTTP JSON API + modular `cad-bridge` CLI (port `8765`) supporting `--then` command chaining, `push-code`, `new-scene`, `push-project`, live cross-section slicing, cavity solidification, `slice-center`, `scan-sections`, `rig-guides`, `auto-rig`, `rig-check`, X-ray `screenshot`, `drawings --json`, topology diagnostics, and export.
- **Procedural & Parametric Modeling**: Rich 3D primitives, 2D `Sketch2D` extrusions/revolves/sweeps/lofts, exact Manifold3D CSG booleans, assemblies with exploded views, geometry memoization, and universal `FileModel` loading (3MF, STL, OBJ, PLY, GLB, GLTF, FBX with per-material face groups & `split_by_material=True`, BLEND, and Python scenes) plus `mesh.split_islands()`.
- **Collaborative Auto-Rigging, Skinning & IK**: Guide-Pin Auto-Rig Pipeline (`cad.core.rigging`: auto-detects or seeds body, 5-finger, jaw/mouth, and eye pins from existing skeletons, with interactive `Aim Pin` volume-midpoint placement and L↔R branch mirroring), Dual Quaternion (DQS) & Linear Blend Skinning (LBS) with **Geodesic Voxel Binding** (`voxel`), **Bone Heat Diffusion** (`heat`), `geodesic`, and `distance` weights, 2-bone analytical & FABRIK IK, `Rig Edit Mode`, `verify_rig` diagnostics, X-ray multi-view contact sheets, and pure-Python Binary/ASCII FBX round-trip I/O.
- **Signed Distance Fields (SDF) & Cavity Solidification**: Exact `TriangleMeshSDF` evaluation, smooth polynomial CSG blending, Marching Cubes & Dual Contouring meshing, hollow cavity detection (`manifold`, `linear_slice`, `step_slice`), and declarative `SolidifyOp` / `CavitiesOp` / `PlugOp` operators.
- **3D Printability Analysis**: Watertight/manifold checks, overhang & support volume estimation, 30+ printer build-volume presets (Creality K/Ender/CR, Bambu Lab, Prusa, Voron, Elegoo, Anycubic, Qidi, Sovol, Flashforge, RatRig), and `--auto-orient` optimization.
- **Bundled AI Agent Skills**: Ships 6 installable agent skills (`cad-tool`, `cad-rigging`, `cad-macro-automator`, `cad-mesh-surgery`, `cad-slicer-sandbox`, `cad-visual-inspector`) and PEP 561 type stubs (`.pyi`).

| Skeletal Rigging, Bone Gizmos & Weight Heatmap | Live Cross-Section Slicing & Capped Cuts |
| :---: | :---: |
| ![Skeletal Rigging & Skinning](https://raw.githubusercontent.com/sanchousf/ai-toolkit/v0.8.0/docs/images/cad_viewer_rigging.png) | ![Live Cross-Section Slicing](https://raw.githubusercontent.com/sanchousf/ai-toolkit/v0.8.0/docs/images/cad_viewer_slicing.png) |

See **[cad/README.md](https://github.com/sanchousf/ai-toolkit/blob/v0.8.0/cad/README.md)** for full documentation, CLI flags, and setup guides.

### Video Toolkit (`video/`)

The **[Video Toolkit](https://github.com/sanchousf/ai-toolkit/blob/v0.8.0/video/README.md)** provides fast, lossless (**zero-reencode**) container and track editing for individual files or batch media libraries:

- **Zero Re-Encoding**: Copies video, audio, and subtitle bitstreams directly at disk I/O speed via **MKVToolNix** (`mkvmerge`, `mkvextract`, `mkvpropedit`) for Matroska containers and **FFmpeg** (`-c copy`, `ffprobe`, with `static-ffmpeg` bundled fallback) for universal containers (`.mp4`, `.mov`, `.ts`, etc.).
- **Complete Track Workflow**: `video tracks` supports `info` (`--json`), `add`, `extract`, `remove`, instant in-place MKV header edits via `set-flags` (including multi-track `--spec`), and short audio clipping via `sample`.
- **Smart Batch & Sidecar Automation**: Parallel worker execution (`-j/--jobs`), terminal progress bar, `--dry-run` previews, atomic `--in-place` replacement, and `--auto-sidecars` with `--sidecar-dir`, `--sidecar-recursive`, `--sidecar-rule` glob/extension templates, and automatic script-based subtitle language detection.
- **Bundled Agent Skill & Setup Helper**: Includes `video setup` to verify or install MKVToolNix and `video --install-skills` for the bundled `video-tool` skill.

See **[video/README.md](https://github.com/sanchousf/ai-toolkit/blob/v0.8.0/video/README.md)** for full CLI and Python API usage.

---

## Repository Structure

```text
ai-toolkit/
├── .github/
│   └── workflows/
│       ├── ai-toolkit.yml    # CI for root manager CLI & meta-package
│       ├── cad.yml           # CI for 3D CAD Toolkit
│       ├── video.yml         # CI for Video Toolkit
│       └── release.yml       # Build & PyPI Trusted Publishing for all packages
├── ai_toolkit/               # Root `ai-toolkit` manager CLI & subproject registry
│   ├── cli.py                # CLI entry point (`list`, `install`, `update`, `uninstall`, `install-skills`)
│   └── registry.py           # Subproject metadata & package resolution
├── cad/                      # 3D Computer-Aided Design & Procedural Modeling Toolkit
│   ├── README.md             # In-depth CAD documentation & CLI reference
│   ├── pyproject.toml        # `sanchousf-ai-toolkit-cad` package definition
│   ├── view.py               # Interactive 3D CAD viewer (`cad`, `cad-view`)
│   ├── save.py               # Headless scene exporter & snapshot generator (`cad-save`)
│   ├── check.py              # Headless scene validator & printability analyzer (`cad-check`)
│   ├── remesh.py             # Standalone mesh decimation & remeshing tool
│   ├── core/                 # Modeling, rendering, SDF, rigging, I/O, analysis & CollabBridge
│   ├── scene/                # BaseScene, geometry caching, in-memory loader & mock UI
│   ├── scenes/               # Demo scenes (assembly, parametric, polyline, skinning, SDF)
│   ├── skills/               # Bundled CAD AI agent skills & installer
│   ├── scripts/              # Cross-platform environment & OpenGL probe helpers
│   ├── ci/                   # CAD CI composite action
│   └── tests/                # Unit & integration test suite (>=90% coverage enforced)
├── video/                    # Lossless Video Container & Track Manipulation Toolkit
│   ├── README.md             # Video toolkit documentation & CLI reference
│   ├── pyproject.toml        # `sanchousf-ai-toolkit-video` package definition
│   ├── cli.py                # Unified `video` CLI entrypoint (`tracks`, `setup`, `install-skills`)
│   ├── tracks.py             # `video-tracks` CLI entrypoint
│   ├── core/                 # MKVToolNix/FFmpeg backends, discovery, models & operations
│   ├── skills/               # Bundled `video-tool` AI agent skill & installer
│   ├── ci/                   # Video CI composite action
│   └── tests/                # Unit & CLI tests with coverage
├── tests/                    # Unit tests for root `ai-toolkit` manager CLI
├── setup.py                  # Root `sanchousf-ai-toolkit` package configuration
├── pyproject.toml            # Build backend specification
└── LICENSE                   # MIT License
```

---

## Contributing & Development

1. Clone the repository:
   ```bash
   git clone https://github.com/sanchousf/ai-toolkit.git
   cd ai-toolkit
   ```
2. Install and test any package locally:
   - **Root CLI (`ai-toolkit`)**:
     ```bash
     pip install -e ".[dev]"
     pytest tests/ -v
     ```
   - **3D CAD Toolkit (`cad/`)**:
     - Linux / macOS / Termux: `cd cad && ./setup_dev.sh && ./run_tests.sh`
     - Windows: `cd cad && setup_dev.bat && run_tests.bat`
   - **Video Toolkit (`video/`)**:
     ```bash
     cd video
     pip install -e ".[dev]"
     pytest -v --cov=core
     ```

### Continuous Integration & Releases

- Path-scoped GitHub Actions workflows validate `ai_toolkit/`, `cad/`, and `video/` independently on pushes and pull requests to `main`, `dev/**`, and `release/**`.
- Pull requests targeting `main` run on both Ubuntu and Windows; manual `workflow_dispatch` supports a `run_full` toggle to test across Linux, Windows, and macOS.
- Publishing a GitHub Release triggers [`.github/workflows/release.yml`](https://github.com/sanchousf/ai-toolkit/blob/v0.8.0/.github/workflows/release.yml), which builds, verifies (`twine check`), attaches artifacts, and publishes `sanchousf-ai-toolkit-cad`, `sanchousf-ai-toolkit-video`, and `sanchousf-ai-toolkit` to PyPI.
