First run: friendly empty lists, actionable unreachable server, clearer installer
- CLI: empty list/runs/drafts/skills say so on stderr with the next command (stdout and --json unchanged); empty stats skip the zero table; connection shows ntfy not configured. - CLI: a refused or unresolvable server says where it dialled and how to start it (pipelines start/doctor, or pipelines serve), redacting the URL. - skills list/show/import dial the saved client.json address like every other server command instead of always 127.0.0.1:8080. - Status: an unreachable server says how to start it; unconfigured ntfy reads as optional phone notifications rather than a Docker misconfiguration. - Installer: missing tools name where to get them; Docker missing vs not running are told apart; the summary ends with numbered next steps (open the URL, sign in with the password just chosen, set up harnesses, start a chat or example pipeline). - README: prerequisites, password and a short First steps; install docs updated (password rule was stale). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+38
-11
@@ -52,6 +52,15 @@ MARKER = "pipelines-install.json"
|
||||
LABEL = "net.a-wan.pipelines"
|
||||
SERVICE_MARKER = "Managed by Pipelines native installer"
|
||||
REQUIRED_TOOLS = ("go", "python3", "git", "curl", "node")
|
||||
# Where a missing prerequisite comes from; the installer itself never installs it.
|
||||
TOOL_SOURCES = {
|
||||
"go": "Go: https://go.dev/dl/",
|
||||
"python3": "Python 3.9 or newer: https://www.python.org/downloads/",
|
||||
"git": "git: your package manager (Xcode Command Line Tools on macOS)",
|
||||
"curl": "curl: your package manager",
|
||||
"node": "Node.js 18 or newer: https://nodejs.org/ (or your package manager)",
|
||||
}
|
||||
DOCKER_SOURCE = "https://docs.docker.com/get-docker/ (Docker Desktop on macOS)"
|
||||
# ntfy's SQLite driver (mattn/go-sqlite3) is cgo, so a C compiler is required to
|
||||
# build the server. Upstream's macOS release asset is client-only, so both
|
||||
# platforms compile ntfy from the pinned Go module.
|
||||
@@ -119,8 +128,9 @@ class Setup:
|
||||
missing.append(tool)
|
||||
if missing:
|
||||
raise ValueError(
|
||||
"Missing required tool(s): " + ", ".join(missing)
|
||||
+ ". Install them yourself and rerun; this installer never installs tools or uses a package manager.")
|
||||
"Missing required tool(s): " + ", ".join(missing) + ". Install them, then rerun ./install:\n"
|
||||
+ "".join(f" - {TOOL_SOURCES.get(tool, tool)}\n" for tool in missing)
|
||||
+ "(this installer never installs tools or uses a package manager)")
|
||||
return found["python3"]
|
||||
|
||||
def harness(self):
|
||||
@@ -369,7 +379,8 @@ class Setup:
|
||||
except (ValueError, AttributeError):
|
||||
major = 0
|
||||
if version.returncode or major < 18:
|
||||
raise ValueError("Node.js 18 or newer is required for the authenticated web proxy")
|
||||
raise ValueError("Node.js 18 or newer is required for the authenticated web proxy; "
|
||||
f"install it ({TOOL_SOURCES['node']}) and rerun ./install")
|
||||
# Reuse the proxy's existing credential location; never disable its gate.
|
||||
auth = Path(self.environ.get("PIPELINES_WEB_AUTH_FILE")
|
||||
or Path.home() / ".config/pipelines/web-auth.json").expanduser().resolve()
|
||||
@@ -427,7 +438,8 @@ class Setup:
|
||||
if not sys.stdin.isatty():
|
||||
raise ValueError("Choose the web sign-in password: rerun ./install in a terminal, "
|
||||
"or set PIPELINES_WEB_PASSWORD. " + web_password.PASSWORD_RULE)
|
||||
print("This computer has no web sign-in yet. Choose the password for the web app and phone.")
|
||||
print("Choose the password for signing in to the Pipelines web app (and the phone app).")
|
||||
print("You will need it right after this install; only a hash of it is stored.")
|
||||
print(web_password.PASSWORD_RULE)
|
||||
while True:
|
||||
first = getpass.getpass("Web password: ")
|
||||
@@ -445,8 +457,12 @@ class Setup:
|
||||
unchanged). The web app ships with the server: the install stops here,
|
||||
before anything is replaced, when it cannot be built."""
|
||||
if not app_build.docker_available(self.runner):
|
||||
raise ValueError("Docker is not running, so the web app cannot be built. The server is never "
|
||||
"installed without it; start Docker and rerun ./install.")
|
||||
if not shutil.which("docker"):
|
||||
raise ValueError("Docker is required to build the web app but was not found on PATH. "
|
||||
f"Install it ({DOCKER_SOURCE}), start it, and rerun ./install. Nothing was installed.")
|
||||
raise ValueError("Docker is installed but not running, or this user cannot use it, so the web app "
|
||||
"cannot be built. Start Docker (Linux: systemctl start docker, and add yourself "
|
||||
"to the docker group) and rerun ./install. Nothing was installed.")
|
||||
try:
|
||||
built = app_build.build("web", runner=self.command,
|
||||
arguments=app_build.update_signing.dart_defines(self.environ))
|
||||
@@ -986,18 +1002,29 @@ class Setup:
|
||||
f"{args.port}, {args.ntfy_port} and {args.web_port} are free (a running Docker installation may use them).")
|
||||
self.retire_legacy_web()
|
||||
self.serve_on_tailnet(opencode_env["PIPELINES_WEB_PUBLIC_URL"], args.web_port)
|
||||
self.print_summary(prefix, manifest, lan_ip, harness_config["default"])
|
||||
|
||||
def print_summary(self, prefix, manifest, lan_ip, default_harness):
|
||||
"""The last thing a new user reads: where to go and what to do next."""
|
||||
print("\nPipelines installed")
|
||||
print(f"Install location: {prefix}")
|
||||
app_build.print_web_urls(manifest, lan_host=lan_ip)
|
||||
bin_dir = prefix / "bin"
|
||||
path_entries = self.environ.get("PATH", "").split(os.pathsep)
|
||||
if str(bin_dir) not in path_entries:
|
||||
cli = "pipelines"
|
||||
if str(bin_dir) not in self.environ.get("PATH", "").split(os.pathsep):
|
||||
cli = str(bin_dir / "pipelines")
|
||||
shell = Path(self.environ.get("SHELL", "")).name
|
||||
rc = "~/.bashrc" if shell == "bash" else "~/.zshrc" if shell == "zsh" else "~/.profile"
|
||||
displayed_bin = "$HOME/.local/share/pipelines/bin" if bin_dir == Path.home() / ".local/share/pipelines/bin" else str(bin_dir)
|
||||
print(f"Add commands to PATH: echo 'export PATH=\"{displayed_bin}:$PATH\"' >> {rc}")
|
||||
print(f"Update later: {prefix / 'bin/pipelines'} update")
|
||||
print(f"Set up harnesses: {prefix / 'bin/pipelines'} harness setup claude|codex|opencode|pi")
|
||||
print(f"\nAdd the commands to your PATH: echo 'export PATH=\"{displayed_bin}:$PATH\"' >> {rc}")
|
||||
password = ("the web password you just chose" if getattr(self, "chosen_web_password", None) is not None
|
||||
else "your existing web password")
|
||||
print("\nNext steps:")
|
||||
print(f" 1. Open the address above and sign in with {password}.")
|
||||
print(f" 2. {default_harness} is ready as the default harness. Add others you use:")
|
||||
print(f" {cli} harness setup claude|codex|opencode|pi")
|
||||
print(" 3. Start a chat, or run one of the example pipelines on the Pipelines page.")
|
||||
print(f"\nCheck the services: {cli} doctor · Update later: {cli} update")
|
||||
|
||||
|
||||
def arguments(argv=None):
|
||||
|
||||
@@ -189,8 +189,40 @@ class SetupNativeTests(unittest.TestCase):
|
||||
self.assertIn("curl", message)
|
||||
self.assertIn("node", message)
|
||||
self.assertIn("never installs tools", message)
|
||||
self.assertIn("https://nodejs.org/", message)
|
||||
self.assertNotIn("https://go.dev/dl/", message)
|
||||
self.assertEqual(recorder.calls, [])
|
||||
|
||||
def test_docker_failure_says_whether_to_install_or_start_it(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
installer = self.installer(directory, Recorder())
|
||||
for docker, expected in ((None, "not found on PATH"), ("/usr/bin/docker", "installed but not running")):
|
||||
with self.subTest(docker=docker), \
|
||||
patch.object(setup_native.app_build, "docker_available", return_value=False), \
|
||||
patch.object(setup_native.shutil, "which", return_value=docker):
|
||||
with self.assertRaisesRegex(ValueError, expected):
|
||||
installer.build_app_web()
|
||||
|
||||
def test_summary_names_the_address_password_and_harness_next_steps(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
installer = self.installer(directory, Recorder())
|
||||
prefix = Path(directory) / "prefix"
|
||||
manifest = {"web": {"port": 8082, "host": "tailnet"}, "opencode_env": {}}
|
||||
for chosen, password in ((True, "the web password you just chose"), (False, "your existing web password")):
|
||||
with self.subTest(chosen=chosen):
|
||||
if chosen:
|
||||
installer.chosen_web_password = "chosen tulip orbit canyon"
|
||||
else:
|
||||
installer.__dict__.pop("chosen_web_password", None)
|
||||
with redirect_stdout(io.StringIO()) as output:
|
||||
installer.print_summary(prefix, manifest, "192.168.1.20", "opencode")
|
||||
text = output.getvalue()
|
||||
self.assertIn("http://localhost:8082/", text)
|
||||
self.assertIn("sign in with " + password, text)
|
||||
self.assertIn(f"{prefix / 'bin/pipelines'} harness setup claude|codex|opencode|pi", text)
|
||||
self.assertIn("Add the commands to your PATH", text)
|
||||
self.assertLess(text.index("http://localhost:8082/"), text.index("Next steps"))
|
||||
|
||||
def test_registration_uses_native_supervisor_on_both_platforms(self):
|
||||
for system in ("Darwin", "Linux"):
|
||||
with self.subTest(system=system), tempfile.TemporaryDirectory() as directory:
|
||||
|
||||
Reference in New Issue
Block a user