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,1606 +0,0 @@
1
- import a from './index2.mjs';
2
- import { i as inquirer } from './index3.mjs';
3
- import { existsSync } from 'node:fs';
4
- import process__default from 'node:process';
5
- import { m as runCodexFullInit, d as selectMcpServices, g as getMcpServices, M as MCP_SERVICE_CONFIGS } from './codex.mjs';
6
- import { a as modifyApiConfigPartially, b as configureApiCompletely, n as needsMigration, m as migrateSettingsForTokenRetrieval, d as displayMigrationResult, p as promptMigration, s as selectAndInstallWorkflows, c as configureOutputStyle, f as formatApiKeyDisplay, W as WORKFLOW_CONFIG_BASE } from '../shared/ccjk.BwfbSKN2.mjs';
7
- import { SETTINGS_FILE, DEFAULT_CODE_TOOL_TYPE, CODE_TOOL_BANNERS, API_DEFAULT_URL } from './constants.mjs';
8
- import { ensureI18nInitialized, i18n } from './index5.mjs';
9
- import { displayBannerWithInfo, padToDisplayWidth } from './banner.mjs';
10
- import { readZcfConfig, updateZcfConfig } from './ccjk-config.mjs';
11
- import { readCcrConfig, backupCcrConfig, createDefaultCcrConfig, writeCcrConfig, configureCcrProxy, setupCcrConfiguration } from './config2.mjs';
12
- import { exec } from 'node:child_process';
13
- import { promisify } from 'node:util';
14
- import { updateCcr } from './auto-updater.mjs';
15
- import { w as wrapCommandWithSudo, i as isWindows, b as isTermux } from './platform.mjs';
16
- import { c as addCompletedOnboarding, s as setPrimaryApiKey, b as backupMcpConfig, a as buildMcpServerConfig, r as readMcpConfig, e as replaceMcpServers, f as fixWindowsMcpConfig, w as writeMcpConfig, g as syncMcpPermissions } from './claude-config.mjs';
17
- import { r as resolveCodeType } from '../shared/ccjk.Cjj8SVrn.mjs';
18
- import { exists } from './fs-operations.mjs';
19
- import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
20
- import { p as promptApiConfigurationAction, i as ensureClaudeDir, e as getExistingApiConfig, s as switchToOfficialLogin, b as backupExistingConfig, c as copyConfigFiles, a as applyAiLanguageDirective, f as configureApi } from './config.mjs';
21
- import { h as handleExitPromptError, a as handleGeneralError } from '../shared/ccjk.BIxuVL3_.mjs';
22
- import { getInstallationStatus, installClaudeCode } from './installer.mjs';
23
- import { p as parseOrchestrationLevel, w as writeOrchestrationPolicy } from './smart-defaults.mjs';
24
- import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
25
- import { resolveAiOutputLanguage } from './prompts.mjs';
26
- import { g as getRuntimeVersion } from '../shared/ccjk.gDEDGD_t.mjs';
27
- import { c as checkSuperpowersInstalled, i as installSuperpowers } from '../shared/ccjk._dESH4Rk.mjs';
28
- import { p as promptBoolean } from '../shared/ccjk.DOwtZMk8.mjs';
29
- import { checkClaudeCodeVersionAndPrompt } from './version-checker.mjs';
30
-
31
- const execAsync$1 = promisify(exec);
32
- async function isCcrInstalled() {
33
- let commandExists = false;
34
- try {
35
- await execAsync$1("ccr version");
36
- commandExists = true;
37
- } catch {
38
- try {
39
- await execAsync$1("which ccr");
40
- commandExists = true;
41
- } catch {
42
- commandExists = false;
43
- }
44
- }
45
- let hasCorrectPackage = false;
46
- try {
47
- await execAsync$1("npm list -g @musistudio/claude-code-router");
48
- hasCorrectPackage = true;
49
- } catch {
50
- hasCorrectPackage = false;
51
- }
52
- return {
53
- isInstalled: commandExists,
54
- hasCorrectPackage
55
- };
56
- }
57
- async function installCcr() {
58
- ensureI18nInitialized();
59
- const { isInstalled, hasCorrectPackage } = await isCcrInstalled();
60
- if (hasCorrectPackage) {
61
- console.log(a.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
62
- await updateCcr();
63
- return;
64
- }
65
- if (isInstalled && !hasCorrectPackage) {
66
- try {
67
- await execAsync$1("npm list -g claude-code-router");
68
- console.log(a.yellow(`\u26A0 ${i18n.t("ccr:detectedIncorrectPackage")}`));
69
- try {
70
- await execAsync$1("npm uninstall -g claude-code-router");
71
- console.log(a.green(`\u2714 ${i18n.t("ccr:uninstalledIncorrectPackage")}`));
72
- } catch {
73
- console.log(a.yellow(`\u26A0 ${i18n.t("ccr:failedToUninstallIncorrectPackage")}`));
74
- }
75
- } catch {
76
- }
77
- }
78
- console.log(a.green(`\u{1F4E6} ${i18n.t("ccr:installingCcr")}`));
79
- try {
80
- const installArgs = ["install", "-g", "@musistudio/claude-code-router", "--force"];
81
- const { command, args, usedSudo } = wrapCommandWithSudo("npm", installArgs);
82
- if (usedSudo) {
83
- console.log(a.yellow(`\u2139 ${i18n.t("installation:usingSudo")}`));
84
- }
85
- await execAsync$1([command, ...args].join(" "));
86
- console.log(a.green(`\u2714 ${i18n.t("ccr:ccrInstallSuccess")}`));
87
- } catch (error) {
88
- if (error.message?.includes("EEXIST")) {
89
- console.log(a.yellow(`\u26A0 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
90
- await updateCcr();
91
- return;
92
- }
93
- console.error(a.red(`\u2716 ${i18n.t("ccr:ccrInstallFailed")}`));
94
- throw error;
95
- }
96
- }
97
-
98
- const COMETIX_PACKAGE_NAME = "@cometix/ccline";
99
- const COMETIX_COMMAND_NAME = "ccline";
100
- const COMETIX_COMMANDS = {
101
- CHECK_INSTALL: `npm list -g ${COMETIX_PACKAGE_NAME}`,
102
- INSTALL: `npm install -g ${COMETIX_PACKAGE_NAME}`,
103
- UPDATE: `npm update -g ${COMETIX_PACKAGE_NAME}`,
104
- PRINT_CONFIG: `${COMETIX_COMMAND_NAME} --print`,
105
- TUI_CONFIG: `${COMETIX_COMMAND_NAME} -c`
106
- };
107
-
108
- function getPlatformStatusLineConfig() {
109
- return {
110
- type: "command",
111
- command: isWindows() ? "%USERPROFILE%\\.claude\\ccline\\ccline.exe" : "~/.claude/ccline/ccline",
112
- padding: 0
113
- };
114
- }
115
-
116
- function addCCometixLineConfig() {
117
- try {
118
- const statusLineConfig = getPlatformStatusLineConfig();
119
- let settings = {};
120
- if (exists(SETTINGS_FILE)) {
121
- settings = readJsonConfig(SETTINGS_FILE) || {};
122
- }
123
- settings.statusLine = statusLineConfig;
124
- writeJsonConfig(SETTINGS_FILE, settings);
125
- return true;
126
- } catch (error) {
127
- console.error("Failed to add CCometixLine configuration:", error);
128
- return false;
129
- }
130
- }
131
- function hasCCometixLineConfig() {
132
- try {
133
- if (!exists(SETTINGS_FILE)) {
134
- return false;
135
- }
136
- const settings = readJsonConfig(SETTINGS_FILE);
137
- return !!settings?.statusLine?.command?.includes("ccline");
138
- } catch {
139
- return false;
140
- }
141
- }
142
-
143
- const execAsync = promisify(exec);
144
- async function isCometixLineInstalled() {
145
- try {
146
- await execAsync(COMETIX_COMMANDS.CHECK_INSTALL);
147
- return true;
148
- } catch {
149
- return false;
150
- }
151
- }
152
- async function installCometixLine() {
153
- ensureI18nInitialized();
154
- const runInstallCommand = async () => {
155
- const installArgs = ["install", "-g", COMETIX_PACKAGE_NAME];
156
- const { command, args, usedSudo } = wrapCommandWithSudo("npm", installArgs);
157
- if (usedSudo) {
158
- console.log(a.yellow(`\u2139 ${i18n.t("installation:usingSudo")}`));
159
- }
160
- await execAsync([command, ...args].join(" "));
161
- };
162
- const isInstalled = await isCometixLineInstalled();
163
- if (isInstalled) {
164
- console.log(a.green(`\u2714 ${i18n.t("cometix:cometixAlreadyInstalled")}`));
165
- try {
166
- console.log(a.green(`${i18n.t("cometix:installingOrUpdating")}`));
167
- await runInstallCommand();
168
- console.log(a.green(`\u2714 ${i18n.t("cometix:installUpdateSuccess")}`));
169
- } catch (error) {
170
- console.log(a.yellow(`\u26A0 ${i18n.t("cometix:installUpdateFailed")}: ${error}`));
171
- }
172
- if (!hasCCometixLineConfig()) {
173
- try {
174
- addCCometixLineConfig();
175
- console.log(a.green(`\u2714 ${i18n.t("cometix:statusLineConfigured") || "Claude Code statusLine configured"}`));
176
- } catch (error) {
177
- console.log(a.yellow(`\u26A0 ${i18n.t("cometix:statusLineConfigFailed") || "Failed to configure statusLine"}: ${error}`));
178
- }
179
- } else {
180
- console.log(a.green(`\u2139 ${i18n.t("cometix:statusLineAlreadyConfigured") || "Claude Code statusLine already configured"}`));
181
- }
182
- return;
183
- }
184
- try {
185
- console.log(a.green(`${i18n.t("cometix:installingCometix")}`));
186
- await runInstallCommand();
187
- console.log(a.green(`\u2714 ${i18n.t("cometix:cometixInstallSuccess")}`));
188
- try {
189
- addCCometixLineConfig();
190
- console.log(a.green(`\u2714 ${i18n.t("cometix:statusLineConfigured") || "Claude Code statusLine configured"}`));
191
- } catch (configError) {
192
- console.log(a.yellow(`\u26A0 ${i18n.t("cometix:statusLineConfigFailed") || "Failed to configure statusLine"}: ${configError}`));
193
- console.log(a.green(`\u{1F4A1} ${i18n.t("cometix:statusLineManualConfig") || "Please manually add statusLine configuration to Claude Code settings"}`));
194
- }
195
- } catch (error) {
196
- console.error(a.red(`\u2717 ${i18n.t("cometix:cometixInstallFailed")}: ${error}`));
197
- throw error;
198
- }
199
- }
200
-
201
- function formatError(error, context) {
202
- const errorMsg = typeof error === "string" ? error : error.message;
203
- const patterns = [
204
- {
205
- pattern: /not initialized|Call initialize/i,
206
- formatter: () => ({
207
- title: "\u26A0\uFE0F Configuration Not Ready",
208
- message: "CCJK needs to be initialized first.",
209
- suggestion: "Run the initialization command to set up your environment.",
210
- command: "ccjk init"
211
- })
212
- },
213
- {
214
- pattern: /Failed to (start|connect|fetch)/i,
215
- formatter: (match) => ({
216
- title: "\u274C Connection Failed",
217
- message: `Unable to ${match[1]} the service.`,
218
- suggestion: "Check your internet connection and try again.",
219
- command: "ccjk doctor"
220
- })
221
- },
222
- {
223
- pattern: /does not exist|not found/i,
224
- formatter: () => ({
225
- title: "\u{1F50D} File Not Found",
226
- message: "The requested file or directory does not exist.",
227
- suggestion: "Verify the path and try again."
228
- })
229
- },
230
- {
231
- pattern: /permission denied|EACCES/i,
232
- formatter: () => ({
233
- title: "\u{1F512} Permission Denied",
234
- message: "You do not have permission to access this resource.",
235
- suggestion: "Check file permissions or run with appropriate privileges.",
236
- command: "sudo ccjk <command>"
237
- })
238
- },
239
- {
240
- pattern: /network|timeout|ETIMEDOUT|ECONNREFUSED/i,
241
- formatter: () => ({
242
- title: "\u{1F310} Network Error",
243
- message: "Unable to connect to the server.",
244
- suggestion: "Check your internet connection and firewall settings."
245
- })
246
- }
247
- ];
248
- for (const { pattern, formatter } of patterns) {
249
- const match = errorMsg.match(pattern);
250
- if (match) {
251
- return formatter(match);
252
- }
253
- }
254
- return {
255
- title: "\u274C Error",
256
- message: errorMsg,
257
- suggestion: context ? `Context: ${context}` : "Run ccjk doctor for diagnostics.",
258
- command: "ccjk doctor"
259
- };
260
- }
261
- function displayError(error, context) {
262
- const formatted = formatError(error, context);
263
- console.error();
264
- console.error(a.red(formatted.title));
265
- console.error(formatted.message);
266
- if (formatted.suggestion) {
267
- console.error();
268
- console.error(a.yellow("\u{1F4A1} Suggestion:"), formatted.suggestion);
269
- }
270
- if (formatted.command) {
271
- console.error(a.cyan(" Run:"), a.green(formatted.command));
272
- }
273
- if (formatted.docsUrl) {
274
- console.error(a.cyan(" Docs:"), a.blue(formatted.docsUrl));
275
- }
276
- console.error();
277
- }
278
-
279
- class ProgressTracker {
280
- currentStep = 0;
281
- totalSteps;
282
- steps;
283
- startTime;
284
- constructor(steps) {
285
- this.steps = steps;
286
- this.totalSteps = steps.length;
287
- this.startTime = Date.now();
288
- }
289
- start() {
290
- console.log();
291
- console.log(a.cyan("\u{1F680} Starting setup..."));
292
- console.log(a.gray(` ${this.totalSteps} steps to complete`));
293
- console.log();
294
- }
295
- nextStep(message) {
296
- this.currentStep++;
297
- const stepName = message || this.steps[this.currentStep - 1];
298
- const progress = Math.round(this.currentStep / this.totalSteps * 100);
299
- const bar = this.renderProgressBar(progress);
300
- console.log();
301
- console.log(a.cyan(`[${this.currentStep}/${this.totalSteps}]`), stepName);
302
- console.log(a.gray(` ${bar} ${progress}%`));
303
- }
304
- complete() {
305
- const duration = ((Date.now() - this.startTime) / 1e3).toFixed(1);
306
- console.log();
307
- console.log(a.green("\u2705 Setup complete!"));
308
- console.log(a.gray(` Completed in ${duration}s`));
309
- console.log();
310
- }
311
- error(message) {
312
- console.log();
313
- console.log(a.red("\u274C Setup failed"));
314
- console.log(a.white(` ${message}`));
315
- console.log();
316
- }
317
- renderProgressBar(percent) {
318
- const width = 20;
319
- const filled = Math.round(percent / 100 * width);
320
- const empty = width - filled;
321
- return a.green("\u2588".repeat(filled)) + a.gray("\u2591".repeat(empty));
322
- }
323
- }
324
-
325
- const ccjkVersion = getRuntimeVersion();
326
- async function validateSkipPromptOptions(options) {
327
- if (options.allLang) {
328
- if (options.allLang === "zh-CN" || options.allLang === "en") {
329
- options.configLang = options.allLang;
330
- options.aiOutputLang = options.allLang;
331
- } else {
332
- options.configLang = "en";
333
- options.aiOutputLang = options.allLang;
334
- }
335
- }
336
- if (options.provider) {
337
- const { getValidProviderIds, getProviderPreset } = await import('./api-providers.mjs');
338
- const validProviders = [...getValidProviderIds(), "custom"];
339
- if (!validProviders.includes(options.provider)) {
340
- throw new Error(
341
- i18n.t("errors:invalidProvider", {
342
- provider: options.provider,
343
- validProviders: validProviders.join(", ")
344
- })
345
- );
346
- }
347
- if (!options.apiType) {
348
- const preset = options.provider !== "custom" ? getProviderPreset(options.provider) : null;
349
- options.apiType = preset?.claudeCode?.authType || "api_key";
350
- }
351
- }
352
- if (!options.configAction) {
353
- options.configAction = "backup";
354
- }
355
- if (typeof options.outputStyles === "string") {
356
- if (options.outputStyles === "skip") {
357
- options.outputStyles = false;
358
- } else if (options.outputStyles === "all") {
359
- options.outputStyles = ["speed-coder", "senior-architect", "pair-programmer"];
360
- } else {
361
- options.outputStyles = options.outputStyles.split(",").map((s) => s.trim());
362
- }
363
- }
364
- if (options.outputStyles === void 0) {
365
- options.outputStyles = ["speed-coder", "senior-architect", "pair-programmer"];
366
- }
367
- if (!options.defaultOutputStyle) {
368
- options.defaultOutputStyle = "senior-architect";
369
- }
370
- if (typeof options.installCometixLine === "string") {
371
- options.installCometixLine = options.installCometixLine.toLowerCase() === "true";
372
- }
373
- if (options.installCometixLine === void 0) {
374
- options.installCometixLine = true;
375
- }
376
- if (typeof options.installSuperpowers === "string") {
377
- options.installSuperpowers = options.installSuperpowers.toLowerCase() === "true";
378
- }
379
- if (options.installSuperpowers === void 0) {
380
- options.installSuperpowers = false;
381
- }
382
- if (typeof options.installAgentBrowser === "string") {
383
- options.installAgentBrowser = options.installAgentBrowser.toLowerCase() === "true";
384
- }
385
- if (options.installAgentBrowser === void 0) {
386
- options.installAgentBrowser = true;
387
- }
388
- if (options.configAction && !["new", "backup", "merge", "docs-only", "skip"].includes(options.configAction)) {
389
- throw new Error(
390
- i18n.t("errors:invalidConfigAction", { value: options.configAction })
391
- );
392
- }
393
- if (options.apiType && !["auth_token", "api_key", "ccr_proxy", "skip"].includes(options.apiType)) {
394
- throw new Error(
395
- i18n.t("errors:invalidApiType", { value: options.apiType })
396
- );
397
- }
398
- if (options.apiConfigs && options.apiConfigsFile) {
399
- throw new Error(i18n.t("multi-config:conflictingParams"));
400
- }
401
- const modelParams = [
402
- ["apiModel", options.apiModel],
403
- ["apiHaikuModel", options.apiHaikuModel],
404
- ["apiSonnetModel", options.apiSonnetModel],
405
- ["apiOpusModel", options.apiOpusModel]
406
- ];
407
- for (const [key, value] of modelParams) {
408
- if (value !== void 0 && typeof value !== "string") {
409
- if (key === "apiModel")
410
- throw new Error(i18n.t("errors:invalidApiModel", { value }));
411
- throw new Error(i18n.t("errors:invalidModelParam", { key, value }));
412
- }
413
- }
414
- if (options.apiType === "api_key" && !options.apiKey) {
415
- throw new Error(i18n.t("errors:apiKeyRequiredForApiKey"));
416
- }
417
- if (options.apiType === "auth_token" && !options.apiKey) {
418
- throw new Error(i18n.t("errors:apiKeyRequiredForAuthToken"));
419
- }
420
- if (typeof options.mcpServices === "string") {
421
- if (options.mcpServices === "skip") {
422
- options.mcpServices = false;
423
- } else if (options.mcpServices === "all") {
424
- options.mcpServices = MCP_SERVICE_CONFIGS.filter((s) => !s.requiresApiKey).map((s) => s.id);
425
- } else {
426
- options.mcpServices = options.mcpServices.split(",").map((s) => s.trim());
427
- }
428
- }
429
- if (Array.isArray(options.mcpServices)) {
430
- const validServices = MCP_SERVICE_CONFIGS.map((s) => s.id);
431
- for (const service of options.mcpServices) {
432
- if (!validServices.includes(service)) {
433
- throw new Error(i18n.t("errors:invalidMcpService", { service, validServices: validServices.join(", ") }));
434
- }
435
- }
436
- }
437
- if (Array.isArray(options.outputStyles)) {
438
- const validStyles = ["speed-coder", "senior-architect", "pair-programmer", "default", "explanatory", "learning"];
439
- for (const style of options.outputStyles) {
440
- if (!validStyles.includes(style)) {
441
- throw new Error(i18n.t("errors:invalidOutputStyle", { style, validStyles: validStyles.join(", ") }));
442
- }
443
- }
444
- }
445
- if (options.defaultOutputStyle) {
446
- const validStyles = ["speed-coder", "senior-architect", "pair-programmer", "default", "explanatory", "learning"];
447
- if (!validStyles.includes(options.defaultOutputStyle)) {
448
- throw new Error(i18n.t("errors:invalidDefaultOutputStyle", { style: options.defaultOutputStyle, validStyles: validStyles.join(", ") }));
449
- }
450
- }
451
- if (options.orchestration !== void 0) {
452
- parseOrchestrationLevel(options.orchestration);
453
- }
454
- if (typeof options.workflows === "string") {
455
- if (options.workflows === "skip") {
456
- options.workflows = false;
457
- } else if (options.workflows === "all") {
458
- options.workflows = WORKFLOW_CONFIG_BASE.map((w) => w.id);
459
- } else {
460
- options.workflows = options.workflows.split(",").map((s) => s.trim());
461
- }
462
- }
463
- if (Array.isArray(options.workflows)) {
464
- const validWorkflows = WORKFLOW_CONFIG_BASE.map((w) => w.id);
465
- for (const workflow of options.workflows) {
466
- if (!validWorkflows.includes(workflow)) {
467
- throw new Error(i18n.t("errors:invalidWorkflow", { workflow, validWorkflows: validWorkflows.join(", ") }));
468
- }
469
- }
470
- }
471
- if (options.mcpServices === void 0) {
472
- options.mcpServices = "all";
473
- options.mcpServices = MCP_SERVICE_CONFIGS.filter((s) => !s.requiresApiKey).map((s) => s.id);
474
- }
475
- if (options.workflows === void 0) {
476
- options.workflows = "all";
477
- options.workflows = WORKFLOW_CONFIG_BASE.map((w) => w.id);
478
- }
479
- if (options.orchestration === void 0) {
480
- options.orchestration = "max";
481
- }
482
- }
483
- async function silentInit(options = {}) {
484
- try {
485
- try {
486
- const { cleanupZcfNamespace } = await import('./cleanup-migration.mjs');
487
- cleanupZcfNamespace();
488
- } catch {
489
- }
490
- const { detectSmartDefaults } = await import('./smart-defaults.mjs').then(function (n) { return n.s; });
491
- const defaults = await detectSmartDefaults();
492
- if (!defaults.apiKey) {
493
- throw new Error("Silent mode requires ANTHROPIC_API_KEY environment variable");
494
- }
495
- options.skipPrompt = true;
496
- options.skipBanner = true;
497
- options.initSource = "silent-init";
498
- options.yes = true;
499
- options.silent = false;
500
- options.apiType = "api_key";
501
- options.apiKey = defaults.apiKey;
502
- if (defaults.apiProvider && defaults.apiProvider !== "anthropic") {
503
- options.provider = defaults.apiProvider;
504
- }
505
- const topMcpServices = defaults.mcpServices.slice(0, 3);
506
- options.mcpServices = topMcpServices;
507
- options.codeType = defaults.codeToolType || "claude-code";
508
- options.configAction = "backup";
509
- options.installCometixLine = false;
510
- options.installSuperpowers = false;
511
- options.installAgentBrowser = options.installAgentBrowser ?? true;
512
- options.workflows = false;
513
- options.orchestration = options.orchestration || defaults.workflows.orchestrationLevel || "minimal";
514
- console.log(`Initializing CCJK (silent mode)...`);
515
- console.log(` Code Tool: ${defaults.codeToolType}`);
516
- console.log(` API Provider: ${defaults.apiProvider || "anthropic"}`);
517
- console.log(` MCP Services: ${topMcpServices.join(", ")}`);
518
- await init(options);
519
- console.log("\u2713 CCJK initialized successfully");
520
- } catch (error) {
521
- displayError(error, "Silent initialization");
522
- throw error;
523
- }
524
- }
525
- async function handleSuperpowersInstallation(options) {
526
- try {
527
- const status = await checkSuperpowersInstalled();
528
- if (status.installed) {
529
- console.log(a.green(`\u2714 ${i18n.t("superpowers:alreadyInstalled")}`));
530
- if (status.version) {
531
- console.log(a.gray(` ${i18n.t("superpowers:status.version", { version: status.version })}`));
532
- }
533
- if (status.skillCount) {
534
- console.log(a.gray(` ${i18n.t("superpowers:status.skillCount", { count: status.skillCount })}`));
535
- }
536
- return;
537
- }
538
- let shouldInstall = false;
539
- if (options.skipPrompt) {
540
- shouldInstall = options.installSuperpowers === true;
541
- } else {
542
- console.log(a.green(`
543
- ${i18n.t("superpowers:title")}`));
544
- console.log(a.gray(i18n.t("superpowers:description")));
545
- console.log(a.gray(i18n.t("superpowers:installPromptDescription")));
546
- shouldInstall = await promptBoolean({
547
- message: i18n.t("superpowers:installPrompt"),
548
- defaultValue: false
549
- });
550
- }
551
- if (!shouldInstall) {
552
- console.log(a.yellow(i18n.t("common:skip")));
553
- return;
554
- }
555
- const result = await installSuperpowers({
556
- lang: i18n.language,
557
- skipPrompt: options.skipPrompt
558
- });
559
- if (result.success) {
560
- console.log(a.green(`\u2714 ${result.message}`));
561
- } else {
562
- console.error(a.red(`\u2716 ${result.message}`));
563
- if (result.error) {
564
- console.error(a.gray(` ${result.error}`));
565
- }
566
- }
567
- } catch (error) {
568
- const errorMessage = error instanceof Error ? error.message : String(error);
569
- console.error(a.red(`${i18n.t("superpowers:installFailed")}: ${errorMessage}`));
570
- }
571
- }
572
- async function init(options = {}) {
573
- options.initSource = options.initSource || "init";
574
- options.orchestration = parseOrchestrationLevel(options.orchestration);
575
- try {
576
- const { cleanupZcfNamespace } = await import('./cleanup-migration.mjs');
577
- const { removed } = cleanupZcfNamespace();
578
- if (removed.length > 0) {
579
- console.log(a.dim(`Cleaned up legacy zcf namespace: ${removed.join(", ")}`));
580
- }
581
- } catch {
582
- }
583
- if (options.silent) {
584
- return await silentInit(options);
585
- }
586
- if (options.smart) {
587
- return await smartInit(options);
588
- }
589
- if (options.skipPrompt) {
590
- await validateSkipPromptOptions(options);
591
- }
592
- try {
593
- const tracker = new ProgressTracker([
594
- "Reading configuration",
595
- "Selecting code tool",
596
- "Configuring API",
597
- "Installing MCP services",
598
- "Setting up workflows",
599
- "Finalizing setup"
600
- ]);
601
- if (!options.skipPrompt && !options.skipBanner) {
602
- tracker.start();
603
- }
604
- if (!options.skipPrompt && !options.skipBanner) tracker.nextStep();
605
- const zcfConfig = readZcfConfig();
606
- if (!options.skipPrompt && !options.skipBanner) tracker.nextStep();
607
- let codeToolType;
608
- try {
609
- codeToolType = await resolveCodeType(options.codeType);
610
- } catch (error) {
611
- const errorMessage = error instanceof Error ? error.message : String(error);
612
- console.error(a.red(`${i18n.t("errors:generalError")} ${errorMessage}`));
613
- codeToolType = DEFAULT_CODE_TOOL_TYPE;
614
- }
615
- options.codeType = codeToolType;
616
- async function selectApiConfigurationMode() {
617
- const { apiMode } = await inquirer.prompt({
618
- type: "list",
619
- name: "apiMode",
620
- message: i18n.t("api:selectApiMode"),
621
- choices: [
622
- {
623
- name: i18n.t("api:useOfficialLogin"),
624
- value: "official"
625
- },
626
- {
627
- name: i18n.t("api:customApiConfig"),
628
- value: "custom"
629
- },
630
- {
631
- name: i18n.t("api:useCcrProxy"),
632
- value: "ccr"
633
- },
634
- {
635
- name: i18n.t("api:skipApi"),
636
- value: "skip"
637
- }
638
- ]
639
- });
640
- return apiMode;
641
- }
642
- async function handleCustomApiConfiguration(existingConfig) {
643
- if (codeToolType === "claude-code") {
644
- const { configureIncrementalManagement } = await import('./claude-code-incremental-manager.mjs');
645
- await configureIncrementalManagement();
646
- return null;
647
- }
648
- if (existingConfig) {
649
- const customConfigAction = await promptApiConfigurationAction();
650
- if (customConfigAction === "modify-partial") {
651
- await modifyApiConfigPartially(existingConfig);
652
- return null;
653
- } else if (customConfigAction === "modify-all") {
654
- return await configureApiCompletely();
655
- } else if (customConfigAction === "keep-existing") {
656
- try {
657
- addCompletedOnboarding();
658
- } catch (error) {
659
- console.error(a.red(i18n.t("errors:failedToSetOnboarding")), error);
660
- }
661
- try {
662
- setPrimaryApiKey();
663
- } catch (error) {
664
- const { ensureI18nInitialized, i18n: i18nModule } = await import('./index5.mjs');
665
- ensureI18nInitialized();
666
- console.error(i18nModule.t("mcp:primaryApiKeySetFailed"), error);
667
- }
668
- return null;
669
- }
670
- } else {
671
- const { apiChoice } = await inquirer.prompt({
672
- type: "list",
673
- name: "apiChoice",
674
- message: i18n.t("api:configureApi"),
675
- choices: [
676
- {
677
- name: `${i18n.t("api:useAuthToken")} - ${a.gray(i18n.t("api:authTokenDesc"))}`,
678
- value: "auth_token",
679
- short: i18n.t("api:useAuthToken")
680
- },
681
- {
682
- name: `${i18n.t("api:useApiKey")} - ${a.gray(i18n.t("api:apiKeyDesc"))}`,
683
- value: "api_key",
684
- short: i18n.t("api:useApiKey")
685
- }
686
- ]
687
- });
688
- if (!apiChoice) {
689
- console.log(a.yellow(i18n.t("common:cancelled")));
690
- process__default.exit(0);
691
- }
692
- return await configureApiCompletely(apiChoice);
693
- }
694
- }
695
- if (!options.skipBanner) {
696
- displayBannerWithInfo(CODE_TOOL_BANNERS[codeToolType] || "CCJK");
697
- }
698
- if (isTermux()) {
699
- console.log(a.yellow(`
700
- \u2139 ${i18n.t("installation:termuxDetected")}`));
701
- console.log(a.gray(i18n.t("installation:termuxEnvironmentInfo")));
702
- }
703
- let configLang = options.configLang;
704
- if (codeToolType === "codex") {
705
- if (!configLang) {
706
- if (options.skipPrompt) {
707
- configLang = zcfConfig?.templateLang || "en";
708
- } else {
709
- configLang = zcfConfig?.templateLang || i18n.language || "en";
710
- }
711
- }
712
- } else {
713
- if (!configLang) {
714
- const { resolveTemplateLanguage } = await import('./prompts.mjs');
715
- configLang = await resolveTemplateLanguage(
716
- options.configLang,
717
- zcfConfig,
718
- options.skipPrompt
719
- );
720
- }
721
- }
722
- if (!configLang) {
723
- configLang = "en";
724
- }
725
- if (codeToolType === "codex") {
726
- if (options.skipPrompt)
727
- process__default.env.CCJK_CODEX_SKIP_PROMPT_SINGLE_BACKUP = "true";
728
- const hasApiConfigs = Boolean(options.apiConfigs || options.apiConfigsFile);
729
- const apiMode = hasApiConfigs ? "skip" : options.apiType === "auth_token" ? "official" : options.apiType === "api_key" ? "custom" : options.apiType === "skip" ? "skip" : options.skipPrompt ? "skip" : void 0;
730
- const customApiConfig = !hasApiConfigs && options.apiType === "api_key" && options.apiKey ? {
731
- type: "api_key",
732
- token: options.apiKey,
733
- baseUrl: options.apiUrl,
734
- model: options.apiModel
735
- // Add model parameter for Codex
736
- } : void 0;
737
- let selectedWorkflows;
738
- if (Array.isArray(options.workflows)) {
739
- selectedWorkflows = options.workflows;
740
- } else if (typeof options.workflows === "string") {
741
- selectedWorkflows = [options.workflows];
742
- } else if (options.workflows === true) {
743
- selectedWorkflows = [];
744
- }
745
- if (hasApiConfigs) {
746
- await handleMultiConfigurations(options, "codex");
747
- }
748
- const resolvedAiOutputLang = await runCodexFullInit({
749
- aiOutputLang: options.aiOutputLang,
750
- skipPrompt: options.skipPrompt,
751
- apiMode,
752
- customApiConfig,
753
- workflows: selectedWorkflows
754
- });
755
- updateZcfConfig({
756
- version: ccjkVersion,
757
- preferredLang: i18n.language,
758
- // CCJK界面语言
759
- templateLang: configLang,
760
- // 模板语言
761
- aiOutputLang: resolvedAiOutputLang ?? options.aiOutputLang ?? zcfConfig?.aiOutputLang ?? "en",
762
- codeToolType
763
- });
764
- console.log(a.green(i18n.t("codex:setupComplete")));
765
- return;
766
- }
767
- const aiOutputLang = await resolveAiOutputLanguage(i18n.language, options.aiOutputLang, zcfConfig, options.skipPrompt);
768
- const installationStatus = await getInstallationStatus();
769
- if (installationStatus.hasGlobal) {
770
- const { verifyInstallation, displayVerificationResult } = await import('./installer.mjs');
771
- const verification = await verifyInstallation("claude-code");
772
- if (verification.symlinkCreated) {
773
- console.log(a.green(`\u2714 ${i18n.t("installation:alreadyInstalled")}`));
774
- displayVerificationResult(verification, "claude-code");
775
- } else if (!verification.success) {
776
- console.log(a.yellow(`\u26A0 ${i18n.t("installation:verificationFailed")}`));
777
- if (verification.error) {
778
- console.log(a.gray(` ${verification.error}`));
779
- }
780
- }
781
- } else {
782
- if (options.skipPrompt) {
783
- await installClaudeCode(true);
784
- } else {
785
- const shouldInstall = await promptBoolean({
786
- message: i18n.t("installation:installPrompt"),
787
- defaultValue: true
788
- });
789
- if (shouldInstall) {
790
- await installClaudeCode(false);
791
- } else {
792
- console.log(a.yellow(i18n.t("common:skip")));
793
- }
794
- }
795
- }
796
- if (installationStatus.hasGlobal) {
797
- await checkClaudeCodeVersionAndPrompt(options.skipPrompt);
798
- }
799
- ensureClaudeDir();
800
- if (existsSync(SETTINGS_FILE) && needsMigration()) {
801
- if (options.skipPrompt) {
802
- console.log(a.yellow("\n\u26A0\uFE0F Problematic configuration detected. Auto-fixing...\n"));
803
- const result = migrateSettingsForTokenRetrieval();
804
- displayMigrationResult(result);
805
- } else {
806
- const shouldMigrate = await promptMigration();
807
- if (shouldMigrate) {
808
- const result = migrateSettingsForTokenRetrieval();
809
- displayMigrationResult(result);
810
- }
811
- }
812
- }
813
- let action = "new";
814
- if (existsSync(SETTINGS_FILE) && !options.force) {
815
- if (options.skipPrompt) {
816
- action = options.configAction || "backup";
817
- if (action === "skip") {
818
- console.log(a.yellow(i18n.t("common:skip")));
819
- return;
820
- }
821
- } else {
822
- const { action: userAction } = await inquirer.prompt({
823
- type: "list",
824
- name: "action",
825
- message: i18n.t("configuration:existingConfig"),
826
- choices: addNumbersToChoices([
827
- { name: i18n.t("configuration:backupAndOverwrite"), value: "backup" },
828
- { name: i18n.t("configuration:updateDocsOnly"), value: "docs-only" },
829
- { name: i18n.t("configuration:mergeConfig"), value: "merge" },
830
- { name: i18n.t("common:skip"), value: "skip" }
831
- ])
832
- });
833
- if (!userAction) {
834
- console.log(a.yellow(i18n.t("common:cancelled")));
835
- process__default.exit(0);
836
- }
837
- action = userAction;
838
- if (action === "skip") {
839
- console.log(a.yellow(i18n.t("common:skip")));
840
- return;
841
- }
842
- }
843
- } else if (options.skipPrompt && options.configAction) {
844
- action = options.configAction;
845
- }
846
- const isNewInstall = !existsSync(SETTINGS_FILE);
847
- if (!options.skipPrompt && (isNewInstall || ["backup", "merge", "new"].includes(action))) {
848
- const isZh = i18n.language === "zh-CN";
849
- console.log("");
850
- console.log(a.bold.cyan(isZh ? "\u{1F48E} \u9876\u7EA7\u5927\u795E\u7F16\u6392\u7406\u5FF5\uFF08\u9ED8\u8BA4\u9996\u9009\uFF09" : "\u{1F48E} Expert Workflow Orchestration (Default First Choice)"));
851
- console.log(a.dim(isZh ? "\u53EF\u540C\u6B65\u4F18\u5316\u89C4\u5212\u3001\u9A8C\u8BC1\u3001\u5B50\u4EE3\u7406\u4E0E\u89C4\u5219\u6267\u884C\u8D28\u91CF\uFF0C\u5EFA\u8BAE\u9996\u6B21\u5B89\u88C5\u7ACB\u5373\u542F\u7528\u3002" : "Improves planning, verification, subagent strategy, and rule execution quality. Recommended on first install."));
852
- const { orchestrationChoice } = await inquirer.prompt({
853
- type: "list",
854
- name: "orchestrationChoice",
855
- message: isZh ? "\u8BF7\u9009\u62E9\u9ED8\u8BA4\u7F16\u6392\u7EA7\u522B\uFF1A" : "Select default orchestration level:",
856
- default: "max",
857
- choices: addNumbersToChoices([
858
- {
859
- name: isZh ? "\u9876\u7EA7\u6A21\u5F0F\uFF08\u63A8\u8350\uFF09- \u6700\u5927\u5316\u8D28\u91CF\u4E0E\u6D41\u7A0B\u7EA6\u675F" : "Expert Mode (Recommended) - Maximum quality and workflow enforcement",
860
- value: "max"
861
- },
862
- {
863
- name: isZh ? "\u6807\u51C6\u6A21\u5F0F - \u5E73\u8861\u8D28\u91CF\u4E0E\u901F\u5EA6" : "Standard Mode - Balanced quality and speed",
864
- value: "standard"
865
- },
866
- {
867
- name: isZh ? "\u8F7B\u91CF\u6A21\u5F0F - \u66F4\u5C11\u6D41\u7A0B\uFF0C\u66F4\u5FEB\u6267\u884C" : "Minimal Mode - Lighter process, faster execution",
868
- value: "minimal"
869
- },
870
- {
871
- name: isZh ? "\u5173\u95ED - \u4E0D\u542F\u7528\u7F16\u6392\u7B56\u7565" : "Off - Disable orchestration policy",
872
- value: "off"
873
- }
874
- ])
875
- });
876
- options.orchestration = orchestrationChoice;
877
- console.log(a.green(`\u2714 ${isZh ? "\u5DF2\u8BBE\u4E3A\u9ED8\u8BA4\u9996\u9009" : "Set as default first choice"}: ${orchestrationChoice}`));
878
- }
879
- if (!options.skipPrompt && !options.skipBanner) tracker.nextStep("Configuring API");
880
- let apiConfig = null;
881
- if (action !== "docs-only" && (isNewInstall || ["backup", "merge", "new"].includes(action))) {
882
- if (options.skipPrompt) {
883
- if (options.apiConfigs || options.apiConfigsFile) {
884
- await handleMultiConfigurations(options, codeToolType);
885
- apiConfig = null;
886
- } else if (options.provider && options.apiKey) {
887
- const { getProviderPreset } = await import('./api-providers.mjs');
888
- const preset = options.provider !== "custom" ? getProviderPreset(options.provider) : null;
889
- apiConfig = {
890
- authType: preset?.claudeCode?.authType || "api_key",
891
- key: options.apiKey,
892
- url: preset?.claudeCode?.baseUrl || options.apiUrl || API_DEFAULT_URL
893
- };
894
- if (preset?.claudeCode?.defaultModels && preset.claudeCode.defaultModels.length > 0) {
895
- const [primary, haiku, sonnet, opus] = preset.claudeCode.defaultModels;
896
- options.apiModel = options.apiModel || primary;
897
- options.apiHaikuModel = options.apiHaikuModel || haiku;
898
- options.apiSonnetModel = options.apiSonnetModel || sonnet;
899
- options.apiOpusModel = options.apiOpusModel || opus;
900
- }
901
- await saveSingleConfigToToml(apiConfig, options.provider, options);
902
- } else if (options.apiType === "auth_token" && options.apiKey) {
903
- apiConfig = {
904
- authType: "auth_token",
905
- key: options.apiKey,
906
- url: options.apiUrl || API_DEFAULT_URL
907
- };
908
- await saveSingleConfigToToml(apiConfig, void 0, options);
909
- } else if (options.apiType === "api_key" && options.apiKey) {
910
- apiConfig = {
911
- authType: "api_key",
912
- key: options.apiKey,
913
- url: options.apiUrl || API_DEFAULT_URL
914
- };
915
- await saveSingleConfigToToml(apiConfig, void 0, options);
916
- } else if (options.apiType === "ccr_proxy") {
917
- const ccrStatus = await isCcrInstalled();
918
- if (!ccrStatus.hasCorrectPackage) {
919
- await installCcr();
920
- } else {
921
- console.log(a.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
922
- }
923
- const existingCcrConfig = readCcrConfig();
924
- if (existingCcrConfig) {
925
- const backupPath = await backupCcrConfig();
926
- if (backupPath) {
927
- console.log(a.gray(`\u2714 ${i18n.t("ccr:ccrBackupSuccess")}: ${backupPath}`));
928
- }
929
- }
930
- const defaultCcrConfig = createDefaultCcrConfig();
931
- writeCcrConfig(defaultCcrConfig);
932
- console.log(a.green(`\u2714 ${i18n.t("ccr:ccrConfigSuccess")}`));
933
- await configureCcrProxy(defaultCcrConfig);
934
- console.log(a.green(`\u2714 ${i18n.t("ccr:proxyConfigSuccess")}`));
935
- try {
936
- addCompletedOnboarding();
937
- } catch (error) {
938
- console.error(a.red(i18n.t("errors:failedToSetOnboarding")), error);
939
- }
940
- apiConfig = null;
941
- }
942
- } else {
943
- const existingApiConfig = getExistingApiConfig();
944
- const apiMode = await selectApiConfigurationMode();
945
- switch (apiMode) {
946
- case "official": {
947
- const success = switchToOfficialLogin();
948
- if (success) {
949
- console.log(a.green(`\u2714 ${i18n.t("api:officialLoginConfigured")}`));
950
- apiConfig = null;
951
- } else {
952
- console.log(a.red(i18n.t("api:officialLoginFailed")));
953
- }
954
- break;
955
- }
956
- case "custom":
957
- apiConfig = await handleCustomApiConfiguration(existingApiConfig);
958
- break;
959
- case "ccr": {
960
- const ccrStatus = await isCcrInstalled();
961
- if (!ccrStatus.hasCorrectPackage) {
962
- await installCcr();
963
- } else {
964
- console.log(a.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
965
- }
966
- const ccrConfigured = await setupCcrConfiguration();
967
- if (ccrConfigured) {
968
- console.log(a.green(`\u2714 ${i18n.t("ccr:ccrSetupComplete")}`));
969
- apiConfig = null;
970
- }
971
- break;
972
- }
973
- case "skip":
974
- apiConfig = null;
975
- break;
976
- default:
977
- console.log(a.yellow(i18n.t("common:cancelled")));
978
- process__default.exit(0);
979
- }
980
- }
981
- }
982
- if (["backup", "docs-only", "merge"].includes(action)) {
983
- const backupDir = backupExistingConfig();
984
- if (backupDir) {
985
- console.log(a.gray(`\u2714 ${i18n.t("configuration:backupSuccess")}: ${backupDir}`));
986
- }
987
- }
988
- if (action === "docs-only") {
989
- copyConfigFiles(true);
990
- if (options.skipPrompt) {
991
- if (options.workflows !== false) {
992
- await selectAndInstallWorkflows(configLang, options.workflows);
993
- }
994
- } else {
995
- await selectAndInstallWorkflows(configLang);
996
- }
997
- } else if (["backup", "merge", "new"].includes(action)) {
998
- copyConfigFiles(false);
999
- if (options.skipPrompt) {
1000
- if (options.workflows !== false) {
1001
- await selectAndInstallWorkflows(configLang, options.workflows);
1002
- }
1003
- } else {
1004
- await selectAndInstallWorkflows(configLang);
1005
- }
1006
- }
1007
- applyAiLanguageDirective(aiOutputLang);
1008
- if (options.skipPrompt) {
1009
- if (options.outputStyles !== false) {
1010
- await configureOutputStyle(
1011
- options.outputStyles,
1012
- options.defaultOutputStyle
1013
- );
1014
- }
1015
- } else {
1016
- await configureOutputStyle();
1017
- }
1018
- if (apiConfig && action !== "docs-only") {
1019
- const configuredApi = configureApi(apiConfig);
1020
- if (configuredApi) {
1021
- console.log(a.green(`\u2714 ${i18n.t("api:apiConfigSuccess")}`));
1022
- console.log(a.gray(` URL: ${configuredApi.url}`));
1023
- console.log(a.gray(` Key: ${formatApiKeyDisplay(configuredApi.key)}`));
1024
- }
1025
- }
1026
- const hasModelParams = options.apiModel || options.apiHaikuModel || options.apiSonnetModel || options.apiOpusModel;
1027
- if (hasModelParams && action !== "docs-only" && codeToolType === "claude-code") {
1028
- if (options.skipPrompt) {
1029
- const { updateCustomModel } = await import('./config.mjs').then(function (n) { return n.j; });
1030
- updateCustomModel(
1031
- options.apiModel || void 0,
1032
- options.apiHaikuModel || void 0,
1033
- options.apiSonnetModel || void 0,
1034
- options.apiOpusModel || void 0
1035
- );
1036
- console.log(a.green(`\u2714 ${i18n.t("api:modelConfigSuccess")}`));
1037
- if (options.apiModel) {
1038
- console.log(a.gray(` ${i18n.t("api:primaryModel")}: ${options.apiModel}`));
1039
- }
1040
- if (options.apiHaikuModel)
1041
- console.log(a.gray(` Haiku: ${options.apiHaikuModel}`));
1042
- if (options.apiSonnetModel)
1043
- console.log(a.gray(` Sonnet: ${options.apiSonnetModel}`));
1044
- if (options.apiOpusModel)
1045
- console.log(a.gray(` Opus: ${options.apiOpusModel}`));
1046
- }
1047
- }
1048
- if (!options.skipPrompt && !options.skipBanner) tracker.nextStep("Installing MCP services");
1049
- if (action !== "docs-only") {
1050
- let shouldConfigureMcp = false;
1051
- if (options.skipPrompt) {
1052
- shouldConfigureMcp = options.mcpServices !== false;
1053
- } else {
1054
- const userChoice = await promptBoolean({
1055
- message: i18n.t("mcp:configureMcp"),
1056
- defaultValue: true
1057
- });
1058
- shouldConfigureMcp = userChoice;
1059
- }
1060
- if (shouldConfigureMcp) {
1061
- if (isWindows()) {
1062
- console.log(a.green(`\u2139 ${i18n.t("installation:windowsDetected")}`));
1063
- }
1064
- let selectedServices;
1065
- if (options.skipPrompt) {
1066
- selectedServices = options.mcpServices;
1067
- } else {
1068
- selectedServices = await selectMcpServices();
1069
- if (selectedServices === void 0) {
1070
- process__default.exit(0);
1071
- }
1072
- }
1073
- if (selectedServices.length > 0) {
1074
- const mcpBackupPath = backupMcpConfig();
1075
- if (mcpBackupPath) {
1076
- console.log(a.gray(`\u2714 ${i18n.t("mcp:mcpBackupSuccess")}: ${mcpBackupPath}`));
1077
- }
1078
- const newServers = {};
1079
- for (const serviceId of selectedServices) {
1080
- const services = await getMcpServices();
1081
- const service = services.find((s) => s.id === serviceId);
1082
- if (!service)
1083
- continue;
1084
- let config = service.config;
1085
- if (service.id === "serena" && Array.isArray(config.args)) {
1086
- const adjusted = { ...config, args: [...config.args || []] };
1087
- const idx = adjusted.args.indexOf("--context");
1088
- if (idx >= 0 && idx + 1 < adjusted.args.length) {
1089
- adjusted.args[idx + 1] = codeToolType === "codex" ? "codex" : "ide-assistant";
1090
- } else {
1091
- adjusted.args.push("--context", codeToolType === "codex" ? "codex" : "ide-assistant");
1092
- }
1093
- config = adjusted;
1094
- }
1095
- if (service.requiresApiKey) {
1096
- if (options.skipPrompt) {
1097
- console.log(a.yellow(`${i18n.t("common:skip")}: ${service.name} (requires API key)`));
1098
- continue;
1099
- } else {
1100
- const response = await inquirer.prompt({
1101
- type: "input",
1102
- name: "apiKey",
1103
- message: service.apiKeyPrompt,
1104
- validate: (value) => !!value || i18n.t("api:keyRequired")
1105
- });
1106
- if (!response.apiKey) {
1107
- console.log(a.yellow(`${i18n.t("common:skip")}: ${service.name}`));
1108
- continue;
1109
- }
1110
- config = buildMcpServerConfig(service.config, response.apiKey, service.apiKeyPlaceholder, service.apiKeyEnvVar);
1111
- }
1112
- }
1113
- newServers[service.id] = config;
1114
- }
1115
- const existingConfig = readMcpConfig();
1116
- let mergedConfig = replaceMcpServers(existingConfig, newServers);
1117
- mergedConfig = fixWindowsMcpConfig(mergedConfig);
1118
- try {
1119
- writeMcpConfig(mergedConfig);
1120
- syncMcpPermissions();
1121
- console.log(a.green(`\u2714 ${i18n.t("mcp:mcpConfigSuccess")}`));
1122
- const { checkMcpPerformance, formatPerformanceWarning } = await import('./mcp-performance.mjs').then(function (n) { return n.e; });
1123
- const serviceCount = Object.keys(newServers).length;
1124
- const perfWarning = checkMcpPerformance(serviceCount);
1125
- if (perfWarning) {
1126
- console.log("");
1127
- console.log(formatPerformanceWarning(perfWarning, i18n.language));
1128
- }
1129
- } catch (error) {
1130
- displayError(error, "MCP configuration");
1131
- }
1132
- }
1133
- }
1134
- }
1135
- const cometixInstalled = await isCometixLineInstalled();
1136
- if (!cometixInstalled) {
1137
- let shouldInstallCometix = false;
1138
- if (options.skipPrompt) {
1139
- shouldInstallCometix = options.installCometixLine !== false;
1140
- } else {
1141
- const userChoice = await promptBoolean({
1142
- message: i18n.t("cometix:installCometixPrompt"),
1143
- defaultValue: true
1144
- });
1145
- shouldInstallCometix = userChoice;
1146
- }
1147
- if (shouldInstallCometix) {
1148
- await installCometixLine();
1149
- } else {
1150
- console.log(a.yellow(i18n.t("cometix:cometixSkipped")));
1151
- }
1152
- } else {
1153
- console.log(a.green(`\u2714 ${i18n.t("cometix:cometixAlreadyInstalled")}`));
1154
- }
1155
- if (!options.skipPrompt || options.installSuperpowers) {
1156
- await handleSuperpowersInstallation(options);
1157
- }
1158
- let agentBrowserReady = false;
1159
- try {
1160
- const isZh = i18n.language === "zh-CN";
1161
- let shouldInstallAgentBrowser = false;
1162
- if (options.skipPrompt) {
1163
- shouldInstallAgentBrowser = options.installAgentBrowser !== false;
1164
- } else {
1165
- shouldInstallAgentBrowser = await promptBoolean({
1166
- message: isZh ? "\u5B89\u88C5 Agent Browser \u6D4F\u89C8\u5668\u81EA\u52A8\u5316\u6A21\u5757\uFF1F\uFF08\u63A8\u8350\uFF0C\u6D4F\u89C8\u5668\u4EFB\u52A1\u53EF\u65E0\u7F1D\u4F7F\u7528\uFF09" : "Install Agent Browser module? (recommended for seamless browser automation)",
1167
- defaultValue: true
1168
- });
1169
- }
1170
- if (shouldInstallAgentBrowser) {
1171
- const { checkAgentBrowserInstalled, installAgentBrowser } = await import('./installer2.mjs');
1172
- const installed = await checkAgentBrowserInstalled();
1173
- const success = installed ? true : await installAgentBrowser();
1174
- if (success) {
1175
- const { addSkill } = await import('./manager.mjs');
1176
- const { browserSkill } = await import('./skill.mjs');
1177
- addSkill(browserSkill);
1178
- agentBrowserReady = true;
1179
- console.log(a.green(`\u2714 ${isZh ? "Agent Browser \u5DF2\u5C31\u7EEA\uFF0C\u6D4F\u89C8\u5668 Skill \u5DF2\u542F\u7528" : "Agent Browser ready, browser skill enabled"}`));
1180
- console.log(a.gray(` ${isZh ? "\u53EF\u76F4\u63A5\u4F7F\u7528:" : "Use directly:"} ccjk browser start https://example.com`));
1181
- }
1182
- } else {
1183
- console.log(a.yellow(isZh ? "\u26A0 \u5DF2\u8DF3\u8FC7 Agent Browser \u5B89\u88C5" : "\u26A0 Agent Browser installation skipped"));
1184
- }
1185
- } catch (error) {
1186
- const msg = error instanceof Error ? error.message : String(error);
1187
- console.log(a.gray(`\u2139 Agent Browser setup skipped: ${msg}`));
1188
- }
1189
- try {
1190
- const { injectSmartGuide } = await import('./smart-guide.mjs');
1191
- const smartGuideSuccess = await injectSmartGuide(configLang);
1192
- if (smartGuideSuccess) {
1193
- console.log(a.green(`\u2714 ${i18n.t("smartGuide:enabled")}`));
1194
- }
1195
- } catch {
1196
- console.log(a.gray(`\u2139 ${i18n.t("smartGuide:skipped")}`));
1197
- }
1198
- try {
1199
- const finalOrchestrationLevel = parseOrchestrationLevel(options.orchestration);
1200
- const policyPath = writeOrchestrationPolicy({
1201
- level: finalOrchestrationLevel,
1202
- language: configLang,
1203
- source: options.initSource
1204
- });
1205
- console.log(a.green(`\u2714 Workflow orchestration: ${finalOrchestrationLevel} (${policyPath})`));
1206
- } catch (error) {
1207
- const msg = error instanceof Error ? error.message : String(error);
1208
- console.log(a.gray(`\u2139 Workflow orchestration skipped: ${msg}`));
1209
- }
1210
- if (!options.skipPrompt && !options.skipBanner) tracker.nextStep("Finalizing setup");
1211
- updateZcfConfig({
1212
- version: ccjkVersion,
1213
- preferredLang: i18n.language,
1214
- // CCJK界面语言
1215
- templateLang: configLang,
1216
- // 模板语言
1217
- aiOutputLang,
1218
- codeToolType
1219
- });
1220
- if (!options.skipPrompt) {
1221
- const { importRecommendedEnv, importRecommendedPermissions } = await import('./simple-config.mjs');
1222
- const confirmImport = await promptBoolean({
1223
- message: i18n.t("configuration:recommendImportEnvPerm") || "\u5BFC\u5165 CCJK \u63A8\u8350\u7684\u73AF\u5883\u53D8\u91CF\u548C\u6743\u9650\u914D\u7F6E\uFF1F\uFF08\u63A8\u8350\uFF0C\u53EF\u51CF\u5C11\u6743\u9650\u5F39\u7A97\uFF09",
1224
- defaultValue: true
1225
- });
1226
- if (confirmImport) {
1227
- try {
1228
- await importRecommendedEnv();
1229
- console.log(a.green(`\u2714 ${i18n.t("configuration:envImportSuccess")}`));
1230
- } catch (error) {
1231
- console.error(a.yellow(`\u26A0 ${i18n.t("configuration:envImportFailed")}: ${error}`));
1232
- }
1233
- try {
1234
- await importRecommendedPermissions();
1235
- console.log(a.green(`\u2714 ${i18n.t("configuration:permissionsImportSuccess") || "\u6743\u9650\u914D\u7F6E\u5DF2\u5BFC\u5165"}`));
1236
- } catch (error) {
1237
- console.error(a.yellow(`\u26A0 ${i18n.t("configuration:permissionsImportFailed")}: ${error}`));
1238
- }
1239
- console.log();
1240
- }
1241
- }
1242
- if (!options.skipPrompt && !options.skipBanner) tracker.complete();
1243
- console.log("");
1244
- console.log(a.bold.green("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
1245
- console.log(a.bold.green("\u2551") + a.bold.white(padToDisplayWidth(` ${i18n.t("configuration:setupCompleteTitle")}`, 62)) + a.bold.green("\u2551"));
1246
- console.log(a.bold.green("\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563"));
1247
- console.log(`${a.bold.green("\u2551")} ${a.bold.green("\u2551")}`);
1248
- console.log(a.bold.green("\u2551") + a.green(padToDisplayWidth(` ${i18n.t("configuration:nextSteps")}`, 62)) + a.bold.green("\u2551"));
1249
- console.log(`${a.bold.green("\u2551")} ${a.bold.green("\u2551")}`);
1250
- console.log(a.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep1")}`, 62) + a.bold.green("\u2551"));
1251
- console.log(a.bold.green("\u2551") + a.dim(padToDisplayWidth(` ${i18n.t("configuration:guidanceStep1Detail")}`, 62)) + a.bold.green("\u2551"));
1252
- console.log(a.bold.green("\u2551") + a.dim(padToDisplayWidth(` ${i18n.t("configuration:guidanceStep1Detail2")}`, 62)) + a.bold.green("\u2551"));
1253
- console.log(`${a.bold.green("\u2551")} ${a.bold.green("\u2551")}`);
1254
- console.log(a.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep2")}`, 62) + a.bold.green("\u2551"));
1255
- console.log(a.bold.green("\u2551") + a.green(padToDisplayWidth(` ${i18n.t("configuration:guidanceStep2Example")}`, 62)) + a.bold.green("\u2551"));
1256
- console.log(`${a.bold.green("\u2551")} ${a.bold.green("\u2551")}`);
1257
- console.log(a.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep3")} `, 44) + a.yellow(padToDisplayWidth(i18n.t("configuration:guidanceStep3Command"), 18)) + a.bold.green("\u2551"));
1258
- console.log(a.bold.green("\u2551") + padToDisplayWidth(` ${i18n.t("configuration:guidanceStep4")} `, 44) + a.yellow(padToDisplayWidth(i18n.t("configuration:guidanceStep4Command"), 18)) + a.bold.green("\u2551"));
1259
- console.log(`${a.bold.green("\u2551")} ${a.bold.green("\u2551")}`);
1260
- console.log(a.bold.green("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"));
1261
- if (isNewInstall || ["backup", "merge", "new"].includes(action)) {
1262
- const isZh = i18n.language === "zh-CN";
1263
- console.log(a.cyan(isZh ? "\u{1F9E0} \u4E0A\u4E0B\u6587\u4F18\u5316\u5DF2\u542F\u7528\uFF08\u9ED8\u8BA4\uFF09" : "\u{1F9E0} Context optimization is enabled (default)"));
1264
- console.log(a.dim(isZh ? " \u5EFA\u8BAE\u7ACB\u5373\u8FD0\u884C: ccjk morning \u67E5\u770B\u5065\u5EB7\u5206\u4E0E\u6536\u76CA\u6458\u8981" : " Recommended now: ccjk morning to view health score and value summary"));
1265
- console.log(a.dim(isZh ? " \u6DF1\u5EA6\u590D\u76D8: ccjk review | \u4E0A\u4E0B\u6587\u8BE6\u60C5: ccjk context --show" : " Deep review: ccjk review | Context details: ccjk context --show"));
1266
- if (agentBrowserReady) {
1267
- console.log(a.cyan(isZh ? "\u{1F310} \u6D4F\u89C8\u5668\u81EA\u52A8\u5316\u5DF2\u5C31\u7EEA\uFF08\u65E0\u7F1D\uFF09" : "\u{1F310} Browser automation is ready (seamless)"));
1268
- console.log(a.dim(isZh ? " \u76F4\u63A5\u5F00\u59CB: ccjk browser start https://example.com" : " Start directly: ccjk browser start https://example.com"));
1269
- console.log(a.dim(isZh ? " \u5E38\u7528\u64CD\u4F5C: ccjk browser status | ccjk browser stop" : " Common actions: ccjk browser status | ccjk browser stop"));
1270
- }
1271
- }
1272
- console.log("");
1273
- } catch (error) {
1274
- if (!handleExitPromptError(error)) {
1275
- displayError(error, "Initialization");
1276
- handleGeneralError(error);
1277
- }
1278
- }
1279
- }
1280
- async function handleMultiConfigurations(options, codeToolType) {
1281
- const { ensureI18nInitialized } = await import('./index5.mjs');
1282
- ensureI18nInitialized();
1283
- try {
1284
- let configs = [];
1285
- if (options.apiConfigs) {
1286
- try {
1287
- configs = JSON.parse(options.apiConfigs);
1288
- } catch (error) {
1289
- throw new Error(i18n.t("multi-config:invalidJson", { error: error instanceof Error ? error.message : String(error) }));
1290
- }
1291
- }
1292
- if (options.apiConfigsFile) {
1293
- try {
1294
- const { readFile } = await import('./fs-operations.mjs');
1295
- const fileContent = readFile(options.apiConfigsFile);
1296
- configs = JSON.parse(fileContent);
1297
- } catch (error) {
1298
- throw new Error(i18n.t("multi-config:fileReadFailed", { error: error instanceof Error ? error.message : String(error) }));
1299
- }
1300
- }
1301
- await validateApiConfigs(configs);
1302
- if (codeToolType === "claude-code") {
1303
- await handleClaudeCodeConfigs(configs);
1304
- } else if (codeToolType === "codex") {
1305
- await handleCodexConfigs(configs);
1306
- }
1307
- console.log(a.green(`\u2714 ${i18n.t("multi-config:configsAddedSuccessfully")}`));
1308
- } catch (error) {
1309
- displayError(error, "Multi-config setup");
1310
- throw error;
1311
- }
1312
- }
1313
- async function validateApiConfigs(configs) {
1314
- if (!Array.isArray(configs)) {
1315
- throw new TypeError(i18n.t("multi-config:mustBeArray"));
1316
- }
1317
- const { getValidProviderIds } = await import('./api-providers.mjs');
1318
- const validProviders = [...getValidProviderIds(), "custom"];
1319
- const names = /* @__PURE__ */ new Set();
1320
- for (const config of configs) {
1321
- if (config.provider && !config.type) {
1322
- config.type = "api_key";
1323
- }
1324
- if (config.provider && !config.name) {
1325
- config.name = config.provider.toUpperCase();
1326
- }
1327
- if (!config.provider && !config.type) {
1328
- throw new Error(i18n.t("multi-config:providerOrTypeRequired"));
1329
- }
1330
- if (config.provider && !validProviders.includes(config.provider)) {
1331
- throw new Error(i18n.t("errors:invalidProvider", {
1332
- provider: config.provider,
1333
- validProviders: validProviders.join(", ")
1334
- }));
1335
- }
1336
- if (!config.name || typeof config.name !== "string" || config.name.trim() === "") {
1337
- throw new Error(i18n.t("multi-config:mustHaveValidName"));
1338
- }
1339
- if (!["api_key", "auth_token", "ccr_proxy"].includes(config.type)) {
1340
- throw new Error(i18n.t("multi-config:invalidAuthType", { type: config.type }));
1341
- }
1342
- if (names.has(config.name)) {
1343
- throw new Error(i18n.t("multi-config:duplicateName", { name: config.name }));
1344
- }
1345
- names.add(config.name);
1346
- if (config.type !== "ccr_proxy" && !config.key) {
1347
- throw new Error(i18n.t("multi-config:configApiKeyRequired", { name: config.name }));
1348
- }
1349
- }
1350
- }
1351
- async function handleClaudeCodeConfigs(configs) {
1352
- const { ClaudeCodeConfigManager } = await import('./claude-code-config-manager.mjs');
1353
- const addedProfiles = [];
1354
- for (const config of configs) {
1355
- if (config.type === "ccr_proxy") {
1356
- throw new Error(i18n.t("multi-config:ccrProxyReserved", { name: config.name }));
1357
- }
1358
- const profile = await convertToClaudeCodeProfile(config);
1359
- const result = await ClaudeCodeConfigManager.addProfile(profile);
1360
- if (!result.success) {
1361
- throw new Error(i18n.t("multi-config:configProfileAddFailed", { name: config.name, error: result.error }));
1362
- }
1363
- const storedProfile = result.addedProfile || ClaudeCodeConfigManager.getProfileByName(config.name) || profile;
1364
- addedProfiles.push(storedProfile);
1365
- console.log(a.green(`\u2714 ${i18n.t("multi-config:profileAdded", { name: config.name })}`));
1366
- }
1367
- if (addedProfiles.length > 0) {
1368
- const summary = addedProfiles.map((profile) => `${profile.name} [${profile.authType}]`).join(", ");
1369
- console.log(a.gray(` \u2022 ${ClaudeCodeConfigManager.CONFIG_FILE}: ${summary}`));
1370
- }
1371
- const defaultConfig = configs.find((c) => c.default);
1372
- if (defaultConfig) {
1373
- const profile = addedProfiles.find((p) => p.name === defaultConfig.name) || ClaudeCodeConfigManager.getProfileByName(defaultConfig.name);
1374
- if (profile && profile.id) {
1375
- await ClaudeCodeConfigManager.switchProfile(profile.id);
1376
- await ClaudeCodeConfigManager.applyProfileSettings(profile);
1377
- console.log(a.green(`\u2714 ${i18n.t("multi-config:defaultProfileSet", { name: defaultConfig.name })}`));
1378
- }
1379
- }
1380
- await ClaudeCodeConfigManager.syncCcrProfile();
1381
- }
1382
- async function handleCodexConfigs(configs) {
1383
- const { addProviderToExisting } = await import('./codex-provider-manager.mjs');
1384
- const addedProviderIds = [];
1385
- for (const config of configs) {
1386
- try {
1387
- const provider = await convertToCodexProvider(config);
1388
- const result = await addProviderToExisting(provider, config.key || "");
1389
- if (!result.success) {
1390
- throw new Error(i18n.t("multi-config:providerAddFailed", { name: config.name, error: result.error }));
1391
- }
1392
- addedProviderIds.push(provider.id);
1393
- console.log(a.green(`\u2714 ${i18n.t("multi-config:providerAdded", { name: config.name })}`));
1394
- } catch (error) {
1395
- console.error(a.red(i18n.t("multi-config:providerAddFailed", {
1396
- name: config.name,
1397
- error: error instanceof Error ? error.message : String(error)
1398
- })));
1399
- throw error;
1400
- }
1401
- }
1402
- const defaultConfig = configs.find((c) => c.default);
1403
- if (defaultConfig) {
1404
- const { switchCodexProvider } = await import('./codex.mjs').then(function (n) { return n.n; });
1405
- const displayName = defaultConfig.name || defaultConfig.provider || "custom";
1406
- const providerId = displayName.toLowerCase().replace(/[^a-z0-9]/g, "-");
1407
- if (addedProviderIds.includes(providerId)) {
1408
- await switchCodexProvider(providerId);
1409
- console.log(a.green(`\u2714 ${i18n.t("multi-config:defaultProviderSet", { name: displayName })}`));
1410
- } else {
1411
- console.log(a.red(i18n.t("multi-config:providerAddFailed", { name: displayName, error: "provider not added" })));
1412
- }
1413
- }
1414
- }
1415
- async function saveSingleConfigToToml(apiConfig, provider, options) {
1416
- try {
1417
- const { ClaudeCodeConfigManager } = await import('./claude-code-config-manager.mjs');
1418
- const profile = await convertSingleConfigToProfile(apiConfig, provider, options);
1419
- const result = await ClaudeCodeConfigManager.addProfile(profile);
1420
- if (result.success) {
1421
- const savedProfile = result.addedProfile || ClaudeCodeConfigManager.getProfileByName(profile.name) || profile;
1422
- if (savedProfile.id) {
1423
- await ClaudeCodeConfigManager.switchProfile(savedProfile.id);
1424
- await ClaudeCodeConfigManager.applyProfileSettings(savedProfile);
1425
- }
1426
- console.log(a.green(`\u2714 ${i18n.t("configuration:singleConfigSaved", { name: profile.name })}`));
1427
- } else {
1428
- console.warn(a.yellow(`${i18n.t("configuration:singleConfigSaveFailed")}: ${result.error}`));
1429
- }
1430
- } catch (error) {
1431
- console.warn(a.yellow(`${i18n.t("configuration:singleConfigSaveFailed")}: ${error instanceof Error ? error.message : String(error)}`));
1432
- }
1433
- }
1434
- async function buildClaudeCodeProfile(params) {
1435
- const { ClaudeCodeConfigManager } = await import('./claude-code-config-manager.mjs');
1436
- let { url: baseUrl, authType, primaryModel, defaultHaikuModel, defaultSonnetModel, defaultOpusModel } = params;
1437
- baseUrl = baseUrl || API_DEFAULT_URL;
1438
- if (params.provider && params.provider !== "custom") {
1439
- const { getProviderPreset } = await import('./api-providers.mjs');
1440
- const preset = getProviderPreset(params.provider);
1441
- if (preset?.claudeCode) {
1442
- baseUrl = params.url || preset.claudeCode.baseUrl;
1443
- authType = preset.claudeCode.authType;
1444
- if (preset.claudeCode.defaultModels && preset.claudeCode.defaultModels.length > 0) {
1445
- const [p, h, s, o] = preset.claudeCode.defaultModels;
1446
- primaryModel = primaryModel || p;
1447
- defaultHaikuModel = defaultHaikuModel || h;
1448
- defaultSonnetModel = defaultSonnetModel || s;
1449
- defaultOpusModel = defaultOpusModel || o;
1450
- }
1451
- }
1452
- }
1453
- return {
1454
- name: params.name,
1455
- authType,
1456
- apiKey: params.key,
1457
- baseUrl,
1458
- primaryModel,
1459
- defaultHaikuModel,
1460
- defaultSonnetModel,
1461
- defaultOpusModel,
1462
- id: ClaudeCodeConfigManager.generateProfileId(params.name)
1463
- };
1464
- }
1465
- async function convertSingleConfigToProfile(apiConfig, provider, options) {
1466
- return buildClaudeCodeProfile({
1467
- name: provider && provider !== "custom" ? provider : "custom-config",
1468
- key: apiConfig.key,
1469
- authType: apiConfig.authType,
1470
- url: apiConfig.url,
1471
- provider,
1472
- primaryModel: options?.apiModel,
1473
- defaultHaikuModel: options?.apiHaikuModel,
1474
- defaultSonnetModel: options?.apiSonnetModel,
1475
- defaultOpusModel: options?.apiOpusModel
1476
- });
1477
- }
1478
- async function convertToClaudeCodeProfile(config) {
1479
- return buildClaudeCodeProfile({
1480
- name: config.name,
1481
- key: config.key,
1482
- authType: (config.type === "ccr_proxy" ? "api_key" : config.type) || "api_key",
1483
- url: config.url,
1484
- provider: config.provider,
1485
- primaryModel: config.primaryModel,
1486
- defaultHaikuModel: config.defaultHaikuModel,
1487
- defaultSonnetModel: config.defaultSonnetModel,
1488
- defaultOpusModel: config.defaultOpusModel
1489
- });
1490
- }
1491
- async function convertToCodexProvider(config) {
1492
- const displayName = config.name || config.provider || "custom";
1493
- const providerId = displayName.toLowerCase().replace(/[^a-z0-9]/g, "-");
1494
- let baseUrl = config.url || API_DEFAULT_URL;
1495
- let model = config.primaryModel || "gpt-5-codex";
1496
- let wireApi = "responses";
1497
- if (config.provider && config.provider !== "custom") {
1498
- const { getProviderPreset } = await import('./api-providers.mjs');
1499
- const preset = getProviderPreset(config.provider);
1500
- if (preset?.codex) {
1501
- baseUrl = config.url || preset.codex.baseUrl;
1502
- model = config.primaryModel || preset.codex.defaultModel || model;
1503
- wireApi = preset.codex.wireApi;
1504
- }
1505
- }
1506
- return {
1507
- id: providerId,
1508
- name: displayName,
1509
- baseUrl,
1510
- wireApi,
1511
- tempEnvKey: `${displayName}_API_KEY`.replace(/\W/g, "_").toUpperCase(),
1512
- requiresOpenaiAuth: false,
1513
- model
1514
- };
1515
- }
1516
- async function smartInit(options = {}) {
1517
- try {
1518
- console.log(a.bold.green("\n\u{1F9E0} Smart Initialization Mode\n"));
1519
- console.log(a.gray("Analyzing your project to generate optimal configuration...\n"));
1520
- const { analyzeProject } = await import('./index14.mjs');
1521
- const analysis = await analyzeProject();
1522
- console.log(a.cyan("\u{1F4CA} Project Analysis:"));
1523
- console.log(a.gray(` \u2022 Type: ${analysis.projectType}`));
1524
- console.log(a.gray(` \u2022 Languages: ${analysis.techStack.languages.join(", ")}`));
1525
- console.log(a.gray(` \u2022 Runtime: ${analysis.techStack.runtime}`));
1526
- if (analysis.frameworks.length > 0) {
1527
- console.log(a.gray(` \u2022 Frameworks: ${analysis.frameworks.join(", ")}`));
1528
- }
1529
- if (analysis.buildTool) {
1530
- console.log(a.gray(` \u2022 Build Tool: ${analysis.buildTool}`));
1531
- }
1532
- console.log(a.gray(` \u2022 Has Tests: ${analysis.hasTests ? "Yes" : "No"}`));
1533
- console.log(a.gray(` \u2022 Has Database: ${analysis.hasDatabase ? "Yes" : "No"}`));
1534
- console.log(a.gray(` \u2022 Has API: ${analysis.hasApi ? "Yes" : "No"}`));
1535
- if (analysis.cicd.length > 0) {
1536
- console.log(a.gray(` \u2022 CI/CD: ${analysis.cicd.join(", ")}`));
1537
- }
1538
- console.log("");
1539
- const { selectTemplates } = await import('./index14.mjs');
1540
- const selection = await selectTemplates(analysis);
1541
- console.log(a.cyan("\u{1F3AF} Template Selection:"));
1542
- console.log(a.gray(` \u2022 Agents: ${selection.agents.length} selected`));
1543
- for (const agent of selection.agents) {
1544
- console.log(a.gray(` - ${agent.name} (${agent.category})`));
1545
- }
1546
- console.log(a.gray(` \u2022 Skills: ${selection.skills.length} selected`));
1547
- for (const skill of selection.skills) {
1548
- console.log(a.gray(` - ${skill.name} (${skill.category})`));
1549
- }
1550
- console.log("");
1551
- console.log(a.cyan("\u{1F4A1} Reasoning:"));
1552
- console.log(a.gray(selection.reasoning.split("\n").map((line) => ` ${line}`).join("\n")));
1553
- console.log("");
1554
- if (!options.skipPrompt && !options.yes) {
1555
- const shouldContinue = await promptBoolean({
1556
- message: "Proceed with this configuration?",
1557
- defaultValue: true
1558
- });
1559
- if (!shouldContinue) {
1560
- console.log(a.yellow("Smart initialization cancelled."));
1561
- return;
1562
- }
1563
- }
1564
- console.log(a.gray("\n\u{1F527} Generating configurations...\n"));
1565
- const { generateConfigs, writeConfigs } = await import('./index14.mjs');
1566
- const config = await generateConfigs(selection);
1567
- await writeConfigs(config);
1568
- console.log(a.green("\u2714 Configurations generated successfully!"));
1569
- console.log(a.gray(` \u2022 ${config.agents.length} agents installed`));
1570
- console.log(a.gray(` \u2022 ${config.skills.length} skills installed`));
1571
- console.log("");
1572
- console.log(a.gray("Running standard initialization...\n"));
1573
- options.smart = false;
1574
- options.skipPrompt = options.skipPrompt ?? false;
1575
- await init(options);
1576
- console.log("");
1577
- console.log(a.bold.green("\u2705 Smart Initialization Complete!"));
1578
- console.log("");
1579
- console.log(a.cyan("\u{1F3AF} What was configured:"));
1580
- console.log(a.gray(" \u2022 Project-specific agents and skills"));
1581
- console.log(a.gray(" \u2022 Claude Code base configuration"));
1582
- console.log(a.gray(" \u2022 MCP services"));
1583
- console.log(a.gray(" \u2022 Workflows and output styles"));
1584
- console.log("");
1585
- console.log(a.cyan("\u{1F680} Next Steps:"));
1586
- console.log(a.gray(" 1. Run: claude"));
1587
- console.log(a.gray(" 2. Start coding with AI assistance!"));
1588
- console.log(a.gray(" 3. Use generated skills with their triggers"));
1589
- console.log("");
1590
- } catch (error) {
1591
- console.error(a.red("\u274C Smart initialization failed:"), error instanceof Error ? error.message : error);
1592
- throw error;
1593
- }
1594
- }
1595
-
1596
- const init$1 = {
1597
- __proto__: null,
1598
- handleMultiConfigurations: handleMultiConfigurations,
1599
- init: init,
1600
- silentInit: silentInit,
1601
- smartInit: smartInit,
1602
- validateApiConfigs: validateApiConfigs,
1603
- validateSkipPromptOptions: validateSkipPromptOptions
1604
- };
1605
-
1606
- export { isCcrInstalled as a, installCcr as b, init$1 as c, init as i };