tesseract-agent 0.1.3 → 0.1.5
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-bundle/cli.js +11 -3
- package/package.json +1 -1
package/dist-bundle/cli.js
CHANGED
|
@@ -7619,7 +7619,9 @@ function ask(question) {
|
|
|
7619
7619
|
});
|
|
7620
7620
|
}
|
|
7621
7621
|
async function fetchJson(url, init) {
|
|
7622
|
-
const
|
|
7622
|
+
const hasBody = init?.body != null;
|
|
7623
|
+
const headers = { ...hasBody ? { "Content-Type": "application/json" } : {}, ...init?.headers ?? {} };
|
|
7624
|
+
const r = await fetch(url, { ...init, headers });
|
|
7623
7625
|
const data = await r.json().catch(() => ({}));
|
|
7624
7626
|
if (!r.ok) throw new Error(data.message || `Request failed (${r.status})`);
|
|
7625
7627
|
return data;
|
|
@@ -7769,9 +7771,15 @@ WantedBy=${o.system ? "multi-user.target" : "default.target"}
|
|
|
7769
7771
|
}
|
|
7770
7772
|
function run(cmd, args) {
|
|
7771
7773
|
const r = spawnSync(cmd, args, { stdio: "inherit" });
|
|
7772
|
-
if (r.
|
|
7774
|
+
if (r.error) throw r.error;
|
|
7775
|
+
if (r.status !== 0) throw new Error(`\`${cmd} ${args.join(" ")}\` exited ${r.status}`);
|
|
7773
7776
|
}
|
|
7774
7777
|
function install(o) {
|
|
7778
|
+
if (!o.system && typeof process.getuid === "function" && process.getuid() === 0) {
|
|
7779
|
+
throw new Error(
|
|
7780
|
+
"Run `tesseract-agent install` as your normal user (no sudo) \u2014 it installs a per-user systemd service.\nFor a root-managed system service instead, use `sudo tesseract-agent install --system`."
|
|
7781
|
+
);
|
|
7782
|
+
}
|
|
7775
7783
|
const p = unitPath(o.system);
|
|
7776
7784
|
mkdirSync3(dirname5(p), { recursive: true });
|
|
7777
7785
|
writeFileSync3(p, buildUnit(o));
|
|
@@ -7822,7 +7830,7 @@ function logs(system, follow) {
|
|
|
7822
7830
|
}
|
|
7823
7831
|
|
|
7824
7832
|
// src/cli.ts
|
|
7825
|
-
var CLI_VERSION = process.env.CCB_DAEMON_VERSION ?? "0.1.
|
|
7833
|
+
var CLI_VERSION = process.env.CCB_DAEMON_VERSION ?? "0.1.5";
|
|
7826
7834
|
function parseFlags(argv) {
|
|
7827
7835
|
const out = {};
|
|
7828
7836
|
for (let i = 0; i < argv.length; i++) {
|