cc-viewer 1.2.8 → 1.2.9
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 +11 -1
- package/cli.js +36 -6
- package/dist/assets/{index-CN78DISW.js → index-Do8E8Nxd.js} +110 -110
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/proxy.js +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
|
|
|
@@ -115,3 +115,13 @@ CC-Viewer supports 18 languages, automatically switching based on system locale:
|
|
|
115
115
|
## License
|
|
116
116
|
|
|
117
117
|
MIT
|
|
118
|
+
|
|
119
|
+
### How to Submit a PR
|
|
120
|
+
The author welcomes and encourages PRs from the community.
|
|
121
|
+
|
|
122
|
+
A few requirements:
|
|
123
|
+
|
|
124
|
+
When submitting a PR, please tell me what your Prompt was and which model you used to modify the code (PRs made with inferior models will not be accepted);
|
|
125
|
+
If there are UI changes, tell me what functionality was modified on the interface — a screenshot with circles drawn around the changes is recommended;
|
|
126
|
+
Changes to cli.js and interceptor.js will be reviewed very carefully, as I don't want issues in core files to affect everyone's usage;
|
|
127
|
+
Please make sure to verify the functionality locally before submitting — much appreciated!
|
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
|
|