@icyfenix-dmla/cli 2026.5.2-1955 → 2026.5.2-1959

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icyfenix-dmla/cli",
3
- "version": "2026.5.2-1955",
3
+ "version": "2026.5.2-1959",
4
4
  "description": "DMLA 沙箱服务命令行工具",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -419,54 +419,70 @@ async function downloadDatasets() {
419
419
  return
420
420
  }
421
421
 
422
- // 显示可用数据集
423
- console.log('可用数据集:')
424
- console.log()
422
+ // 检查 Git 环境
423
+ try {
424
+ execSync('git --version', { stdio: 'pipe' })
425
+ } catch {
426
+ console.log(chalk.red('❌ Git 未安装'))
427
+ console.log(chalk.yellow('下载数据集需要 Git,请先安装: https://git-scm.com/downloads'))
428
+ return
429
+ }
425
430
 
426
- for (let i = 0; i < DATASETS.length; i++) {
427
- const dataset = DATASETS[i]
431
+ // 构建选项列表
432
+ const choices = DATASETS.map((dataset, index) => {
428
433
  const downloaded = isDatasetDownloaded(dataPath, dataset.id)
429
- const status = downloaded ? chalk.green('[x]') : chalk.gray('[ ]')
430
- const downloadedTag = downloaded ? chalk.gray(' (已下载)') : chalk.gray(` (${dataset.size})`)
431
- console.log(` ${i + 1}. ${status} ${dataset.name}${downloadedTag}`)
432
- }
434
+ return {
435
+ name: index.toString(),
436
+ message: `${dataset.name} (${dataset.size})${downloaded ? ' [已下载]' : ''}`,
437
+ disabled: downloaded || dataset.id === 'mnist'
438
+ }
439
+ })
433
440
 
434
- console.log()
435
- console.log(chalk.gray('提示: 输入序号选择数据集,q 返回'))
441
+ // MNIST 特殊提示
442
+ console.log(chalk.gray('提示: MNIST 数据集将在训练时通过 torchvision 自动下载'))
443
+ console.log(chalk.gray('操作: 上下键选择,空格勾选/取消,回车确认下载'))
436
444
  console.log()
437
445
 
438
- const { selection } = await prompt({
439
- type: 'input',
440
- name: 'selection',
441
- message: '选择要下载的数据集序号'
446
+ const { selected } = await prompt({
447
+ type: 'multiselect',
448
+ name: 'selected',
449
+ message: '选择要下载的数据集',
450
+ choices,
451
+ hint: '空格选择,回车确认',
452
+ warn: '已下载或不可选'
442
453
  })
443
454
 
444
- if (selection.toLowerCase() === 'q') {
455
+ if (!selected || selected.length === 0) {
456
+ console.log(chalk.yellow('未选择任何数据集'))
445
457
  return
446
458
  }
447
459
 
448
- const index = parseInt(selection) - 1
449
- if (index < 0 || index >= DATASETS.length) {
450
- console.log(chalk.yellow('无效的选择'))
451
- return
452
- }
460
+ // 下载选中的数据集
461
+ for (const indexStr of selected) {
462
+ const index = parseInt(indexStr)
463
+ const dataset = DATASETS[index]
453
464
 
454
- const dataset = DATASETS[index]
465
+ console.log()
466
+ console.log(chalk.cyan(`────────────────────────────────────`))
455
467
 
456
- // 检查是否已下载
457
- if (isDatasetDownloaded(dataPath, dataset.id)) {
458
- console.log(chalk.yellow(`${dataset.name} 已下载`))
459
- return
460
- }
468
+ // MNIST 特殊处理
469
+ if (dataset.id === 'mnist') {
470
+ console.log(chalk.yellow('MNIST 数据集将在训练时通过 torchvision 自动下载'))
471
+ continue
472
+ }
461
473
 
462
- // MNIST 使用特殊处理
463
- if (dataset.id === 'mnist') {
464
- console.log(chalk.yellow('MNIST 数据集将在训练时通过 torchvision 自动下载'))
465
- return
474
+ // 检查是否已下载
475
+ if (isDatasetDownloaded(dataPath, dataset.id)) {
476
+ console.log(chalk.yellow(`${dataset.name} 已下载,跳过`))
477
+ continue
478
+ }
479
+
480
+ await downloadDataset(dataPath, dataset)
466
481
  }
467
482
 
468
- // 开始下载
469
- await downloadDataset(dataPath, dataset)
483
+ console.log()
484
+ console.log(chalk.cyan(`────────────────────────────────────`))
485
+ console.log(chalk.green('所有选中的数据集已处理完成'))
470
486
  }
471
487
 
472
488
  /**