cc-viewer 1.1.0 → 1.1.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.
- package/package.json +1 -1
- package/server.js +11 -0
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -556,7 +556,18 @@ export async function startViewer() {
|
|
|
556
556
|
currentServer.listen(port, HOST, () => {
|
|
557
557
|
server = currentServer;
|
|
558
558
|
actualPort = port;
|
|
559
|
+
const url = `http://${HOST}:${port}`;
|
|
559
560
|
console.log(t('server.started', { host: HOST, port }));
|
|
561
|
+
// v2.0.69 之前的版本会清空控制台,自动打开浏览器确保用户能看到界面
|
|
562
|
+
try {
|
|
563
|
+
const ccPkgPath = join(__dirname, '..', '@anthropic-ai', 'claude-code', 'package.json');
|
|
564
|
+
const ccVer = JSON.parse(readFileSync(ccPkgPath, 'utf-8')).version;
|
|
565
|
+
const [maj, min, pat] = ccVer.split('.').map(Number);
|
|
566
|
+
if (maj < 2 || (maj === 2 && min === 0 && pat < 69)) {
|
|
567
|
+
const cmd = platform() === 'darwin' ? 'open' : platform() === 'win32' ? 'start' : 'xdg-open';
|
|
568
|
+
execSync(`${cmd} ${url}`, { stdio: 'ignore', timeout: 5000 });
|
|
569
|
+
}
|
|
570
|
+
} catch {}
|
|
560
571
|
startWatching();
|
|
561
572
|
resolve(server);
|
|
562
573
|
});
|