xkat-cli 2.0.15 → 2.0.17
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/checksums.json +5 -5
- package/bin/xkat-cli.js +8 -5
- package/package.json +1 -1
- package/scripts/install.js +9 -3
package/bin/checksums.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"xkat-agent-macos-aarch64": "
|
|
3
|
-
"xkat-agent-macos-x64": "
|
|
4
|
-
"xkat-agent-linux-x64": "
|
|
5
|
-
"xkat-agent-linux-aarch64": "
|
|
6
|
-
"xkat-agent-win-x64.exe": "
|
|
2
|
+
"xkat-agent-macos-aarch64": "2302708ec3671a348d7097ca37c8fdfb8f7e7075677b77bdcd3a81f925c7a08d",
|
|
3
|
+
"xkat-agent-macos-x64": "0327efb22cb81327f139fe93745453c561ccfd8e63255e3277c9feb5de497d0a",
|
|
4
|
+
"xkat-agent-linux-x64": "2ca8bfd35f05398b8e90e4dfa1b5d702f7a81fc5881e4be9b3e8df11345860e9",
|
|
5
|
+
"xkat-agent-linux-aarch64": "6d2db70dd5e7a02c275106f3d3d0abf6ebfdc19d526f6deb952753df3f1f7584",
|
|
6
|
+
"xkat-agent-win-x64.exe": "7116843eaf46be1c75f3170f91b15d745e4a8a0bf6cdf54ec436095fd27082f1"
|
|
7
7
|
}
|
package/bin/xkat-cli.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// Suppress Node.js runtime deprecation warnings (e.g. DEP0169)
|
|
4
|
+
process.removeAllListeners('warning');
|
|
5
|
+
process.emitWarning = () => {};
|
|
3
6
|
process.env.NODE_NO_WARNINGS = '1';
|
|
4
7
|
|
|
5
8
|
/**
|
|
@@ -51,20 +54,20 @@ const binaryPath = candidatePaths.find((p) => fs.existsSync(p));
|
|
|
51
54
|
const args = process.argv.slice(2);
|
|
52
55
|
const subCmd = args.join(' ').trim();
|
|
53
56
|
|
|
54
|
-
// ── 1. Zero-Touch Port 10022 Cleanup Command ──
|
|
57
|
+
// ── 1. Zero-Touch Port 38000..38050 & 10022 Cleanup Command ──
|
|
55
58
|
if (subCmd === 'down' || subCmd === 'stop' || subCmd === 'kill' || subCmd === 'clean') {
|
|
56
|
-
console.log('🛑 Cleaning up
|
|
59
|
+
console.log('🛑 Cleaning up agent ports (38000..38050, 10022) and stopping existing xkat agent instances...');
|
|
57
60
|
if (os.platform() === 'win32') {
|
|
58
61
|
spawnSync('powershell', [
|
|
59
62
|
'-NoProfile',
|
|
60
63
|
'-NonInteractive',
|
|
61
64
|
'-Command',
|
|
62
|
-
'Get-NetTCPConnection -LocalPort
|
|
65
|
+
'38000..38050 + @(10022) | ForEach-Object { Get-NetTCPConnection -LocalPort $_ -ErrorAction SilentlyContinue | Select-Object -ExpandProperty OwningProcess -Unique | Where-Object { $_ -gt 0 } | ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue } }; Get-Process -Name xkat-agent*, xkat* -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue'
|
|
63
66
|
], { stdio: 'inherit' });
|
|
64
67
|
} else {
|
|
65
|
-
spawnSync('sh', ['-c', 'fuser -k 10022/tcp 2>/dev/null || true; pgrep -f "xkat-agent" | xargs -r kill -9 2>/dev/null || true'], { stdio: 'inherit' });
|
|
68
|
+
spawnSync('sh', ['-c', 'fuser -k 38000-38050/tcp 2>/dev/null || true; fuser -k 10022/tcp 2>/dev/null || true; pgrep -f "xkat-agent" | xargs -r kill -9 2>/dev/null || true'], { stdio: 'inherit' });
|
|
66
69
|
}
|
|
67
|
-
console.log('✅
|
|
70
|
+
console.log('✅ Agent ports are now completely free.');
|
|
68
71
|
process.exit(0);
|
|
69
72
|
}
|
|
70
73
|
|
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* Runs automatically right after `npm install`. Downloads the prebuilt Rust
|
|
4
4
|
* binary matching the user's OS/architecture from GitHub Releases (or R2).
|
|
5
5
|
*/
|
|
6
|
+
process.removeAllListeners('warning');
|
|
7
|
+
process.emitWarning = () => {};
|
|
8
|
+
process.env.NODE_NO_WARNINGS = '1';
|
|
9
|
+
|
|
6
10
|
const os = require('os');
|
|
7
11
|
const fs = require('fs');
|
|
8
12
|
const path = require('path');
|
|
@@ -116,13 +120,15 @@ async function main() {
|
|
|
116
120
|
}
|
|
117
121
|
}
|
|
118
122
|
|
|
119
|
-
function downloadFile(
|
|
123
|
+
function downloadFile(urlStr, dest) {
|
|
120
124
|
return new Promise((resolve, reject) => {
|
|
121
125
|
const file = fs.createWriteStream(dest);
|
|
122
|
-
|
|
126
|
+
const parsedUrl = new URL(urlStr);
|
|
127
|
+
https.get(parsedUrl, (response) => {
|
|
123
128
|
// GitHub Releases use 302 redirects
|
|
124
129
|
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
125
|
-
|
|
130
|
+
const redirectUrl = new URL(response.headers.location, parsedUrl);
|
|
131
|
+
https.get(redirectUrl, (redirected) => {
|
|
126
132
|
redirected.pipe(file);
|
|
127
133
|
file.on('finish', () => { file.close(); resolve(); });
|
|
128
134
|
}).on('error', reject);
|