git0 0.1.5 → 0.1.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/gg.js +85 -83
- package/package.json +1 -1
package/gg.js
CHANGED
|
@@ -216,6 +216,90 @@ function provideInstallationInstructions(filePath, asset) {
|
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
// Show package selection menu organized by platform
|
|
220
|
+
async function showPackageMenu(selectedRepo) {
|
|
221
|
+
const currentPlatform = getCurrentPlatform();
|
|
222
|
+
const releaseChoices = [];
|
|
223
|
+
|
|
224
|
+
// Add section headers and organize by platform
|
|
225
|
+
selectedRepo.allReleases.forEach(release => {
|
|
226
|
+
const platforms = ['windows', 'macos', 'linux', 'universal'];
|
|
227
|
+
|
|
228
|
+
platforms.forEach(platform => {
|
|
229
|
+
const assets = release.platformAssets[platform];
|
|
230
|
+
if (assets.length > 0) {
|
|
231
|
+
// Add platform header
|
|
232
|
+
const platformEmoji = {
|
|
233
|
+
windows: '🪟',
|
|
234
|
+
macos: '🍎',
|
|
235
|
+
linux: '🐧',
|
|
236
|
+
universal: '🌐'
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
const platformName = {
|
|
240
|
+
windows: 'Windows',
|
|
241
|
+
macos: 'macOS',
|
|
242
|
+
linux: 'Linux',
|
|
243
|
+
universal: 'Universal'
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
const isCurrentPlatform = platform === currentPlatform.os || platform === 'universal';
|
|
247
|
+
const platformHeader = isCurrentPlatform
|
|
248
|
+
? chalk.green(`${platformEmoji[platform]} ${platformName[platform]} (Your Platform)`)
|
|
249
|
+
: chalk.gray(`${platformEmoji[platform]} ${platformName[platform]}`);
|
|
250
|
+
|
|
251
|
+
// Add separator if not first platform in this release
|
|
252
|
+
const needsSeparator = releaseChoices.length > 0 &&
|
|
253
|
+
!releaseChoices[releaseChoices.length - 1].name.includes('────');
|
|
254
|
+
|
|
255
|
+
if (needsSeparator) {
|
|
256
|
+
releaseChoices.push({
|
|
257
|
+
name: chalk.gray('────────────────────────────────'),
|
|
258
|
+
disabled: true
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
releaseChoices.push({
|
|
263
|
+
name: `${chalk.bold(release.tag_name)} - ${platformHeader}`,
|
|
264
|
+
disabled: true
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
// Add assets for this platform
|
|
268
|
+
assets.forEach(asset => {
|
|
269
|
+
const sizeStr = (asset.size / 1024 / 1024).toFixed(2);
|
|
270
|
+
const archInfo = asset.detectedArch !== 'unknown' && asset.detectedArch !== 'universal'
|
|
271
|
+
? chalk.cyan(`[${asset.detectedArch}]`)
|
|
272
|
+
: '';
|
|
273
|
+
|
|
274
|
+
const highlight = isCurrentPlatform ? chalk.white : chalk.gray;
|
|
275
|
+
|
|
276
|
+
releaseChoices.push({
|
|
277
|
+
name: ` ${highlight(`${asset.name} ${archInfo} (${sizeStr} MB)`)}`,
|
|
278
|
+
value: { release, asset }
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
if (releaseChoices.filter(choice => !choice.disabled).length === 0) {
|
|
286
|
+
console.log(chalk.yellow('No packages found for download.'));
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const { selectedPackage } = await inquirer.prompt({
|
|
291
|
+
type: 'list',
|
|
292
|
+
name: 'selectedPackage',
|
|
293
|
+
message: 'Select a package to download:',
|
|
294
|
+
choices: releaseChoices,
|
|
295
|
+
pageSize: 15
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
const downloadDir = path.resolve(process.cwd(), 'downloads');
|
|
299
|
+
fs.mkdirSync(downloadDir, { recursive: true });
|
|
300
|
+
await downloadPackage(selectedPackage.asset, downloadDir);
|
|
301
|
+
}
|
|
302
|
+
|
|
219
303
|
function getIdeCommand() {
|
|
220
304
|
const ides = [
|
|
221
305
|
{ name: 'Cursor', cmd: 'cursor' },
|
|
@@ -427,89 +511,7 @@ export async function downloadRepo(repo) {
|
|
|
427
511
|
}
|
|
428
512
|
}
|
|
429
513
|
|
|
430
|
-
|
|
431
|
-
async function showPackageMenu(selectedRepo) {
|
|
432
|
-
const currentPlatform = getCurrentPlatform();
|
|
433
|
-
const releaseChoices = [];
|
|
434
|
-
|
|
435
|
-
// Add section headers and organize by platform
|
|
436
|
-
selectedRepo.allReleases.forEach(release => {
|
|
437
|
-
const platforms = ['windows', 'macos', 'linux', 'universal'];
|
|
438
|
-
|
|
439
|
-
platforms.forEach(platform => {
|
|
440
|
-
const assets = release.platformAssets[platform];
|
|
441
|
-
if (assets.length > 0) {
|
|
442
|
-
// Add platform header
|
|
443
|
-
const platformEmoji = {
|
|
444
|
-
windows: '🪟',
|
|
445
|
-
macos: '🍎',
|
|
446
|
-
linux: '🐧',
|
|
447
|
-
universal: '🌐'
|
|
448
|
-
};
|
|
449
|
-
|
|
450
|
-
const platformName = {
|
|
451
|
-
windows: 'Windows',
|
|
452
|
-
macos: 'macOS',
|
|
453
|
-
linux: 'Linux',
|
|
454
|
-
universal: 'Universal'
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
const isCurrentPlatform = platform === currentPlatform.os || platform === 'universal';
|
|
458
|
-
const platformHeader = isCurrentPlatform
|
|
459
|
-
? chalk.green(`${platformEmoji[platform]} ${platformName[platform]} (Your Platform)`)
|
|
460
|
-
: chalk.gray(`${platformEmoji[platform]} ${platformName[platform]}`);
|
|
461
|
-
|
|
462
|
-
// Add separator if not first platform in this release
|
|
463
|
-
const needsSeparator = releaseChoices.length > 0 &&
|
|
464
|
-
!releaseChoices[releaseChoices.length - 1].name.includes('────');
|
|
465
|
-
|
|
466
|
-
if (needsSeparator) {
|
|
467
|
-
releaseChoices.push({
|
|
468
|
-
name: chalk.gray('────────────────────────────────'),
|
|
469
|
-
disabled: true
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
releaseChoices.push({
|
|
474
|
-
name: `${chalk.bold(release.tag_name)} - ${platformHeader}`,
|
|
475
|
-
disabled: true
|
|
476
|
-
});
|
|
477
|
-
|
|
478
|
-
// Add assets for this platform
|
|
479
|
-
assets.forEach(asset => {
|
|
480
|
-
const sizeStr = (asset.size / 1024 / 1024).toFixed(2);
|
|
481
|
-
const archInfo = asset.detectedArch !== 'unknown' && asset.detectedArch !== 'universal'
|
|
482
|
-
? chalk.cyan(`[${asset.detectedArch}]`)
|
|
483
|
-
: '';
|
|
484
|
-
|
|
485
|
-
const highlight = isCurrentPlatform ? chalk.white : chalk.gray;
|
|
486
|
-
|
|
487
|
-
releaseChoices.push({
|
|
488
|
-
name: ` ${highlight(`${asset.name} ${archInfo} (${sizeStr} MB)`)}`,
|
|
489
|
-
value: { release, asset }
|
|
490
|
-
});
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
});
|
|
494
|
-
});
|
|
495
|
-
|
|
496
|
-
if (releaseChoices.filter(choice => !choice.disabled).length === 0) {
|
|
497
|
-
console.log(chalk.yellow('No packages found for download.'));
|
|
498
|
-
return;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
const { selectedPackage } = await inquirer.prompt({
|
|
502
|
-
type: 'list',
|
|
503
|
-
name: 'selectedPackage',
|
|
504
|
-
message: 'Select a package to download:',
|
|
505
|
-
choices: releaseChoices,
|
|
506
|
-
pageSize: 15
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
const downloadDir = path.resolve(process.cwd(), 'downloads');
|
|
510
|
-
fs.mkdirSync(downloadDir, { recursive: true });
|
|
511
|
-
await downloadPackage(selectedPackage.asset, downloadDir);
|
|
512
|
-
}
|
|
514
|
+
function getAvailableDirectoryName(basePath) {
|
|
513
515
|
if (!fs.existsSync(basePath)) return basePath;
|
|
514
516
|
let counter = 2;
|
|
515
517
|
let newPath;
|