autopilot-code 0.0.8 → 0.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autopilot-code",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "private": false,
5
5
  "description": "Repo-issue–driven autopilot runner",
6
6
  "license": "MIT",
@@ -12,12 +12,14 @@
12
12
  "dist/",
13
13
  "scripts/",
14
14
  "templates/",
15
- ".autopilot/"
15
+ ".autopilot/",
16
+ "scripts/postinstall.js"
16
17
  ],
17
18
  "scripts": {
18
19
  "build": "tsc -p tsconfig.json",
19
20
  "lint": "node -e \"console.log('lint: (not configured)')\"",
20
21
  "test": "node -e \"console.log('test: (not configured)')\"",
22
+ "postinstall": "node scripts/postinstall.js",
21
23
  "release": "changeset publish",
22
24
  "version-packages": "changeset version"
23
25
  },
@@ -0,0 +1,33 @@
1
+ const { spawnSync } = require('node:child_process');
2
+ const path = require('node:path');
3
+ const fs = require('node:fs');
4
+
5
+ // Only run on Linux
6
+ if (process.platform !== 'linux') {
7
+ process.exit(0);
8
+ }
9
+
10
+ // Skip if in CI environment
11
+ if (process.env.CI || process.env.GITHUB_ACTIONS) {
12
+ console.log('Autopilot: skipping auto-install (CI detected).');
13
+ process.exit(0);
14
+ }
15
+
16
+ const cliPath = path.join(__dirname, '..', 'dist', 'cli.js');
17
+
18
+ if (!fs.existsSync(cliPath)) {
19
+ console.log('Autopilot: skipping auto-install (cli.js not found).');
20
+ process.exit(0);
21
+ }
22
+
23
+ console.log('Autopilot: attempting to auto-install systemd service...');
24
+
25
+ // We try to install as a user service first (safer for postinstall)
26
+ // If they are root, the CLI logic handles system-wide install.
27
+ const res = spawnSync(process.execPath, [cliPath, 'install'], {
28
+ stdio: 'inherit'
29
+ });
30
+
31
+ if (res.status !== 0) {
32
+ console.log('Autopilot: auto-install skipped or failed (might need manual "autopilot install").');
33
+ }