tokenrace 0.1.4 → 0.1.6

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/bin/cli.js CHANGED
@@ -1,11 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
  import { startServer } from '../src/server.js'
3
+ import { ensureEnvVars } from '../src/ensure-env-vars.js'
3
4
  import open from 'open'
4
5
 
5
6
  const PORT = process.env.TOKENRACE_PORT ? Number(process.env.TOKENRACE_PORT) : 1337
6
7
 
8
+ const { added, rcPath } = ensureEnvVars(PORT)
9
+
7
10
  const { server } = await startServer({ port: PORT })
8
11
 
12
+ const envStatus = added
13
+ ? ` ✓ Variables OTLP añadidas a ${rcPath}\n ⚠ Abre una nueva terminal y ejecuta: claude`
14
+ : ` ✓ Variables OTLP ya presentes en ${rcPath}`
15
+
9
16
  console.log(`
10
17
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
11
18
  tokenrace — monitor de Claude Code
@@ -13,19 +20,7 @@ console.log(`
13
20
 
14
21
  Dashboard → http://localhost:${PORT}
15
22
 
16
- Activa la telemetría en Claude Code:
17
-
18
- export CLAUDE_CODE_ENABLE_TELEMETRY=1
19
- export OTEL_METRICS_EXPORTER=otlp
20
- export OTEL_LOGS_EXPORTER=otlp
21
- export OTEL_EXPORTER_OTLP_PROTOCOL=http/json
22
- export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:${PORT}
23
- export OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=cumulative
24
-
25
- Etiqueta tu sesión (opcional — puedes hacerlo desde la web):
26
- export OTEL_RESOURCE_ATTRIBUTES="project=mi-proyecto"
27
-
28
- Luego: claude
23
+ ${envStatus}
29
24
 
30
25
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
31
26
  `)