@mediaproc/cli 0.1.0 ā 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/README.md +228 -52
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +15 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +34 -18
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/convert.d.ts +6 -0
- package/dist/commands/convert.d.ts.map +1 -0
- package/dist/commands/convert.js +74 -0
- package/dist/commands/convert.js.map +1 -0
- package/dist/commands/info.d.ts +6 -0
- package/dist/commands/info.d.ts.map +1 -0
- package/dist/commands/info.js +103 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +41 -15
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/optimize.d.ts +6 -0
- package/dist/commands/optimize.d.ts.map +1 -0
- package/dist/commands/optimize.js +190 -0
- package/dist/commands/optimize.js.map +1 -0
- package/dist/commands/remove.d.ts.map +1 -1
- package/dist/commands/remove.js +22 -4
- package/dist/commands/remove.js.map +1 -1
- package/dist/plugin-manager.d.ts +11 -2
- package/dist/plugin-manager.d.ts.map +1 -1
- package/dist/plugin-manager.js +33 -4
- package/dist/plugin-manager.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MediaProc
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> ⨠**v0.2.0 Released!** - Image Plugin with 40 commands + Universal convert/info/optimize commands
|
|
4
4
|
|
|
5
5
|
Universal media processing CLI with an extensible plugin architecture. One tool to process all your media - images, videos, audio, documents, and more.
|
|
6
6
|
|
|
@@ -128,33 +128,48 @@ mediaproc document compress input.pdf --quality high
|
|
|
128
128
|
|
|
129
129
|
## š Current Status
|
|
130
130
|
|
|
131
|
-
**Version**: 0.
|
|
132
|
-
**Status**:
|
|
133
|
-
**
|
|
134
|
-
**Expected v1.0**:
|
|
131
|
+
**Version**: 0.2.0 (Alpha - Feature Complete Image Plugin!)
|
|
132
|
+
**Status**: ā
Image plugin with 40 commands + Universal CLI commands
|
|
133
|
+
**Next Release**: Video & Audio plugins (Q1 2026)
|
|
134
|
+
**Expected v1.0**: Q2 2026
|
|
135
135
|
|
|
136
|
-
###
|
|
136
|
+
### š Released & Ready to Use (v0.2.0)
|
|
137
|
+
|
|
138
|
+
ā
**Universal CLI Commands** - Work out-of-the-box without plugins
|
|
139
|
+
- `convert` - Auto-detect file type and suggest conversion
|
|
140
|
+
- `info` - Show file details for any media type
|
|
141
|
+
- `optimize` - Auto-optimize with intelligent strategy suggestions
|
|
142
|
+
|
|
143
|
+
ā
**@mediaproc/image Plugin** - 40 professional image processing commands
|
|
144
|
+
- **Transform** (7): resize, crop, rotate, flip, trim, extend, thumbnail
|
|
145
|
+
- **Color & Tone** (6): modulate, gamma, tint, grayscale, negate, normalize
|
|
146
|
+
- **Effects & Filters** (6): blur, sharpen, median, sepia, vignette, pixelate
|
|
147
|
+
- **Advanced Operations** (5): composite, extract, border, clahe, convolve
|
|
148
|
+
- **Smart/AI Operations** (6): smart-crop, auto-enhance, palette, dominant-color, grid, batch
|
|
149
|
+
- **Utility** (10): convert, optimize, compress, watermark, info, stats, split, stack, mirror, metadata
|
|
150
|
+
- Full documentation with 200+ examples and 10 real-world workflows
|
|
137
151
|
|
|
138
152
|
ā
**Architecture** - Plugin system designed and implemented
|
|
139
153
|
ā
**Core CLI** - Command framework with plugin discovery
|
|
154
|
+
ā
**Built-in Plugin System** - Image plugin ships with CLI
|
|
140
155
|
ā
**Plugin Registry** - Smart plugin management
|
|
141
156
|
ā
**Documentation** - Comprehensive guides and standards
|
|
142
|
-
ā
**Community Guidelines** - Contributing, security, code of conduct
|
|
143
|
-
ā
**Third-Party Support** - Standards for community plugins
|
|
157
|
+
ā
**Community Guidelines** - Contributing, security, code of conduct
|
|
144
158
|
|
|
145
|
-
###
|
|
159
|
+
### š§ In Development
|
|
146
160
|
|
|
147
|
-
š§ **
|
|
148
|
-
š§ **
|
|
149
|
-
š§ **
|
|
161
|
+
š§ **Video Plugin** - Format conversion, transcoding, frame extraction
|
|
162
|
+
š§ **Audio Plugin** - Format conversion, normalization, trimming
|
|
163
|
+
š§ **Testing** - Comprehensive test coverage
|
|
150
164
|
š§ **Examples** - Real-world usage examples
|
|
151
165
|
|
|
152
166
|
### What's Next
|
|
153
167
|
|
|
154
|
-
š **
|
|
155
|
-
š **
|
|
156
|
-
š **Plugin
|
|
157
|
-
š **
|
|
168
|
+
š **Video Plugin** - Format conversion, transcoding (Q1 2026)
|
|
169
|
+
š **Audio Plugin** - Format conversion, normalization (Q1 2026)
|
|
170
|
+
š **Document Plugin** - PDF processing, OCR (Q2 2026)
|
|
171
|
+
š **Advanced Plugins** - 3D, streaming, AI features (Q2-Q3 2026)
|
|
172
|
+
š **Plugin Marketplace** - Community plugin directory (Q3 2026)
|
|
158
173
|
|
|
159
174
|
See [Upcoming Features](docs/upcoming-features.md) for detailed roadmap.
|
|
160
175
|
|
|
@@ -162,11 +177,69 @@ See [Upcoming Features](docs/upcoming-features.md) for detailed roadmap.
|
|
|
162
177
|
|
|
163
178
|
## ⨠Features
|
|
164
179
|
|
|
180
|
+
### Core Architecture
|
|
181
|
+
|
|
182
|
+
#### š **Built-in Plugins** (Out of the Box)
|
|
183
|
+
|
|
184
|
+
MediaProc ships with essential plugins pre-installed, giving you immediate productivity:
|
|
185
|
+
|
|
186
|
+
- **@mediaproc/image** - Professional image processing (19 commands)
|
|
187
|
+
- Resize, crop, rotate, flip, convert formats
|
|
188
|
+
- Filters: blur, sharpen, tint, grayscale, median
|
|
189
|
+
- Color adjustments: modulate, gamma, normalize
|
|
190
|
+
- Utilities: thumbnail, watermark, optimize, trim, extend
|
|
191
|
+
|
|
192
|
+
_More built-in plugins coming soon: video, audio, document_
|
|
193
|
+
|
|
194
|
+
#### š **Add-on Plugins** (Install as Needed)
|
|
195
|
+
|
|
196
|
+
Extend functionality by installing additional plugins from npm:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Add more plugins from npm
|
|
200
|
+
mediaproc add animation # GIF, WebP, Lottie optimization
|
|
201
|
+
mediaproc add 3d # glTF, OBJ, FBX processing
|
|
202
|
+
mediaproc add stream # HLS/DASH streaming
|
|
203
|
+
mediaproc add ai # AI-powered enhancements
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
#### š” **Why This Architecture?**
|
|
207
|
+
|
|
208
|
+
**Universal CLI Benefits:**
|
|
209
|
+
|
|
210
|
+
- ā
Get started instantly with built-in plugins
|
|
211
|
+
- ā
Consistent command syntax across all plugins
|
|
212
|
+
- ā
Unified plugin management (`add`, `remove`, `list`)
|
|
213
|
+
- ā
Shared configuration and settings
|
|
214
|
+
- ā
Better integration between different media types
|
|
215
|
+
- ā
One tool to learn instead of many
|
|
216
|
+
|
|
217
|
+
**Standalone Plugin Benefits:**
|
|
218
|
+
|
|
219
|
+
- ā
Each plugin can also run independently
|
|
220
|
+
- ā
Lightweight installs (only what you need)
|
|
221
|
+
- ā
Faster startup for single-purpose usage
|
|
222
|
+
- ā
Easy to distribute and share
|
|
223
|
+
|
|
224
|
+
**Example: Two Ways to Use**
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# Option 1: Use with universal CLI (recommended)
|
|
228
|
+
npm install -g @mediaproc/cli # Includes @mediaproc/image built-in
|
|
229
|
+
mediaproc image resize photo.jpg -w 1920
|
|
230
|
+
|
|
231
|
+
# Option 2: Use plugin standalone (if you only need images)
|
|
232
|
+
npm install -g @mediaproc/image
|
|
233
|
+
mediaproc-image resize photo.jpg -w 1920
|
|
234
|
+
```
|
|
235
|
+
|
|
165
236
|
### Current Features (v0.1.0)
|
|
166
237
|
|
|
167
238
|
#### Core CLI
|
|
168
239
|
|
|
169
240
|
- ā
Plugin discovery and loading
|
|
241
|
+
- ā
Built-in plugins (ship with CLI)
|
|
242
|
+
- ā
Add-on plugins (install from npm)
|
|
170
243
|
- ā
Smart installation (auto-detects global/local)
|
|
171
244
|
- ā
Plugin registry with short names
|
|
172
245
|
- ā
Configuration management
|
|
@@ -175,25 +248,101 @@ See [Upcoming Features](docs/upcoming-features.md) for detailed roadmap.
|
|
|
175
248
|
|
|
176
249
|
#### Plugin Management
|
|
177
250
|
|
|
178
|
-
- `mediaproc
|
|
179
|
-
- `mediaproc
|
|
180
|
-
- `mediaproc
|
|
251
|
+
- `mediaproc list` - List all plugins (built-in and installed)
|
|
252
|
+
- `mediaproc add <plugin>` - Install add-on plugins from npm
|
|
253
|
+
- `mediaproc remove <plugin>` - Uninstall add-on plugins
|
|
181
254
|
- `mediaproc plugins` - Show available plugins
|
|
182
255
|
- `mediaproc init` - Initialize configuration
|
|
183
256
|
- `mediaproc config` - Manage settings
|
|
184
257
|
|
|
185
|
-
|
|
258
|
+
#### Universal Commands (Work Without Plugins)
|
|
259
|
+
|
|
260
|
+
- `mediaproc convert <input> <output>` - Auto-detect and convert any media file
|
|
261
|
+
- `mediaproc info <file>` - Show file information for any media type
|
|
262
|
+
- `mediaproc optimize <file>` - Suggest optimization strategy based on file type
|
|
263
|
+
|
|
264
|
+
#### Image Processing (@mediaproc/image) ā
BUILT-IN
|
|
265
|
+
|
|
266
|
+
**40 Professional Commands Ready to Use:**
|
|
267
|
+
|
|
268
|
+
**Transform & Resize** (7 commands)
|
|
269
|
+
|
|
270
|
+
- `resize` - Resize with fit modes (cover, contain, fill, inside, outside)
|
|
271
|
+
- `crop` - Extract rectangular regions with positioning
|
|
272
|
+
- `rotate` - Any angle rotation with background control
|
|
273
|
+
- `flip` - Horizontal/vertical/both mirroring
|
|
274
|
+
- `trim` - Auto-remove uniform borders
|
|
275
|
+
- `extend` - Add padding/borders with custom colors
|
|
276
|
+
- `thumbnail` - Generate thumbnails (64px to 512px)
|
|
277
|
+
|
|
278
|
+
**Color & Tone** (6 commands)
|
|
279
|
+
|
|
280
|
+
- `modulate` - Adjust brightness, saturation, hue
|
|
281
|
+
- `gamma` - Gamma correction for midtones (0.1-3.0)
|
|
282
|
+
- `tint` - Apply color tint overlays (RGB hex)
|
|
283
|
+
- `grayscale` - Convert to black & white
|
|
284
|
+
- `negate` - Create negative/inverted images
|
|
285
|
+
- `normalize` - Auto-enhance contrast and brightness
|
|
186
286
|
|
|
187
|
-
|
|
287
|
+
**Effects & Filters** (6 commands)
|
|
188
288
|
|
|
189
|
-
-
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
-
|
|
193
|
-
-
|
|
194
|
-
-
|
|
289
|
+
- `blur` - Gaussian blur (0.3-1000 sigma)
|
|
290
|
+
- `sharpen` - Enhance details and edges (flat/jagged modes)
|
|
291
|
+
- `median` - Noise reduction filter (1-50 size)
|
|
292
|
+
- `sepia` - Vintage sepia tone effect
|
|
293
|
+
- `vignette` - Darken edges for artistic focus
|
|
294
|
+
- `pixelate` - Retro pixel art effect (custom pixel size)
|
|
195
295
|
|
|
196
|
-
|
|
296
|
+
**Advanced Operations** (5 commands)
|
|
297
|
+
|
|
298
|
+
- `composite` - Layer images with blend modes (overlay, multiply, screen)
|
|
299
|
+
- `extract` - Extract color channels (red, green, blue, alpha)
|
|
300
|
+
- `border` - Add decorative frames with custom colors
|
|
301
|
+
- `clahe` - Contrast-limited adaptive histogram equalization
|
|
302
|
+
- `convolve` - Apply custom convolution kernels (sharpen, emboss, edge)
|
|
303
|
+
|
|
304
|
+
**Smart/AI Operations** (6 commands)
|
|
305
|
+
|
|
306
|
+
- `smart-crop` - Intelligent content-aware cropping (attention/entropy)
|
|
307
|
+
- `auto-enhance` - Automatic color and contrast enhancement
|
|
308
|
+
- `palette` - Extract dominant color palettes (2-256 colors)
|
|
309
|
+
- `dominant-color` - Quick dominant color extraction
|
|
310
|
+
- `grid` - Combine images into collage layouts
|
|
311
|
+
- `batch` - Process multiple images at once with any operation
|
|
312
|
+
|
|
313
|
+
**Utility** (10 commands)
|
|
314
|
+
|
|
315
|
+
- `convert` - Format conversion (JPG, PNG, WebP, AVIF, TIFF, GIF)
|
|
316
|
+
- `optimize` - Size optimization (up to 70% reduction, lossless/lossy)
|
|
317
|
+
- `compress` - Advanced compression with quality control
|
|
318
|
+
- `watermark` - Add watermarks with positioning and opacity
|
|
319
|
+
- `info` - Display detailed image metadata
|
|
320
|
+
- `stats` - Technical image statistics (channels, depth, color space)
|
|
321
|
+
- `split` - Split image into grid tiles
|
|
322
|
+
- `stack` - Stack images horizontally/vertically
|
|
323
|
+
- `mirror` - Create mirror/kaleidoscope effects
|
|
324
|
+
- `metadata` - View, export, or remove EXIF data
|
|
325
|
+
|
|
326
|
+
**Format Support:**
|
|
327
|
+
|
|
328
|
+
- Input: JPG, PNG, WebP, AVIF, TIFF, GIF, SVG, HEIF
|
|
329
|
+
- Output: JPG, PNG, WebP, AVIF, TIFF, GIF
|
|
330
|
+
- Modern formats: WebP (25-35% smaller), AVIF (50% smaller)
|
|
331
|
+
|
|
332
|
+
**Professional Features:**
|
|
333
|
+
|
|
334
|
+
- Quality control (1-100)
|
|
335
|
+
- Dry-run mode (preview before executing)
|
|
336
|
+
- Verbose logging
|
|
337
|
+
- Built-in help for every command
|
|
338
|
+
- Comprehensive error handling
|
|
339
|
+
- File size reporting
|
|
340
|
+
|
|
341
|
+
See [plugins/image/README.md](plugins/image/README.md) for complete image plugin documentation.
|
|
342
|
+
|
|
343
|
+
### Planned Features (Add-on Plugins)
|
|
344
|
+
|
|
345
|
+
#### Video Processing (@mediaproc/video) - Q1 2026
|
|
197
346
|
|
|
198
347
|
- Format transcoding (MP4, WebM, AVI, MKV)
|
|
199
348
|
- Codec conversion (H.264, H.265, VP9, AV1)
|
|
@@ -203,7 +352,7 @@ See [Upcoming Features](docs/upcoming-features.md) for detailed roadmap.
|
|
|
203
352
|
- Video merging
|
|
204
353
|
- Audio track management
|
|
205
354
|
|
|
206
|
-
#### Audio Processing (Q1 2026
|
|
355
|
+
#### Audio Processing (@mediaproc/audio) - Q1 2026
|
|
207
356
|
|
|
208
357
|
- Format conversion (MP3, AAC, FLAC, WAV, OGG)
|
|
209
358
|
- Normalization and loudness adjustment
|
|
@@ -212,6 +361,10 @@ See [Upcoming Features](docs/upcoming-features.md) for detailed roadmap.
|
|
|
212
361
|
- Multi-track merging
|
|
213
362
|
- Bitrate control
|
|
214
363
|
|
|
364
|
+
#### Document Processing (@mediaproc/document) - Q2 2026
|
|
365
|
+
|
|
366
|
+
- Bitrate control
|
|
367
|
+
|
|
215
368
|
#### Document Processing (Q2 2026)
|
|
216
369
|
|
|
217
370
|
- PDF compression
|
|
@@ -250,11 +403,16 @@ See [docs/upcoming-features.md](docs/upcoming-features.md) for complete feature
|
|
|
250
403
|
#### From npm (when published)
|
|
251
404
|
|
|
252
405
|
```bash
|
|
253
|
-
# Install
|
|
406
|
+
# Install the universal CLI (includes built-in plugins)
|
|
254
407
|
npm install -g @mediaproc/cli
|
|
255
408
|
|
|
256
|
-
#
|
|
409
|
+
# Start using immediately - image plugin is built-in!
|
|
410
|
+
mediaproc image resize photo.jpg -w 1920
|
|
411
|
+
mediaproc image convert photo.jpg -f webp
|
|
412
|
+
|
|
413
|
+
# Check version and list plugins
|
|
257
414
|
mediaproc --version
|
|
415
|
+
mediaproc list
|
|
258
416
|
```
|
|
259
417
|
|
|
260
418
|
#### From Source (current)
|
|
@@ -267,49 +425,57 @@ cd mediaproc
|
|
|
267
425
|
# Install dependencies
|
|
268
426
|
pnpm install
|
|
269
427
|
|
|
270
|
-
# Build all packages
|
|
271
|
-
pnpm build
|
|
428
|
+
# Build all packages (including built-in plugins)
|
|
429
|
+
pnpm build:all
|
|
272
430
|
|
|
273
431
|
# Link globally
|
|
274
|
-
pnpm link --global
|
|
432
|
+
cd plugins/image && pnpm link --global
|
|
433
|
+
cd ../.. && pnpm link --global
|
|
275
434
|
|
|
276
435
|
# Verify
|
|
277
436
|
mediaproc --version
|
|
437
|
+
mediaproc list # Should show @mediaproc/image as built-in
|
|
278
438
|
```
|
|
279
439
|
|
|
280
440
|
### Basic Usage
|
|
281
441
|
|
|
282
442
|
```bash
|
|
283
|
-
#
|
|
284
|
-
mediaproc add image
|
|
285
|
-
|
|
286
|
-
# Process an image (when implemented)
|
|
443
|
+
# Image processing (built-in - works immediately!)
|
|
287
444
|
mediaproc image resize photo.jpg --width 1920 --height 1080
|
|
445
|
+
mediaproc image convert photo.jpg -f webp -q 85
|
|
446
|
+
mediaproc image thumbnail photo.jpg -s 300
|
|
288
447
|
|
|
289
|
-
# Get help
|
|
448
|
+
# Get help anytime
|
|
290
449
|
mediaproc --help
|
|
291
450
|
mediaproc image --help
|
|
292
451
|
mediaproc image resize --help
|
|
293
452
|
```
|
|
294
453
|
|
|
295
|
-
###
|
|
454
|
+
### Adding More Plugins
|
|
296
455
|
|
|
297
456
|
```bash
|
|
298
|
-
# Install
|
|
299
|
-
mediaproc add video
|
|
300
|
-
mediaproc add audio
|
|
301
|
-
mediaproc add document
|
|
457
|
+
# Install additional plugins from npm
|
|
458
|
+
mediaproc add video # Video processing
|
|
459
|
+
mediaproc add audio # Audio processing
|
|
460
|
+
mediaproc add document # PDF processing
|
|
302
461
|
|
|
303
|
-
#
|
|
304
|
-
|
|
305
|
-
mediaproc instagram filter photo.jpg --style vintage
|
|
462
|
+
# View all plugins (built-in + installed)
|
|
463
|
+
mediaproc list
|
|
306
464
|
|
|
307
|
-
#
|
|
308
|
-
|
|
465
|
+
# Example output:
|
|
466
|
+
# š¦ Built-in Plugins:
|
|
467
|
+
# ā image ā
BUILT-IN
|
|
468
|
+
#
|
|
469
|
+
# š User-Installed:
|
|
470
|
+
# ā video
|
|
471
|
+
# ā audio
|
|
472
|
+
```
|
|
309
473
|
|
|
310
474
|
# View installed plugins
|
|
475
|
+
|
|
311
476
|
mediaproc list
|
|
312
|
-
|
|
477
|
+
|
|
478
|
+
````
|
|
313
479
|
|
|
314
480
|
---
|
|
315
481
|
|
|
@@ -376,6 +542,16 @@ Comprehensive documentation is available in the [docs/](docs/) folder:
|
|
|
376
542
|
- Phase 3: AI & future-proof (Q4 2026)
|
|
377
543
|
- Long-term vision (2027+)
|
|
378
544
|
|
|
545
|
+
### Plugin Documentation
|
|
546
|
+
|
|
547
|
+
- **[Image Plugin Documentation](docs/image-plugin-documentation.md)** - Complete reference for the Image Plugin
|
|
548
|
+
- All 40 commands documented
|
|
549
|
+
- Usage examples and workflows
|
|
550
|
+
- Best practices and tips
|
|
551
|
+
- Social media presets
|
|
552
|
+
- Real-world use cases
|
|
553
|
+
- Troubleshooting guide
|
|
554
|
+
|
|
379
555
|
### Community Guides
|
|
380
556
|
|
|
381
557
|
- **[Contributing](CONTRIBUTING.md)** - How to contribute to MediaProc
|
|
@@ -434,7 +610,7 @@ mediaproc image watermark photo.jpg --text "Ā© 2025" --position bottom-right
|
|
|
434
610
|
for img in photos/*.jpg; do
|
|
435
611
|
mediaproc image convert "$img" --format webp --quality 85
|
|
436
612
|
done
|
|
437
|
-
|
|
613
|
+
````
|
|
438
614
|
|
|
439
615
|
### Video Processing
|
|
440
616
|
|
|
@@ -503,7 +679,7 @@ steps:
|
|
|
503
679
|
mediaproc run workflow.yaml --input images/ --output optimized/
|
|
504
680
|
```
|
|
505
681
|
|
|
506
|
-
_Note:
|
|
682
|
+
_Note: Image processing commands are **fully implemented and ready to use**! Video, audio, and other commands are planned for Q1-Q2 2026. See [Current Status](#-current-status) for details._
|
|
507
683
|
|
|
508
684
|
---
|
|
509
685
|
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA4BA,wBAAsB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAwCzC"}
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
+
import { readFileSync } from 'fs';
|
|
5
|
+
import { join, dirname } from 'path';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
4
7
|
import { PluginManager } from './plugin-manager.js';
|
|
5
8
|
import { addCommand } from './commands/add.js';
|
|
6
9
|
import { removeCommand } from './commands/remove.js';
|
|
@@ -10,13 +13,20 @@ import { initCommand } from './commands/init.js';
|
|
|
10
13
|
import { configCommand } from './commands/config.js';
|
|
11
14
|
import { runCommand } from './commands/run.js';
|
|
12
15
|
import { validateCommand } from './commands/validate.js';
|
|
16
|
+
import { convertCommand } from './commands/convert.js';
|
|
17
|
+
import { infoCommand } from './commands/info.js';
|
|
18
|
+
import { optimizeCommand } from './commands/optimize.js';
|
|
13
19
|
const program = new Command();
|
|
14
20
|
const pluginManager = new PluginManager();
|
|
21
|
+
// Get version from package.json
|
|
22
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
23
|
+
const __dirname = dirname(__filename);
|
|
24
|
+
const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));
|
|
15
25
|
export async function cli() {
|
|
16
26
|
program
|
|
17
27
|
.name('mediaproc')
|
|
18
28
|
.description('Modern, plugin-based media processing CLI')
|
|
19
|
-
.version(
|
|
29
|
+
.version(packageJson.version);
|
|
20
30
|
// Plugin management commands
|
|
21
31
|
addCommand(program, pluginManager);
|
|
22
32
|
removeCommand(program, pluginManager);
|
|
@@ -25,6 +35,10 @@ export async function cli() {
|
|
|
25
35
|
// Project management commands
|
|
26
36
|
initCommand(program);
|
|
27
37
|
configCommand(program);
|
|
38
|
+
// Universal commands (work without plugins)
|
|
39
|
+
convertCommand(program);
|
|
40
|
+
infoCommand(program);
|
|
41
|
+
optimizeCommand(program);
|
|
28
42
|
// Utility commands
|
|
29
43
|
runCommand(program);
|
|
30
44
|
validateCommand(program);
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAC9B,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,GAAG;IACvB,OAAO;SACJ,IAAI,CAAC,WAAW,CAAC;SACjB,WAAW,CAAC,2CAA2C,CAAC;SACxD,OAAO,CAAC,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAA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@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmEpD"}
|
package/dist/commands/config.js
CHANGED
|
@@ -14,9 +14,17 @@ export function configCommand(program) {
|
|
|
14
14
|
console.log(chalk.yellow('No config file found. Run: mediaproc init'));
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
try {
|
|
18
|
+
const config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
19
|
+
console.log(chalk.bold('\nCurrent Configuration:\n'));
|
|
20
|
+
console.log(JSON.stringify(config, null, 2));
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
console.error(chalk.red('ā Failed to parse config file (corrupted JSON)'));
|
|
24
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
25
|
+
console.error(chalk.dim(errorMessage));
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
20
28
|
});
|
|
21
29
|
configCmd
|
|
22
30
|
.command('set <key> <value>')
|
|
@@ -27,24 +35,32 @@ export function configCommand(program) {
|
|
|
27
35
|
console.log(chalk.yellow('No config file found. Run: mediaproc init'));
|
|
28
36
|
return;
|
|
29
37
|
}
|
|
30
|
-
const config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
31
|
-
// Simple dot notation support
|
|
32
|
-
const keys = key.split('.');
|
|
33
|
-
let current = config;
|
|
34
|
-
for (let i = 0; i < keys.length - 1; i++) {
|
|
35
|
-
if (!current[keys[i]])
|
|
36
|
-
current[keys[i]] = {};
|
|
37
|
-
current = current[keys[i]];
|
|
38
|
-
}
|
|
39
|
-
// Try to parse value as JSON, fallback to string
|
|
40
38
|
try {
|
|
41
|
-
|
|
39
|
+
const config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
40
|
+
// Simple dot notation support
|
|
41
|
+
const keys = key.split('.');
|
|
42
|
+
let current = config;
|
|
43
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
44
|
+
if (!current[keys[i]])
|
|
45
|
+
current[keys[i]] = {};
|
|
46
|
+
current = current[keys[i]];
|
|
47
|
+
}
|
|
48
|
+
// Try to parse value as JSON, fallback to string
|
|
49
|
+
try {
|
|
50
|
+
current[keys[keys.length - 1]] = JSON.parse(value);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
current[keys[keys.length - 1]] = value;
|
|
54
|
+
}
|
|
55
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
56
|
+
console.log(chalk.green(`ā Set ${key} = ${value}`));
|
|
42
57
|
}
|
|
43
|
-
catch {
|
|
44
|
-
|
|
58
|
+
catch (error) {
|
|
59
|
+
console.error(chalk.red('ā Failed to parse or update config file'));
|
|
60
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
61
|
+
console.error(chalk.dim(errorMessage));
|
|
62
|
+
process.exit(1);
|
|
45
63
|
}
|
|
46
|
-
writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
47
|
-
console.log(chalk.green(`ā Set ${key} = ${value}`));
|
|
48
64
|
});
|
|
49
65
|
}
|
|
50
66
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AA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,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5E,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;YACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../src/commands/convert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmErD"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { extname } from 'path';
|
|
3
|
+
import { existsSync } from 'fs';
|
|
4
|
+
/**
|
|
5
|
+
* Universal convert command - auto-detects file type and suggests appropriate plugin
|
|
6
|
+
*/
|
|
7
|
+
export function convertCommand(program) {
|
|
8
|
+
program
|
|
9
|
+
.command('convert <input> <output>')
|
|
10
|
+
.description('Universal converter - auto-detects file type and converts')
|
|
11
|
+
.option('-q, --quality <number>', 'Quality (1-100)', '85')
|
|
12
|
+
.option('-f, --force', 'Overwrite existing output file')
|
|
13
|
+
.option('-v, --verbose', 'Verbose output')
|
|
14
|
+
.action((input, output, options) => {
|
|
15
|
+
if (!existsSync(input)) {
|
|
16
|
+
console.error(chalk.red(`ā Input file not found: ${input}`));
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
if (existsSync(output) && !options.force) {
|
|
20
|
+
console.error(chalk.red(`ā Output file already exists: ${output}`));
|
|
21
|
+
console.log(chalk.dim('Use --force to overwrite'));
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
const inputExt = extname(input).toLowerCase().slice(1);
|
|
25
|
+
const outputExt = extname(output).toLowerCase().slice(1);
|
|
26
|
+
// Detect media type and suggest plugin
|
|
27
|
+
const imageExts = ['jpg', 'jpeg', 'png', 'webp', 'gif', 'bmp', 'tiff', 'avif', 'heif', 'svg'];
|
|
28
|
+
const videoExts = ['mp4', 'webm', 'mkv', 'avi', 'mov', 'flv', 'wmv', 'm4v', 'mpg', 'mpeg'];
|
|
29
|
+
const audioExts = ['mp3', 'wav', 'ogg', 'flac', 'aac', 'm4a', 'wma', 'opus'];
|
|
30
|
+
const documentExts = ['pdf', 'docx', 'doc', 'pptx', 'ppt', 'xlsx', 'xls', 'epub'];
|
|
31
|
+
const modelExts = ['gltf', 'glb', 'obj', 'fbx', 'usdz'];
|
|
32
|
+
let pluginName = '';
|
|
33
|
+
let mediaType = '';
|
|
34
|
+
if (imageExts.includes(inputExt) || imageExts.includes(outputExt)) {
|
|
35
|
+
pluginName = 'image';
|
|
36
|
+
mediaType = 'image';
|
|
37
|
+
}
|
|
38
|
+
else if (videoExts.includes(inputExt) || videoExts.includes(outputExt)) {
|
|
39
|
+
pluginName = 'video';
|
|
40
|
+
mediaType = 'video';
|
|
41
|
+
}
|
|
42
|
+
else if (audioExts.includes(inputExt) || audioExts.includes(outputExt)) {
|
|
43
|
+
pluginName = 'audio';
|
|
44
|
+
mediaType = 'audio';
|
|
45
|
+
}
|
|
46
|
+
else if (documentExts.includes(inputExt) || documentExts.includes(outputExt)) {
|
|
47
|
+
pluginName = 'document';
|
|
48
|
+
mediaType = 'document';
|
|
49
|
+
}
|
|
50
|
+
else if (modelExts.includes(inputExt) || modelExts.includes(outputExt)) {
|
|
51
|
+
pluginName = '3d';
|
|
52
|
+
mediaType = '3D model';
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
console.error(chalk.red(`ā Unsupported file format: ${inputExt} ā ${outputExt}`));
|
|
56
|
+
console.log(chalk.yellow('\nš” Supported formats:'));
|
|
57
|
+
console.log(chalk.dim(' Images: jpg, png, webp, gif, avif, heif, svg'));
|
|
58
|
+
console.log(chalk.dim(' Videos: mp4, webm, mkv, avi, mov'));
|
|
59
|
+
console.log(chalk.dim(' Audio: mp3, wav, ogg, flac, aac'));
|
|
60
|
+
console.log(chalk.dim(' Documents: pdf, docx, pptx, epub'));
|
|
61
|
+
console.log(chalk.dim(' 3D Models: gltf, glb, obj, fbx'));
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
console.log(chalk.blue(`šÆ Detected ${mediaType} conversion`));
|
|
65
|
+
console.log(chalk.dim(` ${inputExt.toUpperCase()} ā ${outputExt.toUpperCase()}`));
|
|
66
|
+
console.log('');
|
|
67
|
+
console.log(chalk.yellow(`ā” Quick command:`));
|
|
68
|
+
console.log(chalk.cyan(` mediaproc ${pluginName} convert ${input} ${output} --quality ${options.quality || 85}`));
|
|
69
|
+
console.log('');
|
|
70
|
+
console.log(chalk.dim(`š” Install plugin: mediaproc add ${pluginName}`));
|
|
71
|
+
console.log(chalk.dim(` Then run the command above`));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=convert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../src/commands/convert.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEhC;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,OAAO;SACJ,OAAO,CAAC,0BAA0B,CAAC;SACnC,WAAW,CAAC,2DAA2D,CAAC;SACxE,MAAM,CAAC,wBAAwB,EAAE,iBAAiB,EAAE,IAAI,CAAC;SACzD,MAAM,CAAC,aAAa,EAAE,gCAAgC,CAAC;SACvD,MAAM,CAAC,eAAe,EAAE,gBAAgB,CAAC;SACzC,MAAM,CAAC,CAAC,KAAa,EAAE,MAAc,EAAE,OAAiE,EAAE,EAAE;QAC3G,IAAI,CAA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