cc-viewer 1.5.20 → 1.5.22

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 CHANGED
@@ -38,7 +38,6 @@ You can use Claude directly from the web page while viewing the full request pay
38
38
 
39
39
  Even better — you can even code from your mobile device!
40
40
 
41
-
42
41
  ### Logger Mode
43
42
 
44
43
  ⚠️ If you still prefer using the native claude tool or VS Code extension, use this mode.
@@ -46,6 +45,7 @@ Even better — you can even code from your mobile device!
46
45
  In this mode, launching `claude` or `claude --dangerously-skip-permissions` will automatically start a logging process that records request logs to ~/.claude/cc-viewer/*yourproject*/date.jsonl
47
46
 
48
47
  Enable logger mode:
48
+
49
49
  ```bash
50
50
  ccv -logger
51
51
  ```
@@ -59,10 +59,28 @@ This command automatically detects how Claude Code is installed locally (NPM or
59
59
  - NPM-installed Claude Code is the recommended approach for this project.
60
60
 
61
61
  Uninstall logger mode:
62
+
62
63
  ```bash
63
64
  ccv --uninstall
64
65
  ```
65
66
 
67
+ ### Configuration Override
68
+
69
+ If you need to use a custom API endpoint (e.g., a corporate proxy), simply configure it in `~/.claude/settings.json` or set the `ANTHROPIC_BASE_URL` environment variable. `ccv` will automatically detect and correctly forward requests.
70
+
71
+ ### Environment Variables
72
+
73
+ - `CCV_LOG_DIR`: Override the default log directory (`~/.claude/cc-viewer`).
74
+ - Set to `tmp` to use the system temporary directory (useful for testing or ephemeral sessions).
75
+ - Set to any absolute path or `~/path` to customize storage location.
76
+ - `CCV_DEBUG_PLUGINS`: Set to `1` to enable debug logs for the plugin system.
77
+
78
+ ### Silent Mode
79
+
80
+ By default, `ccv` runs in silent mode when wrapping `claude`, keeping your terminal output clean and consistent with the native experience. All logs are captured in the background and can be viewed at `http://localhost:7008`.
81
+
82
+ Once configured, use the `claude` command as normal. Visit `http://localhost:7008` to access the monitoring interface.
83
+
66
84
  ### Troubleshooting
67
85
 
68
86
  If you encounter issues starting cc-viewer, here is the ultimate troubleshooting approach:
@@ -70,9 +88,11 @@ If you encounter issues starting cc-viewer, here is the ultimate troubleshooting
70
88
  Step 1: Open Claude Code in any directory.
71
89
 
72
90
  Step 2: Give Claude Code the following instruction:
91
+
73
92
  ```
74
93
  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.
75
94
  ```
95
+
76
96
  Letting Claude Code diagnose the issue itself is more effective than asking anyone or reading any documentation!
77
97
 
78
98
  After the above instruction is completed, `findcc.js` will be updated. If your project frequently requires local deployment, or if forked code often needs to resolve installation issues, keeping this file lets you simply copy it next time. At this stage, many projects and companies using Claude Code are not deploying on Mac but rather on server-side hosted environments, so the author has separated `findcc.js` to make it easier to track cc-viewer source code updates going forward.
@@ -80,6 +100,7 @@ After the above instruction is completed, `findcc.js` will be updated. If your p
80
100
  ### Other Commands
81
101
 
82
102
  See:
103
+
83
104
  ```bash
84
105
  ccv -h
85
106
  ```
@@ -94,10 +115,8 @@ By default, `ccv` runs in silent mode when wrapping `claude`, keeping your termi
94
115
 
95
116
  Once configured, use the `claude` command as normal. Visit `http://localhost:7008` to access the monitoring interface.
96
117
 
97
-
98
118
  ## Features
99
119
 
100
-
101
120
  ### Programming Mode
102
121
 
103
122
  After launching with ccv, you can see:
package/cli.js CHANGED
@@ -299,12 +299,13 @@ async function runCliMode(extraClaudeArgs = [], cwd) {
299
299
  await spawnClaude(proxyPort, workingDir, extraClaudeArgs, claudePath, isNpmVersion, port);
300
300
  } catch (err) {
301
301
  console.error('[CC Viewer] Failed to spawn Claude:', err.message);
302
- serverMod.stopViewer();
302
+ await serverMod.stopViewer();
303
303
  process.exit(1);
304
304
  }
305
305
 
306
306
  // 4. 自动打开浏览器
307
- const url = `http://127.0.0.1:${port}`;
307
+ const protocol = serverMod.getProtocol();
308
+ const url = `${protocol}://127.0.0.1:${port}`;
308
309
  try {
309
310
  const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
310
311
  const { execSync } = await import('node:child_process');
@@ -316,8 +317,7 @@ async function runCliMode(extraClaudeArgs = [], cwd) {
316
317
  // 5. 注册退出处理
317
318
  const cleanup = () => {
318
319
  killPty();
319
- serverMod.stopViewer();
320
- process.exit();
320
+ serverMod.stopViewer().finally(() => process.exit());
321
321
  };
322
322
  process.on('SIGINT', cleanup);
323
323
  process.on('SIGTERM', cleanup);
@@ -360,7 +360,8 @@ async function runCliModeWorkspaceSelector(extraClaudeArgs = []) {
360
360
  serverMod.setWorkspaceClaudePath(claudePath, isNpmVersion);
361
361
 
362
362
  // 自动打开浏览器
363
- const url = `http://127.0.0.1:${port}`;
363
+ const wsProtocol = serverMod.getProtocol();
364
+ const url = `${wsProtocol}://127.0.0.1:${port}`;
364
365
  try {
365
366
  const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';
366
367
  const { execSync } = await import('node:child_process');
@@ -373,8 +374,7 @@ async function runCliModeWorkspaceSelector(extraClaudeArgs = []) {
373
374
  const { killPty } = await import('./pty-manager.js');
374
375
  const cleanup = () => {
375
376
  killPty();
376
- serverMod.stopViewer();
377
- process.exit();
377
+ serverMod.stopViewer().finally(() => process.exit());
378
378
  };
379
379
  process.on('SIGINT', cleanup);
380
380
  process.on('SIGTERM', cleanup);