codels-cli
v0.1.0
Published
Add Codels 3D models to your three.js project as code: npx codels-cli add pine-tree
Maintainers
Readme
codels-cli
Add Codels 3D models to a three.js project as code — no loaders, no asset pipeline.
Zero dependencies, Node 18+. Install it globally (npm i -g codels-cli) to type just codels ….
npx codels-cli search "medieval barrel"
npx codels-cli info pine-tree
npx codels-cli add pine-tree barrel --param snow=true # → src/models/pine-tree.js, src/models/barrel.js
npx codels-cli add sedan --format r3f --out src/components # React Three Fiber component
npx codels-cli add windmill --format glb # → public/models/windmill.glb (with its animations)
npx codels-cli pack platformer-kit # one module with the whole packimport { createPineTree } from './models/pine-tree.js';
scene.add(createPineTree());Every generated module only imports three. Units are meters, +Y is up, models face +Z and rest on y = 0.
Parametric models take --param key=value (see npx codels-cli info <slug>); animated ones carry their
THREE.AnimationClips in model.animations.
Formats
| --format | File |
|---|---|
| three (default) | ES module with create<Name>() |
| r3f | React Three Fiber component |
| instanced | create<Name>Instances(count, place) — hundreds of copies in a few draw calls |
| glb · gltf · obj · stl | 3D files (default folder public/models) |
Options
--out <dir>— where to write (defaultsrc/models, orpublic/modelsfor 3D files)--force— overwrite existing files--compress— with--format glb: Meshopt-compressed file, 2–3× smaller (GLTFLoader.setMeshoptDecoder(MeshoptDecoder))--url <origin>orCODELS_URL— another Codels server (defaulthttps://codels.download)--key <cdl_…>orCODELS_API_KEY— optional API key for 10× higher rate limits, created at codels.download/me/api-keys
Models are CC0 unless their page says otherwise. The CLI itself is MIT licensed.
