@overaihq/cli 0.13.7 → 0.13.8

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
@@ -26948,9 +26948,9 @@ import { hostname } from "os";
26948
26948
  import { spawn } from "child_process";
26949
26949
  import { platform } from "os";
26950
26950
  var openBrowser = (url) => {
26951
- const [command, args] = platform() === "darwin" ? ["open", [url]] : platform() === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
26951
+ const [command2, args] = platform() === "darwin" ? ["open", [url]] : platform() === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
26952
26952
  try {
26953
- const child = spawn(command, args, { stdio: "ignore", detached: true });
26953
+ const child = spawn(command2, args, { stdio: "ignore", detached: true });
26954
26954
  child.on("error", () => {
26955
26955
  });
26956
26956
  child.unref();
@@ -27517,7 +27517,7 @@ var runAutomation = async (args) => {
27517
27517
  // src/workspace/validateElements.ts
27518
27518
  var findings = (parsed) => parsed.success ? [] : parsed.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`);
27519
27519
  var validateAutomationElements = async (elements) => {
27520
- const { automationNodesSchema } = await import("./types-M4YAYTNG.js");
27520
+ const { automationNodesSchema } = await import("./types-WI2WSJ3F.js");
27521
27521
  return findings(automationNodesSchema.safeParse(elements));
27522
27522
  };
27523
27523
  var validateWebPageConfig = async (config) => {
@@ -35633,8 +35633,8 @@ var runDiff = async (args, clone) => {
35633
35633
  };
35634
35634
 
35635
35635
  // src/commands/recursiveSync.ts
35636
- var runRecursiveSync = async (command, args) => {
35637
- if (command === "push" && args.includes("--deploy"))
35636
+ var runRecursiveSync = async (command2, args) => {
35637
+ if (command2 === "push" && args.includes("--deploy"))
35638
35638
  throw new Error("Recursive push saves versions only. Deploy from an individual workspace.");
35639
35639
  const origin = openClone();
35640
35640
  const local = /* @__PURE__ */ new Map([[origin.manifest.workspaceId, origin]]);
@@ -35690,7 +35690,7 @@ var runRecursiveSync = async (command, args) => {
35690
35690
  process.stdout.write(`
35691
35691
  Workspace ${label} (${entry.workspace.id})
35692
35692
  `);
35693
- if (clone == null && command !== "pull") {
35693
+ if (clone == null && command2 !== "pull") {
35694
35694
  process.stdout.write("New remote workspace \u2014 run `overai pull --recursive` to clone.\n");
35695
35695
  continue;
35696
35696
  }
@@ -35702,9 +35702,9 @@ Workspace ${label} (${entry.workspace.id})
35702
35702
  throw new Error("Destination already exists, possibly from an incomplete clone. Local files kept; move the folder aside before retrying.");
35703
35703
  await runClone([entry.workspace.id, entry.root], true);
35704
35704
  available.add(entry.workspace.id);
35705
- } else if (command === "status") await runStatus(clone);
35706
- else if (command === "diff") await runDiff(args, clone);
35707
- else if (command === "pull") await runPull(clone);
35705
+ } else if (command2 === "status") await runStatus(clone);
35706
+ else if (command2 === "diff") await runDiff(args, clone);
35707
+ else if (command2 === "pull") await runPull(clone);
35708
35708
  else await runPush(args, clone);
35709
35709
  completed += 1;
35710
35710
  } catch (error) {
@@ -35714,9 +35714,9 @@ Workspace ${label} (${entry.workspace.id})
35714
35714
  }
35715
35715
  }
35716
35716
  process.stdout.write(`
35717
- Recursive ${command}: ${String(completed)} workspace(s) completed, ${String(failures.length)} failed or skipped.
35717
+ Recursive ${command2}: ${String(completed)} workspace(s) completed, ${String(failures.length)} failed or skipped.
35718
35718
  `);
35719
- if (failures.length > 0) throw new Error(`Recursive ${command} incomplete. Successful work was kept; resolve the reported issues and retry.`);
35719
+ if (failures.length > 0) throw new Error(`Recursive ${command2} incomplete. Successful work was kept; resolve the reported issues and retry.`);
35720
35720
  };
35721
35721
 
35722
35722
  // src/commands/update.ts
@@ -35732,6 +35732,11 @@ var packageRootUrl = () => {
35732
35732
  }
35733
35733
  throw new Error("package.json not found relative to the CLI bundle");
35734
35734
  };
35735
+ var compareVersions = (a, b) => {
35736
+ const av = a.split(".").map(Number);
35737
+ const bv = b.split(".").map(Number);
35738
+ return av.map((n, i) => n - (bv[i] ?? 0)).find((d) => d !== 0) ?? 0;
35739
+ };
35735
35740
  var cliVersion = () => {
35736
35741
  const pkg = JSON.parse(
35737
35742
  readFileSync8(new URL("package.json", packageRootUrl()), "utf8")
@@ -35771,9 +35776,7 @@ var runUpdate = async () => {
35771
35776
  `);
35772
35777
  return;
35773
35778
  }
35774
- const cur = current.split(".").map(Number);
35775
- const lat = latest.split(".").map(Number);
35776
- const cmp = cur.map((n, i) => n - (lat[i] ?? 0)).find((d) => d !== 0) ?? 0;
35779
+ const cmp = compareVersions(current, latest);
35777
35780
  if (cmp > 0) {
35778
35781
  process.stdout.write(
35779
35782
  `overai ${current} is ahead of latest (${latest}) \u2014 likely a @next install; nothing to do.
@@ -36834,6 +36837,81 @@ var runWorkspace = async (args) => {
36834
36837
  process.exitCode = 1;
36835
36838
  };
36836
36839
 
36840
+ // src/updateCheck.ts
36841
+ import { request as httpsRequest } from "https";
36842
+ import { existsSync as existsSync6 } from "fs";
36843
+ import { fileURLToPath as fileURLToPath2 } from "url";
36844
+ var CHECK_TIMEOUT_MS = 2e3;
36845
+ var fetchLatestVersion = (signal) => {
36846
+ return new Promise((resolve4, reject2) => {
36847
+ const req = httpsRequest(
36848
+ `https://registry.npmjs.org/${encodeURIComponent(PACKAGE_NAME)}/latest`,
36849
+ { signal, timeout: CHECK_TIMEOUT_MS },
36850
+ (res) => {
36851
+ if (res.statusCode !== 200) {
36852
+ res.resume();
36853
+ reject2(new Error(`registry responded HTTP ${String(res.statusCode)}`));
36854
+ return;
36855
+ }
36856
+ const chunks = [];
36857
+ res.on("data", (chunk) => chunks.push(chunk));
36858
+ res.on("end", () => {
36859
+ try {
36860
+ resolve4(JSON.parse(Buffer.concat(chunks).toString()));
36861
+ } catch {
36862
+ reject2(new Error("registry returned a non-JSON body"));
36863
+ }
36864
+ });
36865
+ }
36866
+ );
36867
+ req.on("timeout", () => {
36868
+ req.destroy(new Error("connect timed out"));
36869
+ });
36870
+ req.on("error", reject2);
36871
+ req.end();
36872
+ });
36873
+ };
36874
+ var PRINT_GRACE_MS = 500;
36875
+ var updateNotice = (current, latest) => {
36876
+ if (compareVersions(current, latest) >= 0) return null;
36877
+ return `overai ${current} \u2192 ${latest} available \u2014 run "overai update"`;
36878
+ };
36879
+ var startUpdateCheck = () => {
36880
+ const controller = new AbortController();
36881
+ const promise = (async () => {
36882
+ try {
36883
+ if (existsSync6(new URL("src", packageRootUrl()))) return null;
36884
+ const path = fileURLToPath2(import.meta.url);
36885
+ if (path.includes("_npx") || path.includes("dlx-")) return null;
36886
+ const body = await fetchLatestVersion(controller.signal);
36887
+ const latest = typeof body.version === "string" ? body.version : null;
36888
+ if (latest == null) return null;
36889
+ return updateNotice(cliVersion(), latest);
36890
+ } catch {
36891
+ return null;
36892
+ }
36893
+ })();
36894
+ return {
36895
+ promise,
36896
+ cancel: () => {
36897
+ controller.abort();
36898
+ }
36899
+ };
36900
+ };
36901
+ var printUpdateNotice = async (check) => {
36902
+ if (check == null) return;
36903
+ const grace = new Promise((resolve4) => {
36904
+ const timer = setTimeout(() => {
36905
+ resolve4(null);
36906
+ }, PRINT_GRACE_MS);
36907
+ timer.unref();
36908
+ });
36909
+ const message = await Promise.race([check.promise, grace]);
36910
+ check.cancel();
36911
+ if (message != null) process.stderr.write(`${message}
36912
+ `);
36913
+ };
36914
+
36837
36915
  // src/index.ts
36838
36916
  var HELP = `overai \u2014 OverAI command-line interface
36839
36917
 
@@ -36965,24 +37043,35 @@ var ORG_AGNOSTIC_COMMANDS = /* @__PURE__ */ new Set([
36965
37043
  "--help",
36966
37044
  "-h"
36967
37045
  ]);
37046
+ var SKIP_UPDATE_CHECK = /* @__PURE__ */ new Set([
37047
+ void 0,
37048
+ "update",
37049
+ "upgrade",
37050
+ "version",
37051
+ "--version",
37052
+ "-v",
37053
+ "help",
37054
+ "--help",
37055
+ "-h"
37056
+ ]);
36968
37057
  var run = async () => {
36969
- const [command, ...rest] = process.argv.slice(2);
36970
- if (command != null && !ORG_AGNOSTIC_COMMANDS.has(command)) {
37058
+ const [command2, ...rest] = process.argv.slice(2);
37059
+ if (command2 != null && !ORG_AGNOSTIC_COMMANDS.has(command2)) {
36971
37060
  pinOrgFromClone();
36972
37061
  announceOrgScope();
36973
37062
  }
36974
37063
  if (rest.includes("--recursive")) {
36975
- if (command !== "status" && command !== "diff" && command !== "pull" && command !== "push")
37064
+ if (command2 !== "status" && command2 !== "diff" && command2 !== "pull" && command2 !== "push")
36976
37065
  throw new Error(
36977
37066
  "--recursive supports status, diff, pull, and save-only push. Deploy and restore remain single-workspace."
36978
37067
  );
36979
37068
  await runRecursiveSync(
36980
- command,
37069
+ command2,
36981
37070
  rest.filter((arg) => arg !== "--recursive")
36982
37071
  );
36983
37072
  return;
36984
37073
  }
36985
- switch (command) {
37074
+ switch (command2) {
36986
37075
  case "signin":
36987
37076
  case "login":
36988
37077
  await signIn();
@@ -37108,16 +37197,20 @@ var run = async () => {
37108
37197
  process.stdout.write(HELP);
37109
37198
  return;
37110
37199
  default:
37111
- process.stderr.write(`Unknown command: ${command}
37200
+ process.stderr.write(`Unknown command: ${command2}
37112
37201
 
37113
37202
  ${HELP}`);
37114
37203
  process.exitCode = 1;
37115
37204
  }
37116
37205
  };
37206
+ var [command] = process.argv.slice(2);
37207
+ var updateNotice2 = process.env.OVERAI_SKIP_UPDATE_CHECK === "1" || !process.stderr.isTTY || SKIP_UPDATE_CHECK.has(command) ? null : startUpdateCheck();
37117
37208
  run().catch((error) => {
37118
37209
  process.stderr.write(
37119
37210
  `${error instanceof Error ? error.message : String(error)}
37120
37211
  `
37121
37212
  );
37122
37213
  process.exitCode = 1;
37214
+ }).finally(() => {
37215
+ void printUpdateNotice(updateNotice2);
37123
37216
  });
@@ -30,6 +30,7 @@ var ServiceEnum = /* @__PURE__ */ ((ServiceEnum2) => {
30
30
  ServiceEnum2["DataFiles"] = "DATA_FILES";
31
31
  ServiceEnum2["DataStreams"] = "DATA_STREAMS";
32
32
  ServiceEnum2["Discord"] = "DISCORD";
33
+ ServiceEnum2["Docusign"] = "DOCUSIGN";
33
34
  ServiceEnum2["Dropbox"] = "DROPBOX";
34
35
  ServiceEnum2["Gmail"] = "GMAIL";
35
36
  ServiceEnum2["GoogleCalendar"] = "GOOGLE_CALENDAR";
@@ -151,6 +152,7 @@ var NodeEnum = /* @__PURE__ */ ((NodeEnum2) => {
151
152
  NodeEnum2["databricksRunSql"] = "DATABRICKS_RUN_SQL";
152
153
  NodeEnum2["databricksStartWarehouse"] = "DATABRICKS_START_WAREHOUSE";
153
154
  NodeEnum2["discordWebhookSendMessage"] = "DISCORD_WEBHOOK_SEND_MESSAGE";
155
+ NodeEnum2["docusignSendEnvelope"] = "DOCUSIGN_SEND_ENVELOPE";
154
156
  NodeEnum2["docxToHtml"] = "DOCX_TO_HTML";
155
157
  NodeEnum2["docxToMarkdown"] = "DOCX_TO_MARKDOWN";
156
158
  NodeEnum2["documentToHtml"] = "DOCUMENT_TO_HTML";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overaihq/cli",
3
- "version": "0.13.7",
3
+ "version": "0.13.8",
4
4
  "description": "Create, edit, deploy, and run OverAI workspace resources from the command line",
5
5
  "type": "module",
6
6
  "homepage": "https://overai.com",