gaoding-cli 1.0.0-alpha.5

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 (177) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/LICENSE +21 -0
  3. package/README.md +136 -0
  4. package/SECURITY.md +34 -0
  5. package/dist/bin/gd-cli.d.ts +2 -0
  6. package/dist/bin/gd-cli.js +10 -0
  7. package/dist/src/api/app-runner.d.ts +33 -0
  8. package/dist/src/api/app-runner.js +1177 -0
  9. package/dist/src/api/dam-client.d.ts +111 -0
  10. package/dist/src/api/dam-client.js +897 -0
  11. package/dist/src/api/direct-auth.d.ts +3 -0
  12. package/dist/src/api/direct-auth.js +11 -0
  13. package/dist/src/api/direct-client.d.ts +27 -0
  14. package/dist/src/api/direct-client.js +151 -0
  15. package/dist/src/api/direct-tools.d.ts +43 -0
  16. package/dist/src/api/direct-tools.js +1155 -0
  17. package/dist/src/api/hub-client.d.ts +20 -0
  18. package/dist/src/api/hub-client.js +99 -0
  19. package/dist/src/api/sso-client.d.ts +60 -0
  20. package/dist/src/api/sso-client.js +140 -0
  21. package/dist/src/api/task-poller.d.ts +38 -0
  22. package/dist/src/api/task-poller.js +72 -0
  23. package/dist/src/api/tool-invoker.d.ts +12 -0
  24. package/dist/src/api/tool-invoker.js +11 -0
  25. package/dist/src/api/usage-client.d.ts +39 -0
  26. package/dist/src/api/usage-client.js +179 -0
  27. package/dist/src/auth/credential-store-v2.d.ts +12 -0
  28. package/dist/src/auth/credential-store-v2.js +59 -0
  29. package/dist/src/commands/auth.d.ts +2 -0
  30. package/dist/src/commands/auth.js +191 -0
  31. package/dist/src/commands/dam.d.ts +2 -0
  32. package/dist/src/commands/dam.js +293 -0
  33. package/dist/src/commands/models.d.ts +2 -0
  34. package/dist/src/commands/models.js +78 -0
  35. package/dist/src/commands/org.d.ts +2 -0
  36. package/dist/src/commands/org.js +137 -0
  37. package/dist/src/commands/skills.d.ts +2 -0
  38. package/dist/src/commands/skills.js +213 -0
  39. package/dist/src/commands/tools.d.ts +4 -0
  40. package/dist/src/commands/tools.js +383 -0
  41. package/dist/src/commands/update.d.ts +2 -0
  42. package/dist/src/commands/update.js +167 -0
  43. package/dist/src/commands/usage.d.ts +7 -0
  44. package/dist/src/commands/usage.js +43 -0
  45. package/dist/src/commands/workflows.d.ts +3 -0
  46. package/dist/src/commands/workflows.js +398 -0
  47. package/dist/src/core/auth/auth-provider.d.ts +8 -0
  48. package/dist/src/core/auth/auth-provider.js +12 -0
  49. package/dist/src/core/auth/device-oauth-provider.d.ts +12 -0
  50. package/dist/src/core/auth/device-oauth-provider.js +124 -0
  51. package/dist/src/core/auth/org-manager.d.ts +26 -0
  52. package/dist/src/core/auth/org-manager.js +224 -0
  53. package/dist/src/core/auth/signature.d.ts +19 -0
  54. package/dist/src/core/auth/signature.js +33 -0
  55. package/dist/src/core/auth/types.d.ts +52 -0
  56. package/dist/src/core/auth/types.js +3 -0
  57. package/dist/src/core/output/cli-error.d.ts +5 -0
  58. package/dist/src/core/output/cli-error.js +8 -0
  59. package/dist/src/core/output/detector.d.ts +5 -0
  60. package/dist/src/core/output/detector.js +14 -0
  61. package/dist/src/core/output/engine.d.ts +32 -0
  62. package/dist/src/core/output/engine.js +77 -0
  63. package/dist/src/core/output/envelope.d.ts +40 -0
  64. package/dist/src/core/output/envelope.js +119 -0
  65. package/dist/src/core/output/index.d.ts +4 -0
  66. package/dist/src/core/output/index.js +4 -0
  67. package/dist/src/core/output/live-display.d.ts +15 -0
  68. package/dist/src/core/output/live-display.js +111 -0
  69. package/dist/src/core/output/result-card.d.ts +18 -0
  70. package/dist/src/core/output/result-card.js +39 -0
  71. package/dist/src/core/prompt/index.d.ts +31 -0
  72. package/dist/src/core/prompt/index.js +36 -0
  73. package/dist/src/io.d.ts +14 -0
  74. package/dist/src/io.js +31 -0
  75. package/dist/src/middleware/auth.d.ts +3 -0
  76. package/dist/src/middleware/auth.js +74 -0
  77. package/dist/src/middleware/error-handler.d.ts +3 -0
  78. package/dist/src/middleware/error-handler.js +431 -0
  79. package/dist/src/middleware/interactive-params.d.ts +14 -0
  80. package/dist/src/middleware/interactive-params.js +53 -0
  81. package/dist/src/middleware/output.d.ts +14 -0
  82. package/dist/src/middleware/output.js +546 -0
  83. package/dist/src/models/model-catalog.d.ts +26 -0
  84. package/dist/src/models/model-catalog.js +216 -0
  85. package/dist/src/program.d.ts +2 -0
  86. package/dist/src/program.js +152 -0
  87. package/dist/src/registry/agent-contracts.d.ts +43 -0
  88. package/dist/src/registry/agent-contracts.js +483 -0
  89. package/dist/src/registry/app-loader.d.ts +2 -0
  90. package/dist/src/registry/app-loader.js +70 -0
  91. package/dist/src/registry/direct-registry.d.ts +11 -0
  92. package/dist/src/registry/direct-registry.js +234 -0
  93. package/dist/src/registry/registry-cache.d.ts +10 -0
  94. package/dist/src/registry/registry-cache.js +52 -0
  95. package/dist/src/registry/registry-client.d.ts +28 -0
  96. package/dist/src/registry/registry-client.js +50 -0
  97. package/dist/src/registry/types.d.ts +69 -0
  98. package/dist/src/registry/types.js +1 -0
  99. package/dist/src/tty/auth-presenter.d.ts +3 -0
  100. package/dist/src/tty/auth-presenter.js +21 -0
  101. package/dist/src/update/install-source.d.ts +19 -0
  102. package/dist/src/update/install-source.js +139 -0
  103. package/dist/src/update/notifier.d.ts +2 -0
  104. package/dist/src/update/notifier.js +59 -0
  105. package/dist/src/update/update-checker.d.ts +22 -0
  106. package/dist/src/update/update-checker.js +110 -0
  107. package/dist/src/update/version.d.ts +9 -0
  108. package/dist/src/update/version.js +52 -0
  109. package/dist/src/utils/agent-skill-installer.d.ts +57 -0
  110. package/dist/src/utils/agent-skill-installer.js +389 -0
  111. package/dist/src/utils/capability-metadata.d.ts +18 -0
  112. package/dist/src/utils/capability-metadata.js +88 -0
  113. package/dist/src/utils/capability-presenter.d.ts +4 -0
  114. package/dist/src/utils/capability-presenter.js +190 -0
  115. package/dist/src/utils/config.d.ts +16 -0
  116. package/dist/src/utils/config.js +54 -0
  117. package/dist/src/utils/credential-permissions.d.ts +2 -0
  118. package/dist/src/utils/credential-permissions.js +22 -0
  119. package/dist/src/utils/ecommerce-input-guidance.d.ts +15 -0
  120. package/dist/src/utils/ecommerce-input-guidance.js +85 -0
  121. package/dist/src/utils/endpoints.d.ts +52 -0
  122. package/dist/src/utils/endpoints.js +258 -0
  123. package/dist/src/utils/enrich-upload-params.d.ts +6 -0
  124. package/dist/src/utils/enrich-upload-params.js +11 -0
  125. package/dist/src/utils/entitlement.d.ts +17 -0
  126. package/dist/src/utils/entitlement.js +146 -0
  127. package/dist/src/utils/gd-home.d.ts +7 -0
  128. package/dist/src/utils/gd-home.js +26 -0
  129. package/dist/src/utils/help-verify.d.ts +9 -0
  130. package/dist/src/utils/help-verify.js +41 -0
  131. package/dist/src/utils/input-json.d.ts +3 -0
  132. package/dist/src/utils/input-json.js +61 -0
  133. package/dist/src/utils/list-output-format.d.ts +10 -0
  134. package/dist/src/utils/list-output-format.js +34 -0
  135. package/dist/src/utils/logger.d.ts +6 -0
  136. package/dist/src/utils/logger.js +19 -0
  137. package/dist/src/utils/matting-compose.d.ts +10 -0
  138. package/dist/src/utils/matting-compose.js +45 -0
  139. package/dist/src/utils/open-browser.d.ts +1 -0
  140. package/dist/src/utils/open-browser.js +4 -0
  141. package/dist/src/utils/output-path.d.ts +5 -0
  142. package/dist/src/utils/output-path.js +70 -0
  143. package/dist/src/utils/redact.d.ts +3 -0
  144. package/dist/src/utils/redact.js +96 -0
  145. package/dist/src/utils/reference-image.d.ts +8 -0
  146. package/dist/src/utils/reference-image.js +43 -0
  147. package/dist/src/utils/resolve-app-local-images.d.ts +8 -0
  148. package/dist/src/utils/resolve-app-local-images.js +84 -0
  149. package/dist/src/utils/sensitive-path.d.ts +6 -0
  150. package/dist/src/utils/sensitive-path.js +69 -0
  151. package/dist/src/utils/settings-store.d.ts +42 -0
  152. package/dist/src/utils/settings-store.js +50 -0
  153. package/dist/src/utils/sleep.d.ts +1 -0
  154. package/dist/src/utils/sleep.js +3 -0
  155. package/dist/src/utils/spinner.d.ts +2 -0
  156. package/dist/src/utils/spinner.js +4 -0
  157. package/dist/src/utils/static-help.d.ts +2 -0
  158. package/dist/src/utils/static-help.js +3 -0
  159. package/dist/src/utils/tool-display.d.ts +10 -0
  160. package/dist/src/utils/tool-display.js +55 -0
  161. package/dist/src/utils/transient-network-error.d.ts +4 -0
  162. package/dist/src/utils/transient-network-error.js +40 -0
  163. package/dist/src/utils/url-safety.d.ts +6 -0
  164. package/dist/src/utils/url-safety.js +67 -0
  165. package/dist/src/utils/write-app-deliverables.d.ts +18 -0
  166. package/dist/src/utils/write-app-deliverables.js +386 -0
  167. package/package.json +91 -0
  168. package/skills/gd-cli/SKILL.md +57 -0
  169. package/skills/gd-cli/references/auth.md +31 -0
  170. package/skills/gd-cli/references/deliverables.md +22 -0
  171. package/skills/gd-cli/references/entitlement.md +21 -0
  172. package/skills/gd-cli/references/errors.md +19 -0
  173. package/skills/gd-cli/references/org.md +18 -0
  174. package/skills/gd-cli/references/sop.md +25 -0
  175. package/skills/gd-cli/references/tools.md +29 -0
  176. package/skills/gd-cli/references/update.md +16 -0
  177. package/skills/gd-cli/references/workflows.md +22 -0
@@ -0,0 +1,137 @@
1
+ import chalk from "chalk";
2
+ import { withErrorHandler } from "../middleware/error-handler.js";
3
+ import { withAuth } from "../middleware/auth.js";
4
+ import { OrgManager } from "../core/auth/org-manager.js";
5
+ import { formatOutput } from "../middleware/output.js";
6
+ import { resolveInvokeOutputFormat, resolveListOutputFormat, } from "../utils/list-output-format.js";
7
+ import { getIO } from "../io.js";
8
+ import { emitJson, wrapEnvelope } from "../core/output/envelope.js";
9
+ import { setStaticHelp } from "../utils/static-help.js";
10
+ export function registerOrgCommand(program) {
11
+ const org = program
12
+ .command("org")
13
+ .usage("<command> [options]")
14
+ .description("查看与切换当前 CLI 团队")
15
+ .configureHelp({ showGlobalOptions: true });
16
+ setStaticHelp(org, ORG_HELP);
17
+ org
18
+ .command("list")
19
+ .alias("ls")
20
+ .description("列出可绑定的组织")
21
+ .action(withErrorHandler(withAuth(async (_opts, command) => {
22
+ const cmd = command;
23
+ const manager = new OrgManager();
24
+ const orgs = await manager.listOrgs();
25
+ const current = manager.getCurrentOrgId();
26
+ const format = resolveListOutputFormat(cmd);
27
+ const rows = orgs.map((o) => ({
28
+ current: o.id === current ? "yes" : "",
29
+ name: o.name,
30
+ id: o.id,
31
+ type: o.org_class ?? "",
32
+ product: o.product_name ?? "",
33
+ status: o.status ?? "",
34
+ expires: formatExpireDate(o.expire_date),
35
+ }));
36
+ if (getIO().prefersJsonOutput(format)) {
37
+ emitJson(wrapEnvelope({ orgs, current_org_id: current }, { command: "org list" }));
38
+ return;
39
+ }
40
+ if (format === "json") {
41
+ formatOutput({ orgs, current_org_id: current }, format);
42
+ }
43
+ else {
44
+ formatOutput(rows, format === "table" ? "table" : "text");
45
+ }
46
+ })));
47
+ org
48
+ .command("current")
49
+ .description("快速查询当前组织")
50
+ .action(withErrorHandler(async (_opts, command) => {
51
+ const cmd = command;
52
+ const manager = new OrgManager();
53
+ const current = manager.getCurrentOrg();
54
+ const payload = {
55
+ status: current ? "completed" : "not_set",
56
+ current_org_id: current?.id ?? null,
57
+ current_org: current ?? null,
58
+ next_command: current ? undefined : "gd-cli org list",
59
+ };
60
+ const format = resolveInvokeOutputFormat(cmd);
61
+ if (getIO().prefersJsonOutput(format) || format === "json") {
62
+ formatOutput(payload, "json");
63
+ return;
64
+ }
65
+ if (!current) {
66
+ console.log(chalk.yellow("当前未绑定团队"));
67
+ console.log(" gd-cli org list");
68
+ return;
69
+ }
70
+ console.log(`当前组织: ${current.name} (${current.id})`);
71
+ }));
72
+ org
73
+ .command("switch")
74
+ .description("切换当前 CLI 组织(TTY 下可交互选择)")
75
+ .option("--org <org-id>", "组织 ID")
76
+ .action(withErrorHandler(withAuth(async (options, command) => {
77
+ const cmd = command;
78
+ const format = resolveListOutputFormat(cmd);
79
+ const manager = new OrgManager();
80
+ let orgId = options.org;
81
+ if (!orgId) {
82
+ const io = getIO();
83
+ if (io.isInteractiveAuth()) {
84
+ const orgs = await manager.listOrgs();
85
+ if (orgs.length === 0) {
86
+ console.log(chalk.yellow("暂无可用组织"));
87
+ return;
88
+ }
89
+ const { Prompt } = await import("../core/prompt/index.js");
90
+ const current = manager.getCurrentOrgId();
91
+ orgId = await Prompt.select({
92
+ message: "选择 CLI 当前组织",
93
+ choices: orgs.map((o) => ({
94
+ name: formatOrgChoice(o, current),
95
+ value: o.id,
96
+ })),
97
+ });
98
+ }
99
+ else {
100
+ const orgs = await manager.listOrgs();
101
+ emitJson(wrapEnvelope({ error: "org_selection_required", orgs }, { command: "org switch" }));
102
+ process.exitCode = 1;
103
+ return;
104
+ }
105
+ }
106
+ const result = await manager.switchOrg(orgId);
107
+ if (getIO().prefersJsonOutput(format)) {
108
+ emitJson(wrapEnvelope({ org: result }, { command: "org switch" }));
109
+ return;
110
+ }
111
+ console.log(chalk.green(`\n✓ 已切换到组织: ${result.name} (${result.id})`));
112
+ console.log(chalk.yellow("\n请 60s 后再调用能力,即可按新组织的权益执行~\n"));
113
+ })));
114
+ }
115
+ const ORG_HELP = `
116
+ Usage: gd-cli org <command> [options]
117
+
118
+ 用于查看和切换当前组织
119
+
120
+ 常用命令:
121
+ list/ls 列出可绑定的组织
122
+ current 查询当前绑定的组织
123
+ switch 切换绑定的组织
124
+ `;
125
+ function formatOrgChoice(org, currentOrgId) {
126
+ const product = org.product_name ? ` · ${org.product_name}` : "";
127
+ const current = org.id === currentOrgId ? " ← 当前" : "";
128
+ return `${org.name} (${org.id})${product}${current}`;
129
+ }
130
+ function formatExpireDate(value) {
131
+ if (!value)
132
+ return "";
133
+ const d = new Date(value);
134
+ if (Number.isNaN(d.getTime()))
135
+ return String(value);
136
+ return d.toISOString().slice(0, 10);
137
+ }
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare function registerSkillsCommand(program: Command): void;
@@ -0,0 +1,213 @@
1
+ import { CliUsageError } from "../core/output/cli-error.js";
2
+ import { emitJson, shouldEmitEnvelope, wrapEnvelope, } from "../core/output/envelope.js";
3
+ import { Prompt } from "../core/prompt/index.js";
4
+ import { withErrorHandler } from "../middleware/error-handler.js";
5
+ import { formatOutput } from "../middleware/output.js";
6
+ import { AgentSkillInstaller, AgentSkillOperationError, } from "../utils/agent-skill-installer.js";
7
+ import { collectArg } from "../utils/input-json.js";
8
+ import { resolveInvokeOutputFormat } from "../utils/list-output-format.js";
9
+ import { setStaticHelp } from "../utils/static-help.js";
10
+ const TARGET_IDS = [
11
+ "universal",
12
+ "claude-code",
13
+ "codex",
14
+ "cursor",
15
+ "opencode",
16
+ "openclaw",
17
+ "workbuddy",
18
+ ];
19
+ export function registerSkillsCommand(program) {
20
+ const skills = program
21
+ .command("skills")
22
+ .description("安装和管理 gd-cli Agent Skill");
23
+ setStaticHelp(skills, SKILLS_HELP);
24
+ skills
25
+ .command("install")
26
+ .description("安装 gd-cli Agent Skill")
27
+ .option("-a, --agent <id>", "目标 Agent,可重复", collectArg, [])
28
+ .option("--all", "安装到全部已知 Agent")
29
+ .option("-y, --yes", "跳过确认")
30
+ .allowExcessArguments(false)
31
+ .action(withErrorHandler(async (options, command) => {
32
+ const installer = new AgentSkillInstaller();
33
+ const agents = await resolveMutationTargets("install", installer, options, command);
34
+ await confirmMutation("install", options, command);
35
+ const result = runInstaller(() => installer.install(agents));
36
+ emitResult(result, command, "skills install");
37
+ }));
38
+ skills
39
+ .command("status")
40
+ .description("查看七个固定 Agent target 的安装状态")
41
+ .allowExcessArguments(false)
42
+ .action(withErrorHandler(async (_options, command) => {
43
+ emitResult(new AgentSkillInstaller().status(), command, "skills status");
44
+ }));
45
+ skills
46
+ .command("update")
47
+ .description("刷新已安装的 gd-cli Agent Skill")
48
+ .allowExcessArguments(false)
49
+ .action(withErrorHandler(async (_options, command) => {
50
+ const installer = new AgentSkillInstaller();
51
+ const result = runInstaller(() => installer.update());
52
+ emitResult(result, command, "skills update");
53
+ }));
54
+ skills
55
+ .command("uninstall")
56
+ .description("卸载 gd-cli 托管的 Agent Skill")
57
+ .option("-a, --agent <id>", "目标 Agent,可重复", collectArg, [])
58
+ .option("--all", "卸载全部已知 Agent target")
59
+ .option("-y, --yes", "跳过确认")
60
+ .allowExcessArguments(false)
61
+ .action(withErrorHandler(async (options, command) => {
62
+ const installer = new AgentSkillInstaller();
63
+ const agents = await resolveMutationTargets("uninstall", installer, options, command);
64
+ if (agents.length === 0) {
65
+ emitResult(installer.uninstall([]), command, "skills uninstall");
66
+ return;
67
+ }
68
+ await confirmMutation("uninstall", options, command);
69
+ const result = runInstaller(() => installer.uninstall(agents));
70
+ emitResult(result, command, "skills uninstall");
71
+ }));
72
+ }
73
+ async function resolveMutationTargets(operation, installer, options, command) {
74
+ const explicit = Array.isArray(options.agent)
75
+ ? options.agent.map(String)
76
+ : [];
77
+ if (options.all && explicit.length > 0) {
78
+ throw usageError("--all 与 --agent 不能同时使用");
79
+ }
80
+ if (options.all)
81
+ return [...TARGET_IDS];
82
+ if (explicit.length > 0)
83
+ return validateTargets(explicit);
84
+ if (!canPrompt(command)) {
85
+ throw usageError(`非交互环境必须通过 --agent <id> 或 --all 指定目标,并使用 --yes;例如 gd-cli skills ${operation} --agent codex --yes`);
86
+ }
87
+ if (operation === "install") {
88
+ const detected = new Set(installer.detectedTargets());
89
+ const selected = await Prompt.multiSelect({
90
+ message: "选择要安装 gd-cli Skill 的 Agent",
91
+ choices: installer.listTargets().map((target) => ({
92
+ name: `${target.name} ${target.path}`,
93
+ value: target.id,
94
+ description: target.id === "universal"
95
+ ? "canonical copy"
96
+ : "链接到 canonical copy",
97
+ checked: target.id === "universal" || detected.has(target.id),
98
+ disabled: target.id === "universal" ? "始终安装" : false,
99
+ })),
100
+ });
101
+ return validateTargets(selected.filter((target) => target !== "universal"));
102
+ }
103
+ const status = installer.status();
104
+ const installed = new Set(status.targets
105
+ .filter((target) => target.status === "installed" || target.status === "outdated")
106
+ .map((target) => target.agent));
107
+ if (installed.size === 0)
108
+ return [];
109
+ const selected = await Prompt.multiSelect({
110
+ message: "选择要卸载 gd-cli Skill 的 Agent",
111
+ choices: installer.listTargets()
112
+ .filter((target) => installed.has(target.id))
113
+ .map((target) => ({
114
+ name: `${target.name} ${target.path}`,
115
+ value: target.id,
116
+ description: target.id === "universal"
117
+ ? "仅当没有其他 Agent 依赖时可删除"
118
+ : "只删除该 Agent target",
119
+ })),
120
+ });
121
+ return validateTargets(selected);
122
+ }
123
+ function validateTargets(values) {
124
+ const targets = [];
125
+ for (const value of values) {
126
+ if (!TARGET_IDS.includes(value)) {
127
+ throw usageError(`不支持的 Agent: ${value}。可选值: ${TARGET_IDS.join(", ")}`);
128
+ }
129
+ const target = value;
130
+ if (!targets.includes(target))
131
+ targets.push(target);
132
+ }
133
+ return targets;
134
+ }
135
+ async function confirmMutation(operation, options, command) {
136
+ if (options.yes || rootYes(command))
137
+ return;
138
+ if (!canPrompt(command)) {
139
+ throw usageError(`非交互环境必须使用 --yes 确认 gd-cli skills ${operation}`);
140
+ }
141
+ const accepted = await Prompt.confirm(operation === "install"
142
+ ? "是否安装 gd-cli Agent Skill?"
143
+ : "是否卸载所选 gd-cli Agent Skill?", false);
144
+ if (!accepted)
145
+ throw usageError("已取消,未修改任何文件");
146
+ }
147
+ function runInstaller(operation) {
148
+ try {
149
+ return operation();
150
+ }
151
+ catch (error) {
152
+ if (error instanceof AgentSkillOperationError) {
153
+ throw new CliUsageError({
154
+ code: "AGENT_SKILL_OPERATION_FAILED",
155
+ type: "validation",
156
+ message: error.message,
157
+ retryable: false,
158
+ detail: error.result,
159
+ });
160
+ }
161
+ throw error;
162
+ }
163
+ }
164
+ function emitResult(result, command, commandName) {
165
+ const format = resolveInvokeOutputFormat(command);
166
+ if (shouldEmitEnvelope(format)) {
167
+ emitJson(wrapEnvelope(result, { command: commandName }));
168
+ }
169
+ else {
170
+ formatOutput(result, format);
171
+ }
172
+ }
173
+ function usageError(message) {
174
+ return new CliUsageError({
175
+ code: "AGENT_SKILL_USAGE_INVALID",
176
+ type: "validation",
177
+ message,
178
+ retryable: false,
179
+ });
180
+ }
181
+ function canPrompt(command) {
182
+ const options = rootOptions(command);
183
+ return options.noInput !== true
184
+ && options.input !== false
185
+ && Boolean(process.stdin.isTTY && process.stdout.isTTY);
186
+ }
187
+ function rootYes(command) {
188
+ return Boolean(rootOptions(command).yes);
189
+ }
190
+ function rootOptions(command) {
191
+ let current = command;
192
+ while (current.parent)
193
+ current = current.parent;
194
+ return current.opts();
195
+ }
196
+ const SKILLS_HELP = `
197
+ gd-cli skills <command> [options]
198
+
199
+ 安装和管理随 gaoding-cli 发布的 gd-cli Agent Skill。
200
+
201
+ 命令:
202
+ install 安装 canonical Skill,并连接所选 Agent
203
+ status 查看七个固定 Agent target
204
+ update 刷新已安装的 canonical 和 fallback copy
205
+ uninstall 删除所选 gd-cli 托管 target
206
+
207
+ 示例:
208
+ gd-cli skills install
209
+ gd-cli skills install --agent codex --yes --format json
210
+ gd-cli skills status --format json
211
+ gd-cli skills update
212
+ gd-cli skills uninstall --all --yes
213
+ `;
@@ -0,0 +1,4 @@
1
+ import { Command } from "commander";
2
+ export declare function registerToolsCommand(program: Command): void;
3
+ export declare function runToolCall(toolName: string, input: string | undefined, opts: Record<string, unknown>, cmd: Command): Promise<void>;
4
+ export declare function mergeToolCallOptions(base: Record<string, unknown>, opts: Record<string, unknown>): Record<string, unknown>;