icoa-cli 2.19.81 → 2.19.82

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.
@@ -285,21 +285,37 @@ function showPythonInstallGuide() {
285
285
  console.log();
286
286
  let currentPy = '';
287
287
  let pyStatus = 'missing';
288
- try {
289
- const out = execSync('python3 --version', { encoding: 'utf-8', timeout: 3000 }).trim();
290
- currentPy = out.replace('Python ', '');
291
- const parts = currentPy.split('.').map(Number);
292
- if (parts[0] === 3 && parts[1] === 12)
293
- pyStatus = 'ok';
294
- else if (parts[0] === 3 && parts[1] >= 10 && parts[1] < 12)
295
- pyStatus = 'old';
296
- else if (parts[0] === 3 && parts[1] > 12)
297
- pyStatus = 'new';
298
- else
299
- pyStatus = 'missing';
300
- }
301
- catch {
302
- pyStatus = 'missing';
288
+ // Prefer the versioned binary if available. On macOS with Homebrew, `python3`
289
+ // often points to the latest (e.g. 3.13) while python@3.12 is also installed
290
+ // at /opt/homebrew/opt/python@3.12/bin/python3.12. Don't force the user to
291
+ // reinstall just because the default changed.
292
+ const pyProbes = [
293
+ 'python3.12 --version',
294
+ '/opt/homebrew/opt/python@3.12/bin/python3.12 --version',
295
+ '/usr/local/opt/python@3.12/bin/python3.12 --version',
296
+ 'python3 --version',
297
+ ];
298
+ for (const cmd of pyProbes) {
299
+ try {
300
+ const out = execSync(cmd, { encoding: 'utf-8', timeout: 3000 }).trim();
301
+ const ver = out.replace('Python ', '');
302
+ const parts = ver.split('.').map(Number);
303
+ // Only accept as "ok" if this probe returned 3.12. Otherwise keep trying.
304
+ if (parts[0] === 3 && parts[1] === 12) {
305
+ currentPy = ver;
306
+ pyStatus = 'ok';
307
+ break;
308
+ }
309
+ // Remember the last-seen version for fallback reporting
310
+ currentPy = ver;
311
+ if (parts[0] === 3 && parts[1] >= 10 && parts[1] < 12)
312
+ pyStatus = 'old';
313
+ else if (parts[0] === 3 && parts[1] > 12)
314
+ pyStatus = 'new';
315
+ else
316
+ pyStatus = 'missing';
317
+ }
318
+ catch { /* try next probe */ }
303
319
  }
304
320
  if (pyStatus === 'ok') {
305
321
  console.log(chalk.green(` ✓ Python ${currentPy} — you're good!`));
package/dist/repl.js CHANGED
@@ -103,21 +103,35 @@ const VERSION = '2.5.1';
103
103
  // Quick Python version check (used in Selection menu startup warning).
104
104
  // Returns {ok, version, status}. Silent/defensive — any error means 'missing'.
105
105
  function checkPython() {
106
- try {
107
- const out = execSyncFn('python3 --version', { encoding: 'utf-8', timeout: 2000 }).trim();
108
- const version = out.replace('Python ', '');
109
- const [maj, min] = version.split('.').map(Number);
110
- if (maj === 3 && min === 12)
111
- return { ok: true, version, status: 'ok' };
112
- if (maj === 3 && min >= 10 && min < 12)
113
- return { ok: true, version, status: 'old' };
114
- if (maj === 3 && min > 12)
115
- return { ok: true, version, status: 'new' };
116
- return { ok: false, version, status: 'missing' };
117
- }
118
- catch {
119
- return { ok: false, version: '', status: 'missing' };
106
+ // Probe python3.12 first — macOS Homebrew installs python@3.12 alongside a
107
+ // newer default python3, and we don't want to flag a 3.12-ready machine just
108
+ // because the default alias moved to 3.13.
109
+ const probes = [
110
+ 'python3.12 --version',
111
+ '/opt/homebrew/opt/python@3.12/bin/python3.12 --version',
112
+ '/usr/local/opt/python@3.12/bin/python3.12 --version',
113
+ 'python3 --version',
114
+ ];
115
+ let lastVersion = '';
116
+ let lastStatus = 'missing';
117
+ for (const cmd of probes) {
118
+ try {
119
+ const out = execSyncFn(cmd, { encoding: 'utf-8', timeout: 2000 }).trim();
120
+ const version = out.replace('Python ', '');
121
+ const [maj, min] = version.split('.').map(Number);
122
+ if (maj === 3 && min === 12)
123
+ return { ok: true, version, status: 'ok' };
124
+ lastVersion = version;
125
+ if (maj === 3 && min >= 10 && min < 12)
126
+ lastStatus = 'old';
127
+ else if (maj === 3 && min > 12)
128
+ lastStatus = 'new';
129
+ else
130
+ lastStatus = 'missing';
131
+ }
132
+ catch { /* try next probe */ }
120
133
  }
134
+ return { ok: lastStatus !== 'missing', version: lastVersion, status: lastStatus };
121
135
  }
122
136
  function printSelectionMenu() {
123
137
  const stats = getDemoStats();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icoa-cli",
3
- "version": "2.19.81",
3
+ "version": "2.19.82",
4
4
  "description": "ICOA CLI — The world's first CLI-native CTF competition terminal",
5
5
  "type": "module",
6
6
  "bin": {