ccanalyzer 1.1.1 → 1.1.3
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 +6 -0
- package/bin/index.js +11 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -13,6 +13,12 @@ npx -y ccanalyzer@latest
|
|
|
13
13
|
|
|
14
14
|
Opens a local dashboard at **http://localhost:3737** in your browser.
|
|
15
15
|
|
|
16
|
+
If port 3737 is already in use, specify a different port with `-p`:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx -y ccanalyzer@latest -p 3738
|
|
20
|
+
```
|
|
21
|
+
|
|
16
22
|
## Features
|
|
17
23
|
|
|
18
24
|
- **Dashboard** — all projects with token counts, costs, and last activity
|
package/bin/index.js
CHANGED
|
@@ -2,15 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
const { startServer } = require('../src/server');
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
const pIdx = args.indexOf('-p');
|
|
7
|
+
const userPort = pIdx !== -1 && args[pIdx + 1] ? parseInt(args[pIdx + 1], 10) : null;
|
|
8
|
+
const port = userPort || parseInt(process.env.PORT || '3737', 10);
|
|
6
9
|
|
|
7
10
|
startServer(port).then(({ url }) => {
|
|
8
11
|
console.log(`\n ccanalyzer running at ${url}\n`);
|
|
9
12
|
try {
|
|
10
|
-
// Try to open browser
|
|
11
13
|
import('open').then(m => m.default(url)).catch(() => {});
|
|
12
14
|
} catch {}
|
|
13
15
|
}).catch(err => {
|
|
14
|
-
|
|
16
|
+
if (err.code === 'EADDRINUSE' && !userPort) {
|
|
17
|
+
console.error(`\n Port ${port} is already in use.`);
|
|
18
|
+
console.error(` Try a different port:\n`);
|
|
19
|
+
console.error(` npx ccanalyzer -p ${port + 1}\n`);
|
|
20
|
+
} else {
|
|
21
|
+
console.error('Failed to start server:', err.message);
|
|
22
|
+
}
|
|
15
23
|
process.exit(1);
|
|
16
24
|
});
|
package/package.json
CHANGED