retiam 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +213 -209
- package/bin/export.js +322 -322
- package/bin/init.js +425 -425
- package/bin/lint.js +354 -354
- package/bin/render-config.js +86 -0
- package/bin/render.js +517 -600
- package/bin/snapshot.js +231 -231
- package/dist/{UTIF-pBEih-vH.js → UTIF-X7q9996p.js} +1 -1
- package/dist/assets/roboto-msdf.json +3642 -3642
- package/dist/{index-CnM0BhUR.js → index-Be4c9A99.js} +9988 -9941
- package/dist/{main-Bw2LTrnR.js → main-IC5HXR90.js} +1 -1
- package/dist/retiam.es.js +739 -734
- package/dist/src/engine/_core/Material.d.ts +13 -18
- package/dist/src/engine/_core/Scene.d.ts +3 -0
- package/dist/src/engine/_core/SnapshotManager.d.ts +3 -0
- package/dist/src/engine/components/fragment/ModelFragment.d.ts +1 -6
- package/dist/src/engine/material/shading/CelShading.d.ts +16 -0
- package/dist/src/engine/material/shading/ClayShading.d.ts +6 -0
- package/dist/src/engine/material/shading/GoochShading.d.ts +14 -0
- package/dist/src/engine/material/shading/PBRShading.d.ts +6 -0
- package/dist/src/engine/material/shading/Shading.d.ts +17 -0
- package/dist/src/engine/material/shading/index.d.ts +5 -0
- package/dist/src/engine/render/RenderConfig.d.ts +1 -23
- package/dist/src/index.d.ts +1 -0
- package/package.json +107 -116
- package/readme.md +437 -143
package/bin/cli.js
CHANGED
|
@@ -1,209 +1,213 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// =========================================================================
|
|
4
|
-
// File: bin/cli.js - Retiam Unified CLI Entrypoint
|
|
5
|
-
// =========================================================================
|
|
6
|
-
|
|
7
|
-
import { spawn } from 'child_process';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import { fileURLToPath } from 'url';
|
|
10
|
-
import { createRequire } from 'module';
|
|
11
|
-
|
|
12
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
-
const __dirname = path.dirname(__filename);
|
|
14
|
-
|
|
15
|
-
const args = process.argv.slice(2);
|
|
16
|
-
const command = args[0];
|
|
17
|
-
|
|
18
|
-
const renderScript = path.join(__dirname, 'render.js');
|
|
19
|
-
const exportScript = path.join(__dirname, 'export.js');
|
|
20
|
-
const lintScript = path.join(__dirname, 'lint.js');
|
|
21
|
-
const snapshotScript = path.join(__dirname, 'snapshot.js');
|
|
22
|
-
const initScript = path.join(__dirname, 'init.js');
|
|
23
|
-
|
|
24
|
-
function runScript(scriptPath, scriptArgs) {
|
|
25
|
-
if (scriptPath === renderScript || scriptPath === snapshotScript) {
|
|
26
|
-
try {
|
|
27
|
-
createRequire(import.meta.url).resolve('puppeteer');
|
|
28
|
-
} catch {
|
|
29
|
-
console.error('Retiam
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
const child = spawn(process.execPath, [scriptPath, ...scriptArgs], { stdio: 'inherit' });
|
|
34
|
-
child.on('error', (error) => {
|
|
35
|
-
console.error(`Unable to start Retiam command: ${error.message}`);
|
|
36
|
-
process.exit(1);
|
|
37
|
-
});
|
|
38
|
-
child.on('exit', (code, signal) => process.exit(code ?? (signal ? 1 : 0)));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function printRootHelp() {
|
|
42
|
-
console.log(`
|
|
43
|
-
🎬 Retiam WebGPU Engine CLI (Agent-Native Edition)
|
|
44
|
-
|
|
45
|
-
Usage:
|
|
46
|
-
npx retiam <command> [file] [options]
|
|
47
|
-
npx retiam [file] [options] (shortcut for render)
|
|
48
|
-
npx retiam help <command> (detailed help for a single command)
|
|
49
|
-
|
|
50
|
-
Commands Overview:
|
|
51
|
-
init, create Initialize a complete Retiam WebGPU animation skeleton project
|
|
52
|
-
lint Statically analyze scenes for runtime hazards and async timing bugs
|
|
53
|
-
snapshot Capture multi-timestamp visual PNG keyframes via headless WebGPU
|
|
54
|
-
render Render high-fidelity video (MP4/WebM) via WebGPU & FFmpeg
|
|
55
|
-
export Bundle scene into an embeddable <retiam-scene> Web Component
|
|
56
|
-
|
|
57
|
-
================================================================================
|
|
58
|
-
1. RENDER (npx retiam render [file] [options])
|
|
59
|
-
Render a scene into an MP4/WebM video via headless Chrome and FFmpeg.
|
|
60
|
-
|
|
61
|
-
Arguments:
|
|
62
|
-
[file] Target scene TypeScript file (default: src/main.ts)
|
|
63
|
-
|
|
64
|
-
Options:
|
|
65
|
-
-w, --width <px> Output video width (default: 1920)
|
|
66
|
-
-h, --height <px> Output video height (default: 1080)
|
|
67
|
-
-f, --fps <num> Render frame rate (default: 60)
|
|
68
|
-
-d, --duration <ms> Maximum rendering duration limit in milliseconds
|
|
69
|
-
-o, --out <dir> Output directory for video (default: ./outputs/video)
|
|
70
|
-
--raytrace [true|false] Enable or disable hardware raytracing
|
|
71
|
-
--no-raytrace Explicitly disable raytracing
|
|
72
|
-
--denoiser <format> Denoiser pipeline ('none', 'spatial', 'oidn', 'native')
|
|
73
|
-
--raw Use native raw HDR frame buffer export
|
|
74
|
-
--replay <file.json> Replay recorded interactions JSON during rendering
|
|
75
|
-
--help Show render-specific help
|
|
76
|
-
|
|
77
|
-
Examples:
|
|
78
|
-
npx retiam render src/scenes/AStarScene.ts
|
|
79
|
-
npx retiam render MyScene.ts -w 1920 -h 1080 -f 60
|
|
80
|
-
npx retiam render MyScene.ts -d 15000 --raytrace false
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
--
|
|
95
|
-
--
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
-
|
|
115
|
-
--
|
|
116
|
-
--
|
|
117
|
-
--
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
// Usage: npx retiam
|
|
172
|
-
runScript(
|
|
173
|
-
}
|
|
174
|
-
else if (command === '
|
|
175
|
-
// Usage: npx retiam
|
|
176
|
-
runScript(
|
|
177
|
-
}
|
|
178
|
-
else if (command === '
|
|
179
|
-
// Usage: npx retiam
|
|
180
|
-
runScript(
|
|
181
|
-
}
|
|
182
|
-
else if (command === '
|
|
183
|
-
// Usage: npx retiam
|
|
184
|
-
runScript(
|
|
185
|
-
}
|
|
186
|
-
else if (command === '
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
runScript(
|
|
194
|
-
} else if (sub === '
|
|
195
|
-
runScript(
|
|
196
|
-
} else if (sub === '
|
|
197
|
-
runScript(
|
|
198
|
-
} else {
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
else
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// =========================================================================
|
|
4
|
+
// File: bin/cli.js - Retiam Unified CLI Entrypoint
|
|
5
|
+
// =========================================================================
|
|
6
|
+
|
|
7
|
+
import { spawn } from 'child_process';
|
|
8
|
+
import path from 'path';
|
|
9
|
+
import { fileURLToPath } from 'url';
|
|
10
|
+
import { createRequire } from 'module';
|
|
11
|
+
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
+
const __dirname = path.dirname(__filename);
|
|
14
|
+
|
|
15
|
+
const args = process.argv.slice(2);
|
|
16
|
+
const command = args[0];
|
|
17
|
+
|
|
18
|
+
const renderScript = path.join(__dirname, 'render.js');
|
|
19
|
+
const exportScript = path.join(__dirname, 'export.js');
|
|
20
|
+
const lintScript = path.join(__dirname, 'lint.js');
|
|
21
|
+
const snapshotScript = path.join(__dirname, 'snapshot.js');
|
|
22
|
+
const initScript = path.join(__dirname, 'init.js');
|
|
23
|
+
|
|
24
|
+
function runScript(scriptPath, scriptArgs) {
|
|
25
|
+
if (scriptPath === renderScript || scriptPath === snapshotScript) {
|
|
26
|
+
try {
|
|
27
|
+
createRequire(import.meta.url).resolve('puppeteer');
|
|
28
|
+
} catch {
|
|
29
|
+
console.error('Retiam installation is incomplete: its required Puppeteer dependency is missing. Reinstall Retiam in your project with: npm install retiam');
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const child = spawn(process.execPath, [scriptPath, ...scriptArgs], { stdio: 'inherit' });
|
|
34
|
+
child.on('error', (error) => {
|
|
35
|
+
console.error(`Unable to start Retiam command: ${error.message}`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
});
|
|
38
|
+
child.on('exit', (code, signal) => process.exit(code ?? (signal ? 1 : 0)));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function printRootHelp() {
|
|
42
|
+
console.log(`
|
|
43
|
+
🎬 Retiam WebGPU Engine CLI (Agent-Native Edition)
|
|
44
|
+
|
|
45
|
+
Usage:
|
|
46
|
+
npx retiam <command> [file] [options]
|
|
47
|
+
npx retiam [file] [options] (shortcut for render)
|
|
48
|
+
npx retiam help <command> (detailed help for a single command)
|
|
49
|
+
|
|
50
|
+
Commands Overview:
|
|
51
|
+
init, create Initialize a complete Retiam WebGPU animation skeleton project
|
|
52
|
+
lint Statically analyze scenes for runtime hazards and async timing bugs
|
|
53
|
+
snapshot Capture multi-timestamp visual PNG keyframes via headless WebGPU
|
|
54
|
+
render Render high-fidelity video (MP4/WebM) via WebGPU & FFmpeg
|
|
55
|
+
export Bundle scene into an embeddable <retiam-scene> Web Component
|
|
56
|
+
|
|
57
|
+
================================================================================
|
|
58
|
+
1. RENDER (npx retiam render [file] [options])
|
|
59
|
+
Render a scene into an MP4/WebM video via headless Chrome and FFmpeg.
|
|
60
|
+
|
|
61
|
+
Arguments:
|
|
62
|
+
[file] Target scene TypeScript file (default: src/main.ts)
|
|
63
|
+
|
|
64
|
+
Options:
|
|
65
|
+
-w, --width <px> Output video width (default: 1920)
|
|
66
|
+
-h, --height <px> Output video height (default: 1080)
|
|
67
|
+
-f, --fps <num> Render frame rate (default: 60)
|
|
68
|
+
-d, --duration <ms> Maximum rendering duration limit in milliseconds
|
|
69
|
+
-o, --out <dir> Output directory for video (default: ./outputs/video)
|
|
70
|
+
--raytrace [true|false] Enable or disable hardware raytracing
|
|
71
|
+
--no-raytrace Explicitly disable raytracing
|
|
72
|
+
--denoiser <format> Denoiser pipeline ('none', 'spatial', 'oidn', 'native')
|
|
73
|
+
--raw Use native raw HDR frame buffer export
|
|
74
|
+
--replay <file.json> Replay recorded interactions JSON during rendering
|
|
75
|
+
--help Show render-specific help
|
|
76
|
+
|
|
77
|
+
Examples:
|
|
78
|
+
npx retiam render src/scenes/AStarScene.ts
|
|
79
|
+
npx retiam render MyScene.ts -w 1920 -h 1080 -f 60
|
|
80
|
+
npx retiam render MyScene.ts -d 15000 --raytrace false
|
|
81
|
+
|
|
82
|
+
Configuration:
|
|
83
|
+
Reads config.js in the project root (retiam.config.js takes priority).
|
|
84
|
+
Command-line flags override file settings.
|
|
85
|
+
|
|
86
|
+
================================================================================
|
|
87
|
+
2. SNAPSHOT (npx retiam snapshot <file> [options])
|
|
88
|
+
Capture visual PNG keyframe snapshots at specific timeline seconds.
|
|
89
|
+
|
|
90
|
+
Arguments:
|
|
91
|
+
<file> Target scene TypeScript file (e.g. MyScene.ts)
|
|
92
|
+
|
|
93
|
+
Options:
|
|
94
|
+
--times <sec,sec,...> Comma-separated timeline seconds (default: 1.0, 2.5)
|
|
95
|
+
-w, --width <px> Snapshot width in pixels (default: 1280)
|
|
96
|
+
-h, --height <px> Snapshot height in pixels (default: 720)
|
|
97
|
+
-o, --out <dir> Output directory for images (default: ./outputs/snapshot)
|
|
98
|
+
--json Output structured JSON for agents & CI automation
|
|
99
|
+
--help Show snapshot-specific help
|
|
100
|
+
|
|
101
|
+
Examples:
|
|
102
|
+
npx retiam snapshot MyScene.ts
|
|
103
|
+
npx retiam snapshot MyScene.ts --times 1.0,3.5,7.0 -w 1920 -h 1080
|
|
104
|
+
npx retiam snapshot MyScene.ts --times 5.0 --out ./outputs/snapshot --json
|
|
105
|
+
|
|
106
|
+
================================================================================
|
|
107
|
+
3. INIT / CREATE (npx retiam init [directory] [options])
|
|
108
|
+
Initialize a complete, ready-to-run Retiam WebGPU animation project skeleton.
|
|
109
|
+
|
|
110
|
+
Arguments:
|
|
111
|
+
[directory] Destination directory (default: ./retiam-animation)
|
|
112
|
+
|
|
113
|
+
Options:
|
|
114
|
+
-n, --name <name> Project name for package.json (default: directory name)
|
|
115
|
+
--title <text> Hero text for starter Hello World scene (default: Hello World)
|
|
116
|
+
--pm <manager> Package manager: npm, pnpm, yarn, bun (default: auto or npm)
|
|
117
|
+
-f, --force Overwrite destination directory if files already exist
|
|
118
|
+
-y, --yes Skip interactive prompts and use defaults
|
|
119
|
+
--install Automatically install dependencies after initialization
|
|
120
|
+
--git Initialize a Git repository (git init)
|
|
121
|
+
--json Output structured JSON for agents & CI automation
|
|
122
|
+
--help, -h Show init-specific help
|
|
123
|
+
|
|
124
|
+
Examples:
|
|
125
|
+
npx retiam init
|
|
126
|
+
npx retiam init my-animation
|
|
127
|
+
npx retiam create quantum-viz --title "Quantum Mechanics" --pm pnpm
|
|
128
|
+
npx retiam init intro-scene -y --install
|
|
129
|
+
|
|
130
|
+
================================================================================
|
|
131
|
+
4. LINT (npx retiam lint <file> [options])
|
|
132
|
+
Static analyzer and AST validator detecting common animation bugs and timing hazards.
|
|
133
|
+
|
|
134
|
+
Arguments:
|
|
135
|
+
<file> Target scene file to analyze (e.g. MyScene.ts)
|
|
136
|
+
|
|
137
|
+
Options:
|
|
138
|
+
--json Output machine-readable JSON with line numbers & suggested fixes
|
|
139
|
+
--help, -h Show lint-specific help
|
|
140
|
+
|
|
141
|
+
Checks Performed:
|
|
142
|
+
- Validates Scene class structure and async run() contract
|
|
143
|
+
- Detects un-awaited this.play() or this.wait() timing races
|
|
144
|
+
- Warns about dangling entities not attached to scene graph
|
|
145
|
+
- Catches Three.js / Python Manim hallucinations
|
|
146
|
+
- Flags extreme world coordinates exceeding standard camera frustum
|
|
147
|
+
|
|
148
|
+
Examples:
|
|
149
|
+
npx retiam lint MyScene.ts
|
|
150
|
+
npx retiam lint MyScene.ts --json
|
|
151
|
+
|
|
152
|
+
================================================================================
|
|
153
|
+
5. EXPORT (npx retiam export [file] [outDir] [options])
|
|
154
|
+
Compile the scene into a standalone, zero-dependency <retiam-scene> Web Component.
|
|
155
|
+
|
|
156
|
+
Arguments:
|
|
157
|
+
[file] Source scene file to bundle (default: src/main.ts)
|
|
158
|
+
[outDir] Target distribution folder (default: outputs/embed)
|
|
159
|
+
|
|
160
|
+
Options:
|
|
161
|
+
-o, --out <dir> Target distribution folder (default: outputs/embed)
|
|
162
|
+
--help, -h Show export-specific help
|
|
163
|
+
|
|
164
|
+
Examples:
|
|
165
|
+
npx retiam export MyScene.ts
|
|
166
|
+
npx retiam export MyScene.ts ./outputs/embed
|
|
167
|
+
`);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (command === 'lint') {
|
|
171
|
+
// Usage: npx retiam lint src/MyScene.ts [--json]
|
|
172
|
+
runScript(lintScript, args.slice(1));
|
|
173
|
+
}
|
|
174
|
+
else if (command === 'snapshot') {
|
|
175
|
+
// Usage: npx retiam snapshot src/MyScene.ts [--times 1.0,2.5] [--out ./outputs/snapshot] [--json]
|
|
176
|
+
runScript(snapshotScript, args.slice(1));
|
|
177
|
+
}
|
|
178
|
+
else if (command === 'init' || command === 'create' || command === 'scaffold') {
|
|
179
|
+
// Usage: npx retiam init [directory] [options]
|
|
180
|
+
runScript(initScript, args.slice(1));
|
|
181
|
+
}
|
|
182
|
+
else if (command === 'export') {
|
|
183
|
+
// Usage: npx retiam export src/main.ts
|
|
184
|
+
runScript(exportScript, args.slice(1));
|
|
185
|
+
}
|
|
186
|
+
else if (command === 'render') {
|
|
187
|
+
// Usage: npx retiam render src/main.ts
|
|
188
|
+
runScript(renderScript, args.slice(1));
|
|
189
|
+
}
|
|
190
|
+
else if (command === 'help') {
|
|
191
|
+
const sub = args[1];
|
|
192
|
+
if (sub === 'lint') {
|
|
193
|
+
runScript(lintScript, ['--help']);
|
|
194
|
+
} else if (sub === 'snapshot') {
|
|
195
|
+
runScript(snapshotScript, ['--help']);
|
|
196
|
+
} else if (sub === 'init' || sub === 'create' || sub === 'scaffold') {
|
|
197
|
+
runScript(initScript, ['--help']);
|
|
198
|
+
} else if (sub === 'export') {
|
|
199
|
+
runScript(exportScript, ['--help']);
|
|
200
|
+
} else if (sub === 'render') {
|
|
201
|
+
runScript(renderScript, ['--help']);
|
|
202
|
+
} else {
|
|
203
|
+
printRootHelp();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else if (command === '-h' || command === '--help' || !command) {
|
|
207
|
+
printRootHelp();
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
// Fallback: Default to rendering if a file path or flag is passed directly
|
|
211
|
+
// Usage: npx retiam src/main.ts
|
|
212
|
+
runScript(renderScript, args);
|
|
213
|
+
}
|