toyon 0.1.0 → 0.3.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/README.md +62 -39
- package/dist/bridge.js +1 -1
- package/dist/cli.js +255 -68
- package/dist/daemon.js +2404 -516
- package/dist/shell/assets/{Editor-Cn-KsoFr.js → Editor-Lle8R8mY.js} +148 -148
- package/dist/shell/assets/{XTerm-DSSGYyFZ.js → XTerm-DcWpV1FL.js} +13 -13
- package/dist/shell/assets/{cssMode-BU_otbjh.js → cssMode-Ck0mAapo.js} +1 -1
- package/dist/shell/assets/{freemarker2-C-NGmKSC.js → freemarker2-B5OkSZOW.js} +1 -1
- package/dist/shell/assets/{handlebars-BWvVdY_e.js → handlebars-C6vrFwYj.js} +1 -1
- package/dist/shell/assets/{html-CBO-8nU2.js → html-CE92cnIr.js} +1 -1
- package/dist/shell/assets/{htmlMode-Dwz6npQ-.js → htmlMode-CfM52A9Q.js} +1 -1
- package/dist/shell/assets/index-DOf1M9v5.js +233 -0
- package/dist/shell/assets/index-b4LMTPcs.css +1 -0
- package/dist/shell/assets/{javascript-__evPE7m.js → javascript-C7Q1bCJn.js} +1 -1
- package/dist/shell/assets/{jsonMode-DpbQTbP6.js → jsonMode-Cq43R9DW.js} +1 -1
- package/dist/shell/assets/{liquid-CgOzfjEh.js → liquid-CnxQAGJm.js} +1 -1
- package/dist/shell/assets/{lspLanguageFeatures-DM57zeAM.js → lspLanguageFeatures-BtjVqb14.js} +1 -1
- package/dist/shell/assets/{mdx-DxN7Bq5u.js → mdx-ycMLgnto.js} +1 -1
- package/dist/shell/assets/{python-C3rGYQJF.js → python-se_0lOPN.js} +1 -1
- package/dist/shell/assets/{razor-C5rkTP_6.js → razor-DjByizBq.js} +1 -1
- package/dist/shell/assets/{tsMode-DDCDv-RH.js → tsMode-D1mOZbLC.js} +1 -1
- package/dist/shell/assets/{typescript-CyHgeKIZ.js → typescript-B-dZdvXG.js} +1 -1
- package/dist/shell/assets/{workers-C7XbwGBM.js → workers-DXwGNRtC.js} +1 -1
- package/dist/shell/assets/{xml-Dmw92JAf.js → xml-CoqNFco9.js} +1 -1
- package/dist/shell/assets/{yaml-Bj_aHuSs.js → yaml-D5Qru8sI.js} +1 -1
- package/dist/shell/index.html +2 -2
- package/dist/shell/manifest.json +1 -1
- package/package.json +2 -2
- package/dist/shell/assets/index-B61fMQI2.css +0 -1
- package/dist/shell/assets/index-Mb4zTZaD.js +0 -230
package/dist/cli.js
CHANGED
|
@@ -3,75 +3,14 @@
|
|
|
3
3
|
|
|
4
4
|
// src/cli.ts
|
|
5
5
|
import { existsSync as existsSync10 } from "fs";
|
|
6
|
-
import { join as
|
|
7
|
-
// package.json
|
|
8
|
-
var package_default = {
|
|
9
|
-
name: "toyon",
|
|
10
|
-
version: "0.1.0",
|
|
11
|
-
description: "Checking an agent's work means running it. Toyon gives every chat its own copy of your web app, with a live preview.",
|
|
12
|
-
license: "MIT",
|
|
13
|
-
type: "module",
|
|
14
|
-
homepage: "https://toyon.dev",
|
|
15
|
-
repository: {
|
|
16
|
-
type: "git",
|
|
17
|
-
url: "git+https://github.com/toyon-dev/toyon.git"
|
|
18
|
-
},
|
|
19
|
-
bugs: "https://github.com/toyon-dev/toyon/issues",
|
|
20
|
-
keywords: [
|
|
21
|
-
"ai",
|
|
22
|
-
"agents",
|
|
23
|
-
"claude-code",
|
|
24
|
-
"codex",
|
|
25
|
-
"opencode",
|
|
26
|
-
"git",
|
|
27
|
-
"worktree",
|
|
28
|
-
"preview",
|
|
29
|
-
"dev-server"
|
|
30
|
-
],
|
|
31
|
-
bin: {
|
|
32
|
-
toyon: "bin/toyon.js"
|
|
33
|
-
},
|
|
34
|
-
files: [
|
|
35
|
-
"bin",
|
|
36
|
-
"dist",
|
|
37
|
-
"cloud"
|
|
38
|
-
],
|
|
39
|
-
engines: {
|
|
40
|
-
node: ">=18"
|
|
41
|
-
},
|
|
42
|
-
os: [
|
|
43
|
-
"darwin",
|
|
44
|
-
"linux"
|
|
45
|
-
],
|
|
46
|
-
scripts: {
|
|
47
|
-
prepublishOnly: "bun ../../scripts/pack.ts"
|
|
48
|
-
},
|
|
49
|
-
dependencies: {
|
|
50
|
-
bun: "1.4.2",
|
|
51
|
-
"bun-pty": "0.4.10"
|
|
52
|
-
},
|
|
53
|
-
devDependencies: {
|
|
54
|
-
"@toyon/shared": "workspace:*"
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
// src/app.ts
|
|
59
|
-
import { spawn as spawn2, spawnSync } from "child_process";
|
|
60
|
-
import { chmodSync, existsSync as existsSync3, mkdirSync as mkdirSync2, readdirSync, readFileSync as readFileSync2, rmSync, writeFileSync } from "fs";
|
|
61
|
-
import { homedir as homedir2 } from "os";
|
|
62
|
-
import { join as join3 } from "path";
|
|
63
|
-
|
|
64
|
-
// src/daemon.ts
|
|
65
|
-
import { spawn } from "child_process";
|
|
66
|
-
import { existsSync as existsSync2, mkdirSync, openSync, readFileSync } from "fs";
|
|
67
|
-
import { homedir } from "os";
|
|
68
|
-
import { join as join2 } from "path";
|
|
6
|
+
import { join as join8, resolve } from "path";
|
|
69
7
|
|
|
70
8
|
// ../shared/src/daemon.ts
|
|
71
9
|
var DAEMON_FILES = {
|
|
72
10
|
token: "token",
|
|
73
11
|
pid: "daemon.pid",
|
|
74
12
|
state: "state.json",
|
|
13
|
+
drafts: "drafts.json",
|
|
75
14
|
log: "daemon.log",
|
|
76
15
|
remote: "remote.json"
|
|
77
16
|
};
|
|
@@ -153,6 +92,114 @@ function bwrapBlockedAdvice(error, restricted) {
|
|
|
153
92
|
`);
|
|
154
93
|
}
|
|
155
94
|
|
|
95
|
+
// ../shared/src/update.ts
|
|
96
|
+
function installMethod(packageJson) {
|
|
97
|
+
if (!packageJson)
|
|
98
|
+
return "none";
|
|
99
|
+
const p = packageJson.replaceAll("\\", "/");
|
|
100
|
+
if (p.includes("/_npx/"))
|
|
101
|
+
return "npx";
|
|
102
|
+
if (p.includes("/.bun/install/global/"))
|
|
103
|
+
return "bun";
|
|
104
|
+
if (p.includes("/node_modules/toyon/"))
|
|
105
|
+
return "npm";
|
|
106
|
+
return "none";
|
|
107
|
+
}
|
|
108
|
+
function installCommand(method, version) {
|
|
109
|
+
if (method === "npm")
|
|
110
|
+
return ["npm", "install", "-g", `toyon@${version}`];
|
|
111
|
+
if (method === "bun")
|
|
112
|
+
return ["bun", "add", "-g", `toyon@${version}`];
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
function newer(a, b) {
|
|
116
|
+
const pa = parseVersion(a);
|
|
117
|
+
const pb = parseVersion(b);
|
|
118
|
+
if (!pa || !pb)
|
|
119
|
+
return false;
|
|
120
|
+
for (let i = 0;i < 3; i++) {
|
|
121
|
+
const x = pa.nums[i] ?? 0;
|
|
122
|
+
const y = pb.nums[i] ?? 0;
|
|
123
|
+
if (x !== y)
|
|
124
|
+
return x > y;
|
|
125
|
+
}
|
|
126
|
+
if (pa.pre === pb.pre)
|
|
127
|
+
return false;
|
|
128
|
+
if (pa.pre === null)
|
|
129
|
+
return true;
|
|
130
|
+
if (pb.pre === null)
|
|
131
|
+
return false;
|
|
132
|
+
return pa.pre > pb.pre;
|
|
133
|
+
}
|
|
134
|
+
function parseVersion(v) {
|
|
135
|
+
const m = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(v.trim());
|
|
136
|
+
if (!m)
|
|
137
|
+
return null;
|
|
138
|
+
return { nums: [Number(m[1]), Number(m[2]), Number(m[3])], pre: m[4] ?? null };
|
|
139
|
+
}
|
|
140
|
+
// package.json
|
|
141
|
+
var package_default = {
|
|
142
|
+
name: "toyon",
|
|
143
|
+
version: "0.3.0",
|
|
144
|
+
description: "Toyon is where coding agents work on your web app while you check each change by using it. Every chat gets its own running copy with a live preview.",
|
|
145
|
+
license: "MIT",
|
|
146
|
+
type: "module",
|
|
147
|
+
homepage: "https://toyon.dev",
|
|
148
|
+
repository: {
|
|
149
|
+
type: "git",
|
|
150
|
+
url: "git+https://github.com/toyon-dev/toyon.git"
|
|
151
|
+
},
|
|
152
|
+
bugs: "https://github.com/toyon-dev/toyon/issues",
|
|
153
|
+
keywords: [
|
|
154
|
+
"ai",
|
|
155
|
+
"agents",
|
|
156
|
+
"claude-code",
|
|
157
|
+
"codex",
|
|
158
|
+
"opencode",
|
|
159
|
+
"git",
|
|
160
|
+
"worktree",
|
|
161
|
+
"preview",
|
|
162
|
+
"dev-server"
|
|
163
|
+
],
|
|
164
|
+
bin: {
|
|
165
|
+
toyon: "bin/toyon.js"
|
|
166
|
+
},
|
|
167
|
+
files: [
|
|
168
|
+
"bin",
|
|
169
|
+
"dist",
|
|
170
|
+
"cloud"
|
|
171
|
+
],
|
|
172
|
+
engines: {
|
|
173
|
+
node: ">=18"
|
|
174
|
+
},
|
|
175
|
+
os: [
|
|
176
|
+
"darwin",
|
|
177
|
+
"linux"
|
|
178
|
+
],
|
|
179
|
+
scripts: {
|
|
180
|
+
prepublishOnly: "bun ../../scripts/pack.ts"
|
|
181
|
+
},
|
|
182
|
+
dependencies: {
|
|
183
|
+
bun: "1.4.2",
|
|
184
|
+
"bun-pty": "0.4.10"
|
|
185
|
+
},
|
|
186
|
+
devDependencies: {
|
|
187
|
+
"@toyon/shared": "workspace:*"
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
// src/app.ts
|
|
192
|
+
import { spawn as spawn2, spawnSync } from "child_process";
|
|
193
|
+
import { chmodSync, existsSync as existsSync3, mkdirSync as mkdirSync2, readdirSync, readFileSync as readFileSync2, rmSync, writeFileSync } from "fs";
|
|
194
|
+
import { homedir as homedir2 } from "os";
|
|
195
|
+
import { join as join3 } from "path";
|
|
196
|
+
|
|
197
|
+
// src/daemon.ts
|
|
198
|
+
import { spawn } from "child_process";
|
|
199
|
+
import { existsSync as existsSync2, mkdirSync, openSync, readFileSync } from "fs";
|
|
200
|
+
import { homedir } from "os";
|
|
201
|
+
import { join as join2 } from "path";
|
|
202
|
+
|
|
156
203
|
// src/layout.ts
|
|
157
204
|
import { existsSync } from "fs";
|
|
158
205
|
import { dirname, join } from "path";
|
|
@@ -404,7 +451,18 @@ exec /bin/bash "$(dirname "$0")/../Resources/launch.sh"
|
|
|
404
451
|
}
|
|
405
452
|
|
|
406
453
|
// src/args.ts
|
|
407
|
-
var VERBS = new Set([
|
|
454
|
+
var VERBS = new Set([
|
|
455
|
+
"stop",
|
|
456
|
+
"restart",
|
|
457
|
+
"update",
|
|
458
|
+
"doctor",
|
|
459
|
+
"logs",
|
|
460
|
+
"version",
|
|
461
|
+
"uninstall",
|
|
462
|
+
"remote",
|
|
463
|
+
"deploy",
|
|
464
|
+
"help"
|
|
465
|
+
]);
|
|
408
466
|
var DEFAULT_LOG_LINES = 100;
|
|
409
467
|
function parseArgs(argv) {
|
|
410
468
|
if (argv.includes("--help") || argv.includes("-h"))
|
|
@@ -415,6 +473,8 @@ function parseArgs(argv) {
|
|
|
415
473
|
if (first !== undefined && VERBS.has(first)) {
|
|
416
474
|
switch (first) {
|
|
417
475
|
case "stop":
|
|
476
|
+
case "restart":
|
|
477
|
+
case "update":
|
|
418
478
|
case "doctor":
|
|
419
479
|
case "version":
|
|
420
480
|
case "help":
|
|
@@ -543,6 +603,10 @@ usage
|
|
|
543
603
|
toyon [path] start the daemon if it is not running, register the repo at path
|
|
544
604
|
(default: the current directory) and open the shell
|
|
545
605
|
toyon stop stop the daemon and every dev server and agent it runs
|
|
606
|
+
toyon restart stop the daemon and start it again from what is installed now; every
|
|
607
|
+
shell reconnects on its own
|
|
608
|
+
toyon update install the newest Toyon the way this one was installed, then restart
|
|
609
|
+
the daemon onto it once no chat is mid-reply
|
|
546
610
|
toyon doctor check the daemon, the token, the shell build and the tools Toyon needs
|
|
547
611
|
toyon logs [-f] [-n N] print the daemon log; -f keeps following it, -n sets how many lines
|
|
548
612
|
toyon version print the CLI version, and the daemon's if one is running
|
|
@@ -571,6 +635,7 @@ options for toyon [path]
|
|
|
571
635
|
environment
|
|
572
636
|
TOYON_HOME where state lives (default ~/.toyon)
|
|
573
637
|
TOYON_PORT the daemon's port (default 4141)
|
|
638
|
+
TOYON_UPDATES off stops Toyon checking for and installing updates on this machine
|
|
574
639
|
`;
|
|
575
640
|
|
|
576
641
|
// src/deploy/fly.ts
|
|
@@ -974,7 +1039,12 @@ async function doctor() {
|
|
|
974
1039
|
lines.push(line(true, "running", `${running} of ${total} worktrees started; the rest start when opened`));
|
|
975
1040
|
}
|
|
976
1041
|
if (version !== package_default.version) {
|
|
977
|
-
lines.push(line(false, "version", `cli is ${package_default.version} and the daemon is ${version}; \`toyon
|
|
1042
|
+
lines.push(line(false, "version", `cli is ${package_default.version} and the daemon is ${version}; \`toyon restart\` brings them level`));
|
|
1043
|
+
}
|
|
1044
|
+
if (h.updates?.managed) {
|
|
1045
|
+
lines.push(line(true, "updates", "off for this machine (TOYON_UPDATES=off)"));
|
|
1046
|
+
} else if (h.updates?.unreachable) {
|
|
1047
|
+
lines.push(line(false, "updates", `npm could not get toyon from ${h.updates.unreachable}, so Toyon cannot update itself; if you may use the public registry, run npm install -g toyon --registry=https://registry.npmjs.org/`));
|
|
978
1048
|
}
|
|
979
1049
|
}
|
|
980
1050
|
const token = readToken();
|
|
@@ -1281,6 +1351,25 @@ async function stop() {
|
|
|
1281
1351
|
return 0;
|
|
1282
1352
|
}
|
|
1283
1353
|
|
|
1354
|
+
// src/restart.ts
|
|
1355
|
+
async function restart() {
|
|
1356
|
+
const before = await health();
|
|
1357
|
+
if (before) {
|
|
1358
|
+
const code = await stop();
|
|
1359
|
+
if (code !== 0)
|
|
1360
|
+
return code;
|
|
1361
|
+
} else {
|
|
1362
|
+
console.log("Toyon was not running");
|
|
1363
|
+
}
|
|
1364
|
+
if (!await startDaemon()) {
|
|
1365
|
+
console.error(`daemon failed to start; \`toyon logs\` shows why (${logFile})`);
|
|
1366
|
+
return 1;
|
|
1367
|
+
}
|
|
1368
|
+
const after = await health();
|
|
1369
|
+
console.log(`started Toyon${after?.pid !== undefined ? ` (pid ${after.pid})` : ""}`);
|
|
1370
|
+
return 0;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1284
1373
|
// src/uninstall.ts
|
|
1285
1374
|
import { existsSync as existsSync9, readFileSync as readFileSync7, rmSync as rmSync5 } from "fs";
|
|
1286
1375
|
import { homedir as homedir3 } from "os";
|
|
@@ -1351,11 +1440,97 @@ async function uninstall(opts) {
|
|
|
1351
1440
|
return 0;
|
|
1352
1441
|
}
|
|
1353
1442
|
|
|
1443
|
+
// src/update.ts
|
|
1444
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
1445
|
+
import { join as join7 } from "path";
|
|
1446
|
+
var WAIT_MS2 = 15000;
|
|
1447
|
+
async function update() {
|
|
1448
|
+
if (process.env.TOYON_UPDATES === "off") {
|
|
1449
|
+
console.error("updates are turned off for this machine (TOYON_UPDATES=off)");
|
|
1450
|
+
return 1;
|
|
1451
|
+
}
|
|
1452
|
+
const method = installMethod(packaged ? join7(here, "..", "package.json") : null);
|
|
1453
|
+
if (method === "none") {
|
|
1454
|
+
console.error("toyon update works on a global npm or bun install, and this Toyon is not one; update it the way it was installed");
|
|
1455
|
+
return 1;
|
|
1456
|
+
}
|
|
1457
|
+
const latest = latestVersion();
|
|
1458
|
+
if (latest === null) {
|
|
1459
|
+
console.error("could not ask npm for the newest Toyon; check that npm is on your PATH and its registry answers");
|
|
1460
|
+
return 1;
|
|
1461
|
+
}
|
|
1462
|
+
const behind = newer(latest, package_default.version);
|
|
1463
|
+
if (method === "npx") {
|
|
1464
|
+
console.log(behind ? `toyon ${latest} is out; npx runs the version you name, so run npx toyon@${latest}` : `toyon ${package_default.version} is the newest`);
|
|
1465
|
+
return 0;
|
|
1466
|
+
}
|
|
1467
|
+
if (behind) {
|
|
1468
|
+
const command = installCommand(method, latest) ?? [];
|
|
1469
|
+
const [cmd, ...args] = command;
|
|
1470
|
+
if (!cmd)
|
|
1471
|
+
return 1;
|
|
1472
|
+
console.log(`installing toyon ${latest}: ${command.join(" ")}`);
|
|
1473
|
+
const r = spawnSync2(cmd, args, { stdio: "inherit" });
|
|
1474
|
+
if (r.status !== 0) {
|
|
1475
|
+
console.error(`the install did not finish; run ${command.join(" ")} yourself to see why`);
|
|
1476
|
+
return r.status ?? 1;
|
|
1477
|
+
}
|
|
1478
|
+
} else {
|
|
1479
|
+
console.log(`toyon ${package_default.version} is the newest`);
|
|
1480
|
+
}
|
|
1481
|
+
return restartOnto(behind ? latest : package_default.version);
|
|
1482
|
+
}
|
|
1483
|
+
function latestVersion() {
|
|
1484
|
+
const r = spawnSync2("npm", ["view", "toyon", "version", "--json"], { encoding: "utf8" });
|
|
1485
|
+
if (r.status !== 0)
|
|
1486
|
+
return null;
|
|
1487
|
+
try {
|
|
1488
|
+
const v = JSON.parse(r.stdout);
|
|
1489
|
+
return typeof v === "string" ? v : null;
|
|
1490
|
+
} catch {
|
|
1491
|
+
return null;
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
async function restartOnto(version) {
|
|
1495
|
+
const h = await health();
|
|
1496
|
+
if (!h) {
|
|
1497
|
+
console.log(`Toyon is not running; \`toyon\` starts ${version}`);
|
|
1498
|
+
return 0;
|
|
1499
|
+
}
|
|
1500
|
+
if (h.version === version) {
|
|
1501
|
+
console.log(`the daemon is already ${version}`);
|
|
1502
|
+
return 0;
|
|
1503
|
+
}
|
|
1504
|
+
const token = readToken();
|
|
1505
|
+
if (!token) {
|
|
1506
|
+
console.error("the daemon token is missing, so the daemon cannot be asked to restart; `toyon restart` does it by hand");
|
|
1507
|
+
return 1;
|
|
1508
|
+
}
|
|
1509
|
+
const res = await fetch(`${base}/restart?token=${token}`, { method: "POST" }).catch(() => null);
|
|
1510
|
+
if (res && res.status === 409) {
|
|
1511
|
+
console.error(await res.text());
|
|
1512
|
+
return 1;
|
|
1513
|
+
}
|
|
1514
|
+
const deadline = Date.now() + WAIT_MS2;
|
|
1515
|
+
while (Date.now() < deadline) {
|
|
1516
|
+
await Bun.sleep(500);
|
|
1517
|
+
if ((await health())?.version === version) {
|
|
1518
|
+
console.log(`restarted Toyon on ${version}`);
|
|
1519
|
+
return 0;
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
console.log(`Toyon restarts on ${version} once the chat replying now finishes`);
|
|
1523
|
+
return 0;
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1354
1526
|
// src/cli.ts
|
|
1527
|
+
function behind(daemonVersion) {
|
|
1528
|
+
return daemonVersion === undefined || newer(package_default.version, daemonVersion);
|
|
1529
|
+
}
|
|
1355
1530
|
async function open(cmd) {
|
|
1356
1531
|
const explicit = cmd.path !== null;
|
|
1357
1532
|
const target = resolve(cmd.path ?? process.cwd());
|
|
1358
|
-
const register = explicit || existsSync10(
|
|
1533
|
+
const register = explicit || existsSync10(join8(target, ".git"));
|
|
1359
1534
|
if (process.platform === "linux") {
|
|
1360
1535
|
const missing = missingSandboxTools();
|
|
1361
1536
|
const blocked = missing.length === 0 ? bwrapStartError() : null;
|
|
@@ -1364,12 +1539,15 @@ async function open(cmd) {
|
|
|
1364
1539
|
else if (blocked)
|
|
1365
1540
|
console.log(bwrapBlockedAdvice(blocked, userNamespacesRestricted()));
|
|
1366
1541
|
}
|
|
1367
|
-
|
|
1542
|
+
const running = await health();
|
|
1543
|
+
if (!running) {
|
|
1368
1544
|
console.log("starting Toyon daemon\u2026");
|
|
1369
1545
|
if (!await startDaemon()) {
|
|
1370
1546
|
console.error(`daemon failed to start; \`toyon logs\` shows why (${logFile})`);
|
|
1371
1547
|
return 1;
|
|
1372
1548
|
}
|
|
1549
|
+
} else if (behind(running.version)) {
|
|
1550
|
+
console.log(`toyon: the running daemon is ${running.version ?? "older"}; \`toyon restart\` starts ${package_default.version}`);
|
|
1373
1551
|
}
|
|
1374
1552
|
const token = readToken();
|
|
1375
1553
|
if (!token) {
|
|
@@ -1420,11 +1598,20 @@ async function run(cmd) {
|
|
|
1420
1598
|
return 2;
|
|
1421
1599
|
case "version": {
|
|
1422
1600
|
const h = await health();
|
|
1423
|
-
|
|
1601
|
+
if (!h)
|
|
1602
|
+
console.log(`toyon ${package_default.version}`);
|
|
1603
|
+
else if (!behind(h.version))
|
|
1604
|
+
console.log(`toyon ${package_default.version} (daemon ${h.version} running)`);
|
|
1605
|
+
else
|
|
1606
|
+
console.log(`toyon ${package_default.version} (daemon ${h.version ?? "?"} running; \`toyon restart\` to update)`);
|
|
1424
1607
|
return 0;
|
|
1425
1608
|
}
|
|
1426
1609
|
case "stop":
|
|
1427
1610
|
return stop();
|
|
1611
|
+
case "restart":
|
|
1612
|
+
return restart();
|
|
1613
|
+
case "update":
|
|
1614
|
+
return update();
|
|
1428
1615
|
case "doctor":
|
|
1429
1616
|
return doctor();
|
|
1430
1617
|
case "logs":
|