ccjk 9.10.0 → 9.10.1

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.
@@ -88,8 +88,48 @@ async function updateClaudeCode(force = false, skipPrompt = false) {
88
88
  ensureI18nInitialized();
89
89
  const spinner = ora(i18n.t("updater:checkingVersion")).start();
90
90
  try {
91
- const { installed, currentVersion, latestVersion, needsUpdate, isHomebrew, installationSource, isBroken } = await checkClaudeCodeVersion();
91
+ const { installed, currentVersion, latestVersion, needsUpdate, isHomebrew, installationSource, isBroken, hasWrongPackage, wrongPackageName } = await checkClaudeCodeVersion();
92
92
  spinner.stop();
93
+ if (hasWrongPackage && wrongPackageName) {
94
+ console.log(ansis.yellow(`
95
+ \u26A0\uFE0F ${i18n.t("installation:wrongPackageDetected")}`));
96
+ console.log(ansis.red(` ${i18n.t("installation:installedPackage")}: ${wrongPackageName}`));
97
+ console.log(ansis.green(` ${i18n.t("installation:correctPackage")}: @anthropic-ai/claude-code`));
98
+ console.log();
99
+ if (!skipPrompt) {
100
+ const inquirer = (await import('inquirer')).default;
101
+ const { shouldFix } = await inquirer.prompt([
102
+ {
103
+ type: "confirm",
104
+ name: "shouldFix",
105
+ message: i18n.t("installation:confirmFixWrongPackage"),
106
+ default: true
107
+ }
108
+ ]);
109
+ if (!shouldFix) {
110
+ console.log(ansis.gray(i18n.t("installation:wrongPackageSkipped")));
111
+ return false;
112
+ }
113
+ }
114
+ const fixSpinner = ora(i18n.t("installation:fixingWrongPackage")).start();
115
+ try {
116
+ await execWithSudoIfNeeded("npm", ["uninstall", "-g", wrongPackageName]);
117
+ fixSpinner.text = i18n.t("installation:installingCorrectPackage");
118
+ await execWithSudoIfNeeded("npm", ["install", "-g", "@anthropic-ai/claude-code", "--force"]);
119
+ fixSpinner.succeed(ansis.green(`\u2713 ${i18n.t("installation:wrongPackageFixed")}`));
120
+ console.log(ansis.green(`
121
+ \u2713 ${i18n.t("installation:nowUsingCorrectPackage")}`));
122
+ return true;
123
+ } catch (error) {
124
+ fixSpinner.fail(ansis.red(`\u2717 ${i18n.t("installation:wrongPackageFixFailed")}`));
125
+ console.error(ansis.red(error instanceof Error ? error.message : String(error)));
126
+ console.log(ansis.gray(`
127
+ ${i18n.t("installation:manualFixHint")}:`));
128
+ console.log(ansis.gray(` npm uninstall -g ${wrongPackageName}`));
129
+ console.log(ansis.gray(` npm install -g @anthropic-ai/claude-code`));
130
+ return false;
131
+ }
132
+ }
93
133
  if (!installed) {
94
134
  console.log(ansis.yellow(i18n.t("updater:claudeCodeNotInstalled")));
95
135
  return false;
@@ -1,4 +1,4 @@
1
- const version = "9.10.0";
1
+ const version = "9.10.1";
2
2
  const homepage = "https://github.com/miounet11/ccjk";
3
3
 
4
4
  export { homepage, version };
@@ -225,6 +225,31 @@ function findClaudeBinaryInDirectory(dir, depth = 0) {
225
225
  }
226
226
 
227
227
  const execAsync = promisify(exec);
228
+ async function detectWrongClaudeCodePackage() {
229
+ try {
230
+ const { stdout } = await execAsync("npm list -g --depth=0 --json");
231
+ const packages = JSON.parse(stdout);
232
+ const dependencies = packages.dependencies || {};
233
+ if ("claude-code" in dependencies) {
234
+ return {
235
+ hasWrongPackage: true,
236
+ wrongPackageName: "claude-code",
237
+ correctPackageName: "@anthropic-ai/claude-code"
238
+ };
239
+ }
240
+ return {
241
+ hasWrongPackage: false,
242
+ wrongPackageName: null,
243
+ correctPackageName: "@anthropic-ai/claude-code"
244
+ };
245
+ } catch {
246
+ return {
247
+ hasWrongPackage: false,
248
+ wrongPackageName: null,
249
+ correctPackageName: "@anthropic-ai/claude-code"
250
+ };
251
+ }
252
+ }
228
253
  async function getInstalledVersion(command, maxRetries = 3) {
229
254
  for (let attempt = 1; attempt <= maxRetries; attempt++) {
230
255
  try {
@@ -773,6 +798,7 @@ async function checkCcrVersion() {
773
798
  };
774
799
  }
775
800
  async function checkClaudeCodeVersion() {
801
+ const wrongPackageInfo = await detectWrongClaudeCodePackage();
776
802
  let currentVersion = await getInstalledVersion("claude");
777
803
  const initialGetVersionSuccess = currentVersion !== null;
778
804
  let installationInfo = await getClaudeCodeInstallationSource();
@@ -819,7 +845,9 @@ async function checkClaudeCodeVersion() {
819
845
  isHomebrew,
820
846
  commandPath,
821
847
  installationSource,
822
- isBroken: !initialGetVersionSuccess && currentVersion !== null
848
+ isBroken: !initialGetVersionSuccess && currentVersion !== null,
849
+ hasWrongPackage: wrongPackageInfo.hasWrongPackage,
850
+ wrongPackageName: wrongPackageInfo.wrongPackageName
823
851
  };
824
852
  }
825
853
  async function checkCometixLineVersion() {
@@ -846,4 +874,4 @@ async function checkClaudeCodeVersionAndPrompt(skipPrompt = false) {
846
874
  }
847
875
  }
848
876
 
849
- export { checkCcrVersion, checkClaudeCodeVersion, checkClaudeCodeVersionAndPrompt, checkCometixLineVersion, checkDuplicateInstallations, compareVersions, detectAllClaudeCodeInstallations, fixBrokenNpmSymlink, getClaudeCodeInstallationSource, getHomebrewClaudeCodeVersion, getInstalledVersion, getLatestVersion, getSourceDisplayName, handleDuplicateInstallations, shouldUpdate };
877
+ export { checkCcrVersion, checkClaudeCodeVersion, checkClaudeCodeVersionAndPrompt, checkCometixLineVersion, checkDuplicateInstallations, compareVersions, detectAllClaudeCodeInstallations, detectWrongClaudeCodePackage, fixBrokenNpmSymlink, getClaudeCodeInstallationSource, getHomebrewClaudeCodeVersion, getInstalledVersion, getLatestVersion, getSourceDisplayName, handleDuplicateInstallations, shouldUpdate };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ccjk",
3
3
  "type": "module",
4
- "version": "9.10.0",
4
+ "version": "9.10.1",
5
5
  "packageManager": "pnpm@10.17.1",
6
6
  "description": "CCJK v9.0.0 - Revolutionary AI Development Platform with Enterprise Security, Streaming Cloud Sync, CRDT Conflict Resolution, and Unified V3 Architecture",
7
7
  "author": {