@delta-infra/cli 1.0.72 → 1.0.73

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/README.md CHANGED
@@ -379,7 +379,7 @@ make release
379
379
  ```bash
380
380
  export GH_TOKEN=<your-github-pat>
381
381
  export NPM_TOKEN=<your-npm-token>
382
- ./release.sh v1.0.72
382
+ ./release.sh v1.0.73
383
383
  ```
384
384
 
385
385
  脚本执行步骤:
package/checksums.txt CHANGED
@@ -1,5 +1,5 @@
1
- 16b7386c1f5cd9ba8175267279b78bec0b5ee5137bfb5ae953bc3022c6e9af5c delta-cli-darwin-amd64.tar.gz
2
- caf1525913944a2f9daa416a19e0097135dc5d74284398742620d3b0c3364aa3 delta-cli-darwin-arm64.tar.gz
3
- 60e46fe37fcbde336d701ff675a9d5e453915bc76739b508f509193ea270ef82 delta-cli-linux-amd64.tar.gz
4
- 52b9bd29c0c30f4f1c5a9a46cac36d014841834e5a3b8c7a2115153a5d18b600 delta-cli-linux-arm64.tar.gz
5
- c94f3955966b27e9f4d242ff78869eb5f3a51e209d9358f843fb6f5236faa7a4 delta-cli-windows-amd64.zip
1
+ 8876ead6e40e32d66f031b0803093c36d2cab9caac736de386a98e1b3ec0ef6d delta-cli-darwin-amd64.tar.gz
2
+ 593093e731ad55f1faaa8375ddd27e82c397bc7e26ec325994af53c5ce99887c delta-cli-darwin-arm64.tar.gz
3
+ 99242ae51327ee64ab7a6f57812f03286e99dd57752dd314eeb7d00a3b0a1a28 delta-cli-linux-amd64.tar.gz
4
+ e39b2bd0ec5d5a16da22b8293e66559ee837c60573f64d808bfa2fc6eecff3f7 delta-cli-linux-arm64.tar.gz
5
+ bb78c56e5455ca5e880c6267bd201b5f9e25586246ae63fab28b3541c8e72581 delta-cli-windows-amd64.zip
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delta-infra/cli",
3
- "version": "1.0.72",
3
+ "version": "1.0.73",
4
4
  "description": "Delta Infra CLI for sandbox compute and science tools.",
5
5
  "bin": {
6
6
  "delta-cli": "scripts/run.js"
@@ -14,6 +14,7 @@ const GH_MIRRORS = ["https://gh.ddlc.top", "https://ghproxy.net", "https://gh-pr
14
14
  const CONFIG_DIR = path.join(osHomedir(), ".delta-infra");
15
15
  const CONFIG_VERSION = 1;
16
16
  const DEFAULT_BASE_URL = "https://delta-infra-nacos-test.yangtzeailab.com/sandbox/api/v1";
17
+ const DEFAULT_SCIENCE_BASE_URL = "http://8.141.101.94:8080/science_tool";
17
18
  const isWindows = process.platform === "win32";
18
19
 
19
20
  const PLATFORM_PATHS = {
@@ -67,6 +68,8 @@ const messages = {
67
68
  step2Skip: "已安装,跳过",
68
69
  step2Fail: "Skills 安装失败。运行以下命令重试: npx skills add %s -y -g",
69
70
  step3: "正在初始化配置...",
71
+ step3BaseUrl: "Sandbox API 地址",
72
+ step3ScienceUrl:"Science API 地址",
70
73
  step3Skip: "跳过配置初始化",
71
74
  step3Done: "配置已初始化",
72
75
  step3Fail: "配置初始化失败。运行以下命令重试: delta-cli config init",
@@ -95,6 +98,8 @@ const messages = {
95
98
  step2Skip: "Already installed. Skipped",
96
99
  step2Fail: "Failed to install skills. Run manually: npx skills add %s -y -g",
97
100
  step3: "Initializing config...",
101
+ step3BaseUrl: "Sandbox API URL",
102
+ step3ScienceUrl:"Science API URL",
98
103
  step3Skip: "Skipped config initialization",
99
104
  step3Done: "Config initialized",
100
105
  step3Fail: "Failed to init config. Run manually: delta-cli config init",
@@ -236,18 +241,20 @@ function getExistingConfig() {
236
241
  } catch { return null; }
237
242
  }
238
243
 
239
- function writeDefaultConfig(existing = null) {
244
+ function writeConfig({ baseUrl, scienceUrl, existing = null } = {}) {
240
245
  fs.mkdirSync(CONFIG_DIR, { recursive: true });
241
246
  const config = {
242
247
  version: CONFIG_VERSION,
243
- base_url: DEFAULT_BASE_URL,
248
+ base_url: baseUrl || DEFAULT_BASE_URL,
244
249
  };
250
+ if (scienceUrl) {
251
+ config.science_base_url = scienceUrl;
252
+ } else if (existing && existing.science_base_url) {
253
+ config.science_base_url = existing.science_base_url;
254
+ }
245
255
  if (existing && existing.token) {
246
256
  config.token = existing.token;
247
257
  }
248
- if (existing && existing.science_base_url) {
249
- config.science_base_url = existing.science_base_url;
250
- }
251
258
  fs.writeFileSync(path.join(CONFIG_DIR, "config.json"), JSON.stringify(config, null, 2) + "\n", { mode: 0o600 });
252
259
  }
253
260
 
@@ -411,9 +418,9 @@ async function stepConfigInit(msg) {
411
418
  s.start(msg.step3);
412
419
 
413
420
  const existingConfig = getExistingConfig();
421
+ s.stop(msg.step3);
414
422
 
415
423
  if (existingConfig && existingConfig.base_url) {
416
- s.stop(msg.step3);
417
424
  const reuse = await p.confirm({
418
425
  message: `发现已有配置 (Server: ${existingConfig.base_url}),继续使用?`,
419
426
  });
@@ -427,12 +434,26 @@ async function stepConfigInit(msg) {
427
434
  }
428
435
  }
429
436
 
437
+ const baseUrl = handleCancel(await p.text({
438
+ message: msg.step3BaseUrl,
439
+ initialValue: existingConfig && existingConfig.base_url
440
+ ? existingConfig.base_url
441
+ : DEFAULT_BASE_URL,
442
+ }), msg);
443
+
444
+ const scienceUrl = handleCancel(await p.text({
445
+ message: msg.step3ScienceUrl,
446
+ initialValue: existingConfig && existingConfig.science_base_url
447
+ ? existingConfig.science_base_url
448
+ : DEFAULT_SCIENCE_BASE_URL,
449
+ }), msg);
450
+
430
451
  try {
431
- writeDefaultConfig(existingConfig);
432
- s.stop(msg.step3Done);
452
+ writeConfig({ baseUrl, scienceUrl, existing: existingConfig });
453
+ p.log.success(msg.step3Done);
433
454
  } catch (e) {
434
- s.stop(msg.step3Fail);
435
455
  p.log.error(e.message || String(e));
456
+ p.log.error(msg.step3Fail);
436
457
  process.exit(1);
437
458
  }
438
459
  }