gaoding-cli 1.0.0-alpha.8 → 1.0.0-alpha.9
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 +18 -0
- package/README.md +47 -64
- package/dist/bin/gd-cli.js +2 -2
- package/dist/src/api/app-runner.d.ts +1 -4
- package/dist/src/api/app-runner.js +10 -42
- package/dist/src/api/dam-client.d.ts +0 -7
- package/dist/src/api/dam-client.js +0 -17
- package/dist/src/commands/auth.js +5 -41
- package/dist/src/commands/creative.js +37 -45
- package/dist/src/commands/dam.js +248 -110
- package/dist/src/commands/org.js +17 -39
- package/dist/src/commands/skills.js +24 -114
- package/dist/src/commands/update.js +10 -85
- package/dist/src/commands/usage.js +4 -17
- package/dist/src/commands/workflows.d.ts +1 -1
- package/dist/src/commands/workflows.js +283 -199
- package/dist/src/core/output/envelope.d.ts +1 -0
- package/dist/src/core/output/envelope.js +76 -6
- package/dist/src/creative/contract.d.ts +28 -80
- package/dist/src/creative/contract.js +23 -44
- package/dist/src/creative/protocol.js +6 -6
- package/dist/src/io.d.ts +0 -2
- package/dist/src/io.js +0 -8
- package/dist/src/middleware/error-handler.d.ts +7 -1
- package/dist/src/middleware/error-handler.js +59 -54
- package/dist/src/program.d.ts +1 -0
- package/dist/src/program.js +138 -41
- package/dist/src/registry/agent-contracts.d.ts +14 -26
- package/dist/src/registry/agent-contracts.js +214 -64
- package/dist/src/utils/capability-presenter.js +6 -29
- package/dist/src/utils/config.d.ts +2 -2
- package/dist/src/utils/config.js +1 -1
- package/dist/src/utils/sensitive-path.js +1 -4
- package/package.json +2 -1
- package/skills/gd-cli/SKILL.md +6 -6
- package/skills/gd-cli/references/auth.md +3 -10
- package/skills/gd-cli/references/creative.md +11 -11
- package/skills/gd-cli/references/entitlement.md +2 -2
- package/skills/gd-cli/references/errors.md +4 -4
- package/skills/gd-cli/references/org.md +3 -3
- package/skills/gd-cli/references/sop.md +5 -5
- package/skills/gd-cli/references/update.md +4 -3
- package/skills/gd-cli/references/workflows.md +6 -5
- package/dist/src/utils/list-output-format.d.ts +0 -10
- package/dist/src/utils/list-output-format.js +0 -34
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
export function printCapabilitySchema(payload) {
|
|
3
3
|
const id = stringValue(payload.id);
|
|
4
|
-
const type = stringValue(payload.type);
|
|
5
|
-
const namespace = namespaceForType(type);
|
|
6
4
|
const title = stringValue(payload.title) || id;
|
|
7
5
|
const category = stringValue(payload.category);
|
|
8
6
|
const description = stringValue(payload.description);
|
|
9
7
|
console.log(chalk.bold(`${title} (${id})`));
|
|
10
|
-
console.log(
|
|
8
|
+
console.log("类型: Workflow 场景");
|
|
11
9
|
if (category)
|
|
12
10
|
console.log(`分类: ${category}`);
|
|
13
11
|
if (description)
|
|
@@ -27,23 +25,18 @@ export function printCapabilitySchema(payload) {
|
|
|
27
25
|
const stdin = recordValue(payload.stdin);
|
|
28
26
|
const stdinCommand = stringValue(stdin?.command);
|
|
29
27
|
const canonicalCommand = stringValue(payload.canonical_command);
|
|
30
|
-
const fallbackCommand =
|
|
31
|
-
? `gd-cli workflows run ${id} --input input.json --format json`
|
|
32
|
-
: `gd-cli ${namespace} call ${id} --input input.json --format json`;
|
|
28
|
+
const fallbackCommand = `gd-cli workflows run ${id} --input input.json --json`;
|
|
33
29
|
console.log("");
|
|
34
30
|
console.log(chalk.bold("调用方式:"));
|
|
35
31
|
console.log(` ${canonicalCommand ?? fallbackCommand}`);
|
|
36
32
|
if (stdinCommand)
|
|
37
33
|
console.log(` ${stdinCommand}`);
|
|
38
34
|
console.log("");
|
|
39
|
-
console.log(
|
|
40
|
-
console.log(` gd-cli
|
|
41
|
-
console.log(` gd-cli ${namespace} examples ${id} --format json`);
|
|
35
|
+
console.log(` 完整 JSON Schema: gd-cli workflows schema ${id} --json`);
|
|
36
|
+
console.log(` 调用示例: gd-cli workflows examples ${id}`);
|
|
42
37
|
}
|
|
43
38
|
export function printCapabilityExamples(payload) {
|
|
44
39
|
const id = stringValue(payload.id);
|
|
45
|
-
const type = stringValue(payload.type);
|
|
46
|
-
const namespace = namespaceForType(type);
|
|
47
40
|
const title = stringValue(payload.title) || id;
|
|
48
41
|
const category = stringValue(payload.category);
|
|
49
42
|
const description = stringValue(payload.description);
|
|
@@ -51,7 +44,7 @@ export function printCapabilityExamples(payload) {
|
|
|
51
44
|
? payload.examples.filter(isRecord)
|
|
52
45
|
: [];
|
|
53
46
|
console.log(chalk.bold(`${title} (${id})`));
|
|
54
|
-
console.log(
|
|
47
|
+
console.log("类型: Workflow 场景");
|
|
55
48
|
if (category)
|
|
56
49
|
console.log(`分类: ${category}`);
|
|
57
50
|
if (description)
|
|
@@ -74,23 +67,7 @@ export function printCapabilityExamples(payload) {
|
|
|
74
67
|
}
|
|
75
68
|
});
|
|
76
69
|
console.log("");
|
|
77
|
-
console.log(
|
|
78
|
-
console.log(` gd-cli ${namespace} examples ${id} --format json`);
|
|
79
|
-
console.log(` gd-cli ${namespace} schema ${id} --format json`);
|
|
80
|
-
}
|
|
81
|
-
function namespaceForType(type) {
|
|
82
|
-
if (type === "workflow")
|
|
83
|
-
return "workflows";
|
|
84
|
-
if (type === "skill")
|
|
85
|
-
return "skills";
|
|
86
|
-
return "tools";
|
|
87
|
-
}
|
|
88
|
-
function labelForType(type) {
|
|
89
|
-
if (type === "workflow")
|
|
90
|
-
return "Workflow 场景";
|
|
91
|
-
if (type === "skill")
|
|
92
|
-
return "Skill 说明";
|
|
93
|
-
return "Tool 能力";
|
|
70
|
+
console.log(`完整 JSON Schema: gd-cli workflows schema ${id} --json`);
|
|
94
71
|
}
|
|
95
72
|
function printSchemaFields(title, schema, kind) {
|
|
96
73
|
console.log(chalk.bold(`${title}:`));
|
|
@@ -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.9";
|
|
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.9";
|
|
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.9";
|
|
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";
|
|
@@ -29,7 +29,7 @@ const SENSITIVE_FILENAMES = new Set([
|
|
|
29
29
|
]);
|
|
30
30
|
export function assertSafeUploadPath(file, options = {}) {
|
|
31
31
|
const absolutePath = path.resolve(process.cwd(), file);
|
|
32
|
-
if (
|
|
32
|
+
if (options.allowSensitivePath === true)
|
|
33
33
|
return absolutePath;
|
|
34
34
|
const reason = sensitivePathReason(absolutePath);
|
|
35
35
|
if (reason) {
|
|
@@ -64,6 +64,3 @@ export function sensitivePathReason(file) {
|
|
|
64
64
|
}
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
67
|
-
function allowSensitive(options) {
|
|
68
|
-
return options.allowSensitivePath === true || process.env.GD_CLI_ALLOW_SENSITIVE_PATHS === "1";
|
|
69
|
-
}
|
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.9",
|
|
4
4
|
"description": "稿定 GD CLI - Creative / Workflows / DAM 命令行工具",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Gaoding",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"@types/node": "^22.14.1",
|
|
60
60
|
"@types/qrcode": "^1.5.6",
|
|
61
61
|
"@types/uuid": "^10.0.0",
|
|
62
|
+
"ajv": "^8.20.0",
|
|
62
63
|
"eslint": "^9.24.0",
|
|
63
64
|
"tsx": "^4.19.4",
|
|
64
65
|
"typescript": "^5.8.3",
|
package/skills/gd-cli/SKILL.md
CHANGED
|
@@ -7,7 +7,7 @@ description: 当用户需要使用稿定生成图片、视频、电商素材或
|
|
|
7
7
|
|
|
8
8
|
## 执行原则
|
|
9
9
|
|
|
10
|
-
当用户提出图片、视频、电商物料或 DAM 素材需求时,优先使用本地 `gd-cli
|
|
10
|
+
当用户提出图片、视频、电商物料或 DAM 素材需求时,优先使用本地 `gd-cli`。不要因当前 Agent 的能力列表中没有稿定入口,就改用本地 Canvas、ffmpeg、SVG 或未文档化接口。
|
|
11
11
|
|
|
12
12
|
开始执行前:
|
|
13
13
|
|
|
@@ -20,16 +20,16 @@ description: 当用户需要使用稿定生成图片、视频、电商素材或
|
|
|
20
20
|
- CLI 与 Skill 升级读 `references/update.md`。
|
|
21
21
|
- 统一创作读 `references/creative.md`,多步骤场景读 `references/workflows.md`。
|
|
22
22
|
|
|
23
|
-
Agent 只根据公开的 `creative`、`workflows` 和 `dam`
|
|
23
|
+
Agent 只根据公开的 `creative`、`workflows` 和 `dam` 命令完成用户需求。普通生成任务中不要切换组织、环境或模型,也不要调用内部运行时类或未文档化接口。
|
|
24
24
|
|
|
25
25
|
## 能力选择
|
|
26
26
|
|
|
27
27
|
先读取 Creative 契约和 Workflow 列表,再按用户意图组织输入:
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
gd-cli creative schema --
|
|
31
|
-
gd-cli creative examples
|
|
32
|
-
gd-cli workflows list --
|
|
30
|
+
gd-cli creative schema --json
|
|
31
|
+
gd-cli creative examples
|
|
32
|
+
gd-cli workflows list --json
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
| 用户意图 | 命令 |
|
|
@@ -43,7 +43,7 @@ gd-cli workflows list --format json
|
|
|
43
43
|
| 小红书种草图文 | `gd-cli workflows run social-seeding-pack` |
|
|
44
44
|
| Campaign KV、多渠道素材 | `gd-cli workflows run campaign-kv-pack` |
|
|
45
45
|
|
|
46
|
-
复杂输入优先通过 `--input <json-file>` 或 stdin
|
|
46
|
+
复杂输入优先通过 `--input <json-file>` 或 stdin 传入。只在该命令支持时传入 `--json`;最终回复按 `references/deliverables.md` 展示预览、链接或文件,不要直接转发整段原始 JSON。
|
|
47
47
|
|
|
48
48
|
## 参考资料
|
|
49
49
|
|
|
@@ -5,20 +5,13 @@
|
|
|
5
5
|
在 Agent 或非 TTY Shell 中执行:
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
gd-cli auth login --no-browser
|
|
8
|
+
gd-cli auth login --no-browser
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- `type=device_authorization`
|
|
14
|
-
- `verification_uri_complete`
|
|
15
|
-
- `expires_in`
|
|
16
|
-
- `interval`
|
|
17
|
-
|
|
18
|
-
Agent 必须立即把 `verification_uri_complete` 原样发送给用户,并保持授权进程运行。用户完成授权后,再执行:
|
|
11
|
+
登录命令只输出面向人的授权信息。Agent 必须从输出中提取授权 URL,原样发送给用户,并保持授权进程运行。用户完成授权后,再执行:
|
|
19
12
|
|
|
20
13
|
```bash
|
|
21
|
-
gd-cli auth status --
|
|
14
|
+
gd-cli auth status --json
|
|
22
15
|
```
|
|
23
16
|
|
|
24
17
|
状态输出只区分登录凭证与当前组织:
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
# GD CLI Creative
|
|
2
2
|
|
|
3
|
-
Creative
|
|
3
|
+
Creative 是统一的创作入口。使用者只描述期望的最终结果并提供必要素材与约束,不需要选择具体实现能力。
|
|
4
4
|
|
|
5
5
|
## 发现契约
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
gd-cli creative schema --
|
|
9
|
-
gd-cli creative examples
|
|
8
|
+
gd-cli creative schema --json
|
|
9
|
+
gd-cli creative examples
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
`creative schema`
|
|
12
|
+
`creative schema` 是本地静态输出;`creative examples` 输出完整可运行的 shell 命令,两者都不请求生成接口。
|
|
13
13
|
|
|
14
14
|
## 发起创作
|
|
15
15
|
|
|
16
16
|
纯文本请求:
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
gd-cli creative run --prompt "为轻量跑鞋写三条简洁的电商标题" --
|
|
19
|
+
gd-cli creative run --prompt "为轻量跑鞋写三条简洁的电商标题" --json
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
需要媒体、比例、分辨率、时长或连续会话时,把完整 JSON 写入文件或 stdin:
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
gd-cli creative run --input request.json --
|
|
26
|
-
cat request.json | gd-cli creative run --input - --
|
|
25
|
+
gd-cli creative run --input request.json --json
|
|
26
|
+
cat request.json | gd-cli creative run --input - --json
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
输入中使用:
|
|
30
30
|
|
|
31
|
-
- `prompt`
|
|
31
|
+
- `prompt` 描述主体、用途、内容、风格、场景、构图或镜头,以及必须保留和避免的事项。
|
|
32
32
|
- `media[]` 传入本地路径或 HTTP(S) URL,并用 `role` 标明 `reference`、`first_frame` 或 `last_frame`。
|
|
33
|
-
- `parameters` 传入可结构化表达的 `ratio`、`resolution` 和 `duration_seconds
|
|
33
|
+
- `parameters` 传入可结构化表达的 `ratio`、`resolution` 和 `duration_seconds`。
|
|
34
34
|
- `conversation_id` 仅在继续已有创作或回答追问时传入;首次请求不传。
|
|
35
|
-
- 回答追问时传入上一次结果中的 `
|
|
35
|
+
- 回答追问时传入上一次结果中的 `question_message_id` 和 `answers[]`。`answers[].values` 可以是推荐选项之外的自定义值。
|
|
36
36
|
|
|
37
37
|
`media` 不能单独提交;`first_frame` 和 `last_frame` 各最多一份且必须是图片。视频、音频只能作为 `reference`。
|
|
38
38
|
|
|
@@ -41,7 +41,7 @@ cat request.json | gd-cli creative run --input - --format json
|
|
|
41
41
|
机器调用只读取一次最终 JSON:
|
|
42
42
|
|
|
43
43
|
- `status=completed` 且 `data.finish_reason=completed`:本轮完成。
|
|
44
|
-
- `status=completed` 且 `data.finish_reason=requires_input`:按 `data.questions` 组织回答,并将 `conversation_id`、`
|
|
44
|
+
- `status=completed` 且 `data.finish_reason=requires_input`:按 `data.questions` 组织回答,并将 `conversation_id`、`question_message_id` 原样带回下一次请求。
|
|
45
45
|
- `status=failed`:读取 `error.code`、`error.message`、`error.hint` 和 `error.retryable`,按 `references/errors.md` 处理。
|
|
46
46
|
|
|
47
47
|
CLI 只输出一次最终结果,不输出中间过程。最终媒体位于 `data.outputs[]`,文本位于 `data.message` 或 `data.outputs[]` 的 `type=text` 项。
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
用户询问剩余稿豆、权益余额或还能生成几次时,执行:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
gd-cli org credits --
|
|
18
|
+
gd-cli org credits --json
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
只根据 `organization`、`credits.total`、`credits.used`、`credits.wait` 和 `credits.surplus` 回复。若用户要求查看其他组织,先执行 `gd-cli org list --
|
|
21
|
+
只根据 `organization`、`credits.total`、`credits.used`、`credits.wait` 和 `credits.surplus` 回复。若用户要求查看其他组织,先执行 `gd-cli org list --json`,等待用户明确选择后再切换。
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## 停止规则
|
|
4
4
|
|
|
5
|
-
1.
|
|
5
|
+
1. 机器可读调用非零退出时,解析 stdout 中的 JSON envelope。
|
|
6
6
|
2. 优先读取 `error.code`、`error.message`、`error.hint`、`error.next_steps`、`pricing_url` 和 `retryable`。
|
|
7
7
|
3. `retryable=false` 或未提供 `retryable` 时,不重复执行同一失败命令。
|
|
8
8
|
4. 只有 `NETWORK_TRANSIENT` 可以短暂重试一次;第二次失败必须停止。
|
|
9
|
-
5.
|
|
9
|
+
5. 内部路由不可用、权益不足、参数错误、授权错误和组织错误都不能盲目重试。
|
|
10
10
|
|
|
11
11
|
## 禁止扩展诊断
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
除非用户明确要求诊断,否则失败后不要切换组织、模型或环境,也不探测未文档化接口。
|
|
14
14
|
|
|
15
15
|
## 授权与当前组织
|
|
16
16
|
|
|
17
17
|
- `AUTH_MISSING`、`AUTH_EXPIRED`:停止当前操作,按 `auth.md` 让用户登录。
|
|
18
|
-
- `ORG_REQUIRED`:执行 `gd-cli org list --
|
|
18
|
+
- `ORG_REQUIRED`:执行 `gd-cli org list --json`,等待用户明确选择后再执行 `org switch`。
|
|
19
19
|
- `ORG_INVALID`:当前组织已被 CLI 清除;重新列出组织并等待用户选择,不自动重放刚才的生成或 DAM 操作。
|
|
20
20
|
- CLI 会在需要时内部维护当前组织访问;不要读取或解释内部刷新时间,也不要要求用户为此反复切换组织。
|
|
21
21
|
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
Agent 可以读取组织,但不能替用户选择组织:
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
gd-cli org list --
|
|
9
|
-
gd-cli org current --
|
|
8
|
+
gd-cli org list --json
|
|
9
|
+
gd-cli org current --json
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
只有用户明确选择具体组织后,才执行:
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
gd-cli org switch --org <org-id>
|
|
15
|
+
gd-cli org switch --org <org-id>
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
如果 `org list` 返回多个组织,向用户列出组织名称、组织 ID 和当前状态,然后等待选择。不要根据名称、权益、历史记录或猜测自动切换。
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
## 总规则
|
|
4
4
|
|
|
5
5
|
1. 用户要图片、视频、电商物料或 DAM 素材时,优先使用 `gd-cli`。
|
|
6
|
-
2.
|
|
6
|
+
2. 仅在目标叶命令支持时使用 `--json` 解析结果、错误、URL、`task_id` 或 Schema;非 TTY 不会自动启用 JSON。
|
|
7
7
|
3. stdout JSON 用于解析结果,stderr 仅用于进度和排错。
|
|
8
8
|
4. 普通生成任务只使用公开的 `creative`、`workflows` 和 `dam` 命令。
|
|
9
9
|
5. 不替用户切换组织、环境或模型;涉及账号、组织、充值或授权时,把选择交给用户。
|
|
10
10
|
|
|
11
11
|
## 推荐流程
|
|
12
12
|
|
|
13
|
-
1. 必要时执行 `gd-cli auth status --
|
|
14
|
-
2. 未登录时按 `auth.md`
|
|
15
|
-
3. 使用 `gd-cli creative schema --
|
|
13
|
+
1. 必要时执行 `gd-cli auth status --json` 检查授权状态。
|
|
14
|
+
2. 未登录时按 `auth.md` 执行 `gd-cli auth login --no-browser`,从人类输出提取授权 URL 并原样发送给用户。
|
|
15
|
+
3. 使用 `gd-cli creative schema --json`、`gd-cli creative examples` 和 `gd-cli workflows list --json` 发现能力。
|
|
16
16
|
4. 图片、视频和文本创作统一使用 Creative,多步骤交付使用 Workflow。
|
|
17
17
|
5. 执行命令后等待终态,解析 `status`、`outputs`、`assets`、`task_id` 和交付路径。
|
|
18
18
|
6. 按 `deliverables.md` 交付预览、链接、本地文件或完整交付包。
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
## 调用边界
|
|
21
21
|
|
|
22
22
|
- 用户未指定模型时,直接调用目标能力,不主动查询或切换模型。
|
|
23
|
-
- 用户未要求诊断时,不探测内部 endpoint
|
|
23
|
+
- 用户未要求诊断时,不探测内部 endpoint、能力路由或组织权限。
|
|
24
24
|
- 一次调用失败后按 `errors.md` 处理,不扩展为无关诊断。
|
|
25
25
|
- Workflow 可能连续调用多个内部能力;不要在 Workflow 运行中并行发起重复任务。
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
## 检查和升级 CLI
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
gd-cli update check --format json
|
|
7
6
|
gd-cli update
|
|
8
7
|
```
|
|
9
8
|
|
|
10
|
-
CLI
|
|
9
|
+
`update` 没有子命令或选项,会检查最新版本并在全局安装场景执行升级。CLI 升级完成后,仅在已安装 canonical Skill 时刷新该 Skill。
|
|
10
|
+
|
|
11
|
+
也可单独刷新已安装的 Agent Skill:
|
|
11
12
|
|
|
12
13
|
```bash
|
|
13
14
|
gd-cli skills update
|
|
14
15
|
```
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
只有安装内容确实变化时,才提示用户重启 Agent 或开启新会话。
|
|
@@ -5,13 +5,14 @@ Workflow 编排预定义步骤和内部能力,适合需要一组完整交付
|
|
|
5
5
|
发现和执行:
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
gd-cli workflows list --
|
|
9
|
-
gd-cli workflows
|
|
10
|
-
gd-cli workflows
|
|
11
|
-
gd-cli workflows
|
|
12
|
-
gd-cli workflows run <workflow-id> --input brief.json --format json
|
|
8
|
+
gd-cli workflows list --json
|
|
9
|
+
gd-cli workflows schema <workflow-id> --json
|
|
10
|
+
gd-cli workflows examples <workflow-id>
|
|
11
|
+
gd-cli workflows run <workflow-id> --input brief.json --json
|
|
13
12
|
```
|
|
14
13
|
|
|
14
|
+
`examples` 输出完整可运行命令,不支持 JSON 输出。`list`、`schema` 和 `run` 仅在显式传入 `--json` 时输出机器可读结果。
|
|
15
|
+
|
|
15
16
|
| Workflow ID | 场景 | 交付内容 |
|
|
16
17
|
| --- | --- | --- |
|
|
17
18
|
| `listing-gallery` | Listing、商品图库、上架素材 | 白底主图、卖点图、细节图、场景图和文案 |
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Command } from "commander";
|
|
2
|
-
/**
|
|
3
|
-
* 列表类命令:未显式指定 -f/--format 时,TTY 用 table,管道/非 TTY 用 json。
|
|
4
|
-
* 显式传入 -f json|text|table 时始终尊重用户选择。
|
|
5
|
-
*/
|
|
6
|
-
export declare function resolveListOutputFormat(subcommand: Command): string;
|
|
7
|
-
/**
|
|
8
|
-
* 工具调用 / 应用运行 / 任务状态:未显式 -f 时,TTY 用 human(交付物可读),非 TTY 用 json。
|
|
9
|
-
*/
|
|
10
|
-
export declare function resolveInvokeOutputFormat(subcommand: Command): string;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
function getRoot(subcommand) {
|
|
2
|
-
return subcommand.parent?.parent ?? subcommand.parent;
|
|
3
|
-
}
|
|
4
|
-
function isImplicitFormat(root) {
|
|
5
|
-
const source = root?.getOptionValueSource("format");
|
|
6
|
-
return (source === undefined || source === "default" || source === "implied");
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* 列表类命令:未显式指定 -f/--format 时,TTY 用 table,管道/非 TTY 用 json。
|
|
10
|
-
* 显式传入 -f json|text|table 时始终尊重用户选择。
|
|
11
|
-
*/
|
|
12
|
-
export function resolveListOutputFormat(subcommand) {
|
|
13
|
-
const root = getRoot(subcommand);
|
|
14
|
-
const opts = (root?.opts() ?? {});
|
|
15
|
-
if (opts.json)
|
|
16
|
-
return "json";
|
|
17
|
-
const format = opts.format ?? "json";
|
|
18
|
-
if (!isImplicitFormat(root))
|
|
19
|
-
return format;
|
|
20
|
-
return process.stdout.isTTY ? "table" : "json";
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* 工具调用 / 应用运行 / 任务状态:未显式 -f 时,TTY 用 human(交付物可读),非 TTY 用 json。
|
|
24
|
-
*/
|
|
25
|
-
export function resolveInvokeOutputFormat(subcommand) {
|
|
26
|
-
const root = getRoot(subcommand);
|
|
27
|
-
const opts = (root?.opts() ?? {});
|
|
28
|
-
if (opts.json)
|
|
29
|
-
return "json";
|
|
30
|
-
const format = opts.format ?? "json";
|
|
31
|
-
if (!isImplicitFormat(root))
|
|
32
|
-
return format;
|
|
33
|
-
return process.stdout.isTTY ? "human" : "json";
|
|
34
|
-
}
|