ccjk 12.0.7 → 12.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/package.json +1 -1
  2. package/dist/chunks/agent-teams.mjs +0 -136
  3. package/dist/chunks/agent.mjs +0 -1439
  4. package/dist/chunks/agents.mjs +0 -3778
  5. package/dist/chunks/api-cli.mjs +0 -132
  6. package/dist/chunks/api-providers.mjs +0 -129
  7. package/dist/chunks/api.mjs +0 -112
  8. package/dist/chunks/auto-bootstrap.mjs +0 -358
  9. package/dist/chunks/auto-init.mjs +0 -7584
  10. package/dist/chunks/auto-updater.mjs +0 -410
  11. package/dist/chunks/banner.mjs +0 -188
  12. package/dist/chunks/bash.mjs +0 -187
  13. package/dist/chunks/boost.mjs +0 -397
  14. package/dist/chunks/ccjk-agents.mjs +0 -414
  15. package/dist/chunks/ccjk-all.mjs +0 -1028
  16. package/dist/chunks/ccjk-config.mjs +0 -261
  17. package/dist/chunks/ccjk-hooks.mjs +0 -1074
  18. package/dist/chunks/ccjk-mcp.mjs +0 -761
  19. package/dist/chunks/ccjk-setup.mjs +0 -763
  20. package/dist/chunks/ccjk-skills.mjs +0 -514
  21. package/dist/chunks/ccr.mjs +0 -98
  22. package/dist/chunks/ccu.mjs +0 -40
  23. package/dist/chunks/check-updates.mjs +0 -108
  24. package/dist/chunks/claude-code-config-manager.mjs +0 -750
  25. package/dist/chunks/claude-code-incremental-manager.mjs +0 -623
  26. package/dist/chunks/claude-config.mjs +0 -236
  27. package/dist/chunks/claude-wrapper.mjs +0 -85
  28. package/dist/chunks/cleanup-migration.mjs +0 -20
  29. package/dist/chunks/cli-hook.mjs +0 -2285
  30. package/dist/chunks/cloud-sync.mjs +0 -29
  31. package/dist/chunks/codex-config-switch.mjs +0 -451
  32. package/dist/chunks/codex-provider-manager.mjs +0 -236
  33. package/dist/chunks/codex-uninstaller.mjs +0 -404
  34. package/dist/chunks/codex.mjs +0 -2077
  35. package/dist/chunks/commands.mjs +0 -108
  36. package/dist/chunks/commands2.mjs +0 -413
  37. package/dist/chunks/commit.mjs +0 -138
  38. package/dist/chunks/completion.mjs +0 -515
  39. package/dist/chunks/config-consolidator.mjs +0 -172
  40. package/dist/chunks/config-switch.mjs +0 -317
  41. package/dist/chunks/config.mjs +0 -379
  42. package/dist/chunks/config2.mjs +0 -477
  43. package/dist/chunks/config3.mjs +0 -470
  44. package/dist/chunks/constants.mjs +0 -133
  45. package/dist/chunks/context-loader.mjs +0 -343
  46. package/dist/chunks/context.mjs +0 -372
  47. package/dist/chunks/convoy-manager.mjs +0 -880
  48. package/dist/chunks/dashboard.mjs +0 -476
  49. package/dist/chunks/doctor.mjs +0 -964
  50. package/dist/chunks/evolution.mjs +0 -382
  51. package/dist/chunks/features.mjs +0 -698
  52. package/dist/chunks/fish.mjs +0 -181
  53. package/dist/chunks/fs-operations.mjs +0 -192
  54. package/dist/chunks/health-alerts.mjs +0 -304
  55. package/dist/chunks/health-check.mjs +0 -532
  56. package/dist/chunks/help.mjs +0 -340
  57. package/dist/chunks/hook-installer.mjs +0 -45
  58. package/dist/chunks/index.mjs +0 -24
  59. package/dist/chunks/index10.mjs +0 -1171
  60. package/dist/chunks/index11.mjs +0 -1008
  61. package/dist/chunks/index12.mjs +0 -193
  62. package/dist/chunks/index13.mjs +0 -218
  63. package/dist/chunks/index14.mjs +0 -663
  64. package/dist/chunks/index2.mjs +0 -19
  65. package/dist/chunks/index3.mjs +0 -19092
  66. package/dist/chunks/index4.mjs +0 -8
  67. package/dist/chunks/index5.mjs +0 -7600
  68. package/dist/chunks/index6.mjs +0 -171
  69. package/dist/chunks/index7.mjs +0 -3583
  70. package/dist/chunks/index8.mjs +0 -19
  71. package/dist/chunks/index9.mjs +0 -616
  72. package/dist/chunks/init.mjs +0 -1606
  73. package/dist/chunks/installer.mjs +0 -690
  74. package/dist/chunks/installer2.mjs +0 -179
  75. package/dist/chunks/interview.mjs +0 -2927
  76. package/dist/chunks/json-config.mjs +0 -60
  77. package/dist/chunks/linux.mjs +0 -3863
  78. package/dist/chunks/macos.mjs +0 -69
  79. package/dist/chunks/main.mjs +0 -635
  80. package/dist/chunks/manager.mjs +0 -1048
  81. package/dist/chunks/marketplace.mjs +0 -949
  82. package/dist/chunks/mcp-cli.mjs +0 -204
  83. package/dist/chunks/mcp-performance.mjs +0 -187
  84. package/dist/chunks/mcp.mjs +0 -1231
  85. package/dist/chunks/menu.mjs +0 -652
  86. package/dist/chunks/metrics-display.mjs +0 -153
  87. package/dist/chunks/migrator.mjs +0 -178
  88. package/dist/chunks/monitor.mjs +0 -1856
  89. package/dist/chunks/notification.mjs +0 -1864
  90. package/dist/chunks/onboarding.mjs +0 -385
  91. package/dist/chunks/package.mjs +0 -3
  92. package/dist/chunks/paradigm.mjs +0 -74
  93. package/dist/chunks/permission-manager.mjs +0 -132
  94. package/dist/chunks/permissions.mjs +0 -265
  95. package/dist/chunks/persistence-manager.mjs +0 -794
  96. package/dist/chunks/persistence.mjs +0 -667
  97. package/dist/chunks/platform.mjs +0 -391
  98. package/dist/chunks/plugin.mjs +0 -1936
  99. package/dist/chunks/powershell.mjs +0 -213
  100. package/dist/chunks/prompts.mjs +0 -241
  101. package/dist/chunks/providers.mjs +0 -260
  102. package/dist/chunks/quick-actions.mjs +0 -320
  103. package/dist/chunks/quick-provider.mjs +0 -682
  104. package/dist/chunks/quick-setup.mjs +0 -412
  105. package/dist/chunks/remote.mjs +0 -497
  106. package/dist/chunks/session.mjs +0 -878
  107. package/dist/chunks/sessions.mjs +0 -106
  108. package/dist/chunks/silent-updater.mjs +0 -396
  109. package/dist/chunks/simple-config.mjs +0 -98
  110. package/dist/chunks/skill.mjs +0 -117
  111. package/dist/chunks/skill2.mjs +0 -9003
  112. package/dist/chunks/skills-sync.mjs +0 -6460
  113. package/dist/chunks/skills.mjs +0 -567
  114. package/dist/chunks/slash-commands.mjs +0 -207
  115. package/dist/chunks/smart-defaults.mjs +0 -412
  116. package/dist/chunks/smart-guide.mjs +0 -194
  117. package/dist/chunks/startup.mjs +0 -487
  118. package/dist/chunks/stats.mjs +0 -410
  119. package/dist/chunks/status.mjs +0 -289
  120. package/dist/chunks/team.mjs +0 -63
  121. package/dist/chunks/thinking.mjs +0 -626
  122. package/dist/chunks/trace.mjs +0 -57
  123. package/dist/chunks/uninstall.mjs +0 -849
  124. package/dist/chunks/update.mjs +0 -167
  125. package/dist/chunks/upgrade-manager.mjs +0 -204
  126. package/dist/chunks/version-checker.mjs +0 -881
  127. package/dist/chunks/vim.mjs +0 -903
  128. package/dist/chunks/windows.mjs +0 -14
  129. package/dist/chunks/workflows.mjs +0 -633
  130. package/dist/chunks/wsl.mjs +0 -129
  131. package/dist/chunks/zero-config.mjs +0 -374
  132. package/dist/chunks/zsh.mjs +0 -182
  133. package/dist/cli.d.mts +0 -1
  134. package/dist/cli.d.ts +0 -1
  135. package/dist/cli.mjs +0 -2199
  136. package/dist/i18n/locales/en/agent-teams.json +0 -18
  137. package/dist/i18n/locales/en/agentBrowser.json +0 -79
  138. package/dist/i18n/locales/en/agents.json +0 -135
  139. package/dist/i18n/locales/en/api.json +0 -63
  140. package/dist/i18n/locales/en/ccjk-agents.json +0 -33
  141. package/dist/i18n/locales/en/ccjk-all.json +0 -23
  142. package/dist/i18n/locales/en/ccjk-skills.json +0 -22
  143. package/dist/i18n/locales/en/ccjk.json +0 -276
  144. package/dist/i18n/locales/en/ccr.json +0 -65
  145. package/dist/i18n/locales/en/claude-md.json +0 -73
  146. package/dist/i18n/locales/en/cli.json +0 -152
  147. package/dist/i18n/locales/en/cloud-setup.json +0 -31
  148. package/dist/i18n/locales/en/cloud-sync.json +0 -147
  149. package/dist/i18n/locales/en/cloud.json +0 -40
  150. package/dist/i18n/locales/en/cloudPlugins.json +0 -118
  151. package/dist/i18n/locales/en/codex.json +0 -127
  152. package/dist/i18n/locales/en/cometix.json +0 -29
  153. package/dist/i18n/locales/en/common.json +0 -68
  154. package/dist/i18n/locales/en/config.json +0 -108
  155. package/dist/i18n/locales/en/configuration.json +0 -226
  156. package/dist/i18n/locales/en/context.json +0 -85
  157. package/dist/i18n/locales/en/dashboard.json +0 -78
  158. package/dist/i18n/locales/en/errors.json +0 -26
  159. package/dist/i18n/locales/en/evolution.json +0 -54
  160. package/dist/i18n/locales/en/hooks.json +0 -74
  161. package/dist/i18n/locales/en/hooksSync.json +0 -133
  162. package/dist/i18n/locales/en/installation.json +0 -83
  163. package/dist/i18n/locales/en/interview.json +0 -104
  164. package/dist/i18n/locales/en/language.json +0 -19
  165. package/dist/i18n/locales/en/lsp.json +0 -78
  166. package/dist/i18n/locales/en/marketplace.json +0 -116
  167. package/dist/i18n/locales/en/mcp.json +0 -178
  168. package/dist/i18n/locales/en/memory.json +0 -92
  169. package/dist/i18n/locales/en/menu.json +0 -143
  170. package/dist/i18n/locales/en/multi-config.json +0 -79
  171. package/dist/i18n/locales/en/notification.json +0 -307
  172. package/dist/i18n/locales/en/permissions.json +0 -95
  173. package/dist/i18n/locales/en/persistence.json +0 -127
  174. package/dist/i18n/locales/en/plugins.json +0 -146
  175. package/dist/i18n/locales/en/quick-actions.json +0 -78
  176. package/dist/i18n/locales/en/registry.json +0 -54
  177. package/dist/i18n/locales/en/remote.json +0 -93
  178. package/dist/i18n/locales/en/sandbox.json +0 -44
  179. package/dist/i18n/locales/en/setup.json +0 -44
  180. package/dist/i18n/locales/en/shencha.json +0 -14
  181. package/dist/i18n/locales/en/skills.json +0 -100
  182. package/dist/i18n/locales/en/skillsSync.json +0 -74
  183. package/dist/i18n/locales/en/smartGuide.json +0 -49
  184. package/dist/i18n/locales/en/stats.json +0 -20
  185. package/dist/i18n/locales/en/subagent.json +0 -69
  186. package/dist/i18n/locales/en/superpowers.json +0 -117
  187. package/dist/i18n/locales/en/team.json +0 -7
  188. package/dist/i18n/locales/en/thinking.json +0 -65
  189. package/dist/i18n/locales/en/tools.json +0 -42
  190. package/dist/i18n/locales/en/uninstall.json +0 -56
  191. package/dist/i18n/locales/en/updater.json +0 -29
  192. package/dist/i18n/locales/en/vim.json +0 -169
  193. package/dist/i18n/locales/en/workflow.json +0 -55
  194. package/dist/i18n/locales/en/workspace.json +0 -108
  195. package/dist/i18n/locales/zh-CN/agent-teams.json +0 -18
  196. package/dist/i18n/locales/zh-CN/agentBrowser.json +0 -79
  197. package/dist/i18n/locales/zh-CN/agents.json +0 -135
  198. package/dist/i18n/locales/zh-CN/api.json +0 -63
  199. package/dist/i18n/locales/zh-CN/ccjk-agents.json +0 -33
  200. package/dist/i18n/locales/zh-CN/ccjk-all.json +0 -23
  201. package/dist/i18n/locales/zh-CN/ccjk-skills.json +0 -22
  202. package/dist/i18n/locales/zh-CN/ccjk.json +0 -276
  203. package/dist/i18n/locales/zh-CN/ccr.json +0 -65
  204. package/dist/i18n/locales/zh-CN/claude-md.json +0 -73
  205. package/dist/i18n/locales/zh-CN/cli.json +0 -152
  206. package/dist/i18n/locales/zh-CN/cloud-setup.json +0 -31
  207. package/dist/i18n/locales/zh-CN/cloud-sync.json +0 -147
  208. package/dist/i18n/locales/zh-CN/cloud.json +0 -40
  209. package/dist/i18n/locales/zh-CN/cloudPlugins.json +0 -118
  210. package/dist/i18n/locales/zh-CN/codex.json +0 -127
  211. package/dist/i18n/locales/zh-CN/cometix.json +0 -29
  212. package/dist/i18n/locales/zh-CN/common.json +0 -68
  213. package/dist/i18n/locales/zh-CN/config.json +0 -108
  214. package/dist/i18n/locales/zh-CN/configuration.json +0 -224
  215. package/dist/i18n/locales/zh-CN/context.json +0 -85
  216. package/dist/i18n/locales/zh-CN/dashboard.json +0 -78
  217. package/dist/i18n/locales/zh-CN/errors.json +0 -26
  218. package/dist/i18n/locales/zh-CN/evolution.json +0 -54
  219. package/dist/i18n/locales/zh-CN/hooks.json +0 -74
  220. package/dist/i18n/locales/zh-CN/hooksSync.json +0 -133
  221. package/dist/i18n/locales/zh-CN/installation.json +0 -83
  222. package/dist/i18n/locales/zh-CN/interview.json +0 -104
  223. package/dist/i18n/locales/zh-CN/language.json +0 -19
  224. package/dist/i18n/locales/zh-CN/lsp.json +0 -78
  225. package/dist/i18n/locales/zh-CN/marketplace.json +0 -116
  226. package/dist/i18n/locales/zh-CN/mcp.json +0 -178
  227. package/dist/i18n/locales/zh-CN/memory.json +0 -92
  228. package/dist/i18n/locales/zh-CN/menu.json +0 -143
  229. package/dist/i18n/locales/zh-CN/multi-config.json +0 -79
  230. package/dist/i18n/locales/zh-CN/notification.json +0 -307
  231. package/dist/i18n/locales/zh-CN/permissions.json +0 -95
  232. package/dist/i18n/locales/zh-CN/persistence.json +0 -127
  233. package/dist/i18n/locales/zh-CN/plugins.json +0 -146
  234. package/dist/i18n/locales/zh-CN/quick-actions.json +0 -78
  235. package/dist/i18n/locales/zh-CN/registry.json +0 -54
  236. package/dist/i18n/locales/zh-CN/remote.json +0 -93
  237. package/dist/i18n/locales/zh-CN/sandbox.json +0 -44
  238. package/dist/i18n/locales/zh-CN/setup.json +0 -44
  239. package/dist/i18n/locales/zh-CN/shencha.json +0 -14
  240. package/dist/i18n/locales/zh-CN/skills.json +0 -100
  241. package/dist/i18n/locales/zh-CN/skillsSync.json +0 -74
  242. package/dist/i18n/locales/zh-CN/smartGuide.json +0 -49
  243. package/dist/i18n/locales/zh-CN/stats.json +0 -20
  244. package/dist/i18n/locales/zh-CN/subagent.json +0 -69
  245. package/dist/i18n/locales/zh-CN/superpowers.json +0 -117
  246. package/dist/i18n/locales/zh-CN/team.json +0 -7
  247. package/dist/i18n/locales/zh-CN/thinking.json +0 -65
  248. package/dist/i18n/locales/zh-CN/tools.json +0 -42
  249. package/dist/i18n/locales/zh-CN/uninstall.json +0 -56
  250. package/dist/i18n/locales/zh-CN/updater.json +0 -29
  251. package/dist/i18n/locales/zh-CN/vim.json +0 -169
  252. package/dist/i18n/locales/zh-CN/workflow.json +0 -55
  253. package/dist/i18n/locales/zh-CN/workspace.json +0 -108
  254. package/dist/index.d.mts +0 -5295
  255. package/dist/index.d.ts +0 -5295
  256. package/dist/index.mjs +0 -4941
  257. package/dist/shared/ccjk.B364Fu0N.mjs +0 -1819
  258. package/dist/shared/ccjk.BAGoDD49.mjs +0 -36
  259. package/dist/shared/ccjk.BBtCGd_g.mjs +0 -899
  260. package/dist/shared/ccjk.BFQ7yr5S.mjs +0 -16
  261. package/dist/shared/ccjk.BFxsJM0k.mjs +0 -599
  262. package/dist/shared/ccjk.BIxuVL3_.mjs +0 -25
  263. package/dist/shared/ccjk.BRZ9ww8S.mjs +0 -142
  264. package/dist/shared/ccjk.BoApaI4j.mjs +0 -28
  265. package/dist/shared/ccjk.BrPUmTqm.mjs +0 -266
  266. package/dist/shared/ccjk.BtB1e5jm.mjs +0 -171
  267. package/dist/shared/ccjk.BwfbSKN2.mjs +0 -1051
  268. package/dist/shared/ccjk.BxSmJ8B7.mjs +0 -243
  269. package/dist/shared/ccjk.Bx_rmYfN.mjs +0 -69
  270. package/dist/shared/ccjk.C2jHOZVP.mjs +0 -52
  271. package/dist/shared/ccjk.CL4Yat0G.mjs +0 -303
  272. package/dist/shared/ccjk.COweQ1RR.mjs +0 -5
  273. package/dist/shared/ccjk.CePkJq2S.mjs +0 -223
  274. package/dist/shared/ccjk.CfKKcvWy.mjs +0 -126
  275. package/dist/shared/ccjk.Cjgrln_h.mjs +0 -297
  276. package/dist/shared/ccjk.Cjj8SVrn.mjs +0 -54
  277. package/dist/shared/ccjk.CxpGa6MC.mjs +0 -2724
  278. package/dist/shared/ccjk.D5MFQT7w.mjs +0 -400
  279. package/dist/shared/ccjk.D6ycHbak.mjs +0 -270
  280. package/dist/shared/ccjk.D8ZLYSZZ.mjs +0 -299
  281. package/dist/shared/ccjk.DG_o24cZ.mjs +0 -88
  282. package/dist/shared/ccjk.DLLw-h4Y.mjs +0 -460
  283. package/dist/shared/ccjk.DOwtZMk8.mjs +0 -4019
  284. package/dist/shared/ccjk.DS7UESmF.mjs +0 -2451
  285. package/dist/shared/ccjk.DTdjs-qK.mjs +0 -1447
  286. package/dist/shared/ccjk.DXRAZcix.mjs +0 -66
  287. package/dist/shared/ccjk.DsYaCCx4.mjs +0 -317
  288. package/dist/shared/ccjk.J8YiPsOw.mjs +0 -259
  289. package/dist/shared/ccjk.KfSWcGlE.mjs +0 -38
  290. package/dist/shared/ccjk.RyizuzOI.mjs +0 -21
  291. package/dist/shared/ccjk.SPoXMvZD.mjs +0 -1242
  292. package/dist/shared/ccjk.T_cX87dY.mjs +0 -15
  293. package/dist/shared/ccjk.UIvifqNE.mjs +0 -1486
  294. package/dist/shared/ccjk._dESH4Rk.mjs +0 -111
  295. package/dist/shared/ccjk.bQ7Dh1g4.mjs +0 -249
  296. package/dist/shared/ccjk.c-ETfBZ_.mjs +0 -617
  297. package/dist/shared/ccjk.gDEDGD_t.mjs +0 -38
  298. package/dist/shared/ccjk.hoqrwWdN.mjs +0 -333
  299. package/dist/shared/ccjk.waa2ikKJ.mjs +0 -351
@@ -1,1028 +0,0 @@
1
- import a from './index2.mjs';
2
- import { c as consola } from '../shared/ccjk.UIvifqNE.mjs';
3
- import { c as createCompleteCloudClient } from '../shared/ccjk.B364Fu0N.mjs';
4
- import { i18n, ensureI18nInitialized } from './index5.mjs';
5
- import { createHash } from 'node:crypto';
6
- import { promises, readFileSync } from 'node:fs';
7
- import { join } from 'node:path';
8
- import { a as analyzeProject } from '../shared/ccjk.DS7UESmF.mjs';
9
- import { c as createDefaultGateway } from '../shared/ccjk.BtB1e5jm.mjs';
10
- import { ccjkAgents } from './ccjk-agents.mjs';
11
- import { ccjkHooks } from './ccjk-hooks.mjs';
12
- import { ccjkMcp } from './ccjk-mcp.mjs';
13
- import { ccjkSkills } from './ccjk-skills.mjs';
14
- import { e as extractString } from '../shared/ccjk.C2jHOZVP.mjs';
15
- import '../shared/ccjk.BAGoDD49.mjs';
16
- import 'node:url';
17
- import 'node:process';
18
- import '../shared/ccjk.bQ7Dh1g4.mjs';
19
- import './index8.mjs';
20
- import 'tinyglobby';
21
- import '../shared/ccjk.BBtCGd_g.mjs';
22
- import './constants.mjs';
23
- import 'node:os';
24
- import '../shared/ccjk.D6ycHbak.mjs';
25
- import '../shared/ccjk.CfKKcvWy.mjs';
26
- import 'node:perf_hooks';
27
- import './index3.mjs';
28
- import 'node:readline';
29
- import 'stream';
30
- import 'node:tty';
31
- import 'node:async_hooks';
32
- import '../shared/ccjk.Cjgrln_h.mjs';
33
- import 'node:util';
34
- import 'tty';
35
- import 'fs';
36
- import 'child_process';
37
- import 'buffer';
38
- import 'string_decoder';
39
- import 'node:child_process';
40
- import './claude-config.mjs';
41
- import './json-config.mjs';
42
- import '../shared/ccjk.RyizuzOI.mjs';
43
- import './fs-operations.mjs';
44
- import 'node:fs/promises';
45
- import './platform.mjs';
46
- import './main.mjs';
47
- import 'module';
48
- import 'node:stream';
49
- import '../shared/ccjk.DsYaCCx4.mjs';
50
-
51
- const packageJson = JSON.parse(readFileSync(join(process.cwd(), "package.json"), "utf-8"));
52
- const CCJK_VERSION = packageJson.version;
53
- class CloudSetupOrchestrator {
54
- gateway;
55
- logger = consola.withTag("cloud-setup");
56
- startTime = Date.now();
57
- constructor(options = {}) {
58
- this.gateway = createDefaultGateway();
59
- }
60
- /**
61
- * Execute cloud-powered setup
62
- */
63
- async executeCloudSetup(options) {
64
- this.logger.info("Starting cloud-powered setup");
65
- try {
66
- const analysis = await this.analyzeProject(options);
67
- const recommendations = await this.getCloudRecommendations(analysis, options);
68
- if (options.interactive !== false) {
69
- await this.displayRecommendationInsights(recommendations, options);
70
- }
71
- const confirmed = await this.getUserConfirmation(recommendations, options);
72
- if (!confirmed) {
73
- return {
74
- success: false,
75
- requestId: recommendations.insights ? "user-cancelled" : "no-recommendations",
76
- confidence: recommendations.confidence || 0,
77
- installed: { skills: [], mcpServices: [], agents: [], hooks: [] },
78
- skipped: { skills: [], mcpServices: [], agents: [], hooks: [] },
79
- failed: { skills: [], mcpServices: [], agents: [], hooks: [] },
80
- duration: Date.now() - this.startTime
81
- };
82
- }
83
- const templates = await this.downloadTemplates(recommendations, options);
84
- const result = await this.executeInstallation(recommendations, templates, options);
85
- if (options.submitTelemetry !== false) {
86
- this.uploadTelemetry(result).catch(() => {
87
- });
88
- }
89
- if (options.generateReport) {
90
- result.reportPath = await this.generateReport(result, recommendations, options);
91
- }
92
- return result;
93
- } catch (error) {
94
- this.logger.error("Cloud setup failed:", error);
95
- throw error;
96
- }
97
- }
98
- /**
99
- * Analyze project with deep inspection
100
- */
101
- async analyzeProject(options) {
102
- if (options.interactive !== false) {
103
- console.log(a.bold(`
104
- ${i18n.t("cloud-setup:analyzingProject")}`));
105
- }
106
- const analysis = await analyzeProject(options.targetDir || process.cwd(), {
107
- analyzeTransitiveDeps: true
108
- // Use default maxFilesToScan of 10000 for better large project support
109
- });
110
- this.generateProjectFingerprint(analysis);
111
- if (options.interactive !== false) {
112
- this.displayProjectInfo(analysis);
113
- }
114
- return analysis;
115
- }
116
- /**
117
- * Generate project fingerprint
118
- */
119
- generateProjectFingerprint(analysis) {
120
- const hash = createHash("sha256");
121
- const directDeps = analysis.dependencies?.direct || [];
122
- const depNames = directDeps.map((d) => d.name).join(",");
123
- const devDepNames = directDeps.filter((d) => d.isDev).map((d) => d.name).join(",");
124
- const frameworkNames = analysis.frameworks?.map((f) => f.name).join(",") || "";
125
- const languageNames = analysis.languages?.map((l) => l.language).join(",") || "";
126
- hash.update(depNames);
127
- hash.update(devDepNames);
128
- hash.update(analysis.projectType || "");
129
- hash.update(frameworkNames);
130
- hash.update(languageNames);
131
- return hash.digest("hex");
132
- }
133
- /**
134
- * Display project information
135
- */
136
- displayProjectInfo(analysis) {
137
- console.log(` ${a.dim(i18n.t("cloud-setup:projectType"))}: ${analysis.projectType}`);
138
- if (analysis.frameworks.length > 0) {
139
- console.log(` ${a.dim(i18n.t("cloud-setup:frameworks"))}: ${analysis.frameworks.map((f) => f.name).join(", ")}`);
140
- }
141
- if (analysis.languages.length > 0) {
142
- console.log(` ${a.dim(i18n.t("cloud-setup:languages"))}: ${analysis.languages.map((l) => l.language).join(", ")}`);
143
- }
144
- }
145
- /**
146
- * Get recommendations from cloud
147
- */
148
- async getCloudRecommendations(analysis, options) {
149
- if (options.useCloud === false) {
150
- return this.getLocalRecommendations(analysis);
151
- }
152
- if (options.interactive !== false) {
153
- console.log(`
154
- ${a.bold(i18n.t("cloud-setup:gettingRecommendations"))}`);
155
- }
156
- const request = {
157
- projectRoot: options.targetDir || process.cwd(),
158
- language: options.lang,
159
- ccjkVersion: CCJK_VERSION
160
- };
161
- if (analysis.dependencies?.direct && analysis.dependencies.direct.length > 0) {
162
- const deps = {};
163
- const devDeps = {};
164
- for (const dep of analysis.dependencies.direct) {
165
- if (dep.isDev) {
166
- devDeps[dep.name] = dep.version || "*";
167
- } else {
168
- deps[dep.name] = dep.version || "*";
169
- }
170
- }
171
- if (Object.keys(deps).length > 0) {
172
- request.dependencies = deps;
173
- }
174
- if (Object.keys(devDeps).length > 0) {
175
- request.devDependencies = devDeps;
176
- }
177
- }
178
- try {
179
- const response = await this.gateway.request(
180
- "analysis.projects",
181
- {
182
- method: "POST",
183
- body: request,
184
- timeout: 1e4
185
- // 10s timeout for cloud analysis
186
- }
187
- );
188
- if (!response.success || !response.data) {
189
- this.logger.warn("Cloud API returned error:", response.error);
190
- return this.getLocalRecommendations(analysis);
191
- }
192
- const data = response.data;
193
- const fingerprint = this.generateProjectFingerprint(analysis);
194
- const recommendations = {
195
- skills: data.recommendations.filter((r) => r.category === "skill"),
196
- mcpServices: data.recommendations.filter((r) => r.category === "mcp"),
197
- agents: data.recommendations.filter((r) => r.category === "agent"),
198
- hooks: data.recommendations.filter((r) => r.category === "hook"),
199
- confidence: this.calculateConfidence(data.recommendations),
200
- fingerprint,
201
- insights: this.extractInsights(data)
202
- };
203
- return recommendations;
204
- } catch (_error) {
205
- this.logger.warn("Failed to get cloud recommendations, using local fallback");
206
- return this.getLocalRecommendations(analysis);
207
- }
208
- }
209
- /**
210
- * Check if a dependency exists in the analysis
211
- * Handles both Map<string, DependencyInfo> and DependencyNode[] formats
212
- */
213
- hasDependency(analysis, name, isDev = false) {
214
- const deps = analysis.dependencies;
215
- if (!deps)
216
- return false;
217
- if (Array.isArray(deps.direct)) {
218
- const nodeList = deps.direct;
219
- return nodeList.some((d) => d.name === name && (isDev ? d.isDev : !d.isDev));
220
- }
221
- return false;
222
- }
223
- /**
224
- * Check if a framework is detected in the analysis
225
- */
226
- hasFramework(analysis, name) {
227
- if (!analysis.frameworks)
228
- return false;
229
- if (Array.isArray(analysis.frameworks) && analysis.frameworks.length > 0) {
230
- const first = analysis.frameworks[0];
231
- if (typeof first === "object" && "name" in first) {
232
- return analysis.frameworks.some((f) => f.name?.toLowerCase() === name.toLowerCase());
233
- }
234
- if (typeof first === "string") {
235
- return analysis.frameworks.includes(name);
236
- }
237
- }
238
- return false;
239
- }
240
- /**
241
- * Check if a language is detected in the analysis
242
- */
243
- hasLanguage(analysis, name) {
244
- if (!analysis.languages)
245
- return false;
246
- if (Array.isArray(analysis.languages) && analysis.languages.length > 0) {
247
- const first = analysis.languages[0];
248
- if (typeof first === "object" && "language" in first) {
249
- return analysis.languages.some((l) => l.language?.toLowerCase() === name.toLowerCase());
250
- }
251
- if (typeof first === "string") {
252
- return analysis.languages.includes(name);
253
- }
254
- }
255
- return false;
256
- }
257
- /**
258
- * Get local fallback recommendations
259
- */
260
- getLocalRecommendations(analysis) {
261
- const recommendations = [];
262
- if (this.hasDependency(analysis, "typescript", true) || this.hasLanguage(analysis, "typescript")) {
263
- recommendations.push({
264
- id: "ts-best-practices",
265
- name: { "en": "TypeScript Best Practices", "zh-CN": "TypeScript \u6700\u4F73\u5B9E\u8DF5" },
266
- description: { "en": "Essential for TypeScript 5.3+ strict mode", "zh-CN": "TypeScript 5.3+ \u4E25\u683C\u6A21\u5F0F\u5FC5\u5907" },
267
- category: "skill",
268
- relevanceScore: 0.98,
269
- tags: ["typescript", "type-checking"]
270
- });
271
- }
272
- if (this.hasDependency(analysis, "react") || this.hasFramework(analysis, "react")) {
273
- recommendations.push({
274
- id: "react-design-patterns",
275
- name: { "en": "React Design Patterns", "zh-CN": "React \u8BBE\u8BA1\u6A21\u5F0F" },
276
- description: { "en": "React 18+ hooks and composition", "zh-CN": "React 18+ Hooks \u548C\u7EC4\u5408" },
277
- category: "skill",
278
- relevanceScore: 0.95,
279
- tags: ["react", "hooks", "frontend"]
280
- });
281
- }
282
- if (this.hasDependency(analysis, "next") || this.hasFramework(analysis, "next") || this.hasFramework(analysis, "nextjs")) {
283
- recommendations.push({
284
- id: "nextjs-optimization",
285
- name: { "en": "Next.js Optimization", "zh-CN": "Next.js \u4F18\u5316" },
286
- description: { "en": "App router and server components", "zh-CN": "App Router \u548C\u670D\u52A1\u5668\u7EC4\u4EF6" },
287
- category: "skill",
288
- relevanceScore: 0.92,
289
- tags: ["nextjs", "ssr", "performance"]
290
- });
291
- }
292
- if (this.hasDependency(analysis, "vue") || this.hasFramework(analysis, "vue")) {
293
- recommendations.push({
294
- id: "vue-design-patterns",
295
- name: { "en": "Vue Design Patterns", "zh-CN": "Vue \u8BBE\u8BA1\u6A21\u5F0F" },
296
- description: { "en": "Vue 3 Composition API patterns", "zh-CN": "Vue 3 \u7EC4\u5408\u5F0F API \u6A21\u5F0F" },
297
- category: "skill",
298
- relevanceScore: 0.95,
299
- tags: ["vue", "composition-api", "frontend"]
300
- });
301
- }
302
- if (this.hasDependency(analysis, "express") || this.hasDependency(analysis, "fastify") || this.hasFramework(analysis, "express")) {
303
- recommendations.push({
304
- id: "nodejs-workflow",
305
- name: { "en": "Node.js Workflow", "zh-CN": "Node.js \u5DE5\u4F5C\u6D41" },
306
- description: { "en": "Node.js development tools", "zh-CN": "Node.js \u5F00\u53D1\u5DE5\u5177" },
307
- category: "skill",
308
- relevanceScore: 0.9,
309
- tags: ["nodejs", "backend"]
310
- });
311
- }
312
- if (this.hasDependency(analysis, "@nestjs/core") || this.hasFramework(analysis, "nest") || this.hasFramework(analysis, "nestjs")) {
313
- recommendations.push({
314
- id: "nestjs-workflow",
315
- name: { "en": "NestJS Workflow", "zh-CN": "NestJS \u5DE5\u4F5C\u6D41" },
316
- description: { "en": "NestJS backend development", "zh-CN": "NestJS \u540E\u7AEF\u5F00\u53D1" },
317
- category: "skill",
318
- relevanceScore: 0.92,
319
- tags: ["nestjs", "backend", "typescript"]
320
- });
321
- }
322
- if (this.hasLanguage(analysis, "python")) {
323
- recommendations.push({
324
- id: "python-workflow",
325
- name: { "en": "Python Workflow", "zh-CN": "Python \u5DE5\u4F5C\u6D41" },
326
- description: { "en": "Python development best practices", "zh-CN": "Python \u5F00\u53D1\u6700\u4F73\u5B9E\u8DF5" },
327
- category: "skill",
328
- relevanceScore: 0.88,
329
- tags: ["python", "backend"]
330
- });
331
- }
332
- const fingerprint = this.generateProjectFingerprint(analysis);
333
- return {
334
- skills: recommendations.filter((r) => r.category === "skill"),
335
- mcpServices: recommendations.filter((r) => r.category === "mcp"),
336
- agents: recommendations.filter((r) => r.category === "agent"),
337
- hooks: recommendations.filter((r) => r.category === "hook"),
338
- confidence: 0.7,
339
- // Local fallback has lower confidence
340
- fingerprint,
341
- insights: {
342
- insights: [],
343
- productivityImprovements: [],
344
- nextRecommendations: []
345
- }
346
- };
347
- }
348
- /**
349
- * Calculate confidence score
350
- */
351
- calculateConfidence(recommendations) {
352
- if (recommendations.length === 0)
353
- return 0;
354
- const avgScore = recommendations.reduce((sum, r) => sum + r.relevanceScore, 0) / recommendations.length;
355
- return Math.round(avgScore * 100);
356
- }
357
- /**
358
- * Extract insights from response
359
- */
360
- extractInsights(_response) {
361
- return {
362
- insights: [
363
- i18n.t("cloud-setup:cloudRecommendationsGenerated")
364
- ],
365
- productivityImprovements: [],
366
- nextRecommendations: [],
367
- communityStats: {
368
- similarProjects: 0,
369
- topInstallations: []
370
- }
371
- };
372
- }
373
- /**
374
- * Display recommendation insights
375
- */
376
- async displayRecommendationInsights(recommendations, options) {
377
- if (options.interactive === false)
378
- return;
379
- console.log(`
380
- ${a.bold(i18n.t("cloud-setup:cloudRecommendations"))} ${a.dim(`(${i18n.t("cloud-setup:confidence")} ${recommendations.confidence}%)`)}`);
381
- console.log("");
382
- if (recommendations.skills.length > 0) {
383
- console.log(` ${a.bold(i18n.t("cloud-setup:skills"))} (${recommendations.skills.length}):`);
384
- for (const skill of recommendations.skills) {
385
- const confidence = options.showConfidence ? ` [${Math.round(skill.relevanceScore * 100)}%]` : "";
386
- const skillName = extractString(skill.name, skill.id, i18n.language);
387
- const skillDesc = extractString(skill.description, "", i18n.language);
388
- const reason = options.showRecommendationReason && skillDesc ? ` - ${skillDesc}` : "";
389
- console.log(` ${a.green("\u2713")} ${skillName}${a.dim(confidence)}${a.dim(reason)}`);
390
- }
391
- }
392
- if (recommendations.mcpServices.length > 0) {
393
- console.log(`
394
- ${a.bold(i18n.t("cloud-setup:mcpServices"))} (${recommendations.mcpServices.length}):`);
395
- for (const service of recommendations.mcpServices) {
396
- const confidence = options.showConfidence ? ` [${Math.round(service.relevanceScore * 100)}%]` : "";
397
- const serviceName = extractString(service.name, service.id, i18n.language);
398
- const serviceDesc = extractString(service.description, "", i18n.language);
399
- const reason = options.showRecommendationReason && serviceDesc ? ` - ${serviceDesc}` : "";
400
- console.log(` ${a.green("\u2713")} ${serviceName}${a.dim(confidence)}${a.dim(reason)}`);
401
- }
402
- }
403
- if (recommendations.agents.length > 0) {
404
- console.log(`
405
- ${a.bold(i18n.t("cloud-setup:agents"))} (${recommendations.agents.length}):`);
406
- for (const agent of recommendations.agents) {
407
- const confidence = options.showConfidence ? ` [${Math.round(agent.relevanceScore * 100)}%]` : "";
408
- const agentName = extractString(agent.name, agent.id, i18n.language);
409
- const agentDesc = extractString(agent.description, "", i18n.language);
410
- const reason = options.showRecommendationReason && agentDesc ? ` - ${agentDesc}` : "";
411
- console.log(` ${a.green("\u2713")} ${agentName}${a.dim(confidence)}${a.dim(reason)}`);
412
- }
413
- }
414
- if (recommendations.hooks.length > 0) {
415
- console.log(`
416
- ${a.bold(i18n.t("cloud-setup:hooks"))} (${recommendations.hooks.length}):`);
417
- for (const hook of recommendations.hooks) {
418
- const confidence = options.showConfidence ? ` [${Math.round(hook.relevanceScore * 100)}%]` : "";
419
- const hookName = extractString(hook.name, hook.id, i18n.language);
420
- const hookDesc = extractString(hook.description, "", i18n.language);
421
- const reason = options.showRecommendationReason && hookDesc ? ` - ${hookDesc}` : "";
422
- console.log(` ${a.green("\u2713")} ${hookName}${a.dim(confidence)}${a.dim(reason)}`);
423
- }
424
- }
425
- if (recommendations.insights?.insights && recommendations.insights.insights.length > 0) {
426
- console.log(`
427
- ${a.bold(i18n.t("cloud-setup:insights"))}:`);
428
- for (const insight of recommendations.insights.insights) {
429
- console.log(` ${a.cyan("\u{1F4A1}")} ${insight}`);
430
- }
431
- }
432
- if (recommendations.insights?.productivityImprovements && recommendations.insights.productivityImprovements.length > 0) {
433
- console.log(`
434
- ${a.bold(i18n.t("cloud-setup:productivityImprovements"))}:`);
435
- for (const improvement of recommendations.insights.productivityImprovements) {
436
- console.log(` ${a.green("\u2191")} ${improvement.resource}: +${improvement.improvement}% ${improvement.reason}`);
437
- }
438
- }
439
- }
440
- /**
441
- * Get user confirmation
442
- */
443
- async getUserConfirmation(recommendations, options) {
444
- if (options.interactive === false)
445
- return true;
446
- const totalResources = recommendations.skills.length + recommendations.mcpServices.length + recommendations.agents.length + recommendations.hooks.length;
447
- if (totalResources === 0) {
448
- console.log(`
449
- ${a.yellow(i18n.t("cloud-setup:noRecommendations"))}`);
450
- return false;
451
- }
452
- try {
453
- const inquirerModule = await import('./index3.mjs').then(function (n) { return n.c; });
454
- const inquirer = inquirerModule.default || inquirerModule;
455
- const { confirm } = await inquirer.prompt([
456
- {
457
- type: "confirm",
458
- name: "confirm",
459
- message: i18n.t("cloud-setup:installResources", { count: totalResources }),
460
- default: true
461
- }
462
- ]);
463
- return confirm;
464
- } catch (error) {
465
- this.logger.error("Failed to prompt user:", error);
466
- return true;
467
- }
468
- }
469
- /**
470
- * Download templates in batch
471
- */
472
- async downloadTemplates(recommendations, options) {
473
- if (options.interactive !== false) {
474
- console.log(`
475
- ${a.bold(i18n.t("cloud-setup:downloadingTemplates"))}`);
476
- }
477
- const allRecommendations = [
478
- ...recommendations.skills,
479
- ...recommendations.mcpServices,
480
- ...recommendations.agents,
481
- ...recommendations.hooks
482
- ];
483
- const templateIds = allRecommendations.map((r) => r.id);
484
- try {
485
- const response = await this.gateway.request(
486
- "templates.batch",
487
- {
488
- method: "POST",
489
- body: {
490
- ids: templateIds,
491
- language: options.lang
492
- },
493
- timeout: 15e3
494
- // 15s timeout for template download
495
- }
496
- );
497
- if (!response.success || !response.data) {
498
- throw new Error(response.error || "Template download failed");
499
- }
500
- const templates = response.data;
501
- if (options.interactive !== false) {
502
- console.log(` ${a.green("\u2713")} ${i18n.t("cloud-setup:templatesDownloaded", { count: Object.keys(templates.templates).length })}`);
503
- }
504
- return templates;
505
- } catch (error) {
506
- this.logger.error("Failed to download templates:", error);
507
- throw error;
508
- }
509
- }
510
- /**
511
- * Execute installation in parallel
512
- */
513
- async executeInstallation(recommendations, templates, options) {
514
- if (options.interactive !== false) {
515
- console.log(`
516
- ${a.bold(i18n.t("cloud-setup:installingResources"))}`);
517
- }
518
- const result = {
519
- success: true,
520
- requestId: "local-execution",
521
- confidence: recommendations.confidence,
522
- installed: { skills: [], mcpServices: [], agents: [], hooks: [] },
523
- skipped: { skills: [], mcpServices: [], agents: [], hooks: [] },
524
- failed: { skills: [], mcpServices: [], agents: [], hooks: [] },
525
- duration: 0,
526
- insights: recommendations.insights
527
- };
528
- if (recommendations.skills.length > 0) {
529
- await this.installSkills(recommendations.skills, result, options);
530
- }
531
- if (recommendations.mcpServices.length > 0) {
532
- await this.installMcpServices(recommendations.mcpServices, result, options);
533
- }
534
- if (recommendations.agents.length > 0) {
535
- await this.installAgents(recommendations.agents, result, options);
536
- }
537
- if (recommendations.hooks.length > 0) {
538
- await this.installHooks(recommendations.hooks, result, options);
539
- }
540
- result.duration = Math.max(Date.now() - this.startTime, 1);
541
- if (options.interactive !== false) {
542
- this.displaySummary(result, options);
543
- }
544
- return result;
545
- }
546
- /**
547
- * Install skills
548
- */
549
- async installSkills(skills, result, options) {
550
- if (options.interactive !== false) {
551
- console.log(`
552
- [1/4] ${i18n.t("cloud-setup:installingSkills")}...`);
553
- }
554
- const skillsOptions = {
555
- lang: options.lang,
556
- interactive: false,
557
- dryRun: options.dryRun,
558
- force: options.force,
559
- targetDir: options.targetDir
560
- };
561
- try {
562
- const skillIds = skills.map((s) => s.id);
563
- process.env.CCJK_SELECTED_SKILLS = JSON.stringify(skillIds);
564
- await ccjkSkills(skillsOptions);
565
- result.installed.skills = skillIds;
566
- if (options.interactive !== false) {
567
- console.log(` ${a.green("\u2713")} ${skills.length}/${skills.length} (${((Date.now() - this.startTime) / 1e3).toFixed(1)}s)`);
568
- }
569
- } catch (error) {
570
- this.logger.error("Skills installation failed:", error);
571
- result.failed.skills = skills.map((s) => ({ id: s.id, error: String(error) }));
572
- }
573
- }
574
- /**
575
- * Install MCP services
576
- */
577
- async installMcpServices(services, result, options) {
578
- if (options.interactive !== false) {
579
- console.log(`
580
- [2/4] ${i18n.t("cloud-setup:configuringMcpServices")}...`);
581
- }
582
- const mcpOptions = {
583
- interactive: false,
584
- services: services.map((s) => s.id),
585
- dryRun: options.dryRun,
586
- force: options.force,
587
- lang: options.lang
588
- };
589
- try {
590
- await ccjkMcp(mcpOptions);
591
- result.installed.mcpServices = services.map((s) => s.id);
592
- if (options.interactive !== false) {
593
- console.log(` ${a.green("\u2713")} ${services.length}/${services.length} (${((Date.now() - this.startTime) / 1e3).toFixed(1)}s)`);
594
- }
595
- } catch (error) {
596
- this.logger.error("MCP services installation failed:", error);
597
- result.failed.mcpServices = services.map((s) => ({ id: s.id, error: String(error) }));
598
- }
599
- }
600
- /**
601
- * Install agents
602
- */
603
- async installAgents(agents, result, options) {
604
- if (options.interactive !== false) {
605
- console.log(`
606
- [3/4] ${i18n.t("cloud-setup:creatingAgents")}...`);
607
- }
608
- const agentOptions = {
609
- lang: options.lang,
610
- dryRun: options.dryRun
611
- // Note: CcjkAgentsOptions doesn't support batch agent creation yet
612
- // We'll need to call ccjkAgents for each agent individually
613
- };
614
- try {
615
- await ccjkAgents(agentOptions);
616
- result.installed.agents = agents.map((a) => a.id);
617
- if (options.interactive !== false) {
618
- console.log(` ${a.green("\u2713")} ${agents.length}/${agents.length} (${((Date.now() - this.startTime) / 1e3).toFixed(1)}s)`);
619
- }
620
- } catch (error) {
621
- this.logger.error("Agents installation failed:", error);
622
- result.failed.agents = agents.map((a) => ({ id: a.id, error: String(error) }));
623
- }
624
- }
625
- /**
626
- * Install hooks
627
- */
628
- async installHooks(hooks, result, options) {
629
- if (options.interactive !== false) {
630
- console.log(`
631
- [4/4] ${i18n.t("cloud-setup:settingUpHooks")}...`);
632
- }
633
- const hookOptions = {
634
- dryRun: options.dryRun
635
- // Note: CcjkHooksOptions doesn't have lang, interactive, hooks, or force properties
636
- // The ccjkHooks command will analyze and install hooks based on project analysis
637
- };
638
- try {
639
- await ccjkHooks(hookOptions);
640
- result.installed.hooks = hooks.map((h) => h.id);
641
- if (options.interactive !== false) {
642
- console.log(` ${a.green("\u2713")} ${hooks.length}/${hooks.length} (${((Date.now() - this.startTime) / 1e3).toFixed(1)}s)`);
643
- }
644
- } catch (error) {
645
- this.logger.error("Hooks installation failed:", error);
646
- result.failed.hooks = hooks.map((h) => ({ id: h.id, error: String(error) }));
647
- }
648
- }
649
- /**
650
- * Display summary
651
- */
652
- displaySummary(result, options) {
653
- console.log("");
654
- console.log(a.green(` ${i18n.t("cloud-setup:setupComplete")}`));
655
- const totalInstalled = result.installed.skills.length + result.installed.mcpServices.length + result.installed.agents.length + result.installed.hooks.length;
656
- console.log(` ${i18n.t("cloud-setup:installedResources", { count: totalInstalled, duration: (result.duration / 1e3).toFixed(1) })}`);
657
- if (result.insights) {
658
- console.log(`
659
- ${a.bold(i18n.t("cloud-setup:cloudFeedback"))}`);
660
- for (const insight of result.insights.insights) {
661
- console.log(` ${a.cyan("\u2022")} ${insight}`);
662
- }
663
- }
664
- console.log(`
665
- ${a.bold(i18n.t("cloud-setup:nextSteps"))}`);
666
- console.log(` ${a.dim("\u2022")} ${i18n.t("cloud-setup:startCoding")}`);
667
- if (options.showRecommendationReason) {
668
- console.log(` ${a.dim("\u2022")} ${i18n.t("cloud-setup:viewRecommendations")}`);
669
- }
670
- console.log(` ${a.dim("\u2022")} ${i18n.t("cloud-setup:customizeSetup")}`);
671
- if (result.reportPath) {
672
- console.log(`
673
- ${a.dim(i18n.t("cloud-setup:reportGenerated", { path: result.reportPath }))}`);
674
- }
675
- }
676
- /**
677
- * Upload telemetry (non-blocking with retry budget)
678
- * Fire-and-forget: does not block setup completion
679
- */
680
- async uploadTelemetry(result) {
681
- const telemetry = {
682
- requestId: result.requestId,
683
- installation: {
684
- timestamp: Date.now(),
685
- duration: result.duration,
686
- selectedResources: [
687
- ...result.installed.skills.map((id) => ({ id, type: "skill", version: "1.0.0" })),
688
- ...result.installed.mcpServices.map((id) => ({ id, type: "mcp", version: "1.0.0" })),
689
- ...result.installed.agents.map((id) => ({ id, type: "agent", version: "1.0.0" })),
690
- ...result.installed.hooks.map((id) => ({ id, type: "hook", version: "1.0.0" }))
691
- ],
692
- skippedResources: [
693
- ...result.skipped.skills,
694
- ...result.skipped.mcpServices,
695
- ...result.skipped.agents,
696
- ...result.skipped.hooks
697
- ],
698
- failedResources: [
699
- ...result.failed.skills,
700
- ...result.failed.mcpServices,
701
- ...result.failed.agents,
702
- ...result.failed.hooks
703
- ]
704
- },
705
- clientInfo: {
706
- ccjkVersion: CCJK_VERSION,
707
- os: process.platform,
708
- nodeVersion: process.version
709
- },
710
- performance: {
711
- networkLatency: 0,
712
- cacheHit: false,
713
- retryCount: 0
714
- }
715
- };
716
- this.sendTelemetryWithRetry(telemetry, 3, 5e3).catch((error) => {
717
- this.logger.debug("Telemetry upload failed after retries (non-blocking):", error);
718
- });
719
- }
720
- /**
721
- * Send telemetry with retry budget
722
- * Private helper for non-blocking telemetry submission
723
- */
724
- async sendTelemetryWithRetry(telemetry, maxAttempts, timeout) {
725
- for (let attempt = 1; attempt <= maxAttempts; attempt++) {
726
- try {
727
- const timeoutPromise = new Promise((_, reject) => {
728
- setTimeout(() => reject(new Error("Telemetry timeout")), timeout);
729
- });
730
- const response = await Promise.race([
731
- this.gateway.request("telemetry.installation", {
732
- method: "POST",
733
- body: telemetry,
734
- timeout
735
- }),
736
- timeoutPromise
737
- ]);
738
- if (response.success) {
739
- this.logger.debug(`Telemetry uploaded successfully (attempt ${attempt}/${maxAttempts})`);
740
- return;
741
- }
742
- throw new Error(response.error || "Unknown telemetry error");
743
- } catch (error) {
744
- this.logger.debug(
745
- `Telemetry attempt ${attempt}/${maxAttempts} failed:`,
746
- error instanceof Error ? error.message : error
747
- );
748
- if (attempt === maxAttempts) {
749
- this.logger.debug("Telemetry failed after all retry attempts - giving up silently");
750
- return;
751
- }
752
- const delay = 100 * 2 ** (attempt - 1);
753
- await new Promise((resolve) => setTimeout(resolve, delay));
754
- }
755
- }
756
- }
757
- /**
758
- * Generate cloud insights report
759
- */
760
- async generateReport(result, recommendations, options) {
761
- const reportPath = join(
762
- process.cwd(),
763
- `ccjk-setup-report-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}.${options.reportFormat || "md"}`
764
- );
765
- let content = "";
766
- if (options.reportFormat === "json") {
767
- content = JSON.stringify({
768
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
769
- result,
770
- recommendations,
771
- options
772
- }, null, 2);
773
- } else {
774
- content = `# CCJK Setup Report (Cloud-Enhanced)
775
-
776
- `;
777
- content += `**Date**: ${(/* @__PURE__ */ new Date()).toLocaleString()}
778
- `;
779
- content += `**Strategy**: ${options.strategy || "cloud-smart"}
780
- `;
781
- content += `**Cloud Confidence**: ${result.confidence}%
782
- `;
783
- content += `**Duration**: ${(result.duration / 1e3).toFixed(1)}s
784
-
785
- `;
786
- content += `## Installed Resources (${Object.values(result.installed).flat().length})
787
-
788
- `;
789
- if (result.installed.skills.length > 0) {
790
- content += `### Skills (${result.installed.skills.length})
791
- `;
792
- for (const skill of result.installed.skills) {
793
- content += `- ${skill}
794
- `;
795
- }
796
- content += "\n";
797
- }
798
- if (result.installed.mcpServices.length > 0) {
799
- content += `### MCP Services (${result.installed.mcpServices.length})
800
- `;
801
- for (const service of result.installed.mcpServices) {
802
- content += `- ${service}
803
- `;
804
- }
805
- content += "\n";
806
- }
807
- if (result.installed.agents.length > 0) {
808
- content += `### Agents (${result.installed.agents.length})
809
- `;
810
- for (const agent of result.installed.agents) {
811
- content += `- ${agent}
812
- `;
813
- }
814
- content += "\n";
815
- }
816
- if (result.installed.hooks.length > 0) {
817
- content += `### Hooks (${result.installed.hooks.length})
818
- `;
819
- for (const hook of result.installed.hooks) {
820
- content += `- ${hook}
821
- `;
822
- }
823
- content += "\n";
824
- }
825
- if (result.insights?.nextRecommendations && result.insights.nextRecommendations.length > 0) {
826
- content += `## Next Recommendations
827
-
828
- `;
829
- for (const rec of result.insights.nextRecommendations) {
830
- content += `- ${rec}
831
- `;
832
- }
833
- }
834
- }
835
- await promises.writeFile(reportPath, content, "utf-8");
836
- return reportPath;
837
- }
838
- /**
839
- * Execute with fallback
840
- */
841
- async executeWithFallback(options) {
842
- try {
843
- return await this.executeCloudSetup(options);
844
- } catch (error) {
845
- if (error.code === "ENOTFOUND" || error.code === "ECONNREFUSED") {
846
- console.warn(a.yellow(`
847
- ${i18n.t("cloud-setup:cloudUnavailable")}`));
848
- console.warn(` ${i18n.t("cloud-setup:fallingBackToLocal")}`);
849
- options.useCloud = false;
850
- return await this.executeCloudSetup(options);
851
- }
852
- throw error;
853
- }
854
- }
855
- }
856
-
857
- async function ccjkAll(options = {}) {
858
- const startTime = Date.now();
859
- await ensureI18nInitialized();
860
- if (options.help) {
861
- return displayHelp();
862
- }
863
- if (options.version) {
864
- return displayVersion();
865
- }
866
- if (options.lang) {
867
- i18n.changeLanguage(options.lang);
868
- }
869
- const logger = consola.withTag("ccjk:all");
870
- const isZh = i18n.language === "zh-CN";
871
- try {
872
- const result = {
873
- success: false,
874
- requestId: "",
875
- confidence: 0,
876
- installed: { skills: [], mcpServices: [], agents: [], hooks: [] },
877
- skipped: { skills: [], mcpServices: [], agents: [], hooks: [] },
878
- failed: { skills: [], mcpServices: [], agents: [], hooks: [] },
879
- duration: 0
880
- };
881
- if (options.json) {
882
- console.log(JSON.stringify({ status: "starting", options }));
883
- }
884
- if (!options.quiet && !options.json) {
885
- displayHeader();
886
- }
887
- if (!options.skipCloudCheck && options.useCloud !== false) {
888
- await checkCloudAvailability(options);
889
- }
890
- const orchestrator = new CloudSetupOrchestrator(options);
891
- const setupResult = await orchestrator.executeWithFallback(options);
892
- Object.assign(result, setupResult);
893
- if (options.json) {
894
- console.log(JSON.stringify({
895
- status: "completed",
896
- result: setupResult,
897
- duration: Date.now() - startTime
898
- }));
899
- return setupResult;
900
- }
901
- if (!options.quiet) {
902
- displayCompletion(setupResult);
903
- }
904
- return setupResult;
905
- } catch (error) {
906
- logger.error("Setup failed:", error);
907
- if (options.json) {
908
- console.log(JSON.stringify({
909
- status: "error",
910
- error: error.message,
911
- duration: Date.now() - startTime
912
- }));
913
- } else if (!options.quiet) {
914
- console.error(`
915
- ${a.red("\u2717")} ${isZh ? "\u8BBE\u7F6E\u5931\u8D25" : "Setup failed"}`);
916
- console.error(` ${a.red(error.message)}`);
917
- if (error.code === "ENOTFOUND") {
918
- console.error(`
919
- ${a.yellow("\u2139")} ${isZh ? "\u4E91\u670D\u52A1\u548C\u672C\u5730\u670D\u52A1\u90FD\u4E0D\u53EF\u7528" : "Both cloud and local services are unavailable"}`);
920
- console.error(` ${isZh ? "\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u6216\u7A0D\u540E\u518D\u8BD5" : "Please check your network connection or try again later"}`);
921
- }
922
- }
923
- throw error;
924
- }
925
- }
926
- function displayHeader() {
927
- console.log("");
928
- console.log(a.bold.cyan("\u2501".repeat(60)));
929
- console.log(a.bold.cyan(` ${i18n.t("ccjk-all:title")}`));
930
- console.log(a.bold.cyan("\u2501".repeat(60)));
931
- console.log("");
932
- }
933
- async function checkCloudAvailability(options) {
934
- const logger = consola.withTag("cloud-check");
935
- i18n.language === "zh-CN";
936
- console.log(` ${a.bold(i18n.t("ccjk-all:connectingToCloud"))}`);
937
- try {
938
- const client = createCompleteCloudClient({
939
- baseURL: options.cloudEndpoint || "https://api.ccjk.cloud"
940
- });
941
- const startTime = Date.now();
942
- const health = await client.healthCheck();
943
- const latency = Date.now() - startTime;
944
- console.log(` ${a.green("\u2713")} ${i18n.t("ccjk-all:connected")} ${a.dim(`(${i18n.t("ccjk-all:latency")} ${latency}ms)`)}`);
945
- console.log(` ${a.green("\u2713")} ${i18n.t("ccjk-all:cloudVersion")} ${a.dim(health.version || "unknown")}`);
946
- } catch (error) {
947
- logger.warn("Cloud service unavailable:", error);
948
- console.log(` ${a.yellow("\u26A0")} ${i18n.t("ccjk-all:cloudUnavailable")}`);
949
- console.log(` ${a.dim(i18n.t("ccjk-all:usingLocalMode"))}`);
950
- options.useCloud = false;
951
- }
952
- }
953
- function displayCompletion(result) {
954
- console.log("");
955
- console.log(a.green(` ${i18n.t("ccjk-all:setupComplete")}`));
956
- const totalInstalled = result.installed.skills.length + result.installed.mcpServices.length + result.installed.agents.length + result.installed.hooks.length;
957
- console.log(` ${i18n.t("ccjk-all:installedCount", { count: totalInstalled, duration: (result.duration / 1e3).toFixed(1) })}`);
958
- if (result.insights?.insights && result.insights.insights.length > 0) {
959
- console.log(`
960
- ${a.bold(i18n.t("ccjk-all:cloudFeedback"))}`);
961
- for (const insight of result.insights.insights) {
962
- console.log(` ${a.cyan("\u2022")} ${insight}`);
963
- }
964
- }
965
- console.log(`
966
- ${a.bold(i18n.t("ccjk-all:nextSteps"))}`);
967
- console.log(` ${a.dim("\u2022")} ${i18n.t("ccjk-all:startCoding")}`);
968
- console.log(` ${a.dim("\u2022")} ${i18n.t("ccjk-all:viewRecommendations")}`);
969
- console.log(` ${a.dim("\u2022")} ${i18n.t("ccjk-all:customizeSetup")}`);
970
- if (result.reportPath) {
971
- console.log(`
972
- ${a.dim(i18n.t("ccjk-all:reportGenerated", { path: result.reportPath }))}`);
973
- }
974
- console.log("");
975
- }
976
- function displayHelp() {
977
- i18n.language === "zh-CN";
978
- console.log("");
979
- console.log(a.bold.cyan("\u2501".repeat(60)));
980
- console.log(a.bold.cyan(` ${i18n.t("ccjk-all:helpTitle")}`));
981
- console.log(a.bold.cyan("\u2501".repeat(60)));
982
- console.log("");
983
- console.log(a.bold(i18n.t("ccjk-all:usage")));
984
- console.log(" ccjk ccjk:all [options]");
985
- console.log("");
986
- console.log(a.bold(i18n.t("ccjk-all:options")));
987
- console.log(" --strategy <type> Cloud strategy (cloud-smart, cloud-conservative, local-fallback)");
988
- console.log(" --use-cloud <bool> Use cloud recommendations (default: true)");
989
- console.log(" --cloud-endpoint <url> Cloud API endpoint");
990
- console.log(" --cache-strategy <type> Cache strategy (aggressive, normal, disabled)");
991
- console.log(" --show-reasons Show recommendation reasons");
992
- console.log(" --show-confidence Show confidence scores");
993
- console.log(" --show-comparison Show community comparison");
994
- console.log(" --submit-telemetry Submit anonymous telemetry (default: true)");
995
- console.log(" --include-feedback Include feedback after installation");
996
- console.log(" --generate-report Generate detailed report");
997
- console.log(" --report-format <type> Report format (markdown, json, html)");
998
- console.log(" --target-dir <path> Target directory (default: current directory)");
999
- console.log(" --interactive Interactive mode (default: true)");
1000
- console.log(" --dry-run Preview without installing");
1001
- console.log(" --force Force installation");
1002
- console.log(" --lang <lang> Language (en, zh-CN)");
1003
- console.log(" --json JSON output");
1004
- console.log(" --quiet Quiet mode");
1005
- console.log(" --verbose Verbose output");
1006
- console.log(" --help Show help");
1007
- console.log(" --version Show version");
1008
- console.log("");
1009
- console.log(a.bold(i18n.t("ccjk-all:examples")));
1010
- console.log(" ccjk ccjk:all # Interactive cloud-powered setup");
1011
- console.log(" ccjk ccjk:all --strategy cloud-smart # Use cloud-smart strategy");
1012
- console.log(" ccjk ccjk:all --use-cloud false # Local mode only");
1013
- console.log(" ccjk ccjk:all --show-reasons # Show recommendation reasons");
1014
- console.log(" ccjk ccjk:all --generate-report # Generate detailed report");
1015
- console.log(" ccjk ccjk:all --dry-run # Preview without installing");
1016
- console.log("");
1017
- console.log(a.bold(i18n.t("ccjk-all:strategies")));
1018
- console.log(" cloud-smart Use cloud with intelligent fallback");
1019
- console.log(" cloud-conservative Prefer cloud but strict about errors");
1020
- console.log(" local-fallback Use local recommendations only");
1021
- console.log("");
1022
- }
1023
- function displayVersion() {
1024
- const pkg = require("../../package.json");
1025
- console.log(`ccjk v${pkg.version}`);
1026
- }
1027
-
1028
- export { ccjkAll };