ccjk 15.28.3 → 15.30.0

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 (440) hide show
  1. package/README.md +5 -4
  2. package/dist/chunks/agent-teams.mjs +145 -0
  3. package/dist/chunks/agent.mjs +1439 -0
  4. package/dist/chunks/agents.mjs +3783 -0
  5. package/dist/chunks/api-cli.mjs +135 -0
  6. package/dist/chunks/api-config-selector.mjs +159 -0
  7. package/dist/chunks/api-providers.mjs +144 -0
  8. package/dist/chunks/api.mjs +115 -0
  9. package/dist/chunks/auto-bootstrap.mjs +358 -0
  10. package/dist/chunks/auto-fixer.mjs +95 -0
  11. package/dist/chunks/auto-updater.mjs +507 -0
  12. package/dist/chunks/banner.mjs +173 -0
  13. package/dist/chunks/bash.mjs +187 -0
  14. package/dist/chunks/boost.mjs +474 -0
  15. package/dist/chunks/brain-config.mjs +75 -0
  16. package/dist/chunks/brain-status.mjs +89 -0
  17. package/dist/chunks/ccjk-agents.mjs +416 -0
  18. package/dist/chunks/ccjk-all.mjs +1046 -0
  19. package/dist/chunks/ccjk-config.mjs +445 -0
  20. package/dist/chunks/ccjk-hooks.mjs +1074 -0
  21. package/dist/chunks/ccjk-mcp.mjs +763 -0
  22. package/dist/chunks/ccjk-setup.mjs +765 -0
  23. package/dist/chunks/ccjk-skills.mjs +518 -0
  24. package/dist/chunks/ccr.mjs +109 -0
  25. package/dist/chunks/ccu.mjs +40 -0
  26. package/dist/chunks/check-updates.mjs +117 -0
  27. package/dist/chunks/claude-code-incremental-manager.mjs +761 -0
  28. package/dist/chunks/claude-config.mjs +606 -0
  29. package/dist/chunks/claude-config2.mjs +62 -0
  30. package/dist/chunks/claude-wrapper.mjs +85 -0
  31. package/dist/chunks/clavue-config.mjs +1454 -0
  32. package/dist/chunks/cleanup-migration.mjs +20 -0
  33. package/dist/chunks/cli-hook.mjs +4096 -0
  34. package/dist/chunks/cloud-sync.mjs +29 -0
  35. package/dist/chunks/code-type-resolver.mjs +880 -0
  36. package/dist/chunks/codex-config-switch.mjs +452 -0
  37. package/dist/chunks/codex-provider-manager.mjs +238 -0
  38. package/dist/chunks/codex-uninstaller.mjs +404 -0
  39. package/dist/chunks/codex.mjs +2141 -0
  40. package/dist/chunks/commands.mjs +108 -0
  41. package/dist/chunks/commands2.mjs +421 -0
  42. package/dist/chunks/commit.mjs +140 -0
  43. package/dist/chunks/completion.mjs +517 -0
  44. package/dist/chunks/config-consolidator.mjs +172 -0
  45. package/dist/chunks/config-switch.mjs +334 -0
  46. package/dist/chunks/config.mjs +558 -0
  47. package/dist/chunks/config2.mjs +484 -0
  48. package/dist/chunks/config3.mjs +486 -0
  49. package/dist/chunks/constants.mjs +323 -0
  50. package/dist/chunks/context-opt.mjs +444 -0
  51. package/dist/chunks/context.mjs +974 -0
  52. package/dist/chunks/dashboard.mjs +481 -0
  53. package/dist/chunks/doctor.mjs +1301 -0
  54. package/dist/chunks/eval.mjs +502 -0
  55. package/dist/chunks/evolution.mjs +322 -0
  56. package/dist/chunks/features.mjs +715 -0
  57. package/dist/chunks/fish.mjs +181 -0
  58. package/dist/chunks/fs-operations.mjs +180 -0
  59. package/dist/chunks/health-alerts.mjs +830 -0
  60. package/dist/chunks/help.mjs +341 -0
  61. package/dist/chunks/hook-installer.mjs +48 -0
  62. package/dist/chunks/impact.mjs +651 -0
  63. package/dist/chunks/index.mjs +23 -0
  64. package/dist/chunks/index10.mjs +19 -0
  65. package/dist/chunks/index11.mjs +1171 -0
  66. package/dist/chunks/index12.mjs +218 -0
  67. package/dist/chunks/index13.mjs +679 -0
  68. package/dist/chunks/index14.mjs +1009 -0
  69. package/dist/chunks/index15.mjs +194 -0
  70. package/dist/chunks/index2.mjs +7637 -0
  71. package/dist/chunks/index3.mjs +171 -0
  72. package/dist/chunks/index4.mjs +26 -0
  73. package/dist/chunks/index5.mjs +19 -0
  74. package/dist/chunks/index6.mjs +19092 -0
  75. package/dist/chunks/index7.mjs +616 -0
  76. package/dist/chunks/index8.mjs +1602 -0
  77. package/dist/chunks/index9.mjs +5384 -0
  78. package/dist/chunks/init.mjs +1911 -0
  79. package/dist/chunks/installer.mjs +757 -0
  80. package/dist/chunks/installer2.mjs +103 -0
  81. package/dist/chunks/interview.mjs +2927 -0
  82. package/dist/chunks/json-config.mjs +60 -0
  83. package/dist/chunks/linux.mjs +3863 -0
  84. package/dist/chunks/macos.mjs +69 -0
  85. package/dist/chunks/main.mjs +635 -0
  86. package/dist/chunks/manager.mjs +1048 -0
  87. package/dist/chunks/marketplace.mjs +265 -0
  88. package/dist/chunks/mcp-cli.mjs +205 -0
  89. package/dist/chunks/mcp-performance.mjs +187 -0
  90. package/dist/chunks/mcp.mjs +667 -0
  91. package/dist/chunks/memory-check.mjs +2973 -0
  92. package/dist/chunks/memory-paths.mjs +259 -0
  93. package/dist/chunks/memory-sync.mjs +209 -0
  94. package/dist/chunks/memory.mjs +354 -0
  95. package/dist/chunks/metrics-display.mjs +153 -0
  96. package/dist/chunks/monitor.mjs +1856 -0
  97. package/dist/chunks/notification.mjs +1864 -0
  98. package/dist/chunks/onboarding.mjs +386 -0
  99. package/dist/chunks/package.mjs +3 -0
  100. package/dist/chunks/paradigm.mjs +74 -0
  101. package/dist/chunks/permission-manager.mjs +250 -0
  102. package/dist/chunks/permissions.mjs +265 -0
  103. package/dist/chunks/persistence-manager.mjs +801 -0
  104. package/dist/chunks/persistence.mjs +707 -0
  105. package/dist/chunks/platform.mjs +395 -0
  106. package/dist/chunks/plugin.mjs +1936 -0
  107. package/dist/chunks/powershell.mjs +213 -0
  108. package/dist/chunks/prompts.mjs +244 -0
  109. package/dist/chunks/providers.mjs +263 -0
  110. package/dist/chunks/quick-actions.mjs +335 -0
  111. package/dist/chunks/quick-provider.mjs +755 -0
  112. package/dist/chunks/quick-setup.mjs +421 -0
  113. package/dist/chunks/remote.mjs +497 -0
  114. package/dist/chunks/research.mjs +1904 -0
  115. package/dist/chunks/rollback.mjs +38 -0
  116. package/dist/chunks/session-manager.mjs +1371 -0
  117. package/dist/chunks/session.mjs +878 -0
  118. package/dist/chunks/sessions.mjs +106 -0
  119. package/dist/chunks/silent-updater.mjs +396 -0
  120. package/dist/chunks/simple-config.mjs +122 -0
  121. package/dist/chunks/skill.mjs +117 -0
  122. package/dist/chunks/skill2.mjs +9052 -0
  123. package/dist/chunks/skills-sync.mjs +1343 -0
  124. package/dist/chunks/skills.mjs +577 -0
  125. package/dist/chunks/slash-commands.mjs +208 -0
  126. package/dist/chunks/smart-guide.mjs +247 -0
  127. package/dist/chunks/snapshot.mjs +58 -0
  128. package/dist/chunks/startup.mjs +487 -0
  129. package/dist/chunks/stats.mjs +191 -0
  130. package/dist/chunks/status.mjs +471 -0
  131. package/dist/chunks/team.mjs +63 -0
  132. package/dist/chunks/thinking.mjs +626 -0
  133. package/dist/chunks/trace.mjs +57 -0
  134. package/dist/chunks/uninstall.mjs +852 -0
  135. package/dist/chunks/update.mjs +174 -0
  136. package/dist/chunks/upgrade-manager.mjs +204 -0
  137. package/dist/chunks/upgrade.mjs +133 -0
  138. package/dist/chunks/version-checker.mjs +891 -0
  139. package/dist/chunks/vim.mjs +903 -0
  140. package/dist/chunks/windows.mjs +14 -0
  141. package/dist/chunks/workflows.mjs +633 -0
  142. package/dist/chunks/wsl.mjs +129 -0
  143. package/dist/chunks/zero-config.mjs +871 -0
  144. package/dist/chunks/zsh.mjs +182 -0
  145. package/dist/cli.d.mts +1 -0
  146. package/dist/cli.d.ts +1 -0
  147. package/dist/cli.js +11 -2
  148. package/dist/cli.js.map +1 -1
  149. package/dist/cli.mjs +2684 -0
  150. package/dist/commands/edit.js +4 -4
  151. package/dist/commands/edit.js.map +1 -1
  152. package/dist/commands/grok.js +35 -0
  153. package/dist/commands/grok.js.map +1 -0
  154. package/dist/commands/init.js +189 -113
  155. package/dist/commands/init.js.map +1 -1
  156. package/dist/commands/menu.js +12 -12
  157. package/dist/commands/menu.js.map +1 -1
  158. package/dist/commands/migrate.js +6 -8
  159. package/dist/commands/migrate.js.map +1 -1
  160. package/dist/commands/profile.js +15 -35
  161. package/dist/commands/profile.js.map +1 -1
  162. package/dist/commands/quick.js +28 -25
  163. package/dist/commands/quick.js.map +1 -1
  164. package/dist/commands/status.js +7 -17
  165. package/dist/commands/status.js.map +1 -1
  166. package/dist/core/codex-config.js +11 -29
  167. package/dist/core/codex-config.js.map +1 -1
  168. package/dist/core/grok-config.js +110 -0
  169. package/dist/core/grok-config.js.map +1 -0
  170. package/dist/core/perms.js +96 -86
  171. package/dist/core/perms.js.map +1 -1
  172. package/dist/core/profiles.js +13 -57
  173. package/dist/core/profiles.js.map +1 -1
  174. package/dist/core/providers.js +58 -49
  175. package/dist/core/providers.js.map +1 -1
  176. package/dist/core/quick-parse.js +1 -7
  177. package/dist/core/quick-parse.js.map +1 -1
  178. package/dist/core/tools.js +24 -0
  179. package/dist/core/tools.js.map +1 -1
  180. package/dist/i18n/locales/en/agent-teams.json +18 -0
  181. package/dist/i18n/locales/en/agentBrowser.json +80 -0
  182. package/dist/i18n/locales/en/agents.json +135 -0
  183. package/dist/i18n/locales/en/api.json +63 -0
  184. package/dist/i18n/locales/en/ccjk-agents.json +33 -0
  185. package/dist/i18n/locales/en/ccjk-all.json +23 -0
  186. package/dist/i18n/locales/en/ccjk-skills.json +22 -0
  187. package/dist/i18n/locales/en/ccjk.json +276 -0
  188. package/dist/i18n/locales/en/ccr.json +65 -0
  189. package/dist/i18n/locales/en/claude-md.json +73 -0
  190. package/dist/i18n/locales/en/cli.json +148 -0
  191. package/dist/i18n/locales/en/cloud-setup.json +31 -0
  192. package/dist/i18n/locales/en/cloud-sync.json +147 -0
  193. package/dist/i18n/locales/en/cloud.json +40 -0
  194. package/dist/i18n/locales/en/cloudPlugins.json +118 -0
  195. package/dist/i18n/locales/en/codex.json +184 -0
  196. package/dist/i18n/locales/en/cometix.json +29 -0
  197. package/dist/i18n/locales/en/common.json +68 -0
  198. package/dist/i18n/locales/en/config.json +108 -0
  199. package/dist/i18n/locales/en/configuration.json +236 -0
  200. package/dist/i18n/locales/en/context.json +85 -0
  201. package/dist/i18n/locales/en/dashboard.json +78 -0
  202. package/dist/i18n/locales/en/errors.json +26 -0
  203. package/dist/i18n/locales/en/evolution.json +54 -0
  204. package/dist/i18n/locales/en/hooks.json +74 -0
  205. package/dist/i18n/locales/en/hooksSync.json +133 -0
  206. package/dist/i18n/locales/en/installation.json +83 -0
  207. package/dist/i18n/locales/en/interview.json +104 -0
  208. package/dist/i18n/locales/en/language.json +19 -0
  209. package/dist/i18n/locales/en/lsp.json +78 -0
  210. package/dist/i18n/locales/en/marketplace.json +116 -0
  211. package/dist/i18n/locales/en/mcp.json +180 -0
  212. package/dist/i18n/locales/en/memory.json +23 -0
  213. package/dist/i18n/locales/en/menu.json +299 -0
  214. package/dist/i18n/locales/en/multi-config.json +79 -0
  215. package/dist/i18n/locales/en/notification.json +307 -0
  216. package/dist/i18n/locales/en/permissions.json +95 -0
  217. package/dist/i18n/locales/en/persistence.json +127 -0
  218. package/dist/i18n/locales/en/plugins.json +146 -0
  219. package/dist/i18n/locales/en/quick-actions.json +78 -0
  220. package/dist/i18n/locales/en/registry.json +54 -0
  221. package/dist/i18n/locales/en/remote.json +93 -0
  222. package/dist/i18n/locales/en/sandbox.json +44 -0
  223. package/dist/i18n/locales/en/setup.json +44 -0
  224. package/dist/i18n/locales/en/shencha.json +14 -0
  225. package/dist/i18n/locales/en/skills.json +100 -0
  226. package/dist/i18n/locales/en/skillsSync.json +74 -0
  227. package/dist/i18n/locales/en/smartGuide.json +49 -0
  228. package/dist/i18n/locales/en/stats.json +20 -0
  229. package/dist/i18n/locales/en/subagent.json +69 -0
  230. package/dist/i18n/locales/en/superpowers.json +117 -0
  231. package/dist/i18n/locales/en/team.json +7 -0
  232. package/dist/i18n/locales/en/thinking.json +65 -0
  233. package/dist/i18n/locales/en/tools.json +42 -0
  234. package/dist/i18n/locales/en/uninstall.json +56 -0
  235. package/dist/i18n/locales/en/updater.json +29 -0
  236. package/dist/i18n/locales/en/vim.json +169 -0
  237. package/dist/i18n/locales/en/workflow.json +55 -0
  238. package/dist/i18n/locales/en/workspace.json +108 -0
  239. package/dist/i18n/locales/zh-CN/agent-teams.json +18 -0
  240. package/dist/i18n/locales/zh-CN/agentBrowser.json +80 -0
  241. package/dist/i18n/locales/zh-CN/agents.json +135 -0
  242. package/dist/i18n/locales/zh-CN/api.json +63 -0
  243. package/dist/i18n/locales/zh-CN/ccjk-agents.json +33 -0
  244. package/dist/i18n/locales/zh-CN/ccjk-all.json +23 -0
  245. package/dist/i18n/locales/zh-CN/ccjk-skills.json +22 -0
  246. package/dist/i18n/locales/zh-CN/ccjk.json +276 -0
  247. package/dist/i18n/locales/zh-CN/ccr.json +65 -0
  248. package/dist/i18n/locales/zh-CN/claude-md.json +73 -0
  249. package/dist/i18n/locales/zh-CN/cli.json +148 -0
  250. package/dist/i18n/locales/zh-CN/cloud-setup.json +31 -0
  251. package/dist/i18n/locales/zh-CN/cloud-sync.json +147 -0
  252. package/dist/i18n/locales/zh-CN/cloud.json +40 -0
  253. package/dist/i18n/locales/zh-CN/cloudPlugins.json +118 -0
  254. package/dist/i18n/locales/zh-CN/codex.json +184 -0
  255. package/dist/i18n/locales/zh-CN/cometix.json +29 -0
  256. package/dist/i18n/locales/zh-CN/common.json +68 -0
  257. package/dist/i18n/locales/zh-CN/config.json +108 -0
  258. package/dist/i18n/locales/zh-CN/configuration.json +234 -0
  259. package/dist/i18n/locales/zh-CN/context.json +85 -0
  260. package/dist/i18n/locales/zh-CN/dashboard.json +78 -0
  261. package/dist/i18n/locales/zh-CN/errors.json +26 -0
  262. package/dist/i18n/locales/zh-CN/evolution.json +54 -0
  263. package/dist/i18n/locales/zh-CN/hooks.json +74 -0
  264. package/dist/i18n/locales/zh-CN/hooksSync.json +133 -0
  265. package/dist/i18n/locales/zh-CN/installation.json +83 -0
  266. package/dist/i18n/locales/zh-CN/interview.json +104 -0
  267. package/dist/i18n/locales/zh-CN/language.json +19 -0
  268. package/dist/i18n/locales/zh-CN/lsp.json +78 -0
  269. package/dist/i18n/locales/zh-CN/marketplace.json +116 -0
  270. package/dist/i18n/locales/zh-CN/mcp.json +180 -0
  271. package/dist/i18n/locales/zh-CN/memory.json +23 -0
  272. package/dist/i18n/locales/zh-CN/menu.json +299 -0
  273. package/dist/i18n/locales/zh-CN/multi-config.json +79 -0
  274. package/dist/i18n/locales/zh-CN/notification.json +307 -0
  275. package/dist/i18n/locales/zh-CN/permissions.json +95 -0
  276. package/dist/i18n/locales/zh-CN/persistence.json +127 -0
  277. package/dist/i18n/locales/zh-CN/plugins.json +146 -0
  278. package/dist/i18n/locales/zh-CN/quick-actions.json +78 -0
  279. package/dist/i18n/locales/zh-CN/registry.json +54 -0
  280. package/dist/i18n/locales/zh-CN/remote.json +93 -0
  281. package/dist/i18n/locales/zh-CN/sandbox.json +44 -0
  282. package/dist/i18n/locales/zh-CN/setup.json +44 -0
  283. package/dist/i18n/locales/zh-CN/shencha.json +14 -0
  284. package/dist/i18n/locales/zh-CN/skills.json +100 -0
  285. package/dist/i18n/locales/zh-CN/skillsSync.json +74 -0
  286. package/dist/i18n/locales/zh-CN/smartGuide.json +49 -0
  287. package/dist/i18n/locales/zh-CN/stats.json +20 -0
  288. package/dist/i18n/locales/zh-CN/subagent.json +69 -0
  289. package/dist/i18n/locales/zh-CN/superpowers.json +117 -0
  290. package/dist/i18n/locales/zh-CN/team.json +7 -0
  291. package/dist/i18n/locales/zh-CN/thinking.json +65 -0
  292. package/dist/i18n/locales/zh-CN/tools.json +42 -0
  293. package/dist/i18n/locales/zh-CN/uninstall.json +56 -0
  294. package/dist/i18n/locales/zh-CN/updater.json +29 -0
  295. package/dist/i18n/locales/zh-CN/vim.json +169 -0
  296. package/dist/i18n/locales/zh-CN/workflow.json +55 -0
  297. package/dist/i18n/locales/zh-CN/workspace.json +108 -0
  298. package/dist/index.d.mts +5658 -0
  299. package/dist/index.d.ts +5658 -0
  300. package/dist/index.mjs +3732 -0
  301. package/dist/shared/ccjk.5bEolFrk.mjs +254 -0
  302. package/dist/shared/ccjk.8oaxX4iR.mjs +90 -0
  303. package/dist/shared/ccjk.B2U7DsPy.mjs +31 -0
  304. package/dist/shared/ccjk.B2f-cwUP.mjs +468 -0
  305. package/dist/shared/ccjk.BAGoDD49.mjs +36 -0
  306. package/dist/shared/ccjk.BBtCGd_g.mjs +899 -0
  307. package/dist/shared/ccjk.BFQ7yr5S.mjs +16 -0
  308. package/dist/shared/ccjk.BLsIiTqO.mjs +449 -0
  309. package/dist/shared/ccjk.BXv8aYs1.mjs +170 -0
  310. package/dist/shared/ccjk.BnsY5WxD.mjs +171 -0
  311. package/dist/shared/ccjk.BoApaI4j.mjs +28 -0
  312. package/dist/shared/ccjk.Bq8TqZG_.mjs +189 -0
  313. package/dist/shared/ccjk.BtrioX1Z.mjs +25 -0
  314. package/dist/shared/ccjk.Bx_rmYfN.mjs +69 -0
  315. package/dist/shared/ccjk.BzPbSEP2.mjs +115 -0
  316. package/dist/shared/ccjk.C0WLUnFV.mjs +293 -0
  317. package/dist/shared/ccjk.C1hANZTu.mjs +19 -0
  318. package/dist/shared/ccjk.C2jHOZVP.mjs +52 -0
  319. package/dist/shared/ccjk.CNhnT6uQ.mjs +636 -0
  320. package/dist/shared/ccjk.COweQ1RR.mjs +5 -0
  321. package/dist/shared/ccjk.CfKKcvWy.mjs +126 -0
  322. package/dist/shared/ccjk.Cjgrln_h.mjs +297 -0
  323. package/dist/shared/ccjk.CoCHVXl3.mjs +3951 -0
  324. package/dist/shared/ccjk.CwGZSTAK.mjs +319 -0
  325. package/dist/shared/ccjk.CxpGa6MC.mjs +2724 -0
  326. package/dist/shared/ccjk.D-magaEx.mjs +763 -0
  327. package/dist/shared/ccjk.D0g2ABGg.mjs +171 -0
  328. package/dist/shared/ccjk.D6ycHbak.mjs +270 -0
  329. package/dist/shared/ccjk.D75wivnp.mjs +142 -0
  330. package/dist/shared/ccjk.DDL-4C-k.mjs +100 -0
  331. package/dist/shared/ccjk.DFRPtmK_.mjs +75 -0
  332. package/dist/shared/ccjk.DMV3x5Sd.mjs +299 -0
  333. package/dist/shared/ccjk.DZ2LLOa-.mjs +2195 -0
  334. package/dist/shared/ccjk.DbigonEQ.mjs +698 -0
  335. package/dist/shared/ccjk.DcMvE7lf.mjs +618 -0
  336. package/dist/shared/ccjk.DeWpAShp.mjs +1828 -0
  337. package/dist/shared/ccjk.DhJ1kyDR.mjs +30 -0
  338. package/dist/shared/ccjk.DlTXS9rP.mjs +224 -0
  339. package/dist/shared/ccjk.DopKzo3z.mjs +305 -0
  340. package/dist/shared/ccjk.DsZsc4LR.mjs +1280 -0
  341. package/dist/shared/ccjk.DuzJZlgj.mjs +418 -0
  342. package/dist/shared/ccjk.Dxgd2vjc.mjs +444 -0
  343. package/dist/shared/ccjk.J8YiPsOw.mjs +259 -0
  344. package/dist/shared/ccjk.KfSWcGlE.mjs +38 -0
  345. package/dist/shared/ccjk.L7yC58_i.mjs +225 -0
  346. package/dist/shared/ccjk.MwtjAULc.mjs +1447 -0
  347. package/dist/shared/ccjk.OJKHVSOb.mjs +2005 -0
  348. package/dist/shared/ccjk.OTnevPNE.mjs +225 -0
  349. package/dist/shared/ccjk.RyizuzOI.mjs +21 -0
  350. package/dist/shared/ccjk.T_cX87dY.mjs +15 -0
  351. package/dist/shared/ccjk.bQ7Dh1g4.mjs +249 -0
  352. package/dist/shared/ccjk.gDEDGD_t.mjs +38 -0
  353. package/dist/shared/ccjk.hoqrwWdN.mjs +333 -0
  354. package/dist/shared/ccjk.i_vn-9C3.mjs +317 -0
  355. package/dist/shared/ccjk.lG3ccFjm.mjs +885 -0
  356. package/dist/shared/ccjk.wLJHO0Af.mjs +244 -0
  357. package/dist/shared/ccjk.y-a_1vK4.mjs +5127 -0
  358. package/dist/templates/agents/README.md +78 -0
  359. package/dist/templates/agents/fullstack-developer.json +70 -0
  360. package/dist/templates/agents/go-expert.json +69 -0
  361. package/dist/templates/agents/index.json +64 -0
  362. package/dist/templates/agents/python-expert.json +69 -0
  363. package/dist/templates/agents/react-specialist.json +69 -0
  364. package/dist/templates/agents/testing-automation-expert.json +70 -0
  365. package/dist/templates/agents/typescript-architect.json +69 -0
  366. package/dist/templates/claude-code/common/settings.json +109 -0
  367. package/dist/templates/common/error-prevention.md +267 -0
  368. package/dist/templates/common/karpathy-baseline.md +83 -0
  369. package/dist/templates/common/output-styles/zh-CN/carmack-mode.md +381 -0
  370. package/dist/templates/common/output-styles/zh-CN/codex-rigor-mode.md +114 -0
  371. package/dist/templates/common/output-styles/zh-CN/dhh-mode.md +265 -0
  372. package/dist/templates/common/output-styles/zh-CN/evan-you-mode.md +539 -0
  373. package/dist/templates/common/output-styles/zh-CN/jobs-mode.md +369 -0
  374. package/dist/templates/common/output-styles/zh-CN/linus-mode.md +135 -0
  375. package/dist/templates/common/output-styles/zh-CN/uncle-bob-mode.md +221 -0
  376. package/dist/templates/common/workflow/continuousDelivery/en/continuous-delivery.md +628 -0
  377. package/dist/templates/common/workflow/continuousDelivery/zh-CN/continuous-delivery.md +628 -0
  378. package/dist/templates/common/workflow/essential/en/agents/ccjk-config-agent.md +187 -0
  379. package/dist/templates/common/workflow/essential/en/agents/ccjk-mcp-agent.md +191 -0
  380. package/dist/templates/common/workflow/essential/en/agents/ccjk-skill-agent.md +249 -0
  381. package/dist/templates/common/workflow/essential/en/agents/ccjk-workflow-agent.md +277 -0
  382. package/dist/templates/common/workflow/essential/en/agents/get-current-datetime.md +29 -0
  383. package/dist/templates/common/workflow/essential/en/agents/init-architect.md +115 -0
  384. package/dist/templates/common/workflow/essential/en/agents/ui-ux-designer.md +91 -0
  385. package/dist/templates/common/workflow/essential/en/feat.md +92 -0
  386. package/dist/templates/common/workflow/essential/en/goal.md +147 -0
  387. package/dist/templates/common/workflow/essential/en/init-project.md +53 -0
  388. package/dist/templates/common/workflow/essential/zh-CN/agents/get-current-datetime.md +29 -0
  389. package/dist/templates/common/workflow/essential/zh-CN/agents/init-architect.md +115 -0
  390. package/dist/templates/common/workflow/essential/zh-CN/agents/ui-ux-designer.md +91 -0
  391. package/dist/templates/common/workflow/essential/zh-CN/feat.md +315 -0
  392. package/dist/templates/common/workflow/essential/zh-CN/goal.md +146 -0
  393. package/dist/templates/common/workflow/essential/zh-CN/init-project.md +53 -0
  394. package/dist/templates/common/workflow/git/en/git-cleanBranches.md +102 -0
  395. package/dist/templates/common/workflow/git/en/git-commit.md +205 -0
  396. package/dist/templates/common/workflow/git/en/git-rollback.md +90 -0
  397. package/dist/templates/common/workflow/git/en/git-worktree.md +276 -0
  398. package/dist/templates/common/workflow/git/zh-CN/git-cleanBranches.md +102 -0
  399. package/dist/templates/common/workflow/git/zh-CN/git-commit.md +205 -0
  400. package/dist/templates/common/workflow/git/zh-CN/git-rollback.md +90 -0
  401. package/dist/templates/common/workflow/git/zh-CN/git-worktree.md +276 -0
  402. package/dist/templates/common/workflow/interview/en/interview.md +67 -0
  403. package/dist/templates/common/workflow/interview/zh-CN/interview.md +67 -0
  404. package/dist/templates/common/workflow/linearMethod/en/linear-method.md +651 -0
  405. package/dist/templates/common/workflow/linearMethod/zh-CN/linear-method.md +752 -0
  406. package/dist/templates/common/workflow/refactoringMaster/en/refactoring-master.md +516 -0
  407. package/dist/templates/common/workflow/refactoringMaster/zh-CN/refactoring-master.md +812 -0
  408. package/dist/templates/common/workflow/sixStep/en/workflow.md +83 -0
  409. package/dist/templates/common/workflow/sixStep/zh-CN/workflow.md +359 -0
  410. package/dist/templates/common/workflow/specFirstTDD/en/spec-first-tdd.md +364 -0
  411. package/dist/templates/common/workflow/specFirstTDD/zh-CN/spec-first-tdd.md +366 -0
  412. package/dist/templates/hooks/README.md +212 -0
  413. package/dist/templates/hooks/git-workflow-hooks.md +551 -0
  414. package/dist/templates/hooks/post-test/coverage.json +21 -0
  415. package/dist/templates/hooks/post-test/summary.json +21 -0
  416. package/dist/templates/hooks/post-test-coverage.md +434 -0
  417. package/dist/templates/hooks/pre-commit/eslint.json +22 -0
  418. package/dist/templates/hooks/pre-commit/prettier.json +22 -0
  419. package/dist/templates/hooks/pre-commit-black.md +274 -0
  420. package/dist/templates/hooks/pre-commit-eslint.md +153 -0
  421. package/dist/templates/hooks/pre-commit-gofmt.md +284 -0
  422. package/dist/templates/hooks/pre-commit-prettier.md +212 -0
  423. package/dist/templates/hooks/pre-commit-type-check.md +377 -0
  424. package/dist/templates/skills/ccjk-init.md +154 -0
  425. package/dist/templates/skills/ccjk-mcp-setup.md +205 -0
  426. package/dist/templates/skills/ccjk-troubleshoot.md +228 -0
  427. package/dist/templates/skills/django-patterns.md +1016 -0
  428. package/dist/templates/skills/git-workflow.md +748 -0
  429. package/dist/templates/skills/go-idioms.md +963 -0
  430. package/dist/templates/skills/index.json +132 -0
  431. package/dist/templates/skills/nextjs-optimization.md +694 -0
  432. package/dist/templates/skills/python-pep8.md +852 -0
  433. package/dist/templates/skills/react-patterns.md +686 -0
  434. package/dist/templates/skills/rust-patterns.md +1057 -0
  435. package/dist/templates/skills/security-best-practices.md +1413 -0
  436. package/dist/templates/skills/testing-best-practices.md +1315 -0
  437. package/dist/templates/skills/ts-best-practices.md +354 -0
  438. package/package.json +12 -13
  439. package/dist/core/codex-auth.js +0 -63
  440. package/dist/core/codex-auth.js.map +0 -1
@@ -0,0 +1,1439 @@
1
+ import a from './index5.mjs';
2
+ import { existsSync, readFileSync, mkdirSync, writeFileSync, readdirSync } from 'node:fs';
3
+ import { CCJK_CONFIG_DIR } from './constants.mjs';
4
+ import { w as writeAgentFile } from '../shared/ccjk.CfKKcvWy.mjs';
5
+ import { g as getPluginManager } from '../shared/ccjk.MwtjAULc.mjs';
6
+ import { homedir } from 'node:os';
7
+ import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
8
+ import '../shared/ccjk.BAGoDD49.mjs';
9
+ import './index2.mjs';
10
+ import 'node:process';
11
+ import 'node:url';
12
+ import './main.mjs';
13
+ import 'module';
14
+ import 'node:child_process';
15
+ import 'node:path';
16
+ import 'node:stream';
17
+ import 'node:readline';
18
+ import '../shared/ccjk.i_vn-9C3.mjs';
19
+
20
+ const CLAUDE_CONFIG_PATH = join(homedir(), ".claude.json");
21
+ const TOOL_CACHE_TTL = 5 * 60 * 1e3;
22
+ class McpServerManager {
23
+ servers = /* @__PURE__ */ new Map();
24
+ toolCache = /* @__PURE__ */ new Map();
25
+ configPath;
26
+ initialized = false;
27
+ constructor(configPath = CLAUDE_CONFIG_PATH) {
28
+ this.configPath = configPath;
29
+ }
30
+ // ==========================================================================
31
+ // Initialization
32
+ // ==========================================================================
33
+ /**
34
+ * Initialize the manager by loading MCP configuration
35
+ */
36
+ async initialize() {
37
+ if (this.initialized) {
38
+ return;
39
+ }
40
+ await this.loadConfiguration();
41
+ this.initialized = true;
42
+ }
43
+ /**
44
+ * Load MCP configuration from file
45
+ */
46
+ async loadConfiguration() {
47
+ const config = this.readConfigFile();
48
+ if (!config?.mcpServers) {
49
+ return;
50
+ }
51
+ for (const [name, serverConfig] of Object.entries(config.mcpServers)) {
52
+ this.servers.set(name, {
53
+ name,
54
+ config: serverConfig,
55
+ status: "unknown"
56
+ });
57
+ }
58
+ }
59
+ /**
60
+ * Read the Claude configuration file
61
+ */
62
+ readConfigFile() {
63
+ if (!existsSync(this.configPath)) {
64
+ return null;
65
+ }
66
+ try {
67
+ const content = readFileSync(this.configPath, "utf-8");
68
+ return JSON.parse(content);
69
+ } catch (error) {
70
+ console.error(`Failed to read MCP config from ${this.configPath}:`, error);
71
+ return null;
72
+ }
73
+ }
74
+ /**
75
+ * Reload configuration (useful after config changes)
76
+ */
77
+ async reload() {
78
+ this.servers.clear();
79
+ this.toolCache.clear();
80
+ this.initialized = false;
81
+ await this.initialize();
82
+ }
83
+ // ==========================================================================
84
+ // Server Management
85
+ // ==========================================================================
86
+ /**
87
+ * Get all configured MCP servers
88
+ */
89
+ getServers() {
90
+ return Array.from(this.servers.values());
91
+ }
92
+ /**
93
+ * Get a specific server by name
94
+ */
95
+ getServer(name) {
96
+ return this.servers.get(name);
97
+ }
98
+ /**
99
+ * Get server names
100
+ */
101
+ getServerNames() {
102
+ return Array.from(this.servers.keys());
103
+ }
104
+ /**
105
+ * Check if a server is configured
106
+ */
107
+ hasServer(name) {
108
+ return this.servers.has(name);
109
+ }
110
+ // ==========================================================================
111
+ // Tool Discovery
112
+ // ==========================================================================
113
+ /**
114
+ * Get available tools from a specific MCP server
115
+ *
116
+ * This method attempts to discover tools by querying the MCP server.
117
+ * Results are cached to avoid repeated queries.
118
+ */
119
+ async getServerTools(serverName) {
120
+ const server = this.servers.get(serverName);
121
+ if (!server) {
122
+ return [];
123
+ }
124
+ const cached = this.toolCache.get(serverName);
125
+ if (cached && Date.now() - cached.timestamp < TOOL_CACHE_TTL) {
126
+ return cached.tools;
127
+ }
128
+ const tools = await this.discoverTools(server);
129
+ this.toolCache.set(serverName, {
130
+ tools,
131
+ timestamp: Date.now()
132
+ });
133
+ server.tools = tools;
134
+ server.lastUpdated = Date.now();
135
+ return tools;
136
+ }
137
+ /**
138
+ * Get all available tools from all configured servers
139
+ */
140
+ async getAllTools() {
141
+ const allTools = [];
142
+ for (const serverName of this.servers.keys()) {
143
+ const tools = await this.getServerTools(serverName);
144
+ allTools.push(...tools);
145
+ }
146
+ return allTools;
147
+ }
148
+ /**
149
+ * Get tools for specific servers (used by AgentRuntime)
150
+ *
151
+ * @param mcpRefs - Array of MCP server references from agent definition
152
+ */
153
+ async getToolsForAgent(mcpRefs) {
154
+ const tools = [];
155
+ for (const ref of mcpRefs) {
156
+ const serverTools = await this.getServerTools(ref.serverName);
157
+ if (ref.tools && ref.tools.length > 0) {
158
+ const filteredTools = serverTools.filter((t) => ref.tools.includes(t.name));
159
+ tools.push(...filteredTools);
160
+ } else {
161
+ tools.push(...serverTools);
162
+ }
163
+ }
164
+ return tools;
165
+ }
166
+ /**
167
+ * Discover tools from an MCP server
168
+ *
169
+ * This is a simplified implementation that returns predefined tools
170
+ * based on known MCP server types. In a full implementation, this would
171
+ * actually connect to the MCP server and query its capabilities.
172
+ */
173
+ async discoverTools(server) {
174
+ const tools = [];
175
+ try {
176
+ if (server.config.type === "stdio" && server.config.command) {
177
+ const discoveredTools = await this.queryStdioServerTools(server);
178
+ if (discoveredTools.length > 0) {
179
+ server.status = "connected";
180
+ return discoveredTools;
181
+ }
182
+ }
183
+ if (server.config.type === "sse" && server.config.url) {
184
+ const discoveredTools = await this.querySseServerTools(server);
185
+ if (discoveredTools.length > 0) {
186
+ server.status = "connected";
187
+ return discoveredTools;
188
+ }
189
+ }
190
+ const knownTools = this.getKnownServerTools(server.name, server.config);
191
+ if (knownTools.length > 0) {
192
+ server.status = "unknown";
193
+ return knownTools;
194
+ }
195
+ server.status = "unknown";
196
+ return tools;
197
+ } catch (error) {
198
+ server.status = "error";
199
+ server.error = error instanceof Error ? error.message : String(error);
200
+ return tools;
201
+ }
202
+ }
203
+ /**
204
+ * Query tools from a stdio-based MCP server
205
+ *
206
+ * Note: This is a placeholder implementation. Real MCP tool discovery
207
+ * would require implementing the MCP protocol handshake.
208
+ */
209
+ async queryStdioServerTools(_server) {
210
+ return [];
211
+ }
212
+ /**
213
+ * Query tools from an SSE-based MCP server
214
+ *
215
+ * Note: This is a placeholder implementation.
216
+ */
217
+ async querySseServerTools(_server) {
218
+ return [];
219
+ }
220
+ /**
221
+ * Get known tools for common MCP servers
222
+ *
223
+ * This provides tool information for well-known MCP servers
224
+ * without needing to actually connect to them.
225
+ */
226
+ getKnownServerTools(serverName, config) {
227
+ const tools = [];
228
+ const command = config.command || "";
229
+ const args = config.args?.join(" ") || "";
230
+ const identifier = `${serverName} ${command} ${args}`.toLowerCase();
231
+ if (identifier.includes("filesystem") || identifier.includes("fs")) {
232
+ tools.push(
233
+ {
234
+ server: serverName,
235
+ name: "read_file",
236
+ description: "Read the contents of a file",
237
+ inputSchema: {
238
+ type: "object",
239
+ properties: {
240
+ path: { type: "string", description: "Path to the file to read" }
241
+ },
242
+ required: ["path"]
243
+ }
244
+ },
245
+ {
246
+ server: serverName,
247
+ name: "write_file",
248
+ description: "Write content to a file",
249
+ inputSchema: {
250
+ type: "object",
251
+ properties: {
252
+ path: { type: "string", description: "Path to the file to write" },
253
+ content: { type: "string", description: "Content to write" }
254
+ },
255
+ required: ["path", "content"]
256
+ }
257
+ },
258
+ {
259
+ server: serverName,
260
+ name: "list_directory",
261
+ description: "List contents of a directory",
262
+ inputSchema: {
263
+ type: "object",
264
+ properties: {
265
+ path: { type: "string", description: "Path to the directory" }
266
+ },
267
+ required: ["path"]
268
+ }
269
+ }
270
+ );
271
+ }
272
+ if (identifier.includes("exa")) {
273
+ tools.push(
274
+ {
275
+ server: serverName,
276
+ name: "web_search",
277
+ description: "Search the web using Exa",
278
+ inputSchema: {
279
+ type: "object",
280
+ properties: {
281
+ query: { type: "string", description: "Search query" },
282
+ numResults: { type: "number", description: "Number of results to return" }
283
+ },
284
+ required: ["query"]
285
+ }
286
+ },
287
+ {
288
+ server: serverName,
289
+ name: "find_similar",
290
+ description: "Find similar content to a URL",
291
+ inputSchema: {
292
+ type: "object",
293
+ properties: {
294
+ url: { type: "string", description: "URL to find similar content for" }
295
+ },
296
+ required: ["url"]
297
+ }
298
+ }
299
+ );
300
+ }
301
+ if (identifier.includes("github")) {
302
+ tools.push(
303
+ {
304
+ server: serverName,
305
+ name: "search_repositories",
306
+ description: "Search GitHub repositories",
307
+ inputSchema: {
308
+ type: "object",
309
+ properties: {
310
+ query: { type: "string", description: "Search query" }
311
+ },
312
+ required: ["query"]
313
+ }
314
+ },
315
+ {
316
+ server: serverName,
317
+ name: "get_file_contents",
318
+ description: "Get contents of a file from a repository",
319
+ inputSchema: {
320
+ type: "object",
321
+ properties: {
322
+ owner: { type: "string", description: "Repository owner" },
323
+ repo: { type: "string", description: "Repository name" },
324
+ path: { type: "string", description: "File path" }
325
+ },
326
+ required: ["owner", "repo", "path"]
327
+ }
328
+ },
329
+ {
330
+ server: serverName,
331
+ name: "create_issue",
332
+ description: "Create a new issue in a repository",
333
+ inputSchema: {
334
+ type: "object",
335
+ properties: {
336
+ owner: { type: "string", description: "Repository owner" },
337
+ repo: { type: "string", description: "Repository name" },
338
+ title: { type: "string", description: "Issue title" },
339
+ body: { type: "string", description: "Issue body" }
340
+ },
341
+ required: ["owner", "repo", "title"]
342
+ }
343
+ }
344
+ );
345
+ }
346
+ if (identifier.includes("playwright")) {
347
+ tools.push(
348
+ {
349
+ server: serverName,
350
+ name: "browser_navigate",
351
+ description: "Navigate to a URL",
352
+ inputSchema: {
353
+ type: "object",
354
+ properties: {
355
+ url: { type: "string", description: "URL to navigate to" }
356
+ },
357
+ required: ["url"]
358
+ }
359
+ },
360
+ {
361
+ server: serverName,
362
+ name: "browser_snapshot",
363
+ description: "Take an accessibility snapshot of the page",
364
+ inputSchema: {
365
+ type: "object",
366
+ properties: {}
367
+ }
368
+ },
369
+ {
370
+ server: serverName,
371
+ name: "browser_click",
372
+ description: "Click on an element",
373
+ inputSchema: {
374
+ type: "object",
375
+ properties: {
376
+ element: { type: "string", description: "Element description" },
377
+ ref: { type: "string", description: "Element reference" }
378
+ },
379
+ required: ["element", "ref"]
380
+ }
381
+ }
382
+ );
383
+ }
384
+ if (identifier.includes("context7")) {
385
+ tools.push(
386
+ {
387
+ server: serverName,
388
+ name: "resolve-library-id",
389
+ description: "Resolve a library name to Context7 library ID",
390
+ inputSchema: {
391
+ type: "object",
392
+ properties: {
393
+ libraryName: { type: "string", description: "Library name to search for" }
394
+ },
395
+ required: ["libraryName"]
396
+ }
397
+ },
398
+ {
399
+ server: serverName,
400
+ name: "query-docs",
401
+ description: "Query documentation for a library",
402
+ inputSchema: {
403
+ type: "object",
404
+ properties: {
405
+ libraryId: { type: "string", description: "Context7 library ID" },
406
+ query: { type: "string", description: "Query string" }
407
+ },
408
+ required: ["libraryId", "query"]
409
+ }
410
+ }
411
+ );
412
+ }
413
+ if (identifier.includes("fetch") || identifier.includes("http")) {
414
+ tools.push({
415
+ server: serverName,
416
+ name: "fetch",
417
+ description: "Fetch content from a URL",
418
+ inputSchema: {
419
+ type: "object",
420
+ properties: {
421
+ url: { type: "string", description: "URL to fetch" },
422
+ method: { type: "string", description: "HTTP method", enum: ["GET", "POST", "PUT", "DELETE"] },
423
+ headers: { type: "object", description: "Request headers" },
424
+ body: { type: "string", description: "Request body" }
425
+ },
426
+ required: ["url"]
427
+ }
428
+ });
429
+ }
430
+ if (identifier.includes("memory") || identifier.includes("knowledge")) {
431
+ tools.push(
432
+ {
433
+ server: serverName,
434
+ name: "store_memory",
435
+ description: "Store information in memory",
436
+ inputSchema: {
437
+ type: "object",
438
+ properties: {
439
+ key: { type: "string", description: "Memory key" },
440
+ value: { type: "string", description: "Value to store" }
441
+ },
442
+ required: ["key", "value"]
443
+ }
444
+ },
445
+ {
446
+ server: serverName,
447
+ name: "retrieve_memory",
448
+ description: "Retrieve information from memory",
449
+ inputSchema: {
450
+ type: "object",
451
+ properties: {
452
+ key: { type: "string", description: "Memory key" }
453
+ },
454
+ required: ["key"]
455
+ }
456
+ }
457
+ );
458
+ }
459
+ return tools;
460
+ }
461
+ // ==========================================================================
462
+ // Tool Execution (Optional Proxy)
463
+ // ==========================================================================
464
+ /**
465
+ * Execute a tool call through the MCP server
466
+ *
467
+ * Note: This is a placeholder for future implementation.
468
+ * In a full implementation, this would:
469
+ * 1. Connect to the appropriate MCP server
470
+ * 2. Send the tool call request
471
+ * 3. Return the response
472
+ *
473
+ * For now, agents should use Claude Code's native MCP integration.
474
+ */
475
+ async callTool(request) {
476
+ const server = this.servers.get(request.server);
477
+ if (!server) {
478
+ return {
479
+ success: false,
480
+ error: `Server not found: ${request.server}`
481
+ };
482
+ }
483
+ const startTime = Date.now();
484
+ try {
485
+ return {
486
+ success: false,
487
+ error: "Direct tool execution not yet implemented. Use Claude Code's native MCP integration.",
488
+ duration: Date.now() - startTime
489
+ };
490
+ } catch (error) {
491
+ return {
492
+ success: false,
493
+ error: error instanceof Error ? error.message : String(error),
494
+ duration: Date.now() - startTime
495
+ };
496
+ }
497
+ }
498
+ // ==========================================================================
499
+ // Utility Methods
500
+ // ==========================================================================
501
+ /**
502
+ * Get tool information formatted for agent system prompt
503
+ */
504
+ formatToolsForPrompt(tools) {
505
+ if (tools.length === 0) {
506
+ return "";
507
+ }
508
+ const lines = ["## Available MCP Tools", ""];
509
+ const byServer = /* @__PURE__ */ new Map();
510
+ for (const tool of tools) {
511
+ const serverTools = byServer.get(tool.server) || [];
512
+ serverTools.push(tool);
513
+ byServer.set(tool.server, serverTools);
514
+ }
515
+ for (const [server, serverTools] of byServer) {
516
+ lines.push(`### ${server}`);
517
+ lines.push("");
518
+ for (const tool of serverTools) {
519
+ lines.push(`**${tool.name}**: ${tool.description}`);
520
+ const schema = tool.inputSchema;
521
+ if (schema.properties) {
522
+ const params = Object.entries(schema.properties);
523
+ if (params.length > 0) {
524
+ lines.push("Parameters:");
525
+ for (const [name, prop] of params) {
526
+ const required = schema.required?.includes(name) ? " (required)" : "";
527
+ lines.push(` - \`${name}\`: ${prop.description || prop.type}${required}`);
528
+ }
529
+ }
530
+ }
531
+ lines.push("");
532
+ }
533
+ }
534
+ return lines.join("\n");
535
+ }
536
+ /**
537
+ * Check if the manager is initialized
538
+ */
539
+ isInitialized() {
540
+ return this.initialized;
541
+ }
542
+ /**
543
+ * Get configuration file path
544
+ */
545
+ getConfigPath() {
546
+ return this.configPath;
547
+ }
548
+ /**
549
+ * Clear tool cache
550
+ */
551
+ clearCache() {
552
+ this.toolCache.clear();
553
+ }
554
+ }
555
+ let managerInstance = null;
556
+ async function getMcpServerManager() {
557
+ if (!managerInstance) {
558
+ managerInstance = new McpServerManager();
559
+ await managerInstance.initialize();
560
+ }
561
+ return managerInstance;
562
+ }
563
+
564
+ const AGENT_TEMPLATES_DIR = join(CCJK_CONFIG_DIR, "agent-templates");
565
+ class AgentBuilder {
566
+ definition = {
567
+ skills: [],
568
+ mcpServers: [],
569
+ capabilities: []
570
+ };
571
+ /**
572
+ * Set agent ID
573
+ */
574
+ id(id) {
575
+ this.definition.id = id;
576
+ return this;
577
+ }
578
+ /**
579
+ * Set agent name
580
+ */
581
+ name(name) {
582
+ this.definition.name = typeof name === "string" ? { "en": name, "zh-CN": name } : name;
583
+ return this;
584
+ }
585
+ /**
586
+ * Set agent description
587
+ */
588
+ description(desc) {
589
+ this.definition.description = typeof desc === "string" ? { "en": desc, "zh-CN": desc } : desc;
590
+ return this;
591
+ }
592
+ /**
593
+ * Set agent persona/role
594
+ */
595
+ persona(persona) {
596
+ this.definition.persona = persona;
597
+ return this;
598
+ }
599
+ /**
600
+ * Set agent instructions
601
+ */
602
+ instructions(instructions) {
603
+ this.definition.instructions = instructions;
604
+ return this;
605
+ }
606
+ /**
607
+ * Add a skill
608
+ */
609
+ addSkill(pluginId, options = {}) {
610
+ this.definition.skills.push({
611
+ pluginId,
612
+ ...options
613
+ });
614
+ return this;
615
+ }
616
+ /**
617
+ * Add multiple skills
618
+ */
619
+ addSkills(pluginIds) {
620
+ for (const id of pluginIds) {
621
+ this.addSkill(id);
622
+ }
623
+ return this;
624
+ }
625
+ /**
626
+ * Add an MCP server
627
+ */
628
+ addMcpServer(serverName, options = {}) {
629
+ this.definition.mcpServers.push({
630
+ serverName,
631
+ ...options
632
+ });
633
+ return this;
634
+ }
635
+ /**
636
+ * Add multiple MCP servers
637
+ */
638
+ addMcpServers(serverNames) {
639
+ for (const name of serverNames) {
640
+ this.addMcpServer(name);
641
+ }
642
+ return this;
643
+ }
644
+ /**
645
+ * Add capability
646
+ */
647
+ addCapability(capability) {
648
+ if (!this.definition.capabilities.includes(capability)) {
649
+ this.definition.capabilities.push(capability);
650
+ }
651
+ return this;
652
+ }
653
+ /**
654
+ * Add multiple capabilities
655
+ */
656
+ addCapabilities(capabilities) {
657
+ for (const cap of capabilities) {
658
+ this.addCapability(cap);
659
+ }
660
+ return this;
661
+ }
662
+ /**
663
+ * Set trigger patterns
664
+ */
665
+ triggers(patterns) {
666
+ this.definition.triggers = patterns;
667
+ return this;
668
+ }
669
+ /**
670
+ * Build the agent definition
671
+ */
672
+ build() {
673
+ if (!this.definition.id) {
674
+ throw new Error("Agent ID is required");
675
+ }
676
+ if (!this.definition.name) {
677
+ throw new Error("Agent name is required");
678
+ }
679
+ if (!this.definition.description) {
680
+ throw new Error("Agent description is required");
681
+ }
682
+ if (!this.definition.persona) {
683
+ this.definition.persona = "You are a helpful AI assistant.";
684
+ }
685
+ if (!this.definition.instructions) {
686
+ this.definition.instructions = "";
687
+ }
688
+ return this.definition;
689
+ }
690
+ /**
691
+ * Build and save the agent
692
+ */
693
+ async save() {
694
+ const definition = this.build();
695
+ const manager = await getPluginManager();
696
+ await manager.createAgent(definition);
697
+ return definition;
698
+ }
699
+ }
700
+ class AgentCreator {
701
+ /**
702
+ * Create a new agent builder
703
+ */
704
+ create() {
705
+ return new AgentBuilder();
706
+ }
707
+ /**
708
+ * Create agent from template
709
+ */
710
+ async fromTemplate(templateId, overrides = {}) {
711
+ const template = await this.loadTemplate(templateId);
712
+ if (!template) {
713
+ throw new Error(`Template not found: ${templateId}`);
714
+ }
715
+ const definition = {
716
+ id: overrides.id || `${templateId}-${Date.now()}`,
717
+ name: overrides.name || template.name || { "en": templateId, "zh-CN": templateId },
718
+ description: overrides.description || template.description || { "en": "", "zh-CN": "" },
719
+ persona: overrides.persona || template.persona || "",
720
+ instructions: overrides.instructions || template.instructions || "",
721
+ skills: [...template.skills || [], ...overrides.skills || []],
722
+ mcpServers: [...template.mcpServers || [], ...overrides.mcpServers || []],
723
+ capabilities: [.../* @__PURE__ */ new Set([...template.capabilities || [], ...overrides.capabilities || []])],
724
+ triggers: overrides.triggers || template.triggers,
725
+ intents: overrides.intents || template.intents
726
+ };
727
+ const manager = await getPluginManager();
728
+ await manager.createAgent(definition);
729
+ return definition;
730
+ }
731
+ /**
732
+ * Create agent from skills only
733
+ */
734
+ async fromSkills(id, name, skillIds, options = {}) {
735
+ const builder = this.create().id(id).name(name).description(options.description || `Agent using skills: ${skillIds.join(", ")}`).addSkills(skillIds);
736
+ if (options.persona) {
737
+ builder.persona(options.persona);
738
+ }
739
+ if (options.instructions) {
740
+ builder.instructions(options.instructions);
741
+ }
742
+ return builder.save();
743
+ }
744
+ /**
745
+ * Create agent from MCP servers only
746
+ */
747
+ async fromMcpServers(id, name, serverNames, options = {}) {
748
+ const builder = this.create().id(id).name(name).description(options.description || `Agent using MCP servers: ${serverNames.join(", ")}`).addMcpServers(serverNames);
749
+ if (options.persona) {
750
+ builder.persona(options.persona);
751
+ }
752
+ if (options.instructions) {
753
+ builder.instructions(options.instructions);
754
+ }
755
+ return builder.save();
756
+ }
757
+ /**
758
+ * Load a template
759
+ */
760
+ async loadTemplate(templateId) {
761
+ const builtIn = BUILT_IN_TEMPLATES[templateId];
762
+ if (builtIn) {
763
+ return builtIn;
764
+ }
765
+ const templatePath = join(AGENT_TEMPLATES_DIR, `${templateId}.json`);
766
+ if (existsSync(templatePath)) {
767
+ return JSON.parse(readFileSync(templatePath, "utf-8"));
768
+ }
769
+ return null;
770
+ }
771
+ /**
772
+ * Save a template
773
+ */
774
+ async saveTemplate(templateId, template) {
775
+ if (!existsSync(AGENT_TEMPLATES_DIR)) {
776
+ mkdirSync(AGENT_TEMPLATES_DIR, { recursive: true });
777
+ }
778
+ const templatePath = join(AGENT_TEMPLATES_DIR, `${templateId}.json`);
779
+ writeFileSync(templatePath, JSON.stringify(template, null, 2));
780
+ }
781
+ /**
782
+ * List available templates
783
+ */
784
+ listTemplates() {
785
+ const templates = Object.keys(BUILT_IN_TEMPLATES);
786
+ if (existsSync(AGENT_TEMPLATES_DIR)) {
787
+ const files = readdirSync(AGENT_TEMPLATES_DIR);
788
+ for (const file of files) {
789
+ if (file.endsWith(".json") || file.endsWith(".md")) {
790
+ templates.push(file.replace(/\.(json|md)$/, ""));
791
+ }
792
+ }
793
+ }
794
+ return templates;
795
+ }
796
+ /**
797
+ * Write agent to Claude Code compatible location (project-local .claude-code/agents/)
798
+ */
799
+ async writeToClaudeCode(agent, options) {
800
+ return writeAgentFile(agent, {
801
+ format: "markdown",
802
+ projectDir: options?.projectDir,
803
+ global: false
804
+ });
805
+ }
806
+ }
807
+ class AgentRuntime {
808
+ context;
809
+ constructor(context) {
810
+ this.context = context;
811
+ }
812
+ /**
813
+ * Create runtime from agent ID
814
+ */
815
+ static async fromAgentId(agentId) {
816
+ const manager = await getPluginManager();
817
+ const agent = manager.getAgent(agentId);
818
+ if (!agent) {
819
+ throw new Error(`Agent not found: ${agentId}`);
820
+ }
821
+ const skills = [];
822
+ for (const skillRef of agent.skills) {
823
+ const plugin = manager.getPlugin(skillRef.pluginId);
824
+ if (plugin) {
825
+ skills.push(plugin);
826
+ }
827
+ }
828
+ let mcpTools = [];
829
+ if (agent.mcpServers && agent.mcpServers.length > 0) {
830
+ try {
831
+ const mcpManager = await getMcpServerManager();
832
+ mcpTools = await mcpManager.getToolsForAgent(agent.mcpServers);
833
+ } catch (error) {
834
+ console.warn("Failed to load MCP tools:", error instanceof Error ? error.message : String(error));
835
+ }
836
+ }
837
+ return new AgentRuntime({
838
+ agent,
839
+ skills,
840
+ mcpTools,
841
+ task: "",
842
+ history: []
843
+ });
844
+ }
845
+ /**
846
+ * Get the system prompt for this agent
847
+ */
848
+ getSystemPrompt() {
849
+ const parts = [];
850
+ parts.push(this.context.agent.persona);
851
+ parts.push("");
852
+ if (this.context.agent.instructions) {
853
+ parts.push("## Instructions");
854
+ parts.push(this.context.agent.instructions);
855
+ parts.push("");
856
+ }
857
+ if (this.context.skills.length > 0) {
858
+ parts.push("## Available Skills");
859
+ parts.push("");
860
+ for (const skill of this.context.skills) {
861
+ if (skill.skill) {
862
+ parts.push(`### ${skill.skill.title}`);
863
+ parts.push(skill.skill.description);
864
+ parts.push("");
865
+ if (skill.skill.applicability.taskTypes.length > 0) {
866
+ parts.push("**When to use:**");
867
+ for (const task of skill.skill.applicability.taskTypes) {
868
+ parts.push(`- ${task}`);
869
+ }
870
+ parts.push("");
871
+ }
872
+ if (skill.skill.rules && skill.skill.rules.length > 0) {
873
+ parts.push("**Key Rules:**");
874
+ const criticalRules = skill.skill.rules.filter((r) => r.priority === "critical" || r.priority === "high");
875
+ for (const rule of criticalRules.slice(0, 5)) {
876
+ parts.push(`- **${rule.id}**: ${rule.title}`);
877
+ }
878
+ parts.push("");
879
+ }
880
+ }
881
+ }
882
+ }
883
+ if (this.context.mcpTools.length > 0) {
884
+ parts.push("## Available MCP Tools");
885
+ parts.push("");
886
+ const byServer = /* @__PURE__ */ new Map();
887
+ for (const tool of this.context.mcpTools) {
888
+ const serverTools = byServer.get(tool.server) || [];
889
+ serverTools.push(tool);
890
+ byServer.set(tool.server, serverTools);
891
+ }
892
+ for (const [server, serverTools] of byServer) {
893
+ parts.push(`### ${server}`);
894
+ parts.push("");
895
+ for (const tool of serverTools) {
896
+ parts.push(`**${tool.name}**: ${tool.description}`);
897
+ const schema = tool.inputSchema;
898
+ if (schema.properties) {
899
+ const params = Object.entries(schema.properties);
900
+ if (params.length > 0) {
901
+ parts.push("Parameters:");
902
+ for (const [name, prop] of params) {
903
+ const required = schema.required?.includes(name) ? " (required)" : "";
904
+ parts.push(` - \`${name}\`: ${prop.description || prop.type}${required}`);
905
+ }
906
+ }
907
+ }
908
+ parts.push("");
909
+ }
910
+ }
911
+ }
912
+ if (this.context.agent.capabilities.length > 0) {
913
+ parts.push("## Capabilities");
914
+ parts.push("");
915
+ for (const cap of this.context.agent.capabilities) {
916
+ parts.push(`- ${this.formatCapability(cap)}`);
917
+ }
918
+ parts.push("");
919
+ }
920
+ return parts.join("\n");
921
+ }
922
+ /**
923
+ * Get full skill content for context
924
+ */
925
+ getSkillContent() {
926
+ const parts = [];
927
+ for (const skill of this.context.skills) {
928
+ if (skill.skill) {
929
+ parts.push(`# ${skill.skill.title}`);
930
+ parts.push("");
931
+ parts.push(skill.skill.rawContent);
932
+ parts.push("");
933
+ parts.push("---");
934
+ parts.push("");
935
+ }
936
+ }
937
+ return parts.join("\n");
938
+ }
939
+ /**
940
+ * Add message to history
941
+ */
942
+ addMessage(role, content) {
943
+ this.context.history = this.context.history || [];
944
+ this.context.history.push({
945
+ role,
946
+ content,
947
+ timestamp: Date.now()
948
+ });
949
+ }
950
+ /**
951
+ * Get conversation history
952
+ */
953
+ getHistory() {
954
+ return this.context.history || [];
955
+ }
956
+ /**
957
+ * Set current task
958
+ */
959
+ setTask(task) {
960
+ this.context.task = task;
961
+ }
962
+ /**
963
+ * Format capability for display
964
+ */
965
+ formatCapability(cap) {
966
+ const labels = {
967
+ "code-generation": "Code Generation",
968
+ "code-review": "Code Review",
969
+ "testing": "Testing",
970
+ "documentation": "Documentation",
971
+ "deployment": "Deployment",
972
+ "debugging": "Debugging",
973
+ "refactoring": "Refactoring",
974
+ "git-operations": "Git Operations",
975
+ "file-management": "File Management",
976
+ "web-search": "Web Search",
977
+ "api-integration": "API Integration"
978
+ };
979
+ return labels[cap] || cap;
980
+ }
981
+ }
982
+ const BUILT_IN_TEMPLATES = {
983
+ "code-assistant": {
984
+ name: { "en": "Code Assistant", "zh-CN": "\u4EE3\u7801\u52A9\u624B" },
985
+ description: { "en": "General-purpose coding assistant", "zh-CN": "\u901A\u7528\u7F16\u7A0B\u52A9\u624B" },
986
+ persona: `You are an expert software engineer with deep knowledge of multiple programming languages and frameworks. You write clean, efficient, and well-documented code. You follow best practices and design patterns.`,
987
+ capabilities: ["code-generation", "code-review", "debugging", "refactoring"],
988
+ instructions: `
989
+ - Always explain your reasoning before writing code
990
+ - Follow the project's existing code style
991
+ - Write comprehensive error handling
992
+ - Add helpful comments for complex logic
993
+ - Suggest tests for new functionality
994
+ `
995
+ },
996
+ "git-master": {
997
+ name: { "en": "Git Master", "zh-CN": "Git \u5927\u5E08" },
998
+ description: { "en": "Expert Git operations assistant", "zh-CN": "Git \u64CD\u4F5C\u4E13\u5BB6" },
999
+ persona: `You are a Git expert who helps with version control operations. You write clear, conventional commit messages and help manage branches effectively.`,
1000
+ capabilities: ["git-operations"],
1001
+ instructions: `
1002
+ - Use conventional commit format (feat:, fix:, docs:, etc.)
1003
+ - Suggest appropriate branch names
1004
+ - Help resolve merge conflicts
1005
+ - Explain Git concepts when needed
1006
+ `
1007
+ },
1008
+ "test-engineer": {
1009
+ name: { "en": "Test Engineer", "zh-CN": "\u6D4B\u8BD5\u5DE5\u7A0B\u5E08" },
1010
+ description: { "en": "Testing and quality assurance specialist", "zh-CN": "\u6D4B\u8BD5\u548C\u8D28\u91CF\u4FDD\u8BC1\u4E13\u5BB6" },
1011
+ persona: `You are a QA engineer specializing in software testing. You write comprehensive test cases and help ensure code quality.`,
1012
+ capabilities: ["testing", "code-review"],
1013
+ instructions: `
1014
+ - Write tests that cover edge cases
1015
+ - Use appropriate testing frameworks (Jest, Vitest, etc.)
1016
+ - Follow AAA pattern (Arrange, Act, Assert)
1017
+ - Aim for high test coverage
1018
+ - Include both unit and integration tests
1019
+ `
1020
+ },
1021
+ "devops-engineer": {
1022
+ name: { "en": "DevOps Engineer", "zh-CN": "DevOps \u5DE5\u7A0B\u5E08" },
1023
+ description: { "en": "DevOps and deployment specialist", "zh-CN": "DevOps \u548C\u90E8\u7F72\u4E13\u5BB6" },
1024
+ persona: `You are a DevOps engineer who helps with CI/CD, containerization, and deployment. You write efficient Dockerfiles and deployment configurations.`,
1025
+ capabilities: ["deployment", "file-management"],
1026
+ instructions: `
1027
+ - Write optimized Dockerfiles with multi-stage builds
1028
+ - Create comprehensive CI/CD pipelines
1029
+ - Follow security best practices
1030
+ - Use environment variables for configuration
1031
+ - Document deployment procedures
1032
+ `
1033
+ },
1034
+ "full-stack": {
1035
+ name: { "en": "Full Stack Developer", "zh-CN": "\u5168\u6808\u5F00\u53D1\u8005" },
1036
+ description: { "en": "Full stack development assistant", "zh-CN": "\u5168\u6808\u5F00\u53D1\u52A9\u624B" },
1037
+ persona: `You are a full-stack developer proficient in both frontend and backend development. You build complete, production-ready applications.`,
1038
+ capabilities: ["code-generation", "code-review", "testing", "documentation", "deployment"],
1039
+ instructions: `
1040
+ - Consider both frontend and backend implications
1041
+ - Write responsive and accessible UI
1042
+ - Design RESTful APIs
1043
+ - Implement proper authentication and authorization
1044
+ - Optimize for performance
1045
+ `
1046
+ }
1047
+ };
1048
+ let creatorInstance = null;
1049
+ function getAgentCreator() {
1050
+ if (!creatorInstance) {
1051
+ creatorInstance = new AgentCreator();
1052
+ }
1053
+ return creatorInstance;
1054
+ }
1055
+ function createAgent() {
1056
+ return new AgentBuilder();
1057
+ }
1058
+ async function createAgentFromTemplate(templateId, overrides = {}) {
1059
+ const creator = getAgentCreator();
1060
+ return creator.fromTemplate(templateId, overrides);
1061
+ }
1062
+ async function getAgentRuntime(agentId) {
1063
+ return AgentRuntime.fromAgentId(agentId);
1064
+ }
1065
+
1066
+ async function handleAgentCommand(args, options = {}) {
1067
+ const subcommand = args[0];
1068
+ const restArgs = args.slice(1);
1069
+ switch (subcommand) {
1070
+ case "create":
1071
+ case "new":
1072
+ await createNewAgent(restArgs[0], options);
1073
+ break;
1074
+ case "list":
1075
+ case "ls":
1076
+ await listAgents(options);
1077
+ break;
1078
+ case "info":
1079
+ case "show":
1080
+ await showAgentInfo(restArgs[0], options);
1081
+ break;
1082
+ case "remove":
1083
+ case "rm":
1084
+ case "delete":
1085
+ await removeAgent(restArgs[0]);
1086
+ break;
1087
+ case "run":
1088
+ case "start":
1089
+ await runAgent(restArgs[0], restArgs.slice(1).join(" "));
1090
+ break;
1091
+ case "templates":
1092
+ await listTemplates(options);
1093
+ break;
1094
+ default:
1095
+ showAgentHelp();
1096
+ }
1097
+ }
1098
+ async function createNewAgent(name, options) {
1099
+ if (!name) {
1100
+ console.log(a.red("Error: Please specify an agent name"));
1101
+ console.log(a.dim("Example: agent create my-assistant"));
1102
+ return;
1103
+ }
1104
+ console.log(a.cyan(`
1105
+ \u{1F916} Creating agent: ${name}
1106
+ `));
1107
+ try {
1108
+ let agent;
1109
+ if (options.template) {
1110
+ console.log(a.dim(`Using template: ${options.template}`));
1111
+ agent = await createAgentFromTemplate(options.template, {
1112
+ id: name,
1113
+ name: { "en": name, "zh-CN": name }
1114
+ });
1115
+ } else {
1116
+ const builder = createAgent().id(name).name(name).description(`Custom agent: ${name}`);
1117
+ if (options.skills && options.skills.length > 0) {
1118
+ builder.addSkills(options.skills);
1119
+ console.log(a.dim(`Adding skills: ${options.skills.join(", ")}`));
1120
+ }
1121
+ if (options.mcp && options.mcp.length > 0) {
1122
+ builder.addMcpServers(options.mcp);
1123
+ console.log(a.dim(`Adding MCP servers: ${options.mcp.join(", ")}`));
1124
+ }
1125
+ if (options.persona) {
1126
+ builder.persona(options.persona);
1127
+ }
1128
+ agent = await builder.save();
1129
+ }
1130
+ console.log(a.green(`
1131
+ \u2705 Agent created successfully!`));
1132
+ console.log("");
1133
+ console.log(a.bold("Agent Details:"));
1134
+ console.log(a.dim(` ID: ${agent.id}`));
1135
+ console.log(a.dim(` Name: ${agent.name.en}`));
1136
+ console.log(a.dim(` Skills: ${agent.skills.length}`));
1137
+ console.log(a.dim(` MCP Servers: ${agent.mcpServers.length}`));
1138
+ console.log(a.dim(` Capabilities: ${agent.capabilities.join(", ")}`));
1139
+ console.log("");
1140
+ console.log(a.dim(`Run with: agent run ${agent.id}`));
1141
+ } catch (error) {
1142
+ console.log(a.red(`\u274C Failed to create agent: ${error instanceof Error ? error.message : error}`));
1143
+ }
1144
+ }
1145
+ async function listAgents(options) {
1146
+ const manager = await getPluginManager();
1147
+ const agents = manager.listAgents();
1148
+ if (options.json) {
1149
+ console.log(JSON.stringify(agents, null, 2));
1150
+ return;
1151
+ }
1152
+ console.log(a.cyan("\n\u{1F916} Installed Agents\n"));
1153
+ if (agents.length === 0) {
1154
+ console.log(a.dim("No agents created yet."));
1155
+ console.log(a.dim("\nCreate an agent with:"));
1156
+ console.log(a.dim(" agent create my-assistant --template code-assistant"));
1157
+ console.log(a.dim(" agent create my-agent --skills git-helper,code-reviewer"));
1158
+ return;
1159
+ }
1160
+ for (const agent of agents) {
1161
+ const name = agent.name.en || agent.id;
1162
+ console.log(` ${a.bold(name)} ${a.dim(`(${agent.id})`)}`);
1163
+ console.log(a.dim(` ${agent.description.en}`));
1164
+ const badges = [];
1165
+ if (agent.skills.length > 0)
1166
+ badges.push(`\u{1F4DA} ${agent.skills.length} skills`);
1167
+ if (agent.mcpServers.length > 0)
1168
+ badges.push(`\u{1F527} ${agent.mcpServers.length} MCP`);
1169
+ if (agent.capabilities.length > 0)
1170
+ badges.push(`\u26A1 ${agent.capabilities.length} capabilities`);
1171
+ if (badges.length > 0) {
1172
+ console.log(a.dim(` ${badges.join(" \u2022 ")}`));
1173
+ }
1174
+ console.log("");
1175
+ }
1176
+ console.log(a.dim(`Total: ${agents.length} agents`));
1177
+ }
1178
+ async function showAgentInfo(agentId, options) {
1179
+ if (!agentId) {
1180
+ console.log(a.red("Error: Please specify an agent ID"));
1181
+ return;
1182
+ }
1183
+ const manager = await getPluginManager();
1184
+ const agent = manager.getAgent(agentId);
1185
+ if (!agent) {
1186
+ console.log(a.red(`Agent not found: ${agentId}`));
1187
+ return;
1188
+ }
1189
+ if (options.json) {
1190
+ console.log(JSON.stringify(agent, null, 2));
1191
+ return;
1192
+ }
1193
+ console.log("");
1194
+ console.log(a.bold(a.cyan(`\u{1F916} ${agent.name.en}`)));
1195
+ console.log(a.dim(`ID: ${agent.id}`));
1196
+ console.log("");
1197
+ console.log(a.bold("\u{1F4DD} Description"));
1198
+ console.log(a.dim(` ${agent.description.en}`));
1199
+ console.log("");
1200
+ console.log(a.bold("\u{1F3AD} Persona"));
1201
+ console.log(a.dim(` ${agent.persona.substring(0, 200)}${agent.persona.length > 200 ? "..." : ""}`));
1202
+ console.log("");
1203
+ if (agent.instructions) {
1204
+ console.log(a.bold("\u{1F4CB} Instructions"));
1205
+ const lines = agent.instructions.split("\n").slice(0, 5);
1206
+ for (const line of lines) {
1207
+ console.log(a.dim(` ${line}`));
1208
+ }
1209
+ if (agent.instructions.split("\n").length > 5) {
1210
+ console.log(a.dim(" ..."));
1211
+ }
1212
+ console.log("");
1213
+ }
1214
+ if (agent.skills.length > 0) {
1215
+ console.log(a.bold("\u{1F4DA} Skills"));
1216
+ for (const skill of agent.skills) {
1217
+ const plugin = manager.getPlugin(skill.pluginId);
1218
+ const name = plugin?.manifest.name.en || skill.pluginId;
1219
+ console.log(a.dim(` \u2022 ${name}`));
1220
+ }
1221
+ console.log("");
1222
+ }
1223
+ if (agent.mcpServers.length > 0) {
1224
+ console.log(a.bold("\u{1F527} MCP Servers"));
1225
+ for (const mcp of agent.mcpServers) {
1226
+ console.log(a.dim(` \u2022 ${mcp.serverName}`));
1227
+ if (mcp.tools && mcp.tools.length > 0) {
1228
+ console.log(a.dim(` Tools: ${mcp.tools.join(", ")}`));
1229
+ }
1230
+ }
1231
+ console.log("");
1232
+ }
1233
+ if (agent.capabilities.length > 0) {
1234
+ console.log(a.bold("\u26A1 Capabilities"));
1235
+ for (const cap of agent.capabilities) {
1236
+ console.log(a.dim(` \u2022 ${formatCapability(cap)}`));
1237
+ }
1238
+ console.log("");
1239
+ }
1240
+ if (agent.triggers && agent.triggers.length > 0) {
1241
+ console.log(a.bold("\u{1F3AF} Triggers"));
1242
+ for (const trigger of agent.triggers) {
1243
+ console.log(a.dim(` \u2022 ${trigger}`));
1244
+ }
1245
+ console.log("");
1246
+ }
1247
+ console.log(a.bold("\u{1F4AC} System Prompt Preview"));
1248
+ try {
1249
+ const runtime = await getAgentRuntime(agentId);
1250
+ const prompt = runtime.getSystemPrompt();
1251
+ const lines = prompt.split("\n").slice(0, 10);
1252
+ for (const line of lines) {
1253
+ console.log(a.dim(` ${line}`));
1254
+ }
1255
+ console.log(a.dim(" ..."));
1256
+ } catch {
1257
+ console.log(a.dim(" (Unable to generate preview)"));
1258
+ }
1259
+ }
1260
+ async function removeAgent(agentId) {
1261
+ if (!agentId) {
1262
+ console.log(a.red("Error: Please specify an agent ID"));
1263
+ return;
1264
+ }
1265
+ const manager = await getPluginManager();
1266
+ const agent = manager.getAgent(agentId);
1267
+ if (!agent) {
1268
+ console.log(a.red(`Agent not found: ${agentId}`));
1269
+ return;
1270
+ }
1271
+ console.log(a.yellow(`
1272
+ \u26A0\uFE0F Removing agent: ${agent.name.en}`));
1273
+ console.log(a.red("Agent removal not yet implemented"));
1274
+ }
1275
+ async function runAgent(agentId, task) {
1276
+ if (!agentId) {
1277
+ console.log(a.red("Error: Please specify an agent ID"));
1278
+ return;
1279
+ }
1280
+ const manager = await getPluginManager();
1281
+ const agent = manager.getAgent(agentId);
1282
+ if (!agent) {
1283
+ console.log(a.red(`Agent not found: ${agentId}`));
1284
+ return;
1285
+ }
1286
+ console.log(a.cyan(`
1287
+ \u{1F916} Starting agent: ${agent.name.en}
1288
+ `));
1289
+ try {
1290
+ const runtime = await getAgentRuntime(agentId);
1291
+ console.log(a.bold("System Prompt:"));
1292
+ console.log(a.dim("\u2500".repeat(60)));
1293
+ console.log(a.dim(runtime.getSystemPrompt()));
1294
+ console.log(a.dim("\u2500".repeat(60)));
1295
+ console.log("");
1296
+ if (task) {
1297
+ runtime.setTask(task);
1298
+ console.log(a.bold("Task:"));
1299
+ console.log(a.dim(task));
1300
+ console.log("");
1301
+ }
1302
+ const skillContent = runtime.getSkillContent();
1303
+ if (skillContent) {
1304
+ console.log(a.bold("Skill Knowledge:"));
1305
+ console.log(a.dim("\u2500".repeat(60)));
1306
+ const lines = skillContent.split("\n").slice(0, 20);
1307
+ for (const line of lines) {
1308
+ console.log(a.dim(line));
1309
+ }
1310
+ if (skillContent.split("\n").length > 20) {
1311
+ console.log(a.dim("... (truncated)"));
1312
+ }
1313
+ console.log(a.dim("\u2500".repeat(60)));
1314
+ }
1315
+ console.log("");
1316
+ console.log(a.green("\u2705 Agent ready!"));
1317
+ console.log(a.dim("The system prompt and skill knowledge above can be used with Claude."));
1318
+ } catch (error) {
1319
+ console.log(a.red(`\u274C Failed to start agent: ${error instanceof Error ? error.message : error}`));
1320
+ }
1321
+ }
1322
+ async function listTemplates(options) {
1323
+ const creator = getAgentCreator();
1324
+ const templates = creator.listTemplates();
1325
+ if (options.json) {
1326
+ console.log(JSON.stringify(templates, null, 2));
1327
+ return;
1328
+ }
1329
+ console.log(a.cyan("\n\u{1F4CB} Available Agent Templates\n"));
1330
+ const templateInfo = {
1331
+ "code-assistant": {
1332
+ name: "Code Assistant",
1333
+ description: "General-purpose coding assistant",
1334
+ capabilities: ["code-generation", "code-review", "debugging", "refactoring"]
1335
+ },
1336
+ "git-master": {
1337
+ name: "Git Master",
1338
+ description: "Expert Git operations assistant",
1339
+ capabilities: ["git-operations"]
1340
+ },
1341
+ "test-engineer": {
1342
+ name: "Test Engineer",
1343
+ description: "Testing and quality assurance specialist",
1344
+ capabilities: ["testing", "code-review"]
1345
+ },
1346
+ "devops-engineer": {
1347
+ name: "DevOps Engineer",
1348
+ description: "DevOps and deployment specialist",
1349
+ capabilities: ["deployment", "file-management"]
1350
+ },
1351
+ "full-stack": {
1352
+ name: "Full Stack Developer",
1353
+ description: "Full stack development assistant",
1354
+ capabilities: ["code-generation", "code-review", "testing", "documentation", "deployment"]
1355
+ }
1356
+ };
1357
+ for (const templateId of templates) {
1358
+ const info = templateInfo[templateId];
1359
+ if (info) {
1360
+ console.log(` ${a.bold(info.name)} ${a.dim(`(${templateId})`)}`);
1361
+ console.log(a.dim(` ${info.description}`));
1362
+ console.log(a.dim(` Capabilities: ${info.capabilities.join(", ")}`));
1363
+ console.log("");
1364
+ } else {
1365
+ console.log(` ${a.bold(templateId)}`);
1366
+ console.log("");
1367
+ }
1368
+ }
1369
+ console.log(a.dim("Create an agent from template:"));
1370
+ console.log(a.dim(" agent create my-assistant --template code-assistant"));
1371
+ }
1372
+ function formatCapability(cap) {
1373
+ const labels = {
1374
+ "code-generation": "Code Generation",
1375
+ "code-review": "Code Review",
1376
+ "testing": "Testing",
1377
+ "documentation": "Documentation",
1378
+ "deployment": "Deployment",
1379
+ "debugging": "Debugging",
1380
+ "refactoring": "Refactoring",
1381
+ "git-operations": "Git Operations",
1382
+ "file-management": "File Management",
1383
+ "web-search": "Web Search",
1384
+ "api-integration": "API Integration"
1385
+ };
1386
+ return labels[cap] || cap;
1387
+ }
1388
+ function showAgentHelp() {
1389
+ console.log(`
1390
+ ${a.bold(a.cyan("\u{1F916} Agent Command"))}
1391
+
1392
+ ${a.bold("Usage:")}
1393
+ agent <command> [options]
1394
+
1395
+ ${a.bold("Commands:")}
1396
+ ${a.green("create")} <name> Create a new agent
1397
+ ${a.green("list")} List all agents
1398
+ ${a.green("info")} <id> Show agent details
1399
+ ${a.green("remove")} <id> Remove an agent
1400
+ ${a.green("run")} <id> [task] Run an agent
1401
+ ${a.green("templates")} List available templates
1402
+
1403
+ ${a.bold("Options:")}
1404
+ --template <id> Use a template (code-assistant, git-master, etc.)
1405
+ --skills <ids> Comma-separated skill IDs to include
1406
+ --mcp <servers> Comma-separated MCP server names
1407
+ --persona <text> Custom persona for the agent
1408
+ --json Output as JSON
1409
+
1410
+ ${a.bold("Examples:")}
1411
+ ${a.dim("# Create from template")}
1412
+ agent create my-assistant --template code-assistant
1413
+
1414
+ ${a.dim("# Create with specific skills")}
1415
+ agent create reviewer --skills code-reviewer,react-best-practices
1416
+
1417
+ ${a.dim("# Create with MCP servers")}
1418
+ agent create deployer --mcp vercel,github --skills vercel-deploy
1419
+
1420
+ ${a.dim("# List all agents")}
1421
+ agent list
1422
+
1423
+ ${a.dim("# Run an agent")}
1424
+ agent run my-assistant "Review this code"
1425
+
1426
+ ${a.bold("Agent Composition:")}
1427
+ Agents combine Skills (knowledge) + MCP (tools) + Persona (behavior)
1428
+
1429
+ \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
1430
+ \u2502 Agent \u2502
1431
+ \u2502 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502
1432
+ \u2502 \u2502 Skills \u2502 +\u2502 MCP \u2502 +\u2502 Persona \u2502 \u2502
1433
+ \u2502 \u2502(\u77E5\u8BC6\u5E93) \u2502 \u2502 (\u5DE5\u5177) \u2502 \u2502 (\u884C\u4E3A) \u2502 \u2502
1434
+ \u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502
1435
+ \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
1436
+ `);
1437
+ }
1438
+
1439
+ export { handleAgentCommand as default, handleAgentCommand };