What Programming Languages Power the text-to-cad Repository?

The text-to-cad codebase is a polyglot architecture that leverages Python for CAD generation algorithms, JavaScript for the interactive web viewer, and Shell scripts for build automation, while using YAML and JSON for declarative configuration.

The earthtojake/text-to-cad repository converts textual descriptions into manufacturable CAD models through a multi-language stack. This polyglot approach allows the project to combine Python's computational strength for geometry processing with JavaScript's browser capabilities for visualization, orchestrated by Shell-based build pipelines.

Python: The Core CAD Generation Engine

Python serves as the backbone of the text-to-cad project, handling the heavy computational lifting required for procedural model generation. The cadgen package, defined in packages/cadgen/pyproject.toml, contains the core algorithms that transform text prompts into solid geometry.

CLI Tools and Model Scripts

The repository uses Python for both library distribution and standalone generation scripts. Individual model definitions demonstrate how the CAD engine constructs parts programmatically.


# models/w16/src/w16.py – a sample model script

from cadgen import cadgen

def build():
    # Create a simple piston assembly

    piston = cadgen.Part("piston.stl")
    cadgen.export(piston, "output/w16.step")

Execute the generation script from the command line:

python models/w16/src/w16.py

JavaScript: Interactive CAD Viewer and Runtime

JavaScript powers the front-end visualization layer, enabling browser-based preview of generated models. The runtime is packaged as cadgen-js, with its manifest located at packages/cadgen-js/package.json, providing ES modules that support both Node.js and browser environments.

ES Modules for WebGL Rendering

The viewer implementation initializes WebGL contexts to render STEP and STL files directly in the browser. The createViewer function in packages/cadgen-js/src/lib/viewer/webglSupport.js handles canvas setup and scene initialization.

// packages/cadgen-js/src/lib/viewer/webglSupport.js
import { initWebGL } from "./webglSupport";

/**
 * Initialise the CAD viewer with a given canvas element.
 */
export function createViewer(canvas) {
  const gl = initWebGL(canvas);
  // … set up scene, load geometry, etc.
}

Import the module in client applications:

import { createViewer } from "cadgen-js";
const canvas = document.getElementById("cad-canvas");
createViewer(canvas);

Shell Scripts: Build Automation and CI

Shell scripts orchestrate the development workflow, ensuring reproducible builds across platforms. The master test driver at scripts/test/test.sh coordinates execution of both Python unit tests and JavaScript test suites.


# scripts/test/test.sh – runs the full test matrix

./scripts/test/test.sh

This script serves as the entry point for continuous integration, validating the entire stack before releases.

Configuration Languages: YAML and JSON

Declarative configuration files separate metadata from implementation logic. YAML defines AI agent behaviors and skill manifests, such as skills/urdf/agents/openai.yaml, which configures the URDF generation pipeline. JSON handles package metadata in packages/cadgen-js/package.json and GitHub Actions workflows, providing structured data that both Python and JavaScript ecosystems can parse natively.

Summary

  • Python drives the computational engine, CLI tools, and model generation scripts through the cadgen package.
  • JavaScript enables browser-based CAD visualization using ES modules and WebGL rendering in packages/cadgen-js.
  • Shell scripts automate testing and builds via scripts/test/test.sh.
  • YAML and JSON manage skill configurations and package metadata, ensuring portable declarative settings.

Frequently Asked Questions

Is text-to-cad primarily a Python project?

While Python handles the core CAD generation algorithms and CLI tooling in packages/cadgen, the repository is genuinely polyglot. JavaScript is equally critical for the viewer runtime, and Shell scripts manage the build infrastructure, making it a balanced multi-language ecosystem rather than a Python-only tool.

What JavaScript module system does text-to-cad use?

The repository uses ES modules (ESM) throughout the JavaScript codebase. The packages/cadgen-js/package.json specifies ES module exports, and source files like packages/cadgen-js/src/lib/viewer/webglSupport.js use standard import syntax for browser and Node.js compatibility.

How does text-to-cad execute cross-language testing?

The Shell script at scripts/test/test.sh acts as the unified test orchestrator. It invokes Python's unit test framework alongside JavaScript's Jest tests, ensuring that changes to the CAD generation logic do not break the viewer integration, all within a single CI command.

Why does text-to-cad use YAML for skill configurations?

YAML provides human-readable, hierarchical configuration syntax ideal for complex skill definitions like skills/urdf/agents/openai.yaml. This format allows developers to specify AI agent parameters and plugin metadata without modifying source code, separating configuration concerns from implementation logic.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →