coderadar 0.1.1 → 0.2.0
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 +137 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +49 -23
- package/dist/commands/sync.js.map +1 -1
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# CodeRadar CLI
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
Track projects, monitor Claude Code usage, analyze costs — from your terminal.
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Sync local data to cloud dashboard
|
|
13
|
+
npx coderadar sync --token <your-token>
|
|
14
|
+
|
|
15
|
+
# Generate local HTML dashboard (offline mode)
|
|
16
|
+
npx coderadar generate
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Run directly with npx (recommended)
|
|
23
|
+
npx coderadar
|
|
24
|
+
|
|
25
|
+
# Or install globally
|
|
26
|
+
npm install -g coderadar
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Commands
|
|
30
|
+
|
|
31
|
+
### `coderadar sync`
|
|
32
|
+
|
|
33
|
+
Sync local project data to the cloud dashboard.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
coderadar sync --token <your-token>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Options:
|
|
40
|
+
- `--token <token>` - Your cloud dashboard authentication token
|
|
41
|
+
- `--url <url>` - Custom cloud URL (defaults to https://coderadar-guillaumebeylounehs-projects.vercel.app)
|
|
42
|
+
|
|
43
|
+
### `coderadar generate`
|
|
44
|
+
|
|
45
|
+
Generate a static HTML dashboard from local data (offline mode).
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
coderadar generate
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The dashboard is saved to `~/.coderadar/dashboard.html` and automatically opens in your browser.
|
|
52
|
+
|
|
53
|
+
### `coderadar init`
|
|
54
|
+
|
|
55
|
+
Interactive setup wizard to configure your CodeRadar installation.
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
coderadar init
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### `coderadar config`
|
|
62
|
+
|
|
63
|
+
Manage configuration settings.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Set cloud token
|
|
67
|
+
coderadar config set cloudToken <token>
|
|
68
|
+
|
|
69
|
+
# Set cloud URL
|
|
70
|
+
coderadar config set cloudUrl <url>
|
|
71
|
+
|
|
72
|
+
# View current configuration
|
|
73
|
+
coderadar config list
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Cloud Dashboard
|
|
77
|
+
|
|
78
|
+
Access your cloud dashboard at:
|
|
79
|
+
**https://coderadar-guillaumebeylounehs-projects.vercel.app**
|
|
80
|
+
|
|
81
|
+
The cloud dashboard provides:
|
|
82
|
+
- Real-time project monitoring across devices
|
|
83
|
+
- AI-powered summaries and insights (Pro tier)
|
|
84
|
+
- Team collaboration features (Team tier)
|
|
85
|
+
- Multi-currency budget tracking (Pro tier)
|
|
86
|
+
- PDF exports and Slack/Discord webhooks (Team tier)
|
|
87
|
+
|
|
88
|
+
## How It Works
|
|
89
|
+
|
|
90
|
+
CodeRadar CLI scans your local development environment to collect:
|
|
91
|
+
|
|
92
|
+
1. **Project Data**
|
|
93
|
+
- Git statistics (commits, branches, contributors)
|
|
94
|
+
- Project health scores
|
|
95
|
+
- Technology stack detection
|
|
96
|
+
- Last activity timestamps
|
|
97
|
+
|
|
98
|
+
2. **Claude Code Sessions**
|
|
99
|
+
- Session history and duration
|
|
100
|
+
- Model usage (Opus 4.6, Sonnet 4.5, etc.)
|
|
101
|
+
- Token consumption
|
|
102
|
+
- Conversation contexts
|
|
103
|
+
|
|
104
|
+
3. **API Costs**
|
|
105
|
+
- Token-based cost calculations
|
|
106
|
+
- Budget tracking and alerts
|
|
107
|
+
- Spending trends over time
|
|
108
|
+
|
|
109
|
+
All data is synced to the cloud dashboard for cross-device access, team sharing, and advanced analytics.
|
|
110
|
+
|
|
111
|
+
## Requirements
|
|
112
|
+
|
|
113
|
+
- Node.js >= 18.0.0
|
|
114
|
+
- Git (for project scanning)
|
|
115
|
+
- Claude Code (for session tracking)
|
|
116
|
+
|
|
117
|
+
## Privacy
|
|
118
|
+
|
|
119
|
+
CodeRadar CLI respects your privacy:
|
|
120
|
+
- All data stays local by default
|
|
121
|
+
- Cloud sync is opt-in (requires explicit `--token`)
|
|
122
|
+
- No telemetry or analytics unless synced
|
|
123
|
+
- Open source and auditable
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
MIT License - Copyright (c) 2026 Guillaume Beylouneh
|
|
128
|
+
|
|
129
|
+
## Links
|
|
130
|
+
|
|
131
|
+
- [GitHub Repository](https://github.com/GuillaumeBeylouneh/coderadar)
|
|
132
|
+
- [Cloud Dashboard](https://coderadar-guillaumebeylounehs-projects.vercel.app)
|
|
133
|
+
- [Issue Tracker](https://github.com/GuillaumeBeylouneh/coderadar/issues)
|
|
134
|
+
|
|
135
|
+
## Author
|
|
136
|
+
|
|
137
|
+
Guillaume Beylouneh
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAIA,UAAU,WAAW;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAIA,UAAU,WAAW;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,iBAuIrD"}
|
package/dist/commands/sync.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { loadConfig } from 'coderadar-core';
|
|
1
|
+
import { loadConfig, enrichTimelineWithSessionData } from 'coderadar-core';
|
|
2
2
|
import { collectDashboardData } from '../collector.js';
|
|
3
3
|
import ora from 'ora';
|
|
4
4
|
export async function syncCommand(options) {
|
|
5
5
|
const config = loadConfig();
|
|
6
|
-
const cloudUrl = options.url || config.cloudUrl || 'https://coderadar.
|
|
6
|
+
const cloudUrl = options.url || config.cloudUrl || 'https://coderadar-guillaumebeylounehs-projects.vercel.app';
|
|
7
7
|
const token = options.token || config.cloudToken || process.env.CODERADAR_TOKEN;
|
|
8
8
|
if (!token) {
|
|
9
9
|
console.error('No auth token found. Set one with:\n' +
|
|
@@ -16,6 +16,10 @@ export async function syncCommand(options) {
|
|
|
16
16
|
const spinner = ora('Collecting local data...').start();
|
|
17
17
|
try {
|
|
18
18
|
const data = collectDashboardData(config, { noCosts: options.noCosts });
|
|
19
|
+
spinner.text = 'Enriching session data...';
|
|
20
|
+
// Enrich timeline with token/cost/model data
|
|
21
|
+
const sessionEnrichment = await enrichTimelineWithSessionData(config.claudeDir, data.timeline, 60);
|
|
22
|
+
spinner.text = 'Transforming data for sync...';
|
|
19
23
|
// Transform projects for API
|
|
20
24
|
const projects = data.projects.map((p) => ({
|
|
21
25
|
name: p.name,
|
|
@@ -33,27 +37,49 @@ export async function syncCommand(options) {
|
|
|
33
37
|
last_commit_message: p.lastCommit || null,
|
|
34
38
|
updated_at: new Date().toISOString(),
|
|
35
39
|
}));
|
|
36
|
-
// Transform sessions from timeline
|
|
37
|
-
const sessions = data.timeline.map((t) =>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
// Transform sessions from timeline with enrichment data
|
|
41
|
+
const sessions = data.timeline.map((t) => {
|
|
42
|
+
const enrichment = sessionEnrichment.get(t.sessionId);
|
|
43
|
+
return {
|
|
44
|
+
session_id: t.sessionId,
|
|
45
|
+
project_path: enrichment?.projectPath || t.project || null,
|
|
46
|
+
title: t.summary || t.project || null,
|
|
47
|
+
model: enrichment?.model || null,
|
|
48
|
+
started_at: t.date,
|
|
49
|
+
duration_minutes: t.stats?.duration || null,
|
|
50
|
+
input_tokens: enrichment?.inputTokens || 0,
|
|
51
|
+
output_tokens: enrichment?.outputTokens || 0,
|
|
52
|
+
cost_usd: enrichment?.costUsd || null,
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
// Transform costs - create one record per model per day to match Supabase UNIQUE constraint
|
|
56
|
+
const daily_costs = [];
|
|
57
|
+
for (const c of data.costDaily) {
|
|
58
|
+
if (c.modelBreakdowns && c.modelBreakdowns.length > 0) {
|
|
59
|
+
// Create one record per model
|
|
60
|
+
for (const mb of c.modelBreakdowns) {
|
|
61
|
+
daily_costs.push({
|
|
62
|
+
date: c.date,
|
|
63
|
+
total_cost_usd: mb.cost || 0,
|
|
64
|
+
total_input_tokens: mb.inputTokens || 0,
|
|
65
|
+
total_output_tokens: mb.outputTokens || 0,
|
|
66
|
+
model: mb.modelName || null,
|
|
67
|
+
session_count: 0, // We don't have session count per model yet
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// Fallback: single record with aggregated data
|
|
73
|
+
daily_costs.push({
|
|
74
|
+
date: c.date,
|
|
75
|
+
total_cost_usd: c.totalCost || 0,
|
|
76
|
+
total_input_tokens: c.inputTokens || 0,
|
|
77
|
+
total_output_tokens: c.outputTokens || 0,
|
|
78
|
+
model: null,
|
|
79
|
+
session_count: 0,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
57
83
|
spinner.text = `Syncing ${projects.length} projects, ${sessions.length} sessions, ${daily_costs.length} cost records...`;
|
|
58
84
|
const response = await fetch(`${cloudUrl}/api/sync`, {
|
|
59
85
|
method: 'POST',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,GAAG,MAAM,KAAK,CAAC;AAQtB,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAoB;IACpD,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,QAAQ,IAAI,2DAA2D,CAAC;IAC/G,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;IAEhF,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CACX,sCAAsC;YACtC,kDAAkD;YAClD,6BAA6B;YAC7B,mDAAmD;YACnD,uBAAuB,GAAG,QAAQ,GAAG,qBAAqB,CAC3D,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,0BAA0B,CA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AE,CAAC;YAC7B,OAAO,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,SAAS,CAAC,CAAC;QACxE,CAAC;QACD,IAAI,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC;YAC7B,OAAO,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,SAAS,CAAC,CAAC;QACxE,CAAC;QACD,IAAI,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,cAAc,CAAC,CAAC;QAChF,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,gBAAgB,QAAQ,YAAY,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5B,OAAO,CAAC,KAAK,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coderadar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Intelligent dashboard for Claude Code project supervision - scan projects, track sessions, monitor costs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"node": ">=18.0.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"coderadar-core": "^0.
|
|
27
|
+
"coderadar-core": "^0.2.0",
|
|
28
28
|
"commander": "^13.0.0",
|
|
29
29
|
"ora": "^8.1.0",
|
|
30
30
|
"open": "^10.1.0"
|