ccjk 9.10.0 → 9.10.2
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;
|
package/dist/chunks/package.mjs
CHANGED
|
@@ -416,6 +416,14 @@ class ZcfUninstaller {
|
|
|
416
416
|
warnings: []
|
|
417
417
|
};
|
|
418
418
|
try {
|
|
419
|
+
const backupPath = await this.createBackupBeforeUninstall();
|
|
420
|
+
if (backupPath) {
|
|
421
|
+
console.log(ansis.green(`
|
|
422
|
+
\u2714 ${i18n.t("uninstall:backupCreated", { path: backupPath })}`));
|
|
423
|
+
console.log(ansis.cyan(` ${i18n.t("uninstall:backupLocation")}: ${backupPath}`));
|
|
424
|
+
console.log(ansis.gray(` ${i18n.t("uninstall:backupRestoreHint")}`));
|
|
425
|
+
console.log();
|
|
426
|
+
}
|
|
419
427
|
const directoriesToRemove = [
|
|
420
428
|
{ path: join(homedir(), ".claude"), name: "~/.claude/" },
|
|
421
429
|
{ path: join(homedir(), ".claude.json"), name: "~/.claude.json" },
|
|
@@ -539,6 +547,38 @@ class ZcfUninstaller {
|
|
|
539
547
|
};
|
|
540
548
|
}
|
|
541
549
|
}
|
|
550
|
+
/**
|
|
551
|
+
* Create backup before complete uninstall
|
|
552
|
+
* Saves important files to ~/.ccjk/uninstall_backups/ to prevent loss
|
|
553
|
+
*/
|
|
554
|
+
async createBackupBeforeUninstall() {
|
|
555
|
+
try {
|
|
556
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, -5);
|
|
557
|
+
const backupDir = join(homedir(), ".ccjk", "uninstall_backups", `backup_${timestamp}`);
|
|
558
|
+
await promises.mkdir(backupDir, { recursive: true });
|
|
559
|
+
const filesToBackup = [
|
|
560
|
+
{ src: join(homedir(), ".claude", "settings.json"), name: "settings.json" },
|
|
561
|
+
{ src: join(homedir(), ".claude", "claude.json"), name: "claude.json" },
|
|
562
|
+
{ src: join(homedir(), ".claude", "CLAUDE.md"), name: "CLAUDE.md" },
|
|
563
|
+
{ src: join(homedir(), ".claude", "keybindings.json"), name: "keybindings.json" }
|
|
564
|
+
];
|
|
565
|
+
let backedUpCount = 0;
|
|
566
|
+
for (const file of filesToBackup) {
|
|
567
|
+
if (await pathExists(file.src)) {
|
|
568
|
+
try {
|
|
569
|
+
await promises.copyFile(file.src, join(backupDir, file.name));
|
|
570
|
+
backedUpCount++;
|
|
571
|
+
} catch (error) {
|
|
572
|
+
console.warn(`Failed to backup ${file.name}: ${error.message}`);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
return backedUpCount > 0 ? backupDir : null;
|
|
577
|
+
} catch (error) {
|
|
578
|
+
console.error(`Failed to create backup: ${error.message}`);
|
|
579
|
+
return null;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
542
582
|
}
|
|
543
583
|
|
|
544
584
|
async function uninstall(options = {}) {
|
|
@@ -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.
|
|
4
|
+
"version": "9.10.2",
|
|
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": {
|