ccjk 9.5.6 → 9.7.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 (103) hide show
  1. package/dist/chunks/agent.mjs +1 -1
  2. package/dist/chunks/api-providers.mjs +1 -1
  3. package/dist/chunks/api.mjs +3 -3
  4. package/dist/chunks/auto-bootstrap.mjs +1 -1
  5. package/dist/chunks/auto-updater.mjs +1 -1
  6. package/dist/chunks/boost.mjs +160 -0
  7. package/dist/chunks/ccjk-agents.mjs +1 -1
  8. package/dist/chunks/ccjk-all.mjs +1 -1
  9. package/dist/chunks/ccjk-config.mjs +1 -1
  10. package/dist/chunks/ccjk-hooks.mjs +1 -1
  11. package/dist/chunks/ccjk-mcp.mjs +2 -2
  12. package/dist/chunks/ccjk-setup.mjs +1 -1
  13. package/dist/chunks/ccjk-skills.mjs +1 -1
  14. package/dist/chunks/ccr.mjs +25 -30
  15. package/dist/chunks/ccu.mjs +1 -1
  16. package/dist/chunks/check-updates.mjs +3 -4
  17. package/dist/chunks/claude-code-config-manager.mjs +7 -7
  18. package/dist/chunks/claude-code-incremental-manager.mjs +2 -2
  19. package/dist/chunks/claude-config.mjs +4 -4
  20. package/dist/chunks/claude-wrapper.mjs +2 -2
  21. package/dist/chunks/codex-config-switch.mjs +4 -5
  22. package/dist/chunks/codex-provider-manager.mjs +2 -3
  23. package/dist/chunks/codex-uninstaller.mjs +2 -2
  24. package/dist/chunks/codex.mjs +207 -6
  25. package/dist/chunks/commands.mjs +391 -88
  26. package/dist/chunks/commands2.mjs +88 -391
  27. package/dist/chunks/completion.mjs +1 -1
  28. package/dist/chunks/config-consolidator.mjs +2 -2
  29. package/dist/chunks/config-switch.mjs +3 -4
  30. package/dist/chunks/config.mjs +78 -7
  31. package/dist/chunks/config2.mjs +400 -410
  32. package/dist/chunks/config3.mjs +410 -400
  33. package/dist/chunks/constants.mjs +1 -1
  34. package/dist/chunks/doctor.mjs +4 -4
  35. package/dist/chunks/features.mjs +24 -17
  36. package/dist/chunks/index.mjs +178 -7
  37. package/dist/chunks/index2.mjs +1162 -169
  38. package/dist/chunks/index3.mjs +910 -1076
  39. package/dist/chunks/index4.mjs +137 -947
  40. package/dist/chunks/index5.mjs +635 -167
  41. package/dist/chunks/init.mjs +141 -99
  42. package/dist/chunks/installer.mjs +147 -649
  43. package/dist/chunks/installer2.mjs +649 -147
  44. package/dist/chunks/interview.mjs +2 -2
  45. package/dist/chunks/marketplace.mjs +1 -1
  46. package/dist/chunks/mcp.mjs +1058 -17
  47. package/dist/chunks/menu.mjs +147 -56
  48. package/dist/chunks/monitor.mjs +2 -2
  49. package/dist/chunks/notification.mjs +1 -1
  50. package/dist/chunks/onboarding.mjs +2 -2
  51. package/dist/chunks/package.mjs +2 -210
  52. package/dist/chunks/permission-manager.mjs +2 -2
  53. package/dist/chunks/permissions.mjs +1 -1
  54. package/dist/chunks/platform.mjs +1 -1
  55. package/dist/chunks/plugin.mjs +1 -1
  56. package/dist/chunks/prompts.mjs +1 -1
  57. package/dist/chunks/providers.mjs +1 -1
  58. package/dist/chunks/quick-setup.mjs +16 -20
  59. package/dist/chunks/silent-updater.mjs +1 -1
  60. package/dist/chunks/simple-config.mjs +2 -2
  61. package/dist/chunks/skill.mjs +1 -1
  62. package/dist/chunks/skills-sync.mjs +1 -1
  63. package/dist/chunks/skills.mjs +1 -1
  64. package/dist/chunks/startup.mjs +1 -1
  65. package/dist/chunks/stats.mjs +1 -1
  66. package/dist/chunks/status.mjs +159 -0
  67. package/dist/chunks/team.mjs +1 -1
  68. package/dist/chunks/thinking.mjs +2 -2
  69. package/dist/chunks/uninstall.mjs +6 -6
  70. package/dist/chunks/update.mjs +6 -9
  71. package/dist/chunks/upgrade-manager.mjs +2 -2
  72. package/dist/chunks/version-checker.mjs +3 -3
  73. package/dist/chunks/vim.mjs +1 -1
  74. package/dist/chunks/workflows.mjs +616 -215
  75. package/dist/cli.mjs +70 -121
  76. package/dist/index.d.mts +17 -1482
  77. package/dist/index.d.ts +17 -1482
  78. package/dist/index.mjs +950 -4740
  79. package/dist/shared/{ccjk.zCqdxT2Y.mjs → ccjk.Br91zBIG.mjs} +2 -2
  80. package/dist/shared/ccjk.CSkyCZIM.mjs +638 -0
  81. package/dist/shared/{ccjk.BKoi8-Hy.mjs → ccjk.DE91nClQ.mjs} +1 -1
  82. package/dist/shared/{ccjk.f40us0yY.mjs → ccjk.DvIrK0wz.mjs} +2 -2
  83. package/dist/shared/ccjk.LsPZ2PYo.mjs +1048 -0
  84. package/dist/shared/{ccjk.DRweXU5F.mjs → ccjk.q1koQxEE.mjs} +2 -2
  85. package/package.json +1 -1
  86. package/templates/claude-code/common/settings.json +15 -111
  87. package/dist/chunks/api-adapter.mjs +0 -180
  88. package/dist/chunks/cli.mjs +0 -2227
  89. package/dist/chunks/context-menu.mjs +0 -913
  90. package/dist/chunks/hooks-sync.mjs +0 -1627
  91. package/dist/chunks/index6.mjs +0 -663
  92. package/dist/chunks/mcp-market.mjs +0 -1077
  93. package/dist/chunks/mcp-server.mjs +0 -776
  94. package/dist/chunks/project-detector.mjs +0 -131
  95. package/dist/chunks/provider-registry.mjs +0 -92
  96. package/dist/chunks/setup-wizard.mjs +0 -362
  97. package/dist/chunks/tools.mjs +0 -143
  98. package/dist/chunks/workflows2.mjs +0 -633
  99. package/dist/shared/ccjk.BM_HZogn.mjs +0 -347
  100. package/dist/shared/ccjk.BaEp4UHQ.mjs +0 -75
  101. package/dist/shared/ccjk.CS0ybJCf.mjs +0 -490
  102. package/dist/shared/ccjk.CZgIwikC.mjs +0 -209
  103. package/dist/shared/ccjk.tO8zeFh1.mjs +0 -397
@@ -1,347 +0,0 @@
1
- import ansis from 'ansis';
2
- import { SETTINGS_FILE, CLAUDE_DIR } from '../chunks/constants.mjs';
3
- import { ensureI18nInitialized, i18n } from '../chunks/index2.mjs';
4
- import { b as backupExistingConfig } from '../chunks/config.mjs';
5
- import { exists } from '../chunks/fs-operations.mjs';
6
- import { readJsonConfig, writeJsonConfig } from '../chunks/json-config.mjs';
7
- import { existsSync } from 'node:fs';
8
- import { rm, mkdir, copyFile } from 'node:fs/promises';
9
- import { fileURLToPath } from 'node:url';
10
- import inquirer from 'inquirer';
11
- import { join, dirname } from 'pathe';
12
- import { getOrderedWorkflows, getWorkflowConfig, getTagLabel } from '../chunks/workflows.mjs';
13
-
14
- function migrateSettingsForTokenRetrieval() {
15
- ensureI18nInitialized();
16
- const result = {
17
- success: false,
18
- changes: [],
19
- backupPath: null,
20
- errors: []
21
- };
22
- try {
23
- if (!exists(SETTINGS_FILE)) {
24
- result.errors.push(i18n.t("common:fileNotFound", { file: "settings.json" }));
25
- return result;
26
- }
27
- const settings = readJsonConfig(SETTINGS_FILE);
28
- if (!settings) {
29
- result.errors.push(i18n.t("common:failedToReadFile", { file: "settings.json" }));
30
- return result;
31
- }
32
- let modified = false;
33
- if (settings.env) {
34
- if ("CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC" in settings.env) {
35
- delete settings.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC;
36
- result.changes.push("Removed CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC (was blocking token retrieval)");
37
- modified = true;
38
- }
39
- if (settings.env.MCP_TIMEOUT) {
40
- const timeout = Number.parseInt(settings.env.MCP_TIMEOUT, 10);
41
- if (!Number.isNaN(timeout) && timeout > 2e4) {
42
- const oldValue = settings.env.MCP_TIMEOUT;
43
- settings.env.MCP_TIMEOUT = "15000";
44
- result.changes.push(`Reduced MCP_TIMEOUT from ${oldValue}ms to 15000ms (was causing slow failures)`);
45
- modified = true;
46
- }
47
- }
48
- }
49
- if (!modified) {
50
- result.success = true;
51
- return result;
52
- }
53
- const backupPath = backupExistingConfig();
54
- if (backupPath) {
55
- result.backupPath = backupPath;
56
- } else {
57
- result.errors.push("Failed to create backup (continuing anyway)");
58
- }
59
- writeJsonConfig(SETTINGS_FILE, settings);
60
- result.success = true;
61
- return result;
62
- } catch (error) {
63
- result.errors.push(`Migration failed: ${error instanceof Error ? error.message : String(error)}`);
64
- return result;
65
- }
66
- }
67
- function needsMigration() {
68
- try {
69
- if (!exists(SETTINGS_FILE)) {
70
- return false;
71
- }
72
- const settings = readJsonConfig(SETTINGS_FILE);
73
- if (!settings || !settings.env) {
74
- return false;
75
- }
76
- const hasProblematicVar = "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC" in settings.env;
77
- const hasExcessiveTimeout = settings.env.MCP_TIMEOUT && Number.parseInt(settings.env.MCP_TIMEOUT, 10) > 2e4;
78
- return Boolean(hasProblematicVar || hasExcessiveTimeout);
79
- } catch {
80
- return false;
81
- }
82
- }
83
- function displayMigrationResult(result) {
84
- ensureI18nInitialized();
85
- if (result.success) {
86
- if (result.changes.length > 0) {
87
- console.log(ansis.green(`
88
- \u2705 ${i18n.t("common:configurationFixed")}
89
- `));
90
- console.log(ansis.bold("Changes made:"));
91
- for (const change of result.changes) {
92
- console.log(ansis.gray(` \u2022 ${change}`));
93
- }
94
- if (result.backupPath) {
95
- console.log(ansis.gray(`
96
- \u{1F4E6} Backup created: ${result.backupPath}`));
97
- }
98
- console.log(ansis.yellow("\n\u26A0\uFE0F Please restart Claude Code CLI for changes to take effect.\n"));
99
- } else {
100
- console.log(ansis.green(`
101
- \u2705 ${i18n.t("common:noMigrationNeeded")}
102
- `));
103
- }
104
- } else {
105
- console.log(ansis.red(`
106
- \u274C ${i18n.t("common:migrationFailed")}
107
- `));
108
- if (result.errors.length > 0) {
109
- console.log(ansis.bold("Errors:"));
110
- for (const error of result.errors) {
111
- console.log(ansis.red(` \u2022 ${error}`));
112
- }
113
- }
114
- if (result.backupPath) {
115
- console.log(ansis.gray(`
116
- \u{1F4E6} Backup available at: ${result.backupPath}`));
117
- console.log(ansis.gray("You can restore with: cp <backup-path>/settings.json ~/.claude/settings.json\n"));
118
- }
119
- }
120
- }
121
- async function promptMigration() {
122
- ensureI18nInitialized();
123
- const inquirer = await import('inquirer');
124
- console.log(ansis.yellow("\n\u26A0\uFE0F Problematic configuration detected!\n"));
125
- console.log(ansis.gray("Your settings.json contains configurations that prevent Claude Code"));
126
- console.log(ansis.gray("from retrieving token counts, causing /compact failures.\n"));
127
- const { shouldMigrate } = await inquirer.default.prompt({
128
- type: "confirm",
129
- name: "shouldMigrate",
130
- message: "Would you like to fix these issues automatically? (backup will be created)",
131
- default: true
132
- });
133
- return shouldMigrate;
134
- }
135
-
136
- function getRootDir() {
137
- const currentFilePath = fileURLToPath(import.meta.url);
138
- const distDir = dirname(dirname(currentFilePath));
139
- return dirname(distDir);
140
- }
141
- const DEFAULT_CODE_TOOL_TEMPLATE = "claude-code";
142
- const COMMON_TEMPLATE_CATEGORIES = ["git", "sixStep", "essential", "interview", "specFirstTDD", "continuousDelivery", "refactoringMaster", "linearMethod"];
143
- function formatTags(tags) {
144
- const tagColors = {
145
- recommended: (text) => ansis.bgGreen.black(` ${text} `),
146
- popular: (text) => ansis.bgYellow.black(` ${text} `),
147
- new: (text) => ansis.bgCyan.black(` ${text} `),
148
- essential: (text) => ansis.bgBlue.white(` ${text} `),
149
- professional: (text) => ansis.bgMagenta.white(` ${text} `)
150
- };
151
- return tags.map((tag) => tagColors[tag](getTagLabel(tag))).join(" ");
152
- }
153
- function buildWorkflowChoice(workflow) {
154
- const tags = formatTags(workflow.metadata.tags);
155
- const stats = workflow.stats ? ansis.dim(workflow.stats) : "";
156
- const description = workflow.description ? ansis.gray(workflow.description) : "";
157
- const nameLine = `${workflow.name} ${tags}`;
158
- const detailLine = stats ? ` ${stats}` : "";
159
- const descLine = description ? ` ${description}` : "";
160
- const displayName = [nameLine, detailLine, descLine].filter(Boolean).join("\n");
161
- return {
162
- name: displayName,
163
- value: workflow.id,
164
- checked: workflow.defaultSelected
165
- };
166
- }
167
- async function selectAndInstallWorkflows(configLang, preselectedWorkflows) {
168
- ensureI18nInitialized();
169
- const workflows = getOrderedWorkflows();
170
- const choices = workflows.map((workflow) => buildWorkflowChoice(workflow));
171
- let selectedWorkflows;
172
- if (preselectedWorkflows) {
173
- selectedWorkflows = preselectedWorkflows;
174
- } else {
175
- console.log("");
176
- console.log(ansis.bold.cyan("\u2501".repeat(60)));
177
- console.log(ansis.bold.white(` \u{1F680} ${i18n.t("workflow:selectWorkflowType")}`));
178
- console.log(ansis.bold.cyan("\u2501".repeat(60)));
179
- console.log("");
180
- const response = await inquirer.prompt({
181
- type: "checkbox",
182
- name: "selectedWorkflows",
183
- message: i18n.t("common:multiSelectHint"),
184
- choices,
185
- pageSize: 15
186
- });
187
- selectedWorkflows = response.selectedWorkflows;
188
- }
189
- if (!selectedWorkflows || selectedWorkflows.length === 0) {
190
- console.log(ansis.yellow(i18n.t("common:cancelled")));
191
- return;
192
- }
193
- await cleanupOldVersionFiles();
194
- for (const workflowId of selectedWorkflows) {
195
- const config = getWorkflowConfig(workflowId);
196
- if (config) {
197
- await installWorkflowWithDependencies(config, configLang);
198
- }
199
- }
200
- }
201
- async function installWorkflowWithDependencies(config, configLang) {
202
- const rootDir = getRootDir();
203
- ensureI18nInitialized();
204
- const result = {
205
- workflow: config.id,
206
- success: true,
207
- installedCommands: [],
208
- installedAgents: [],
209
- errors: []
210
- };
211
- const WORKFLOW_OPTION_KEYS = {
212
- essentialTools: i18n.t("workflow:workflowOption.essentialTools"),
213
- sixStepsWorkflow: i18n.t("workflow:workflowOption.sixStepsWorkflow"),
214
- gitWorkflow: i18n.t("workflow:workflowOption.gitWorkflow"),
215
- interviewWorkflow: i18n.t("workflow:workflowOption.interviewWorkflow"),
216
- specFirstTDD: i18n.t("workflow:workflowOption.specFirstTDD"),
217
- continuousDelivery: i18n.t("workflow:workflowOption.continuousDelivery"),
218
- refactoringMaster: i18n.t("workflow:workflowOption.refactoringMaster"),
219
- linearMethod: i18n.t("workflow:workflowOption.linearMethod")
220
- };
221
- const workflowName = WORKFLOW_OPTION_KEYS[config.id] || config.id;
222
- console.log(ansis.green(`
223
- \u{1F4E6} ${i18n.t("workflow:installingWorkflow")}: ${workflowName}...`));
224
- const commandsDir = join(CLAUDE_DIR, "commands", "ccjk");
225
- if (!existsSync(commandsDir)) {
226
- await mkdir(commandsDir, { recursive: true });
227
- }
228
- for (const commandFile of config.commands) {
229
- const isCommonTemplate = COMMON_TEMPLATE_CATEGORIES.includes(config.category);
230
- const commandSource = isCommonTemplate ? join(
231
- rootDir,
232
- "templates",
233
- "common",
234
- "workflow",
235
- config.category,
236
- configLang,
237
- commandFile
238
- ) : join(
239
- rootDir,
240
- "templates",
241
- DEFAULT_CODE_TOOL_TEMPLATE,
242
- configLang,
243
- "workflow",
244
- config.category,
245
- "commands",
246
- commandFile
247
- );
248
- const destFileName = commandFile;
249
- const commandDest = join(commandsDir, destFileName);
250
- if (existsSync(commandSource)) {
251
- try {
252
- await copyFile(commandSource, commandDest);
253
- result.installedCommands.push(destFileName);
254
- console.log(ansis.gray(` \u2714 ${i18n.t("workflow:installedCommand")}: ccjk/${destFileName}`));
255
- } catch (error) {
256
- const errorMsg = `${i18n.t("workflow:failedToInstallCommand")} ${commandFile}: ${error}`;
257
- result.errors?.push(errorMsg);
258
- console.error(ansis.red(` \u2717 ${errorMsg}`));
259
- result.success = false;
260
- }
261
- }
262
- }
263
- if (config.autoInstallAgents && config.agents.length > 0) {
264
- const agentsCategoryDir = join(CLAUDE_DIR, "agents", "ccjk", config.category);
265
- if (!existsSync(agentsCategoryDir)) {
266
- await mkdir(agentsCategoryDir, { recursive: true });
267
- }
268
- for (const agent of config.agents) {
269
- const isCommonTemplate = COMMON_TEMPLATE_CATEGORIES.includes(config.category);
270
- const agentSource = isCommonTemplate ? join(
271
- rootDir,
272
- "templates",
273
- "common",
274
- "workflow",
275
- config.category,
276
- configLang,
277
- "agents",
278
- agent.filename
279
- ) : join(
280
- rootDir,
281
- "templates",
282
- DEFAULT_CODE_TOOL_TEMPLATE,
283
- configLang,
284
- "workflow",
285
- config.category,
286
- "agents",
287
- agent.filename
288
- );
289
- const agentDest = join(agentsCategoryDir, agent.filename);
290
- if (existsSync(agentSource)) {
291
- try {
292
- await copyFile(agentSource, agentDest);
293
- result.installedAgents.push(agent.filename);
294
- console.log(ansis.gray(` \u2714 ${i18n.t("workflow:installedAgent")}: ccjk/${config.category}/${agent.filename}`));
295
- } catch (error) {
296
- const errorMsg = `${i18n.t("workflow:failedToInstallAgent")} ${agent.filename}: ${error}`;
297
- result.errors?.push(errorMsg);
298
- console.error(ansis.red(` \u2717 ${errorMsg}`));
299
- if (agent.required) {
300
- result.success = false;
301
- }
302
- }
303
- }
304
- }
305
- }
306
- if (result.success) {
307
- console.log(ansis.green(`\u2714 ${workflowName} ${i18n.t("workflow:workflowInstallSuccess")}`));
308
- } else {
309
- console.log(ansis.red(`\u2717 ${workflowName} ${i18n.t("workflow:workflowInstallError")}`));
310
- }
311
- return result;
312
- }
313
- async function cleanupOldVersionFiles() {
314
- ensureI18nInitialized();
315
- console.log(ansis.green(`
316
- \u{1F9F9} ${i18n.t("workflow:cleaningOldFiles")}...`));
317
- const oldCommandFiles = [
318
- join(CLAUDE_DIR, "commands", "workflow.md"),
319
- join(CLAUDE_DIR, "commands", "feat.md")
320
- ];
321
- const oldAgentFiles = [
322
- join(CLAUDE_DIR, "agents", "planner.md"),
323
- join(CLAUDE_DIR, "agents", "ui-ux-designer.md")
324
- ];
325
- for (const file of oldCommandFiles) {
326
- if (existsSync(file)) {
327
- try {
328
- await rm(file, { force: true });
329
- console.log(ansis.gray(` \u2714 ${i18n.t("workflow:removedOldFile")}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
330
- } catch {
331
- console.error(ansis.yellow(` \u26A0 ${i18n.t("errors:failedToRemoveFile")}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
332
- }
333
- }
334
- }
335
- for (const file of oldAgentFiles) {
336
- if (existsSync(file)) {
337
- try {
338
- await rm(file, { force: true });
339
- console.log(ansis.gray(` \u2714 ${i18n.t("workflow:removedOldFile")}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
340
- } catch {
341
- console.error(ansis.yellow(` \u26A0 ${i18n.t("errors:failedToRemoveFile")}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
342
- }
343
- }
344
- }
345
- }
346
-
347
- export { displayMigrationResult as d, migrateSettingsForTokenRetrieval as m, needsMigration as n, promptMigration as p, selectAndInstallWorkflows as s };
@@ -1,75 +0,0 @@
1
- import { exec } from 'node:child_process';
2
- import { promisify } from 'node:util';
3
- import ansis from 'ansis';
4
- import { ensureI18nInitialized, i18n } from '../chunks/index2.mjs';
5
- import { updateCcr } from '../chunks/auto-updater.mjs';
6
- import { w as wrapCommandWithSudo } from '../chunks/platform.mjs';
7
-
8
- const execAsync = promisify(exec);
9
- async function isCcrInstalled() {
10
- let commandExists = false;
11
- try {
12
- await execAsync("ccr version");
13
- commandExists = true;
14
- } catch {
15
- try {
16
- await execAsync("which ccr");
17
- commandExists = true;
18
- } catch {
19
- commandExists = false;
20
- }
21
- }
22
- let hasCorrectPackage = false;
23
- try {
24
- await execAsync("npm list -g @musistudio/claude-code-router");
25
- hasCorrectPackage = true;
26
- } catch {
27
- hasCorrectPackage = false;
28
- }
29
- return {
30
- isInstalled: commandExists,
31
- hasCorrectPackage
32
- };
33
- }
34
- async function installCcr() {
35
- ensureI18nInitialized();
36
- const { isInstalled, hasCorrectPackage } = await isCcrInstalled();
37
- if (hasCorrectPackage) {
38
- console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
39
- await updateCcr();
40
- return;
41
- }
42
- if (isInstalled && !hasCorrectPackage) {
43
- try {
44
- await execAsync("npm list -g claude-code-router");
45
- console.log(ansis.yellow(`\u26A0 ${i18n.t("ccr:detectedIncorrectPackage")}`));
46
- try {
47
- await execAsync("npm uninstall -g claude-code-router");
48
- console.log(ansis.green(`\u2714 ${i18n.t("ccr:uninstalledIncorrectPackage")}`));
49
- } catch {
50
- console.log(ansis.yellow(`\u26A0 ${i18n.t("ccr:failedToUninstallIncorrectPackage")}`));
51
- }
52
- } catch {
53
- }
54
- }
55
- console.log(ansis.green(`\u{1F4E6} ${i18n.t("ccr:installingCcr")}`));
56
- try {
57
- const installArgs = ["install", "-g", "@musistudio/claude-code-router", "--force"];
58
- const { command, args, usedSudo } = wrapCommandWithSudo("npm", installArgs);
59
- if (usedSudo) {
60
- console.log(ansis.yellow(`\u2139 ${i18n.t("installation:usingSudo")}`));
61
- }
62
- await execAsync([command, ...args].join(" "));
63
- console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrInstallSuccess")}`));
64
- } catch (error) {
65
- if (error.message?.includes("EEXIST")) {
66
- console.log(ansis.yellow(`\u26A0 ${i18n.t("ccr:ccrAlreadyInstalled")}`));
67
- await updateCcr();
68
- return;
69
- }
70
- console.error(ansis.red(`\u2716 ${i18n.t("ccr:ccrInstallFailed")}`));
71
- throw error;
72
- }
73
- }
74
-
75
- export { installCcr as a, isCcrInstalled as i };