@crievo/omni 0.1.5 → 0.1.6

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/tools/runner.mjs CHANGED
@@ -10,8 +10,9 @@
10
10
  pairs this Mac: shows a code, opens the approval page, waits
11
11
  node tools/runner.mjs status [--json] paired? which Mac? connected now? the service on?
12
12
  node tools/runner.mjs logout deletes this Mac's key in the cloud and here
13
- node tools/runner.mjs service install the studio as a macOS service: starts at login, restarts if it
14
- stops, no terminal (log in .runner/studio.log)
13
+ node tools/runner.mjs service install the studio as a service (launchd on macOS, a scheduled task on
14
+ Windows): starts at login, restarts if it stops, no terminal
15
+ (log in .runner/studio.log)
15
16
  node tools/runner.mjs service uninstall | restart | status
16
17
 
17
18
  Pairing is the device authorization flow (RFC 8628) of the studio's Better Auth: the code lasts
@@ -20,8 +21,8 @@
20
21
  ============================================================================ */
21
22
 
22
23
  import { hostname } from "node:os";
23
- import { spawn } from "node:child_process";
24
24
  import { finishPairing, startPairing } from "./lib/pairing.mjs";
25
+ import { openUrl } from "./lib/platform.mjs";
25
26
  import { cloudSettings, env, runnerStatus, writeEnv } from "./platforms.mjs";
26
27
  import { service, serviceInstall, serviceRestart, serviceUninstall } from "./lib/service.mjs";
27
28
 
@@ -61,8 +62,7 @@ async function login() {
61
62
  console.log(`Código do pareamento: ${code.user_code}`);
62
63
  console.log(`Aprove em: ${code.verification_uri_complete}`);
63
64
  console.log(`(vale ${Math.round(code.expires_in / 60)} min; confira se o código na página é o mesmo)`);
64
- if (!args.includes("--no-open") && process.platform === "darwin")
65
- spawn("open", [code.verification_uri_complete], { stdio: "ignore", detached: true }).unref();
65
+ if (!args.includes("--no-open")) openUrl(code.verification_uri_complete);
66
66
  const paired = await finishPairing(url, code, name).catch(e =>
67
67
  fail(`${e.message}; rode de novo node tools/runner.mjs login`),
68
68
  );
@@ -75,7 +75,7 @@ async function login() {
75
75
  );
76
76
  }
77
77
 
78
- /* --- the service: the studio kept on by launchd (tools/lib/service.mjs) ------------------ */
78
+ /* --- the service: the studio kept on by launchd or a scheduled task (tools/lib/service.mjs) ---- */
79
79
  function install() {
80
80
  try {
81
81
  serviceInstall({ log: line => console.log(line) });