voyageai-cli 1.20.1 ā 1.20.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/package.json +1 -1
- package/src/commands/app.js +66 -14
package/package.json
CHANGED
package/src/commands/app.js
CHANGED
|
@@ -64,17 +64,57 @@ function registerApp(program) {
|
|
|
64
64
|
|
|
65
65
|
// --download: fetch latest GitHub release and open download URL
|
|
66
66
|
if (opts.download) {
|
|
67
|
-
|
|
67
|
+
// Try /releases/latest first, then scan all releases for app-v* tags
|
|
68
|
+
const latestUrl = 'https://api.github.com/repos/mrlynn/voyageai-cli/releases/latest';
|
|
69
|
+
const allUrl = 'https://api.github.com/repos/mrlynn/voyageai-cli/releases?per_page=10';
|
|
68
70
|
try {
|
|
69
71
|
console.log('š Checking for the latest desktop app release...');
|
|
70
|
-
|
|
72
|
+
|
|
73
|
+
let release;
|
|
74
|
+
try {
|
|
75
|
+
release = await fetchJSON(latestUrl);
|
|
76
|
+
} catch {
|
|
77
|
+
// /releases/latest might 404 ā fall back to scanning
|
|
78
|
+
release = null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// If latest release has no assets or isn't an app release, scan all
|
|
82
|
+
if (!release || !release.assets || release.assets.length === 0) {
|
|
83
|
+
const releases = await fetchJSON(allUrl);
|
|
84
|
+
release = releases.find(
|
|
85
|
+
(r) => !r.draft && !r.prerelease && r.assets && r.assets.length > 0
|
|
86
|
+
&& r.tag_name && r.tag_name.startsWith('app-v')
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (!release || !release.assets) {
|
|
91
|
+
console.log('\nā No desktop app releases found on GitHub.');
|
|
92
|
+
console.log(' Run \'vai playground\' for the web version instead.');
|
|
93
|
+
console.log(' Or visit: https://github.com/mrlynn/voyageai-cli/releases');
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
71
96
|
|
|
72
97
|
const extMap = { darwin: '.dmg', win32: '.exe', linux: '.AppImage' };
|
|
73
98
|
const ext = extMap[process.platform];
|
|
74
99
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
100
|
+
if (!ext) {
|
|
101
|
+
console.log(`\nā No desktop app available for ${process.platform}.`);
|
|
102
|
+
console.log(' Run \'vai playground\' for the web version instead.');
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Find matching asset ā prefer arch-specific on macOS (arm64 vs x64)
|
|
107
|
+
const candidates = release.assets.filter((a) => a.name.endsWith(ext));
|
|
108
|
+
let asset = null;
|
|
109
|
+
|
|
110
|
+
if (candidates.length > 1 && process.platform === 'darwin') {
|
|
111
|
+
const arch = process.arch; // 'arm64' or 'x64'
|
|
112
|
+
asset = candidates.find((a) => a.name.includes(arch))
|
|
113
|
+
|| candidates.find((a) => a.name.includes('arm64')) // default to arm64
|
|
114
|
+
|| candidates[0];
|
|
115
|
+
} else {
|
|
116
|
+
asset = candidates[0] || null;
|
|
117
|
+
}
|
|
78
118
|
|
|
79
119
|
if (asset) {
|
|
80
120
|
console.log(`\nā
Found release: ${release.tag_name || release.name}`);
|
|
@@ -83,15 +123,14 @@ function registerApp(program) {
|
|
|
83
123
|
console.log('Opening download in your browser...');
|
|
84
124
|
openInBrowser(asset.browser_download_url);
|
|
85
125
|
} else {
|
|
86
|
-
console.log(
|
|
87
|
-
|
|
88
|
-
);
|
|
126
|
+
console.log(`\nā No ${ext} asset found in release ${release.tag_name}.`);
|
|
127
|
+
console.log(' Available assets:');
|
|
128
|
+
release.assets.forEach((a) => console.log(` ⢠${a.name}`));
|
|
129
|
+
console.log(`\n Visit: https://github.com/mrlynn/voyageai-cli/releases`);
|
|
89
130
|
}
|
|
90
131
|
} catch (err) {
|
|
91
|
-
console.error(
|
|
92
|
-
|
|
93
|
-
);
|
|
94
|
-
if (process.env.DEBUG) console.error(err);
|
|
132
|
+
console.error('ā Failed to check GitHub releases:', err.message);
|
|
133
|
+
console.error(' Visit: https://github.com/mrlynn/voyageai-cli/releases');
|
|
95
134
|
}
|
|
96
135
|
return;
|
|
97
136
|
}
|
|
@@ -99,8 +138,21 @@ function registerApp(program) {
|
|
|
99
138
|
const electronPkg = path.join(electronDir, 'package.json');
|
|
100
139
|
|
|
101
140
|
if (!fs.existsSync(electronPkg)) {
|
|
102
|
-
console.
|
|
103
|
-
|
|
141
|
+
console.log('');
|
|
142
|
+
console.log('š„ļø The Vai desktop app is not installed locally.');
|
|
143
|
+
console.log('');
|
|
144
|
+
console.log(' Download the latest release for your platform:');
|
|
145
|
+
console.log('');
|
|
146
|
+
console.log(' vai app --download');
|
|
147
|
+
console.log('');
|
|
148
|
+
console.log(' Or grab it directly from GitHub:');
|
|
149
|
+
console.log(' https://github.com/mrlynn/voyageai-cli/releases/latest');
|
|
150
|
+
console.log('');
|
|
151
|
+
console.log(' Don\'t need the desktop app? Use the web playground instead:');
|
|
152
|
+
console.log('');
|
|
153
|
+
console.log(' vai playground');
|
|
154
|
+
console.log('');
|
|
155
|
+
return;
|
|
104
156
|
}
|
|
105
157
|
|
|
106
158
|
// Check if electron is installed
|