Skip to content

superdwayne/touchdesigner-cli

Repository files navigation

๐ŸŽ›๏ธ cli-touchdesigner

Make TouchDesigner Agent-Native

One CLI to create, manage, and render TouchDesigner projects โ€” built for AI agents, automation pipelines, and headless workflows.

Part of the CLI-Anything ecosystem

Python 3.9+ License: MIT Tests: 117 passing TouchDesigner


103+ Operators ยท 8 Network Templates ยท Interactive REPL ยท JSON Output ยท Script Export

Installation Guide ยท Agent Integration Guide


๐Ÿ“‹ Table of Contents


๐Ÿ’ก Why This Exists

Today's creative software serves humans. Tomorrow's users will be AI agents.

TouchDesigner is one of the most powerful real-time visual programming environments โ€” but it's locked behind a GUI. This CLI bridges the gap, letting agents like Claude Code, Cursor, Copilot, and any automation pipeline drive TouchDesigner programmatically.

No GUI required. Build operator networks, configure parameters, generate TD scripts โ€” all from the command line.


๐Ÿš€ Installation

Prerequisites

  • Python 3.9+
  • TouchDesigner (optional โ€” needed only for rendering; project management works standalone)

Step 1: Clone the repo

git clone https://github.com/superdwayne/touchdesigner-cli.git
cd touchdesigner-cli/agent-harness

Step 2: Create a virtual environment

python3 -m venv .venv
source .venv/bin/activate        # macOS / Linux
# .venv\Scripts\activate         # Windows

Step 3: Install the package

pip install -e ".[dev]"

Windows users: If you hit a UnicodeDecodeError, run $env:PYTHONUTF8="1" (PowerShell) or set PYTHONUTF8=1 (CMD) before the pip install command.

This installs the CLI as cli-anything-touchdesigner and the shorthand td-cli on your PATH (inside the venv).

Step 4: Verify it works

cli-anything-touchdesigner --version
# cli-anything-touchdesigner, version 1.0.0

cli-anything-touchdesigner --help
# Usage: cli-anything-touchdesigner [OPTIONS] COMMAND [ARGS]...

cli-anything-touchdesigner status
# Shows TouchDesigner backend detection status
โšก One-liner install (copy-paste)
git clone https://github.com/superdwayne/touchdesigner-cli.git && \
cd touchdesigner-cli/agent-harness && \
python3 -m venv .venv && \
source .venv/bin/activate && \
pip install -e ".[dev]" && \
cli-anything-touchdesigner --version

Detailed platform-specific instructions (macOS, Linux, Windows): docs/INSTALL.md


โšก Quick Start

Create a project and build a network

# 1. Create a new project
cli-anything-touchdesigner project new MyVisuals -o myvisuals.json

# 2. Add operators
cli-anything-touchdesigner --project myvisuals.json op add TOP noise noise1 --param amp=2.0
cli-anything-touchdesigner --project myvisuals.json op add TOP level level1
cli-anything-touchdesigner --project myvisuals.json op add TOP null out1

# 3. Connect them into a chain
cli-anything-touchdesigner --project myvisuals.json net connect /project1/noise1 /project1/level1
cli-anything-touchdesigner --project myvisuals.json net connect /project1/level1 /project1/out1

# 4. Export as a TouchDesigner Python script
cli-anything-touchdesigner --project myvisuals.json export script -o setup.py

Build entire networks with one command

# Audio-reactive visualization
cli-anything-touchdesigner --project myvisuals.json net template audio-reactive --audio-file music.wav

# Feedback loop
cli-anything-touchdesigner --project myvisuals.json net template feedback-loop

# 3D scene with sphere geometry
cli-anything-touchdesigner --project myvisuals.json net template 3d-scene --geometry sphere

# GPU particle system
cli-anything-touchdesigner --project myvisuals.json net template particle-system

# Custom GLSL shader chain
cli-anything-touchdesigner --project myvisuals.json net template glsl-shader

# List all available templates
cli-anything-touchdesigner net templates

Get smart operator suggestions

cli-anything-touchdesigner op suggest audio reactive visuals
# โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
# โ”‚  Family  Type               Reason                       โ”‚
# โ”‚  CHOP    audiofileinCHOP    Load audio file              โ”‚
# โ”‚  CHOP    audiospectrumCHOP  Analyze frequency spectrum   โ”‚
# โ”‚  CHOP    mathCHOP           Scale/offset audio values    โ”‚
# โ”‚  TOP     choptoTOP          Convert audio data to textureโ”‚
# โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿค– Agent Integration

This CLI is designed to be used by AI agents. Full guide: docs/AGENTS.md

Works with every major agent platform

Platform How It Works
Claude Code Discovers via which and --help. Add hints to CLAUDE.md.
Cursor Add to .cursorrules for automatic discovery.
Windsurf Add to .windsurfrules or global rules.
Copilot CLI Suggests commands from ?? queries.
LangChain Wrap as a @tool โ€” example in AGENTS.md.
CrewAI Wrap as a @tool โ€” example in AGENTS.md.
MCP Server Expose as MCP tools โ€” example in AGENTS.md.
Any language Shell out + parse JSON โ€” Node/Go/Rust examples.

Minimal agent prompt (copy-paste into your agent)

You have access to `cli-anything-touchdesigner`, a CLI for building TouchDesigner projects.

Key commands:
  cli-anything-touchdesigner --json project new <name> -o <file.json>
  cli-anything-touchdesigner --json --project <file> op add <FAMILY> <type> <name>
  cli-anything-touchdesigner --json --project <file> net template <template_name>
  cli-anything-touchdesigner --json --project <file> net connect <from> <to>
  cli-anything-touchdesigner --json --project <file> export script -o <output.py>
  cli-anything-touchdesigner op suggest <description>

Families: TOP, CHOP, SOP, DAT, COMP, MAT, POP
Templates: audio-reactive, feedback-loop, 3d-scene, particle-system,
           instancing, glsl-shader, osc-receiver, video-mixer

Always use --json for structured output.

Full integration guide with code examples for every platform: docs/AGENTS.md


๐ŸŽฎ REPL Mode

Run the CLI without a subcommand to enter interactive mode โ€” perfect for AI agent sessions:

$ cli-anything-touchdesigner

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘  cli-anything-touchdesigner v1.0.0              โ•‘
โ•‘  TouchDesigner CLI for AI Agents                 โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

td> project new LiveShow
โœ“ Created project: LiveShow

td[LiveShow]> net template audio-reactive --audio-file set.wav
โœ“ Built template 'audio-reactive' (9 operators)

td[LiveShow]*> op list
  Name          Family  Type               Path
  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€     โ”€โ”€โ”€โ”€โ”€โ”€  โ”€โ”€โ”€โ”€               โ”€โ”€โ”€โ”€
  audioIn1      CHOP    audiofileinCHOP    /project1/audioIn1
  spectrum1     CHOP    audiospectrumCHOP  /project1/spectrum1
  math1         CHOP    mathCHOP           /project1/math1
  null_chop1    CHOP    nullCHOP           /project1/null_chop1
  chopTo1       TOP     choptoTOP          /project1/chopTo1
  noise1        TOP     noiseTOP           /project1/noise1
  comp1         TOP     compositeTOP       /project1/comp1
  level1        TOP     levelTOP           /project1/level1
  out1          TOP     nullTOP            /project1/out1

td[LiveShow]*> op set /project1/noise1 amp 3.0
โœ“ Set amp=3.0 on /project1/noise1

td[LiveShow]*> export script -o live_setup.py
โœ“ Exported TD script: live_setup.py

td[LiveShow]*> exit
Goodbye! ๐Ÿ‘‹

The * after the project name means there are unsaved changes. REPL supports full command history (up/down arrows) and undo/redo.


๐ŸŽจ Operator Families

All 7 TouchDesigner operator families are supported with 103+ operator types:

Family Color Purpose Types
๐ŸŸฃ TOP Purple Texture/image processing on GPU 21
๐ŸŸข CHOP Green Channel data โ€” audio, animation, control signals 22
๐Ÿ”ต SOP Blue 3D surface & geometry operations 16
๐Ÿ”ท DAT Teal Text, tables, scripts, networking 16
โšช COMP Gray Components โ€” containers, 3D objects, UI 14
๐ŸŸก MAT Yellow Materials & shaders for 3D rendering 8
๐Ÿฉท POP Pink GPU-accelerated particles & point data 6
# List all families and counts
cli-anything-touchdesigner op types

# List all operator types in a family
cli-anything-touchdesigner op types TOP
cli-anything-touchdesigner op types CHOP
cli-anything-touchdesigner op types POP

๐Ÿงฉ Network Templates

Pre-built operator networks for common TouchDesigner workflows:

Template Description Operators
audio-reactive Audio File In โ†’ Spectrum โ†’ Math โ†’ CHOP to TOP โ†’ Composite 9
feedback-loop Noise โ†’ Composite โ† Feedback โ† Transform โ† Level (loop) 6
3d-scene Geometry + Camera + Light โ†’ Render TOP โ†’ Null 6
particle-system POP Generate โ†’ Force โ†’ Noise โ†’ Attrib โ†’ Render 5
instancing Noise CHOPs (tx/ty/tz) โ†’ Merge โ†’ Geometry COMP 6
glsl-shader Noise โ†’ GLSL TOP โ†’ Level โ†’ Null + shader DAT 5
osc-receiver OSC In โ†’ Select โ†’ Filter โ†’ Null 4
video-mixer Movie File In ร—N โ†’ Switch โ†’ Composite โ†’ Null 5+
# Build any template
cli-anything-touchdesigner --project my.json net template feedback-loop

# Customize with options
cli-anything-touchdesigner --project my.json net template 3d-scene --geometry torus
cli-anything-touchdesigner --project my.json net template instancing --count 500
cli-anything-touchdesigner --project my.json net template video-mixer --input-count 4
cli-anything-touchdesigner --project my.json net template osc-receiver --port 9000

๐Ÿค– JSON Mode for Agents

Every command supports --json for structured machine-readable output โ€” ideal for AI agents:

# Create a project
cli-anything-touchdesigner --json project new AgentProject
{
  "status": "success",
  "message": "Created project: AgentProject",
  "data": {
    "name": "AgentProject",
    "type": "standard",
    "operators": 0,
    "connections": 0,
    "families": {},
    "resolution": [1920, 1080],
    "fps": 60,
    "modified": false
  }
}
# List operators
cli-anything-touchdesigner --json --project myvisuals.json op list
[
  {"name": "noise1", "family": "TOP", "type": "noiseTOP", "path": "/project1/noise1"},
  {"name": "null1", "family": "TOP", "type": "nullTOP", "path": "/project1/null1"}
]
# Get operator suggestions
cli-anything-touchdesigner --json op suggest particle effects
[
  {"family": "POP", "type": "popGeneratePOP", "reason": "Generate particles"},
  {"family": "POP", "type": "popForcePOP", "reason": "Apply forces to particles"},
  {"family": "POP", "type": "popRenderPOP", "reason": "Render particles"}
]

๐Ÿงช Running Tests

The project includes 117 comprehensive tests covering all modules:

Quick run

cd agent-harness
source .venv/bin/activate
pytest -v

Expected output

tests/test_cli.py       ...  28 passed
tests/test_operators.py ...  29 passed
tests/test_network.py   ...  22 passed
tests/test_project.py   ...  38 passed

========================= 117 passed =========================

With coverage

pytest --cov=cli_anything_touchdesigner --cov-report=term-missing -v

Run specific tests

pytest tests/test_project.py -v     # Project management tests
pytest tests/test_operators.py -v   # Operator registry tests
pytest tests/test_network.py -v     # Network builder tests
pytest tests/test_cli.py -v         # CLI integration tests

Test breakdown

Test File Tests What It Covers
test_project.py 38 Project CRUD, undo/redo, save/load, connections, flags
test_operators.py 29 Operator registry, type lookup, defaults, suggestions
test_network.py 22 Templates, chain building, custom parents, all 8 templates
test_cli.py 28 CLI commands, JSON output, export, status, end-to-end

๐Ÿ—๏ธ Architecture

touchdesigner-cli/
โ””โ”€โ”€ agent-harness/
    โ”œโ”€โ”€ cli_anything_touchdesigner/
    โ”‚   โ”œโ”€โ”€ __init__.py        # Package metadata & version
    โ”‚   โ”œโ”€โ”€ cli.py             # Click CLI โ€” all subcommands + entry point
    โ”‚   โ”œโ”€โ”€ project.py         # Project/session state with undo/redo
    โ”‚   โ”œโ”€โ”€ operators.py       # 103+ operator types across 7 families
    โ”‚   โ”œโ”€โ”€ network.py         # Network builder + 8 pre-built templates
    โ”‚   โ”œโ”€โ”€ backend.py         # TouchDesigner process discovery & execution
    โ”‚   โ”œโ”€โ”€ formatter.py       # Human-readable tables + JSON output
    โ”‚   โ””โ”€โ”€ repl_skin.py       # Interactive REPL with history & prompts
    โ”‚
    โ”œโ”€โ”€ tests/
    โ”‚   โ”œโ”€โ”€ test_project.py    # 38 tests โ€” project management
    โ”‚   โ”œโ”€โ”€ test_operators.py  # 29 tests โ€” operator registry
    โ”‚   โ”œโ”€โ”€ test_network.py    # 22 tests โ€” network templates
    โ”‚   โ””โ”€โ”€ test_cli.py        # 28 tests โ€” CLI integration
    โ”‚
    โ”œโ”€โ”€ docs/
    โ”‚   โ”œโ”€โ”€ INSTALL.md         # Detailed installation guide
    โ”‚   โ””โ”€โ”€ AGENTS.md          # Agent integration guide
    โ”‚
    โ”œโ”€โ”€ setup.py               # Legacy setup config
    โ”œโ”€โ”€ pyproject.toml         # Modern Python packaging
    โ””โ”€โ”€ README.md              # Package README

Design Principles

Principle Description
Authentic Integration Generates valid TD Python scripts. Delegates to real TouchDesigner for rendering. Builds interfaces to software, not replacements.
Dual Interaction Stateful REPL for interactive agent sessions + subcommand interface for scripting and pipelines.
Agent-Native --json on every command. Self-describing via --help. Discoverable via which.
Zero Compromise Real TD required for rendering. No toy implementations. Tests fail (not skip) when backends are missing.

๐Ÿ”Œ TouchDesigner Backend

The CLI auto-discovers TouchDesigner on your system:

Platform Search Paths
macOS /Applications/Derivative/TouchDesigner.app/
Windows C:\Program Files\Derivative\TouchDesigner\
Linux /opt/Derivative/TouchDesigner/

You can also set environment variables:

export TOUCHDESIGNER_PATH="/path/to/TouchDesigner"
export TOUCHDESIGNER_BATCH_PATH="/path/to/TouchDesignerBatch"

TouchDesigner is optional. Project management, operator configuration, network building, and script generation all work without TD installed. You only need TD for rendering.


๐Ÿ—บ๏ธ Command Reference

cli-anything-touchdesigner
โ”œโ”€โ”€ project
โ”‚   โ”œโ”€โ”€ new <name>                Create a new project
โ”‚   โ”œโ”€โ”€ open <path>               Open an existing project
โ”‚   โ”œโ”€โ”€ save [-o path]            Save current project
โ”‚   โ””โ”€โ”€ info                      Show project info
โ”‚
โ”œโ”€โ”€ op
โ”‚   โ”œโ”€โ”€ add <family> <type> <name>   Add an operator
โ”‚   โ”œโ”€โ”€ remove <path>                Remove an operator
โ”‚   โ”œโ”€โ”€ list [--family FAM]          List operators
โ”‚   โ”œโ”€โ”€ info <path>                  Show operator details
โ”‚   โ”œโ”€โ”€ set <path> <param> <val>     Set parameter
โ”‚   โ”œโ”€โ”€ get <path> <param>           Get parameter
โ”‚   โ”œโ”€โ”€ flag <path> <flag> <bool>    Set operator flag
โ”‚   โ”œโ”€โ”€ types [family]               List available types
โ”‚   โ””โ”€โ”€ suggest <description...>     Get smart suggestions
โ”‚
โ”œโ”€โ”€ net
โ”‚   โ”œโ”€โ”€ connect <from> <to>          Connect operators
โ”‚   โ”œโ”€โ”€ disconnect <from> <to>       Disconnect operators
โ”‚   โ”œโ”€โ”€ list [op_path]               List connections
โ”‚   โ”œโ”€โ”€ template <name> [options]    Build from template
โ”‚   โ””โ”€โ”€ templates                    List all templates
โ”‚
โ”œโ”€โ”€ export
โ”‚   โ”œโ”€โ”€ script [-o path]             Export TD Python script
โ”‚   โ””โ”€โ”€ json [-o path]               Export project as JSON
โ”‚
โ”œโ”€โ”€ render <output> [options]         Render via TouchDesigner
โ””โ”€โ”€ status                            Show backend status

๐Ÿ“„ License

MIT โ€” use it however you want.


Built with the CLI-Anything methodology

Making TouchDesigner agent-native, one command at a time.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors