claude-cli-analytics 0.0.1 → 0.0.5
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 +148 -60
- package/bin/cli.cjs +168 -0
- package/bin/sanity.mjs +3 -0
- package/dist/client/assets/{index-CXwfzzf8.js → index-B3X-FepG.js} +29 -22
- package/dist/client/index.html +1 -1
- package/dist/server/analyzer.js +305 -85
- package/dist/server/index.js +7 -5
- package/package.json +2 -2
- package/bin/cli.js +0 -44
package/dist/server/index.js
CHANGED
|
@@ -94,18 +94,20 @@ app.post('/api/refresh', (req, res) => {
|
|
|
94
94
|
// Static file serving (SPA)
|
|
95
95
|
// ════════════════════════════════════════════════════════════
|
|
96
96
|
const distPath = path.resolve(__dirname, '../client');
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
const distPathAlt = path.resolve(process.cwd(), 'dist/client');
|
|
98
|
+
const resolvedDistPath = fs.existsSync(distPath) ? distPath : distPathAlt;
|
|
99
|
+
const indexHtmlPath = path.join(resolvedDistPath, 'index.html');
|
|
100
|
+
if (fs.existsSync(resolvedDistPath)) {
|
|
101
|
+
app.use(express.static(resolvedDistPath));
|
|
100
102
|
app.use((req, res, next) => {
|
|
101
103
|
if (req.path.startsWith('/api'))
|
|
102
104
|
return next();
|
|
103
105
|
res.sendFile(indexHtmlPath);
|
|
104
106
|
});
|
|
105
|
-
console.log(`📦 Serving frontend from: ${
|
|
107
|
+
console.log(`📦 Serving frontend from: ${resolvedDistPath}`);
|
|
106
108
|
}
|
|
107
109
|
else {
|
|
108
|
-
console.log(`⚠️ Frontend not found at: ${
|
|
110
|
+
console.log(`⚠️ Frontend not found at: ${resolvedDistPath}`);
|
|
109
111
|
console.log(` Run in dev mode: npm run dev`);
|
|
110
112
|
}
|
|
111
113
|
// ════════════════════════════════════════════════════════════
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-cli-analytics",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Claude CLI Analytics Dashboard - Efficiency insights for Claude Pro users",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"main": "dist/server/index.js",
|
|
26
26
|
"type": "module",
|
|
27
27
|
"bin": {
|
|
28
|
-
"claude-cli-analytics": "./bin/cli.
|
|
28
|
+
"claude-cli-analytics": "./bin/cli.cjs"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
31
|
"dist",
|
package/bin/cli.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// ── Claude Analytics CLI ──
|
|
4
|
-
// Supports: --port <number>, --path <dir>, --help
|
|
5
|
-
|
|
6
|
-
const args = process.argv.slice(2);
|
|
7
|
-
|
|
8
|
-
// Handle --help
|
|
9
|
-
if (args.includes('--help') || args.includes('-h')) {
|
|
10
|
-
console.log(`
|
|
11
|
-
Claude Analytics Dashboard
|
|
12
|
-
|
|
13
|
-
Usage: claude-cli-analytics [options]
|
|
14
|
-
|
|
15
|
-
Options:
|
|
16
|
-
--port <number> Server port (default: 3001)
|
|
17
|
-
--path <dir> Claude projects directory (overrides auto-detection)
|
|
18
|
-
--help, -h Show this help message
|
|
19
|
-
|
|
20
|
-
Auto-detection:
|
|
21
|
-
Automatically finds Claude Code data at ~/.claude/projects
|
|
22
|
-
Works with all installation methods (homebrew, npm, direct install)
|
|
23
|
-
|
|
24
|
-
Environment variables:
|
|
25
|
-
CLAUDE_PROJECTS_DIR Override projects directory path
|
|
26
|
-
PORT Override server port
|
|
27
|
-
`);
|
|
28
|
-
process.exit(0);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Parse --port
|
|
32
|
-
const portIdx = args.indexOf('--port');
|
|
33
|
-
if (portIdx !== -1 && args[portIdx + 1]) {
|
|
34
|
-
process.env.PORT = args[portIdx + 1];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Parse --path
|
|
38
|
-
const pathIdx = args.indexOf('--path');
|
|
39
|
-
if (pathIdx !== -1 && args[pathIdx + 1]) {
|
|
40
|
-
process.env.CLAUDE_PROJECTS_DIR = args[pathIdx + 1];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Start the server
|
|
44
|
-
import('../dist/server/index.js');
|