ccjk 9.4.3 → 9.4.4

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 (70) hide show
  1. package/dist/chunks/agent.mjs +13 -9
  2. package/dist/chunks/ccjk-agents.mjs +95 -93
  3. package/dist/chunks/ccjk-all.mjs +445 -441
  4. package/dist/chunks/ccjk-hooks.mjs +18 -15
  5. package/dist/chunks/ccjk-mcp.mjs +46 -41
  6. package/dist/chunks/ccjk-setup.mjs +71 -70
  7. package/dist/chunks/ccjk-skills.mjs +20 -20
  8. package/dist/chunks/ccr.mjs +3 -3
  9. package/dist/chunks/claude-code-config-manager.mjs +2 -2
  10. package/dist/chunks/claude-code-incremental-manager.mjs +1 -1
  11. package/dist/chunks/cli-hook.mjs +1416 -1328
  12. package/dist/chunks/cli.mjs +65 -41
  13. package/dist/chunks/codex.mjs +7 -7
  14. package/dist/chunks/completion.mjs +1 -1
  15. package/dist/chunks/config-consolidator.mjs +2 -2
  16. package/dist/chunks/config.mjs +2 -2
  17. package/dist/chunks/config2.mjs +2 -2
  18. package/dist/chunks/doctor.mjs +4 -4
  19. package/dist/chunks/features.mjs +1 -1
  20. package/dist/chunks/fish.mjs +2 -2
  21. package/dist/chunks/index5.mjs +254 -253
  22. package/dist/chunks/index7.mjs +656 -0
  23. package/dist/chunks/init.mjs +88 -4
  24. package/dist/chunks/json-config.mjs +1 -1
  25. package/dist/chunks/menu.mjs +7 -5
  26. package/dist/chunks/monitor.mjs +96 -54
  27. package/dist/chunks/onboarding.mjs +4 -4
  28. package/dist/chunks/package.mjs +209 -2
  29. package/dist/chunks/project-detector.mjs +23 -12
  30. package/dist/chunks/quick-provider.mjs +53 -34
  31. package/dist/chunks/quick-setup.mjs +4 -4
  32. package/dist/chunks/skill.mjs +5 -5
  33. package/dist/chunks/skills.mjs +7 -3
  34. package/dist/chunks/startup.mjs +219 -219
  35. package/dist/chunks/update.mjs +3 -3
  36. package/dist/chunks/upgrade-manager.mjs +1 -1
  37. package/dist/chunks/version-checker.mjs +1 -1
  38. package/dist/cli.mjs +4 -1
  39. package/dist/i18n/locales/en/ccjk-agents.json +1 -1
  40. package/dist/i18n/locales/en/ccjk-all.json +1 -1
  41. package/dist/i18n/locales/en/ccjk-skills.json +1 -1
  42. package/dist/i18n/locales/en/cloud-setup.json +1 -1
  43. package/dist/i18n/locales/en/plugins.json +13 -0
  44. package/dist/i18n/locales/en/setup.json +1 -1
  45. package/dist/i18n/locales/zh-CN/ccjk-agents.json +1 -1
  46. package/dist/i18n/locales/zh-CN/ccjk-all.json +1 -1
  47. package/dist/i18n/locales/zh-CN/ccjk-skills.json +1 -1
  48. package/dist/i18n/locales/zh-CN/cloud-setup.json +1 -1
  49. package/dist/i18n/locales/zh-CN/plugins.json +13 -0
  50. package/dist/i18n/locales/zh-CN/setup.json +1 -1
  51. package/dist/index.d.mts +1609 -483
  52. package/dist/index.d.ts +1609 -483
  53. package/dist/index.mjs +4439 -1731
  54. package/dist/shared/{ccjk.CcFAyU1D.mjs → ccjk.0Alj2iLZ.mjs} +2046 -2011
  55. package/dist/shared/{ccjk.BCSUNwWl.mjs → ccjk.BI7ZG5E_.mjs} +2 -2
  56. package/dist/shared/{ccjk.C4nuYSEu.mjs → ccjk.Bvoex4TZ.mjs} +17 -9
  57. package/dist/shared/{ccjk.DqALuTvR.mjs → ccjk.Cg7t5XaL.mjs} +26 -12
  58. package/package.json +55 -57
  59. package/templates/agents/fullstack-developer.json +1 -1
  60. package/templates/agents/go-expert.json +1 -1
  61. package/templates/agents/index.json +64 -0
  62. package/templates/agents/python-expert.json +1 -1
  63. package/templates/agents/react-specialist.json +1 -1
  64. package/templates/agents/testing-automation-expert.json +1 -1
  65. package/templates/agents/typescript-architect.json +1 -1
  66. package/templates/hooks/post-test/coverage.json +1 -1
  67. package/templates/hooks/post-test/summary.json +1 -1
  68. package/templates/hooks/pre-commit/eslint.json +1 -1
  69. package/templates/hooks/pre-commit/prettier.json +1 -1
  70. package/templates/skills/index.json +132 -0
@@ -1,18 +1,18 @@
1
1
  import ansis from 'ansis';
2
2
  import { existsSync, readFileSync, mkdirSync, writeFileSync, readdirSync } from 'node:fs';
3
3
  import { join } from 'pathe';
4
- import { g as getPluginManager } from '../shared/ccjk.DqALuTvR.mjs';
5
- import { homedir } from 'node:os';
6
- import { w as writeAgentFile } from '../shared/ccjk.C4nuYSEu.mjs';
7
4
  import { CCJK_CONFIG_DIR } from './constants.mjs';
8
- import 'tinyexec';
9
- import 'node:child_process';
10
- import '../shared/ccjk.Bdhyg3X-.mjs';
5
+ import { w as writeAgentFile } from '../shared/ccjk.Bvoex4TZ.mjs';
6
+ import { g as getPluginManager } from '../shared/ccjk.Cg7t5XaL.mjs';
7
+ import { homedir } from 'node:os';
11
8
  import './index3.mjs';
12
9
  import 'node:process';
13
10
  import 'node:url';
14
11
  import 'i18next';
15
12
  import 'i18next-fs-backend';
13
+ import 'tinyexec';
14
+ import 'node:child_process';
15
+ import '../shared/ccjk.Bdhyg3X-.mjs';
16
16
 
17
17
  const CLAUDE_CONFIG_PATH = join(homedir(), ".claude.json");
18
18
  const TOOL_CACHE_TTL = 5 * 60 * 1e3;
@@ -710,12 +710,16 @@ class AgentCreator {
710
710
  throw new Error(`Template not found: ${templateId}`);
711
711
  }
712
712
  const definition = {
713
- ...template,
714
- ...overrides,
715
713
  id: overrides.id || `${templateId}-${Date.now()}`,
714
+ name: overrides.name || template.name || { "en": templateId, "zh-CN": templateId },
715
+ description: overrides.description || template.description || { "en": "", "zh-CN": "" },
716
+ persona: overrides.persona || template.persona || "",
717
+ instructions: overrides.instructions || template.instructions || "",
716
718
  skills: [...template.skills || [], ...overrides.skills || []],
717
719
  mcpServers: [...template.mcpServers || [], ...overrides.mcpServers || []],
718
- capabilities: [.../* @__PURE__ */ new Set([...template.capabilities || [], ...overrides.capabilities || []])]
720
+ capabilities: [.../* @__PURE__ */ new Set([...template.capabilities || [], ...overrides.capabilities || []])],
721
+ triggers: overrides.triggers || template.triggers,
722
+ intents: overrides.intents || template.intents
719
723
  };
720
724
  const manager = await getPluginManager();
721
725
  await manager.createAgent(definition);
@@ -1,12 +1,12 @@
1
- import consola from 'consola';
2
1
  import process__default, { cwd } from 'node:process';
3
- import { P as ProjectAnalyzer, g as getTemplatesClient } from '../shared/ccjk.CcFAyU1D.mjs';
2
+ import consola from 'consola';
3
+ import { P as ProjectAnalyzer, g as getTemplatesClient } from '../shared/ccjk.0Alj2iLZ.mjs';
4
+ import { i18n } from './index3.mjs';
5
+ import { existsSync, readFileSync, writeFileSync, readdirSync } from 'node:fs';
4
6
  import { join, dirname } from 'pathe';
5
- import { fileURLToPath } from 'node:url';
6
- import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
7
7
  import { CLAUDE_AGENTS_DIR } from './constants.mjs';
8
- import { i18n } from './index3.mjs';
9
- import { w as writeAgentFile } from '../shared/ccjk.C4nuYSEu.mjs';
8
+ import { w as writeAgentFile } from '../shared/ccjk.Bvoex4TZ.mjs';
9
+ import { fileURLToPath } from 'node:url';
10
10
  import { e as extractDisplayName, a as extractString } from '../shared/ccjk.AqnXPAzw.mjs';
11
11
  import 'fs-extra';
12
12
  import 'fs';
@@ -15,51 +15,9 @@ import 'url';
15
15
  import 'module';
16
16
  import 'smol-toml';
17
17
  import 'ofetch';
18
- import 'node:os';
19
18
  import 'i18next';
20
19
  import 'i18next-fs-backend';
21
-
22
- const _dirname = dirname(fileURLToPath(import.meta.url));
23
- const AGENT_TEMPLATES_DIR = join(_dirname, "..", "templates", "agents");
24
- const AGENT_TEMPLATES_DIR_FALLBACK = join(process.cwd(), "templates", "agents");
25
- function getAgentTemplatesDir() {
26
- if (existsSync(AGENT_TEMPLATES_DIR)) {
27
- return AGENT_TEMPLATES_DIR;
28
- }
29
- return AGENT_TEMPLATES_DIR_FALLBACK;
30
- }
31
- async function loadAgentTemplates() {
32
- const templatesDir = getAgentTemplatesDir();
33
- if (!existsSync(templatesDir)) {
34
- console.warn("Agent templates directory not found:", templatesDir);
35
- return [];
36
- }
37
- const templates = [];
38
- const files = readdirSync(templatesDir);
39
- for (const file of files) {
40
- if (!file.endsWith(".json")) continue;
41
- try {
42
- const filePath = join(templatesDir, file);
43
- const content = readFileSync(filePath, "utf-8");
44
- const template = JSON.parse(content);
45
- const recommendation = {
46
- name: template.name?.en || template.id || file.replace(".json", ""),
47
- description: template.description?.en || "No description available",
48
- skills: template.skills || [],
49
- mcpServers: template.mcpServers || [],
50
- persona: template.persona,
51
- capabilities: template.capabilities || [],
52
- confidence: 0.8,
53
- // Default confidence
54
- reason: `Matches project type and includes relevant skills: ${(template.skills || []).join(", ")}`
55
- };
56
- templates.push(recommendation);
57
- } catch (error) {
58
- console.warn(`Failed to load agent template ${file}:`, error);
59
- }
60
- }
61
- return templates;
62
- }
20
+ import 'node:os';
63
21
 
64
22
  const AGENTS_DIR = CLAUDE_AGENTS_DIR;
65
23
  async function registerAgent(agent) {
@@ -82,7 +40,7 @@ async function registerAgent(agent) {
82
40
  }
83
41
  function generateAgentId(agent) {
84
42
  const name = agent.name || agent.role || "agent";
85
- return name.toLowerCase().replace(/\s+/g, "-") + "-" + Date.now();
43
+ return `${name.toLowerCase().replace(/\s+/g, "-")}-${Date.now()}`;
86
44
  }
87
45
 
88
46
  function validateAgentDefinition(agent) {
@@ -130,22 +88,65 @@ function validateAgentDefinition(agent) {
130
88
  };
131
89
  }
132
90
 
91
+ const _dirname = dirname(fileURLToPath(import.meta.url));
92
+ const AGENT_TEMPLATES_DIR = join(_dirname, "..", "templates", "agents");
93
+ const AGENT_TEMPLATES_DIR_FALLBACK = join(process.cwd(), "templates", "agents");
94
+ function getAgentTemplatesDir() {
95
+ if (existsSync(AGENT_TEMPLATES_DIR)) {
96
+ return AGENT_TEMPLATES_DIR;
97
+ }
98
+ return AGENT_TEMPLATES_DIR_FALLBACK;
99
+ }
100
+ async function loadAgentTemplates() {
101
+ const templatesDir = getAgentTemplatesDir();
102
+ if (!existsSync(templatesDir)) {
103
+ console.warn("Agent templates directory not found:", templatesDir);
104
+ return [];
105
+ }
106
+ const templates = [];
107
+ const files = readdirSync(templatesDir);
108
+ for (const file of files) {
109
+ if (!file.endsWith(".json"))
110
+ continue;
111
+ try {
112
+ const filePath = join(templatesDir, file);
113
+ const content = readFileSync(filePath, "utf-8");
114
+ const template = JSON.parse(content);
115
+ const recommendation = {
116
+ name: template.name?.en || template.id || file.replace(".json", ""),
117
+ description: template.description?.en || "No description available",
118
+ skills: template.skills || [],
119
+ mcpServers: template.mcpServers || [],
120
+ persona: template.persona,
121
+ capabilities: template.capabilities || [],
122
+ confidence: 0.8,
123
+ // Default confidence
124
+ reason: `Matches project type and includes relevant skills: ${(template.skills || []).join(", ")}`
125
+ };
126
+ templates.push(recommendation);
127
+ } catch (error) {
128
+ console.warn(`Failed to load agent template ${file}:`, error);
129
+ }
130
+ }
131
+ return templates;
132
+ }
133
+
133
134
  async function ccjkAgents(options = {}) {
134
135
  try {
135
136
  if (options.lang) {
136
137
  i18n.changeLanguage(options.lang);
137
138
  }
138
- const isZh2 = i18n.language === "zh-CN";
139
+ const isZh = i18n.language === "zh-CN";
139
140
  if (options.list) {
140
141
  await listAgents();
141
142
  return;
142
143
  }
143
144
  if (options.delete) {
144
- consola.warn(isZh2 ? "\u5220\u9664\u529F\u80FD\u6682\u672A\u5B9E\u73B0" : "Delete functionality not yet implemented");
145
+ consola.warn(isZh ? "\u5220\u9664\u529F\u80FD\u6682\u672A\u5B9E\u73B0" : "Delete functionality not yet implemented");
145
146
  return;
146
147
  }
147
148
  if (!options.json) {
148
- consola.info(isZh2 ? "\u{1F50D} \u5206\u6790\u9879\u76EE\u4E2D..." : "\u{1F50D} Analyzing project...");
149
+ consola.info(isZh ? "\u{1F50D} \u5206\u6790\u9879\u76EE\u4E2D..." : "\u{1F50D} Analyzing project...");
149
150
  }
150
151
  const analyzer = new ProjectAnalyzer();
151
152
  const analysis = await analyzer.analyze(cwd());
@@ -159,18 +160,18 @@ async function ccjkAgents(options = {}) {
159
160
  const projectType = analysis.projectType;
160
161
  const frameworks = analysis.frameworks.map((f) => f.name);
161
162
  const languages = analysis.languages.map((l) => l.language);
162
- consola.success(`${isZh2 ? "\u68C0\u6D4B\u5230" : "Detected"}: ${projectType}`);
163
+ consola.success(`${isZh ? "\u68C0\u6D4B\u5230" : "Detected"}: ${projectType}`);
163
164
  if (frameworks.length > 0) {
164
- consola.info(`${isZh2 ? "\u6846\u67B6" : "Frameworks"}: ${frameworks.join(", ")}`);
165
+ consola.info(`${isZh ? "\u6846\u67B6" : "Frameworks"}: ${frameworks.join(", ")}`);
165
166
  }
166
167
  if (languages.length > 0) {
167
- consola.info(`${isZh2 ? "\u8BED\u8A00" : "Languages"}: ${languages.join(", ")}`);
168
+ consola.info(`${isZh ? "\u8BED\u8A00" : "Languages"}: ${languages.join(", ")}`);
168
169
  }
169
170
  consola.log("");
170
- consola.info(isZh2 ? "\u{1F4CB} \u83B7\u53D6\u63A8\u8350\u4E2D..." : "\u{1F4CB} Getting recommendations...");
171
+ consola.info(isZh ? "\u{1F4CB} \u83B7\u53D6\u63A8\u8350\u4E2D..." : "\u{1F4CB} Getting recommendations...");
171
172
  let recommendations = [];
172
173
  try {
173
- const templatesClient = getTemplatesClient({ language: isZh2 ? "zh-CN" : "en" });
174
+ const templatesClient = getTemplatesClient({ language: isZh ? "zh-CN" : "en" });
174
175
  const cloudAgents = await templatesClient.getSpecialistAgents();
175
176
  const relevantAgents = cloudAgents.filter((agent) => {
176
177
  const tags = agent.tags || [];
@@ -180,20 +181,20 @@ async function ccjkAgents(options = {}) {
180
181
  });
181
182
  recommendations = (relevantAgents.length > 0 ? relevantAgents : cloudAgents.slice(0, 10)).map((agent) => ({
182
183
  id: agent.id,
183
- name: agent.name_zh_cn && isZh2 ? agent.name_zh_cn : agent.name_en,
184
- description: agent.description_zh_cn && isZh2 ? agent.description_zh_cn : agent.description_en || "",
184
+ name: agent.name_zh_cn && isZh ? agent.name_zh_cn : agent.name_en,
185
+ description: agent.description_zh_cn && isZh ? agent.description_zh_cn : agent.description_en || "",
185
186
  skills: agent.tags || [],
186
187
  mcpServers: [],
187
188
  persona: agent.name_en,
188
189
  capabilities: [],
189
190
  confidence: agent.rating_average / 5 || 0.8,
190
- reason: `${isZh2 ? "\u63A8\u8350\u7406\u7531" : "Recommended"}: ${agent.category}`
191
+ reason: `${isZh ? "\u63A8\u8350\u7406\u7531" : "Recommended"}: ${agent.category}`
191
192
  }));
192
193
  if (recommendations.length > 0) {
193
- consola.success(isZh2 ? `\u4ECE\u4E91\u7AEF\u83B7\u53D6 ${recommendations.length} \u4E2A\u4E13\u4E1A\u4EE3\u7406` : `Fetched ${recommendations.length} specialist agents from cloud`);
194
+ consola.success(isZh ? `\u4ECE\u4E91\u7AEF\u83B7\u53D6 ${recommendations.length} \u4E2A\u4E13\u4E1A\u4EE3\u7406` : `Fetched ${recommendations.length} specialist agents from cloud`);
194
195
  }
195
196
  } catch (error) {
196
- consola.warn(isZh2 ? "\u4E91\u7AEF\u83B7\u53D6\u5931\u8D25\uFF0C\u4F7F\u7528\u672C\u5730\u6A21\u677F" : "Cloud fetch failed, using local templates");
197
+ consola.warn(isZh ? "\u4E91\u7AEF\u83B7\u53D6\u5931\u8D25\uFF0C\u4F7F\u7528\u672C\u5730\u6A21\u677F" : "Cloud fetch failed, using local templates");
197
198
  }
198
199
  if (!recommendations || recommendations.length === 0) {
199
200
  const templates = await loadAgentTemplates();
@@ -206,19 +207,19 @@ async function ccjkAgents(options = {}) {
206
207
  );
207
208
  }
208
209
  if (recommendations.length === 0) {
209
- consola.warn(isZh2 ? "\u672A\u627E\u5230\u5408\u9002\u7684\u4EE3\u7406\uFF0C\u4F7F\u7528\u6240\u6709\u6A21\u677F" : "No suitable agents found, using all templates");
210
+ consola.warn(isZh ? "\u672A\u627E\u5230\u5408\u9002\u7684\u4EE3\u7406\uFF0C\u4F7F\u7528\u6240\u6709\u6A21\u677F" : "No suitable agents found, using all templates");
210
211
  recommendations = await loadAgentTemplates();
211
212
  }
212
213
  consola.log("");
213
- consola.info(`${isZh2 ? "\u627E\u5230" : "Found"} ${recommendations.length} ${isZh2 ? "\u4E2A\u63A8\u8350\u4EE3\u7406" : "recommended agent(s)"}:`);
214
+ consola.info(`${isZh ? "\u627E\u5230" : "Found"} ${recommendations.length} ${isZh ? "\u4E2A\u63A8\u8350\u4EE3\u7406" : "recommended agent(s)"}:`);
214
215
  consola.log("");
215
216
  recommendations.forEach((agent, index) => {
216
- const displayName = extractDisplayName(agent.name, isZh2);
217
- const displayDesc = extractDisplayName(agent.description, isZh2, "No description available");
217
+ const displayName = extractDisplayName(agent.name, isZh);
218
+ const displayDesc = extractDisplayName(agent.description, isZh, "No description available");
218
219
  consola.log(` ${index + 1}. ${displayName}`);
219
220
  consola.log(` ${displayDesc}`);
220
221
  if (agent.skills && agent.skills.length > 0) {
221
- consola.log(` ${isZh2 ? "\u6280\u80FD" : "Skills"}: ${agent.skills.join(", ")}`);
222
+ consola.log(` ${isZh ? "\u6280\u80FD" : "Skills"}: ${agent.skills.join(", ")}`);
222
223
  }
223
224
  if (agent.mcpServers && agent.mcpServers.length > 0) {
224
225
  consola.log(` MCP: ${agent.mcpServers.join(", ")}`);
@@ -239,14 +240,14 @@ async function ccjkAgents(options = {}) {
239
240
  case "auto":
240
241
  if (!options.dryRun) {
241
242
  consola.log("");
242
- consola.info(isZh2 ? "\u{1F916} \u521B\u5EFA\u4EE3\u7406\u4E2D..." : "\u{1F916} Creating agents...");
243
+ consola.info(isZh ? "\u{1F916} \u521B\u5EFA\u4EE3\u7406\u4E2D..." : "\u{1F916} Creating agents...");
243
244
  }
244
245
  for (const recommendation of recommendations) {
245
246
  const agentName = await createAgent(recommendation, options);
246
247
  if (agentName) {
247
248
  createdAgents.push(agentName);
248
249
  if (!options.dryRun) {
249
- consola.success(`${isZh2 ? "\u5DF2\u521B\u5EFA" : "Created"}: ${agentName}`);
250
+ consola.success(`${isZh ? "\u5DF2\u521B\u5EFA" : "Created"}: ${agentName}`);
250
251
  }
251
252
  }
252
253
  }
@@ -274,53 +275,54 @@ async function ccjkAgents(options = {}) {
274
275
  if (!options.dryRun) {
275
276
  consola.log("");
276
277
  if (createdAgents.length > 0) {
277
- consola.success(`${isZh2 ? "\u2705 \u6210\u529F\u521B\u5EFA" : "\u2705 Successfully created"} ${createdAgents.length} ${isZh2 ? "\u4E2A\u4EE3\u7406" : "agent(s)"}`);
278
+ consola.success(`${isZh ? "\u2705 \u6210\u529F\u521B\u5EFA" : "\u2705 Successfully created"} ${createdAgents.length} ${isZh ? "\u4E2A\u4EE3\u7406" : "agent(s)"}`);
278
279
  consola.log("");
279
- consola.info(isZh2 ? "\u7528\u6CD5:" : "Usage:");
280
+ consola.info(isZh ? "\u7528\u6CD5:" : "Usage:");
280
281
  createdAgents.forEach((agent) => {
281
282
  consola.log(` /agent ${agent}`);
282
283
  });
283
- consola.log(` ${isZh2 ? "\u67E5\u770B\u6240\u6709\u4EE3\u7406" : "List all agents"}: /agent list`);
284
+ consola.log(` ${isZh ? "\u67E5\u770B\u6240\u6709\u4EE3\u7406" : "List all agents"}: /agent list`);
284
285
  } else {
285
- consola.warn(isZh2 ? "\u672A\u521B\u5EFA\u4EFB\u4F55\u4EE3\u7406" : "No agents created");
286
+ consola.warn(isZh ? "\u672A\u521B\u5EFA\u4EFB\u4F55\u4EE3\u7406" : "No agents created");
286
287
  }
287
288
  } else {
288
289
  consola.log("");
289
- consola.info(isZh2 ? "\u{1F50D} Dry run \u5B8C\u6210" : "\u{1F50D} Dry run complete");
290
+ consola.info(isZh ? "\u{1F50D} Dry run \u5B8C\u6210" : "\u{1F50D} Dry run complete");
290
291
  }
291
292
  } catch (error) {
293
+ const isZh = i18n.language === "zh-CN";
292
294
  consola.error(isZh ? "\u4EE3\u7406\u521B\u5EFA\u5931\u8D25" : "Agent creation failed", error);
293
295
  process__default.exit(1);
294
296
  }
295
297
  }
296
298
  async function listAgents() {
297
- const isZh2 = i18n.language === "zh-CN";
299
+ const isZh = i18n.language === "zh-CN";
298
300
  const templates = await loadAgentTemplates();
299
301
  consola.log("");
300
- consola.info(`${isZh2 ? "\u53EF\u7528\u7684\u4EE3\u7406\u6A21\u677F" : "Available Agent Templates"} (${templates.length}):`);
302
+ consola.info(`${isZh ? "\u53EF\u7528\u7684\u4EE3\u7406\u6A21\u677F" : "Available Agent Templates"} (${templates.length}):`);
301
303
  consola.log("");
302
304
  templates.forEach((agent, index) => {
303
305
  consola.log(` ${index + 1}. ${agent.name}`);
304
306
  consola.log(` ${agent.description}`);
305
307
  if (agent.skills && agent.skills.length > 0) {
306
- consola.log(` ${isZh2 ? "\u6280\u80FD" : "Skills"}: ${agent.skills.join(", ")}`);
308
+ consola.log(` ${isZh ? "\u6280\u80FD" : "Skills"}: ${agent.skills.join(", ")}`);
307
309
  }
308
310
  consola.log("");
309
311
  });
310
312
  }
311
313
  async function createAgent(recommendation, options) {
312
314
  try {
313
- const isZh2 = i18n.language === "zh-CN";
314
- const agentName = extractString(recommendation.name, recommendation.id || "unknown-agent");
315
+ const isZh = i18n.language === "zh-CN";
316
+ const agentName = extractString(recommendation.name, "unknown-agent");
315
317
  const agentDescription = extractString(recommendation.description, "No description available");
316
318
  const agentDef = {
317
319
  id: agentName.toLowerCase().replace(/\s+/g, "-"),
318
320
  name: {
319
- en: agentName,
321
+ "en": agentName,
320
322
  "zh-CN": agentName
321
323
  },
322
324
  description: {
323
- en: agentDescription,
325
+ "en": agentDescription,
324
326
  "zh-CN": agentDescription
325
327
  },
326
328
  persona: recommendation.persona || agentName,
@@ -336,26 +338,26 @@ async function createAgent(recommendation, options) {
336
338
  };
337
339
  const validation = validateAgentDefinition(agentDef);
338
340
  if (!validation.valid) {
339
- consola.error(`${isZh2 ? "\u9A8C\u8BC1\u5931\u8D25" : "Validation failed"}: ${agentName}`, validation.errors);
341
+ consola.error(`${isZh ? "\u9A8C\u8BC1\u5931\u8D25" : "Validation failed"}: ${agentName}`, validation.errors);
340
342
  return null;
341
343
  }
342
344
  if (options.dryRun) {
343
- consola.info(`[DRY RUN] ${isZh2 ? "\u5C06\u521B\u5EFA\u4EE3\u7406" : "Would create agent"}: ${agentName}`);
345
+ consola.info(`[DRY RUN] ${isZh ? "\u5C06\u521B\u5EFA\u4EE3\u7406" : "Would create agent"}: ${agentName}`);
344
346
  return agentName;
345
347
  }
346
348
  await writeAgentFile(agentDef);
347
349
  await registerAgent(agentDef);
348
350
  return agentName;
349
351
  } catch (error) {
350
- const isZh2 = i18n.language === "zh-CN";
352
+ const isZh = i18n.language === "zh-CN";
351
353
  const errorName = extractString(recommendation.name, "unknown");
352
- consola.error(`${isZh2 ? "\u521B\u5EFA\u5931\u8D25" : "Failed to create"}: ${errorName}`, error);
354
+ consola.error(`${isZh ? "\u521B\u5EFA\u5931\u8D25" : "Failed to create"}: ${errorName}`, error);
353
355
  return null;
354
356
  }
355
357
  }
356
358
  async function createCustomAgent(options) {
357
359
  try {
358
- const isZh2 = i18n.language === "zh-CN";
360
+ const isZh = i18n.language === "zh-CN";
359
361
  let agentName = options.create || options.template;
360
362
  if (!agentName) {
361
363
  agentName = "my-custom-agent";
@@ -366,11 +368,11 @@ async function createCustomAgent(options) {
366
368
  const agentDef = {
367
369
  id: agentName.toLowerCase().replace(/\s+/g, "-"),
368
370
  name: {
369
- en: agentName,
371
+ "en": agentName,
370
372
  "zh-CN": agentName
371
373
  },
372
374
  description: {
373
- en: description,
375
+ "en": description,
374
376
  "zh-CN": description
375
377
  },
376
378
  persona: options.persona || agentName,
@@ -386,19 +388,19 @@ async function createCustomAgent(options) {
386
388
  };
387
389
  const validation = validateAgentDefinition(agentDef);
388
390
  if (!validation.valid) {
389
- consola.error(isZh2 ? "\u9A8C\u8BC1\u9519\u8BEF" : "Validation errors", validation.errors);
391
+ consola.error(isZh ? "\u9A8C\u8BC1\u9519\u8BEF" : "Validation errors", validation.errors);
390
392
  return null;
391
393
  }
392
394
  if (options.dryRun) {
393
- consola.info(`[DRY RUN] ${isZh2 ? "\u5C06\u521B\u5EFA\u81EA\u5B9A\u4E49\u4EE3\u7406" : "Would create custom agent"}: ${agentName}`);
395
+ consola.info(`[DRY RUN] ${isZh ? "\u5C06\u521B\u5EFA\u81EA\u5B9A\u4E49\u4EE3\u7406" : "Would create custom agent"}: ${agentName}`);
394
396
  return agentName;
395
397
  }
396
398
  await writeAgentFile(agentDef);
397
399
  await registerAgent(agentDef);
398
400
  return agentName;
399
401
  } catch (error) {
400
- const isZh2 = i18n.language === "zh-CN";
401
- consola.error(isZh2 ? "\u81EA\u5B9A\u4E49\u4EE3\u7406\u521B\u5EFA\u5931\u8D25" : "Custom agent creation failed", error);
402
+ const isZh = i18n.language === "zh-CN";
403
+ consola.error(isZh ? "\u81EA\u5B9A\u4E49\u4EE3\u7406\u521B\u5EFA\u5931\u8D25" : "Custom agent creation failed", error);
402
404
  return null;
403
405
  }
404
406
  }