copilot-tracer 1.0.1 → 1.0.2

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/dist/cli.js CHANGED
@@ -24,10 +24,12 @@ program
24
24
  .parse();
25
25
  const opts = program.opts();
26
26
  const port = parseInt(opts.port);
27
- // Handle --setup before anything else
27
+ // Handle --setup: patch env files, apply to current process, then fall through to start web UI
28
28
  if (opts.setup) {
29
29
  runSetup(port);
30
- process.exit(0);
30
+ // Force no-proxy web mode — user just needs to open the browser
31
+ opts.proxy = false;
32
+ opts.ui = 'web';
31
33
  }
32
34
  const sessionId = opts.session || randomUUID();
33
35
  createSession(sessionId);
@@ -35,7 +37,7 @@ console.log(`\n šŸ¤– Copilot Tracer | Session: ${sessionId}\n`);
35
37
  // Start Web UI
36
38
  if (opts.ui === 'web' || opts.ui === 'both') {
37
39
  startWebServer(port, sessionId);
38
- setTimeout(() => open(`http://localhost:${port}`), 1500);
40
+ setTimeout(() => open(`http://localhost:${port}/`), 1500);
39
41
  }
40
42
  // Start Console UI refresh loop
41
43
  if (opts.ui === 'console' || opts.ui === 'both') {
package/dist/setup.js CHANGED
@@ -78,7 +78,11 @@ function detectShellProfile() {
78
78
  return path.join(os.homedir(), '.zshrc');
79
79
  }
80
80
  function getVSCodeSettingsPath() {
81
- return path.join(os.homedir(), 'Library/Application Support/Code/User/settings.json');
81
+ if (process.platform === 'darwin') {
82
+ return path.join(os.homedir(), 'Library/Application Support/Code/User/settings.json');
83
+ }
84
+ // Linux (and WSL)
85
+ return path.join(os.homedir(), '.config/Code/User/settings.json');
82
86
  }
83
87
  // ── Patchers ──────────────────────────────────────────────────────────────────
84
88
  function patchShellProfile(profilePath, port) {
@@ -202,15 +206,19 @@ export function runSetup(port) {
202
206
  console.log(`\n${WARN} VS Code settings: ${result.reason}`);
203
207
  }
204
208
  }
205
- // 5. Summary
209
+ // 5. Apply env vars to the current process so the OTLP receiver works immediately
210
+ process.env[OTEL_ENDPOINT_KEY] = `http://localhost:${port}`;
211
+ process.env[OTEL_CONTENT_KEY] = 'true';
212
+ process.env[OTEL_ENABLED_KEY] = 'true';
213
+ // 6. Summary
214
+ const profileBase = profilePath ? path.basename(profilePath) : '.zshrc';
206
215
  console.log('\n────────────────────────────────────────────────');
207
- console.log(' Next steps:\n');
208
- console.log(` 1. source ${profilePath ?? '~/.zshrc'} (apply to current terminal)`);
216
+ console.log(' One manual step required:\n');
217
+ console.log(` source ~/${profileBase}`);
218
+ console.log(` (opens a new terminal already? — env is already active there)`);
209
219
  if (vscode.found)
210
- console.log(' 2. Restart VS Code');
211
- console.log(` 3. node dist/cli.js --ui web --port ${port} --no-proxy`);
212
- console.log(` 4. Open http://localhost:${port}`);
213
- console.log(` 5. Use copilot normally — traces appear automatically`);
214
- console.log('\n Tracer endpoint: http://localhost:' + port + '/v1/traces');
220
+ console.log('\n Restart VS Code once to pick up the new terminal env.');
221
+ console.log('\n ✨ Starting tracer web UI now...');
222
+ console.log(` Open: http://localhost:${port}/`);
215
223
  console.log('────────────────────────────────────────────────\n');
216
224
  }
package/dist/webServer.js CHANGED
@@ -51,7 +51,16 @@ export function startWebServer(port = 4747, sessionId) {
51
51
  traceEvents.off('trace:done', onDone);
52
52
  });
53
53
  });
54
+ httpServer.on('error', (err) => {
55
+ if (err.code === 'EADDRINUSE') {
56
+ console.error(`\n āŒ Port ${port} is already in use.`);
57
+ console.error(` A tracer may already be running — open http://localhost:${port}/`);
58
+ console.error(` Or kill it: lsof -ti:${port} | xargs kill\n`);
59
+ process.exit(1);
60
+ }
61
+ throw err;
62
+ });
54
63
  httpServer.listen(port, () => {
55
- console.log(`\n 🌐 Copilot Tracer Web UI: http://localhost:${port}\n`);
64
+ console.log(`\n 🌐 Copilot Tracer Web UI: http://localhost:${port}/\n`);
56
65
  });
57
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "copilot-tracer",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Real-time monitor and tracing tool for GitHub Copilot CLI — tracks tokens, AI credits, MCP/skill/agent calls with console and web UI",
5
5
  "keywords": [
6
6
  "copilot",