aicp-tracker 1.0.5 → 1.0.7
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/setup.js +5 -33
- package/package.json +1 -1
package/bin/setup.js
CHANGED
|
@@ -13,40 +13,12 @@ if (isPostinstall) {
|
|
|
13
13
|
try { existing = require('../src/config').load(); } catch {}
|
|
14
14
|
if (existing?.apiKey && existing?.vcsUrl) process.exit(0);
|
|
15
15
|
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
const {
|
|
16
|
+
// spawnSync with stdio:'inherit' passes the real terminal descriptors to the child,
|
|
17
|
+
// giving enquirer a proper TTY without opening a separate window.
|
|
18
|
+
const { spawnSync } = require('child_process');
|
|
19
19
|
const wizardPath = path.resolve(__dirname, 'aicp-tracker.js');
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
if (process.platform === 'win32') {
|
|
24
|
-
// cmd /k keeps the window open after the wizard finishes so the user can read output
|
|
25
|
-
spawn('cmd.exe', ['/c', 'start', 'cmd', '/k', `"${nodePath}" "${wizardPath}" setup`], { stdio: 'ignore', detached: true }).unref();
|
|
26
|
-
} else if (process.platform === 'darwin') {
|
|
27
|
-
spawn('osascript', ['-e', `tell app "Terminal" to do script "${nodePath} '${wizardPath}' setup"`], { stdio: 'ignore', detached: true }).unref();
|
|
28
|
-
} else {
|
|
29
|
-
// Try common Linux terminal emulators in order
|
|
30
|
-
const terms = ['x-terminal-emulator', 'gnome-terminal', 'xterm', 'konsole'];
|
|
31
|
-
let launched = false;
|
|
32
|
-
for (const term of terms) {
|
|
33
|
-
try {
|
|
34
|
-
spawn(term, ['-e', `${nodePath} "${wizardPath}" setup`], { stdio: 'ignore', detached: true }).unref();
|
|
35
|
-
launched = true;
|
|
36
|
-
break;
|
|
37
|
-
} catch {}
|
|
38
|
-
}
|
|
39
|
-
if (!launched) {
|
|
40
|
-
console.log('\n\x1b[1m AI Code Pulse Tracker installed.\x1b[0m');
|
|
41
|
-
console.log(' Run \x1b[1maicp-tracker setup\x1b[0m to activate tracking.\n');
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
} catch {
|
|
45
|
-
console.log('\n\x1b[1m AI Code Pulse Tracker installed.\x1b[0m');
|
|
46
|
-
console.log(' Run \x1b[1maicp-tracker setup\x1b[0m to activate tracking.\n');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
process.exit(0);
|
|
20
|
+
const result = spawnSync(process.execPath, [wizardPath, 'setup'], { stdio: 'inherit' });
|
|
21
|
+
process.exit(result.status || 0);
|
|
50
22
|
}
|
|
51
23
|
|
|
52
24
|
// ── When called directly (aicp-tracker setup) ─────────────────────────────────
|