gaoding-cli 1.0.0-alpha.7 → 1.0.0-alpha.8

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +18 -14
  3. package/dist/src/api/app-runner.js +1 -2
  4. package/dist/src/api/creative-client.d.ts +34 -0
  5. package/dist/src/api/creative-client.js +184 -0
  6. package/dist/src/api/direct-client.d.ts +9 -2
  7. package/dist/src/api/direct-client.js +45 -18
  8. package/dist/src/api/hub-client.d.ts +11 -8
  9. package/dist/src/api/hub-client.js +17 -18
  10. package/dist/src/api/usage-client.d.ts +4 -4
  11. package/dist/src/api/usage-client.js +9 -49
  12. package/dist/src/auth/credential-store-v2.d.ts +0 -1
  13. package/dist/src/auth/credential-store-v2.js +0 -6
  14. package/dist/src/commands/auth.js +13 -13
  15. package/dist/src/commands/creative.d.ts +8 -0
  16. package/dist/src/commands/creative.js +186 -0
  17. package/dist/src/commands/dam.js +27 -22
  18. package/dist/src/commands/org.js +20 -14
  19. package/dist/src/commands/skills.js +9 -4
  20. package/dist/src/commands/update.js +6 -2
  21. package/dist/src/commands/usage.d.ts +1 -1
  22. package/dist/src/commands/usage.js +6 -4
  23. package/dist/src/commands/workflows.js +31 -13
  24. package/dist/src/core/auth/auth-guard.d.ts +21 -0
  25. package/dist/src/core/auth/auth-guard.js +121 -0
  26. package/dist/src/core/auth/org-manager.d.ts +2 -1
  27. package/dist/src/core/auth/org-manager.js +61 -6
  28. package/dist/src/creative/contract.d.ts +1112 -0
  29. package/dist/src/creative/contract.js +743 -0
  30. package/dist/src/creative/media.d.ts +19 -0
  31. package/dist/src/creative/media.js +83 -0
  32. package/dist/src/creative/protocol.d.ts +60 -0
  33. package/dist/src/creative/protocol.js +337 -0
  34. package/dist/src/middleware/auth.d.ts +6 -2
  35. package/dist/src/middleware/auth.js +25 -63
  36. package/dist/src/middleware/error-handler.d.ts +2 -0
  37. package/dist/src/middleware/error-handler.js +3 -4
  38. package/dist/src/program.js +7 -89
  39. package/dist/src/registry/agent-contracts.d.ts +3 -11
  40. package/dist/src/registry/agent-contracts.js +5 -243
  41. package/dist/src/registry/direct-registry.d.ts +0 -5
  42. package/dist/src/registry/direct-registry.js +0 -19
  43. package/dist/src/registry/registry-client.d.ts +0 -21
  44. package/dist/src/registry/registry-client.js +1 -40
  45. package/dist/src/utils/config.d.ts +2 -2
  46. package/dist/src/utils/config.js +1 -1
  47. package/dist/src/utils/help-verify.d.ts +1 -3
  48. package/dist/src/utils/help-verify.js +1 -25
  49. package/package.json +3 -3
  50. package/skills/gd-cli/SKILL.md +10 -9
  51. package/skills/gd-cli/references/auth.md +6 -0
  52. package/skills/gd-cli/references/creative.md +47 -0
  53. package/skills/gd-cli/references/entitlement.md +2 -2
  54. package/skills/gd-cli/references/errors.md +7 -0
  55. package/skills/gd-cli/references/sop.md +4 -4
  56. package/skills/gd-cli/references/workflows.md +1 -1
  57. package/dist/src/commands/models.d.ts +0 -2
  58. package/dist/src/commands/models.js +0 -78
  59. package/dist/src/commands/tools.d.ts +0 -4
  60. package/dist/src/commands/tools.js +0 -383
  61. package/skills/gd-cli/references/tools.md +0 -29
@@ -3,17 +3,13 @@ import { CLI_VERSION } from "./utils/config.js";
3
3
  import { registerAuthCommand } from "./commands/auth.js";
4
4
  import { registerOrgCommand } from "./commands/org.js";
5
5
  import { registerWorkflowsCommand } from "./commands/workflows.js";
6
- import { registerToolsCommand } from "./commands/tools.js";
6
+ import { registerCreativeCommand } from "./commands/creative.js";
7
7
  import { registerDamCommand } from "./commands/dam.js";
8
- import { registerModelsCommand } from "./commands/models.js";
9
8
  import { registerUpdateCommand } from "./commands/update.js";
10
9
  import { registerSkillsCommand } from "./commands/skills.js";
11
- import { registerUsageCommand } from "./commands/usage.js";
12
10
  import { maybeNotifyUpdate } from "./update/notifier.js";
13
- import { formatOutput } from "./middleware/output.js";
14
- import { buildManifest, buildTopExamples, rowsForManifest, } from "./registry/agent-contracts.js";
15
- import { resolveListOutputFormat } from "./utils/list-output-format.js";
16
11
  import { setStaticHelp } from "./utils/static-help.js";
12
+ import { installAuthPreflight } from "./middleware/auth.js";
17
13
  export async function createProgram() {
18
14
  const program = new Command();
19
15
  program
@@ -27,43 +23,14 @@ export async function createProgram() {
27
23
  .addOption(new Option("--yes", "跳过确认"))
28
24
  .addOption(new Option("--verbose", "输出详细日志").hideHelp().default(false));
29
25
  setStaticHelp(program, TOP_LEVEL_HELP);
30
- program
31
- .command("manifest")
32
- .description("输出 Agent 可解析的 gd-cli 能力清单")
33
- .action((_opts, command) => {
34
- const manifest = buildManifest("all");
35
- const format = resolveListOutputFormat(command);
36
- formatOutput(format === "json" ? manifest : rowsForManifest(manifest), format);
37
- });
38
- program
39
- .command("examples")
40
- .description("查看常用场景示例")
41
- .action((_opts, command) => {
42
- const examples = buildTopExamples();
43
- const format = resolveExplicitExamplesFormat(command);
44
- if (format === "json") {
45
- formatOutput(examples, "json");
46
- }
47
- else {
48
- printExamples(examples);
49
- }
50
- });
51
- const agent = program
52
- .command("agent", { hidden: true })
53
- .description("Agent 调用 gd-cli 的机器可读入口说明")
54
- .action(() => {
55
- console.log(AGENT_HELP.trim());
56
- });
57
- agent.addHelpText("afterAll", `\n${AGENT_HELP}`);
58
26
  registerAuthCommand(program);
59
27
  registerOrgCommand(program);
28
+ registerCreativeCommand(program);
60
29
  registerWorkflowsCommand(program);
61
- registerToolsCommand(program);
62
30
  registerSkillsCommand(program);
63
- registerModelsCommand(program);
64
31
  registerDamCommand(program);
65
32
  registerUpdateCommand(program);
66
- registerUsageCommand(program);
33
+ installAuthPreflight(program);
67
34
  program.hook("postAction", async (_thisCommand, actionCommand) => {
68
35
  await maybeNotifyUpdate(actionCommand);
69
36
  });
@@ -77,8 +44,8 @@ GD CLI — 让稿定成为 Agent 的创意生产引擎
77
44
  核心命令:
78
45
  auth 登录、退出、查看登录状态
79
46
  org 查看和切换当前组织
47
+ creative 通过统一创作入口生成图片、视频和文本
80
48
  workflows 运行完整创意场景任务,例如商品上新、批量海报、内容矩阵
81
- tools 调用单项 AI 创意能力,例如生图、抠图、高清化、标题生成
82
49
  skills 安装和管理 gd-cli Agent Skill
83
50
  dam 素材管理,上传、查询、删除素材
84
51
  update 检查并升级 gd-cli
@@ -87,8 +54,9 @@ GD CLI — 让稿定成为 Agent 的创意生产引擎
87
54
  gd-cli auth login 登录稿定账号
88
55
  gd-cli org list 查看可用组织
89
56
  gd-cli org switch 切换当前组织
57
+ gd-cli creative schema --format json 查看 Creative 输入输出结构
58
+ gd-cli creative examples --format json 查看 Creative 调用示例
90
59
  gd-cli workflows list 查看完整创意场景
91
- gd-cli tools list 查看单项 AI 创意能力
92
60
  gd-cli dam upload ./image.png 上传素材到 DAM
93
61
 
94
62
  常用选项:
@@ -99,54 +67,4 @@ GD CLI — 让稿定成为 Agent 的创意生产引擎
99
67
  --yes 跳过确认
100
68
  -h, --help display help for command
101
69
 
102
- 更多:
103
- gd-cli examples 查看常用场景示例
104
- gd-cli manifest 可解析的能力清单
105
70
  `;
106
- const AGENT_HELP = `
107
- Agent 推荐入口:
108
- gd-cli manifest --format json 读取完整能力清单
109
- gd-cli workflows manifest --format json 读取 Workflows 清单
110
- gd-cli tools manifest --format json 读取 Tools 清单
111
- gd-cli workflows schema <workflow-id> --format json 查看 Workflow 输入/输出结构
112
- gd-cli tools schema <tool-id> --format json 查看 Tool 输入/输出结构
113
-
114
- 调用规则:
115
- 1. 优先用 --format json 或 --json。
116
- 2. 复杂输入用 --input <json-file> 或 stdin: cat input.json | gd-cli tools call <tool-id> - --json。
117
- 3. 完整业务场景优先选 workflows;单项能力选 tools;素材复用选 dam。
118
- 4. Agent 不切换模型、环境或组织;这些由 CLI 配置和用户显式命令管理。
119
- `;
120
- function resolveExplicitExamplesFormat(command) {
121
- const root = command.parent;
122
- const opts = (root?.opts() ?? {});
123
- if (opts.json)
124
- return "json";
125
- const source = root?.getOptionValueSource("format");
126
- return source && source !== "default" && source !== "implied"
127
- ? opts.format ?? "human"
128
- : "human";
129
- }
130
- function printExamples(payload) {
131
- const examples = Array.isArray(payload.examples) ? payload.examples : [];
132
- console.log("常用场景示例\n");
133
- examples.forEach((item, index) => {
134
- const record = item;
135
- console.log(`${index + 1}. ${String(record.title ?? "")}`);
136
- const description = record.description;
137
- if (typeof description === "string" && description.trim()) {
138
- console.log(` ${description.trim()}`);
139
- }
140
- console.log("");
141
- console.log(` ${String(record.command ?? "")}`);
142
- const input = record.input_json;
143
- if (input && typeof input === "object" && Object.keys(input).length > 0) {
144
- console.log("");
145
- console.log(" input_json:");
146
- for (const [key, value] of Object.entries(input)) {
147
- console.log(` ${key}: ${String(value)}`);
148
- }
149
- }
150
- console.log("");
151
- });
152
- }
@@ -1,7 +1,5 @@
1
1
  import type { OutputSpec, ParamSpec } from "./types.js";
2
2
  import { type CapabilityPolicy, type CapabilitySource, type CapabilityStatus } from "../utils/capability-metadata.js";
3
- type CapabilityKind = "workflow" | "tool";
4
- type ManifestScope = "all" | "workflows" | "tools";
5
3
  export interface JsonSchemaObject {
6
4
  type: "object";
7
5
  properties: Record<string, Record<string, unknown>>;
@@ -10,7 +8,7 @@ export interface JsonSchemaObject {
10
8
  }
11
9
  export interface CapabilityManifestCommand {
12
10
  id: string;
13
- type: CapabilityKind | "dam" | "org";
11
+ type: "workflow";
14
12
  category: string;
15
13
  title: string;
16
14
  description: string;
@@ -22,8 +20,6 @@ export interface CapabilityManifestCommand {
22
20
  source: CapabilitySource;
23
21
  status: CapabilityStatus;
24
22
  policy: CapabilityPolicy;
25
- dependency_tools?: string[];
26
- affected_workflows?: string[];
27
23
  }
28
24
  export interface CapabilityManifest {
29
25
  name: "gd-cli";
@@ -33,11 +29,7 @@ export interface CapabilityManifest {
33
29
  }
34
30
  export declare function buildInputJsonSchema(params: ParamSpec[], extraProperties?: Record<string, Record<string, unknown>>): JsonSchemaObject;
35
31
  export declare function buildOutputJsonSchema(output: OutputSpec): JsonSchemaObject;
36
- export declare function buildToolSchema(toolId: string): Record<string, unknown>;
37
32
  export declare function buildWorkflowSchema(appId: string): Record<string, unknown>;
38
- export declare function buildToolExamples(toolId: string): Record<string, unknown>;
39
33
  export declare function buildWorkflowExamples(appId: string): Record<string, unknown>;
40
- export declare function buildManifest(scope?: ManifestScope): CapabilityManifest;
41
- export declare function rowsForManifest(manifest: CapabilityManifest): Record<string, string>[];
42
- export declare function buildTopExamples(): Record<string, unknown>;
43
- export {};
34
+ export declare function buildWorkflowManifest(): CapabilityManifest;
35
+ export declare function rowsForWorkflowManifest(manifest: CapabilityManifest): Record<string, string>[];
@@ -1,5 +1,5 @@
1
1
  import { CLI_VERSION } from "../utils/config.js";
2
- import { DIRECT_APPS, PUBLIC_DIRECT_TOOLS, appToolDependencies, appsDependingOnTool, resolveAppSpec, resolvePublicToolSpec, } from "./direct-registry.js";
2
+ import { DIRECT_APPS, resolveAppSpec, } from "./direct-registry.js";
3
3
  import { capabilityMetadata, } from "../utils/capability-metadata.js";
4
4
  export function buildInputJsonSchema(params, extraProperties = {}) {
5
5
  const properties = { ...extraProperties };
@@ -42,30 +42,6 @@ export function buildOutputJsonSchema(output) {
42
42
  additionalProperties: true,
43
43
  };
44
44
  }
45
- export function buildToolSchema(toolId) {
46
- const spec = resolvePublicToolSpec(toolId);
47
- if (!spec)
48
- throw new Error(`未找到工具: ${toolId}`);
49
- const input = sampleInput(spec.input ?? []);
50
- return {
51
- id: spec.name,
52
- type: "tool",
53
- category: spec.category,
54
- title: spec.display_name,
55
- description: spec.description,
56
- canonical_command: `gd-cli tools call ${spec.name}`,
57
- schema_command: `gd-cli tools schema ${spec.name} --format json`,
58
- examples_command: `gd-cli tools examples ${spec.name} --format json`,
59
- input_schema: buildInputJsonSchema(spec.input ?? []),
60
- output_schema: buildOutputJsonSchema(spec.output),
61
- sample_input: input,
62
- stdin: {
63
- supported: true,
64
- command: `cat input.json | gd-cli tools call ${spec.name} - --format json`,
65
- content_type: "application/json",
66
- },
67
- };
68
- }
69
45
  export function buildWorkflowSchema(appId) {
70
46
  const spec = resolveAppSpec(appId);
71
47
  if (!spec)
@@ -91,38 +67,6 @@ export function buildWorkflowSchema(appId) {
91
67
  },
92
68
  };
93
69
  }
94
- export function buildToolExamples(toolId) {
95
- const spec = resolvePublicToolSpec(toolId);
96
- if (!spec)
97
- throw new Error(`未找到工具: ${toolId}`);
98
- const input = sampleInput(spec.input ?? []);
99
- const curatedExamples = curatedToolExamples(spec.name);
100
- const agentInput = firstExampleInput(curatedExamples) ?? input;
101
- return {
102
- id: spec.name,
103
- type: "tool",
104
- category: spec.category,
105
- title: spec.display_name,
106
- description: spec.description,
107
- examples: [
108
- ...(curatedExamples.length > 0
109
- ? curatedExamples
110
- : [
111
- scenarioExample(spec.description, buildFlagCommand("gd-cli tools call", spec.name, spec.input ?? []), input),
112
- ]),
113
- {
114
- description: "Agent / 脚本推荐:stdin JSON",
115
- command: `cat input.json | gd-cli tools call ${spec.name} - --format json`,
116
- input_json: agentInput,
117
- },
118
- {
119
- description: "Agent / 脚本推荐:JSON 文件",
120
- command: `gd-cli tools call ${spec.name} --input input.json --format json`,
121
- input_json: agentInput,
122
- },
123
- ],
124
- };
125
- }
126
70
  export function buildWorkflowExamples(appId) {
127
71
  const spec = resolveAppSpec(appId);
128
72
  if (!spec)
@@ -162,55 +106,16 @@ export function buildWorkflowExamples(appId) {
162
106
  examples,
163
107
  };
164
108
  }
165
- export function buildManifest(scope = "all") {
166
- const commands = [];
167
- if (scope === "all" || scope === "tools") {
168
- commands.push(...PUBLIC_DIRECT_TOOLS.map(toolManifestCommand));
169
- }
170
- if (scope === "all" || scope === "workflows") {
171
- commands.push(...DIRECT_APPS.map(workflowManifestCommand));
172
- }
173
- if (scope === "all") {
174
- commands.push({
175
- id: "dam.upload",
176
- type: "dam",
177
- category: "asset",
178
- title: "DAM 素材上传",
179
- description: "上传本地文件到 DAM,返回可复用 asset_id 与 CDN URL",
180
- canonical_command: "gd-cli dam upload <file>",
181
- output: "json",
182
- safe_for_agent: true,
183
- ...capabilityMetadata("dam", "dam.upload"),
184
- }, {
185
- id: "dam.search",
186
- type: "dam",
187
- category: "asset",
188
- title: "DAM 素材搜索",
189
- description: "按关键词、资源库、文件夹、类型、格式或标签搜索素材",
190
- canonical_command: "gd-cli dam search <keyword>",
191
- output: "json",
192
- safe_for_agent: true,
193
- ...capabilityMetadata("dam", "dam.search"),
194
- }, {
195
- id: "org.current",
196
- type: "org",
197
- category: "account",
198
- title: "当前组织",
199
- description: "查询当前绑定团队,便于 Agent 确认执行上下文",
200
- canonical_command: "gd-cli org current",
201
- output: "json",
202
- safe_for_agent: true,
203
- ...capabilityMetadata("org", "org.current"),
204
- });
205
- }
109
+ export function buildWorkflowManifest() {
110
+ const commands = DIRECT_APPS.map(workflowManifestCommand);
206
111
  return {
207
112
  name: "gd-cli",
208
113
  version: CLI_VERSION,
209
- description: "Gaoding creative production CLI for agents",
114
+ description: "Gaoding Workflow capabilities for agents",
210
115
  commands,
211
116
  };
212
117
  }
213
- export function rowsForManifest(manifest) {
118
+ export function rowsForWorkflowManifest(manifest) {
214
119
  return manifest.commands.map((command) => ({
215
120
  id: command.id,
216
121
  type: command.type,
@@ -219,86 +124,6 @@ export function rowsForManifest(manifest) {
219
124
  command: command.canonical_command,
220
125
  }));
221
126
  }
222
- export function buildTopExamples() {
223
- return {
224
- examples: [
225
- {
226
- title: "生成商品图库素材包",
227
- description: "完整 Workflow:上传商品图,自动完成抠图、提示词优化、多图生成和标题卖点整理,适合要一组可上架 Listing 图库时使用。",
228
- command: "gd-cli workflows run listing-gallery --image ./sku_001.jpg --brief \"夏季轻薄防晒衣,透气面料,适合户外通勤;卖点图短文案:轻薄防晒 通勤无负担\" --copy-mode render-text --ratio 1:1 -f json",
229
- input_json: {
230
- image: "./sku_001.jpg",
231
- brief: "夏季轻薄防晒衣,透气面料,适合户外通勤;卖点图短文案:轻薄防晒 通勤无负担",
232
- copy_mode: "render-text",
233
- ratio: "1:1",
234
- },
235
- },
236
- {
237
- title: "单项 AI 生图",
238
- description: "只调用生图 Tool,不编排完整 Workflow;适合已有明确画面提示词,只需要一张图时使用。",
239
- command: "gd-cli tools call image.generate --prompt \"电商主图,白底,突出夏季轻薄防晒衣的透气面料,干净高级\" --image ./sku_001.jpg --ratio 1:1 -f json",
240
- input_json: {
241
- prompt: "电商主图,白底,突出夏季轻薄防晒衣的透气面料,干净高级",
242
- image: "./sku_001.jpg",
243
- ratio: "1:1",
244
- },
245
- },
246
- {
247
- title: "生成商品标题",
248
- description: "轻量文本 Tool;适合脚本或 Agent 批量根据 brief 生成标题。",
249
- command: "gd-cli tools call text.title --brief \"夏季轻薄防晒衣,防晒透气,户外通勤,女款\" -f json",
250
- input_json: {
251
- brief: "夏季轻薄防晒衣,防晒透气,户外通勤,女款",
252
- },
253
- },
254
- {
255
- title: "生成商品短视频",
256
- description: "文生视频;适合没有参考图、先用文字描述生成短视频镜头。",
257
- command: "gd-cli tools call video.generate --prompt \"商品短视频,展示夏季轻薄防晒衣的透气面料和户外通勤场景,镜头缓慢推进\" --duration 5 -f json",
258
- input_json: {
259
- prompt: "商品短视频,展示夏季轻薄防晒衣的透气面料和户外通勤场景,镜头缓慢推进",
260
- duration: "5",
261
- },
262
- },
263
- {
264
- title: "参考图生成商品短视频",
265
- description: "图生视频;适合以商品图作为首帧或视觉参考,保持商品主体一致。",
266
- command: "gd-cli tools call video.generate --prompt \"以参考图为首帧,展示防晒衣面料细节,轻微镜头推进,自然光\" --image ./sku_001.jpg --duration 5 -f json",
267
- input_json: {
268
- prompt: "以参考图为首帧,展示防晒衣面料细节,轻微镜头推进,自然光",
269
- image: "./sku_001.jpg",
270
- duration: "5",
271
- },
272
- },
273
- {
274
- title: "查找 DAM 里的商品素材",
275
- description: "搜索已入库素材,返回 asset_id、URL、封面和文件信息,适合后续 Workflow / Tool 复用素材。",
276
- command: "gd-cli dam search \"防晒衣\" --type image --format jpg,png -f json",
277
- },
278
- {
279
- title: "Agent 读取能力清单",
280
- description: "机器可读入口;Agent 应优先读取 manifest,再按 schema/examples 选择能力和拼装参数。",
281
- command: "gd-cli manifest -f json",
282
- },
283
- ],
284
- };
285
- }
286
- function toolManifestCommand(spec) {
287
- return {
288
- id: spec.name,
289
- type: "tool",
290
- category: spec.category,
291
- title: spec.display_name,
292
- description: spec.description,
293
- canonical_command: `gd-cli tools call ${spec.name}`,
294
- input_schema_command: `gd-cli tools schema ${spec.name}`,
295
- examples_command: `gd-cli tools examples ${spec.name}`,
296
- output: "json",
297
- safe_for_agent: true,
298
- ...capabilityMetadata("tool", spec.name),
299
- affected_workflows: appsDependingOnTool(spec.name).map((app) => app.id),
300
- };
301
- }
302
127
  function workflowManifestCommand(spec) {
303
128
  return {
304
129
  id: spec.id,
@@ -312,7 +137,6 @@ function workflowManifestCommand(spec) {
312
137
  output: "json",
313
138
  safe_for_agent: true,
314
139
  ...capabilityMetadata("app", spec.id),
315
- dependency_tools: appToolDependencies(spec),
316
140
  };
317
141
  }
318
142
  function buildFlagCommand(prefix, id, params) {
@@ -360,68 +184,6 @@ function sampleValue(param) {
360
184
  return "./image.png";
361
185
  return "value";
362
186
  }
363
- function curatedToolExamples(toolId) {
364
- if (toolId === "asset.upload") {
365
- return [
366
- scenarioExample("上传本地商品图到临时 CDN,返回可传给后续 Tool/App 的 URL。", "gd-cli tools call asset.upload --file ./sku_001.jpg -f json", { file: "./sku_001.jpg" }),
367
- ];
368
- }
369
- if (toolId === "text.title") {
370
- return [
371
- scenarioExample("根据商品卖点生成适合电商或社媒使用的标题。", "gd-cli tools call text.title --brief \"夏季轻薄防晒衣,防晒透气,户外通勤,女款\" -f json", { brief: "夏季轻薄防晒衣,防晒透气,户外通勤,女款" }),
372
- ];
373
- }
374
- if (toolId === "text.prompt") {
375
- return [
376
- scenarioExample("把简短商品需求扩写成更适合生图模型的提示词。", "gd-cli tools call text.prompt --prompt \"防晒衣电商主图,突出轻薄透气\" --image ./sku_001.jpg -f json", {
377
- prompt: "防晒衣电商主图,突出轻薄透气",
378
- image: "./sku_001.jpg",
379
- }),
380
- ];
381
- }
382
- if (toolId === "image.cutout") {
383
- return [
384
- scenarioExample("商品图抠图,输出透明背景 PNG,适合后续主图或海报合成。", "gd-cli tools call image.cutout --image ./sku_001.jpg --mode product -f json", { image: "./sku_001.jpg", mode: "product" }),
385
- ];
386
- }
387
- if (toolId === "image.generate") {
388
- return [
389
- scenarioExample("不带参考图,直接根据文字提示词生成一张电商海报。", "gd-cli tools call image.generate --prompt \"夏季轻薄防晒衣电商海报,清爽户外通勤场景,自然光,干净高级,突出轻薄透气面料\" --ratio 1:1 -f json", {
390
- prompt: "夏季轻薄防晒衣电商海报,清爽户外通勤场景,自然光,干净高级,突出轻薄透气面料",
391
- ratio: "1:1",
392
- }),
393
- scenarioExample("带参考图,根据商品图和提示词生成一张干净高级的电商主图。", "gd-cli tools call image.generate --prompt \"电商主图,白底,突出夏季轻薄防晒衣的透气面料,干净高级\" --image ./sku_001.jpg --ratio 1:1 -f json", {
394
- prompt: "电商主图,白底,突出夏季轻薄防晒衣的透气面料,干净高级",
395
- image: "./sku_001.jpg",
396
- ratio: "1:1",
397
- }),
398
- ];
399
- }
400
- if (toolId === "image.svg") {
401
- return [
402
- scenarioExample("把 Logo 或图形素材转成 SVG,适合后续编辑或排版。", "gd-cli tools call image.svg --image ./logo.png --mode auto -f json", { image: "./logo.png", mode: "auto" }),
403
- ];
404
- }
405
- if (toolId === "image.super-res") {
406
- return [
407
- scenarioExample("提升商品图清晰度,适合上架前处理低清素材。", "gd-cli tools call image.super-res --image ./sku_001.jpg --mode hd -f json", { image: "./sku_001.jpg", mode: "hd" }),
408
- ];
409
- }
410
- if (toolId === "video.generate") {
411
- return [
412
- scenarioExample("文生视频:没有参考图时,直接用镜头描述生成商品短视频。", "gd-cli tools call video.generate --prompt \"商品短视频,展示夏季轻薄防晒衣的透气面料和户外通勤场景,镜头缓慢推进\" --duration 5 -f json", {
413
- prompt: "商品短视频,展示夏季轻薄防晒衣的透气面料和户外通勤场景,镜头缓慢推进",
414
- duration: "5",
415
- }),
416
- scenarioExample("图生视频:以商品图为首帧或视觉参考,保持商品主体一致。", "gd-cli tools call video.generate --prompt \"以参考图为首帧,展示防晒衣面料细节,轻微镜头推进,自然光\" --image ./sku_001.jpg --duration 5 -f json", {
417
- prompt: "以参考图为首帧,展示防晒衣面料细节,轻微镜头推进,自然光",
418
- image: "./sku_001.jpg",
419
- duration: "5",
420
- }),
421
- ];
422
- }
423
- return [];
424
- }
425
187
  function curatedAppExamples(appId) {
426
188
  if (appId === "listing-gallery") {
427
189
  return [
@@ -1,11 +1,6 @@
1
1
  import type { AppSpec, RegistryResponse, ToolSpec } from "./types.js";
2
2
  export declare const DIRECT_TOOLS: ToolSpec[];
3
- export declare const PUBLIC_DIRECT_TOOLS: ToolSpec[];
4
3
  export declare const DIRECT_APPS: AppSpec[];
5
4
  export declare const DIRECT_REGISTRY: RegistryResponse;
6
5
  export declare function resolveToolSpec(id: string): ToolSpec | undefined;
7
- export declare function resolvePublicToolSpec(id: string): ToolSpec | undefined;
8
- export declare function isPublicToolSpec(tool: ToolSpec): boolean;
9
6
  export declare function resolveAppSpec(id: string): AppSpec | undefined;
10
- export declare function appToolDependencies(app: AppSpec): string[];
11
- export declare function appsDependingOnTool(toolId: string): AppSpec[];
@@ -44,7 +44,6 @@ export const DIRECT_TOOLS = [
44
44
  param("style_code", "string", false, "--style-code", "模型或风格 code"),
45
45
  ], true, 900),
46
46
  ];
47
- export const PUBLIC_DIRECT_TOOLS = DIRECT_TOOLS.filter(isPublicToolSpec);
48
47
  export const DIRECT_APPS = [
49
48
  {
50
49
  id: "listing-gallery",
@@ -156,27 +155,9 @@ export const DIRECT_REGISTRY = {
156
155
  export function resolveToolSpec(id) {
157
156
  return DIRECT_TOOLS.find((tool) => tool.name === id || tool.aliases?.includes(id));
158
157
  }
159
- export function resolvePublicToolSpec(id) {
160
- return PUBLIC_DIRECT_TOOLS.find((tool) => tool.name === id || tool.aliases?.includes(id));
161
- }
162
- export function isPublicToolSpec(tool) {
163
- return !tool.tags.includes("internal");
164
- }
165
158
  export function resolveAppSpec(id) {
166
159
  return DIRECT_APPS.find((app) => app.id === id || app.aliases?.includes(id));
167
160
  }
168
- export function appToolDependencies(app) {
169
- return uniqueStrings([
170
- ...(app.required_tools ?? []),
171
- ...(app.asset_operations ?? []).filter((id) => resolvePublicToolSpec(id)),
172
- ]);
173
- }
174
- export function appsDependingOnTool(toolId) {
175
- return DIRECT_APPS.filter((app) => appToolDependencies(app).includes(toolId));
176
- }
177
- function uniqueStrings(values) {
178
- return [...new Set(values.filter(Boolean))];
179
- }
180
161
  function tool(name, aliases, displayName, description, category, input, async = false, timeout = 120, internal = false) {
181
162
  return {
182
163
  name,
@@ -4,25 +4,4 @@ export declare class RegistryClient {
4
4
  private client;
5
5
  constructor(client: HubClient);
6
6
  fetchRegistry(): Promise<RegistryResponse>;
7
- getDetail(id: string): Promise<import("./types.js").ToolSpec | import("./types.js").AppSpec>;
8
- search(query: string, options?: {
9
- type?: string;
10
- limit?: number;
11
- }): Promise<{
12
- results: ({
13
- id: string;
14
- type: string;
15
- display_name: string;
16
- description: string;
17
- category: "asset" | "text" | "image" | "video" | "agent" | "template" | "infrastructure";
18
- spec: import("./types.js").ToolSpec;
19
- } | {
20
- id: string;
21
- type: string;
22
- display_name: string;
23
- description: string;
24
- category: string;
25
- spec: import("./types.js").AppSpec;
26
- })[];
27
- }>;
28
7
  }
@@ -1,4 +1,4 @@
1
- import { DIRECT_APPS, DIRECT_REGISTRY, PUBLIC_DIRECT_TOOLS, resolveAppSpec, resolveToolSpec, } from "./direct-registry.js";
1
+ import { DIRECT_REGISTRY } from "./direct-registry.js";
2
2
  export class RegistryClient {
3
3
  client;
4
4
  constructor(client) {
@@ -8,43 +8,4 @@ export class RegistryClient {
8
8
  void this.client;
9
9
  return DIRECT_REGISTRY;
10
10
  }
11
- async getDetail(id) {
12
- const tool = resolveToolSpec(id);
13
- if (tool)
14
- return tool;
15
- const app = resolveAppSpec(id);
16
- if (app)
17
- return app;
18
- throw new Error(`未找到能力: ${id}`);
19
- }
20
- async search(query, options) {
21
- const q = query.trim().toLowerCase();
22
- const toolResults = PUBLIC_DIRECT_TOOLS.map((spec) => ({
23
- id: spec.name,
24
- type: "tool",
25
- display_name: spec.display_name,
26
- description: spec.description,
27
- category: spec.category,
28
- spec,
29
- }));
30
- const appResults = DIRECT_APPS.map((spec) => ({
31
- id: spec.id,
32
- type: "app",
33
- display_name: spec.name,
34
- description: spec.description,
35
- category: spec.category,
36
- spec,
37
- }));
38
- const all = [
39
- ...(!options?.type || options.type === "tool" ? toolResults : []),
40
- ...(!options?.type || options.type === "app" ? appResults : []),
41
- ].filter((item) => {
42
- if (!q)
43
- return true;
44
- return (item.id.toLowerCase().includes(q) ||
45
- item.display_name.toLowerCase().includes(q) ||
46
- item.description.toLowerCase().includes(q));
47
- });
48
- return { results: all.slice(0, options?.limit ?? all.length) };
49
- }
50
11
  }
@@ -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.7";
8
+ export declare const CLI_VERSION = "1.0.0-alpha.8";
9
9
  export declare const CLI_PACKAGE_NAME = "gaoding-cli";
10
- export declare const CLI_USER_AGENT = "gd-cli/1.0.0-alpha.7";
10
+ export declare const CLI_USER_AGENT = "gd-cli/1.0.0-alpha.8";
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;
@@ -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.7";
35
+ export const CLI_VERSION = "1.0.0-alpha.8";
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";
@@ -1,9 +1,7 @@
1
1
  import type { Command } from "commander";
2
2
  /**
3
- * 在命令 `-h` 底部追加一段「快速验证」单行示例(用于具体 Tool / Workflow 子命令)。
3
+ * 在命令 `-h` 底部追加一段「快速验证」单行示例(用于 Workflow 子命令)。
4
4
  */
5
5
  export declare function appendVerifySnippet(cmd: Command, line: string): void;
6
- /** 按工具 id 附加对应示例;无映射则不加(避免误导) */
7
- export declare function appendToolQuickExample(cmd: Command, toolName: string): void;
8
6
  /** `gd-cli workflows run -h` 专用 */
9
7
  export declare function appendAppRunQuickExample(cmd: Command, _legacyPrefix?: string): void;