skills-atlas-cli 0.16.0 → 0.16.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/bin/telemetry-send.js +22 -3
- package/data.json +1011 -840
- package/package.json +1 -1
- package/src/commands/info.js +4 -1
- package/src/localskills.js +0 -0
package/bin/telemetry-send.js
CHANGED
|
@@ -1,20 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
// Detached sender. Reads {endpoint, client, events} from the temp file in argv[2], POSTs once
|
|
4
|
-
//
|
|
3
|
+
// Detached sender. Reads {endpoint, client, events} from the temp file in argv[2], POSTs once,
|
|
4
|
+
// then deletes the file. Fully fail-silent — telemetry must never matter.
|
|
5
|
+
// In a proxied environment Node's built-in fetch (undici) IGNORES *_PROXY env, so the POST would
|
|
6
|
+
// silently fail; there we fall back to curl, which honors the proxy. Non-proxied → plain fetch.
|
|
5
7
|
const fs = require('fs');
|
|
6
8
|
const file = process.argv[2];
|
|
7
9
|
const cleanup = () => { try { fs.unlinkSync(file); } catch { /* ignore */ } };
|
|
8
10
|
if (!file) process.exit(0);
|
|
9
11
|
let p; try { p = JSON.parse(fs.readFileSync(file, 'utf8')); } catch { cleanup(); process.exit(0); }
|
|
10
12
|
if (!p || !p.endpoint || !Array.isArray(p.events) || !p.events.length) { cleanup(); process.exit(0); }
|
|
13
|
+
|
|
14
|
+
const body = JSON.stringify({ client: p.client, events: p.events });
|
|
15
|
+
const proxy = process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY ||
|
|
16
|
+
process.env.http_proxy || process.env.ALL_PROXY || process.env.all_proxy;
|
|
17
|
+
|
|
18
|
+
if (proxy) {
|
|
19
|
+
// curl picks up *_PROXY from the environment automatically; body via stdin avoids arg limits.
|
|
20
|
+
try {
|
|
21
|
+
require('child_process').spawnSync('curl', [
|
|
22
|
+
'-s', '--max-time', '4', '-X', 'POST', p.endpoint,
|
|
23
|
+
'-H', 'Content-Type: application/json', '--data-binary', '@-',
|
|
24
|
+
], { input: body, stdio: ['pipe', 'ignore', 'ignore'] });
|
|
25
|
+
} catch { /* curl missing → drop; telemetry must never matter */ }
|
|
26
|
+
cleanup();
|
|
27
|
+
process.exit(0);
|
|
28
|
+
}
|
|
29
|
+
|
|
11
30
|
try {
|
|
12
31
|
const ac = new AbortController();
|
|
13
32
|
const timer = setTimeout(() => ac.abort(), 2000);
|
|
14
33
|
fetch(p.endpoint, {
|
|
15
34
|
method: 'POST',
|
|
16
35
|
headers: { 'Content-Type': 'application/json' },
|
|
17
|
-
body
|
|
36
|
+
body,
|
|
18
37
|
signal: ac.signal,
|
|
19
38
|
}).catch(() => {}).finally(() => { clearTimeout(timer); cleanup(); });
|
|
20
39
|
} catch { cleanup(); }
|