autopilot-code 0.0.10 → 0.0.12

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
@@ -138,31 +138,35 @@ function getSystemdPaths() {
138
138
  const logPath = node_path_1.default.join(GLOBAL_CONFIG_DIR, "autopilot.log");
139
139
  return { unitPath, logPath, useSystem };
140
140
  }
141
- function generateSystemdUnit(logPath, intervalSeconds) {
142
- const execPath = process.execPath;
141
+ function generateSystemdUnit(logPath, intervalSeconds, useSystem) {
142
+ const nodePath = process.execPath;
143
+ const scriptPath = node_path_1.default.resolve(process.argv[1]);
143
144
  const args = [
145
+ scriptPath,
144
146
  "service",
145
147
  "--foreground",
146
148
  "--interval-seconds", intervalSeconds,
147
149
  ];
148
150
  const user = process.env.USER || "root";
151
+ const home = process.env.HOME || "/root";
149
152
  return `[Unit]
150
153
  Description=Autopilot automated issue runner
151
154
  After=network.target
152
155
 
153
156
  [Service]
154
157
  Type=simple
155
- ExecStart=${execPath} ${args.join(" ")}
158
+ WorkingDirectory=${home}
159
+ ExecStart=${nodePath} ${args.join(" ")}
156
160
  Restart=always
157
161
  RestartSec=10
158
162
  StandardOutput=journal
159
163
  StandardError=journal
160
164
  SyslogIdentifier=autopilot
161
- ${isRoot() ? `User=${user}` : ""}
165
+ ${useSystem ? `User=${user}` : ""}
162
166
  Environment="NODE_ENV=production"
163
167
 
164
168
  [Install]
165
- WantedBy=multi-user.target
169
+ WantedBy=${useSystem ? "multi-user.target" : "default.target"}
166
170
  `;
167
171
  }
168
172
  function systemctl(cmd, args, check = false) {
@@ -195,7 +199,7 @@ function installSystemdService() {
195
199
  if (!(0, node_fs_1.existsSync)(unitDir)) {
196
200
  (0, node_fs_1.mkdirSync)(unitDir, { recursive: true });
197
201
  }
198
- const unitContent = generateSystemdUnit(logPath, intervalSeconds);
202
+ const unitContent = generateSystemdUnit(logPath, intervalSeconds, useSystem);
199
203
  (0, node_fs_1.writeFileSync)(unitPath, unitContent, { mode: 0o644 });
200
204
  console.log(`Systemd unit file created at: ${unitPath}`);
201
205
  const daemonReloadArgs = useSystem ? [] : ["--user"];
@@ -205,7 +209,7 @@ function installSystemdService() {
205
209
  if (!systemctl("enable", ["autopilot.service", ...daemonReloadArgs])) {
206
210
  process.exit(1);
207
211
  }
208
- if (!systemctl("start", ["autopilot.service", ...daemonReloadArgs])) {
212
+ if (!systemctl("restart", ["autopilot.service", ...daemonReloadArgs])) {
209
213
  process.exit(1);
210
214
  }
211
215
  console.log("✅ Autopilot service installed, enabled and started.");
@@ -398,7 +402,7 @@ program
398
402
  console.log("No source folders configured. Run 'autopilot init' to add some.");
399
403
  return;
400
404
  }
401
- const args = [runnerPath, "--root", ...rootPaths];
405
+ const args = ["-u", runnerPath, "--root", ...rootPaths];
402
406
  if (opts.maxDepth)
403
407
  args.push("--max-depth", opts.maxDepth);
404
408
  if (opts.minPriority)
@@ -430,7 +434,7 @@ program
430
434
  console.log("No source folders configured. Run 'autopilot init' to add some.");
431
435
  return;
432
436
  }
433
- const args = [runnerPath, "--root", ...rootPaths];
437
+ const args = ["-u", runnerPath, "--root", ...rootPaths];
434
438
  if (opts.maxDepth)
435
439
  args.push("--max-depth", opts.maxDepth);
436
440
  if (opts.minPriority)
@@ -463,7 +467,7 @@ program
463
467
  console.log("No source folders configured. Run 'autopilot init' to add some.");
464
468
  return;
465
469
  }
466
- const args = [runnerPath, "--root", ...rootPaths];
470
+ const args = ["-u", runnerPath, "--root", ...rootPaths];
467
471
  if (opts.maxDepth)
468
472
  args.push("--max-depth", opts.maxDepth);
469
473
  if (opts.minPriority)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autopilot-code",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "private": false,
5
5
  "description": "Repo-issue–driven autopilot runner",
6
6
  "license": "MIT",
@@ -100,10 +100,8 @@ def load_config(repo_root: Path) -> RepoConfig | None:
100
100
  allowed_merge_users = list(data.get("allowedMergeUsers", []))
101
101
 
102
102
  if auto_merge and not allowed_merge_users:
103
- raise RuntimeError(
104
- "autoMerge is enabled but allowedMergeUsers list is empty or missing. "
105
- "Please specify at least one allowed GitHub username."
106
- )
103
+ print(f"Warning: [{data.get('repo', 'unknown')}] autoMerge is enabled but allowedMergeUsers is empty. Disabling autoMerge for this repo.")
104
+ auto_merge = False
107
105
 
108
106
  auto_resolve_conflicts = data.get("autoResolveConflicts", True)
109
107
  conflict_resolution_max_attempts = int(data.get("conflictResolutionMaxAttempts", 3))
@@ -152,9 +150,12 @@ def _discover_repos_recursive(
152
150
  if (current_dir / ".git").exists() and (
153
151
  current_dir / ".autopilot" / "autopilot.json"
154
152
  ).exists():
155
- cfg = load_config(current_dir)
156
- if cfg:
157
- out.append(cfg)
153
+ try:
154
+ cfg = load_config(current_dir)
155
+ if cfg:
156
+ out.append(cfg)
157
+ except Exception as e:
158
+ print(f"Error loading config in {current_dir}: {e}")
158
159
  return
159
160
 
160
161
  # Recursively search subdirectories (depth-first)
@@ -356,6 +357,7 @@ def run_cycle(
356
357
  claimed_count = 0
357
358
 
358
359
  for cfg in all_configs:
360
+ print(f"[{cfg.repo}] Scanning for issues...")
359
361
  # 1) First, check any in-progress issues and mark blocked if stale.
360
362
  inprog = list_in_progress_issues(cfg)
361
363
  for it in inprog: