@manturhub/cli 0.9.10-dev.20260810.5 → 0.9.10-dev.20260810.6

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
@@ -15,16 +15,17 @@ manturhub login
15
15
  printf '%s' "$YOUR_MANTURHUB_KEY" | manturhub login --key-stdin
16
16
  ```
17
17
 
18
- CLI 默认连接生产站 `https://hub.mantur.ai`,Key 也必须在该生产站创建。
18
+ 稳定版 `@manturhub/cli@latest` 默认连接生产站 `https://hub.mantur.ai`,生产 Key 必须在该站创建。
19
19
 
20
- 开发和测试环境使用开发网关:
20
+ 开发版 `@manturhub/cli@dev` 默认连接开发网关,无需设置环境变量:
21
21
 
22
22
  ```bash
23
- MANTURHUB_BASE=http://gateway-dev.guiyi.cn manturhub login
24
- MANTURHUB_BASE=http://gateway-dev.guiyi.cn manturhub ls
23
+ npm install -g @manturhub/cli@dev
24
+ manturhub login
25
+ manturhub ls
25
26
  ```
26
27
 
27
- 开发网关是唯一允许使用远程 HTTP 的例外;生产站和其他远程部署必须使用 HTTPS。开发网关与生产站的 API Key 不通用。
28
+ `MANTURHUB_BASE` 可显式覆盖包的默认网关。开发网关是唯一允许使用远程 HTTP 的例外;生产站和其他远程部署必须使用 HTTPS。开发网关与生产站的 API Key 不通用。
28
29
  算子列表和详情通过 `/api/openapi/v1/operators` 获取,只返回当前 Key 已授权的算子。
29
30
  文件先通过 `POST /api/openapi/v1/files/upload` 提交 `files: [{ fileName, contentType, size }]`,从 `data.files[0]` 获取 `uploadUrl` 和 `downloadUrl`,再以 PUT 将文件流式上传到 `uploadUrl`;上传成功后命令输出 `downloadUrl`。API Key 只发送给 ManturHub 网关,不会发送给对象存储。
30
31
 
@@ -68,6 +69,6 @@ CLI 会在付费调用前按算子实时 schema 校验未知字段、必填项
68
69
 
69
70
  机器消费输出可在支持的查询命令上加 `--json`。进度和提示写入 stderr,JSON 结果写入 stdout。
70
71
 
71
- 环境变量:`MANTURHUB_KEY`(优先于配置文件) · `MANTURHUB_BASE`(测试或私有部署覆盖,默认 `https://hub.mantur.ai`)。
72
+ 环境变量:`MANTURHUB_KEY`(优先于配置文件) · `MANTURHUB_BASE`(显式覆盖当前发布通道的默认网关)。
72
73
 
73
74
  ManturHub 算子广场:https://hub.mantur.ai
package/lib/config.js CHANGED
@@ -11,11 +11,22 @@ import {
11
11
  // Local config lives at ~/.manturhub/config.json (chmod 600). Env vars win over it.
12
12
  const DIR = join(homedir(), ".manturhub");
13
13
  const FILE = join(DIR, "config.json");
14
- // Published CLI defaults to production; test/private deployments override with
15
- // MANTURHUB_BASE or config.json. All generated links must go through getBaseUrl().
16
- const DEFAULT_BASE = "https://hub.mantur.ai";
17
14
  const DEVELOPMENT_HTTP_ORIGIN = "http://gateway-dev.guiyi.cn";
18
- const LEGACY_DEFAULT_BASES = new Set([
15
+ const PRODUCTION_ORIGIN = "https://hub.mantur.ai";
16
+ const PACKAGE_VERSION = JSON.parse(
17
+ readFileSync(new URL("../package.json", import.meta.url), "utf8")
18
+ ).version;
19
+
20
+ export function defaultBaseForVersion(version) {
21
+ return /-dev(?:\.|$)/.test(String(version)) ? DEVELOPMENT_HTTP_ORIGIN : PRODUCTION_ORIGIN;
22
+ }
23
+
24
+ // dev 预发布包默认连接开发网关,稳定包默认连接生产网关。MANTURHUB_BASE
25
+ // 仍可显式覆盖;历史配置中保存过的官方默认地址不应覆盖当前发布通道。
26
+ const DEFAULT_BASE = defaultBaseForVersion(PACKAGE_VERSION);
27
+ const KNOWN_DEFAULT_BASES = new Set([
28
+ DEVELOPMENT_HTTP_ORIGIN,
29
+ PRODUCTION_ORIGIN,
19
30
  "https://hub.mantur.cn",
20
31
  "https://manturhub.leisurecat.cloud",
21
32
  "https://api.ophub.com",
@@ -68,6 +79,6 @@ function validateBaseUrl(value) {
68
79
  export function getBaseUrl() {
69
80
  if (process.env.MANTURHUB_BASE) return validateBaseUrl(process.env.MANTURHUB_BASE);
70
81
  const storedBase = loadConfig().baseUrl?.replace(/\/$/, "");
71
- if (storedBase && !LEGACY_DEFAULT_BASES.has(storedBase)) return validateBaseUrl(storedBase);
82
+ if (storedBase && !KNOWN_DEFAULT_BASES.has(storedBase)) return validateBaseUrl(storedBase);
72
83
  return DEFAULT_BASE;
73
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manturhub/cli",
3
- "version": "0.9.10-dev.20260810.5",
3
+ "version": "0.9.10-dev.20260810.6",
4
4
  "description": "ManturHub 算子广场 CLI:通过 REST 发现和调用 AI 算子、浏览配方,并安装 Skill 与 Agent 套件",
5
5
  "type": "module",
6
6
  "bin": {