gaoding-cli 1.0.0-alpha.7 → 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.
Files changed (77) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +47 -60
  3. package/dist/bin/gd-cli.js +2 -2
  4. package/dist/src/api/app-runner.d.ts +1 -4
  5. package/dist/src/api/app-runner.js +11 -44
  6. package/dist/src/api/creative-client.d.ts +34 -0
  7. package/dist/src/api/creative-client.js +184 -0
  8. package/dist/src/api/dam-client.d.ts +0 -7
  9. package/dist/src/api/dam-client.js +0 -17
  10. package/dist/src/api/direct-client.d.ts +9 -2
  11. package/dist/src/api/direct-client.js +45 -18
  12. package/dist/src/api/hub-client.d.ts +11 -8
  13. package/dist/src/api/hub-client.js +17 -18
  14. package/dist/src/api/usage-client.d.ts +4 -4
  15. package/dist/src/api/usage-client.js +9 -49
  16. package/dist/src/auth/credential-store-v2.d.ts +0 -1
  17. package/dist/src/auth/credential-store-v2.js +0 -6
  18. package/dist/src/commands/auth.js +17 -53
  19. package/dist/src/commands/creative.d.ts +8 -0
  20. package/dist/src/commands/creative.js +178 -0
  21. package/dist/src/commands/dam.js +270 -127
  22. package/dist/src/commands/org.js +31 -47
  23. package/dist/src/commands/skills.js +33 -118
  24. package/dist/src/commands/update.js +11 -82
  25. package/dist/src/commands/usage.d.ts +1 -1
  26. package/dist/src/commands/usage.js +10 -21
  27. package/dist/src/commands/workflows.d.ts +1 -1
  28. package/dist/src/commands/workflows.js +299 -197
  29. package/dist/src/core/auth/auth-guard.d.ts +21 -0
  30. package/dist/src/core/auth/auth-guard.js +121 -0
  31. package/dist/src/core/auth/org-manager.d.ts +2 -1
  32. package/dist/src/core/auth/org-manager.js +61 -6
  33. package/dist/src/core/output/envelope.d.ts +1 -0
  34. package/dist/src/core/output/envelope.js +76 -6
  35. package/dist/src/creative/contract.d.ts +1060 -0
  36. package/dist/src/creative/contract.js +722 -0
  37. package/dist/src/creative/media.d.ts +19 -0
  38. package/dist/src/creative/media.js +83 -0
  39. package/dist/src/creative/protocol.d.ts +60 -0
  40. package/dist/src/creative/protocol.js +337 -0
  41. package/dist/src/io.d.ts +0 -2
  42. package/dist/src/io.js +0 -8
  43. package/dist/src/middleware/auth.d.ts +6 -2
  44. package/dist/src/middleware/auth.js +25 -63
  45. package/dist/src/middleware/error-handler.d.ts +8 -0
  46. package/dist/src/middleware/error-handler.js +61 -57
  47. package/dist/src/program.d.ts +1 -0
  48. package/dist/src/program.js +137 -122
  49. package/dist/src/registry/agent-contracts.d.ts +14 -34
  50. package/dist/src/registry/agent-contracts.js +209 -297
  51. package/dist/src/registry/direct-registry.d.ts +0 -5
  52. package/dist/src/registry/direct-registry.js +0 -19
  53. package/dist/src/registry/registry-client.d.ts +0 -21
  54. package/dist/src/registry/registry-client.js +1 -40
  55. package/dist/src/utils/capability-presenter.js +6 -29
  56. package/dist/src/utils/config.d.ts +2 -2
  57. package/dist/src/utils/config.js +1 -1
  58. package/dist/src/utils/help-verify.d.ts +1 -3
  59. package/dist/src/utils/help-verify.js +1 -25
  60. package/dist/src/utils/sensitive-path.js +1 -4
  61. package/package.json +4 -3
  62. package/skills/gd-cli/SKILL.md +13 -12
  63. package/skills/gd-cli/references/auth.md +9 -10
  64. package/skills/gd-cli/references/creative.md +47 -0
  65. package/skills/gd-cli/references/entitlement.md +3 -3
  66. package/skills/gd-cli/references/errors.md +10 -3
  67. package/skills/gd-cli/references/org.md +3 -3
  68. package/skills/gd-cli/references/sop.md +8 -8
  69. package/skills/gd-cli/references/update.md +4 -3
  70. package/skills/gd-cli/references/workflows.md +7 -6
  71. package/dist/src/commands/models.d.ts +0 -2
  72. package/dist/src/commands/models.js +0 -78
  73. package/dist/src/commands/tools.d.ts +0 -4
  74. package/dist/src/commands/tools.js +0 -383
  75. package/dist/src/utils/list-output-format.d.ts +0 -10
  76. package/dist/src/utils/list-output-format.js +0 -34
  77. package/skills/gd-cli/references/tools.md +0 -29
@@ -1,6 +1,75 @@
1
- import { CLI_VERSION } from "../utils/config.js";
2
- import { DIRECT_APPS, PUBLIC_DIRECT_TOOLS, appToolDependencies, appsDependingOnTool, resolveAppSpec, resolvePublicToolSpec, } from "./direct-registry.js";
3
- import { capabilityMetadata, } from "../utils/capability-metadata.js";
1
+ import { resolveAppSpec } from "./direct-registry.js";
2
+ export const PUBLIC_WORKFLOW_MEDIA_PATTERN = "^kv_\\d+_\\d+$";
3
+ const PUBLIC_WORKFLOW_OUTPUT_DEFINITIONS = {
4
+ "listing-gallery": {
5
+ textFields: ["text", "title_text", "delivery_copy", "prompt_plan"],
6
+ mediaFields: [
7
+ "main_image",
8
+ "selling_point_image",
9
+ "detail_image",
10
+ "lifestyle_image",
11
+ ],
12
+ overlayFields: [
13
+ "selling_point_image",
14
+ "detail_image",
15
+ "lifestyle_image",
16
+ ],
17
+ ratioFields: [
18
+ "main_image",
19
+ "selling_point_image",
20
+ "detail_image",
21
+ "lifestyle_image",
22
+ ],
23
+ ratios: "record",
24
+ },
25
+ "pdp-a-plus": {
26
+ textFields: ["text", "title_text", "delivery_copy", "prompt_plan"],
27
+ mediaFields: [
28
+ "hero_module",
29
+ "pain_point_module",
30
+ "structure_module",
31
+ "usage_module",
32
+ "comparison_module",
33
+ ],
34
+ overlayFields: [
35
+ "hero_module",
36
+ "pain_point_module",
37
+ "structure_module",
38
+ "usage_module",
39
+ "comparison_module",
40
+ ],
41
+ ratioFields: [
42
+ "hero_module",
43
+ "pain_point_module",
44
+ "structure_module",
45
+ "usage_module",
46
+ "comparison_module",
47
+ ],
48
+ ratios: "record",
49
+ sellingPoints: true,
50
+ },
51
+ "social-seeding-pack": {
52
+ textFields: [
53
+ "text",
54
+ "title_text",
55
+ "xhs_caption",
56
+ "cover_prompt",
57
+ "scene_prompt",
58
+ ],
59
+ mediaFields: ["cover_image", "scene_image"],
60
+ overlayFields: ["cover_image", "scene_image"],
61
+ ratioFields: ["cover_image", "scene_image"],
62
+ ratios: "record",
63
+ },
64
+ "campaign-kv-pack": {
65
+ textFields: ["text", "title_text", "delivery_copy", "prompt_plan"],
66
+ mediaFields: [],
67
+ overlayFields: [],
68
+ ratioFields: [],
69
+ ratios: "array",
70
+ mediaPattern: PUBLIC_WORKFLOW_MEDIA_PATTERN,
71
+ },
72
+ };
4
73
  export function buildInputJsonSchema(params, extraProperties = {}) {
5
74
  const properties = { ...extraProperties };
6
75
  const required = [];
@@ -24,52 +93,52 @@ export function buildInputJsonSchema(params, extraProperties = {}) {
24
93
  type: "object",
25
94
  properties,
26
95
  required,
27
- additionalProperties: true,
96
+ additionalProperties: false,
28
97
  };
29
98
  }
30
- export function buildOutputJsonSchema(output) {
31
- const properties = {};
32
- for (const [key, prop] of Object.entries(output.properties ?? {})) {
33
- properties[key] = {
34
- type: prop.type,
35
- description: prop.description,
36
- };
99
+ export function resolvePublicWorkflowOutputDefinition(appId) {
100
+ const definition = PUBLIC_WORKFLOW_OUTPUT_DEFINITIONS[appId];
101
+ if (!definition)
102
+ throw new Error(`未找到 Workflow 输出契约: ${appId}`);
103
+ return definition;
104
+ }
105
+ export function buildOutputJsonSchema(appId) {
106
+ const definition = resolvePublicWorkflowOutputDefinition(appId);
107
+ const properties = Object.fromEntries(definition.textFields.map((field) => [
108
+ field,
109
+ stringSchema(workflowTextDescription(field)),
110
+ ]));
111
+ properties.copy_plan = copyPlanSchema();
112
+ properties.overlay_copy = namedStringRecordSchema(definition.overlayFields, definition.mediaPattern);
113
+ properties.category_profile = categoryProfileSchema();
114
+ properties.ratios = definition.ratios === "array"
115
+ ? stringArraySchema("本次生成的画面比例列表", "^\\d+:\\d+$")
116
+ : namedStringRecordSchema(definition.ratioFields);
117
+ properties.assets = workflowAssetsSchema();
118
+ if (definition.sellingPoints) {
119
+ properties.selling_points = stringArraySchema("从 brief 提取的公开卖点列表");
120
+ }
121
+ for (const field of definition.mediaFields) {
122
+ properties[field] = workflowMediaSchema(`${field} 生成结果`);
37
123
  }
38
124
  return {
39
125
  type: "object",
40
126
  properties,
41
127
  required: [],
42
- additionalProperties: true,
43
- };
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
- },
128
+ additionalProperties: false,
129
+ ...(definition.mediaPattern
130
+ ? {
131
+ patternProperties: {
132
+ [definition.mediaPattern]: workflowMediaSchema("Campaign KV 生成结果"),
133
+ },
134
+ }
135
+ : {}),
67
136
  };
68
137
  }
69
138
  export function buildWorkflowSchema(appId) {
70
139
  const spec = resolveAppSpec(appId);
71
140
  if (!spec)
72
- throw new Error(`未找到应用: ${appId}`);
141
+ throw new Error(`未找到 Workflow: ${appId}`);
73
142
  const input = sampleInput(spec.input ?? []);
74
143
  return {
75
144
  id: spec.id,
@@ -78,55 +147,119 @@ export function buildWorkflowSchema(appId) {
78
147
  title: spec.name,
79
148
  description: spec.description,
80
149
  canonical_command: `gd-cli workflows run ${spec.id}`,
81
- schema_command: `gd-cli workflows schema ${spec.id} --format json`,
82
- examples_command: `gd-cli workflows examples ${spec.id} --format json`,
150
+ schema_command: `gd-cli workflows schema ${spec.id} --json`,
151
+ examples_command: `gd-cli workflows examples ${spec.id}`,
83
152
  input_schema: buildInputJsonSchema(spec.input ?? []),
84
- output_schema: buildOutputJsonSchema(spec.output),
153
+ output_schema: buildOutputJsonSchema(spec.id),
85
154
  sample_input: input,
86
155
  deliverables: spec.outputs ?? ["manifest.json", "README.md", "assets/"],
87
156
  stdin: {
88
157
  supported: true,
89
- command: `cat brief.json | gd-cli workflows run ${spec.id} - --format json`,
158
+ command: `cat brief.json | gd-cli workflows run ${spec.id} --input - --json`,
90
159
  content_type: "application/json",
91
160
  },
92
161
  };
93
162
  }
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;
163
+ function workflowMediaSchema(description) {
101
164
  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,
165
+ type: "object",
166
+ description,
167
+ properties: {
168
+ url: stringSchema("主结果 URL"),
169
+ mime_type: stringSchema("主结果 MIME 类型"),
170
+ urls: stringArraySchema("全部结果 URL"),
171
+ },
172
+ required: [],
173
+ additionalProperties: false,
174
+ };
175
+ }
176
+ function workflowAssetsSchema() {
177
+ return {
178
+ type: "array",
179
+ description: "按语义角色汇总的公开图片清单",
180
+ items: {
181
+ type: "object",
182
+ properties: {
183
+ label: stringSchema("交付物显示名称"),
184
+ role: stringSchema("交付物语义角色"),
185
+ type: { type: "string", enum: ["image"], description: "媒体类型" },
186
+ url: stringSchema("交付物 URL"),
117
187
  },
118
- {
119
- description: "Agent / 脚本推荐:JSON 文件",
120
- command: `gd-cli tools call ${spec.name} --input input.json --format json`,
121
- input_json: agentInput,
188
+ required: ["label", "role", "type", "url"],
189
+ additionalProperties: false,
190
+ },
191
+ };
192
+ }
193
+ function copyPlanSchema() {
194
+ return {
195
+ type: "object",
196
+ description: "本次 Workflow 使用的画内文案策略",
197
+ properties: {
198
+ mode: {
199
+ type: "string",
200
+ enum: ["layout-copy", "render-text", "no-text"],
201
+ description: "最终文案模式",
122
202
  },
123
- ],
203
+ render_text: { type: "boolean", description: "是否生成画内文字" },
204
+ image_model: stringSchema("显式选择的生图模型"),
205
+ },
206
+ required: ["mode", "render_text"],
207
+ additionalProperties: false,
208
+ };
209
+ }
210
+ function categoryProfileSchema() {
211
+ return {
212
+ type: "object",
213
+ description: "根据 brief 推断的公开品类策略",
214
+ properties: {
215
+ id: stringSchema("品类策略 ID"),
216
+ label: stringSchema("品类显示名称"),
217
+ guidance: stringSchema("品类创作指导"),
218
+ },
219
+ required: ["id", "label", "guidance"],
220
+ additionalProperties: false,
221
+ };
222
+ }
223
+ function namedStringRecordSchema(fields, pattern) {
224
+ return {
225
+ type: "object",
226
+ properties: Object.fromEntries(fields.map((field) => [field, stringSchema(`${field} 对应值`)])),
227
+ required: [],
228
+ additionalProperties: false,
229
+ ...(pattern
230
+ ? { patternProperties: { [pattern]: stringSchema("比例对应值") } }
231
+ : {}),
124
232
  };
125
233
  }
234
+ function stringArraySchema(description, pattern) {
235
+ return {
236
+ type: "array",
237
+ description,
238
+ items: {
239
+ type: "string",
240
+ ...(pattern ? { pattern } : {}),
241
+ },
242
+ };
243
+ }
244
+ function stringSchema(description) {
245
+ return { type: "string", description };
246
+ }
247
+ function workflowTextDescription(field) {
248
+ const descriptions = {
249
+ text: "面向用户的 Workflow 总说明",
250
+ title_text: "生成标题",
251
+ delivery_copy: "交付说明或渠道文案",
252
+ prompt_plan: "公开素材或主视觉规划",
253
+ xhs_caption: "小红书正文与标签",
254
+ cover_prompt: "封面图提示词",
255
+ scene_prompt: "场景图提示词",
256
+ };
257
+ return descriptions[field] ?? field;
258
+ }
126
259
  export function buildWorkflowExamples(appId) {
127
260
  const spec = resolveAppSpec(appId);
128
261
  if (!spec)
129
- throw new Error(`未找到应用: ${appId}`);
262
+ throw new Error(`未找到 Workflow: ${appId}`);
130
263
  const input = sampleInput(spec.input ?? []);
131
264
  const curatedExamples = curatedAppExamples(spec.id);
132
265
  const agentInput = firstExampleInput(curatedExamples) ?? input;
@@ -138,21 +271,15 @@ export function buildWorkflowExamples(appId) {
138
271
  ]),
139
272
  {
140
273
  description: "Agent / 脚本推荐:stdin JSON",
141
- command: `cat brief.json | gd-cli workflows run ${spec.id} - --format json`,
274
+ command: `cat brief.json | gd-cli workflows run ${spec.id} --input - --json`,
142
275
  input_json: agentInput,
143
276
  },
144
277
  {
145
278
  description: "Agent / 脚本推荐:JSON 文件",
146
- command: `gd-cli workflows run ${spec.id} --input brief.json --format json`,
279
+ command: `gd-cli workflows run ${spec.id} --input brief.json --json`,
147
280
  input_json: agentInput,
148
281
  },
149
282
  ];
150
- if (spec.supports_batch) {
151
- examples.push({
152
- description: "批量任务 dry-run 预检",
153
- command: `gd-cli workflows run ${spec.id} --input ./products.csv --assets-dir ./images --dry-run --format json`,
154
- });
155
- }
156
283
  return {
157
284
  id: spec.id,
158
285
  type: "workflow",
@@ -162,159 +289,6 @@ export function buildWorkflowExamples(appId) {
162
289
  examples,
163
290
  };
164
291
  }
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
- }
206
- return {
207
- name: "gd-cli",
208
- version: CLI_VERSION,
209
- description: "Gaoding creative production CLI for agents",
210
- commands,
211
- };
212
- }
213
- export function rowsForManifest(manifest) {
214
- return manifest.commands.map((command) => ({
215
- id: command.id,
216
- type: command.type,
217
- 分类: command.category,
218
- 名称: command.title,
219
- command: command.canonical_command,
220
- }));
221
- }
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
- function workflowManifestCommand(spec) {
303
- return {
304
- id: spec.id,
305
- type: "workflow",
306
- category: spec.category,
307
- title: spec.name,
308
- description: spec.description,
309
- canonical_command: `gd-cli workflows run ${spec.id}`,
310
- input_schema_command: `gd-cli workflows schema ${spec.id}`,
311
- examples_command: `gd-cli workflows examples ${spec.id}`,
312
- output: "json",
313
- safe_for_agent: true,
314
- ...capabilityMetadata("app", spec.id),
315
- dependency_tools: appToolDependencies(spec),
316
- };
317
- }
318
292
  function buildFlagCommand(prefix, id, params) {
319
293
  const pieces = [prefix, id];
320
294
  for (const param of params) {
@@ -322,7 +296,7 @@ function buildFlagCommand(prefix, id, params) {
322
296
  continue;
323
297
  pieces.push(param.cli_flag, quoteShell(String(sampleValue(param))));
324
298
  }
325
- pieces.push("--format", "json");
299
+ pieces.push("--json");
326
300
  return pieces.join(" ");
327
301
  }
328
302
  function sampleInput(params) {
@@ -360,72 +334,10 @@ function sampleValue(param) {
360
334
  return "./image.png";
361
335
  return "value";
362
336
  }
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
337
  function curatedAppExamples(appId) {
426
338
  if (appId === "listing-gallery") {
427
339
  return [
428
- scenarioExample("生成一套可上架的商品图库素材,包含白底主图、卖点图、细节图和生活方式图。", "gd-cli workflows run listing-gallery --image ./sku_001.jpg --brief \"夏季轻薄防晒衣,透气面料,适合户外通勤;卖点图短文案:轻薄防晒 通勤无负担\" --copy-mode render-text --ratio 1:1 -f json", {
340
+ scenarioExample("生成一套可上架的商品图库素材,包含白底主图、卖点图、细节图和生活方式图。", "gd-cli workflows run listing-gallery --image ./sku_001.jpg --brief \"夏季轻薄防晒衣,透气面料,适合户外通勤;卖点图短文案:轻薄防晒 通勤无负担\" --copy-mode render-text --ratio 1:1 --json", {
429
341
  image: "./sku_001.jpg",
430
342
  brief: "夏季轻薄防晒衣,透气面料,适合户外通勤;卖点图短文案:轻薄防晒 通勤无负担",
431
343
  copy_mode: "render-text",
@@ -435,7 +347,7 @@ function curatedAppExamples(appId) {
435
347
  }
436
348
  if (appId === "pdp-a-plus") {
437
349
  return [
438
- scenarioExample("生成详情页/A+模块素材,按购买疑虑组织首屏、痛点、结构、使用和规格模块。", "gd-cli workflows run pdp-a-plus --image ./air-purifier.jpg --brief \"桌面空气净化器,静音,滤芯可更换,适合卧室;首屏短文案:静音净化 安心入睡\" --copy-mode render-text --ratio 4:5 -f json", {
350
+ scenarioExample("生成详情页/A+模块素材,按购买疑虑组织首屏、痛点、结构、使用和规格模块。", "gd-cli workflows run pdp-a-plus --image ./air-purifier.jpg --brief \"桌面空气净化器,静音,滤芯可更换,适合卧室;首屏短文案:静音净化 安心入睡\" --copy-mode render-text --ratio 4:5 --json", {
439
351
  image: "./air-purifier.jpg",
440
352
  brief: "桌面空气净化器,静音,滤芯可更换,适合卧室;首屏短文案:静音净化 安心入睡",
441
353
  copy_mode: "render-text",
@@ -445,7 +357,7 @@ function curatedAppExamples(appId) {
445
357
  }
446
358
  if (appId === "social-seeding-pack") {
447
359
  return [
448
- scenarioExample("生成小红书种草图文素材,包含封面图、场景图、标题、正文和标签。", "gd-cli workflows run social-seeding-pack --image ./serum.jpg --brief \"屏障修护精华,清爽不黏,适合通勤包分享;封面短文案:通勤包里的清爽修护\" --copy-mode render-text --ratio 3:4 -f json", {
360
+ scenarioExample("生成小红书种草图文素材,包含封面图、场景图、标题、正文和标签。", "gd-cli workflows run social-seeding-pack --image ./serum.jpg --brief \"屏障修护精华,清爽不黏,适合通勤包分享;封面短文案:通勤包里的清爽修护\" --copy-mode render-text --ratio 3:4 --json", {
449
361
  image: "./serum.jpg",
450
362
  brief: "屏障修护精华,清爽不黏,适合通勤包分享;封面短文案:通勤包里的清爽修护",
451
363
  copy_mode: "render-text",
@@ -455,7 +367,7 @@ function curatedAppExamples(appId) {
455
367
  }
456
368
  if (appId === "campaign-kv-pack") {
457
369
  return [
458
- scenarioExample("生成 Campaign KV 多渠道素材,包含横版、方图、竖图和渠道裁切建议。", "gd-cli workflows run campaign-kv-pack --image ./running-shoes.jpg --brief \"城市跑鞋新品 Campaign,轻量缓震,面向通勤跑者;主标题:轻跑进城\" --copy-mode render-text --ratios 16:9,1:1,4:5 -f json", {
370
+ scenarioExample("生成 Campaign KV 多渠道素材,包含横版、方图、竖图和渠道裁切建议。", "gd-cli workflows run campaign-kv-pack --image ./running-shoes.jpg --brief \"城市跑鞋新品 Campaign,轻量缓震,面向通勤跑者;主标题:轻跑进城\" --copy-mode render-text --ratios 16:9,1:1,4:5 --json", {
459
371
  image: "./running-shoes.jpg",
460
372
  brief: "城市跑鞋新品 Campaign,轻量缓震,面向通勤跑者;主标题:轻跑进城",
461
373
  copy_mode: "render-text",
@@ -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,