autopilot-code 0.0.8 → 0.0.10

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 CHANGED
@@ -273,6 +273,15 @@ function statusSystemdService() {
273
273
  const { spawnSync } = require("node:child_process");
274
274
  spawnSync("systemctl", ["status", "autopilot.service", ...daemonReloadArgs], { stdio: "inherit" });
275
275
  }
276
+ function logsSystemdService() {
277
+ const { useSystem } = getSystemdPaths();
278
+ const args = ["-u", "autopilot", "-f"];
279
+ if (!useSystem) {
280
+ args.unshift("--user");
281
+ }
282
+ console.log(`Streaming logs from ${useSystem ? "system" : "user"} service (Ctrl+C to stop)...\n`);
283
+ (0, node_child_process_1.spawnSync)("journalctl", args, { stdio: "inherit" });
284
+ }
276
285
  async function initCommand() {
277
286
  const cwd = process.cwd();
278
287
  const validation = validatePath(cwd);
@@ -505,4 +514,10 @@ program
505
514
  .action(() => {
506
515
  statusSystemdService();
507
516
  });
517
+ program
518
+ .command("logs")
519
+ .description("Stream live logs from the autopilot systemd service")
520
+ .action(() => {
521
+ logsSystemdService();
522
+ });
508
523
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autopilot-code",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
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
+ }