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 +5 -3
- package/dist/setup.js +17 -9
- package/dist/webServer.js +10 -1
- package/package.json +1 -1
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
|
|
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
|
-
|
|
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}
|
|
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
|
-
|
|
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.
|
|
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('
|
|
208
|
-
console.log(`
|
|
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('
|
|
211
|
-
console.log(
|
|
212
|
-
console.log(`
|
|
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}
|
|
64
|
+
console.log(`\n š Copilot Tracer Web UI: http://localhost:${port}/\n`);
|
|
56
65
|
});
|
|
57
66
|
}
|
package/package.json
CHANGED