overlord-cli 0.2607100901.0 → 0.2607121101.0

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/index.js CHANGED
@@ -7999,20 +7999,57 @@ function applyPollJitter(intervalMs, random = Math.random) {
7999
7999
  const spread = intervalMs * 0.1;
8000
8000
  return Math.round(intervalMs + (random() * 2 - 1) * spread);
8001
8001
  }
8002
+ function resolveOverlordAppInvocation({
8003
+ platform: platform2 = process.platform,
8004
+ homedir: homedir2 = os4.homedir(),
8005
+ exists = existsSync19
8006
+ } = {}) {
8007
+ if (platform2 !== "darwin") return null;
8008
+ const appDirs = [
8009
+ "/Applications/Overlord.app",
8010
+ path23.join(homedir2, "Applications", "Overlord.app")
8011
+ ];
8012
+ for (const appDir of appDirs) {
8013
+ const program = path23.join(appDir, "Contents", "MacOS", "Overlord");
8014
+ const script = path23.join(appDir, "Contents", "Resources", "cli", "bin", "ovld.mjs");
8015
+ if (exists(program) && exists(script)) {
8016
+ return { program, args: [script, "runner", "supervise"], runAsElectronNode: true };
8017
+ }
8018
+ }
8019
+ return null;
8020
+ }
8002
8021
  function resolveOvldInvocation(argv = process.argv, execPath = process.execPath) {
8003
8022
  const override = process.env.OVLD_RUNNER_EXEC?.trim();
8004
8023
  if (override) {
8005
8024
  return { program: override, args: ["runner", "supervise"] };
8006
8025
  }
8007
8026
  const scriptPath = argv[1] ? path23.resolve(argv[1]) : "";
8027
+ if (process.env.ELECTRON_RUN_AS_NODE) {
8028
+ return scriptPath ? { program: execPath, args: [scriptPath, "runner", "supervise"], runAsElectronNode: true } : { program: execPath, args: ["runner", "supervise"], runAsElectronNode: true };
8029
+ }
8030
+ const appInvocation = resolveOverlordAppInvocation();
8031
+ if (appInvocation) return appInvocation;
8008
8032
  if (scriptPath) {
8009
8033
  return { program: execPath, args: [scriptPath, "runner", "supervise"] };
8010
8034
  }
8011
8035
  return { program: execPath, args: ["runner", "supervise"] };
8012
8036
  }
8037
+ function describeServicePublisher({
8038
+ execProgram,
8039
+ platform: platform2 = process.platform
8040
+ }) {
8041
+ if (platform2 !== "darwin" || !execProgram) {
8042
+ return { publisher: "unknown", needsReinstallForOverlord: false };
8043
+ }
8044
+ if (execProgram.includes(".app/Contents/MacOS/")) {
8045
+ return { publisher: "overlord", needsReinstallForOverlord: false };
8046
+ }
8047
+ return { publisher: "node", needsReinstallForOverlord: true };
8048
+ }
8013
8049
  function buildRunnerServiceEnv({
8014
8050
  backendUrl,
8015
- overlordHome
8051
+ overlordHome,
8052
+ runAsElectronNode
8016
8053
  }) {
8017
8054
  const env = {
8018
8055
  OVERLORD_BACKEND_URL: backendUrl,
@@ -8022,6 +8059,7 @@ function buildRunnerServiceEnv({
8022
8059
  if (home) env.OVLD_HOME = path23.resolve(home);
8023
8060
  const token = process.env.OVERLORD_USER_TOKEN?.trim() || process.env.OVLD_USER_TOKEN?.trim();
8024
8061
  if (token) env.OVERLORD_USER_TOKEN = token;
8062
+ if (runAsElectronNode || process.env.ELECTRON_RUN_AS_NODE) env.ELECTRON_RUN_AS_NODE = "1";
8025
8063
  return env;
8026
8064
  }
8027
8065
  function xmlEscape(value) {
@@ -9028,6 +9066,23 @@ async function runManagementCommand({
9028
9066
  else console.log(`Linked ${directory} to project ${projectId}`);
9029
9067
  return;
9030
9068
  }
9069
+ case "add-url": {
9070
+ const sourceUrl = flagValue(parsed.flags, "--url");
9071
+ if (!sourceUrl) throw new CliError({ message: "Missing --url <git-url>" });
9072
+ const projectId = flagValue(parsed.flags, "--project-id");
9073
+ if (!projectId) throw new CliError({ message: "Missing --project-id for URL resources." });
9074
+ const resource = await runtime.backend.post({
9075
+ path: `/api/projects/${encodeURIComponent(projectId)}/resources`,
9076
+ body: {
9077
+ sourceUrl,
9078
+ resourceKey: flagValue(parsed.flags, "--key"),
9079
+ isPrimary: flagValue(parsed.flags, "--primary") !== "false"
9080
+ }
9081
+ });
9082
+ if (json) printJson({ resource });
9083
+ else console.log(`Linked ${sourceUrl} to project ${projectId}`);
9084
+ return;
9085
+ }
9031
9086
  case "create":
9032
9087
  case "prompt": {
9033
9088
  const objectivesJson = flagValue(parsed.flags, "--objectives-json");
@@ -9438,6 +9493,10 @@ async function runRunnerServiceCommand({
9438
9493
  if (action === "status") {
9439
9494
  const runState = await manager.status();
9440
9495
  const state = readRunnerServiceState();
9496
+ const { publisher, needsReinstallForOverlord } = describeServicePublisher({
9497
+ execProgram: state.execProgram
9498
+ });
9499
+ const reinstallHint = runState.installed && needsReinstallForOverlord ? 'This service is registered under "Node.js Foundation" because it runs the plain node binary. Reinstall it from the Overlord desktop app (or with the desktop app present) to re-register it under "Overlord".' : null;
9441
9500
  const payload = {
9442
9501
  supported: true,
9443
9502
  kind: manager.kind,
@@ -9451,7 +9510,9 @@ async function runRunnerServiceCommand({
9451
9510
  lastClaimedAt: state.lastClaimedAt,
9452
9511
  lastLaunchedAt: state.lastLaunchedAt,
9453
9512
  lastError: state.lastError,
9454
- currentPollIntervalMs: state.currentPollIntervalMs
9513
+ currentPollIntervalMs: state.currentPollIntervalMs,
9514
+ publisher,
9515
+ reinstallHint
9455
9516
  };
9456
9517
  if (json) printJson(payload);
9457
9518
  else {
@@ -9459,12 +9520,15 @@ async function runRunnerServiceCommand({
9459
9520
  Service: `${manager.kind} (${manager.identifier})`,
9460
9521
  Installed: runState.installed ? "yes" : "no",
9461
9522
  Running: runState.running,
9523
+ Publisher: publisher === "unknown" ? "(unknown)" : publisher,
9462
9524
  Backend: state.backendUrl ?? "(unknown)",
9463
9525
  "Last heartbeat": state.lastHeartbeatAt ?? "(never)",
9464
9526
  "Last launched": state.lastLaunchedAt ?? "(never)",
9465
9527
  "Poll interval": state.currentPollIntervalMs ? `${state.currentPollIntervalMs}ms` : "(idle)",
9466
9528
  "Last error": state.lastError ?? "(none)"
9467
9529
  });
9530
+ if (reinstallHint) console.log(`
9531
+ Note: ${reinstallHint}`);
9468
9532
  }
9469
9533
  return;
9470
9534
  }
@@ -9472,7 +9536,10 @@ async function runRunnerServiceCommand({
9472
9536
  const config = loadConfig();
9473
9537
  const backendUrl = resolveBackendUrl(config);
9474
9538
  const invocation = resolveOvldInvocation();
9475
- const env = buildRunnerServiceEnv({ backendUrl });
9539
+ const env = buildRunnerServiceEnv({
9540
+ backendUrl,
9541
+ runAsElectronNode: invocation.runAsElectronNode
9542
+ });
9476
9543
  const autoStart = !flagBoolean(parsed.flags, "--no-start");
9477
9544
  await manager.install({ invocation, env, autoStart });
9478
9545
  writeRunnerServiceState({
@@ -9616,6 +9683,7 @@ Projects:
9616
9683
  ${primaryCommand} create-project --name "<name>" [--directory <path>|--no-directory]
9617
9684
  ${primaryCommand} add-cwd [--directory <path>] [--project-id <id>] [--key <resourceKey>] [--primary true|false]
9618
9685
  (prompts to pick a project when --project-id is omitted)
9686
+ ${primaryCommand} add-url --url <git-url> --project-id <id> [--key <resourceKey>] [--primary true|false]
9619
9687
 
9620
9688
  Missions:
9621
9689
  ${primaryCommand} create "<objective>" [--objectives-json '[...]'] [--json]
@@ -9685,6 +9753,7 @@ var KNOWN_COMMANDS = /* @__PURE__ */ new Set([
9685
9753
  "create-project",
9686
9754
  "org-setup",
9687
9755
  "add-cwd",
9756
+ "add-url",
9688
9757
  "create",
9689
9758
  "prompt",
9690
9759
  "attach",