media-gen-cli 1.5.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/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "media-gen-cli",
3
+ "version": "1.5.0",
4
+ "description": "Production-ready CLI for multi-provider media generation (images, video, voice, audio) designed for developers and AI agents",
5
+ "type": "module",
6
+ "main": "./dist/media-gen.js",
7
+ "bin": {
8
+ "media-gen": "./dist/media-gen.mjs"
9
+ },
10
+ "files": [
11
+ "dist/media-gen.mjs",
12
+ "skills/",
13
+ "README.md",
14
+ "LICENSE",
15
+ ".env.example"
16
+ ],
17
+ "scripts": {
18
+ "dev": "tsx src/index.ts",
19
+ "build": "node esbuild.config.mjs",
20
+ "test": "vitest run",
21
+ "test:watch": "vitest",
22
+ "lint": "eslint src/ --ext .ts",
23
+ "format": "prettier --write \"src/**/*.ts\"",
24
+ "typecheck": "tsc --noEmit",
25
+ "prepublishOnly": "npm run build"
26
+ },
27
+ "keywords": [
28
+ "ai",
29
+ "media-generation",
30
+ "image-generation",
31
+ "video-generation",
32
+ "text-to-speech",
33
+ "transcription",
34
+ "openai",
35
+ "gemini",
36
+ "elevenlabs",
37
+ "deepgram",
38
+ "cli"
39
+ ],
40
+ "author": "Francis Hor <francishoe@gmail.com>",
41
+ "license": "MIT",
42
+ "engines": {
43
+ "node": ">=18.0.0"
44
+ },
45
+ "dependencies": {
46
+ "commander": "^12.1.0",
47
+ "dotenv": "^16.4.7",
48
+ "edge-tts-universal": "^1.4.0",
49
+ "ora": "^8.1.1",
50
+ "pino": "^9.6.0",
51
+ "pino-pretty": "^13.0.0",
52
+ "zod": "^3.24.1"
53
+ },
54
+ "devDependencies": {
55
+ "@types/node": "^22.10.0",
56
+ "esbuild": "^0.24.2",
57
+ "eslint": "^9.16.0",
58
+ "prettier": "^3.4.2",
59
+ "tsx": "^4.19.2",
60
+ "typescript": "^5.7.2",
61
+ "vitest": "^2.1.8"
62
+ }
63
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Francis Hor
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.
@@ -0,0 +1,98 @@
1
+ # Release Notes
2
+
3
+ ## v1.5.0 (2026-07-09)
4
+
5
+ ### New Capabilities
6
+ - **OpenRouter video generation** — 12 models via `POST /api/v1/videos` (async with polling)
7
+ - google/veo-3.1, google/veo-3.1-fast, google/veo-3.1-lite
8
+ - alibaba/happy-horse-1.1, alibaba/happy-horse-1.0, alibaba/wan-2.7
9
+ - x-ai/grok-imagine-video
10
+ - kuaishou/kling-video-3.0-pro, kuaishou/kling-video-3.0-standard
11
+ - minimax/hailuo-2.3
12
+ - bytedance-seed/seedance-2.0-fast, bytedance-seed/seedance-2.0
13
+ - **OpenRouter image** — added microsoft/mai-image-2.5
14
+ - Auto-generate `~/.media-gen/.env` template on first run (all keys commented out)
15
+ - `--version` now reflects package.json (injected at build time)
16
+ - `.plugin/plugin.json` for Open Plugins standard (cursor.directory compatibility)
17
+ - `npx skills add onimusya/media-gen` installation support
18
+
19
+ ### Fixes
20
+ - Fixed OpenRouter video endpoint (`POST /api/v1/videos`, not `/video/generations`)
21
+ - Fixed OpenRouter video download (uses `unsigned_urls[]` with auth header)
22
+ - Fixed `~/.media-gen/logs/` not created on `--help` or `--version`
23
+ - Fixed `--version` showing hardcoded `1.0.0`
24
+
25
+ ## v1.3.0 (2026-07-08)
26
+
27
+ ### New Capabilities
28
+ - **Runway image generation** — gen4_image, gen4_image_turbo, gemini_image3_pro, gemini_image3.1_flash, gemini_2.5_flash, gpt_image_2
29
+ - **Runway multi-provider video** — veo3, veo3.1, seedance2, seedance2_fast, seedance2_mini, happyhorse_1_0, gemini_omni_flash (text-to-video + image-to-video)
30
+ - **Deepgram TTS** — Aura-2 and Aura models with 19 featured voices (English, German, Italian, Japanese)
31
+
32
+ ### Updated Models
33
+ - **Runway**: expanded from 5 to 18 models (image + video + image-to-video)
34
+ - **Deepgram**: added `aura-2` and `aura` TTS models with voice IDs (e.g., `aura-2-thalia-en`)
35
+ - **Fal.ai**: added ByteDance Seedream v5/v4, Dreamina v3.1, all Seedance 2.0 variants (standard/fast/mini)
36
+
37
+ ### Fixes
38
+ - Fixed Fal.ai queue status/download URL construction (strips endpoint suffix for queue paths)
39
+ - Fixed Azure provider to use Azure AI Services OpenAI-compatible endpoint format
40
+
41
+ ## v1.2.0 (2026-07-08)
42
+
43
+ ### Changes
44
+ - **Azure provider rewritten** for Azure AI Services OpenAI-compatible endpoint (`https://{resource}.services.ai.azure.com/openai/v1`)
45
+ - Azure models: gpt-image-2, gpt-image-1.5, gpt-4o-mini-tts with 13 voice IDs
46
+ - Added `LICENSE` and `RELEASE_NOTES.md` to skills folder
47
+ - Added prerequisites section to README
48
+ - Added ByteDance Seedream v5/v4 and Dreamina v3.1 for Fal.ai
49
+ - Added all Seedance 2.0 variants for Fal.ai (text-to-video, fast, mini)
50
+
51
+ ## v1.1.0 (2026-07-07)
52
+
53
+ ### New Providers
54
+ - **MiniMax (Hailuo)** — video generation (Hailuo 2.3, 2.3Fast, 02) + TTS (speech-2.8-hd/turbo)
55
+ - **Google Gemini TTS** — 30 voices, controllable style, 3 models (gemini-3.1-flash-tts-preview, gemini-2.5-flash-preview-tts, gemini-2.5-pro-preview-tts)
56
+
57
+ ### New Features
58
+ - `--instructions` option for OpenAI/Azure TTS (gpt-4o-mini-tts) to control voice style, tone, accent
59
+ - `MEDIA_GEN_VOICE_ID` env var — set default voice-id so `--voice-id` is optional
60
+ - `MEDIA_GEN_LOG_LEVEL` env var — configurable log level (silent/error/warn/info/debug/trace)
61
+ - Structured logging to `~/.media-gen/logs/media-gen-YYYY-MM-DD.log`
62
+ - Minified + obfuscated production build (519KB)
63
+ - Release scripts (`scripts/release.sh`, `scripts/release.ps1`)
64
+ - `config init --global` for user-level setup at `~/.media-gen/`
65
+
66
+ ### Fixes
67
+ - Fixed Fal.ai queue status/download URL construction (model path stripping for Seedance 2.0)
68
+ - Fixed home `~/.media-gen/.env` loading — now properly overrides stale system env vars
69
+ - Fixed Google Veo API: correct model names (`veo-3.1-generate-preview`), auth headers (`x-goog-api-key`), job polling URLs
70
+ - Azure provider rewritten to use Azure AI Services OpenAI-compatible endpoint
71
+
72
+ ### Updated Models
73
+ - **OpenAI**: gpt-image-2, 13 voice IDs (alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer, verse, marin, cedar)
74
+ - **Azure**: gpt-image-2, gpt-image-1.5, gpt-4o-mini-tts, 13 voice IDs
75
+ - **ElevenLabs**: 21 premade voice IDs (fetched from live API, free plan)
76
+ - **Google**: imagen-4.0, veo-3.1 variants, 30 TTS voices (Kore, Puck, Zephyr, etc.)
77
+ - **Fal.ai**: Seedance 2.0 (standard/fast/mini), Seedream v5/v4, Dreamina v3.1
78
+ - **Deepgram**: nova-3, nova-3-medical
79
+ - **Luma**: ray3.2, ray3.14
80
+ - **Runway**: gen4.5, aleph-2.0
81
+ - **Replicate**: flux-2-pro/max, flux-kontext-pro, gen-4.5, happy-horse-1.0
82
+ - **OpenRouter**: gpt-image-2, gemini-3.1-flash-image, grok-imagine, flux.2-klein-4b
83
+
84
+ ## v1.0.0 (2026-07-06)
85
+
86
+ ### Initial Release
87
+ - 13 provider adapters: OpenAI, Google, Azure, ElevenLabs, Deepgram, Fal.ai, Luma AI, Replicate, Stability AI, Runway, OpenRouter, MiniMax, Edge TTS (free)
88
+ - CLI commands: image generate/edit, video generate/image-to-video/extend, voice tts/clone/isolate, audio transcribe/translate
89
+ - AI agent SKILL.md following Agent Skills open standard
90
+ - Default provider/model/voice-id via env vars
91
+ - Multi-level config: `~/.media-gen/.env` → project `.env` → env vars
92
+ - `models.json` config for model/voice registry (bundled + user override at `.media-gen/models.json`)
93
+ - Cross-platform scripts (bash, cmd, PowerShell)
94
+ - Single bundled JS file via esbuild
95
+ - Async video job polling with `--wait`, `--poll-interval`, `--timeout`
96
+ - Structured JSON output (`--json`) for agent integration
97
+ - Dry-run mode (`--dry-run`) for cost-safe validation
98
+ - 25 tests passing
@@ -0,0 +1,273 @@
1
+ ---
2
+ name: media-generation
3
+ description: Generate and edit images, create videos, synthesize speech, transcribe and translate audio using multiple AI providers (OpenAI, Google, ElevenLabs, Deepgram, Fal, Luma, Replicate, Stability, Runway, OpenRouter, Edge TTS). Use when the user asks to create media assets, generate pictures, make videos, produce voiceovers, transcribe recordings, or work with any visual/audio content.
4
+ compatibility: Requires Node.js 18+ and at least one provider API key configured in .env (Edge TTS is free, no key needed)
5
+ metadata:
6
+ author: Francis Hor <francishoe@gmail.com>
7
+ version: "1.0"
8
+ allowed-tools: Bash(node:*)
9
+ ---
10
+
11
+ # Media Generation
12
+
13
+ Run the CLI at `${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs` with Node.js. Always use `--json` for parseable output.
14
+
15
+ ```bash
16
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs <command> [options] --json
17
+ ```
18
+
19
+ ## Commands
20
+
21
+ | Command | Purpose |
22
+ |---------|---------|
23
+ | `image generate` | Generate images from text prompts |
24
+ | `image edit` | Edit existing images with a prompt |
25
+ | `video generate` | Generate video from text (async) |
26
+ | `video image-to-video` | Animate an image into video |
27
+ | `video extend` | Extend an existing video |
28
+ | `voice tts` | Text to speech synthesis |
29
+ | `voice clone` | Clone a voice from audio samples |
30
+ | `voice isolate` | Isolate voice from background audio |
31
+ | `audio transcribe` | Transcribe audio to text |
32
+ | `audio translate` | Translate audio to another language |
33
+ | `providers list` | List all providers with capabilities, models, and voices |
34
+ | `providers list --configured` | List only configured providers |
35
+ | `providers list --capability <cap>` | Filter by capability |
36
+ | `providers models` | List all models across all providers |
37
+ | `providers models --provider <id>` | List models/voices for a specific provider |
38
+ | `providers models --capability <cap>` | Filter models by capability |
39
+ | `config init` | Initialize project-level config |
40
+ | `config init --global` | Initialize user-level config at ~/.media-gen/ |
41
+ | `config validate` | Check which providers are configured |
42
+ | `job status` | Check async job status |
43
+ | `job download` | Download completed async job result |
44
+
45
+ ## Configuration
46
+
47
+ Defaults are set via `.env` (at project root or `~/.media-gen/.env` for global). With defaults configured, `--provider`, `--model`, and `--voice-id` are all optional:
48
+
49
+ ```bash
50
+ MEDIA_GEN_DEFAULT_PROVIDER=openrouter
51
+ MEDIA_GEN_DEFAULT_MODEL=openai/gpt-image-2
52
+ MEDIA_GEN_VOICE_PROVIDER=edge-tts
53
+ MEDIA_GEN_VOICE_MODEL=
54
+ MEDIA_GEN_VOICE_ID=en-US-EmmaMultilingualNeural
55
+ MEDIA_GEN_VIDEO_PROVIDER=google
56
+ MEDIA_GEN_VIDEO_MODEL=veo-3.1-generate-preview
57
+ MEDIA_GEN_AUDIO_PROVIDER=deepgram
58
+ MEDIA_GEN_AUDIO_MODEL=nova-3
59
+ MEDIA_GEN_LOG_LEVEL=error
60
+ ```
61
+
62
+ ## Examples
63
+
64
+ ### Image generation
65
+
66
+ ```bash
67
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs image generate \
68
+ --prompt "A pixel art fantasy arena" \
69
+ --output ./outputs/arena.png \
70
+ --json
71
+ ```
72
+
73
+ ### Video generation (wait for result)
74
+
75
+ ```bash
76
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs video generate \
77
+ --provider google \
78
+ --model veo-3.1-generate-preview \
79
+ --prompt "A cinematic card pack opening" \
80
+ --duration 8 \
81
+ --output ./outputs/video.mp4 \
82
+ --wait \
83
+ --json
84
+ ```
85
+
86
+ ### Text to speech (Edge TTS - free, no API key)
87
+
88
+ ```bash
89
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs voice tts \
90
+ --provider edge-tts \
91
+ --voice-id en-US-EmmaMultilingualNeural \
92
+ --text "Hello world" \
93
+ --output ./outputs/voice.mp3 \
94
+ --json
95
+ ```
96
+
97
+ ### Text to speech (ElevenLabs)
98
+
99
+ ```bash
100
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs voice tts \
101
+ --provider elevenlabs \
102
+ --voice-id JBFqnCBsd6RMkjVDRZzb \
103
+ --text "Welcome to the show" \
104
+ --output ./outputs/george.mp3 \
105
+ --json
106
+ ```
107
+
108
+ ### Text to speech (Google Gemini TTS)
109
+
110
+ ```bash
111
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs voice tts \
112
+ --provider google \
113
+ --model gemini-3.1-flash-tts-preview \
114
+ --voice-id Kore \
115
+ --text "Say cheerfully: Have a wonderful day!" \
116
+ --output ./outputs/gemini-voice.wav \
117
+ --json
118
+ ```
119
+
120
+ ### Text to speech (OpenAI)
121
+
122
+ ```bash
123
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs voice tts \
124
+ --provider openai \
125
+ --model gpt-4o-mini-tts \
126
+ --voice-id coral \
127
+ --text "Hello from OpenAI" \
128
+ --output ./outputs/openai-voice.mp3 \
129
+ --json
130
+ ```
131
+
132
+ ### Text to speech (with defaults set, minimal)
133
+
134
+ ```bash
135
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs voice tts \
136
+ --text "Just provide text when defaults are configured" \
137
+ --output ./outputs/speech.mp3 \
138
+ --json
139
+ ```
140
+
141
+ ### Transcription
142
+
143
+ ```bash
144
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs audio transcribe \
145
+ --input ./audio/recording.mp3 \
146
+ --output ./outputs/transcript.json \
147
+ --json
148
+ ```
149
+
150
+ ### List supported providers and models
151
+
152
+ ```bash
153
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs providers list --json
154
+ ```
155
+
156
+ ### List voices for a TTS provider
157
+
158
+ ```bash
159
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs providers models --provider edge-tts --json
160
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs providers models --provider elevenlabs --json
161
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs providers models --provider openai --json
162
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs providers models --provider google --json
163
+ ```
164
+
165
+ ### Dry run (validate without calling API)
166
+
167
+ ```bash
168
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs image generate \
169
+ --prompt "test" --dry-run --json
170
+ ```
171
+
172
+ ## Async Video Jobs
173
+
174
+ Video generation is asynchronous. Providers return a job ID instead of a file.
175
+
176
+ ### Pattern 1: Wait for completion (simple)
177
+
178
+ Add `--wait` to block until the video is ready:
179
+
180
+ ```bash
181
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs video generate \
182
+ --provider google \
183
+ --model veo-3.1-generate-preview \
184
+ --prompt "A cinematic scene" \
185
+ --output ./outputs/video.mp4 \
186
+ --wait \
187
+ --poll-interval 5000 \
188
+ --timeout 300000 \
189
+ --json
190
+ ```
191
+
192
+ Returns the final file path when complete.
193
+
194
+ ### Pattern 2: Non-blocking (get job ID, check later)
195
+
196
+ Without `--wait`, the CLI returns immediately with a job ID:
197
+
198
+ ```bash
199
+ # Start generation (returns instantly)
200
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs video generate \
201
+ --provider google \
202
+ --model veo-3.1-generate-preview \
203
+ --prompt "A cinematic scene" \
204
+ --json
205
+ # Returns: {"ok": true, "jobId": "operations/abc123", "status": "processing"}
206
+
207
+ # Check status later
208
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs job status \
209
+ --provider google \
210
+ --job-id "operations/abc123" \
211
+ --json
212
+ # Returns: {"ok": true, "jobId": "...", "status": "completed"}
213
+
214
+ # Download the result
215
+ node ${CLAUDE_SKILL_DIR}/scripts/media-gen.mjs job download \
216
+ --provider google \
217
+ --job-id "operations/abc123" \
218
+ --output ./outputs/video.mp4 \
219
+ --json
220
+ ```
221
+
222
+ ### Async options
223
+
224
+ | Option | Default | Description |
225
+ |--------|---------|-------------|
226
+ | `--wait` | false | Block until job completes |
227
+ | `--poll-interval` | 5000 | Milliseconds between status checks |
228
+ | `--timeout` | 600000 | Max wait time (10 minutes) |
229
+
230
+ ### Async providers
231
+
232
+ Google (Veo), Luma AI, Runway, Fal.ai, and Replicate all use async for video. Image and TTS are always synchronous.
233
+
234
+ ## Response format
235
+
236
+ Success:
237
+ ```json
238
+ {"ok": true, "type": "image", "provider": "openai", "model": "gpt-image-2", "outputFile": "./outputs/image.png", "durationMs": 1200}
239
+ ```
240
+
241
+ Error:
242
+ ```json
243
+ {"ok": false, "error": {"code": "PROVIDER_NOT_CONFIGURED", "message": "Missing OPENAI_API_KEY", "suggestion": "Set OPENAI_API_KEY in .env"}}
244
+ ```
245
+
246
+ ## Rules
247
+
248
+ - Use `--json` for all calls.
249
+ - Use `--dry-run` before expensive operations when unsure.
250
+ - Never use `--overwrite` unless the user confirms.
251
+ - Keep outputs inside the project workspace.
252
+ - For video, use `--wait` only when the user wants the file immediately.
253
+ - Check the `ok` field in every response before proceeding.
254
+ - On error, show the `suggestion` field to the user.
255
+ - For TTS, `--voice-id` is optional when `MEDIA_GEN_VOICE_ID` is set in .env.
256
+ - Edge TTS is free and requires no API key — prefer it for basic TTS tasks.
257
+
258
+ ## Provider Capabilities
259
+
260
+ | Provider | Image | Video | TTS | Transcribe | Translate | Clone | Isolate |
261
+ |----------|-------|-------|-----|------------|-----------|-------|---------|
262
+ | openai | Yes | | Yes | Yes | Yes | | |
263
+ | google | Yes | Yes | Yes | | | | |
264
+ | azure | Yes | | Yes | Yes | Yes | | |
265
+ | elevenlabs | | | Yes | | | Yes | Yes |
266
+ | deepgram | | | Yes | Yes | Yes | | |
267
+ | fal | Yes | Yes | | | | | |
268
+ | luma | | Yes | | | | | |
269
+ | replicate | Yes | Yes | | | | | |
270
+ | stability | Yes | | | | | | |
271
+ | runway | | Yes | | | | | |
272
+ | openrouter | Yes | Yes | | | | | |
273
+ | edge-tts | | | Yes (free) | | | | |
@@ -0,0 +1,46 @@
1
+ @echo off
2
+ REM Install media-gen-cli (Windows CMD)
3
+ setlocal enabledelayedexpansion
4
+
5
+ set "SCRIPT_DIR=%~dp0"
6
+ pushd "%SCRIPT_DIR%\..\..\..\"
7
+ set "PROJECT_DIR=%CD%"
8
+ popd
9
+
10
+ echo Installing media-gen-cli from: %PROJECT_DIR%
11
+
12
+ cd /d "%PROJECT_DIR%"
13
+
14
+ REM Check for Node.js
15
+ where node >nul 2>&1
16
+ if %ERRORLEVEL% neq 0 (
17
+ echo Error: Node.js is required but not installed.
18
+ echo Install it from https://nodejs.org/ ^(v18+^)
19
+ exit /b 1
20
+ )
21
+
22
+ REM Install dependencies
23
+ echo Installing dependencies...
24
+ call npm install --silent
25
+ if %ERRORLEVEL% neq 0 exit /b 1
26
+
27
+ REM Build the CLI
28
+ echo Building CLI...
29
+ call npm run build --silent
30
+ if %ERRORLEVEL% neq 0 exit /b 1
31
+
32
+ REM Verify
33
+ if exist "%PROJECT_DIR%\dist\media-gen.mjs" (
34
+ echo.
35
+ echo [OK] media-gen-cli installed successfully!
36
+ echo.
37
+ echo Run with:
38
+ echo node %PROJECT_DIR%\dist\media-gen.mjs --help
39
+ echo.
40
+ echo Or link globally:
41
+ echo npm link
42
+ echo media-gen --help
43
+ ) else (
44
+ echo Error: Build failed. dist\media-gen.mjs not found.
45
+ exit /b 1
46
+ )
@@ -0,0 +1,58 @@
1
+ # Install media-gen-cli (Windows PowerShell)
2
+ # Compatible with PowerShell 5.1+ and PowerShell Core 7+
3
+ $ErrorActionPreference = "Stop"
4
+
5
+ $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
6
+ $ProjectDir = Resolve-Path (Join-Path $ScriptDir "..\..\..") | Select-Object -ExpandProperty Path
7
+
8
+ Write-Host "Installing media-gen-cli from: $ProjectDir"
9
+
10
+ Set-Location $ProjectDir
11
+
12
+ # Check for Node.js
13
+ try {
14
+ $nodeVersion = & node -v 2>$null
15
+ } catch {
16
+ Write-Host "Error: Node.js is required but not installed." -ForegroundColor Red
17
+ Write-Host "Install it from https://nodejs.org/ (v18+)"
18
+ exit 1
19
+ }
20
+
21
+ if (-not $nodeVersion) {
22
+ Write-Host "Error: Node.js is required but not installed." -ForegroundColor Red
23
+ Write-Host "Install it from https://nodejs.org/ (v18+)"
24
+ exit 1
25
+ }
26
+
27
+ $major = [int]($nodeVersion -replace 'v(\d+)\..*', '$1')
28
+ if ($major -lt 18) {
29
+ Write-Host "Error: Node.js 18+ is required. Found: $nodeVersion" -ForegroundColor Red
30
+ exit 1
31
+ }
32
+
33
+ # Install dependencies
34
+ Write-Host "Installing dependencies..."
35
+ & npm install --silent
36
+ if ($LASTEXITCODE -ne 0) { exit 1 }
37
+
38
+ # Build the CLI
39
+ Write-Host "Building CLI..."
40
+ & npm run build --silent
41
+ if ($LASTEXITCODE -ne 0) { exit 1 }
42
+
43
+ # Verify
44
+ $distPath = Join-Path $ProjectDir "dist\media-gen.mjs"
45
+ if (Test-Path $distPath) {
46
+ Write-Host ""
47
+ Write-Host "media-gen-cli installed successfully!" -ForegroundColor Green
48
+ Write-Host ""
49
+ Write-Host "Run with:"
50
+ Write-Host " node $distPath --help"
51
+ Write-Host ""
52
+ Write-Host "Or link globally:"
53
+ Write-Host " npm link"
54
+ Write-Host " media-gen --help"
55
+ } else {
56
+ Write-Host "Error: Build failed. dist\media-gen.mjs not found." -ForegroundColor Red
57
+ exit 1
58
+ }
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env bash
2
+ # Install media-gen-cli
3
+ # Compatible with Linux, macOS, and Windows (Git Bash/WSL)
4
+ set -e
5
+
6
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
7
+ PROJECT_DIR="$(cd "$SCRIPT_DIR/../../.." && pwd)"
8
+
9
+ echo "Installing media-gen-cli from: $PROJECT_DIR"
10
+
11
+ cd "$PROJECT_DIR"
12
+
13
+ # Check for Node.js
14
+ if ! command -v node &> /dev/null; then
15
+ echo "Error: Node.js is required but not installed."
16
+ echo "Install it from https://nodejs.org/ (v18+)"
17
+ exit 1
18
+ fi
19
+
20
+ NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
21
+ if [ "$NODE_VERSION" -lt 18 ]; then
22
+ echo "Error: Node.js 18+ is required. Found: $(node -v)"
23
+ exit 1
24
+ fi
25
+
26
+ # Install dependencies
27
+ echo "Installing dependencies..."
28
+ npm install --silent
29
+
30
+ # Build the CLI
31
+ echo "Building CLI..."
32
+ npm run build --silent
33
+
34
+ # Verify
35
+ if [ -f "$PROJECT_DIR/dist/media-gen.mjs" ]; then
36
+ echo ""
37
+ echo "✓ media-gen-cli installed successfully!"
38
+ echo ""
39
+ echo "Run with:"
40
+ echo " node $PROJECT_DIR/dist/media-gen.mjs --help"
41
+ echo ""
42
+ echo "Or link globally:"
43
+ echo " npm link"
44
+ echo " media-gen --help"
45
+ else
46
+ echo "Error: Build failed. dist/media-gen.mjs not found."
47
+ exit 1
48
+ fi
@@ -0,0 +1,3 @@
1
+ @echo off
2
+ REM media-gen CLI runner (Windows CMD)
3
+ node "%~dp0media-gen.mjs" %*