@delta-infra/cli 1.0.84 → 1.0.85

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/checksums.txt CHANGED
@@ -1,5 +1,5 @@
1
- 667417d5358bf7dacbb8a79ec15e045c79205f48df9f8155b294a387fc5ecfc1 delta-cli-darwin-amd64.tar.gz
2
- 30d4e295329b41fa56e244d74e8a2bfacdcb546486065bc829e4532aa52a1eeb delta-cli-darwin-arm64.tar.gz
3
- bd2922359a6be1289bff1e0c8050ec01a444b376f0681124cbfd5c39e5af7580 delta-cli-linux-amd64.tar.gz
4
- 3ba46f7c5470d92d8b59825e639b66f207482746c45d8cd34a95ba6a89e0b6df delta-cli-linux-arm64.tar.gz
5
- f0426b06da61dfdffc079fa5e5e52437285c840855197240d55a49246d23e835 delta-cli-windows-amd64.zip
1
+ 598d6098c95178c336be2c69c1b8314341581c2b39bce5bd3d7a5b39d207ac04 delta-cli-darwin-amd64.tar.gz
2
+ 815a88f48726354efc5e17dca5f54ed05784e0dfd2a525e05a2ab748114223e7 delta-cli-darwin-arm64.tar.gz
3
+ 861f1e946c94311526b6802a85ebf9a7368b05631ee96822ed24b55facd5b5d2 delta-cli-linux-amd64.tar.gz
4
+ e3bf8ed838c0cfc56d66ec9c663fc608217964599820c7c08ac34c227811f98d delta-cli-linux-arm64.tar.gz
5
+ fbd669af1baa1d76d06d90e386350d20cda9c6569027ed4e00b4fe5bc796e578 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.84",
3
+ "version": "1.0.85",
4
4
  "description": "Delta Infra CLI for sandbox compute and science tools.",
5
5
  "bin": {
6
6
  "delta-cli": "scripts/run.js"
@@ -45,7 +45,67 @@ const PLATFORM_LABELS = {
45
45
  const skillManifest = require("../skills/manifest.json");
46
46
  const SKILL_NAMES = skillManifest.skills;
47
47
  const RETIRED_SKILL_NAMES = skillManifest.retired_skills || [];
48
- const LANG = "zh";
48
+
49
+ // Language for interactive prompts and log text. Detection precedence:
50
+ // DELTA_CLI_LANG (explicit override) > OS locale env (LANG/LC_ALL/LANGUAGE/
51
+ // LC_MESSAGES) > platform probe (Windows UI culture via PowerShell) >
52
+ // Intl default locale. Only zh and en are supported; anything not Chinese
53
+ // falls back to English. Neutral locales (C / POSIX / und) carry no language
54
+ // signal and resolve to English instead of leaking the runtime's default.
55
+ //
56
+ // Windows does not set the POSIX LANG/LC_ALL vars and Node's Intl defaults to
57
+ // en-US there, so a Chinese Windows user would otherwise see English. We probe
58
+ // the real UI culture on that platform instead.
59
+ function detectLang() {
60
+ if (process.env.DELTA_CLI_LANG) {
61
+ return process.env.DELTA_CLI_LANG.toLowerCase().startsWith("zh") ? "zh" : "en";
62
+ }
63
+ const neutral = /^(c|posix|und)(\b|$)/i;
64
+ const candidates = [
65
+ process.env.LC_ALL,
66
+ process.env.LC_MESSAGES,
67
+ process.env.LANG,
68
+ process.env.LANGUAGE,
69
+ ];
70
+ let sawLocale = false;
71
+ for (const value of candidates) {
72
+ if (!value) continue;
73
+ sawLocale = true;
74
+ const lower = value.toLowerCase();
75
+ if (neutral.test(value)) return "en";
76
+ if (lower.startsWith("zh")) return "zh";
77
+ return "en";
78
+ }
79
+ if (sawLocale) return "en";
80
+ if (isWindows) {
81
+ const win = windowsUiLanguage();
82
+ if (win) return win;
83
+ }
84
+ try {
85
+ if (String(Intl.DateTimeFormat().resolvedOptions().locale).toLowerCase().startsWith("zh")) {
86
+ return "zh";
87
+ }
88
+ } catch {}
89
+ return "en";
90
+ }
91
+
92
+ // Returns "zh" or "en" from the Windows UI culture, or "" when it cannot be read.
93
+ function windowsUiLanguage() {
94
+ try {
95
+ const out = execFileSync(
96
+ "powershell.exe",
97
+ ["-NoProfile", "-Command",
98
+ "[System.Globalization.CultureInfo]::CurrentUICulture.Name"],
99
+ { stdio: ["ignore", "pipe", "ignore"], encoding: "utf8", timeout: 8000 }
100
+ );
101
+ const name = (out || "").trim().toLowerCase();
102
+ if (name.startsWith("zh")) return "zh";
103
+ if (name) return "en";
104
+ } catch {}
105
+ return "";
106
+ }
107
+
108
+ const LANG = detectLang();
49
109
 
50
110
  function platformSkillDir(platform) {
51
111
  return path.join(osHomedir(), ...PLATFORM_PATHS[platform]);
@@ -83,6 +143,10 @@ const messages = {
83
143
  done: "安装完成!\n现在可以让你的 AI 工具使用 delta-cli 管理 Delta Sandbox 资源或调用 Science 工具。",
84
144
  cancelled: "安装已取消",
85
145
  nonTtyHint: "要完成配置,请在终端中运行:\n delta-cli config init\n delta-cli auth login",
146
+ uninstallConfirm: "将移除全局包、AI Skills 和配置文件。是否继续?",
147
+ uninstallCancelled: "卸载已取消",
148
+ uninstallDone: "卸载完成",
149
+ uninstallComplete: "卸载完成。",
86
150
  },
87
151
  en: {
88
152
  setup: "Setting up Delta Infra CLI...",
@@ -113,6 +177,10 @@ const messages = {
113
177
  done: "You are all set!\nYour AI tool can now use delta-cli to manage Delta Sandbox resources or invoke Science tools.",
114
178
  cancelled: "Installation cancelled",
115
179
  nonTtyHint: "To complete setup, run interactively:\n delta-cli config init\n delta-cli auth login",
180
+ uninstallConfirm: "This will remove the global package, AI Skills and config. Continue?",
181
+ uninstallCancelled: "Uninstall cancelled",
182
+ uninstallDone: "Uninstall complete",
183
+ uninstallComplete: "Uninstall complete.",
116
184
  },
117
185
  };
118
186
 
@@ -565,33 +633,35 @@ async function stepUninstallPackage(msg) {
565
633
 
566
634
  async function doInstall() {
567
635
  const isInteractive = isInteractiveEnv();
636
+ const msg = messages[LANG];
568
637
 
569
638
  if (isInteractive) {
570
- p.intro(messages.zh.setup);
571
- await stepInstallGlobally(messages.zh);
572
- const platforms = await stepSelectPlatforms(messages.zh);
573
- await stepInstallSkills(messages.zh, platforms);
574
- await stepConfigInit(messages.zh);
575
- await stepAuthLogin(messages.zh);
576
- p.outro(messages.zh.done);
639
+ p.intro(msg.setup);
640
+ await stepInstallGlobally(msg);
641
+ const platforms = await stepSelectPlatforms(msg);
642
+ await stepInstallSkills(msg, platforms);
643
+ await stepConfigInit(msg);
644
+ await stepAuthLogin(msg);
645
+ p.outro(msg.done);
577
646
  } else {
578
- console.log(messages.zh.setup);
579
- await stepInstallGlobally(messages.zh);
647
+ console.log(msg.setup);
648
+ await stepInstallGlobally(msg);
580
649
  const platforms = ["agents"];
581
- await stepInstallSkills(messages.zh, platforms);
582
- console.log(messages.zh.nonTtyHint);
650
+ await stepInstallSkills(msg, platforms);
651
+ console.log(msg.nonTtyHint);
583
652
  }
584
653
  }
585
654
 
586
655
  async function doUninstall() {
587
656
  const isInteractive = isInteractiveEnv();
657
+ const msg = messages[LANG];
588
658
 
589
659
  if (isInteractive) {
590
660
  const ok = await p.confirm({
591
- message: "将移除全局包、AI Skills 和配置文件。是否继续?",
661
+ message: msg.uninstallConfirm,
592
662
  });
593
663
  if (p.isCancel(ok) || !ok) {
594
- p.cancel("卸载已取消");
664
+ p.cancel(msg.uninstallCancelled);
595
665
  process.exit(0);
596
666
  }
597
667
  }
@@ -601,9 +671,9 @@ async function doUninstall() {
601
671
  await stepUninstallPackage();
602
672
 
603
673
  if (isInteractive) {
604
- p.outro("卸载完成");
674
+ p.outro(msg.uninstallDone);
605
675
  } else {
606
- console.log("\nUninstall complete.");
676
+ console.log("\n" + msg.uninstallComplete);
607
677
  }
608
678
  }
609
679