Metadata-Version: 2.4
Name: sanchousf-ai-toolkit
Version: 0.7.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 both autonomous AI agents and human developers.

---

## 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](cad/README.md)** (`cad/`) | `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](cad/README.md) • [Interactive Viewer](cad/README.md#3-launching-the-interactive-3d-viewer) • [AI Bridge](cad/README.md#5-ai-agent-collabbridge-cad-bridge) |
| **[Video Toolkit](video/README.md)** (`video/`) | `sanchousf-ai-toolkit-video` | Fast, lossless (**zero-reencode**) video container and audio/subtitle track manipulation CLI & Python API powered by MKVToolNix and FFmpeg. | [Documentation](video/README.md) • [Track Commands](video/README.md#quick-start) • [Backend Setup](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](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), mouse bone selection & live gizmo posing with nearby-bone distance culling, global Undo/Redo (`Ctrl+Z` / `Ctrl+Y`), live cross-section slicing planes, 3D scratchpad annotations with individual stroke eraser (`Ctrl+Right Drag`), measurement calipers, and unified multi-format load/save.
- **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-check`, X-ray `screenshot`, `drawings --json` (with full `points`/`start_point`/`end_point`), 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()`.
- **Skeletal Rigging, Geodesic Skinning & Verification**: Hierarchical `Bone` rigs (`Bone.from_points`, `add_child_bone_world`, `set_pose_offset`, `reset_pose`), Dual Quaternion Skinning (DQS) & Linear Blend Skinning (LBS), vectorized Euclidean & mesh-surface **geodesic** `compute_bone_weights` (with `_L`/`_R` side isolation and region masks), rigid accessory attachment, `verify_rig` placement diagnostics, X-ray bone & multi-view contact sheet rendering (`cad save -i --xray-bones --views`), 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`).

See **[cad/README.md](cad/README.md)** for full documentation, CLI flags, and setup guides.

### Video Toolkit (`video/`)

The **[Video Toolkit](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](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`](.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.
