@sallmarta/eye-hate-agent 1.0.12 → 1.0.13
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/eha.js +21 -5
- package/package.json +1 -1
package/bin/eha.js
CHANGED
|
@@ -137,11 +137,27 @@ async function checkForUpdates() {
|
|
|
137
137
|
|
|
138
138
|
const latest = data.version;
|
|
139
139
|
if (latest && latest !== pkg.version) {
|
|
140
|
-
console.log(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
)
|
|
144
|
-
|
|
140
|
+
console.log(chalk.yellow(` Update available: ${pkg.version} → ${latest}`));
|
|
141
|
+
|
|
142
|
+
const isInteractive = process.stdin.isTTY && process.stdout.isTTY;
|
|
143
|
+
if (isInteractive) {
|
|
144
|
+
const confirmed = await promptConfirm(' Would you like to auto-update EHA now?', true);
|
|
145
|
+
if (confirmed) {
|
|
146
|
+
console.log(chalk.blue(' Updating EHA globally...'));
|
|
147
|
+
try {
|
|
148
|
+
require('node:child_process').execSync('npm i -g @sallmarta/eye-hate-agent', { stdio: 'inherit' });
|
|
149
|
+
console.log(chalk.green(' ✓ Update successful! Please run the command again.'));
|
|
150
|
+
process.exit(0);
|
|
151
|
+
} catch (err) {
|
|
152
|
+
console.log(chalk.red(' Update failed. Please run manually: npm i -g @sallmarta/eye-hate-agent'));
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
console.log('');
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
console.log(chalk.gray(` — run npm i -g @sallmarta/eye-hate-agent`));
|
|
159
|
+
console.log('');
|
|
160
|
+
}
|
|
145
161
|
}
|
|
146
162
|
} catch {
|
|
147
163
|
// Silently ignore — no network, no problem
|