@delta-infra/cli 1.0.69 → 1.0.70

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
@@ -375,7 +375,7 @@ make release
375
375
  ```bash
376
376
  export GH_TOKEN=<your-github-pat>
377
377
  export NPM_TOKEN=<your-npm-token>
378
- ./release.sh v1.0.69
378
+ ./release.sh v1.0.70
379
379
  ```
380
380
 
381
381
  脚本执行步骤:
package/checksums.txt CHANGED
@@ -1,5 +1,5 @@
1
- b7fefdbe859a2360be2c9edd1ef9b6ed474e28130eab660d9d04b2641d49df70 delta-cli-darwin-amd64.tar.gz
2
- 8c04c9baac76f92cd310b3bddde7924bd69c1fad60817d10a07dbe13b70d1f52 delta-cli-darwin-arm64.tar.gz
3
- ce4eff6603af742cf3a7f87f89a4c9ea9da61f11f0f129247ccade7b1d5c9a4c delta-cli-linux-amd64.tar.gz
4
- f865da4a11ae884c39ac39f539e4b1d64b4a2868305981b0105e239795591a35 delta-cli-linux-arm64.tar.gz
5
- cfb2f8b72909624505a951f790b3f7f17f43aab00555d5d39f86d7d40c6905ce delta-cli-windows-amd64.zip
1
+ af5ff4a7832f6d7b84d58c128e1ec4275b4f9c0af9ae4d95e83f78f69da2e6ad delta-cli-darwin-amd64.tar.gz
2
+ 23ff7deb342c39dce91af911e58ab2e6a3232b0c75d4ba6f77471b0513b25863 delta-cli-darwin-arm64.tar.gz
3
+ 1e4545d4bbd69b190aa83c65a59e8009e37f2c68d715613dc8185a51bdc495ed delta-cli-linux-amd64.tar.gz
4
+ 846ece621a8030606004dfc398dabc0e1889fb4c34c18e7094ced9ba159f4fc4 delta-cli-linux-arm64.tar.gz
5
+ 4cd39c137560399d967e2fad4c175a5902b79767f6f6cb05c66a06c7a82f4b66 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.69",
3
+ "version": "1.0.70",
4
4
  "description": "Delta Infra CLI for sandbox compute and science tools.",
5
5
  "bin": {
6
6
  "delta-cli": "scripts/run.js"
@@ -12,6 +12,8 @@ const SKILLS_REPO = "yzailab/delta-infra-cli";
12
12
  const NPM_REGISTRIES = ["https://registry.npmmirror.com", "https://registry.npmjs.org"];
13
13
  const GH_MIRRORS = ["https://gh.ddlc.top", "https://ghproxy.net", "https://gh-proxy.com"];
14
14
  const CONFIG_DIR = path.join(osHomedir(), ".delta-infra");
15
+ const CONFIG_VERSION = 1;
16
+ const DEFAULT_BASE_URL = "https://delta-infra-nacos-test.yangtzeailab.com/sandbox/api/v1";
15
17
  const isWindows = process.platform === "win32";
16
18
 
17
19
  const PLATFORM_PATHS = {
@@ -234,6 +236,21 @@ function getExistingConfig() {
234
236
  } catch { return null; }
235
237
  }
236
238
 
239
+ function writeDefaultConfig(existing = null) {
240
+ fs.mkdirSync(CONFIG_DIR, { recursive: true });
241
+ const config = {
242
+ version: CONFIG_VERSION,
243
+ base_url: DEFAULT_BASE_URL,
244
+ };
245
+ if (existing && existing.token) {
246
+ config.token = existing.token;
247
+ }
248
+ if (existing && existing.science_base_url) {
249
+ config.science_base_url = existing.science_base_url;
250
+ }
251
+ fs.writeFileSync(path.join(CONFIG_DIR, "config.json"), JSON.stringify(config, null, 2) + "\n", { mode: 0o600 });
252
+ }
253
+
237
254
  // ── Steps ───────────────────────────────────────────────────────────────────
238
255
 
239
256
  async function stepInstallGlobally(msg) {
@@ -393,33 +410,29 @@ async function stepConfigInit(msg) {
393
410
  const s = createSpinner();
394
411
  s.start(msg.step3);
395
412
 
396
- const deltaCli = whichDeltaCli();
397
- if (!deltaCli) {
398
- s.stop(msg.step3);
399
- p.log.warn("delta-cli not found on PATH after global install.");
400
- p.log.info(msg.step3Fail);
401
- return;
402
- }
403
-
404
- // Check if config already exists with valid data
405
413
  const existingConfig = getExistingConfig();
406
- s.stop(msg.step3);
407
414
 
408
415
  if (existingConfig && existingConfig.base_url) {
416
+ s.stop(msg.step3);
409
417
  const reuse = await p.confirm({
410
418
  message: `发现已有配置 (Server: ${existingConfig.base_url}),继续使用?`,
411
419
  });
412
- if (handleCancel(reuse, msg) && reuse) {
420
+ if (p.isCancel(reuse)) {
421
+ handleCancel(reuse, msg);
422
+ return;
423
+ }
424
+ if (reuse) {
413
425
  p.log.info(msg.step3Skip);
414
426
  return;
415
427
  }
416
428
  }
417
429
 
418
430
  try {
419
- run(deltaCli, ["config", "init"]);
420
- p.log.success(msg.step3Done);
421
- } catch {
422
- p.log.error(msg.step3Fail);
431
+ writeDefaultConfig(existingConfig);
432
+ s.stop(msg.step3Done);
433
+ } catch (e) {
434
+ s.stop(msg.step3Fail);
435
+ p.log.error(e.message || String(e));
423
436
  process.exit(1);
424
437
  }
425
438
  }