mix-id 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/cli.mjs +28 -2
  2. package/package.json +1 -1
package/cli.mjs CHANGED
@@ -67,11 +67,37 @@ if (!input || flags.help) {
67
67
 
68
68
  // --- Preflight checks ---
69
69
 
70
- if (!hasCommand('ffmpeg') || !hasCommand('ffprobe')) {
71
- console.error('āŒ ffmpeg is required. Install: brew install ffmpeg');
70
+ async function ensureDeps() {
71
+ const missing = [];
72
+ if (!hasCommand('ffmpeg') || !hasCommand('ffprobe')) missing.push('ffmpeg');
73
+ if (isURL && !hasCommand('yt-dlp')) missing.push('yt-dlp');
74
+
75
+ if (missing.length === 0) return;
76
+
77
+ // Try auto-install via brew
78
+ if (hasCommand('brew')) {
79
+ console.log(`\nšŸ“¦ Installing missing dependencies: ${missing.join(', ')}...\n`);
80
+ const { execSync } = await import('child_process');
81
+ try {
82
+ execSync(`brew install ${missing.join(' ')}`, { stdio: 'inherit' });
83
+ console.log('');
84
+ return;
85
+ } catch {
86
+ console.error(`\nāŒ Auto-install failed. Please run manually:`);
87
+ console.error(` brew install ${missing.join(' ')}`);
88
+ process.exit(1);
89
+ }
90
+ }
91
+
92
+ console.error(`\nāŒ Missing dependencies: ${missing.join(', ')}`);
93
+ console.error(`\n Install with:`);
94
+ console.error(` brew install ${missing.join(' ')} (macOS)`);
95
+ console.error(` apt install ${missing.join(' ')} (Linux)`);
72
96
  process.exit(1);
73
97
  }
74
98
 
99
+ await ensureDeps();
100
+
75
101
  // --- Resolve input ---
76
102
 
77
103
  const isURL = /^https?:\/\//i.test(input);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mix-id",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Identify tracks in any DJ mix — from a file or URL. Outputs tracklists as TXT, CUE, and JSON.",
5
5
  "type": "module",
6
6
  "bin": {