autopilot-code 0.0.13 → 0.0.14
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 +10 -1
- package/package.json +1 -1
- package/scripts/postinstall.js +2 -0
package/dist/cli.js
CHANGED
|
@@ -140,7 +140,16 @@ function getSystemdPaths() {
|
|
|
140
140
|
}
|
|
141
141
|
function generateSystemdUnit(logPath, intervalSeconds, useSystem) {
|
|
142
142
|
const nodePath = process.execPath;
|
|
143
|
-
|
|
143
|
+
// Prefer the global bin symlink (e.g., ~/.nvm/.../bin/autopilot) over the direct script path
|
|
144
|
+
// This ensures global npm installs point to the symlink, not the internal package path
|
|
145
|
+
let scriptPath = node_path_1.default.resolve(process.argv[1]);
|
|
146
|
+
// Check if we're installed globally - look for the autopilot symlink in the bin directory
|
|
147
|
+
const binDir = node_path_1.default.dirname(nodePath);
|
|
148
|
+
const autopilotBin = node_path_1.default.join(binDir, 'autopilot');
|
|
149
|
+
if ((0, node_fs_1.existsSync)(autopilotBin)) {
|
|
150
|
+
// Use the symlink if it exists (global install)
|
|
151
|
+
scriptPath = autopilotBin;
|
|
152
|
+
}
|
|
144
153
|
const args = [
|
|
145
154
|
scriptPath,
|
|
146
155
|
"service",
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -30,4 +30,6 @@ const res = spawnSync(process.execPath, [cliPath, 'install'], {
|
|
|
30
30
|
|
|
31
31
|
if (res.status !== 0) {
|
|
32
32
|
console.log('Autopilot: auto-install skipped or failed (might need manual "autopilot install").');
|
|
33
|
+
} else {
|
|
34
|
+
console.log('Autopilot: systemd service installed successfully via postinstall.');
|
|
33
35
|
}
|