cc-viewer 1.2.8 → 1.3.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.
- package/README.md +1 -1
- package/cli.js +36 -6
- package/dist/assets/{index-CN78DISW.js → index-C8W8UYGw.js} +93 -93
- package/dist/assets/index-V2-sKBoM.css +1 -0
- package/dist/index.html +2 -2
- package/interceptor.js +1 -1
- package/package.json +1 -1
- package/proxy.js +0 -1
- package/server.js +89 -1
- package/dist/assets/index-DhZ8St4J.css +0 -1
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ Step 1: Open Claude Code in any directory.
|
|
|
41
41
|
|
|
42
42
|
Step 2: Give Claude Code the following instruction:
|
|
43
43
|
```
|
|
44
|
-
I have installed the cc-viewer npm package but
|
|
44
|
+
I have installed the cc-viewer npm package, but after running ccv it still doesn't work properly. Please check cc-viewer's cli.js and findcc.js, and adapt them to the local Claude Code deployment based on the specific environment. Keep the scope of changes as constrained as possible within findcc.js.
|
|
45
45
|
```
|
|
46
46
|
Letting Claude Code diagnose the issue itself is more effective than asking anyone or reading any documentation!
|
|
47
47
|
|
package/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { readFileSync, writeFileSync, existsSync } from 'node:fs';
|
|
3
|
+
import { readFileSync, writeFileSync, existsSync, realpathSync } from 'node:fs';
|
|
4
4
|
import { resolve } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import { homedir } from 'node:os';
|
|
@@ -223,7 +223,7 @@ if (isVersion) {
|
|
|
223
223
|
|
|
224
224
|
if (args[0] === 'run') {
|
|
225
225
|
runProxyCommand(args);
|
|
226
|
-
} else if (
|
|
226
|
+
} else if (isUninstall) {
|
|
227
227
|
const cliResult = removeCliJsInjection();
|
|
228
228
|
const shellResult = removeShellHook();
|
|
229
229
|
|
|
@@ -249,12 +249,42 @@ if (args[0] === 'run') {
|
|
|
249
249
|
} else {
|
|
250
250
|
// Installation Logic
|
|
251
251
|
let mode = 'unknown';
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
252
|
+
|
|
253
|
+
// Check PATH to determine priority
|
|
254
|
+
let prefersNative = true; // default to native if not found in PATH
|
|
255
|
+
const paths = (process.env.PATH || '').split(':');
|
|
256
|
+
for (const dir of paths) {
|
|
257
|
+
if (!dir) continue;
|
|
258
|
+
const exePath = resolve(dir, 'claude');
|
|
259
|
+
if (existsSync(exePath)) {
|
|
260
|
+
try {
|
|
261
|
+
const real = realpathSync(exePath);
|
|
262
|
+
if (real.includes('node_modules')) {
|
|
263
|
+
prefersNative = false;
|
|
264
|
+
} else {
|
|
265
|
+
prefersNative = true;
|
|
266
|
+
}
|
|
267
|
+
break;
|
|
268
|
+
} catch (e) {
|
|
269
|
+
// ignore
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const nativePath = resolveNativePath();
|
|
275
|
+
const hasNpm = existsSync(cliPath);
|
|
276
|
+
|
|
277
|
+
if (prefersNative) {
|
|
256
278
|
if (nativePath) {
|
|
257
279
|
mode = 'native';
|
|
280
|
+
} else if (hasNpm) {
|
|
281
|
+
mode = 'npm';
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
if (hasNpm) {
|
|
285
|
+
mode = 'npm';
|
|
286
|
+
} else if (nativePath) {
|
|
287
|
+
mode = 'native';
|
|
258
288
|
}
|
|
259
289
|
}
|
|
260
290
|
|