@genart-dev/cli 0.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 genart-dev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,386 @@
1
+ # @genart-dev/cli
2
+
3
+ Command-line interface for [genart.dev](https://genart.dev) — render, batch, montage, import, validate, export, and scaffold generative art sketches. Includes a built-in MCP server for AI agent integration.
4
+
5
+ Part of [genart.dev](https://genart.dev) — a generative art platform with an [MCP server](https://github.com/genart-dev/mcp-server), desktop app, and IDE extensions.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install -g @genart-dev/cli
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```bash
16
+ # Create a new sketch
17
+ genart init "spiral grid" --renderer p5
18
+
19
+ # Render to PNG
20
+ genart render spiral-grid.genart -o spiral-grid.png
21
+
22
+ # Batch render with seed sweep
23
+ genart batch spiral-grid.genart --seeds 1-20 --concurrency 8
24
+
25
+ # Export standalone HTML
26
+ genart export spiral-grid.genart --format html
27
+
28
+ # Import existing source code
29
+ genart import sketch.js
30
+
31
+ # Record a video
32
+ genart video spiral-grid.genart --duration 10 --fps 30
33
+
34
+ # Connect your AI agent
35
+ genart agent install claude
36
+ ```
37
+
38
+ ## Commands
39
+
40
+ ### `genart render <file>`
41
+
42
+ Render a `.genart` sketch to an image.
43
+
44
+ ```bash
45
+ genart render sketch.genart
46
+ genart render sketch.genart -o output.png --wait 1s --scale 2
47
+ genart render sketch.genart --seed 42 --preset landscape-1000
48
+ genart render sketch.genart --params '{"amplitude": 0.8}' --colors '["#ff0000", "#00ff00"]'
49
+ ```
50
+
51
+ | Option | Default | Description |
52
+ |--------|---------|-------------|
53
+ | `--wait <duration>` | `500ms` | Wait time before capture |
54
+ | `--seed <n>` | | Override seed |
55
+ | `--params <json>` | | Override parameters (JSON object) |
56
+ | `--colors <json>` | | Override color palette (JSON array) |
57
+ | `--width <n>` | | Override canvas width |
58
+ | `--height <n>` | | Override canvas height |
59
+ | `--preset <name>` | | Canvas preset (e.g. `square-600`, `landscape-1000`) |
60
+ | `--format <fmt>` | `png` | Output format: `png`, `jpeg`, `webp` |
61
+ | `--quality <n>` | `80` | Lossy compression quality (0–100) |
62
+ | `--scale <n>` | `1` | Pixel density multiplier |
63
+ | `-o, --output <path>` | | Output file path |
64
+
65
+ ### `genart info <files...>`
66
+
67
+ Inspect `.genart` sketch metadata — title, renderer, canvas, parameters, colors, skills, dates.
68
+
69
+ ```bash
70
+ genart info sketch.genart
71
+ genart info *.genart --json
72
+ genart info sketches/ --table
73
+ ```
74
+
75
+ | Option | Description |
76
+ |--------|-------------|
77
+ | `--json` | Machine-readable JSON output |
78
+ | `--table` | Tabular output for multiple files |
79
+
80
+ ### `genart validate <paths...>`
81
+
82
+ Validate `.genart` files. Accepts files and directories (scans recursively).
83
+
84
+ ```bash
85
+ genart validate sketch.genart
86
+ genart validate ./sketches/ --strict
87
+ ```
88
+
89
+ | Option | Description |
90
+ |--------|-------------|
91
+ | `--strict` | Also run renderer-specific `validate()` on algorithm source |
92
+
93
+ ### `genart init [name]`
94
+
95
+ Scaffold a new `.genart` sketch file with interactive prompts.
96
+
97
+ ```bash
98
+ genart init
99
+ genart init "wave field" --renderer three --preset portrait-800
100
+ ```
101
+
102
+ | Option | Default | Description |
103
+ |--------|---------|-------------|
104
+ | `--renderer <type>` | *(interactive)* | `p5`, `canvas2d`, `three`, `glsl`, `svg` |
105
+ | `--preset <name>` | `square-600` | Canvas preset |
106
+ | `--title <string>` | *(interactive)* | Sketch title |
107
+
108
+ ### `genart export <file>`
109
+
110
+ Export sketch as HTML, image, or algorithm source.
111
+
112
+ ```bash
113
+ genart export sketch.genart --format html -o sketch.html
114
+ genart export sketch.genart --format png --scale 2
115
+ genart export sketch.genart --format algorithm # extracts .js or .glsl
116
+ ```
117
+
118
+ | Option | Default | Description |
119
+ |--------|---------|-------------|
120
+ | `--format <fmt>` | `html` | `html`, `png`, `jpeg`, `webp`, `algorithm` |
121
+ | `--wait <duration>` | `500ms` | Render wait time (image formats) |
122
+ | `--seed <n>` | | Override seed |
123
+ | `--params <json>` | | Override parameters |
124
+ | `--colors <json>` | | Override color palette |
125
+ | `--width <n>` | | Override canvas width |
126
+ | `--height <n>` | | Override canvas height |
127
+ | `--preset <name>` | | Canvas preset |
128
+ | `--quality <n>` | `80` | Lossy compression quality (0–100) |
129
+ | `--scale <n>` | `1` | Pixel density multiplier |
130
+ | `-o, --output <path>` | | Output file path |
131
+
132
+ ### `genart batch <files...>`
133
+
134
+ Generate many renders from one sketch — seed ranges, parameter sweeps, random combinations.
135
+
136
+ ```bash
137
+ genart batch sketch.genart --seeds 1-100 --concurrency 8 -o renders/
138
+ genart batch sketch.genart --sweep amplitude=0:1:0.1 --manifest
139
+ genart batch sketch.genart --random 50 --naming "{id}-{seed}-{params}"
140
+ genart batch sketch.genart --seeds 1-5 --sweep size=10:50:10 --matrix
141
+ ```
142
+
143
+ | Option | Default | Description |
144
+ |--------|---------|-------------|
145
+ | `--seeds <range>` | | Seed range or list (e.g. `1-100`, `1,5,42`) |
146
+ | `--sweep <spec>` | | Parameter sweep: `key=min:max:step` (repeatable) |
147
+ | `--random <n>` | | Generate N random seed + param combinations |
148
+ | `--matrix` | | Cartesian product of seeds × sweeps |
149
+ | `--concurrency <n>` | `4` | Parallel captures |
150
+ | `--naming <pattern>` | `{id}-{seed}` | Output naming (tokens: `{id}`, `{seed}`, `{index}`, `{params}`) |
151
+ | `--manifest` | | Write `manifest.json` with per-render metadata |
152
+ | `--wait <duration>` | `500ms` | Render wait time |
153
+ | `--format <fmt>` | `png` | `png`, `jpeg`, `webp` |
154
+ | `--quality <n>` | `80` | Lossy compression quality (0–100) |
155
+ | `--scale <n>` | `1` | Pixel density multiplier |
156
+ | `--width <n>` | | Override canvas width |
157
+ | `--height <n>` | | Override canvas height |
158
+ | `--preset <name>` | | Canvas preset |
159
+ | `--colors <json>` | | Override color palette |
160
+ | `-o, --output-dir <dir>` | `.` | Output directory |
161
+
162
+ ### `genart montage <source>`
163
+
164
+ Compose a grid of images into a single montage. Reads from a directory or manifest JSON on stdin.
165
+
166
+ ```bash
167
+ genart montage renders/ -o grid.png --columns 10 --gap 4
168
+ genart batch sketch.genart --seeds 1-25 --manifest | genart montage - --label seed
169
+ ```
170
+
171
+ | Option | Default | Description |
172
+ |--------|---------|-------------|
173
+ | `--columns <n>` | *(auto)* | Grid columns |
174
+ | `--rows <n>` | *(auto)* | Grid rows |
175
+ | `--tile-size <WxH>` | | Force tile dimensions (e.g. `200x200`) |
176
+ | `--gap <px>` | `2` | Gap between tiles |
177
+ | `--padding <px>` | `0` | Outer padding |
178
+ | `--background <hex>` | `#0A0A0A` | Background color |
179
+ | `--label <mode>` | `none` | Label tiles: `seed`, `params`, `filename`, `index`, `none` |
180
+ | `--label-color <hex>` | `#999999` | Label text color |
181
+ | `--label-font-size <px>` | `11` | Label font size |
182
+ | `--sort <key>` | | Sort: `seed`, `name`, `param:<key>` |
183
+ | `-o, --output <path>` | `montage.png` | Output file |
184
+
185
+ Requires [`sharp`](https://sharp.pixelplumbing.com/) — install with `npm install sharp`.
186
+
187
+ ### `genart import <files...>`
188
+
189
+ Convert source files (`.js`, `.glsl`) into `.genart` sketches. Auto-detects renderer, parameters, colors, and canvas size from source code.
190
+
191
+ ```bash
192
+ genart import sketch.js
193
+ genart import *.js --batch --renderer p5 --title "My Series"
194
+ genart import shader.glsl --preset landscape-1000 --seed 42
195
+ genart import sketch.js --dry-run
196
+ ```
197
+
198
+ | Option | Default | Description |
199
+ |--------|---------|-------------|
200
+ | `--renderer <type>` | *(auto-detect)* | Force renderer type |
201
+ | `--preset <name>` | `square-600` | Canvas preset |
202
+ | `--title <string>` | *(interactive)* | Sketch title |
203
+ | `--seed <n>` | | Initial seed |
204
+ | `-y, --non-interactive` | | Accept all defaults |
205
+ | `--batch` | | Process multiple files non-interactively |
206
+ | `--dry-run` | | Preview without writing |
207
+ | `-o, --output <path>` | | Output path (single file only) |
208
+
209
+ **Renderer auto-detection** analyzes source code for framework-specific patterns (p5 instance methods, Canvas2D API, THREE constructors, GLSL builtins, SVG namespaces) and reports confidence level (high, medium, low).
210
+
211
+ ### `genart video <file>`
212
+
213
+ Render a video from an animated sketch. Captures frames via headless Chrome and encodes with ffmpeg.
214
+
215
+ ```bash
216
+ genart video sketch.genart --duration 10
217
+ genart video sketch.genart --duration 5 --fps 60 --format webm --codec vp9
218
+ genart video sketch.genart --duration 3 --animate amplitude=0:1 --easing ease-in-out
219
+ genart video sketch.genart --duration 2 --format gif --loop 0
220
+ ```
221
+
222
+ | Option | Default | Description |
223
+ |--------|---------|-------------|
224
+ | `--duration <seconds>` | *(required)* | Video duration in seconds |
225
+ | `--fps <n>` | `30` | Frames per second |
226
+ | `--format <fmt>` | `mp4` | `mp4`, `webm`, `gif` |
227
+ | `--codec <name>` | `h264` | `h264`, `h265`, `vp9` |
228
+ | `--quality <n>` | `75` | Encoding quality (0–100) |
229
+ | `--animate <spec>` | | Interpolate parameter: `param=start:end` (repeatable) |
230
+ | `--easing <fn>` | `linear` | `linear`, `ease-in`, `ease-out`, `ease-in-out` |
231
+ | `--loop <n>` | `0` | GIF loop count (0 = infinite) |
232
+ | `--concurrency <n>` | `4` | Parallel frame captures |
233
+ | `--wait <duration>` | `200ms` | Init wait before time injection |
234
+ | `--seed <n>` | | Override seed |
235
+ | `--params <json>` | | Override parameters |
236
+ | `--colors <json>` | | Override color palette |
237
+ | `--width <n>` | | Override canvas width |
238
+ | `--height <n>` | | Override canvas height |
239
+ | `--preset <name>` | | Canvas preset |
240
+ | `-o, --output <path>` | | Output file path |
241
+
242
+ Requires [ffmpeg](https://ffmpeg.org/) in `PATH`.
243
+
244
+ ### `genart agent <subcommand>`
245
+
246
+ MCP server and AI agent configuration. See [Agent Integration](#agent-integration) below.
247
+
248
+ ## Agent Integration
249
+
250
+ The CLI includes a built-in [MCP server](https://modelcontextprotocol.io) with 33 tools for creating and manipulating generative art. Connect it to any AI coding agent.
251
+
252
+ ### `genart agent install [client]`
253
+
254
+ Configure MCP for an AI client with one command.
255
+
256
+ ```bash
257
+ genart agent install claude
258
+ genart agent install cursor
259
+ genart agent install --all # configure all detected clients
260
+ genart agent install claude --npx # use npx instead of global binary
261
+ genart agent install --remove # remove genart from all clients
262
+ genart agent install vscode --dry-run
263
+ ```
264
+
265
+ | Option | Description |
266
+ |--------|-------------|
267
+ | `--all` | Configure all clients whose binary is detected in PATH |
268
+ | `--remove` | Remove genart MCP configuration |
269
+ | `--dry-run` | Preview changes without writing |
270
+ | `--npx` | Force npx invocation (`npx -y @genart-dev/cli agent stdio`) |
271
+
272
+ ### Supported AI Clients
273
+
274
+ | Client | ID | Config Path (macOS) | Binary |
275
+ |--------|----|-------------------|--------|
276
+ | Claude Code | `claude` | `~/.claude.json` | `claude` |
277
+ | Codex CLI | `codex` | `~/.codex/config.toml` | `codex` |
278
+ | Cursor | `cursor` | `~/.cursor/mcp.json` | `cursor` |
279
+ | VS Code | `vscode` | `~/Library/Application Support/Code/User/settings.json` | `code` |
280
+ | Gemini CLI | `gemini` | `~/.gemini/settings.json` | `gemini` |
281
+ | OpenCode | `opencode` | `~/.config/opencode/opencode.json` | `opencode` |
282
+ | Kiro | `kiro` | `~/.kiro/settings/mcp.json` | `kiro` |
283
+ | Windsurf | `windsurf` | `~/.codeium/windsurf/mcp_config.json` | `windsurf` |
284
+
285
+ ### `genart agent stdio`
286
+
287
+ Start MCP server over stdio transport. This is what AI clients connect to.
288
+
289
+ ```bash
290
+ genart agent stdio
291
+ genart agent stdio --base-path ~/sketches
292
+ ```
293
+
294
+ | Option | Default | Description |
295
+ |--------|---------|-------------|
296
+ | `--base-path <dir>` | cwd | Base directory for file operations |
297
+
298
+ ### `genart agent http`
299
+
300
+ Start MCP server over HTTP (Streamable HTTP transport) for browser or network access.
301
+
302
+ ```bash
303
+ genart agent http
304
+ genart agent http --port 8080 --cors
305
+ ```
306
+
307
+ | Option | Default | Description |
308
+ |--------|---------|-------------|
309
+ | `--port <n>` | `3333` | Port to listen on |
310
+ | `--host <addr>` | `127.0.0.1` | Host to bind to |
311
+ | `--base-path <dir>` | cwd | Base directory for file operations |
312
+ | `--cors` | | Enable CORS headers |
313
+
314
+ ### `genart agent sidecar`
315
+
316
+ Start MCP server in sidecar mode (stdio + IPC mutations). Used by the Electron desktop app for real-time UI updates.
317
+
318
+ ```bash
319
+ genart agent sidecar --base-path ~/project
320
+ ```
321
+
322
+ | Option | Default | Description |
323
+ |--------|---------|-------------|
324
+ | `--base-path <dir>` | cwd | Base directory for file operations |
325
+
326
+ ### `genart agent doctor`
327
+
328
+ Diagnose your genart MCP setup — checks CLI version, Chrome, ffmpeg, sharp, and per-client configuration.
329
+
330
+ ```bash
331
+ genart agent doctor
332
+ ```
333
+
334
+ ## Hybrid Workflow
335
+
336
+ The CLI and MCP server are designed to work together. Your AI agent creates and edits sketches through the MCP tools, then you use the CLI to render, batch, export, and compose:
337
+
338
+ ```bash
339
+ # 1. Connect your agent
340
+ genart agent install claude
341
+
342
+ # 2. Ask the agent to create sketches
343
+ # "Create a workspace with three p5.js sketches exploring Perlin noise"
344
+
345
+ # 3. Render the results
346
+ genart render noise-field.genart -o noise-field.png
347
+
348
+ # 4. Explore the parameter space
349
+ genart batch noise-field.genart --seeds 1-100 --sweep scale=0.01:0.1:0.01 --matrix
350
+
351
+ # 5. Compose a montage
352
+ genart montage renders/ --columns 10 --label seed -o exploration.png
353
+
354
+ # 6. Record a video
355
+ genart video noise-field.genart --duration 10 --animate scale=0.01:0.1 --easing ease-in-out
356
+ ```
357
+
358
+ ## Environment Variables
359
+
360
+ | Variable | Description |
361
+ |----------|-------------|
362
+ | `GENART_CHROME_PATH` | Override Chrome/Chromium path for headless rendering. Auto-detected by default. |
363
+
364
+ ## Optional Dependencies
365
+
366
+ | Package | Required For | Install |
367
+ |---------|-------------|---------|
368
+ | [sharp](https://sharp.pixelplumbing.com/) | `montage` command | `npm install sharp` |
369
+ | [ffmpeg](https://ffmpeg.org/) | `video` command | `brew install ffmpeg` / [download](https://ffmpeg.org/download.html) |
370
+ | Chrome/Chromium | `render`, `export`, `batch`, `video` | Auto-detected or set `GENART_CHROME_PATH` |
371
+
372
+ ## Related Packages
373
+
374
+ | Package | Purpose |
375
+ |---------|---------|
376
+ | [`@genart-dev/format`](https://github.com/genart-dev/format) | File format types, parsers, presets |
377
+ | [`@genart-dev/core`](https://github.com/genart-dev/core) | Renderer adapters, skill registry |
378
+ | [`@genart-dev/mcp-server`](https://github.com/genart-dev/mcp-server) | MCP server + CLI (33 tools) |
379
+
380
+ ## Support
381
+
382
+ Questions, bugs, or feedback — [support@genart.dev](mailto:support@genart.dev) or [open an issue](https://github.com/genart-dev/cli/issues).
383
+
384
+ ## License
385
+
386
+ MIT
@@ -0,0 +1,2 @@
1
+
2
+ export { }