gaoding-cli 1.0.0-alpha.5 → 1.0.0-alpha.7
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/CHANGELOG.md +21 -0
- package/README.md +2 -2
- package/dist/src/api/direct-tools.js +2 -2
- package/dist/src/commands/tools.js +1 -1
- package/dist/src/commands/workflows.js +1 -1
- package/dist/src/middleware/error-handler.js +2 -2
- package/dist/src/program.js +2 -2
- package/dist/src/utils/config.d.ts +2 -2
- package/dist/src/utils/config.js +1 -1
- package/package.json +2 -9
- package/dist/src/registry/app-loader.d.ts +0 -2
- package/dist/src/registry/app-loader.js +0 -70
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
7
7
|
|
|
8
|
+
## [1.0.0-alpha.7] - 2026-07-23
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- 修复 npm package version 与 `gd-cli --version` 不一致的问题,并新增 package integration 回归检查。
|
|
13
|
+
|
|
14
|
+
## [1.0.0-alpha.6] - 2026-07-23
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- 新增跨境电商 Customer Solution 的独立交付包和单一 `INSTALL.md` 执行入口。
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Customer Solution 文档同时支持人类阅读和 Agent 逐步执行,并明确首次单商品验收与外部提交确认边界。
|
|
23
|
+
- 公网 npm 包继续只包含 GD CLI,不包含 Customer Solution、客户配置或 `postinstall` 副作用。
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- 生图任务轮询超时后不再错误切换模型并重复提交任务。
|
|
28
|
+
|
|
8
29
|
## [1.0.0-alpha.5] - 2026-07-16
|
|
9
30
|
|
|
10
31
|
### Added
|
package/README.md
CHANGED
|
@@ -36,11 +36,11 @@ gd-cli auth status
|
|
|
36
36
|
gd-cli org list
|
|
37
37
|
gd-cli org switch --org <org-id>
|
|
38
38
|
|
|
39
|
-
gd-cli tools
|
|
39
|
+
gd-cli tools list
|
|
40
40
|
gd-cli tools call image.cutout --image ./product.jpg --mode product
|
|
41
41
|
gd-cli tools call text.title --brief "夏季运动鞋,轻量缓震,适合通勤"
|
|
42
42
|
|
|
43
|
-
gd-cli workflows
|
|
43
|
+
gd-cli workflows list
|
|
44
44
|
gd-cli workflows run listing-gallery \
|
|
45
45
|
--image ./product.jpg \
|
|
46
46
|
--brief "夏季运动鞋,轻量缓震,适合通勤"
|
|
@@ -731,10 +731,10 @@ function shouldRetryModelFallback(error) {
|
|
|
731
731
|
if (isTransientNetworkError(error))
|
|
732
732
|
return true;
|
|
733
733
|
const message = errorMessage(error);
|
|
734
|
-
if (/没有可用的工具|tool-intent 没有返回|tool intent 没有返回|敏感|安全|审核|not[_\s-]?passed|audit|content|quota|额度|余额|point|credit|权限|permission|401|403|参数|必填|invalid|MEDIA_RESOURCE_UNREACHABLE/i.test(message)) {
|
|
734
|
+
if (/没有可用的工具|tool-intent 没有返回|tool intent 没有返回|敏感|安全|审核|not[_\s-]?passed|audit|content|quota|额度|余额|point|credit|权限|permission|401|403|参数|必填|invalid|timeout|超时|MEDIA_RESOURCE_UNREACHABLE/i.test(message)) {
|
|
735
735
|
return false;
|
|
736
736
|
}
|
|
737
|
-
return /tool-intent|scene_code|模型|model|unsupported|not support|暂不支持|第三方|三方|服务异常|
|
|
737
|
+
return /tool-intent|scene_code|模型|model|unsupported|not support|暂不支持|第三方|三方|服务异常|call_async|call_sync/i.test(message);
|
|
738
738
|
}
|
|
739
739
|
function selectedModelOutput(type, code, meta) {
|
|
740
740
|
return {
|
|
@@ -38,7 +38,7 @@ export function registerToolsCommand(program) {
|
|
|
38
38
|
const publicItems = items.map(toPublicToolPayload);
|
|
39
39
|
const format = resolveListOutputFormat(cmd);
|
|
40
40
|
if (shouldEmitEnvelope(format)) {
|
|
41
|
-
emitJson(wrapEnvelope({ tools: publicItems }, { command: "tools
|
|
41
|
+
emitJson(wrapEnvelope({ tools: publicItems }, { command: "tools list" }));
|
|
42
42
|
}
|
|
43
43
|
else if (format === "json") {
|
|
44
44
|
formatOutput(publicItems, format);
|
|
@@ -41,7 +41,7 @@ export function registerWorkflowsCommand(program) {
|
|
|
41
41
|
const publicItems = DIRECT_APPS.map(toPublicAppPayload);
|
|
42
42
|
const format = resolveListOutputFormat(cmd);
|
|
43
43
|
if (shouldEmitEnvelope(format)) {
|
|
44
|
-
emitJson(wrapEnvelope({ workflows: publicItems }, { command: "workflows
|
|
44
|
+
emitJson(wrapEnvelope({ workflows: publicItems }, { command: "workflows list" }));
|
|
45
45
|
}
|
|
46
46
|
else if (format === "json") {
|
|
47
47
|
formatOutput(publicItems, format);
|
|
@@ -15,8 +15,8 @@ const ERROR_GUIDES = {
|
|
|
15
15
|
ORG_INVALID: "当前组织无效:\n gd-cli org list",
|
|
16
16
|
PARAM_MISSING: "查看命令帮助:\n gd-cli <command> --help",
|
|
17
17
|
PARAM_INVALID: "参数值不合法,请检查参数格式",
|
|
18
|
-
TOOL_NOT_FOUND: "工具不存在:\n gd-cli tools
|
|
19
|
-
APP_NOT_FOUND: "Workflow 不存在:\n gd-cli workflows
|
|
18
|
+
TOOL_NOT_FOUND: "工具不存在:\n gd-cli tools list",
|
|
19
|
+
APP_NOT_FOUND: "Workflow 不存在:\n gd-cli workflows list",
|
|
20
20
|
TASK_NOT_FOUND: "任务不存在或已过期",
|
|
21
21
|
RATE_LIMITED: "请求过于频繁,请稍后重试",
|
|
22
22
|
QUOTA_EXCEEDED: `权益不足,请购买或升级后重试:\n ${ENTITLEMENT_PRICING_URL}`,
|
package/dist/src/program.js
CHANGED
|
@@ -87,8 +87,8 @@ GD CLI — 让稿定成为 Agent 的创意生产引擎
|
|
|
87
87
|
gd-cli auth login 登录稿定账号
|
|
88
88
|
gd-cli org list 查看可用组织
|
|
89
89
|
gd-cli org switch 切换当前组织
|
|
90
|
-
gd-cli workflows
|
|
91
|
-
gd-cli tools
|
|
90
|
+
gd-cli workflows list 查看完整创意场景
|
|
91
|
+
gd-cli tools list 查看单项 AI 创意能力
|
|
92
92
|
gd-cli dam upload ./image.png 上传素材到 DAM
|
|
93
93
|
|
|
94
94
|
常用选项:
|
|
@@ -5,9 +5,9 @@ export declare const PROD_API_BASE = "https://gdcli.gaoding.com/api";
|
|
|
5
5
|
export declare const GDHUB_DIR: string;
|
|
6
6
|
/** Migrate credentials from the early internal storage directory when present. */
|
|
7
7
|
export declare function migrateCredentialsIfNeeded(): void;
|
|
8
|
-
export declare const CLI_VERSION = "1.0.0-alpha.
|
|
8
|
+
export declare const CLI_VERSION = "1.0.0-alpha.7";
|
|
9
9
|
export declare const CLI_PACKAGE_NAME = "gaoding-cli";
|
|
10
|
-
export declare const CLI_USER_AGENT = "gd-cli/1.0.0-alpha.
|
|
10
|
+
export declare const CLI_USER_AGENT = "gd-cli/1.0.0-alpha.7";
|
|
11
11
|
export declare const GDHUB_CLI_CLIENT_ID = "gdhub-cli";
|
|
12
12
|
export declare const DEFAULT_SCOPE: readonly ["scene-executor", "run:scene-app", "use:tools", "export", "read:public"];
|
|
13
13
|
export declare const CACHE_TTL_MS: number;
|
package/dist/src/utils/config.js
CHANGED
|
@@ -32,7 +32,7 @@ export function migrateCredentialsIfNeeded() {
|
|
|
32
32
|
function readEnv(key, legacyKey) {
|
|
33
33
|
return process.env[key] ?? process.env[legacyKey];
|
|
34
34
|
}
|
|
35
|
-
export const CLI_VERSION = "1.0.0-alpha.
|
|
35
|
+
export const CLI_VERSION = "1.0.0-alpha.7";
|
|
36
36
|
export const CLI_PACKAGE_NAME = "gaoding-cli";
|
|
37
37
|
export const CLI_USER_AGENT = `gd-cli/${CLI_VERSION}`;
|
|
38
38
|
export const GDHUB_CLI_CLIENT_ID = "gdhub-cli";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gaoding-cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"description": "稿定 GD CLI - Tools / Workflows / DAM 命令行工具",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Gaoding",
|
|
@@ -18,13 +18,6 @@
|
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"dist/",
|
|
21
|
-
"!dist/src/commands/app.*",
|
|
22
|
-
"!dist/src/commands/config.*",
|
|
23
|
-
"!dist/src/commands/config-env.*",
|
|
24
|
-
"!dist/src/commands/info.*",
|
|
25
|
-
"!dist/src/commands/search.*",
|
|
26
|
-
"!dist/src/commands/task.*",
|
|
27
|
-
"!dist/src/commands/tool.*",
|
|
28
21
|
"skills/gd-cli/",
|
|
29
22
|
"README.md",
|
|
30
23
|
"SECURITY.md",
|
|
@@ -57,7 +50,7 @@
|
|
|
57
50
|
"open": "^10.1.2",
|
|
58
51
|
"ora": "^8.2.0",
|
|
59
52
|
"qrcode": "^1.5.4",
|
|
60
|
-
"sharp": "^0.
|
|
53
|
+
"sharp": "^0.35.3",
|
|
61
54
|
"uuid": "^11.1.0"
|
|
62
55
|
},
|
|
63
56
|
"devDependencies": {
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { RegistryCache } from "./registry-cache.js";
|
|
2
|
-
import { RegistryClient } from "./registry-client.js";
|
|
3
|
-
import { HubClient } from "../api/hub-client.js";
|
|
4
|
-
import { AppRunner } from "../api/app-runner.js";
|
|
5
|
-
import { withAuth } from "../middleware/auth.js";
|
|
6
|
-
import { withErrorHandler } from "../middleware/error-handler.js";
|
|
7
|
-
import { formatOutput } from "../middleware/output.js";
|
|
8
|
-
import { resolveInvokeOutputFormat } from "../utils/list-output-format.js";
|
|
9
|
-
import { appActivityLabel } from "../utils/tool-display.js";
|
|
10
|
-
import { createSpinner } from "../utils/spinner.js";
|
|
11
|
-
import { logger } from "../utils/logger.js";
|
|
12
|
-
export async function loadDynamicAppCommands(appCmd) {
|
|
13
|
-
const client = new HubClient();
|
|
14
|
-
const registryClient = new RegistryClient(client);
|
|
15
|
-
const cache = new RegistryCache(registryClient);
|
|
16
|
-
let registry;
|
|
17
|
-
try {
|
|
18
|
-
registry = await cache.get();
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
logger.debug("Registry 缓存不可用,跳过动态 APP 命令注册");
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const apps = registry.apps ?? [];
|
|
25
|
-
for (const app of apps) {
|
|
26
|
-
registerAppSubcommand(appCmd, app);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function registerAppSubcommand(parent, spec) {
|
|
30
|
-
const cmd = parent
|
|
31
|
-
.command(spec.id)
|
|
32
|
-
.description(spec.description);
|
|
33
|
-
for (const param of spec.input ?? []) {
|
|
34
|
-
const flag = param.cli_flag ?? `--${param.name}`;
|
|
35
|
-
const desc = param.description + (param.required ? " (必填)" : "");
|
|
36
|
-
cmd.option(`${flag} <value>`, desc);
|
|
37
|
-
}
|
|
38
|
-
cmd
|
|
39
|
-
.option("--async", "异步模式", false)
|
|
40
|
-
.option("--timeout <seconds>", "超时时间(秒)", String(spec.estimated_duration * 2))
|
|
41
|
-
.action(withErrorHandler(withAuth(async (...args) => {
|
|
42
|
-
const opts = args[0];
|
|
43
|
-
const cmd = args[1];
|
|
44
|
-
const params = {};
|
|
45
|
-
for (const [k, v] of Object.entries(opts)) {
|
|
46
|
-
if (k !== "async" && k !== "timeout" && v !== undefined && v !== false) {
|
|
47
|
-
params[k] = v;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const label = appActivityLabel(spec.id, spec.name);
|
|
51
|
-
const spinner = createSpinner(`${label} · 处理中…`);
|
|
52
|
-
if (process.stderr.isTTY)
|
|
53
|
-
spinner.start();
|
|
54
|
-
const runner = new AppRunner();
|
|
55
|
-
const result = await runner.run(spec.id, params, {
|
|
56
|
-
async: !!opts.async,
|
|
57
|
-
timeout: parseInt(String(opts.timeout)),
|
|
58
|
-
});
|
|
59
|
-
if (process.stderr.isTTY) {
|
|
60
|
-
if (result.status === "completed")
|
|
61
|
-
spinner.succeed(`${label} · 已完成`);
|
|
62
|
-
else if (result.status === "failed")
|
|
63
|
-
spinner.fail(`${label} · 失败`);
|
|
64
|
-
else
|
|
65
|
-
spinner.stop();
|
|
66
|
-
}
|
|
67
|
-
const format = resolveInvokeOutputFormat(cmd);
|
|
68
|
-
formatOutput(result, format, { activityLabel: label });
|
|
69
|
-
})));
|
|
70
|
-
}
|