@icyfenix-dmla/install 2026.5.2-7 → 2026.5.3-1019

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/install",
3
- "version": "2026.5.2-7",
3
+ "version": "2026.5.3-1019",
4
4
  "description": "DMLA 沙箱环境 TUI 安装向导",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -83,15 +83,17 @@ export async function runInstallTUI() {
83
83
  console.log()
84
84
 
85
85
  const env = await checkEnvironment()
86
+ let dockerAvailable = true
86
87
 
87
88
  if (!env.docker) {
88
- console.log(chalk.red('❌ Docker 未安装或未运行'))
89
- console.log(chalk.yellow('请先安装 Docker: https://docs.docker.com/get-docker/'))
90
- process.exit(1)
89
+ dockerAvailable = false
90
+ console.log(chalk.yellow('⚠️ Docker 未安装或未运行'))
91
+ console.log(chalk.gray(' CLI 工具可先安装,稍后在有 Docker 的环境中使用'))
92
+ console.log(chalk.gray(' Docker 安装指南: https://docs.docker.com/get-docker/'))
93
+ } else {
94
+ console.log(chalk.green(`✔ Docker ${env.dockerVersion || ''} 已安装`))
91
95
  }
92
96
 
93
- console.log(chalk.green(`✔ Docker ${env.dockerVersion || ''} 已安装`))
94
-
95
97
  if (!env.node) {
96
98
  console.log(chalk.red('❌ Node.js 未安装'))
97
99
  console.log(chalk.yellow('请先安装 Node.js: https://nodejs.org/'))
@@ -100,8 +102,23 @@ export async function runInstallTUI() {
100
102
 
101
103
  console.log(chalk.green(`✔ Node.js ${env.nodeVersion} 已安装`))
102
104
 
103
- // GPU 信息显示
104
- if (env.gpu) {
105
+ // Git 检测
106
+ if (env.git) {
107
+ console.log(chalk.green(`✔ Git ${env.gitVersion || ''} 已安装`))
108
+ } else {
109
+ console.log(chalk.yellow('⚠️ Git 未安装'))
110
+ console.log(chalk.gray(' 下载数据集功能需要 Git,建议安装'))
111
+ }
112
+
113
+ // Git LFS 检测
114
+ if (env.gitLfs) {
115
+ console.log(chalk.green(`✔ Git LFS ${env.gitLfsVersion || ''} 已安装`))
116
+ } else {
117
+ console.log(chalk.gray(' Git LFS: 未安装 (部分大型数据集可能需要)'))
118
+ }
119
+
120
+ // GPU 信息显示(仅当 Docker 可用时)
121
+ if (dockerAvailable && env.gpu) {
105
122
  console.log(chalk.green(`✔ GPU: ${env.gpuInfo || '检测到'}`))
106
123
 
107
124
  // 显示驱动版本和 CUDA 兼容上限
@@ -122,6 +139,8 @@ export async function runInstallTUI() {
122
139
  console.log(chalk.yellow(` GPU 镜像: 不兼容 (需要驱动 >= ${minDriverForGpuImage})`))
123
140
  console.log(chalk.yellow(` 💡 建议:升级 NVIDIA 驱动到 ${minDriverForGpuImage}+ 或使用 CPU 模式`))
124
141
  }
142
+ } else if (!dockerAvailable) {
143
+ console.log(chalk.gray(' GPU: 检测已跳过(Docker 不可用)'))
125
144
  } else {
126
145
  console.log(chalk.gray(' GPU: 未检测到'))
127
146
  }
@@ -131,32 +150,45 @@ export async function runInstallTUI() {
131
150
  // ─────────────────────────────────────────────────────────────
132
151
  // 步骤 2: 选择镜像仓库(或跳过拉取)
133
152
  // ─────────────────────────────────────────────────────────────
134
- const registryChoice = await prompt({
135
- type: 'select',
136
- name: 'registry',
137
- message: '请选择镜像仓库',
138
- initial: 0, // 默认选择 'auto'(第一项)
139
- choices: [
140
- { name: 'auto', message: '自动选择 (根据网络延迟)' },
141
- { name: 'dockerhub', message: 'Docker Hub (全球访问)' },
142
- { name: 'acr', message: '阿里云 ACR (国内加速)' },
143
- { name: 'skip', message: '暂不拉取镜像 (仅安装 CLI)' }
144
- ]
145
- })
146
153
 
147
- let registry = registryChoice.registry
148
- let skipPull = false
154
+ // Docker 不可用时,强制跳过镜像拉取
155
+ let registry = 'skip'
156
+ let skipPull = true
149
157
 
150
- if (registry === 'skip') {
151
- skipPull = true
152
- console.log(chalk.gray(' 将仅安装 CLI 工具'))
153
- } else if (registry === 'auto') {
154
- console.log(chalk.gray(' 检测网络延迟...'))
155
- registry = 'acr'
156
- console.log(chalk.gray(` 已选择: ${registry === 'acr' ? '阿里云 ACR' : 'Docker Hub'}`))
157
- }
158
+ if (!dockerAvailable) {
159
+ console.log(chalk.bold('镜像安装'))
160
+ console.log()
161
+ console.log(chalk.gray(' Docker 未安装,将仅安装 CLI 工具'))
162
+ console.log(chalk.gray(' 稍后可在有 Docker 的环境中运行: dmla install'))
163
+ console.log()
164
+ } else {
165
+ const registryChoice = await prompt({
166
+ type: 'select',
167
+ name: 'registry',
168
+ message: '请选择镜像仓库',
169
+ initial: 0, // 默认选择 'auto'(第一项)
170
+ choices: [
171
+ { name: 'auto', message: '自动选择 (根据网络延迟)' },
172
+ { name: 'dockerhub', message: 'Docker Hub (全球访问)' },
173
+ { name: 'acr', message: '阿里云 ACR (国内加速)' },
174
+ { name: 'skip', message: '暂不拉取镜像 (仅安装 CLI)' }
175
+ ]
176
+ })
158
177
 
159
- console.log()
178
+ registry = registryChoice.registry
179
+ skipPull = false
180
+
181
+ if (registry === 'skip') {
182
+ skipPull = true
183
+ console.log(chalk.gray(' 将仅安装 CLI 工具'))
184
+ } else if (registry === 'auto') {
185
+ console.log(chalk.gray(' 检测网络延迟...'))
186
+ registry = 'acr'
187
+ console.log(chalk.gray(` 已选择: ${registry === 'acr' ? '阿里云 ACR' : 'Docker Hub'}`))
188
+ }
189
+
190
+ console.log()
191
+ }
160
192
 
161
193
  // ─────────────────────────────────────────────────────────────
162
194
  // 步骤 3: 选择镜像类型(如果需要拉取)
@@ -45,6 +45,52 @@ function checkNode() {
45
45
  }
46
46
  }
47
47
 
48
+ /**
49
+ * 检查 Git 环境
50
+ */
51
+ function checkGit() {
52
+ try {
53
+ const version = execSync('git --version', {
54
+ encoding: 'utf8',
55
+ stdio: ['ignore', 'pipe', 'ignore']
56
+ }).trim()
57
+ // git version 2.x.x -> 2.x.x
58
+ const versionMatch = version.match(/git version (\d+\.\d+\.\d+)/)
59
+ return {
60
+ installed: true,
61
+ version: versionMatch ? versionMatch[1] : version.replace('git version ', '')
62
+ }
63
+ } catch {
64
+ return {
65
+ installed: false,
66
+ version: null
67
+ }
68
+ }
69
+ }
70
+
71
+ /**
72
+ * 检查 Git LFS 环境
73
+ */
74
+ function checkGitLfs() {
75
+ try {
76
+ const version = execSync('git lfs version', {
77
+ encoding: 'utf8',
78
+ stdio: ['ignore', 'pipe', 'ignore']
79
+ }).trim()
80
+ // git-lfs/3.x.x -> 3.x.x
81
+ const versionMatch = version.match(/git-lfs\/(\d+\.\d+\.\d+)/)
82
+ return {
83
+ installed: true,
84
+ version: versionMatch ? versionMatch[1] : version
85
+ }
86
+ } catch {
87
+ return {
88
+ installed: false,
89
+ version: null
90
+ }
91
+ }
92
+ }
93
+
48
94
  /**
49
95
  * 检查 GPU 环境
50
96
  * @returns {{ available: boolean, info: string|null, driverVersion: string|null }}
@@ -108,6 +154,8 @@ function checkPort(port) {
108
154
  export async function checkEnvironment() {
109
155
  const dockerEnv = await checkDocker()
110
156
  const nodeEnv = checkNode()
157
+ const gitEnv = checkGit()
158
+ const gitLfsEnv = checkGitLfs()
111
159
  const gpuEnv = checkGPU()
112
160
 
113
161
  return {
@@ -115,6 +163,10 @@ export async function checkEnvironment() {
115
163
  dockerVersion: dockerEnv.version,
116
164
  node: nodeEnv.installed,
117
165
  nodeVersion: nodeEnv.version,
166
+ git: gitEnv.installed,
167
+ gitVersion: gitEnv.version,
168
+ gitLfs: gitLfsEnv.installed,
169
+ gitLfsVersion: gitLfsEnv.version,
118
170
  gpu: gpuEnv.available,
119
171
  gpuInfo: gpuEnv.info,
120
172
  gpuDriverVersion: gpuEnv.driverVersion,