@sealant/mend 0.36.0-next.761 → 0.36.0-next.771
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/{chunk-D4JBBLJV.js → chunk-NSHXPJLT.js} +4 -2
- package/dist/{dashboard-4BJL72T6.js → dashboard-HLZJXTKG.js} +1 -1
- package/dist/main.js +540 -284
- package/man/mend-accounts.1 +1 -1
- package/man/mend-adopt.1 +1 -1
- package/man/mend-attach.1 +1 -1
- package/man/mend-codex.1 +1 -1
- package/man/mend-completions.1 +1 -1
- package/man/mend-connect-pi.1 +1 -1
- package/man/mend-connect.1 +1 -1
- package/man/mend-continue.1 +1 -1
- package/man/mend-doctor.1 +2 -2
- package/man/mend-dotfiles-repo.1 +1 -1
- package/man/mend-dotfiles-sync.1 +1 -1
- package/man/mend-dotfiles.1 +1 -1
- package/man/mend-env-cluster.1 +1 -1
- package/man/mend-env-load.1 +1 -1
- package/man/mend-env-show.1 +1 -1
- package/man/mend-folder-create.1 +1 -1
- package/man/mend-folder-list.1 +1 -1
- package/man/mend-folder-push.1 +1 -1
- package/man/mend-folder-rm.1 +1 -1
- package/man/mend-git-author.1 +1 -1
- package/man/mend-help.1 +1 -1
- package/man/mend-invite.1 +1 -1
- package/man/mend-keys-init.1 +1 -1
- package/man/mend-keys-mode.1 +1 -1
- package/man/mend-keys-share.1 +1 -1
- package/man/mend-keys-show.1 +1 -1
- package/man/mend-land.1 +1 -1
- package/man/mend-login.1 +10 -2
- package/man/mend-logout.1 +1 -1
- package/man/mend-logs.1 +1 -1
- package/man/mend-man.1 +1 -1
- package/man/mend-members.1 +1 -1
- package/man/mend-memory-import.1 +1 -1
- package/man/mend-memory-rm.1 +1 -1
- package/man/mend-memory-show.1 +1 -1
- package/man/mend-memory.1 +1 -1
- package/man/mend-models.1 +1 -1
- package/man/mend-operator-exposure.1 +1 -1
- package/man/mend-operator-gate.1 +1 -1
- package/man/mend-operator-grant-owner.1 +1 -1
- package/man/mend-operator-org-create.1 +1 -1
- package/man/mend-operator-org-invite-owner.1 +1 -1
- package/man/mend-operator-org-list.1 +1 -1
- package/man/mend-operator-org-rename.1 +1 -1
- package/man/mend-operator-reset-link.1 +1 -1
- package/man/mend-pair.1 +1 -1
- package/man/mend-projects.1 +1 -1
- package/man/mend-pull.1 +1 -1
- package/man/mend-refresh.1 +1 -1
- package/man/mend-rejoin.1 +1 -1
- package/man/mend-resume.1 +1 -1
- package/man/mend-run.1 +1 -1
- package/man/mend-secrets-add.1 +1 -1
- package/man/mend-secrets-rm.1 +1 -1
- package/man/mend-secrets.1 +1 -1
- package/man/mend-server-logs.1 +1 -1
- package/man/mend-server-restart.1 +1 -1
- package/man/mend-server-setup.1 +3 -3
- package/man/mend-server-start.1 +1 -1
- package/man/mend-server-status.1 +1 -1
- package/man/mend-server-stop.1 +1 -1
- package/man/mend-server-upgrade.1 +1 -1
- package/man/mend-server.1 +1 -1
- package/man/mend-service-add.1 +1 -1
- package/man/mend-service-connect.1 +1 -1
- package/man/mend-service-init.1 +1 -1
- package/man/mend-service-list.1 +1 -1
- package/man/mend-service-logs.1 +1 -1
- package/man/mend-service-restart.1 +1 -1
- package/man/mend-service-run.1 +1 -1
- package/man/mend-service-stop.1 +1 -1
- package/man/mend-session-share.1 +1 -1
- package/man/mend-sessions.1 +1 -1
- package/man/mend-shell.1 +1 -1
- package/man/mend-skills-push.1 +1 -1
- package/man/mend-skills.1 +1 -1
- package/man/mend-snake.1 +1 -1
- package/man/mend-ssh-keys-remove.1 +1 -1
- package/man/mend-ssh-keys.1 +1 -1
- package/man/mend-ssh-setup.1 +1 -1
- package/man/mend-ssh.1 +1 -1
- package/man/mend-stop.1 +1 -1
- package/man/mend-ui.1 +1 -1
- package/man/mend-uninstall.1 +2 -2
- package/man/mend-version.1 +1 -1
- package/man/mend-wait.1 +1 -1
- package/man/mend-workspace-replace.1 +1 -1
- package/man/mend-worktrees-rm.1 +1 -1
- package/man/mend-worktrees.1 +1 -1
- package/man/mend.1 +1 -1
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -80,15 +80,15 @@ import {
|
|
|
80
80
|
workspaceRetirementLine,
|
|
81
81
|
worktreeJoinLine,
|
|
82
82
|
worktreeListsPeople
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-NSHXPJLT.js";
|
|
84
84
|
|
|
85
85
|
// src/main.ts
|
|
86
|
-
import { spawn as spawn3, spawnSync as
|
|
86
|
+
import { spawn as spawn3, spawnSync as spawnSync7 } from "node:child_process";
|
|
87
87
|
import * as crypto from "node:crypto";
|
|
88
88
|
import * as fs21 from "node:fs";
|
|
89
89
|
import { createRequire } from "node:module";
|
|
90
90
|
import * as net6 from "node:net";
|
|
91
|
-
import * as
|
|
91
|
+
import * as os13 from "node:os";
|
|
92
92
|
import * as path21 from "node:path";
|
|
93
93
|
|
|
94
94
|
// src/agent-memory.ts
|
|
@@ -164,7 +164,7 @@ var memoryDisplayName = (filePath) => {
|
|
|
164
164
|
if (named === null) return filePath;
|
|
165
165
|
return named.harness === "claude" ? named.name : `${named.harness}:${named.name}`;
|
|
166
166
|
};
|
|
167
|
-
var lost = (n,
|
|
167
|
+
var lost = (n, whose2) => `${n} of ${whose2} line${n === 1 ? " is" : "s are"} not in the result: its copy kept as a version`;
|
|
168
168
|
var ADDED_NAMED = 20;
|
|
169
169
|
var importReportLines = (report) => {
|
|
170
170
|
const lines = [];
|
|
@@ -2171,15 +2171,18 @@ var COMMANDS = [
|
|
|
2171
2171
|
name: "login",
|
|
2172
2172
|
section: "start",
|
|
2173
2173
|
summary: "sign this terminal in through the browser",
|
|
2174
|
-
synopsis: ["[--url <server>]"],
|
|
2174
|
+
synopsis: ["[--url <server>] [--open | --no-open]"],
|
|
2175
2175
|
description: [
|
|
2176
|
-
"Opens <server>/authorize in your browser. You press Authorize there. The CLI saves a device token to ~/.config/mend/cli.json with mode 0600. No password is typed in the terminal, and the token can be revoked from the server at any time."
|
|
2176
|
+
"Opens <server>/authorize in your browser. You press Authorize there. The CLI saves a device token to ~/.config/mend/cli.json with mode 0600. No password is typed in the terminal, and the token can be revoked from the server at any time.",
|
|
2177
|
+
"Over SSH, or on Linux with no display, no browser opens: the CLI prints the link and the code, and you open the link on your own machine."
|
|
2177
2178
|
],
|
|
2178
2179
|
options: [
|
|
2179
2180
|
{
|
|
2180
2181
|
flag: "--url <server>",
|
|
2181
2182
|
text: "the Mend server. Default: MEND_URL, then http://localhost:3105"
|
|
2182
|
-
}
|
|
2183
|
+
},
|
|
2184
|
+
{ flag: "--open", text: "open the browser here, even over SSH" },
|
|
2185
|
+
{ flag: "--no-open", text: "only print the link and the code" }
|
|
2183
2186
|
],
|
|
2184
2187
|
examples: [
|
|
2185
2188
|
{ command: "mend login --url http://10.0.0.216:3105", text: "sign in to a LAN server" }
|
|
@@ -2343,7 +2346,7 @@ var COMMANDS = [
|
|
|
2343
2346
|
summary: "check this machine's setup, or bundle it for a bug report",
|
|
2344
2347
|
synopsis: ["", "--bundle [--out <path>] [--tail <n>]"],
|
|
2345
2348
|
description: [
|
|
2346
|
-
"Read-only. One line per fact: the server, the sign-in, the platform connection, the provider accounts, the git key, and where docker is on PATH its daemon
|
|
2349
|
+
"Read-only. One line per fact: the server, the sign-in, the platform connection, the provider accounts, the git key, and where docker is on PATH what a stop of its daemon waits for against what systemd allows docker.service. Each unfinished line ends with the command that fixes it.",
|
|
2347
2350
|
"--bundle collects what a maintainer asks for one output at a time into one tar.gz: this CLI and its environment, the doctor lines, the server's health, the local server's configuration (its compose file and the names of its .env keys, never their values), docker version, info, contexts, the Mend and workspace containers with their inspect facts, the local server's container logs, the running workspace containers' logs, every session with its processes, exit codes and argv, the recorded terminal output of each, the connected accounts, and the versions and paths of claude, codex, gh, git and docker on this machine.",
|
|
2348
2351
|
"Each part is collected on its own: one that fails leaves a <name>.error.txt in the bundle instead of stopping it. One redactor runs over every file before it is written: bearer and header values, Slack, OpenAI, GitHub and AWS token shapes, JWTs, passwords in URLs, and any password, secret or token value. The archive is written with mode 0600. It still contains logs and configuration; read it before you share it."
|
|
2349
2352
|
],
|
|
@@ -3307,8 +3310,8 @@ var COMMANDS = [
|
|
|
3307
3310
|
"--t3-gateway turns on the t3code gateway (docs/adr/0012): t3code's desktop, mobile and web clients add it as an environment, pair with a code from mend pair, and see this Mend's projects and sessions. It runs in the Mend container, confined to a root and a uid of its own, on a listener of its own published on 127.0.0.1 only (port 3120, or --t3-gateway-port): reaching it from another machine is an exposure you put in front of it and declare. Setup refuses it on a Mend image that has no gateway, and says whether it answered. It is kept across reruns and upgrades; --no-t3-gateway turns it off, and its state stays in its own volume, mend-t3-gateway. Off, nothing of it runs.",
|
|
3308
3311
|
"--exposure declares how the instance is reached, and --tenancy whether one organization or many use it. Both are written into the generation and kept across reruns and upgrades. public needs the edge and an existing first account. With multi, or with public, the multi mode gate's settings follow: MEND_SOURCE_POLICY=tenant and MEND_CAPTURE_REQUIRE_SIZES=true, and public sets MEND_URL_BEARERS=refuse. The server still decides whether it starts, and mend server status shows what it reports.",
|
|
3309
3312
|
"Two mirrors run beside Mend unless turned off: an npm mirror (nginx caching npmjs.org, capped at 10g by default, least recently used out) and a Docker mirror (a pull-through cache of Docker Hub, capped at 20g by default: over the cap its cache is cleared). Both leave 5g free on their disk: below that, nginx evicts and the Docker mirror pauses, and sessions pull from Docker Hub directly. Neither publishes a host port. Sessions install npm packages and pull Docker Hub images through them; a project's own npm settings win, and a mirror that is down sends sessions upstream instead. Both are kept across reruns and upgrades, and an upgrade adds them to an install from before them. The Docker mirror pulls anonymously unless given a Docker Hub login: --docker-hub-username with the access token piped on standard input, kept in server.env only. The mirror has no login of its own, so every session that reaches it can pull whatever that token can read: setup takes a login only with --docker-hub-public-only, your statement that the token's access permission is Public Repo Read-only. Mend cannot check a token's scope.",
|
|
3310
|
-
"Before
|
|
3311
|
-
"When setup changes Mend's URL, a CLI signed in at the old one is left pointing there. Setup says so with the command each one runs (mend login --url <new>). When this machine's own CLI points at the old URL and that no longer answers, setup offers to point it at the new one; its sign-in carries over, since a device's token is not bound to a URL. When it points anywhere else this install does not answer (another server, or nothing), setup offers the same; a sign-in made at another server stays behind, and the offer leads with no while that server answers. A re-run says to create the first account only while the instance has none.",
|
|
3313
|
+
"Before its other questions and before it pulls the release, setup reads the Docker host's kernel, through the few megabytes of busybox every install needs anyway. Each workspace runs its own rootless Docker, which needs unprivileged user namespaces; Ubuntu 23.10 and later (24.04 LTS included) refuse them by default, and then no session can start. On a terminal setup asks to allow them: on a yes it writes the setting to /etc/sysctl.d/60-mend-rootless-docker.conf on the Docker host and applies it, through a short privileged container on the Docker socket it already uses, then reads the kernel again. That lifts the restriction for the whole host; the file says on its first lines that setup wrote it and what it replaced, so mend uninstall --all removes it and puts that back. On a no, or on a rootless daemon, it prints the command to run on the host, and repeats it as its last line. Without a terminal or with --yes, it says to re-run with --allow-userns, so that setup writes the file and mend uninstall can undo it; the command is the other way, and a file written by hand stays on uninstall. --allow-userns and --no-allow-userns answer for a script.",
|
|
3314
|
+
"When setup changes Mend's URL, a CLI signed in at the old one is left pointing there. Setup says so with the command each one runs (mend login --url <new>), which is a new sign-in: it asks for a browser authorization. When this machine's own CLI points at the old URL and that no longer answers, setup offers to point it at the new one; its sign-in carries over, since a device's token is not bound to a URL. When it points anywhere else this install does not answer (another server, or nothing), setup offers the same; a sign-in made at another server stays behind, and the offer leads with no while that server answers. A re-run says to create the first account only while the instance has none.",
|
|
3312
3315
|
"Docker Desktop on Linux and macOS, and OrbStack on macOS, expose client-side proxy sockets. Containers use the daemon-side /var/run/docker.sock. --docker-socket overrides detection and is retained on reruns.",
|
|
3313
3316
|
"Setup holds an exclusive process lock through startup and health checks. A busy lock reports its owner and manual recovery steps. Never remove a live lock. Private configuration uses immutable generations and an atomic active pointer; failed attempts retain credentials and never delete Docker volumes."
|
|
3314
3317
|
],
|
|
@@ -3638,7 +3641,7 @@ var COMMANDS = [
|
|
|
3638
3641
|
"Asks which scope to remove when none is given, prints exactly what will go, and requires the word delete before the server is touched; any other answer removes nothing and exits 1. Nothing is touched until Docker answers: with Docker stopped, the server and everything scopes refuse and change nothing, here or on the server.",
|
|
3639
3642
|
"The server scope removes the local Compose installation. First its sessions' workspaces, live ones included: the plan lists them, and uninstall stops them and removes them with their Docker services, volumes and networks. Then its containers, every volume and network it owns (repositories, worktrees, the database), its release image, and the private configuration with its generations and backups. A workspace is the installation's when it mounts the installation's control volume. The anchor volume mend-store and identity.env go last, once everything else has; anything Docker would not remove keeps them, is named, and is written to uninstall-left.json, so running mend uninstall again finishes the job, and mend server setup can reinstall over it. A sign-in to the server just removed is cleared: its token went with the server.",
|
|
3640
3643
|
"The home scope removes cli.json, the workspace SSH key file and the managed block in ~/.ssh/config. When the sign-in is to another server, that server is first asked to remove the workspace SSH key this machine registered and to revoke this terminal's device token; a key it refuses to remove, or one this machine cannot read, makes the uninstall exit 1 naming what may still be registered. The account's other keys and devices stay.",
|
|
3641
|
-
"Everything also offers what else Mend put on the Docker host: the images it pulled and built (the bundle's, the workspace images, the workspaces' Docker service and network guard), with the space they take, and the user-namespace sysctl file setup wrote, putting back the setting it replaced. A sysctl file written by hand stays, with the command that removes it. Docker's build cache is shared by every build on the daemon, so it gets its own question, and stays under --yes. The CLI itself stays: npm uninstall -g @sealant/mend removes it. The last line names whatever is still here.",
|
|
3644
|
+
"Everything also offers what else Mend put on the Docker host: the images it pulled and built (the bundle's, the workspace images, the workspaces' Docker service and network guard), with the space they take, and the user-namespace sysctl file setup wrote, putting back the setting it replaced. A sysctl file written by hand stays, with the command that removes it. Docker's build cache is shared by every build on the daemon, so it gets its own question, and stays under --yes. When the uninstall stops before these, it says each one was not reached, and the next run removes them. The CLI itself stays: npm uninstall -g @sealant/mend removes it. The last line names whatever is still here.",
|
|
3642
3645
|
"Nothing else under the configuration directory is touched; a host-run store or keys root is listed and left in place. With no configuration here, Docker volumes carrying Mend's installation label and no anchor are what an earlier install left: the server scope lists and removes them."
|
|
3643
3646
|
],
|
|
3644
3647
|
options: [
|
|
@@ -4110,153 +4113,115 @@ var doctorBundleCommand = async (args, deps) => {
|
|
|
4110
4113
|
};
|
|
4111
4114
|
|
|
4112
4115
|
// src/doctor.ts
|
|
4116
|
+
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
4113
4117
|
import * as fs9 from "node:fs";
|
|
4114
4118
|
import * as path9 from "node:path";
|
|
4115
4119
|
|
|
4116
4120
|
// src/docker-shutdown.ts
|
|
4117
4121
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
4118
4122
|
import * as fs8 from "node:fs";
|
|
4119
|
-
import * as os5 from "node:os";
|
|
4120
4123
|
import * as path8 from "node:path";
|
|
4121
|
-
var
|
|
4122
|
-
var
|
|
4123
|
-
var
|
|
4124
|
-
|
|
4125
|
-
const arg = argv[index] ?? "";
|
|
4126
|
-
if (arg.startsWith(`${name}=`)) return arg.slice(name.length + 1);
|
|
4127
|
-
if (arg === name) return argv[index + 1] ?? "";
|
|
4128
|
-
}
|
|
4129
|
-
return null;
|
|
4130
|
-
};
|
|
4131
|
-
var seconds = (value) => {
|
|
4132
|
-
if (typeof value === "number" && Number.isInteger(value) && value >= 0) return value;
|
|
4133
|
-
if (typeof value === "string" && /^\d+$/.test(value.trim())) return Number(value.trim());
|
|
4134
|
-
return null;
|
|
4135
|
-
};
|
|
4124
|
+
var WORKSPACE_STOP_TIMEOUT_SECONDS = 60;
|
|
4125
|
+
var DOCKER_DEFAULT_STOP_TIMEOUT_SECONDS = 10;
|
|
4126
|
+
var DOCKERD_SHUTDOWN_GRACE_SECONDS = 5;
|
|
4127
|
+
var SYSTEMD_DEFAULT_STOP_SECONDS = 90;
|
|
4136
4128
|
var daemonKindOf = (info) => {
|
|
4137
4129
|
if (/docker desktop/i.test(info.operatingSystem)) return "desktop";
|
|
4138
4130
|
if (/orbstack/i.test(info.operatingSystem)) return "orbstack";
|
|
4139
4131
|
if (info.securityOptions.some((option) => option.includes("name=rootless"))) return "rootless";
|
|
4140
4132
|
return "dockerd";
|
|
4141
4133
|
};
|
|
4142
|
-
var
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
);
|
|
4154
|
-
case "dockerd":
|
|
4155
|
-
return "/etc/docker/daemon.json";
|
|
4134
|
+
var stopLimitOf = (facts, daemon) => {
|
|
4135
|
+
if (daemon === "desktop" || daemon === "orbstack") {
|
|
4136
|
+
return { kind: "none", why: "no systemd unit runs this daemon" };
|
|
4137
|
+
}
|
|
4138
|
+
const unit = facts.unit;
|
|
4139
|
+
if (unit === null) return { kind: "none", why: "no systemd unit observed" };
|
|
4140
|
+
if (unit.activeState !== "active") {
|
|
4141
|
+
return { kind: "none", why: `${unit.name} is ${unit.activeState}` };
|
|
4142
|
+
}
|
|
4143
|
+
if (daemon === "dockerd" && facts.dockerdPid !== null && unit.mainPid !== facts.dockerdPid) {
|
|
4144
|
+
return { kind: "none", why: `${unit.name} is not the dockerd docker talks to` };
|
|
4156
4145
|
}
|
|
4146
|
+
return { kind: "observed", unit: unit.name, seconds: unit.timeoutStopSeconds };
|
|
4157
4147
|
};
|
|
4158
|
-
var
|
|
4148
|
+
var readDockerStop = (facts, expected = null) => {
|
|
4159
4149
|
if (facts.info === null) return { kind: "unknown", why: "docker info did not answer" };
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
return value === null ? { kind: "unknown", why: `dockerd --shutdown-timeout ${flag} unreadable` } : {
|
|
4171
|
-
kind: "observed",
|
|
4172
|
-
seconds: value,
|
|
4173
|
-
source: "dockerd --shutdown-timeout",
|
|
4174
|
-
daemon,
|
|
4175
|
-
configPath,
|
|
4176
|
-
fromFlag: true
|
|
4177
|
-
};
|
|
4178
|
-
}
|
|
4179
|
-
}
|
|
4180
|
-
const file = facts.readFile(configPath);
|
|
4181
|
-
if (file.kind === "unreadable") return { kind: "unknown", why: `${configPath} unreadable` };
|
|
4182
|
-
if (file.kind === "read") {
|
|
4183
|
-
let parsed;
|
|
4184
|
-
try {
|
|
4185
|
-
parsed = JSON.parse(file.text);
|
|
4186
|
-
} catch {
|
|
4187
|
-
return { kind: "unknown", why: `${configPath} is not JSON` };
|
|
4188
|
-
}
|
|
4189
|
-
const configured = typeof parsed === "object" && parsed !== null && "shutdown-timeout" in parsed ? parsed["shutdown-timeout"] : void 0;
|
|
4190
|
-
if (configured !== void 0) {
|
|
4191
|
-
const value = seconds(configured);
|
|
4192
|
-
return value === null ? { kind: "unknown", why: `shutdown-timeout in ${configPath} unreadable` } : {
|
|
4193
|
-
kind: "observed",
|
|
4194
|
-
seconds: value,
|
|
4195
|
-
source: configPath,
|
|
4196
|
-
daemon,
|
|
4197
|
-
configPath,
|
|
4198
|
-
fromFlag: false
|
|
4199
|
-
};
|
|
4150
|
+
if (facts.info.liveRestore) return { kind: "live-restore" };
|
|
4151
|
+
if (facts.containers === null)
|
|
4152
|
+
return { kind: "unknown", why: "its containers could not be read" };
|
|
4153
|
+
let waitSeconds = expected ?? 0;
|
|
4154
|
+
let longest = expected === null ? null : { kind: "workspaces" };
|
|
4155
|
+
for (const container of facts.containers) {
|
|
4156
|
+
const seconds = container.stopTimeout ?? DOCKER_DEFAULT_STOP_TIMEOUT_SECONDS;
|
|
4157
|
+
if (seconds > waitSeconds) {
|
|
4158
|
+
waitSeconds = seconds;
|
|
4159
|
+
longest = { kind: "container", name: container.name };
|
|
4200
4160
|
}
|
|
4201
4161
|
}
|
|
4202
|
-
if (argv === null && !managed) {
|
|
4203
|
-
return {
|
|
4204
|
-
kind: "unknown",
|
|
4205
|
-
why: `no dockerd process observed here \xB7 not set in ${configPath}`
|
|
4206
|
-
};
|
|
4207
|
-
}
|
|
4208
4162
|
return {
|
|
4209
4163
|
kind: "observed",
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
configPath,
|
|
4214
|
-
fromFlag: false
|
|
4164
|
+
waitSeconds,
|
|
4165
|
+
longest,
|
|
4166
|
+
limit: stopLimitOf(facts, daemonKindOf(facts.info))
|
|
4215
4167
|
};
|
|
4216
4168
|
};
|
|
4217
|
-
var
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4169
|
+
var limitSeconds = (limit) => limit.kind === "observed" ? limit.seconds : SYSTEMD_DEFAULT_STOP_SECONDS;
|
|
4170
|
+
var outlasts = (reading) => {
|
|
4171
|
+
const limit = limitSeconds(reading.limit);
|
|
4172
|
+
return limit !== null && reading.waitSeconds + DOCKERD_SHUTDOWN_GRACE_SECONDS >= limit;
|
|
4173
|
+
};
|
|
4174
|
+
var whose = (reading) => {
|
|
4175
|
+
if (reading.longest === null) return "no container running";
|
|
4176
|
+
if (reading.longest.kind === "workspaces") return "a workspace's stop timeout";
|
|
4177
|
+
return `${reading.longest.name}'s stop timeout`;
|
|
4178
|
+
};
|
|
4179
|
+
var stopWords = (reading) => reading.longest === null ? "no container running" : `a Docker stop waits up to ${reading.waitSeconds} s \xB7 ${whose(reading)}`;
|
|
4180
|
+
var limitWords = (limit, ok) => {
|
|
4181
|
+
if (limit.kind === "none")
|
|
4182
|
+
return `${limit.why} (systemd's default is ${SYSTEMD_DEFAULT_STOP_SECONDS} s)`;
|
|
4183
|
+
if (limit.seconds === null) return `systemd waits for ${limit.unit} without a limit`;
|
|
4184
|
+
return ok ? `systemd allows ${limit.unit} ${limit.seconds} s` : `systemd kills ${limit.unit} after ${limit.seconds} s, and Docker's next start waits for what it left running`;
|
|
4185
|
+
};
|
|
4186
|
+
var isWorkspace = (name) => name.startsWith("sealant-");
|
|
4187
|
+
var fixWords = (reading) => {
|
|
4188
|
+
const longest = reading.longest;
|
|
4189
|
+
if (longest !== null && longest.kind === "container" && reading.waitSeconds > WORKSPACE_STOP_TIMEOUT_SECONDS) {
|
|
4190
|
+
return isWorkspace(longest.name) ? "stop that session (mend sessions, then mend stop <session>) before you restart or upgrade Docker" : `docker stop ${longest.name} before you restart or upgrade Docker`;
|
|
4191
|
+
}
|
|
4192
|
+
const room = reading.waitSeconds + DOCKERD_SHUTDOWN_GRACE_SECONDS + 30;
|
|
4193
|
+
return reading.limit.kind === "observed" ? `sudo systemctl edit ${reading.limit.unit.replace(" (user)", "")} and set [Service] TimeoutStopSec=${room}` : "stop sessions before you restart, upgrade or quit Docker";
|
|
4194
|
+
};
|
|
4195
|
+
var dockerStopCheck = (reading) => {
|
|
4231
4196
|
if (reading.kind === "unknown") {
|
|
4232
4197
|
return {
|
|
4233
4198
|
label: "docker",
|
|
4234
4199
|
state: "todo",
|
|
4235
|
-
detail: `
|
|
4200
|
+
detail: `Docker stop not observed \xB7 ${reading.why}`,
|
|
4236
4201
|
fix: null
|
|
4237
4202
|
};
|
|
4238
4203
|
}
|
|
4239
|
-
if (reading.
|
|
4204
|
+
if (reading.kind === "live-restore") {
|
|
4240
4205
|
return {
|
|
4241
4206
|
label: "docker",
|
|
4242
4207
|
state: "ok",
|
|
4243
|
-
detail:
|
|
4208
|
+
detail: "live-restore on \xB7 a Docker restart leaves sessions running",
|
|
4244
4209
|
fix: null
|
|
4245
4210
|
};
|
|
4246
4211
|
}
|
|
4212
|
+
const ok = !outlasts(reading);
|
|
4247
4213
|
return {
|
|
4248
4214
|
label: "docker",
|
|
4249
|
-
state: "todo",
|
|
4250
|
-
detail:
|
|
4251
|
-
fix:
|
|
4215
|
+
state: ok ? "ok" : "todo",
|
|
4216
|
+
detail: `${stopWords(reading)} \xB7 ${limitWords(reading.limit, ok)}`,
|
|
4217
|
+
fix: ok ? null : fixWords(reading)
|
|
4252
4218
|
};
|
|
4253
4219
|
};
|
|
4254
|
-
var
|
|
4255
|
-
if (reading.kind === "
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
return `Docker shutdown-timeout is ${reading.seconds} s (${reading.source}), below the ${grace} s capture grace: a host restart or daemon stop kills capture workspaces after ${reading.seconds} s, before they save. To raise it: ${raiseShutdownTimeoutWords(reading, grace)}.`;
|
|
4220
|
+
var dockerStopSetupLine = (reading) => {
|
|
4221
|
+
if (reading.kind === "live-restore") return null;
|
|
4222
|
+
if (reading.kind === "unknown") return null;
|
|
4223
|
+
if (!outlasts(reading)) return null;
|
|
4224
|
+
return `A Docker stop waits up to ${reading.waitSeconds} s (${whose(reading)}), but ${limitWords(reading.limit, false)}: a restart or upgrade of Docker with a live session leaves Docker down until that workspace ends. To avoid it: ${fixWords(reading)}.`;
|
|
4260
4225
|
};
|
|
4261
4226
|
var parseDockerInfo = (stdout) => {
|
|
4262
4227
|
let parsed;
|
|
@@ -4271,15 +4236,52 @@ var parseDockerInfo = (stdout) => {
|
|
|
4271
4236
|
const options = "SecurityOptions" in parsed ? parsed.SecurityOptions : [];
|
|
4272
4237
|
return {
|
|
4273
4238
|
operatingSystem,
|
|
4274
|
-
securityOptions: Array.isArray(options) ? options.filter((option) => typeof option === "string") : []
|
|
4239
|
+
securityOptions: Array.isArray(options) ? options.filter((option) => typeof option === "string") : [],
|
|
4240
|
+
liveRestore: "LiveRestoreEnabled" in parsed && parsed.LiveRestoreEnabled === true
|
|
4275
4241
|
};
|
|
4276
4242
|
};
|
|
4277
|
-
var
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4243
|
+
var parseContainerStopTimeouts = (stdout) => stdout.split("\n").map((line) => line.trim()).filter((line) => line !== "").map((line) => {
|
|
4244
|
+
const bar = line.lastIndexOf("|");
|
|
4245
|
+
const name = (bar < 0 ? line : line.slice(0, bar)).replace(/^\//, "");
|
|
4246
|
+
const value = bar < 0 ? "" : line.slice(bar + 1).trim();
|
|
4247
|
+
return { name, stopTimeout: /^\d+$/.test(value) ? Number(value) : null };
|
|
4248
|
+
});
|
|
4249
|
+
var TIMESPAN_UNITS = {
|
|
4250
|
+
us: 1e-6,
|
|
4251
|
+
ms: 1e-3,
|
|
4252
|
+
s: 1,
|
|
4253
|
+
sec: 1,
|
|
4254
|
+
m: 60,
|
|
4255
|
+
min: 60,
|
|
4256
|
+
h: 3600,
|
|
4257
|
+
hr: 3600,
|
|
4258
|
+
d: 86400,
|
|
4259
|
+
w: 604800
|
|
4260
|
+
};
|
|
4261
|
+
var parseSystemdTimespan = (text) => {
|
|
4262
|
+
const value = text.trim();
|
|
4263
|
+
if (value === "infinity") return null;
|
|
4264
|
+
if (value === "") return void 0;
|
|
4265
|
+
let total = 0;
|
|
4266
|
+
for (const part of value.split(/\s+/)) {
|
|
4267
|
+
const match = /^(\d+(?:\.\d+)?)([a-z]*)$/.exec(part);
|
|
4268
|
+
const unit = match?.[2] === "" ? "s" : match?.[2];
|
|
4269
|
+
const factor = unit === void 0 ? void 0 : TIMESPAN_UNITS[unit];
|
|
4270
|
+
if (match === null || factor === void 0) return void 0;
|
|
4271
|
+
total += Number(match[1]) * factor;
|
|
4282
4272
|
}
|
|
4273
|
+
return Math.round(total);
|
|
4274
|
+
};
|
|
4275
|
+
var parseDaemonUnit = (name, stdout) => {
|
|
4276
|
+
const fields = /* @__PURE__ */ new Map();
|
|
4277
|
+
for (const line of stdout.split("\n")) {
|
|
4278
|
+
const equals = line.indexOf("=");
|
|
4279
|
+
if (equals > 0) fields.set(line.slice(0, equals), line.slice(equals + 1));
|
|
4280
|
+
}
|
|
4281
|
+
const activeState = fields.get("ActiveState");
|
|
4282
|
+
const timeout = parseSystemdTimespan(fields.get("TimeoutStopUSec") ?? "");
|
|
4283
|
+
if (activeState === void 0 || timeout === void 0) return null;
|
|
4284
|
+
return { name, activeState, mainPid: fields.get("MainPID") ?? "", timeoutStopSeconds: timeout };
|
|
4283
4285
|
};
|
|
4284
4286
|
var hostProcView = {
|
|
4285
4287
|
list: (dir) => {
|
|
@@ -4416,24 +4418,50 @@ var hostDockerEndpoint = (context = null) => {
|
|
|
4416
4418
|
const endpoint = inspected.status === 0 ? inspected.stdout.trim() : "";
|
|
4417
4419
|
return endpoint === "" ? DOCKER_DEFAULT_HOST : endpoint;
|
|
4418
4420
|
};
|
|
4419
|
-
var
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4421
|
+
var runBounded = (command, args) => {
|
|
4422
|
+
const result = spawnSync3(command, [...args], {
|
|
4423
|
+
encoding: "utf8",
|
|
4424
|
+
timeout: 3e3,
|
|
4425
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
4426
|
+
});
|
|
4427
|
+
return result.status === 0 ? result.stdout : null;
|
|
4428
|
+
};
|
|
4429
|
+
var hostDockerDaemonFacts = (infoStdout, context = null) => {
|
|
4430
|
+
const info = infoStdout === null ? null : parseDockerInfo(infoStdout);
|
|
4431
|
+
const contextArgs = context === null ? [] : ["--context", context];
|
|
4432
|
+
const ids = info === null ? null : runBounded("docker", [...contextArgs, "ps", "-q"]);
|
|
4433
|
+
const idList = ids?.split("\n").map((id) => id.trim()).filter((id) => id !== "") ?? [];
|
|
4434
|
+
const inspected = ids === null ? null : idList.length === 0 ? "" : runBounded("docker", [
|
|
4435
|
+
...contextArgs,
|
|
4436
|
+
"inspect",
|
|
4437
|
+
"--format",
|
|
4438
|
+
"{{.Name}}|{{json .Config.StopTimeout}}",
|
|
4439
|
+
...idList
|
|
4440
|
+
]);
|
|
4441
|
+
const daemon = info === null ? null : daemonKindOf(info);
|
|
4442
|
+
const unitArgs = [
|
|
4443
|
+
"show",
|
|
4444
|
+
"docker.service",
|
|
4445
|
+
"-p",
|
|
4446
|
+
"ActiveState",
|
|
4447
|
+
"-p",
|
|
4448
|
+
"MainPID",
|
|
4449
|
+
"-p",
|
|
4450
|
+
"TimeoutStopUSec"
|
|
4451
|
+
];
|
|
4452
|
+
const unitText = daemon === "dockerd" ? runBounded("systemctl", unitArgs) : daemon === "rootless" ? runBounded("systemctl", ["--user", ...unitArgs]) : null;
|
|
4453
|
+
const observed = observeDockerd(hostProcView, hostDockerEndpoint(context));
|
|
4454
|
+
return {
|
|
4455
|
+
info,
|
|
4456
|
+
dockerdPid: observed.kind === "observed" ? observed.pid : null,
|
|
4457
|
+
containers: inspected === null ? null : parseContainerStopTimeouts(inspected),
|
|
4458
|
+
unit: unitText === null ? null : parseDaemonUnit(
|
|
4459
|
+
daemon === "rootless" ? "docker.service (user)" : "docker.service",
|
|
4460
|
+
unitText
|
|
4461
|
+
)
|
|
4462
|
+
};
|
|
4428
4463
|
};
|
|
4429
|
-
var
|
|
4430
|
-
info: infoStdout === null ? null : parseDockerInfo(infoStdout),
|
|
4431
|
-
...dockerdFactsOf(observeDockerd(hostProcView, hostDockerEndpoint(context))),
|
|
4432
|
-
readFile: readHostFile,
|
|
4433
|
-
home: os5.homedir(),
|
|
4434
|
-
xdgConfigHome: process.env["XDG_CONFIG_HOME"] ?? null
|
|
4435
|
-
});
|
|
4436
|
-
var observeHostShutdownTimeout = (context = null) => {
|
|
4464
|
+
var observeHostDockerStop = (context = null) => {
|
|
4437
4465
|
const info = spawnSync3(
|
|
4438
4466
|
"docker",
|
|
4439
4467
|
[...context === null ? [] : ["--context", context], "info", "--format", "{{json .}}"],
|
|
@@ -4443,29 +4471,77 @@ var observeHostShutdownTimeout = (context = null) => {
|
|
|
4443
4471
|
stdio: ["ignore", "pipe", "ignore"]
|
|
4444
4472
|
}
|
|
4445
4473
|
);
|
|
4446
|
-
return
|
|
4447
|
-
hostDockerDaemonFacts(info.status === 0 ? info.stdout : null, context)
|
|
4448
|
-
);
|
|
4474
|
+
return readDockerStop(hostDockerDaemonFacts(info.status === 0 ? info.stdout : null, context));
|
|
4449
4475
|
};
|
|
4450
4476
|
|
|
4451
4477
|
// src/doctor.ts
|
|
4452
4478
|
var TIMEOUT_MS = 3e3;
|
|
4479
|
+
var pmsetValue = (output, name) => {
|
|
4480
|
+
const match = new RegExp(`^\\s*${name}\\s+(\\d+)`, "m").exec(output);
|
|
4481
|
+
return match?.[1] === void 0 ? null : Number(match[1]);
|
|
4482
|
+
};
|
|
4483
|
+
var macSleepCheck = (pmset) => {
|
|
4484
|
+
const sleepMinutes = pmsetValue(pmset, "sleep");
|
|
4485
|
+
if (sleepMinutes === null || sleepMinutes === 0) return null;
|
|
4486
|
+
const wakeForNetwork = pmsetValue(pmset, "womp");
|
|
4487
|
+
return {
|
|
4488
|
+
label: "sleep",
|
|
4489
|
+
state: "todo",
|
|
4490
|
+
detail: `this Mac sleeps after ${sleepMinutes} min idle, and the Docker VM pauses while it sleeps: builds stall, sessions drop, its clock drifts`,
|
|
4491
|
+
fix: `sudo pmset -a sleep 0 disksleep 0${wakeForNetwork === 0 ? " womp 1" : ""} (System Settings \u2192 Energy \u2192 Prevent automatic sleeping when the display is off${wakeForNetwork === 0 ? ", and Wake for network access" : ""})`
|
|
4492
|
+
};
|
|
4493
|
+
};
|
|
4494
|
+
var macLidSleepCheck = (ioreg) => {
|
|
4495
|
+
const match = /"AppleClamshellCausesSleep"\s*=\s*(Yes|No)/.exec(ioreg);
|
|
4496
|
+
if (match?.[1] !== "Yes") return null;
|
|
4497
|
+
return {
|
|
4498
|
+
label: "lid",
|
|
4499
|
+
state: "todo",
|
|
4500
|
+
detail: "closing this Mac's lid sleeps it unless an external display and power are attached, and the Docker VM pauses while it sleeps: builds stall, sessions drop, its clock drifts",
|
|
4501
|
+
fix: "keep the lid open, or attach power and an external display before you close it"
|
|
4502
|
+
};
|
|
4503
|
+
};
|
|
4504
|
+
var readMacLid = () => {
|
|
4505
|
+
const read = spawnSync4("ioreg", ["-r", "-k", "AppleClamshellCausesSleep", "-d", "1"], {
|
|
4506
|
+
encoding: "utf8",
|
|
4507
|
+
timeout: TIMEOUT_MS
|
|
4508
|
+
});
|
|
4509
|
+
return read.status === 0 ? read.stdout : null;
|
|
4510
|
+
};
|
|
4511
|
+
var readMacPowerSettings = () => {
|
|
4512
|
+
const read = spawnSync4("pmset", ["-g"], { encoding: "utf8", timeout: TIMEOUT_MS });
|
|
4513
|
+
return read.status === 0 ? read.stdout : null;
|
|
4514
|
+
};
|
|
4453
4515
|
var MARKS = { ok: "\u2713", todo: "\u25CB", failed: "\u2717" };
|
|
4454
4516
|
var LABEL_WIDTH = 11;
|
|
4455
4517
|
var day = (at) => at.toISOString().slice(0, 10);
|
|
4456
4518
|
var formatCheck = (check, paint7 = (_state, mark) => mark) => `${paint7(check.state, MARKS[check.state])} ${check.label.padEnd(LABEL_WIDTH)} ${check.detail}${check.fix === null ? "" : ` \u2192 ${check.fix}`}`;
|
|
4457
4519
|
var getJson = async (config, route) => {
|
|
4458
4520
|
try {
|
|
4521
|
+
const sent = Date.now();
|
|
4459
4522
|
const response = await fetch(`${config.url}/api${route}`, {
|
|
4460
4523
|
headers: config.token === null ? {} : { authorization: `Bearer ${config.token}` },
|
|
4461
4524
|
signal: AbortSignal.timeout(TIMEOUT_MS)
|
|
4462
4525
|
});
|
|
4463
|
-
|
|
4464
|
-
|
|
4526
|
+
const date = Date.parse(response.headers.get("date") ?? "");
|
|
4527
|
+
const clockSkewMs = Number.isNaN(date) ? null : date - (sent + Date.now()) / 2;
|
|
4528
|
+
if (!response.ok) return { value: null, status: response.status, clockSkewMs };
|
|
4529
|
+
return { value: await response.json(), status: response.status, clockSkewMs };
|
|
4465
4530
|
} catch {
|
|
4466
|
-
return { value: null, status: null };
|
|
4531
|
+
return { value: null, status: null, clockSkewMs: null };
|
|
4467
4532
|
}
|
|
4468
4533
|
};
|
|
4534
|
+
var CLOCK_SKEW_FINDING_MS = 2 * 6e4;
|
|
4535
|
+
var clockCheck = (clockSkewMs) => {
|
|
4536
|
+
if (Math.abs(clockSkewMs) < CLOCK_SKEW_FINDING_MS) return null;
|
|
4537
|
+
const minutes = Math.round(Math.abs(clockSkewMs) / 6e4);
|
|
4538
|
+
return {
|
|
4539
|
+
label: "clock",
|
|
4540
|
+
state: "todo",
|
|
4541
|
+
detail: `this server's clock is ${minutes} min ${clockSkewMs < 0 ? "behind" : "ahead of"} this machine's`,
|
|
4542
|
+
fix: "if the server runs in OrbStack or Docker Desktop, restart it; otherwise check NTP on both machines (timedatectl, or sntp on a Mac)"
|
|
4543
|
+
};
|
|
4544
|
+
};
|
|
4469
4545
|
var exposureCheck = (exposure) => {
|
|
4470
4546
|
const beyondMachine = exposure.declared !== "loopback" && exposure.originOnMachine !== true;
|
|
4471
4547
|
const gateOpen = beyondMachine ? exposure.gateOpen : 0;
|
|
@@ -4571,6 +4647,8 @@ var runChecks = async (config, probes) => {
|
|
|
4571
4647
|
checks.push(
|
|
4572
4648
|
health.value === null ? await unreachedServer(config, local) : await answeredServer(config, health.value, local)
|
|
4573
4649
|
);
|
|
4650
|
+
const clock2 = health.value === null || health.clockSkewMs === null ? null : clockCheck(health.clockSkewMs);
|
|
4651
|
+
if (clock2 !== null) checks.push(clock2);
|
|
4574
4652
|
const projects = health.value !== null && config.token !== null ? await getJson(config, "/projects") : null;
|
|
4575
4653
|
if (health.value === null) checks.push(notChecked("signed in"));
|
|
4576
4654
|
else if (config.token === null) {
|
|
@@ -4714,9 +4792,15 @@ var runChecks = async (config, probes) => {
|
|
|
4714
4792
|
checks.push(exposure === void 0 ? notChecked("exposure") : exposureCheck(exposure));
|
|
4715
4793
|
const userNamespaces = machine === null || machine.value === null ? void 0 : machine.value.userNamespaces;
|
|
4716
4794
|
if (userNamespaces !== void 0) checks.push(userNamespacesCheck(userNamespaces));
|
|
4717
|
-
if (probes.
|
|
4718
|
-
checks.push(
|
|
4719
|
-
}
|
|
4795
|
+
if (probes.dockerStop !== void 0 && probes.onPath("docker")) {
|
|
4796
|
+
checks.push(dockerStopCheck(probes.dockerStop(local?.dockerContext ?? null)));
|
|
4797
|
+
}
|
|
4798
|
+
const pmset = local === null || probes.macPowerSettings === void 0 ? null : probes.macPowerSettings();
|
|
4799
|
+
const sleep3 = pmset === null ? null : macSleepCheck(pmset);
|
|
4800
|
+
if (sleep3 !== null) checks.push(sleep3);
|
|
4801
|
+
const lid = local === null || probes.macLid === void 0 ? null : probes.macLid();
|
|
4802
|
+
const lidSleep = lid === null ? null : macLidSleepCheck(lid);
|
|
4803
|
+
if (lidSleep !== null) checks.push(lidSleep);
|
|
4720
4804
|
return checks;
|
|
4721
4805
|
};
|
|
4722
4806
|
var onPath = (command) => {
|
|
@@ -4740,8 +4824,9 @@ var doctorCommand = async (config, localCredential2, claudeGrant2, localServer)
|
|
|
4740
4824
|
localCredential: localCredential2,
|
|
4741
4825
|
claudeGrant: claudeGrant2,
|
|
4742
4826
|
onPath,
|
|
4743
|
-
|
|
4744
|
-
...localServer === void 0 ? {} : { localServer }
|
|
4827
|
+
dockerStop: observeHostDockerStop,
|
|
4828
|
+
...localServer === void 0 ? {} : { localServer },
|
|
4829
|
+
...process.platform === "darwin" ? { macPowerSettings: readMacPowerSettings, macLid: readMacLid } : {}
|
|
4745
4830
|
});
|
|
4746
4831
|
for (const check of checks) {
|
|
4747
4832
|
process.stdout.write(`${redactCredentials(formatCheck(check, paintMark))}
|
|
@@ -4993,9 +5078,9 @@ var useHttp1 = () => {
|
|
|
4993
5078
|
};
|
|
4994
5079
|
|
|
4995
5080
|
// src/landing.ts
|
|
4996
|
-
import { spawnSync as
|
|
5081
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
4997
5082
|
import * as fs11 from "node:fs";
|
|
4998
|
-
import * as
|
|
5083
|
+
import * as os5 from "node:os";
|
|
4999
5084
|
import * as path11 from "node:path";
|
|
5000
5085
|
var paint = (code) => (text) => process.stdout.isTTY === true ? `[${code}m${text}[0m` : text;
|
|
5001
5086
|
var dim = paint("2");
|
|
@@ -5216,7 +5301,7 @@ var landCommand = async (api2, args) => {
|
|
|
5216
5301
|
if (!landingSucceeded(report)) process.exitCode = 1;
|
|
5217
5302
|
};
|
|
5218
5303
|
var git = (cwd, args) => {
|
|
5219
|
-
const result =
|
|
5304
|
+
const result = spawnSync5("git", args, { cwd, encoding: "utf8" });
|
|
5220
5305
|
return {
|
|
5221
5306
|
status: result.status ?? 1,
|
|
5222
5307
|
stdout: result.stdout ?? "",
|
|
@@ -5292,7 +5377,7 @@ var fetchBundle = (cwd, bundle, into = bundle.branch) => {
|
|
|
5292
5377
|
recordAt(previous);
|
|
5293
5378
|
return { _tag: "unchanged", branch: into, here: previous, tip: bundle.tip };
|
|
5294
5379
|
}
|
|
5295
|
-
const dir = fs11.mkdtempSync(path11.join(
|
|
5380
|
+
const dir = fs11.mkdtempSync(path11.join(os5.tmpdir(), "mend-pull-"));
|
|
5296
5381
|
try {
|
|
5297
5382
|
const file = path11.join(dir, "change.bundle");
|
|
5298
5383
|
fs11.writeFileSync(file, bundle.bytes, { mode: 384 });
|
|
@@ -5534,7 +5619,7 @@ var followStart = async (options) => {
|
|
|
5534
5619
|
|
|
5535
5620
|
// src/login.ts
|
|
5536
5621
|
import { spawn as spawn2 } from "node:child_process";
|
|
5537
|
-
import * as
|
|
5622
|
+
import * as os6 from "node:os";
|
|
5538
5623
|
|
|
5539
5624
|
// src/pair.ts
|
|
5540
5625
|
var paint2 = (code) => (text) => process.stdout.isTTY === true ? `\x1B[${code}m${text}\x1B[0m` : text;
|
|
@@ -5606,7 +5691,15 @@ var parseCliAuthStart = (json2) => {
|
|
|
5606
5691
|
if (typeof deviceCode !== "string" || typeof code !== "string" || typeof verifyPath !== "string" || typeof expiresAt !== "string" || typeof intervalSeconds !== "number") {
|
|
5607
5692
|
return null;
|
|
5608
5693
|
}
|
|
5609
|
-
|
|
5694
|
+
const expiresIn = "expiresIn" in json2 ? json2.expiresIn : void 0;
|
|
5695
|
+
return {
|
|
5696
|
+
deviceCode,
|
|
5697
|
+
code,
|
|
5698
|
+
verifyPath,
|
|
5699
|
+
expiresAt,
|
|
5700
|
+
intervalSeconds,
|
|
5701
|
+
...typeof expiresIn === "number" && Number.isFinite(expiresIn) ? { expiresIn } : {}
|
|
5702
|
+
};
|
|
5610
5703
|
};
|
|
5611
5704
|
var parseCliAuthPoll = (json2) => {
|
|
5612
5705
|
if (typeof json2 !== "object" || json2 === null || !("status" in json2)) return null;
|
|
@@ -5665,13 +5758,32 @@ var browserCommand = (platform) => {
|
|
|
5665
5758
|
return null;
|
|
5666
5759
|
};
|
|
5667
5760
|
var pollDelayMs = (intervalSeconds) => Math.min(Math.max(Math.round(intervalSeconds), 1), 10) * 1e3;
|
|
5668
|
-
var pollDeadline = (
|
|
5669
|
-
|
|
5670
|
-
|
|
5761
|
+
var pollDeadline = (expiry, receivedAt, serverDate = null) => {
|
|
5762
|
+
if (expiry.expiresIn !== void 0) return receivedAt + Math.max(0, expiry.expiresIn) * 1e3;
|
|
5763
|
+
const at = Date.parse(expiry.expiresAt);
|
|
5764
|
+
const serverNow = serverDate === null ? Number.NaN : Date.parse(serverDate);
|
|
5765
|
+
if (Number.isNaN(at) || Number.isNaN(serverNow)) return receivedAt + 10 * 6e4;
|
|
5766
|
+
return receivedAt + Math.max(0, at - serverNow);
|
|
5767
|
+
};
|
|
5768
|
+
var isSet = (value) => value !== void 0 && value !== "";
|
|
5769
|
+
var browserDecision = (input) => {
|
|
5770
|
+
if (input.args.includes("--no-open")) return { open: false, why: null };
|
|
5771
|
+
if (input.args.includes("--open")) return { open: true, why: null };
|
|
5772
|
+
if (!input.isTTY) return { open: false, why: null };
|
|
5773
|
+
if (isSet(input.env["SSH_CONNECTION"]) || isSet(input.env["SSH_TTY"])) {
|
|
5774
|
+
return {
|
|
5775
|
+
open: false,
|
|
5776
|
+
why: "this terminal is over SSH, so no browser opens here: open the link on your own machine"
|
|
5777
|
+
};
|
|
5778
|
+
}
|
|
5779
|
+
if (input.platform === "linux" && !isSet(input.env["DISPLAY"]) && !isSet(input.env["WAYLAND_DISPLAY"])) {
|
|
5780
|
+
return { open: false, why: "no display here, so no browser opens: open the link elsewhere" };
|
|
5781
|
+
}
|
|
5782
|
+
return { open: browserCommand(input.platform) !== null, why: null };
|
|
5671
5783
|
};
|
|
5672
5784
|
var openBrowser = (url) => {
|
|
5673
5785
|
const opener = browserCommand(process.platform);
|
|
5674
|
-
if (opener === null
|
|
5786
|
+
if (opener === null) return;
|
|
5675
5787
|
try {
|
|
5676
5788
|
const child = spawn2(opener.command, [...opener.args, url], {
|
|
5677
5789
|
stdio: "ignore",
|
|
@@ -5693,18 +5805,19 @@ var post = async (url, body) => {
|
|
|
5693
5805
|
} catch {
|
|
5694
5806
|
return fail3(`cannot reach the Mend server at ${new URL(url).origin} \u2014 is it running?`);
|
|
5695
5807
|
}
|
|
5808
|
+
const receivedAt = Date.now();
|
|
5696
5809
|
const text = await response.text();
|
|
5697
5810
|
let json2 = null;
|
|
5698
5811
|
try {
|
|
5699
5812
|
json2 = JSON.parse(text);
|
|
5700
5813
|
} catch {
|
|
5701
5814
|
}
|
|
5702
|
-
return { status: response.status, json: json2 };
|
|
5815
|
+
return { status: response.status, json: json2, date: response.headers.get("date"), receivedAt };
|
|
5703
5816
|
};
|
|
5704
5817
|
var retryAfterSecondsOf = (json2) => {
|
|
5705
5818
|
if (typeof json2 === "object" && json2 !== null && "retryAfterSeconds" in json2) {
|
|
5706
|
-
const
|
|
5707
|
-
if (Number.isFinite(
|
|
5819
|
+
const seconds = Number(json2.retryAfterSeconds);
|
|
5820
|
+
if (Number.isFinite(seconds) && seconds > 0) return seconds;
|
|
5708
5821
|
}
|
|
5709
5822
|
return 5;
|
|
5710
5823
|
};
|
|
@@ -5726,7 +5839,7 @@ var resolveServerUrl = async (args, deps) => {
|
|
|
5726
5839
|
};
|
|
5727
5840
|
var loginCommand = async (args, deps) => {
|
|
5728
5841
|
const base = await resolveServerUrl(args, deps);
|
|
5729
|
-
const started = await post(`${base}/api/cli/auth`, { name:
|
|
5842
|
+
const started = await post(`${base}/api/cli/auth`, { name: os6.hostname(), client: "cli" });
|
|
5730
5843
|
if (started.status === 429) {
|
|
5731
5844
|
return fail3(
|
|
5732
5845
|
`the server asked for a pause \u2014 try again in ${retryAfterSecondsOf(started.json)}s`
|
|
@@ -5744,10 +5857,17 @@ var loginCommand = async (args, deps) => {
|
|
|
5744
5857
|
` ${dim3("code")} ${groupCode(opened.code)} ${dim3("\xB7 approve only if the browser shows the same code")}`
|
|
5745
5858
|
);
|
|
5746
5859
|
say3(` ${dim3("browser")} ${cobalt(url)}`);
|
|
5860
|
+
const browser = browserDecision({
|
|
5861
|
+
args,
|
|
5862
|
+
env: process.env,
|
|
5863
|
+
platform: process.platform,
|
|
5864
|
+
isTTY: process.stdout.isTTY === true
|
|
5865
|
+
});
|
|
5866
|
+
if (browser.why !== null) say3(` ${dim3(browser.why)}`);
|
|
5747
5867
|
say3("");
|
|
5748
5868
|
say3(dim3(" waiting for approval\u2026 Ctrl-C stops; nothing is granted until someone approves"));
|
|
5749
|
-
openBrowser(url);
|
|
5750
|
-
const deadline = pollDeadline(opened.
|
|
5869
|
+
if (browser.open) openBrowser(url);
|
|
5870
|
+
const deadline = pollDeadline(opened, started.receivedAt, started.date);
|
|
5751
5871
|
const delay2 = pollDelayMs(opened.intervalSeconds);
|
|
5752
5872
|
while (Date.now() < deadline) {
|
|
5753
5873
|
await sleep2(delay2);
|
|
@@ -6181,9 +6301,9 @@ var operatorCommand = async (api2, tryApi, baseUrl, args) => {
|
|
|
6181
6301
|
|
|
6182
6302
|
// src/pi-profile.ts
|
|
6183
6303
|
import * as fs13 from "node:fs";
|
|
6184
|
-
import * as
|
|
6304
|
+
import * as os7 from "node:os";
|
|
6185
6305
|
import * as path13 from "node:path";
|
|
6186
|
-
var piAgentDir = () => process.env["PI_CODING_AGENT_DIR"] ?? path13.join(
|
|
6306
|
+
var piAgentDir = () => process.env["PI_CODING_AGENT_DIR"] ?? path13.join(os7.homedir(), ".pi", "agent");
|
|
6187
6307
|
var RESOURCE_DIRS = ["extensions", "themes", "prompts"];
|
|
6188
6308
|
var BESIDE = [
|
|
6189
6309
|
["package.json", "package.json"],
|
|
@@ -6242,7 +6362,7 @@ var walk = (root, notes) => {
|
|
|
6242
6362
|
return found;
|
|
6243
6363
|
};
|
|
6244
6364
|
var isLocalSource = (source) => !/^(npm|git):/.test(source) && !/^(https?|ssh|git):\/\//.test(source) && !source.startsWith("git@");
|
|
6245
|
-
var expandHome = (source) => source === "~" || source.startsWith("~/") ? path13.join(
|
|
6365
|
+
var expandHome = (source) => source === "~" || source.startsWith("~/") ? path13.join(os7.homedir(), source.slice(1)) : source;
|
|
6246
6366
|
var bundleName = (abs) => {
|
|
6247
6367
|
try {
|
|
6248
6368
|
const manifest = JSON.parse(fs13.readFileSync(path13.join(abs, "package.json"), "utf8"));
|
|
@@ -6722,10 +6842,10 @@ var parseDuration = (text) => {
|
|
|
6722
6842
|
};
|
|
6723
6843
|
var DURATION_ISSUE = "--timeout takes a duration above 0: 90 or 90s, 5m, 1h";
|
|
6724
6844
|
var durationLine = (ms) => {
|
|
6725
|
-
const
|
|
6726
|
-
if (
|
|
6727
|
-
const minutes = Math.floor(
|
|
6728
|
-
const rest =
|
|
6845
|
+
const seconds = Math.round(ms / 1e3);
|
|
6846
|
+
if (seconds < 60) return `${seconds} s`;
|
|
6847
|
+
const minutes = Math.floor(seconds / 60);
|
|
6848
|
+
const rest = seconds % 60;
|
|
6729
6849
|
if (minutes < 60) return rest === 0 ? `${minutes} min` : `${minutes} min ${rest} s`;
|
|
6730
6850
|
const hours = Math.floor(minutes / 60);
|
|
6731
6851
|
return minutes % 60 === 0 ? `${hours} h` : `${hours} h ${minutes % 60} min`;
|
|
@@ -6883,7 +7003,7 @@ import * as dns from "node:dns/promises";
|
|
|
6883
7003
|
import * as fs16 from "node:fs";
|
|
6884
7004
|
import { readFile } from "node:fs/promises";
|
|
6885
7005
|
import * as net4 from "node:net";
|
|
6886
|
-
import * as
|
|
7006
|
+
import * as os9 from "node:os";
|
|
6887
7007
|
import * as path16 from "node:path";
|
|
6888
7008
|
|
|
6889
7009
|
// src/server-docker-volumes.ts
|
|
@@ -6892,7 +7012,7 @@ import { createHash as createHash2 } from "node:crypto";
|
|
|
6892
7012
|
// src/server-store.ts
|
|
6893
7013
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
6894
7014
|
import * as fs14 from "node:fs";
|
|
6895
|
-
import * as
|
|
7015
|
+
import * as os8 from "node:os";
|
|
6896
7016
|
import * as path15 from "node:path";
|
|
6897
7017
|
var ServerRefusal = class extends Error {
|
|
6898
7018
|
};
|
|
@@ -6997,7 +7117,7 @@ var describeOwner = (lockDir) => {
|
|
|
6997
7117
|
const owner = parseLockOwner(raw);
|
|
6998
7118
|
if (owner === null) return "owner metadata is invalid";
|
|
6999
7119
|
const label = `PID ${owner.pid} on ${owner.hostname}`;
|
|
7000
|
-
if (owner.hostname !==
|
|
7120
|
+
if (owner.hostname !== os8.hostname()) return label;
|
|
7001
7121
|
try {
|
|
7002
7122
|
process.kill(owner.pid, 0);
|
|
7003
7123
|
return `${label} is still live`;
|
|
@@ -7050,7 +7170,7 @@ var acquireLock = (configDir, create) => {
|
|
|
7050
7170
|
}
|
|
7051
7171
|
const owned = fs14.statSync(lockDir);
|
|
7052
7172
|
const ownerFile = path15.join(lockDir, "owner.json");
|
|
7053
|
-
const owner = `${JSON.stringify({ pid: process.pid, hostname:
|
|
7173
|
+
const owner = `${JSON.stringify({ pid: process.pid, hostname: os8.hostname(), token: randomUUID2() })}
|
|
7054
7174
|
`;
|
|
7055
7175
|
let open = true;
|
|
7056
7176
|
const assertOwned = () => {
|
|
@@ -7887,7 +8007,13 @@ var flagsFor = (before, after) => {
|
|
|
7887
8007
|
return flags;
|
|
7888
8008
|
};
|
|
7889
8009
|
var shellWord = (word) => /^[A-Za-z0-9_./:@=,+-]+$/.test(word) ? word : `'${word.replaceAll("'", `'\\''`)}'`;
|
|
7890
|
-
var setupCommandOf = (flags
|
|
8010
|
+
var setupCommandOf = (flags, given = []) => [
|
|
8011
|
+
"mend",
|
|
8012
|
+
"server",
|
|
8013
|
+
"setup",
|
|
8014
|
+
...flags.length === 0 ? ["--yes"] : flags.map(shellWord),
|
|
8015
|
+
...given.map(shellWord)
|
|
8016
|
+
].join(" ");
|
|
7891
8017
|
var sshAt = (settings) => settings.sshBind ?? settings.bind;
|
|
7892
8018
|
var sshBeyondThisMachine = (settings) => !isLoopbackAddress(sshAt(settings));
|
|
7893
8019
|
var reachOf = (settings) => settings.edgeHost !== void 0 ? `the public internet, over HTTPS at ${settings.edgeHost} (the edge, Caddy, on 80 and 443)` : isLoopbackAddress(settings.bind) ? `this machine only, at ${settings.appUrl}` : `your network, at ${settings.appUrl} (listening on ${settings.bind})`;
|
|
@@ -8669,7 +8795,7 @@ var runGuide = async (io, context) => {
|
|
|
8669
8795
|
for (const line of changes) io.write(line);
|
|
8670
8796
|
}
|
|
8671
8797
|
}
|
|
8672
|
-
io.write(`Same as: ${setupCommandOf(flags)}`);
|
|
8798
|
+
io.write(`Same as: ${setupCommandOf(flags, context.given)}`);
|
|
8673
8799
|
const unresolvedEdge = target.edgeHost !== void 0 && asked.unresolved.has(target.edgeHost) ? target.edgeHost : null;
|
|
8674
8800
|
if (unresolvedEdge !== null)
|
|
8675
8801
|
io.write(
|
|
@@ -8893,14 +9019,14 @@ var parseSetupOptions = (args) => {
|
|
|
8893
9019
|
previous.push(value);
|
|
8894
9020
|
values.set(flag, previous);
|
|
8895
9021
|
}
|
|
8896
|
-
const
|
|
8897
|
-
const version =
|
|
8898
|
-
const appPort =
|
|
8899
|
-
const sshPort =
|
|
9022
|
+
const flagValue2 = (flag) => values.get(flag)?.[0];
|
|
9023
|
+
const version = flagValue2("--version");
|
|
9024
|
+
const appPort = flagValue2("--port");
|
|
9025
|
+
const sshPort = flagValue2("--ssh-port");
|
|
8900
9026
|
const origins = values.get("--origin");
|
|
8901
|
-
const edge =
|
|
8902
|
-
const exposure =
|
|
8903
|
-
const tenancy =
|
|
9027
|
+
const edge = flagValue2("--edge");
|
|
9028
|
+
const exposure = flagValue2("--exposure");
|
|
9029
|
+
const tenancy = flagValue2("--tenancy");
|
|
8904
9030
|
const declared = values.get("--declare");
|
|
8905
9031
|
const declaredItems = declared === void 0 ? void 0 : parseDeclared(declared, "--declare");
|
|
8906
9032
|
const undeclared = parseDeclared(values.get("--undeclare") ?? [], "--undeclare");
|
|
@@ -8919,7 +9045,7 @@ var parseSetupOptions = (args) => {
|
|
|
8919
9045
|
};
|
|
8920
9046
|
const npmMirror = pair("--npm-mirror", "--no-npm-mirror");
|
|
8921
9047
|
const dockerMirror = pair("--docker-mirror", "--no-docker-mirror");
|
|
8922
|
-
const maxSize =
|
|
9048
|
+
const maxSize = flagValue2("--npm-mirror-max-size");
|
|
8923
9049
|
const npmMirrorMaxSize = maxSize === void 0 ? void 0 : parseMirrorSize(maxSize);
|
|
8924
9050
|
if (npmMirrorMaxSize === null)
|
|
8925
9051
|
throw setupError(
|
|
@@ -8927,7 +9053,7 @@ var parseSetupOptions = (args) => {
|
|
|
8927
9053
|
);
|
|
8928
9054
|
if (npmMirrorMaxSize !== void 0 && npmMirror === false)
|
|
8929
9055
|
throw setupError("--npm-mirror-max-size and --no-npm-mirror contradict each other.");
|
|
8930
|
-
const dockerMaxSize =
|
|
9056
|
+
const dockerMaxSize = flagValue2("--docker-mirror-max-size");
|
|
8931
9057
|
const dockerMirrorMaxSize = dockerMaxSize === void 0 ? void 0 : parseMirrorSize(dockerMaxSize);
|
|
8932
9058
|
if (dockerMirrorMaxSize === null)
|
|
8933
9059
|
throw setupError(
|
|
@@ -8935,7 +9061,7 @@ var parseSetupOptions = (args) => {
|
|
|
8935
9061
|
);
|
|
8936
9062
|
if (dockerMirrorMaxSize !== void 0 && dockerMirror === false)
|
|
8937
9063
|
throw setupError("--docker-mirror-max-size and --no-docker-mirror contradict each other.");
|
|
8938
|
-
const dockerHubUsername =
|
|
9064
|
+
const dockerHubUsername = flagValue2("--docker-hub-username");
|
|
8939
9065
|
const dockerHubTokenStdin = values.has("--docker-hub-token-stdin");
|
|
8940
9066
|
const noDockerHubLogin = values.has("--no-docker-hub-login");
|
|
8941
9067
|
if (dockerHubUsername === void 0 !== !dockerHubTokenStdin)
|
|
@@ -8957,22 +9083,22 @@ var parseSetupOptions = (args) => {
|
|
|
8957
9083
|
throw setupError(
|
|
8958
9084
|
`--docker-hub-username and ${noDockerHubLogin ? "--no-docker-hub-login" : "--no-docker-mirror"} contradict each other.`
|
|
8959
9085
|
);
|
|
8960
|
-
const t3GatewayPort =
|
|
9086
|
+
const t3GatewayPort = flagValue2("--t3-gateway-port");
|
|
8961
9087
|
if (values.has("--no-t3-gateway") && (values.has("--t3-gateway") || t3GatewayPort !== void 0)) {
|
|
8962
9088
|
throw setupError("--no-t3-gateway contradicts --t3-gateway and --t3-gateway-port.");
|
|
8963
9089
|
}
|
|
8964
9090
|
return {
|
|
8965
|
-
context:
|
|
9091
|
+
context: flagValue2("--context"),
|
|
8966
9092
|
version: version === void 0 ? void 0 : parseVersion(version),
|
|
8967
|
-
bind:
|
|
8968
|
-
sshBind:
|
|
8969
|
-
url:
|
|
9093
|
+
bind: flagValue2("--bind"),
|
|
9094
|
+
sshBind: flagValue2("--ssh-bind"),
|
|
9095
|
+
url: flagValue2("--url"),
|
|
8970
9096
|
// `--origin none`: no extra origins at all.
|
|
8971
9097
|
origins: origins === void 0 ? void 0 : origins[0] === "none" ? [] : origins,
|
|
8972
9098
|
appPort: appPort === void 0 ? void 0 : parsePort(appPort, "--port"),
|
|
8973
9099
|
sshPort: sshPort === void 0 ? void 0 : parsePort(sshPort, "--ssh-port"),
|
|
8974
|
-
dockerSocket:
|
|
8975
|
-
assetsDir:
|
|
9100
|
+
dockerSocket: flagValue2("--docker-socket"),
|
|
9101
|
+
assetsDir: flagValue2("--assets-dir"),
|
|
8976
9102
|
offline: values.has("--offline"),
|
|
8977
9103
|
edge: edge === void 0 ? void 0 : parseEdge(edge),
|
|
8978
9104
|
noEdge: values.has("--no-edge"),
|
|
@@ -9524,7 +9650,8 @@ var checkDocker = async (runtime, context) => {
|
|
|
9524
9650
|
}
|
|
9525
9651
|
return info.stdout.trim();
|
|
9526
9652
|
};
|
|
9527
|
-
var
|
|
9653
|
+
var NETWORK_GUARD_IMAGE = "busybox:1.37@sha256:bdf57e528e45e4433820e045b29b4597825a1c9e38353532d90a01445013f82e";
|
|
9654
|
+
var HOST_HELPER_IMAGE = NETWORK_GUARD_IMAGE;
|
|
9528
9655
|
var observeHostUserNamespaces = async (runtime, context) => {
|
|
9529
9656
|
const read = HOST_USER_NAMESPACE_FILES.map(
|
|
9530
9657
|
(file) => `printf '%s|' "$(cat ${file} 2>/dev/null || echo -)"`
|
|
@@ -9550,7 +9677,8 @@ var observeHostUserNamespaces = async (runtime, context) => {
|
|
|
9550
9677
|
unprivilegedUsernsClone: clone ?? null
|
|
9551
9678
|
});
|
|
9552
9679
|
};
|
|
9553
|
-
var
|
|
9680
|
+
var ALLOW_USERNS_RERUN = "Re-run mend server setup with --allow-userns to let setup write it (and let mend uninstall undo it). Or, on the host, run:";
|
|
9681
|
+
var userNamespacesReminder = (setting, how = "On the host, run:") => `No session can start on this Docker host yet: its kernel refuses unprivileged user namespaces, which each workspace's rootless Docker service needs. ${how} ${hostUserNamespacesFix(setting)}`;
|
|
9554
9682
|
var sysctlOf = (setting) => {
|
|
9555
9683
|
const match = /^([a-z0-9_.]+) = ([0-9]+)$/.exec(setting);
|
|
9556
9684
|
if (match?.[1] === void 0 || match[2] === void 0) return null;
|
|
@@ -9611,10 +9739,10 @@ var settleHostUserNamespaces = async (runtime, options, context) => {
|
|
|
9611
9739
|
runtime.writeLine(
|
|
9612
9740
|
`Sessions cannot start on this host yet: ${who} blocks the unprivileged user namespaces each workspace's Docker service needs.`
|
|
9613
9741
|
);
|
|
9614
|
-
const printFix = (why) => {
|
|
9615
|
-
runtime.writeLine(`${why}
|
|
9742
|
+
const printFix = (why, how = "On the host, run:") => {
|
|
9743
|
+
runtime.writeLine(`${why} ${how} ${fix}`);
|
|
9616
9744
|
runtime.writeLine("");
|
|
9617
|
-
return userNamespacesReminder(observed.setting);
|
|
9745
|
+
return userNamespacesReminder(observed.setting, how);
|
|
9618
9746
|
};
|
|
9619
9747
|
if (await rootlessDaemon(runtime, context)) {
|
|
9620
9748
|
return printFix(
|
|
@@ -9627,13 +9755,12 @@ var settleHostUserNamespaces = async (runtime, options, context) => {
|
|
|
9627
9755
|
`Allowing them writes ${observed.setting} to ${HOST_USER_NAMESPACE_SYSCTL_FILE} on the Docker host and applies it now. It lifts that restriction for the whole host, not only for Mend.`
|
|
9628
9756
|
);
|
|
9629
9757
|
const answer2 = await runtime.prompter("Allow them now? [Y/n] ");
|
|
9630
|
-
if (answer2 === null) throw setupError("Stopped before
|
|
9758
|
+
if (answer2 === null) throw setupError("Stopped before setup changed anything.");
|
|
9631
9759
|
allow = !/^n/i.test(answer2.trim());
|
|
9632
9760
|
}
|
|
9761
|
+
if (allow === false) return printFix("Left as it is (--no-allow-userns or your answer).");
|
|
9633
9762
|
if (allow !== true) {
|
|
9634
|
-
return printFix(
|
|
9635
|
-
allow === false ? "Left as it is (--no-allow-userns or your answer)." : "Setup changes the host's kernel only when asked: answer the question on a terminal, or pass --allow-userns."
|
|
9636
|
-
);
|
|
9763
|
+
return printFix("Setup changes the host's kernel only when asked.", ALLOW_USERNS_RERUN);
|
|
9637
9764
|
}
|
|
9638
9765
|
const stopped = await allowHostUserNamespaces(runtime, context, observed.setting);
|
|
9639
9766
|
if (stopped !== null) return printFix(`Setup could not apply it through Docker (${stopped}).`);
|
|
@@ -10514,6 +10641,14 @@ var mirrorsChangedLines = (before, config) => {
|
|
|
10514
10641
|
return lines;
|
|
10515
10642
|
};
|
|
10516
10643
|
var UNASKED_FRESH_SETUP = "No terminal to ask on, and no flag says how this Mend is reached (--context and --docker-socket only choose the Docker engine), so setup does not guess. Run mend server setup in a terminal to answer its questions, or say it with flags: --yes takes the defaults (this machine only, http://localhost:3105); --bind <address> --url <origin> serves a private network (a tailnet, a LAN, a VPN); for public HTTPS, set up on this machine first, create the first account, then run mend server setup --edge <host> --exposure public. mend help server setup lists every flag.";
|
|
10644
|
+
var requestedDockerContext = (runtime, options, existing) => {
|
|
10645
|
+
const variable = runtime.dockerContextVariable;
|
|
10646
|
+
const fromVariable = options.context === void 0 && existing === null && variable !== void 0;
|
|
10647
|
+
return {
|
|
10648
|
+
requested: options.context ?? (fromVariable ? variable : existing?.config.dockerContext),
|
|
10649
|
+
fromVariable
|
|
10650
|
+
};
|
|
10651
|
+
};
|
|
10517
10652
|
var refuseLegacyContract = (existing) => {
|
|
10518
10653
|
if (existing !== null && existing.config.assetContract !== ASSET_CONTRACT) {
|
|
10519
10654
|
throw setupError(
|
|
@@ -10547,13 +10682,25 @@ var guidedSetup = async (runtime, prompter, hostFlags2 = []) => {
|
|
|
10547
10682
|
if (read._tag === "error") return { _tag: "error", message: read.error.message };
|
|
10548
10683
|
const existing = read.value;
|
|
10549
10684
|
refuseLegacyContract(existing);
|
|
10685
|
+
const hostOptions = parseSetupOptions(hostFlags2);
|
|
10686
|
+
const context = await selectDockerContext(
|
|
10687
|
+
runtime,
|
|
10688
|
+
requestedDockerContext(runtime, hostOptions, existing).requested
|
|
10689
|
+
);
|
|
10690
|
+
await checkDocker(runtime, context.name);
|
|
10691
|
+
const reminder = await settleHostUserNamespaces(
|
|
10692
|
+
{ ...runtime, prompter },
|
|
10693
|
+
hostOptions,
|
|
10694
|
+
context.name
|
|
10695
|
+
);
|
|
10550
10696
|
const outcome = await runGuide(
|
|
10551
10697
|
{ write: runtime.writeLine, ask: prompter },
|
|
10552
10698
|
{
|
|
10553
10699
|
saved: existing === null ? null : resolveSetupSettings(existing.config, []),
|
|
10554
10700
|
defaults: resolveSetupSettings(null, []),
|
|
10555
10701
|
observe: guideObservations(runtime),
|
|
10556
|
-
resolve: (flags) => resolveSetupSettings(existing?.config ?? null, flags)
|
|
10702
|
+
resolve: (flags) => resolveSetupSettings(existing?.config ?? null, flags),
|
|
10703
|
+
given: hostFlags2
|
|
10557
10704
|
}
|
|
10558
10705
|
);
|
|
10559
10706
|
if (outcome._tag === "refused") return { _tag: "error", message: outcome.message };
|
|
@@ -10564,7 +10711,8 @@ var guidedSetup = async (runtime, prompter, hostFlags2 = []) => {
|
|
|
10564
10711
|
return underLock(
|
|
10565
10712
|
runtime.configDir,
|
|
10566
10713
|
(store) => setupServer([...outcome.flags, ...hostFlags2], runtime, store, {
|
|
10567
|
-
askedAgainst: existing?.directory ?? null
|
|
10714
|
+
askedAgainst: existing?.directory ?? null,
|
|
10715
|
+
userNamespaces: { reminder }
|
|
10568
10716
|
}),
|
|
10569
10717
|
{ create: true }
|
|
10570
10718
|
);
|
|
@@ -10609,11 +10757,8 @@ var setupServer = async (args, runtime, store, run2 = {}) => {
|
|
|
10609
10757
|
}
|
|
10610
10758
|
refuseLegacyContract(existing);
|
|
10611
10759
|
const variable = runtime.dockerContextVariable;
|
|
10612
|
-
const
|
|
10613
|
-
const selectedContext = await selectDockerContext(
|
|
10614
|
-
runtime,
|
|
10615
|
-
options.context ?? (fromVariable ? variable : existing?.config.dockerContext)
|
|
10616
|
-
);
|
|
10760
|
+
const { requested, fromVariable } = requestedDockerContext(runtime, options, existing);
|
|
10761
|
+
const selectedContext = await selectDockerContext(runtime, requested);
|
|
10617
10762
|
const operatingSystem = await checkDocker(runtime, selectedContext.name);
|
|
10618
10763
|
runtime.writeLine(
|
|
10619
10764
|
`Using Docker context "${selectedContext.name}" (${selectedContext.endpoint})${fromVariable ? ", from DOCKER_CONTEXT" : ""}`
|
|
@@ -10628,7 +10773,7 @@ var setupServer = async (args, runtime, store, run2 = {}) => {
|
|
|
10628
10773
|
validateExposure(existing?.config ?? null, options),
|
|
10629
10774
|
existing?.config ?? null
|
|
10630
10775
|
);
|
|
10631
|
-
const userNamespaces = await settleHostUserNamespaces(runtime, options, selectedContext.name);
|
|
10776
|
+
const userNamespaces = run2.userNamespaces === void 0 ? await settleHostUserNamespaces(runtime, options, selectedContext.name) : run2.userNamespaces.reminder;
|
|
10632
10777
|
const serverVersion = await resolveServerVersion(runtime, options, existing?.config ?? null);
|
|
10633
10778
|
const mirrors = resolveMirrors(existing?.config.mirrors, options);
|
|
10634
10779
|
const configWithoutBucket = {
|
|
@@ -10656,9 +10801,10 @@ var setupServer = async (args, runtime, store, run2 = {}) => {
|
|
|
10656
10801
|
"--format",
|
|
10657
10802
|
"{{json .}}"
|
|
10658
10803
|
]);
|
|
10659
|
-
const line =
|
|
10660
|
-
|
|
10661
|
-
runtime.dockerDaemonFacts(info.status === 0 ? info.stdout : null, selectedContext.name)
|
|
10804
|
+
const line = dockerStopSetupLine(
|
|
10805
|
+
readDockerStop(
|
|
10806
|
+
runtime.dockerDaemonFacts(info.status === 0 ? info.stdout : null, selectedContext.name),
|
|
10807
|
+
WORKSPACE_STOP_TIMEOUT_SECONDS
|
|
10662
10808
|
)
|
|
10663
10809
|
);
|
|
10664
10810
|
if (line !== null) runtime.writeLine(line);
|
|
@@ -10806,7 +10952,7 @@ var reachedBefore = (url, before) => {
|
|
|
10806
10952
|
};
|
|
10807
10953
|
var followUrlChange = async (runtime, options, before, after, instance) => {
|
|
10808
10954
|
runtime.writeLine(
|
|
10809
|
-
`Mend's URL changed from ${before.appUrl} to ${after.appUrl}. Browsers open ${after.appUrl}. A CLI signed in at the old URL (another account on this machine, another machine)
|
|
10955
|
+
`Mend's URL changed from ${before.appUrl} to ${after.appUrl}. Browsers open ${after.appUrl}. A CLI signed in at the old URL (another account on this machine, another machine) signs in again with mend login --url ${after.appUrl}, which asks for a new browser authorization.`
|
|
10810
10956
|
);
|
|
10811
10957
|
const saved = runtime.savedCliLogin?.(runtime.configDir) ?? null;
|
|
10812
10958
|
if (saved === null || !saved.signedIn || !reachedBefore(saved.url, before) || await answersAs(runtime, saved.url, after.serverVersion, instance)) {
|
|
@@ -11549,7 +11695,7 @@ var manageServer = async (command, args, runtime, store) => {
|
|
|
11549
11695
|
};
|
|
11550
11696
|
var nodeServerRuntime = () => {
|
|
11551
11697
|
const environment = { ...process.env };
|
|
11552
|
-
const home =
|
|
11698
|
+
const home = os9.homedir();
|
|
11553
11699
|
const configHome = environment["XDG_CONFIG_HOME"] ?? path16.join(home, ".config");
|
|
11554
11700
|
return {
|
|
11555
11701
|
configDir: path16.join(configHome, "mend"),
|
|
@@ -11590,7 +11736,7 @@ var nodeServerRuntime = () => {
|
|
|
11590
11736
|
return null;
|
|
11591
11737
|
}
|
|
11592
11738
|
},
|
|
11593
|
-
localAddresses: () => reachableAddressesOf(
|
|
11739
|
+
localAddresses: () => reachableAddressesOf(os9.networkInterfaces()),
|
|
11594
11740
|
readStdin: async () => {
|
|
11595
11741
|
const chunks = [];
|
|
11596
11742
|
for await (const chunk of process.stdin)
|
|
@@ -11664,7 +11810,7 @@ var portTakenHere = async (port, address = "127.0.0.1") => {
|
|
|
11664
11810
|
};
|
|
11665
11811
|
var probeSshFromHere = async (bind, port) => {
|
|
11666
11812
|
const unspecified = bind === "0.0.0.0" || bind === "::";
|
|
11667
|
-
const addresses = unspecified ? Object.values(
|
|
11813
|
+
const addresses = unspecified ? Object.values(os9.networkInterfaces()).flatMap((entries) => entries ?? []).filter(
|
|
11668
11814
|
(entry) => !entry.internal && (entry.family === "IPv4" || bind === "::" && !entry.address.startsWith("fe80"))
|
|
11669
11815
|
).map((entry) => entry.address).slice(0, 4) : [bind];
|
|
11670
11816
|
return Promise.all(
|
|
@@ -12247,15 +12393,15 @@ var scanSkillLibrary = (root) => {
|
|
|
12247
12393
|
|
|
12248
12394
|
// src/ssh-setup.ts
|
|
12249
12395
|
import * as fs19 from "node:fs";
|
|
12250
|
-
import * as
|
|
12396
|
+
import * as os11 from "node:os";
|
|
12251
12397
|
import * as path19 from "node:path";
|
|
12252
12398
|
|
|
12253
12399
|
// ../../packages/workspace-ssh/src/index.ts
|
|
12254
|
-
import { spawnSync as
|
|
12400
|
+
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
12255
12401
|
import { createHash as createHash3 } from "node:crypto";
|
|
12256
12402
|
import * as fs18 from "node:fs";
|
|
12257
12403
|
import { isIP as isIP3 } from "node:net";
|
|
12258
|
-
import * as
|
|
12404
|
+
import * as os10 from "node:os";
|
|
12259
12405
|
import * as path18 from "node:path";
|
|
12260
12406
|
var LEGACY_BLOCK_BEGIN = "# >>> mend workspace ssh (managed by `mend ssh setup`) >>>";
|
|
12261
12407
|
var LEGACY_BLOCK_END = "# <<< mend workspace ssh <<<";
|
|
@@ -12344,7 +12490,7 @@ var blockEnd = (alias) => `# <<< mend workspace ssh ${alias} <<<`;
|
|
|
12344
12490
|
var hasControls = (value) => /[\p{Cc}\p{Zl}\p{Zp}]/u.test(value);
|
|
12345
12491
|
var parseIdentityPath = (value) => {
|
|
12346
12492
|
const resolved = path18.resolve(
|
|
12347
|
-
value.startsWith("~/") ? path18.join(
|
|
12493
|
+
value.startsWith("~/") ? path18.join(os10.homedir(), value.slice(2)) : value
|
|
12348
12494
|
);
|
|
12349
12495
|
if (value === "" || hasControls(value) || hasControls(resolved) || value.includes("${") || resolved.includes("${")) {
|
|
12350
12496
|
return failure(
|
|
@@ -12543,7 +12689,7 @@ var workspaceSshPublicKeyFingerprint = (publicKey) => {
|
|
|
12543
12689
|
var publicKeyIdentity = (publicKey) => publicKey.trim().split(/\s+/).slice(0, 2).join(" ");
|
|
12544
12690
|
var agentKeys = () => {
|
|
12545
12691
|
if (!process.env["SSH_AUTH_SOCK"]) return [];
|
|
12546
|
-
const listed3 =
|
|
12692
|
+
const listed3 = spawnSync6("ssh-add", ["-L"], {
|
|
12547
12693
|
encoding: "utf8",
|
|
12548
12694
|
timeout: 3e3,
|
|
12549
12695
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -12571,7 +12717,7 @@ var readRequiredKey = (keyPath, source) => {
|
|
|
12571
12717
|
const privatePath = publicPath.slice(0, -".pub".length);
|
|
12572
12718
|
const read = readText(publicPath);
|
|
12573
12719
|
if (!read.ok) return read;
|
|
12574
|
-
const derived =
|
|
12720
|
+
const derived = spawnSync6("ssh-keygen", ["-y", "-P", "", "-f", privatePath], {
|
|
12575
12721
|
encoding: "utf8",
|
|
12576
12722
|
timeout: 3e3,
|
|
12577
12723
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -12631,9 +12777,9 @@ var generateDedicatedKey = (privatePath) => {
|
|
|
12631
12777
|
new WorkspaceSshError("key", `Could not create ${path18.dirname(privatePath)}.`, cause)
|
|
12632
12778
|
);
|
|
12633
12779
|
}
|
|
12634
|
-
const generated =
|
|
12780
|
+
const generated = spawnSync6(
|
|
12635
12781
|
"ssh-keygen",
|
|
12636
|
-
["-t", "ed25519", "-f", privatePath, "-N", "", "-C", `mend-${
|
|
12782
|
+
["-t", "ed25519", "-f", privatePath, "-N", "", "-C", `mend-${os10.hostname()}`],
|
|
12637
12783
|
{ encoding: "utf8", timeout: 3e3, stdio: ["ignore", "pipe", "pipe"] }
|
|
12638
12784
|
);
|
|
12639
12785
|
if (generated.status !== 0) {
|
|
@@ -12775,8 +12921,8 @@ var dim5 = ansi("2");
|
|
|
12775
12921
|
var green5 = ansi("32");
|
|
12776
12922
|
var warn = ansi("33");
|
|
12777
12923
|
var say5 = (line) => console.log(redactCredentials(line));
|
|
12778
|
-
var sshConfigPath = () => path19.join(
|
|
12779
|
-
var
|
|
12924
|
+
var sshConfigPath = () => path19.join(os11.homedir(), ".ssh", "config");
|
|
12925
|
+
var flagValue = (args, flag) => {
|
|
12780
12926
|
const index = args.indexOf(flag);
|
|
12781
12927
|
return index === -1 || args[index + 1] === void 0 ? null : String(args[index + 1]);
|
|
12782
12928
|
};
|
|
@@ -12793,7 +12939,7 @@ var showStatus = async (api2, cliHome, serverUrl, args) => {
|
|
|
12793
12939
|
const parsedTarget = parseWorkspaceSshTarget({
|
|
12794
12940
|
serverUrl,
|
|
12795
12941
|
publishedPort: view.gateway.port,
|
|
12796
|
-
hostnameOverride:
|
|
12942
|
+
hostnameOverride: flagValue(args, "--host")
|
|
12797
12943
|
});
|
|
12798
12944
|
if (parsedTarget.ok === false) return showFailure(parsedTarget.error.message);
|
|
12799
12945
|
const config = readWorkspaceSshConfig(sshConfigPath());
|
|
@@ -12830,14 +12976,14 @@ var setup = async (api2, cliHome, serverUrl, args) => {
|
|
|
12830
12976
|
const parsedTarget = parseWorkspaceSshTarget({
|
|
12831
12977
|
serverUrl,
|
|
12832
12978
|
publishedPort: view.gateway.port,
|
|
12833
|
-
hostnameOverride:
|
|
12979
|
+
hostnameOverride: flagValue(args, "--host")
|
|
12834
12980
|
});
|
|
12835
12981
|
if (parsedTarget.ok === false) return showFailure(parsedTarget.error.message);
|
|
12836
12982
|
const config = readWorkspaceSshConfig(sshConfigPath());
|
|
12837
12983
|
if (config.ok === false) return showFailure(config.error.message);
|
|
12838
12984
|
const picked = pickWorkspaceSshKey({
|
|
12839
12985
|
configHome: cliHome,
|
|
12840
|
-
explicitKeyPath:
|
|
12986
|
+
explicitKeyPath: flagValue(args, "--key"),
|
|
12841
12987
|
configuredIdentityFile: configuredWorkspaceSshIdentityFile(config.value, parsedTarget.value),
|
|
12842
12988
|
create: true
|
|
12843
12989
|
});
|
|
@@ -12845,7 +12991,7 @@ var setup = async (api2, cliHome, serverUrl, args) => {
|
|
|
12845
12991
|
if (picked.value === null) return showFailure("No workspace SSH key is available.");
|
|
12846
12992
|
const registered = await api2("POST", "/workspace-ssh/keys", {
|
|
12847
12993
|
publicKey: picked.value.publicKey,
|
|
12848
|
-
name:
|
|
12994
|
+
name: os11.hostname()
|
|
12849
12995
|
});
|
|
12850
12996
|
const sourceLabel = {
|
|
12851
12997
|
explicit: "from --key",
|
|
@@ -12886,7 +13032,7 @@ var sessionSsh = async (api2, cliHome, serverUrl, session, args) => {
|
|
|
12886
13032
|
const parsedTarget = parseWorkspaceSshTarget({
|
|
12887
13033
|
serverUrl,
|
|
12888
13034
|
publishedPort: view.gateway.port,
|
|
12889
|
-
hostnameOverride:
|
|
13035
|
+
hostnameOverride: flagValue(args, "--host")
|
|
12890
13036
|
});
|
|
12891
13037
|
if (parsedTarget.ok === false) return showFailure(parsedTarget.error.message);
|
|
12892
13038
|
console.log(
|
|
@@ -13115,7 +13261,7 @@ var sshCommand = async (args, api2, cliHome, serverUrl, findSession2) => {
|
|
|
13115
13261
|
|
|
13116
13262
|
// src/uninstall.ts
|
|
13117
13263
|
import * as fs20 from "node:fs";
|
|
13118
|
-
import * as
|
|
13264
|
+
import * as os12 from "node:os";
|
|
13119
13265
|
import * as path20 from "node:path";
|
|
13120
13266
|
var UNINSTALL_USAGE = "usage: mend uninstall [--all | --server | --home] [--yes]";
|
|
13121
13267
|
var parseUninstallArgs = (args) => {
|
|
@@ -13200,7 +13346,7 @@ var sshBlockOwned = (owners) => (block) => {
|
|
|
13200
13346
|
};
|
|
13201
13347
|
var blockLabel = (block) => `Host ${block.alias}${block.hostname === null ? "" : ` \u2192 ${block.hostname}${block.port === null ? "" : `:${block.port}`}`}`;
|
|
13202
13348
|
var within = (directory, file) => {
|
|
13203
|
-
const resolved = file.startsWith("~/") ? path20.join(
|
|
13349
|
+
const resolved = file.startsWith("~/") ? path20.join(os12.homedir(), file.slice(2)) : file;
|
|
13204
13350
|
const relative6 = path20.relative(directory, resolved);
|
|
13205
13351
|
return relative6 !== "" && !relative6.startsWith("..") && !path20.isAbsolute(relative6);
|
|
13206
13352
|
};
|
|
@@ -13315,6 +13461,60 @@ var findWorkspaces = async (run2, context, controlVolume) => {
|
|
|
13315
13461
|
images: [...images]
|
|
13316
13462
|
};
|
|
13317
13463
|
};
|
|
13464
|
+
var serverServices = (plan) => [
|
|
13465
|
+
"mend",
|
|
13466
|
+
"postgres",
|
|
13467
|
+
"garage",
|
|
13468
|
+
...plan.edgeHost == null ? [] : ["edge"],
|
|
13469
|
+
...plan.mirrors ?? []
|
|
13470
|
+
];
|
|
13471
|
+
var composeServices = async (run2, target) => {
|
|
13472
|
+
const listed3 = await run2("docker", serverComposeArgs(target, ["ps", "--all", "--services"]), {
|
|
13473
|
+
timeoutMs: DOCKER_DEADLINE_MS
|
|
13474
|
+
});
|
|
13475
|
+
if (listed3.status !== 0) return null;
|
|
13476
|
+
const order = ["mend", "postgres", "garage", "edge", "npm-mirror", "docker-mirror"];
|
|
13477
|
+
const rank = (service) => {
|
|
13478
|
+
const at = order.indexOf(service);
|
|
13479
|
+
return at === -1 ? order.length : at;
|
|
13480
|
+
};
|
|
13481
|
+
return [
|
|
13482
|
+
...new Set(
|
|
13483
|
+
rows(listed3.stdout).map(([service]) => service ?? "").filter((service) => DOCKER_NAME.test(service))
|
|
13484
|
+
)
|
|
13485
|
+
].toSorted((a, b) => rank(a) - rank(b));
|
|
13486
|
+
};
|
|
13487
|
+
var serverVolumes = (plan) => [
|
|
13488
|
+
MEND_DOCKER_NAMESPACE_WITH_GARAGE.store,
|
|
13489
|
+
...secondaryVolumesOf(MEND_DOCKER_NAMESPACE_WITH_GARAGE),
|
|
13490
|
+
"mend-config",
|
|
13491
|
+
"mend-ssh",
|
|
13492
|
+
"mend-postgres",
|
|
13493
|
+
...plan.edgeHost === null ? [] : ["mend-edge-data", "mend-edge-config"],
|
|
13494
|
+
...(plan.mirrors ?? []).map((service) => `mend-${service}`),
|
|
13495
|
+
// The t3code gateway's state, with paired people's device tokens, when it is there.
|
|
13496
|
+
...plan.t3GatewayVolume === true ? [T3_GATEWAY_VOLUME] : []
|
|
13497
|
+
];
|
|
13498
|
+
var serverPresent = async (run2, target, volumes, image) => {
|
|
13499
|
+
const containers = await composeServices(run2, target);
|
|
13500
|
+
const listed3 = await listNamesIn(run2, target.dockerContext, "volume", []);
|
|
13501
|
+
if (containers === null || "problem" in listed3) return void 0;
|
|
13502
|
+
const inspected = await dockerIn(run2, target.dockerContext, [
|
|
13503
|
+
"image",
|
|
13504
|
+
"inspect",
|
|
13505
|
+
image,
|
|
13506
|
+
"--format",
|
|
13507
|
+
"{{.Id}}"
|
|
13508
|
+
]);
|
|
13509
|
+
return {
|
|
13510
|
+
containers,
|
|
13511
|
+
volumes: volumes.filter(
|
|
13512
|
+
(name) => listed3.includes(name) || listed3.includes(`${MEND_DOCKER_NAMESPACE.project}_${name}`)
|
|
13513
|
+
),
|
|
13514
|
+
// Unknown is not gone: only Docker saying there is no such image leaves it out.
|
|
13515
|
+
image: inspected.status === 0 || !notFound(inspected)
|
|
13516
|
+
};
|
|
13517
|
+
};
|
|
13318
13518
|
var readLeft = (configDir) => {
|
|
13319
13519
|
try {
|
|
13320
13520
|
const parsed = JSON.parse(fs20.readFileSync(path20.join(configDir, LEFT_FILE), "utf8"));
|
|
@@ -13503,8 +13703,19 @@ var describeUninstall = async (runtime, scope) => {
|
|
|
13503
13703
|
let holdings = NO_HOLDINGS;
|
|
13504
13704
|
let t3GatewayVolume = config.t3GatewayPort !== void 0;
|
|
13505
13705
|
let extras;
|
|
13706
|
+
let present;
|
|
13506
13707
|
if (dockerProblem === null) {
|
|
13507
13708
|
t3GatewayVolume ||= (await volumeOwner(run2, context, `mend_${T3_GATEWAY_VOLUME}`)).state === "present";
|
|
13709
|
+
present = await serverPresent(
|
|
13710
|
+
run2,
|
|
13711
|
+
{ directory, dockerContext: context, overlays: composeOverlays(config) },
|
|
13712
|
+
serverVolumes({
|
|
13713
|
+
edgeHost: config.edgeHost ?? null,
|
|
13714
|
+
mirrors: mirrorServices(config.mirrors),
|
|
13715
|
+
t3GatewayVolume
|
|
13716
|
+
}),
|
|
13717
|
+
`ghcr.io/sealant-sh/mend:${config.serverVersion}`
|
|
13718
|
+
);
|
|
13508
13719
|
const control = await volumeOwner(run2, context, MEND_DOCKER_NAMESPACE.control);
|
|
13509
13720
|
const owner = read.value.identity === null ? null : serverVolumeOwner(Buffer.from(read.value.identity));
|
|
13510
13721
|
if (control.state === "present" && owner !== null && control.owner === owner) {
|
|
@@ -13531,6 +13742,9 @@ var describeUninstall = async (runtime, scope) => {
|
|
|
13531
13742
|
const candidates = [
|
|
13532
13743
|
...composed.status === 0 ? composed.stdout.split(/\s+/) : [],
|
|
13533
13744
|
...guard.status === 0 ? [guard.stdout.trim()] : [],
|
|
13745
|
+
// By its pin too: a re-run after a partial uninstall no longer has the Mend image,
|
|
13746
|
+
// and so no label to read it from.
|
|
13747
|
+
NETWORK_GUARD_IMAGE,
|
|
13534
13748
|
DOCKER_SERVICE_IMAGE,
|
|
13535
13749
|
// The edge's image stays after `--no-edge`, when the overlay no longer names it.
|
|
13536
13750
|
EDGE_IMAGE,
|
|
@@ -13558,7 +13772,8 @@ var describeUninstall = async (runtime, scope) => {
|
|
|
13558
13772
|
dockerProblem,
|
|
13559
13773
|
holdings,
|
|
13560
13774
|
leftByEarlier: readLeft(configDir),
|
|
13561
|
-
...extras === void 0 ? {} : { extras }
|
|
13775
|
+
...extras === void 0 ? {} : { extras },
|
|
13776
|
+
...present === void 0 ? {} : { present }
|
|
13562
13777
|
};
|
|
13563
13778
|
}
|
|
13564
13779
|
}
|
|
@@ -13635,17 +13850,17 @@ var planLines = (plan, configDir) => {
|
|
|
13635
13850
|
`server Mend ${version}${appUrl === "" ? "" : ` at ${appUrl}`}${dockerContext === "" ? "" : ` \xB7 docker context ${dockerContext}`}`
|
|
13636
13851
|
);
|
|
13637
13852
|
if (dockerContext !== "") {
|
|
13638
|
-
const
|
|
13639
|
-
const
|
|
13640
|
-
const
|
|
13641
|
-
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
...
|
|
13853
|
+
const present = plan.server.present;
|
|
13854
|
+
const containers = present?.containers ?? serverServices(plan.server);
|
|
13855
|
+
const volumes = present?.volumes ?? serverVolumes(plan.server);
|
|
13856
|
+
const image = present === void 0 || present.image;
|
|
13857
|
+
const parts = [
|
|
13858
|
+
...containers.length === 0 ? [] : [`containers ${containers.join(", ")}`],
|
|
13859
|
+
...volumes.length === 0 ? [] : [`volumes ${volumes.join(", ")}`],
|
|
13860
|
+
...image ? [`image ghcr.io/sealant-sh/mend:${version}`] : [],
|
|
13861
|
+
...edgeHost === null ? [] : [`the edge for ${edgeHost}`]
|
|
13645
13862
|
];
|
|
13646
|
-
lines.push(
|
|
13647
|
-
` containers ${["mend", "postgres", "garage", ...edge].join(", ")} \xB7 volumes ${[MEND_DOCKER_NAMESPACE_WITH_GARAGE.store, ...secondaryVolumesOf(MEND_DOCKER_NAMESPACE_WITH_GARAGE), "mend-config", "mend-ssh", "mend-postgres", ...edgeVolumes].join(", ")} \xB7 image ghcr.io/sealant-sh/mend:${version}${edgeHost === null ? "" : ` \xB7 the edge for ${edgeHost}`}`
|
|
13648
|
-
);
|
|
13863
|
+
if (parts.length > 0) lines.push(` ${parts.join(" \xB7 ")}`);
|
|
13649
13864
|
}
|
|
13650
13865
|
lines.push(
|
|
13651
13866
|
` ${configDir}: identity.env, active, ${plural(generations, "generation")}, ${plural(backups, "backup")}`
|
|
@@ -13707,7 +13922,7 @@ var planLines = (plan, configDir) => {
|
|
|
13707
13922
|
};
|
|
13708
13923
|
var planDeletesData = (plan) => plan.server !== null && plan.server !== "none";
|
|
13709
13924
|
var planIsEmpty = (plan) => (plan.server === null || plan.server === "none") && (plan.home === null || plan.home.cliConfig === null && plan.home.sshDirectory === null && plan.home.sshBlocks.length === 0);
|
|
13710
|
-
var
|
|
13925
|
+
var removeWorkspaceContainers = async (run2, context, holdings, report) => {
|
|
13711
13926
|
const left = [];
|
|
13712
13927
|
const containers = [
|
|
13713
13928
|
...holdings.workspaces.map((workspace) => workspace.name),
|
|
@@ -13732,8 +13947,12 @@ var removeWorkspaces = async (run2, context, holdings, report) => {
|
|
|
13732
13947
|
`removed ${plural(removed.length, "workspace container")}${live > 0 ? `, ${live} of them live` : ""}, with their volumes (${listOf(removed)})`
|
|
13733
13948
|
);
|
|
13734
13949
|
}
|
|
13950
|
+
return left;
|
|
13951
|
+
};
|
|
13952
|
+
var removeWorkspaceNetworks = async (run2, context, names, report) => {
|
|
13953
|
+
const left = [];
|
|
13735
13954
|
const networks = [];
|
|
13736
|
-
for (const name of
|
|
13955
|
+
for (const name of names) {
|
|
13737
13956
|
const gone = await dockerIn(run2, context, ["network", "rm", name]);
|
|
13738
13957
|
if (gone.status === 0 || notFound(gone)) networks.push(name);
|
|
13739
13958
|
else {
|
|
@@ -13805,6 +14024,7 @@ var removeServer = async (runtime, plan, report) => {
|
|
|
13805
14024
|
const control = await volumeOwner(run2, context, namespace.control);
|
|
13806
14025
|
return control.state === "present" && owner !== null && control.owner === owner;
|
|
13807
14026
|
};
|
|
14027
|
+
const workspaceNetworks = /* @__PURE__ */ new Set();
|
|
13808
14028
|
const sweepWorkspaces = async () => {
|
|
13809
14029
|
if (!await controlIsOurs()) return;
|
|
13810
14030
|
const found = await findWorkspaces(run2, context, namespace.control);
|
|
@@ -13812,19 +14032,22 @@ var removeServer = async (runtime, plan, report) => {
|
|
|
13812
14032
|
report.failures.push(`could not list the installation's workspaces: ${found.problem}`);
|
|
13813
14033
|
return;
|
|
13814
14034
|
}
|
|
13815
|
-
left.push(...await
|
|
14035
|
+
left.push(...await removeWorkspaceContainers(run2, context, found, report));
|
|
14036
|
+
for (const name of found.networks) workspaceNetworks.add(name);
|
|
13816
14037
|
};
|
|
13817
14038
|
const target = {
|
|
13818
14039
|
directory: installation.directory,
|
|
13819
14040
|
dockerContext: context,
|
|
13820
14041
|
overlays: composeOverlays(installation.config)
|
|
13821
14042
|
};
|
|
14043
|
+
const services = await composeServices(run2, target);
|
|
13822
14044
|
await run2("docker", serverComposeArgs(target, ["stop", "--timeout", "30", "mend"]), {
|
|
13823
14045
|
timeoutMs: serverProcessDeadlines.stop
|
|
13824
14046
|
});
|
|
13825
14047
|
await sweepWorkspaces();
|
|
13826
14048
|
const pending = await pendingHoldings(run2, context, plan.leftByEarlier ?? []);
|
|
13827
|
-
left.push(...await
|
|
14049
|
+
left.push(...await removeWorkspaceContainers(run2, context, pending.holdings, report));
|
|
14050
|
+
for (const name of pending.holdings.networks) workspaceNetworks.add(name);
|
|
13828
14051
|
const down = await run2(
|
|
13829
14052
|
"docker",
|
|
13830
14053
|
serverComposeArgs(target, ["down", "--volumes", "--remove-orphans", "--timeout", "30"]),
|
|
@@ -13835,10 +14058,17 @@ var removeServer = async (runtime, plan, report) => {
|
|
|
13835
14058
|
`Docker did not take the server down (docker compose down: ${detail(down)}). Its volumes and files are kept; run mend uninstall again once Docker answers.`
|
|
13836
14059
|
);
|
|
13837
14060
|
}
|
|
13838
|
-
|
|
13839
|
-
|
|
13840
|
-
|
|
14061
|
+
const containers = services ?? serverServices({
|
|
14062
|
+
edgeHost: installation.config.edgeHost,
|
|
14063
|
+
mirrors: mirrorServices(installation.config.mirrors)
|
|
14064
|
+
});
|
|
14065
|
+
if (containers.length > 0) {
|
|
14066
|
+
server.writeLine(
|
|
14067
|
+
`removed containers ${containers.join(", ")} and the Compose-owned volumes`
|
|
14068
|
+
);
|
|
14069
|
+
}
|
|
13841
14070
|
await sweepWorkspaces();
|
|
14071
|
+
left.push(...await removeWorkspaceNetworks(run2, context, [...workspaceNetworks], report));
|
|
13842
14072
|
const compose = `label=com.docker.compose.project=${MEND_DOCKER_NAMESPACE.project}`;
|
|
13843
14073
|
const networks = await listNamesIn(run2, context, "network", [compose]);
|
|
13844
14074
|
if ("problem" in networks) {
|
|
@@ -13944,7 +14174,8 @@ var removeLeftovers = async (runtime, plan, report) => {
|
|
|
13944
14174
|
report.failures.push(`could not remove container ${name}: ${detail(gone)}`);
|
|
13945
14175
|
}
|
|
13946
14176
|
}
|
|
13947
|
-
left.push(...await
|
|
14177
|
+
left.push(...await removeWorkspaceContainers(run2, context, plan.holdings, report));
|
|
14178
|
+
left.push(...await removeWorkspaceNetworks(run2, context, plan.holdings.networks, report));
|
|
13948
14179
|
left.push(...await removeEach(run2, context, "network", plan.networks, report));
|
|
13949
14180
|
const volumes = [];
|
|
13950
14181
|
for (const name of plan.volumes) {
|
|
@@ -14026,6 +14257,22 @@ var removeHostExtras = async (runtime, context, extras, report) => {
|
|
|
14026
14257
|
}
|
|
14027
14258
|
if (refused.length > 0) report.remaining.push(plural(refused.length, "image"));
|
|
14028
14259
|
};
|
|
14260
|
+
var notReachedExtras = (extras) => [
|
|
14261
|
+
...extras.images.length === 0 ? [] : [`${plural(extras.images.length, "image")} (${listOf(extras.images, 4)})`],
|
|
14262
|
+
...extras.sysctl.state === "mend" ? [HOST_USER_NAMESPACE_SYSCTL_FILE] : []
|
|
14263
|
+
];
|
|
14264
|
+
var settleBuildCache = async (runtime, context, size, clear, outcome) => {
|
|
14265
|
+
const prune = `docker --context ${context} builder prune --all removes it`;
|
|
14266
|
+
if (!clear) return { kind: "kept", line: `Docker's build cache, ${size}: ${prune}` };
|
|
14267
|
+
if (outcome.failures.length > 0) {
|
|
14268
|
+
return {
|
|
14269
|
+
kind: "not reached",
|
|
14270
|
+
line: `Docker's build cache, ${size}: the uninstall stopped before it; run mend uninstall again, or ${prune}`
|
|
14271
|
+
};
|
|
14272
|
+
}
|
|
14273
|
+
const problem = await clearBuildCache(runtime, context);
|
|
14274
|
+
return problem === null ? { kind: "removed", line: `removed Docker's build cache (${size})` } : { kind: "kept", line: `Docker's build cache, ${size} (${problem}): ${prune}` };
|
|
14275
|
+
};
|
|
14029
14276
|
var clearBuildCache = async (runtime, context) => {
|
|
14030
14277
|
const pruned = await dockerIn(
|
|
14031
14278
|
runtime.server.run,
|
|
@@ -14132,10 +14379,12 @@ var executeUninstall = async (runtime, plan) => {
|
|
|
14132
14379
|
leftovers: [],
|
|
14133
14380
|
remaining: []
|
|
14134
14381
|
};
|
|
14382
|
+
const notReached = [];
|
|
14135
14383
|
const done = () => ({
|
|
14136
14384
|
failures: report.failures,
|
|
14137
14385
|
leftovers: report.leftovers,
|
|
14138
|
-
remaining: report.remaining
|
|
14386
|
+
remaining: report.remaining,
|
|
14387
|
+
...notReached.length === 0 ? {} : { notReached }
|
|
14139
14388
|
});
|
|
14140
14389
|
const refusal = planRefusal(plan);
|
|
14141
14390
|
if (refusal !== null) {
|
|
@@ -14149,6 +14398,8 @@ var executeUninstall = async (runtime, plan) => {
|
|
|
14149
14398
|
serverGone = true;
|
|
14150
14399
|
if (server === "removed" && plan.server.extras !== void 0) {
|
|
14151
14400
|
await removeHostExtras(runtime, plan.server.dockerContext, plan.server.extras, report);
|
|
14401
|
+
} else if (plan.server.extras !== void 0) {
|
|
14402
|
+
notReached.push(...notReachedExtras(plan.server.extras));
|
|
14152
14403
|
}
|
|
14153
14404
|
} else if (isLeftovers(plan.server)) {
|
|
14154
14405
|
await removeLeftovers(runtime, plan.server, report);
|
|
@@ -14349,10 +14600,10 @@ var worktreesRmCommand = async (deps, argv) => {
|
|
|
14349
14600
|
var mendCliHome = () => {
|
|
14350
14601
|
const xdg = process.env["XDG_CONFIG_HOME"];
|
|
14351
14602
|
const preferred = path21.join(
|
|
14352
|
-
xdg === void 0 || xdg === "" ? path21.join(
|
|
14603
|
+
xdg === void 0 || xdg === "" ? path21.join(os13.homedir(), ".config") : xdg,
|
|
14353
14604
|
"mend"
|
|
14354
14605
|
);
|
|
14355
|
-
const legacy = path21.join(
|
|
14606
|
+
const legacy = path21.join(os13.homedir(), ".mend");
|
|
14356
14607
|
return !fs21.existsSync(preferred) && fs21.existsSync(legacy) ? legacy : preferred;
|
|
14357
14608
|
};
|
|
14358
14609
|
var CONFIG_PATH = path21.join(mendCliHome(), "cli.json");
|
|
@@ -14551,10 +14802,10 @@ var withSpinner = async (label, work) => {
|
|
|
14551
14802
|
const started = Date.now();
|
|
14552
14803
|
let frame = 0;
|
|
14553
14804
|
const timer = setInterval(() => {
|
|
14554
|
-
const
|
|
14805
|
+
const seconds = Math.round((Date.now() - started) / 1e3);
|
|
14555
14806
|
const text = typeof label === "string" ? label : label();
|
|
14556
14807
|
chrome.write(
|
|
14557
|
-
`\r\x1B[2K ${frames[frame % frames.length]} ${redactCredentials(text)} ${dim7(`${
|
|
14808
|
+
`\r\x1B[2K ${frames[frame % frames.length]} ${redactCredentials(text)} ${dim7(`${seconds}s`)} `
|
|
14558
14809
|
);
|
|
14559
14810
|
frame += 1;
|
|
14560
14811
|
}, 120);
|
|
@@ -16221,7 +16472,7 @@ var secretsCommand = async (config, args) => {
|
|
|
16221
16472
|
if (verb === "add" || verb === "rm") {
|
|
16222
16473
|
const given = rest.find((arg, index) => !arg.startsWith("--") && rest[index - 1] !== "--from");
|
|
16223
16474
|
if (given === void 0) return fail7(usageOf(`secrets ${verb}`));
|
|
16224
|
-
const resolved = secretFilePathOf(given,
|
|
16475
|
+
const resolved = secretFilePathOf(given, os13.homedir());
|
|
16225
16476
|
if (resolved.issue !== null) return fail7(resolved.issue);
|
|
16226
16477
|
if (verb === "rm") {
|
|
16227
16478
|
const removed = await api(
|
|
@@ -16267,7 +16518,7 @@ var secretsCommand = async (config, args) => {
|
|
|
16267
16518
|
var isProvider = (value) => value === "claude" || value === "codex" || value === "github";
|
|
16268
16519
|
var readIfExists = (file) => fs21.existsSync(file) ? fs21.readFileSync(file, "utf8") : null;
|
|
16269
16520
|
var localCredential = (provider) => {
|
|
16270
|
-
const home =
|
|
16521
|
+
const home = os13.homedir();
|
|
16271
16522
|
switch (provider) {
|
|
16272
16523
|
case "codex":
|
|
16273
16524
|
return readIfExists(
|
|
@@ -16281,7 +16532,7 @@ var localCredential = (provider) => {
|
|
|
16281
16532
|
)
|
|
16282
16533
|
);
|
|
16283
16534
|
case "github": {
|
|
16284
|
-
const result =
|
|
16535
|
+
const result = spawnSync7("gh", ["auth", "token"], { encoding: "utf8" });
|
|
16285
16536
|
const token = result.status === 0 ? result.stdout.trim() : "";
|
|
16286
16537
|
return token === "" ? null : token;
|
|
16287
16538
|
}
|
|
@@ -16619,7 +16870,7 @@ var uninstallCommand = async (config, args) => {
|
|
|
16619
16870
|
const runtime = {
|
|
16620
16871
|
server,
|
|
16621
16872
|
cliHome: mendCliHome(),
|
|
16622
|
-
sshConfigFile: path21.join(
|
|
16873
|
+
sshConfigFile: path21.join(os13.homedir(), ".ssh", "config"),
|
|
16623
16874
|
signedIn: config.token === null || !fs21.existsSync(CONFIG_PATH) ? null : { url: config.url, deviceId: config.deviceId },
|
|
16624
16875
|
revokeDevice: async () => {
|
|
16625
16876
|
if (config.deviceId === null) return "no device id saved";
|
|
@@ -16664,19 +16915,24 @@ var uninstallCommand = async (config, args) => {
|
|
|
16664
16915
|
const outcome = await executeUninstall(runtime, plan);
|
|
16665
16916
|
const remaining = [...outcome.remaining];
|
|
16666
16917
|
const leftovers = [...outcome.leftovers];
|
|
16918
|
+
const notReached = [...outcome.notReached ?? []];
|
|
16667
16919
|
if (extras?.buildCache != null && plan.server !== null && plan.server !== "none" && !("kind" in plan.server)) {
|
|
16668
|
-
const
|
|
16669
|
-
|
|
16670
|
-
|
|
16920
|
+
const cache = await settleBuildCache(
|
|
16921
|
+
runtime,
|
|
16922
|
+
plan.server.dockerContext,
|
|
16923
|
+
extras.buildCache,
|
|
16924
|
+
clearCache,
|
|
16925
|
+
outcome
|
|
16926
|
+
);
|
|
16927
|
+
if (cache.kind === "removed") say7(cache.line);
|
|
16671
16928
|
else {
|
|
16672
|
-
leftovers.push(
|
|
16673
|
-
`Docker's build cache, ${extras.buildCache}${problem === "kept" ? "" : ` (${problem})`}: docker --context ${context} builder prune --all removes it`
|
|
16674
|
-
);
|
|
16929
|
+
(cache.kind === "kept" ? leftovers : notReached).push(cache.line);
|
|
16675
16930
|
remaining.push(`Docker's build cache (${extras.buildCache})`);
|
|
16676
16931
|
}
|
|
16677
16932
|
}
|
|
16678
16933
|
if (scope === "all") remaining.push("the mend CLI itself (npm uninstall -g @sealant/mend)");
|
|
16679
16934
|
for (const line of leftovers) say7(dim7(` kept \xB7 ${line}`));
|
|
16935
|
+
for (const line of notReached) say7(dim7(` not reached \xB7 ${line}`));
|
|
16680
16936
|
if (outcome.failures.length > 0) {
|
|
16681
16937
|
return fail7(outcome.failures.join("\n"));
|
|
16682
16938
|
}
|
|
@@ -16714,7 +16970,7 @@ var keysShare = async (config) => {
|
|
|
16714
16970
|
return fail7("SSH_AUTH_SOCK is not set \u2014 start (or plug in) your ssh-agent first");
|
|
16715
16971
|
}
|
|
16716
16972
|
await shareAgent({
|
|
16717
|
-
url: () => socketUrl(config, "keys-bridge", { host:
|
|
16973
|
+
url: () => socketUrl(config, "keys-bridge", { host: os13.hostname() }),
|
|
16718
16974
|
agentSock,
|
|
16719
16975
|
signal: new AbortController().signal,
|
|
16720
16976
|
onEvent: (event) => {
|
|
@@ -16844,7 +17100,7 @@ ${usageOf("dotfiles repo")}`);
|
|
|
16844
17100
|
var dotfilesSync = async (config, args) => {
|
|
16845
17101
|
const all = args.includes("--all");
|
|
16846
17102
|
const requestedPaths = args.filter((arg) => !arg.startsWith("--"));
|
|
16847
|
-
const home =
|
|
17103
|
+
const home = os13.homedir();
|
|
16848
17104
|
if (!all && requestedPaths.length === 0) {
|
|
16849
17105
|
const found = scanDotfileCandidates(home);
|
|
16850
17106
|
if (found.length === 0) {
|
|
@@ -16871,13 +17127,13 @@ var dotfilesSync = async (config, args) => {
|
|
|
16871
17127
|
if ("error" in read) return fail7(read.error);
|
|
16872
17128
|
const result = await api(config, "POST", "/dotfiles/snapshot", {
|
|
16873
17129
|
files: read.files,
|
|
16874
|
-
source:
|
|
17130
|
+
source: os13.hostname(),
|
|
16875
17131
|
merge: false
|
|
16876
17132
|
});
|
|
16877
17133
|
const snapshot = result.snapshot;
|
|
16878
17134
|
if (snapshot === null) return fail7("the server accepted the sync but reports no snapshot");
|
|
16879
17135
|
say7(
|
|
16880
|
-
`${green7("synced")} ${snapshot.files.length} file${snapshot.files.length === 1 ? "" : "s"} from ${
|
|
17136
|
+
`${green7("synced")} ${snapshot.files.length} file${snapshot.files.length === 1 ? "" : "s"} from ${os13.hostname()} \xB7 ${dim7(snapshot.sha.slice(0, 7))} ${dim7("\u2014 applies from the next session launch")}`
|
|
16881
17137
|
);
|
|
16882
17138
|
};
|
|
16883
17139
|
var envLoad = async (config, args) => {
|
|
@@ -17104,7 +17360,7 @@ var skillsList = async (config, args) => {
|
|
|
17104
17360
|
};
|
|
17105
17361
|
var skillsPush = async (config, args) => {
|
|
17106
17362
|
const dirFlag = takeFlagValue4(args, "--dir");
|
|
17107
|
-
const root = dirFlag === null ? path21.join(
|
|
17363
|
+
const root = dirFlag === null ? path21.join(os13.homedir(), DEFAULT_SKILLS_DIR) : path21.resolve(dirFlag);
|
|
17108
17364
|
const scanned = scanSkillLibrary(root);
|
|
17109
17365
|
if ("error" in scanned) return fail7(scanned.error);
|
|
17110
17366
|
for (const note of scanned.notes) say7(dim7(` ${note.skill}: ${note.message}`));
|
|
@@ -18111,14 +18367,14 @@ var dashboard = async (config, options = {}) => {
|
|
|
18111
18367
|
`the dashboard needs Node >= 26 (node:ffi) \u2014 this is ${process.version}; every other command still works`
|
|
18112
18368
|
);
|
|
18113
18369
|
}
|
|
18114
|
-
const rerun =
|
|
18370
|
+
const rerun = spawnSync7(
|
|
18115
18371
|
process.execPath,
|
|
18116
18372
|
["--experimental-ffi", "--disable-warning=ExperimentalWarning", ...process.argv.slice(1)],
|
|
18117
18373
|
{ stdio: "inherit" }
|
|
18118
18374
|
);
|
|
18119
18375
|
process.exit(rerun.status ?? 0);
|
|
18120
18376
|
}
|
|
18121
|
-
const { runDashboard } = await import("./dashboard-
|
|
18377
|
+
const { runDashboard } = await import("./dashboard-HLZJXTKG.js");
|
|
18122
18378
|
const agentShare = await startShareIfBridge(config);
|
|
18123
18379
|
const tunnels = options.noTunnel === true || serverIsLocal(config) ? null : createServiceTunnels({
|
|
18124
18380
|
listServices: () => fetchServices(config),
|
|
@@ -18152,7 +18408,7 @@ var startShareIfBridge = async (config) => {
|
|
|
18152
18408
|
}
|
|
18153
18409
|
if (access.mode !== "bridge") return null;
|
|
18154
18410
|
return startAgentShare({
|
|
18155
|
-
url: () => socketUrl(config, "keys-bridge", { host:
|
|
18411
|
+
url: () => socketUrl(config, "keys-bridge", { host: os13.hostname() }),
|
|
18156
18412
|
agentSock
|
|
18157
18413
|
});
|
|
18158
18414
|
};
|
|
@@ -18192,9 +18448,9 @@ var manCommand = (words) => {
|
|
|
18192
18448
|
}
|
|
18193
18449
|
const version = cliVersion();
|
|
18194
18450
|
const page = doc === null ? renderManIndex(version) : renderManPage(doc, version);
|
|
18195
|
-
const file = path21.join(
|
|
18451
|
+
const file = path21.join(os13.tmpdir(), `mend-man-${process.pid}-${manFileName(doc)}`);
|
|
18196
18452
|
fs21.writeFileSync(file, page);
|
|
18197
|
-
const result =
|
|
18453
|
+
const result = spawnSync7("man", ["-l", file], { stdio: "inherit" });
|
|
18198
18454
|
fs21.rmSync(file, { force: true });
|
|
18199
18455
|
if (result.error !== void 0 || result.status !== 0) {
|
|
18200
18456
|
sayPage(doc === null ? renderIndex() : renderCommand(doc));
|