myaiforone 1.0.5 → 1.0.6
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/bin/cli.js +25 -0
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -537,6 +537,31 @@ function printFinal() {
|
|
|
537
537
|
async function main() {
|
|
538
538
|
printBanner();
|
|
539
539
|
|
|
540
|
+
// ── Version check — warn if running a stale cached version ───────
|
|
541
|
+
try {
|
|
542
|
+
const pkg = JSON.parse(readFileSync(join(PROJECT_ROOT, 'package.json'), 'utf8'));
|
|
543
|
+
const localVersion = pkg.version;
|
|
544
|
+
const res = await fetch('https://registry.npmjs.org/myaiforone/latest', { signal: AbortSignal.timeout(5000) });
|
|
545
|
+
if (res.ok) {
|
|
546
|
+
const data = await res.json();
|
|
547
|
+
const latestVersion = data.version;
|
|
548
|
+
if (localVersion !== latestVersion) {
|
|
549
|
+
console.log(' ⚠ You\'re running myaiforone@' + localVersion + ' but ' + latestVersion + ' is available.');
|
|
550
|
+
console.log(' ⚠ Run: npx myaiforone@latest');
|
|
551
|
+
console.log(' ⚠ Or: npx clear-npx-cache && npx myaiforone');
|
|
552
|
+
console.log('');
|
|
553
|
+
const answer = await ask(' Continue with ' + localVersion + ' anyway? (y/n) ');
|
|
554
|
+
if (answer.toLowerCase() !== 'y') {
|
|
555
|
+
console.log('');
|
|
556
|
+
console.log(' Run: npx myaiforone@latest');
|
|
557
|
+
console.log('');
|
|
558
|
+
process.exit(0);
|
|
559
|
+
}
|
|
560
|
+
console.log('');
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
} catch { /* network unavailable — skip version check */ }
|
|
564
|
+
|
|
540
565
|
console.log(' Here\'s what we\'ll do:');
|
|
541
566
|
console.log('');
|
|
542
567
|
for (let i = 0; i < STEPS.length; i++) {
|