ccjk 5.2.0 → 5.2.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.
@@ -87,54 +87,6 @@ function findResidualNpmTempDirs(packageName) {
87
87
  }
88
88
  return residuals;
89
89
  }
90
- function safeRemoveDirectory(dirPath) {
91
- try {
92
- const dirName = dirPath.split("/").pop() || dirPath.split("\\").pop() || "";
93
- if (!isNpmTempDir(dirName)) {
94
- return false;
95
- }
96
- nodeFs.rmSync(dirPath, { recursive: true, force: true });
97
- return true;
98
- } catch {
99
- return false;
100
- }
101
- }
102
- function cleanupNpmTempDirs(packageName) {
103
- const residuals = findResidualNpmTempDirs(packageName);
104
- let cleaned = 0;
105
- let failed = 0;
106
- const paths = [];
107
- for (const dir of residuals) {
108
- if (safeRemoveDirectory(dir)) {
109
- cleaned++;
110
- paths.push(dir);
111
- } else {
112
- failed++;
113
- }
114
- }
115
- return { cleaned, failed, paths };
116
- }
117
- function getNpmCleanupStatus(packageName) {
118
- const residuals = findResidualNpmTempDirs(packageName);
119
- if (residuals.length === 0) {
120
- return {
121
- needsCleanup: false,
122
- residualCount: 0,
123
- canAutoClean: true,
124
- requiresSudo: false,
125
- recommendation: "No cleanup needed"
126
- };
127
- }
128
- const platform = getPlatform();
129
- const requiresSudo = (platform === "macos" || platform === "linux") && residuals.some((r) => r.startsWith("/usr/") || r.startsWith("/opt/"));
130
- return {
131
- needsCleanup: true,
132
- residualCount: residuals.length,
133
- canAutoClean: !requiresSudo,
134
- requiresSudo,
135
- recommendation: requiresSudo ? "Residual directories found. Manual cleanup with sudo required." : "Residual directories found. Can be automatically cleaned."
136
- };
137
- }
138
90
 
139
91
  async function execWithSudoIfNeeded(command, args) {
140
92
  const needsSudo = shouldUseSudoForGlobalInstall();
@@ -222,6 +174,33 @@ async function updateClaudeCode(force = false, skipPrompt = false) {
222
174
  }
223
175
  console.log(ansis.green(format(i18n.t("updater:currentVersion"), { version: currentVersion || "" })));
224
176
  console.log(ansis.green(format(i18n.t("updater:latestVersion"), { version: latestVersion })));
177
+ if (!isHomebrew) {
178
+ const residuals = findResidualNpmTempDirs("@anthropic-ai/claude-code");
179
+ if (residuals.length > 0) {
180
+ const plural = residuals.length > 1 ? "ies" : "y";
181
+ console.log(ansis.yellow(`
182
+ \u26A0 ${format(i18n.t("updater:residualDirsFound"), { count: String(residuals.length), plural })}`));
183
+ console.log(ansis.gray(` ${i18n.t("updater:cleaningWithSudo")}`));
184
+ try {
185
+ const { wrapCommandWithSudo } = await import('./platform.mjs');
186
+ let cleanedCount = 0;
187
+ for (const dir of residuals) {
188
+ const { command, args } = wrapCommandWithSudo("rm", ["-rf", dir]);
189
+ try {
190
+ await exec(command, args);
191
+ cleanedCount++;
192
+ } catch {
193
+ }
194
+ }
195
+ if (cleanedCount > 0) {
196
+ const cleanedPlural = cleanedCount > 1 ? "ies" : "y";
197
+ console.log(ansis.green(` \u2714 ${format(i18n.t("updater:cleanedDirs"), { count: String(cleanedCount), plural: cleanedPlural })}`));
198
+ }
199
+ } catch {
200
+ console.log(ansis.yellow(` \u2139 ${i18n.t("updater:cleanupFailed")}`));
201
+ }
202
+ }
203
+ }
225
204
  if (isBroken) {
226
205
  console.log(ansis.yellow(i18n.t("updater:installationBroken")));
227
206
  const fixResult = await fixBrokenNpmSymlink();
@@ -251,38 +230,6 @@ async function updateClaudeCode(force = false, skipPrompt = false) {
251
230
  } else {
252
231
  console.log(ansis.green(format(i18n.t("updater:autoUpdating"), { tool: "Claude Code" })));
253
232
  }
254
- if (!isHomebrew && (installationSource === "npm" || installationSource === "other")) {
255
- const residuals = findResidualNpmTempDirs("@anthropic-ai/claude-code");
256
- if (residuals.length > 0) {
257
- const plural = residuals.length > 1 ? "ies" : "y";
258
- console.log(ansis.yellow(`
259
- \u26A0 ${format(i18n.t("updater:residualDirsFound"), { count: String(residuals.length), plural })}`));
260
- const cleanupStatus = getNpmCleanupStatus("@anthropic-ai/claude-code");
261
- if (cleanupStatus.requiresSudo) {
262
- console.log(ansis.gray(` ${i18n.t("updater:cleaningWithSudo")}`));
263
- try {
264
- const { wrapCommandWithSudo } = await import('./platform.mjs');
265
- for (const dir of residuals) {
266
- const { command, args } = wrapCommandWithSudo("rm", ["-rf", dir]);
267
- try {
268
- await exec(command, args);
269
- } catch {
270
- }
271
- }
272
- const cleanedPlural = residuals.length > 1 ? "ies" : "y";
273
- console.log(ansis.green(` \u2714 ${format(i18n.t("updater:cleanedDirs"), { count: String(residuals.length), plural: cleanedPlural })}`));
274
- } catch {
275
- console.log(ansis.yellow(` \u2139 ${i18n.t("updater:cleanupFailed")}`));
276
- }
277
- } else {
278
- const result = cleanupNpmTempDirs("@anthropic-ai/claude-code");
279
- if (result.cleaned > 0) {
280
- const cleanedPlural = result.cleaned > 1 ? "ies" : "y";
281
- console.log(ansis.green(` \u2714 ${format(i18n.t("updater:cleanedDirs"), { count: String(result.cleaned), plural: cleanedPlural })}`));
282
- }
283
- }
284
- }
285
- }
286
233
  const toolName = isHomebrew ? "Claude Code (Homebrew)" : "Claude Code";
287
234
  const updateSpinner = ora(format(i18n.t("updater:updating"), { tool: toolName })).start();
288
235
  try {
@@ -1,4 +1,4 @@
1
- const version = "5.2.0";
1
+ const version = "5.2.1";
2
2
  const homepage = "https://github.com/miounet11/ccjk";
3
3
 
4
4
  export { homepage, version };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ccjk",
3
3
  "type": "module",
4
- "version": "5.2.0",
4
+ "version": "5.2.1",
5
5
  "packageManager": "pnpm@10.17.1",
6
6
  "description": "Claude Code JinKu - Advanced AI-powered development assistant with skills, agents, and LLM-driven audit",
7
7
  "author": {