ccjk 9.6.1 → 9.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/chunks/boost.mjs +246 -7
  2. package/dist/chunks/ccjk-mcp.mjs +1 -1
  3. package/dist/chunks/ccr.mjs +25 -28
  4. package/dist/chunks/check-updates.mjs +4 -3
  5. package/dist/chunks/claude-code-config-manager.mjs +1 -1
  6. package/dist/chunks/claude-code-incremental-manager.mjs +1 -1
  7. package/dist/chunks/claude-config.mjs +1 -1
  8. package/dist/chunks/codex-config-switch.mjs +3 -4
  9. package/dist/chunks/codex-provider-manager.mjs +1 -2
  10. package/dist/chunks/codex.mjs +204 -3
  11. package/dist/chunks/config-switch.mjs +2 -3
  12. package/dist/chunks/config.mjs +1 -1
  13. package/dist/chunks/doctor.mjs +1 -1
  14. package/dist/chunks/features.mjs +24 -15
  15. package/dist/chunks/hook-installer.mjs +44 -0
  16. package/dist/chunks/index3.mjs +32 -32
  17. package/dist/chunks/init.mjs +129 -87
  18. package/dist/chunks/installer2.mjs +1 -1
  19. package/dist/chunks/interview.mjs +1 -1
  20. package/dist/chunks/mcp.mjs +1058 -17
  21. package/dist/chunks/menu.mjs +140 -56
  22. package/dist/chunks/package.mjs +2 -210
  23. package/dist/chunks/platform.mjs +1 -1
  24. package/dist/chunks/quick-setup.mjs +35 -18
  25. package/dist/chunks/simple-config.mjs +1 -1
  26. package/dist/{shared/ccjk.q1koQxEE.mjs → chunks/smart-defaults.mjs} +77 -79
  27. package/dist/chunks/status.mjs +208 -101
  28. package/dist/chunks/thinking.mjs +1 -1
  29. package/dist/chunks/uninstall.mjs +6 -4
  30. package/dist/chunks/update.mjs +4 -7
  31. package/dist/chunks/version-checker.mjs +1 -1
  32. package/dist/cli.mjs +4 -80
  33. package/dist/index.d.mts +17 -1482
  34. package/dist/index.d.ts +17 -1482
  35. package/dist/index.mjs +12 -4191
  36. package/dist/shared/{ccjk.CSkyCZIM.mjs → ccjk.Bndhan7G.mjs} +4 -242
  37. package/dist/shared/ccjk.CeE8RLG2.mjs +62 -0
  38. package/dist/shared/ccjk.DKojSRzw.mjs +266 -0
  39. package/dist/shared/{ccjk.CItD1fpl.mjs → ccjk.DvIrK0wz.mjs} +1 -1
  40. package/dist/shared/ccjk.LsPZ2PYo.mjs +1048 -0
  41. package/package.json +1 -1
  42. package/dist/chunks/api-adapter.mjs +0 -180
  43. package/dist/chunks/cli.mjs +0 -2227
  44. package/dist/chunks/context-menu.mjs +0 -913
  45. package/dist/chunks/hooks-sync.mjs +0 -1627
  46. package/dist/chunks/mcp-market.mjs +0 -1077
  47. package/dist/chunks/mcp-server.mjs +0 -776
  48. package/dist/chunks/project-detector.mjs +0 -131
  49. package/dist/chunks/provider-registry.mjs +0 -92
  50. package/dist/chunks/setup-wizard.mjs +0 -362
  51. package/dist/chunks/tools.mjs +0 -143
  52. package/dist/chunks/workflows2.mjs +0 -232
  53. package/dist/shared/ccjk.C0pb50xH.mjs +0 -347
  54. package/dist/shared/ccjk.ChMkBmdL.mjs +0 -490
  55. package/dist/shared/ccjk.CtSfXUSh.mjs +0 -209
  56. package/dist/shared/ccjk.xfAjmbJp.mjs +0 -75
@@ -3,47 +3,106 @@ import process__default from 'node:process';
3
3
  import ansis from 'ansis';
4
4
  import inquirer from 'inquirer';
5
5
  import { version } from './package.mjs';
6
- import { s as selectMcpServices, a as getMcpServices, M as MCP_SERVICE_CONFIGS } from '../shared/ccjk.CtSfXUSh.mjs';
7
- import { WORKFLOW_CONFIG_BASE } from './workflows2.mjs';
6
+ import { b as runCodexFullInit, s as selectMcpServices, c as getMcpServices, M as MCP_SERVICE_CONFIGS } from './codex.mjs';
7
+ import { m as modifyApiConfigPartially, c as configureApiCompletely, n as needsMigration, a as migrateSettingsForTokenRetrieval, d as displayMigrationResult, p as promptMigration, s as selectAndInstallWorkflows, b as configureOutputStyle, f as formatApiKeyDisplay, W as WORKFLOW_CONFIG_BASE } from '../shared/ccjk.LsPZ2PYo.mjs';
8
8
  import { SETTINGS_FILE, DEFAULT_CODE_TOOL_TYPE, CODE_TOOL_BANNERS, API_DEFAULT_URL } from './constants.mjs';
9
9
  import { ensureI18nInitialized, i18n } from './index.mjs';
10
10
  import { d as displayBannerWithInfo, p as padToDisplayWidth } from '../shared/ccjk.Br91zBIG.mjs';
11
11
  import { readZcfConfig, updateZcfConfig } from './ccjk-config.mjs';
12
12
  import { readCcrConfig, backupCcrConfig, createDefaultCcrConfig, writeCcrConfig, configureCcrProxy, setupCcrConfiguration } from './config3.mjs';
13
- import { i as isCcrInstalled, a as installCcr } from '../shared/ccjk.xfAjmbJp.mjs';
14
- 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';
15
- import { d as runCodexFullInit } from './codex.mjs';
16
- import { r as resolveCodeType } from '../shared/ccjk.q1koQxEE.mjs';
17
13
  import { exec } from 'node:child_process';
18
14
  import { promisify } from 'node:util';
15
+ import { updateCcr } from './auto-updater.mjs';
16
+ import { w as wrapCommandWithSudo, i as isWindows, a as isTermux } from './platform.mjs';
17
+ 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';
18
+ import { r as resolveCodeType } from '../shared/ccjk.CeE8RLG2.mjs';
19
19
  import { exists } from './fs-operations.mjs';
20
20
  import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
21
- import { i as isWindows, w as wrapCommandWithSudo, d as isTermux } from './platform.mjs';
22
- import { p as promptApiConfigurationAction, e as ensureClaudeDir, g as getExistingApiConfig, s as switchToOfficialLogin, b as backupExistingConfig, f as copyConfigFiles, d as applyAiLanguageDirective, h as configureApi } from './config.mjs';
23
- import { n as needsMigration, m as migrateSettingsForTokenRetrieval, d as displayMigrationResult, p as promptMigration, s as selectAndInstallWorkflows } from '../shared/ccjk.C0pb50xH.mjs';
24
- import { m as modifyApiConfigPartially, c as configureApiCompletely, a as configureOutputStyle, f as formatApiKeyDisplay } from '../shared/ccjk.ChMkBmdL.mjs';
25
- import { a as handleExitPromptError, h as handleGeneralError } from '../shared/ccjk.CItD1fpl.mjs';
21
+ import { p as promptApiConfigurationAction, e as ensureClaudeDir, g as getExistingApiConfig, s as switchToOfficialLogin, b as backupExistingConfig, a as copyConfigFiles, d as applyAiLanguageDirective, f as configureApi } from './config.mjs';
22
+ import { h as handleExitPromptError, a as handleGeneralError } from '../shared/ccjk.DvIrK0wz.mjs';
26
23
  import { getInstallationStatus, installClaudeCode } from './installer2.mjs';
27
24
  import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
28
25
  import { resolveAiOutputLanguage } from './prompts.mjs';
29
26
  import { c as checkSuperpowersInstalled, i as installSuperpowers } from '../shared/ccjk.DE91nClQ.mjs';
30
27
  import { p as promptBoolean } from '../shared/ccjk.DHbrGcgg.mjs';
31
28
  import { checkClaudeCodeVersionAndPrompt } from './version-checker.mjs';
32
- import 'node:os';
33
- import 'pathe';
34
- import 'node:url';
35
- import 'i18next';
36
- import 'i18next-fs-backend';
37
- import 'smol-toml';
38
- import 'node:crypto';
39
- import 'node:fs/promises';
40
- import 'dayjs';
41
- import 'tinyexec';
42
- import 'inquirer-toggle';
43
- import './auto-updater.mjs';
44
- import 'ora';
45
- import 'node:path';
46
- import 'semver';
29
+
30
+ const execAsync$1 = promisify(exec);
31
+ async function isCcrInstalled() {
32
+ let commandExists = false;
33
+ try {
34
+ await execAsync$1("ccr version");
35
+ commandExists = true;
36
+ } catch {
37
+ try {
38
+ await execAsync$1("which ccr");
39
+ commandExists = true;
40
+ } catch {
41
+ commandExists = false;
42
+ }
43
+ }
44
+ let hasCorrectPackage = false;
45
+ try {
46
+ await execAsync$1("npm list -g @musistudio/claude-code-router");
47
+ hasCorrectPackage = true;
48
+ } catch {
49
+ hasCorrectPackage = false;
50
+ }
51
+ return {
52
+ isInstalled: commandExists,
53
+ hasCorrectPackage
54
+ };
55
+ }
56
+ async function installCcr() {
57
+ ensureI18nInitialized();
58
+ const { isInstalled, hasCorrectPackage } = await isCcrInstalled();
59
+ if (hasCorrectPackage) {
60
+ console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
61
+ await updateCcr();
62
+ return;
63
+ }
64
+ if (isInstalled && !hasCorrectPackage) {
65
+ try {
66
+ await execAsync$1("npm list -g claude-code-router");
67
+ console.log(ansis.yellow(`\u26A0 ${i18n.t("ccr:detectedIncorrectPackage")}`));
68
+ try {
69
+ await execAsync$1("npm uninstall -g claude-code-router");
70
+ console.log(ansis.green(`\u2714 ${i18n.t("ccr:uninstalledIncorrectPackage")}`));
71
+ } catch {
72
+ console.log(ansis.yellow(`\u26A0 ${i18n.t("ccr:failedToUninstallIncorrectPackage")}`));
73
+ }
74
+ } catch {
75
+ }
76
+ }
77
+ console.log(ansis.green(`\u{1F4E6} ${i18n.t("ccr:installingCcr")}`));
78
+ try {
79
+ const installArgs = ["install", "-g", "@musistudio/claude-code-router", "--force"];
80
+ const { command, args, usedSudo } = wrapCommandWithSudo("npm", installArgs);
81
+ if (usedSudo) {
82
+ console.log(ansis.yellow(`\u2139 ${i18n.t("installation:usingSudo")}`));
83
+ }
84
+ await execAsync$1([command, ...args].join(" "));
85
+ console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrInstallSuccess")}`));
86
+ } catch (error) {
87
+ if (error.message?.includes("EEXIST")) {
88
+ console.log(ansis.yellow(`\u26A0 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
89
+ await updateCcr();
90
+ return;
91
+ }
92
+ console.error(ansis.red(`\u2716 ${i18n.t("ccr:ccrInstallFailed")}`));
93
+ throw error;
94
+ }
95
+ }
96
+
97
+ const COMETIX_PACKAGE_NAME = "@cometix/ccline";
98
+ const COMETIX_COMMAND_NAME = "ccline";
99
+ const COMETIX_COMMANDS = {
100
+ CHECK_INSTALL: `npm list -g ${COMETIX_PACKAGE_NAME}`,
101
+ INSTALL: `npm install -g ${COMETIX_PACKAGE_NAME}`,
102
+ UPDATE: `npm update -g ${COMETIX_PACKAGE_NAME}`,
103
+ PRINT_CONFIG: `${COMETIX_COMMAND_NAME} --print`,
104
+ TUI_CONFIG: `${COMETIX_COMMAND_NAME} -c`
105
+ };
47
106
 
48
107
  function getPlatformStatusLineConfig() {
49
108
  return {
@@ -80,16 +139,6 @@ function hasCCometixLineConfig() {
80
139
  }
81
140
  }
82
141
 
83
- const COMETIX_PACKAGE_NAME = "@cometix/ccline";
84
- const COMETIX_COMMAND_NAME = "ccline";
85
- const COMETIX_COMMANDS = {
86
- CHECK_INSTALL: `npm list -g ${COMETIX_PACKAGE_NAME}`,
87
- INSTALL: `npm install -g ${COMETIX_PACKAGE_NAME}`,
88
- UPDATE: `npm update -g ${COMETIX_PACKAGE_NAME}`,
89
- PRINT_CONFIG: `${COMETIX_COMMAND_NAME} --print`,
90
- TUI_CONFIG: `${COMETIX_COMMAND_NAME} -c`
91
- };
92
-
93
142
  const execAsync = promisify(exec);
94
143
  async function isCometixLineInstalled() {
95
144
  try {
@@ -1063,7 +1112,7 @@ async function handleCodexConfigs(configs) {
1063
1112
  }
1064
1113
  const defaultConfig = configs.find((c) => c.default);
1065
1114
  if (defaultConfig) {
1066
- const { switchCodexProvider } = await import('./codex.mjs').then(function (n) { return n.i; });
1115
+ const { switchCodexProvider } = await import('./codex.mjs').then(function (n) { return n.m; });
1067
1116
  const displayName = defaultConfig.name || defaultConfig.provider || "custom";
1068
1117
  const providerId = displayName.toLowerCase().replace(/[^a-z0-9]/g, "-");
1069
1118
  if (addedProviderIds.includes(providerId)) {
@@ -1093,20 +1142,15 @@ async function saveSingleConfigToToml(apiConfig, provider, options) {
1093
1142
  console.warn(ansis.yellow(`${i18n.t("configuration:singleConfigSaveFailed")}: ${error instanceof Error ? error.message : String(error)}`));
1094
1143
  }
1095
1144
  }
1096
- async function convertSingleConfigToProfile(apiConfig, provider, options) {
1145
+ async function buildClaudeCodeProfile(params) {
1097
1146
  const { ClaudeCodeConfigManager } = await import('./claude-code-config-manager.mjs');
1098
- const configName = provider && provider !== "custom" ? provider : "custom-config";
1099
- let baseUrl = apiConfig.url || API_DEFAULT_URL;
1100
- let primaryModel = options?.apiModel;
1101
- let defaultHaikuModel = options?.apiHaikuModel;
1102
- let defaultSonnetModel = options?.apiSonnetModel;
1103
- let defaultOpusModel = options?.apiOpusModel;
1104
- let authType = apiConfig.authType;
1105
- if (provider && provider !== "custom") {
1147
+ let { url: baseUrl, authType, primaryModel, defaultHaikuModel, defaultSonnetModel, defaultOpusModel } = params;
1148
+ baseUrl = baseUrl || API_DEFAULT_URL;
1149
+ if (params.provider && params.provider !== "custom") {
1106
1150
  const { getProviderPreset } = await import('./api-providers.mjs');
1107
- const preset = getProviderPreset(provider);
1151
+ const preset = getProviderPreset(params.provider);
1108
1152
  if (preset?.claudeCode) {
1109
- baseUrl = apiConfig.url || preset.claudeCode.baseUrl;
1153
+ baseUrl = params.url || preset.claudeCode.baseUrl;
1110
1154
  authType = preset.claudeCode.authType;
1111
1155
  if (preset.claudeCode.defaultModels && preset.claudeCode.defaultModels.length > 0) {
1112
1156
  const [p, h, s, o] = preset.claudeCode.defaultModels;
@@ -1117,54 +1161,43 @@ async function convertSingleConfigToProfile(apiConfig, provider, options) {
1117
1161
  }
1118
1162
  }
1119
1163
  }
1120
- const profile = {
1121
- name: configName,
1164
+ return {
1165
+ name: params.name,
1122
1166
  authType,
1123
- apiKey: apiConfig.key,
1167
+ apiKey: params.key,
1124
1168
  baseUrl,
1125
1169
  primaryModel,
1126
1170
  defaultHaikuModel,
1127
1171
  defaultSonnetModel,
1128
1172
  defaultOpusModel,
1129
- id: ClaudeCodeConfigManager.generateProfileId(configName)
1173
+ id: ClaudeCodeConfigManager.generateProfileId(params.name)
1130
1174
  };
1131
- return profile;
1175
+ }
1176
+ async function convertSingleConfigToProfile(apiConfig, provider, options) {
1177
+ return buildClaudeCodeProfile({
1178
+ name: provider && provider !== "custom" ? provider : "custom-config",
1179
+ key: apiConfig.key,
1180
+ authType: apiConfig.authType,
1181
+ url: apiConfig.url,
1182
+ provider,
1183
+ primaryModel: options?.apiModel,
1184
+ defaultHaikuModel: options?.apiHaikuModel,
1185
+ defaultSonnetModel: options?.apiSonnetModel,
1186
+ defaultOpusModel: options?.apiOpusModel
1187
+ });
1132
1188
  }
1133
1189
  async function convertToClaudeCodeProfile(config) {
1134
- const { ClaudeCodeConfigManager } = await import('./claude-code-config-manager.mjs');
1135
- let baseUrl = config.url;
1136
- let primaryModel = config.primaryModel;
1137
- let defaultHaikuModel = config.defaultHaikuModel;
1138
- let defaultSonnetModel = config.defaultSonnetModel;
1139
- let defaultOpusModel = config.defaultOpusModel;
1140
- let authType = config.type || "api_key";
1141
- if (config.provider && config.provider !== "custom") {
1142
- const { getProviderPreset } = await import('./api-providers.mjs');
1143
- const preset = getProviderPreset(config.provider);
1144
- if (preset?.claudeCode) {
1145
- baseUrl = baseUrl || preset.claudeCode.baseUrl;
1146
- authType = preset.claudeCode.authType;
1147
- if (preset.claudeCode.defaultModels && preset.claudeCode.defaultModels.length > 0) {
1148
- const [p, h, s, o] = preset.claudeCode.defaultModels;
1149
- primaryModel = primaryModel || p;
1150
- defaultHaikuModel = defaultHaikuModel || h;
1151
- defaultSonnetModel = defaultSonnetModel || s;
1152
- defaultOpusModel = defaultOpusModel || o;
1153
- }
1154
- }
1155
- }
1156
- const profile = {
1190
+ return buildClaudeCodeProfile({
1157
1191
  name: config.name,
1158
- authType,
1159
- apiKey: config.key,
1160
- baseUrl,
1161
- primaryModel,
1162
- defaultHaikuModel,
1163
- defaultSonnetModel,
1164
- defaultOpusModel,
1165
- id: ClaudeCodeConfigManager.generateProfileId(config.name)
1166
- };
1167
- return profile;
1192
+ key: config.key,
1193
+ authType: (config.type === "ccr_proxy" ? "api_key" : config.type) || "api_key",
1194
+ url: config.url,
1195
+ provider: config.provider,
1196
+ primaryModel: config.primaryModel,
1197
+ defaultHaikuModel: config.defaultHaikuModel,
1198
+ defaultSonnetModel: config.defaultSonnetModel,
1199
+ defaultOpusModel: config.defaultOpusModel
1200
+ });
1168
1201
  }
1169
1202
  async function convertToCodexProvider(config) {
1170
1203
  const displayName = config.name || config.provider || "custom";
@@ -1271,4 +1304,13 @@ async function smartInit(options = {}) {
1271
1304
  }
1272
1305
  }
1273
1306
 
1274
- export { handleMultiConfigurations, init, smartInit, validateApiConfigs, validateSkipPromptOptions };
1307
+ const init$1 = {
1308
+ __proto__: null,
1309
+ handleMultiConfigurations: handleMultiConfigurations,
1310
+ init: init,
1311
+ smartInit: smartInit,
1312
+ validateApiConfigs: validateApiConfigs,
1313
+ validateSkipPromptOptions: validateSkipPromptOptions
1314
+ };
1315
+
1316
+ export { isCcrInstalled as a, installCcr as b, init$1 as c, init as i };
@@ -9,7 +9,7 @@ import { exec } from 'tinyexec';
9
9
  import { ensureI18nInitialized, i18n } from './index.mjs';
10
10
  import { updateClaudeCode } from './auto-updater.mjs';
11
11
  import { exists } from './fs-operations.mjs';
12
- import { f as findCommandPath, b as getPlatform, c as getHomebrewCommandPaths, d as isTermux, e as getTermuxPrefix, h as isWSL, j as getWSLInfo, w as wrapCommandWithSudo, k as commandExists, l as getRecommendedInstallMethods } from './platform.mjs';
12
+ import { f as findCommandPath, d as getPlatform, e as getHomebrewCommandPaths, a as isTermux, h as getTermuxPrefix, j as isWSL, k as getWSLInfo, w as wrapCommandWithSudo, c as commandExists, l as getRecommendedInstallMethods } from './platform.mjs';
13
13
  import 'node:url';
14
14
  import 'i18next';
15
15
  import 'i18next-fs-backend';
@@ -5,7 +5,7 @@ import process__default from 'node:process';
5
5
  import ansis from 'ansis';
6
6
  import inquirer from 'inquirer';
7
7
  import { i18n } from './index.mjs';
8
- import { a as handleExitPromptError, h as handleGeneralError } from '../shared/ccjk.CItD1fpl.mjs';
8
+ import { h as handleExitPromptError, a as handleGeneralError } from '../shared/ccjk.DvIrK0wz.mjs';
9
9
  import { randomUUID } from 'node:crypto';
10
10
  import 'node:url';
11
11
  import 'i18next';