snow-ai 0.2.1 → 0.2.3
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/dist/cli.js +21 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { render } from 'ink';
|
|
4
4
|
import meow from 'meow';
|
|
5
|
+
import { execSync } from 'child_process';
|
|
5
6
|
import App from './app.js';
|
|
6
7
|
const cli = meow(`
|
|
7
8
|
Usage
|
|
@@ -10,10 +11,29 @@ const cli = meow(`
|
|
|
10
11
|
Options
|
|
11
12
|
--help Show help
|
|
12
13
|
--version Show version
|
|
14
|
+
--update Update to latest version
|
|
13
15
|
`, {
|
|
14
16
|
importMeta: import.meta,
|
|
15
|
-
flags: {
|
|
17
|
+
flags: {
|
|
18
|
+
update: {
|
|
19
|
+
type: 'boolean',
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
16
23
|
});
|
|
24
|
+
// Handle update flag
|
|
25
|
+
if (cli.flags.update) {
|
|
26
|
+
console.log('🔄 Updating snow-ai to latest version...');
|
|
27
|
+
try {
|
|
28
|
+
execSync('npm install -g snow-ai@latest', { stdio: 'inherit' });
|
|
29
|
+
console.log('✅ Update completed successfully!');
|
|
30
|
+
process.exit(0);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
console.error('❌ Update failed:', error instanceof Error ? error.message : error);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
17
37
|
// Disable bracketed paste mode on startup
|
|
18
38
|
process.stdout.write('\x1b[?2004l');
|
|
19
39
|
// Re-enable on exit to avoid polluting parent shell
|