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:
@@ -4,18 +4,32 @@ Pipelines is a per-user server and CLI for running reusable AI workflows and cha
|
||||
|
||||
## Install
|
||||
|
||||
From this checkout, run:
|
||||
You need Go, Node.js 18+, Python 3.9+, git, curl, a C compiler, a running
|
||||
Docker (it builds the web app) and [OpenCode](https://opencode.ai) on your
|
||||
`PATH`; see [docs/install.md](docs/install.md). From this checkout, run:
|
||||
|
||||
```sh
|
||||
./install
|
||||
```
|
||||
|
||||
If `pipelines` is not already on your `PATH`, add it:
|
||||
The installer asks you to choose a web sign-in password. If `pipelines` is not
|
||||
already on your `PATH`, add it:
|
||||
|
||||
```sh
|
||||
export PATH="$HOME/.local/share/pipelines/bin:$PATH"
|
||||
```
|
||||
|
||||
## First steps
|
||||
|
||||
1. Open the address the installer printed (by default `http://localhost:8082/`)
|
||||
and sign in with the password you chose.
|
||||
2. Set up the harnesses you use (below). OpenCode is already the default.
|
||||
3. Start a chat, or run one of the example pipelines a new installation starts
|
||||
with: `pipelines list`, then `pipelines run <pipeline> "<task>"`.
|
||||
|
||||
If the CLI says it cannot reach the server, run `pipelines start`
|
||||
(`pipelines doctor` shows what is wrong).
|
||||
|
||||
## Set up harnesses
|
||||
|
||||
Run the command for each harness you want to use:
|
||||
|
||||
+29
-9
@@ -28,9 +28,10 @@ them, and it stops naming whatever is missing.
|
||||
| tailscale | optional; tailnet HTTPS access |
|
||||
|
||||
The install is **all or nothing**: the web app and the server are built before
|
||||
either is installed. If Docker is not running, `./install` stops with
|
||||
"Docker is not running, so the web app cannot be built" and leaves any existing
|
||||
installation running unchanged.
|
||||
either is installed. If Docker is missing or not running, `./install` stops
|
||||
("Docker is required to build the web app but was not found on PATH" or
|
||||
"Docker is installed but not running") and leaves any existing installation
|
||||
running unchanged. A missing tool is named with where to get it.
|
||||
|
||||
Run as your normal logged-in user. macOS needs `launchctl` in a GUI login;
|
||||
Linux needs `systemctl --user`. Other platforms are refused.
|
||||
@@ -62,7 +63,21 @@ Linux needs `systemctl --user`. Other platforms are refused.
|
||||
(stopped, plist renamed to `.disabled`), so only one web app is served.
|
||||
11. If `PIPELINES_WEB_PUBLIC_URL` is an `https://…ts.net` address, runs
|
||||
`tailscale serve --bg --https=<port> http://127.0.0.1:<web-port>`.
|
||||
12. Prints the browser URLs and the next step, setting up harnesses.
|
||||
12. Prints the browser URLs and the next steps (below).
|
||||
|
||||
## First steps after installing
|
||||
|
||||
1. Open the printed address (by default `http://localhost:8082/`) and sign in
|
||||
with the web password you chose during the install.
|
||||
2. OpenCode is already the default harness. Add the others you use with
|
||||
`pipelines harness setup claude|codex|opencode|pi`.
|
||||
3. Start a chat, or run one of the example pipelines a new database starts
|
||||
with. From a terminal: `pipelines list`, then
|
||||
`pipelines run <pipeline> "<task>"` in the repository to work on.
|
||||
|
||||
Empty lists are normal on a new installation: `pipelines runs` says
|
||||
"No runs yet" with the command to start one. If the CLI cannot reach the
|
||||
server it says so and how to start it (`pipelines start`, `pipelines doctor`).
|
||||
|
||||
## Set up harnesses
|
||||
|
||||
@@ -336,8 +351,9 @@ supervisor's output also reaches `journalctl --user -u net.a-wan.pipelines.servi
|
||||
|
||||
## Web sign-in password
|
||||
|
||||
On a new computer `./install` asks for the password (8+ characters, typed
|
||||
twice). Without a terminal, set `PIPELINES_WEB_PASSWORD`. It is stored in
|
||||
On a new computer `./install` asks for the password (typed twice): at least
|
||||
16 characters, or a passphrase of 4 or more random words (15 characters or more
|
||||
in all). Without a terminal, set `PIPELINES_WEB_PASSWORD`. It is stored in
|
||||
`~/.config/pipelines/web-auth.json` (mode 0600) with a generated cookie secret,
|
||||
and reused unchanged on every reinstall. An invalid or non-private file stops
|
||||
the installer rather than being reset.
|
||||
@@ -352,8 +368,8 @@ checkout with:
|
||||
./password
|
||||
```
|
||||
|
||||
It prompts twice without echoing the password, requires at least eight
|
||||
characters, and writes the private password file atomically. The updated web
|
||||
It prompts twice without echoing the password, applies the same strength rule,
|
||||
and writes the private password file atomically. The updated web
|
||||
proxy picks it up on the next request; no service restart is needed, and existing
|
||||
sessions and running tasks remain connected. SSH is supported with an interactive
|
||||
TTY. This changes the web/app sign-in password; the ntfy notification account's
|
||||
@@ -402,7 +418,11 @@ per-user data directory (`XDG_DATA_HOME`, or Application Support on macOS).
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **"Docker is not running"**: start Docker Desktop (or the daemon) and rerun.
|
||||
- **"Docker is installed but not running"**: start Docker Desktop (or the
|
||||
daemon, and make sure your user may use it) and rerun. **"Docker … was not
|
||||
found on PATH"**: install Docker first.
|
||||
- **"cannot reach the Pipelines server"**: the service is stopped. Run
|
||||
`pipelines start`; `pipelines doctor` and `pipelines logs` show why it stopped.
|
||||
- **Ports busy**: a Docker installation or an old server may hold 8080, 8082 or
|
||||
8090. Stop it, or choose other ports with the flags above.
|
||||
- **"No usable configured harness model"**: rerun `./install` in a terminal to
|
||||
|
||||
+25
-1
@@ -543,6 +543,9 @@ func (a App) Run(ctx context.Context, args []string) error {
|
||||
for _, d := range items {
|
||||
fmt.Fprintf(a.Out, "%s\t%s\tbase v%d\n", d.Name, d.Path, d.BaseVersion)
|
||||
}
|
||||
if len(items) == 0 {
|
||||
a.notice("No drafts. `pipelines new` or `pipelines edit` creates one.")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// Connect only for server operations. Keep each RPC bounded, not the interactive session.
|
||||
@@ -568,7 +571,7 @@ func (a App) Run(ctx context.Context, args []string) error {
|
||||
}
|
||||
return fmt.Errorf("Pipelines server unavailable")
|
||||
}
|
||||
return err
|
||||
return serverUnreachable(err, connectURL, a.Install != nil)
|
||||
}
|
||||
defer c.Close()
|
||||
// Report at most one build/protocol warning per invocation on stderr, so
|
||||
@@ -631,6 +634,10 @@ func (a App) Run(ctx context.Context, args []string) error {
|
||||
average = time.Duration(u.AverageSeconds * float64(time.Second)).Round(time.Second).String()
|
||||
}
|
||||
fmt.Fprintf(a.Out, "Usage · all history\n%d runs · %d succeeded · %d failed · %d canceled · %d interrupted · %d active\nAverage completed duration: %s\n", u.Total, u.Succeeded, u.Failed, u.Canceled, u.Interrupted, u.Active, average)
|
||||
if u.Total == 0 {
|
||||
fmt.Fprintln(a.Out, "No runs yet. Start one with: pipelines run <pipeline> \"<task>\"")
|
||||
return nil
|
||||
}
|
||||
if t := u.Usage; t != nil {
|
||||
line := fmt.Sprintf("Reported model usage: %d tokens over %d stage(s)", t.TokensTotal, t.Stages)
|
||||
if t.SplitKnown {
|
||||
@@ -880,6 +887,13 @@ func (a App) Run(ctx context.Context, args []string) error {
|
||||
}
|
||||
fmt.Fprintf(a.Out, "%d\t%s\tv%d\t%d stages%s\n", p.ID, p.Name, p.Version, p.Stages, note)
|
||||
}
|
||||
if len(r.Pipelines) == 0 {
|
||||
if o.archived && !o.all {
|
||||
a.notice("No archived pipelines.")
|
||||
} else {
|
||||
a.notice("No pipelines yet. See starting points with `pipelines templates`, or create one with `pipelines new`.")
|
||||
}
|
||||
}
|
||||
case "templates":
|
||||
for _, t := range r.Templates {
|
||||
note := ""
|
||||
@@ -899,6 +913,13 @@ func (a App) Run(ctx context.Context, args []string) error {
|
||||
}
|
||||
fmt.Fprintf(a.Out, "%d\t%s\t%s\tv%d\t%s\n", run.ID, run.Label(), run.Name, run.Version, status)
|
||||
}
|
||||
if len(r.Runs) == 0 {
|
||||
if o.name != "" {
|
||||
a.notice(fmt.Sprintf("No runs of %s yet. Start one with: pipelines run %s \"<task>\"", o.name, o.name))
|
||||
} else {
|
||||
a.notice("No runs yet. Start one with: pipelines run <pipeline> \"<task>\" (`pipelines list` shows pipelines).")
|
||||
}
|
||||
}
|
||||
case "ping":
|
||||
fmt.Fprintln(a.Out, "Connected ·", r.Time)
|
||||
if r.Build != nil {
|
||||
@@ -916,6 +937,9 @@ func (a App) Run(ctx context.Context, args []string) error {
|
||||
for _, n := range r.NotificationEndpoints {
|
||||
fmt.Fprintf(a.Out, "ntfy: %s · topic %s\n", n.ServerURL, n.Topic)
|
||||
}
|
||||
if len(r.NotificationEndpoints) == 0 {
|
||||
fmt.Fprintln(a.Out, "ntfy: not configured (phone notifications are off)")
|
||||
}
|
||||
if note := identityNote(r); note != "" {
|
||||
fmt.Fprintln(a.Out, "Note:", note)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net"
|
||||
"net/url"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// unreachableError reports a connection that never reached a Pipelines server
|
||||
// in plain words, with how to start one. The transport error stays wrapped.
|
||||
type unreachableError struct {
|
||||
endpoint, reason, start string
|
||||
err error
|
||||
}
|
||||
|
||||
func (e *unreachableError) Error() string {
|
||||
return "cannot reach the Pipelines server at " + e.endpoint + " (" + e.reason + ").\n" +
|
||||
"Is it running? " + e.start + ".\n" +
|
||||
"Using another server? Pass --url or set PIPELINES_URL."
|
||||
}
|
||||
|
||||
func (e *unreachableError) Unwrap() error { return e.err }
|
||||
|
||||
// serverUnreachable explains a refused or unresolvable server address. Other
|
||||
// errors (a rejected token, a protocol mismatch) are returned unchanged.
|
||||
func serverUnreachable(err error, endpoint string, installed bool) error {
|
||||
var dnsErr *net.DNSError
|
||||
reason := ""
|
||||
switch {
|
||||
case err == nil:
|
||||
return nil
|
||||
case errors.Is(err, syscall.ECONNREFUSED):
|
||||
reason = "connection refused"
|
||||
case errors.As(err, &dnsErr):
|
||||
reason = "unknown host " + dnsErr.Name
|
||||
default:
|
||||
return err
|
||||
}
|
||||
start := "Start it with `pipelines serve` (foreground), or install the service with ./install from the source checkout"
|
||||
if installed {
|
||||
start = "Start it with `pipelines start`; `pipelines doctor` and `pipelines logs` show why it stopped"
|
||||
}
|
||||
return &unreachableError{endpoint: displayEndpoint(endpoint), reason: reason, start: start, err: err}
|
||||
}
|
||||
|
||||
// displayEndpoint drops credentials, query and fragment from a server URL.
|
||||
func displayEndpoint(endpoint string) string {
|
||||
u, err := url.Parse(endpoint)
|
||||
if err != nil || u.Host == "" {
|
||||
return "the configured address"
|
||||
}
|
||||
return (&url.URL{Scheme: u.Scheme, Host: u.Host, Path: u.Path}).String()
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package cli_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
"syscall"
|
||||
"testing"
|
||||
|
||||
"git.a-wan.net/alan/pipelines/internal/cli"
|
||||
)
|
||||
|
||||
// A brand-new server has no pipelines, runs, drafts or skills. Human output
|
||||
// says so with a next step on stderr; stdout stays empty for scripts and
|
||||
// --json output carries no prose.
|
||||
func TestEmptyListsExplainNextStepOnStderrOnly(t *testing.T) {
|
||||
t.Setenv("PIPELINES_NTFY_URL", "")
|
||||
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
|
||||
_, _, url := setup(t)
|
||||
invoke := func(args ...string) (string, string) {
|
||||
t.Helper()
|
||||
var out, stderr bytes.Buffer
|
||||
if err := (cli.App{Out: &out, Err: &stderr, In: strings.NewReader("")}).Run(context.Background(), args); err != nil {
|
||||
t.Fatal(args, err)
|
||||
}
|
||||
return out.String(), stderr.String()
|
||||
}
|
||||
for _, c := range []struct {
|
||||
args []string
|
||||
hint string
|
||||
}{
|
||||
{[]string{"--url", url, "list"}, "No pipelines yet. See starting points with `pipelines templates`"},
|
||||
{[]string{"--url", url, "list", "--archived"}, "No archived pipelines."},
|
||||
{[]string{"--url", url, "runs"}, "No runs yet. Start one with: pipelines run <pipeline>"},
|
||||
{[]string{"--url", url, "drafts"}, "No drafts."},
|
||||
{[]string{"skills", "list", "--url", url}, "No library skills yet."},
|
||||
} {
|
||||
out, hint := invoke(c.args...)
|
||||
if out != "" || !strings.Contains(hint, c.hint) {
|
||||
t.Fatalf("%v: stdout %q stderr %q", c.args, out, hint)
|
||||
}
|
||||
out, hint = invoke(append(c.args, "--json")...)
|
||||
if hint != "" || strings.Contains(out, "No ") {
|
||||
t.Fatalf("%v --json: stdout %q stderr %q", c.args, out, hint)
|
||||
}
|
||||
}
|
||||
out, _ := invoke("--url", url, "stats")
|
||||
if !strings.Contains(out, "0 runs") || !strings.Contains(out, "No runs yet") || strings.Contains(out, "Daily activity") {
|
||||
t.Fatalf("empty stats: %q", out)
|
||||
}
|
||||
out, _ = invoke("--url", url, "connection")
|
||||
if !strings.Contains(out, "ntfy: not configured") {
|
||||
t.Fatalf("connection without ntfy: %q", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnreachableServerSaysHowToStartIt(t *testing.T) {
|
||||
const closed = "ws://user:secret@127.0.0.1:1/connect?token=secret"
|
||||
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
|
||||
t.Setenv("PIPELINES_URL", "")
|
||||
for _, c := range []struct {
|
||||
app cli.App
|
||||
args []string
|
||||
}{
|
||||
{cli.App{}, []string{"--url", closed, "runs"}},
|
||||
{cli.App{}, []string{"skills", "list", "--url", closed}},
|
||||
} {
|
||||
var out, stderr bytes.Buffer
|
||||
c.app.Out, c.app.Err, c.app.In = &out, &stderr, strings.NewReader("")
|
||||
err := c.app.Run(context.Background(), c.args)
|
||||
if err == nil {
|
||||
t.Fatal("closed port connected")
|
||||
}
|
||||
text := err.Error()
|
||||
for _, want := range []string{"cannot reach the Pipelines server at ws://127.0.0.1:1/connect (connection refused)", "pipelines serve", "--url or set PIPELINES_URL"} {
|
||||
if !strings.Contains(text, want) {
|
||||
t.Fatalf("%v: missing %q in %q", c.args, want, text)
|
||||
}
|
||||
}
|
||||
if strings.Contains(text, "secret") {
|
||||
t.Fatalf("credentials exposed: %q", text)
|
||||
}
|
||||
if !errors.Is(err, syscall.ECONNREFUSED) {
|
||||
t.Fatalf("transport error not wrapped: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
-2
@@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"git.a-wan.net/alan/pipelines/internal/client"
|
||||
"git.a-wan.net/alan/pipelines/internal/protocol"
|
||||
"git.a-wan.net/alan/pipelines/internal/skills"
|
||||
@@ -39,6 +41,15 @@ func (a App) skillsCommand(ctx context.Context, args []string) error {
|
||||
fs := flag.NewFlagSet("skills "+sub, flag.ContinueOnError)
|
||||
fs.SetOutput(a.Err)
|
||||
url := envOr("PIPELINES_URL", "ws://127.0.0.1:8080/connect")
|
||||
if os.Getenv("PIPELINES_URL") == "" {
|
||||
// Like every other server command, dial the installation's saved
|
||||
// address unless --url or PIPELINES_URL chooses another.
|
||||
if configured, err := client.ConfiguredURL(); err != nil {
|
||||
return err
|
||||
} else if configured != "" {
|
||||
url = configured
|
||||
}
|
||||
}
|
||||
yes := false
|
||||
version := 0
|
||||
jsonMode := false
|
||||
@@ -65,7 +76,7 @@ func (a App) skillsCommand(ctx context.Context, args []string) error {
|
||||
}
|
||||
c, e := client.Open(ctx, url)
|
||||
if e != nil {
|
||||
return e
|
||||
return serverUnreachable(e, url, a.Install != nil)
|
||||
}
|
||||
defer c.Close()
|
||||
files := make([]protocol.SkillFile, len(b.Files))
|
||||
@@ -86,7 +97,7 @@ func (a App) skillsCommand(ctx context.Context, args []string) error {
|
||||
}
|
||||
c, e := client.Open(ctx, url)
|
||||
if e != nil {
|
||||
return e
|
||||
return serverUnreachable(e, url, a.Install != nil)
|
||||
}
|
||||
defer c.Close()
|
||||
if sub == "list" {
|
||||
@@ -103,6 +114,9 @@ func (a App) skillsCommand(ctx context.Context, args []string) error {
|
||||
for _, s := range r.SkillSummaries {
|
||||
fmt.Fprintf(a.Out, "%s\tv%d\t%s\n", s.Name, s.LatestVersion, s.Digest)
|
||||
}
|
||||
if len(r.SkillSummaries) == 0 {
|
||||
a.notice("No library skills yet. Add one with: pipelines skills import <folder>")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if len(pos) != 1 {
|
||||
|
||||
@@ -32,8 +32,10 @@ func ServerLines(s *protocol.SystemStatus) []string {
|
||||
break
|
||||
}
|
||||
}
|
||||
if len(seen) == 0 {
|
||||
lines = append(lines, "LAN address unavailable.", "For Docker: rerun ./install on the server.")
|
||||
if s.Server.Health == "unreachable" {
|
||||
lines = append(lines, "Is it running? Start it with `pipelines start` (installed service) or `pipelines serve`.")
|
||||
} else if len(seen) == 0 {
|
||||
lines = append(lines, "LAN address unavailable.", "For a Docker install: rerun ./install --docker on the server.")
|
||||
}
|
||||
if s.Server.Port != "" {
|
||||
lines = append(lines, "Port: "+s.Server.Port)
|
||||
@@ -56,9 +58,11 @@ func NtfyLines(s *protocol.SystemStatus) []string {
|
||||
lines = append(lines, "Login: "+s.NtfyUser, "Use the password set during installation.")
|
||||
}
|
||||
if s.Ntfy.Health == "not configured" {
|
||||
lines = append(lines, "The connected Pipelines server has no ntfy publishing configuration.", "For Docker: check docker compose port pipelines 8080.", "Connect the TUI to that port; check --url / PIPELINES_URL.", "If this is the intended server: run ./install there.")
|
||||
lines = append(lines, "Phone notifications are off: the connected Pipelines server has no ntfy publishing configuration (optional).",
|
||||
"./install sets it up; a plain `pipelines serve` runs without it.",
|
||||
"Expected it? Check this is the intended server (--url / PIPELINES_URL); for Docker: docker compose port pipelines 8080.")
|
||||
} else if s.Ntfy.Health == "unreachable" || s.Ntfy.Health == "unhealthy" {
|
||||
lines = append(lines, "On the server: docker compose logs ntfy")
|
||||
lines = append(lines, "On the server: pipelines doctor (Docker: docker compose logs ntfy)")
|
||||
}
|
||||
return lines
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ func TestOfflineStatusIncludesBothServicesAndRedactsURLCredentials(t *testing.T)
|
||||
t.Fatal("credentials exposed", text)
|
||||
}
|
||||
}
|
||||
for _, expected := range []string{"Pipelines server", "unreachable", "ntfy", "unknown (server unavailable)", "8080"} {
|
||||
for _, expected := range []string{"Pipelines server", "unreachable", "pipelines start", "pipelines serve", "ntfy", "unknown (server unavailable)", "8080"} {
|
||||
if !strings.Contains(text, expected) {
|
||||
t.Fatal("missing offline information", expected, text)
|
||||
}
|
||||
@@ -23,7 +23,7 @@ func TestOfflineStatusIncludesBothServicesAndRedactsURLCredentials(t *testing.T)
|
||||
|
||||
func TestUnconfiguredNtfyExplainsConnectedServerAndEndpointMismatch(t *testing.T) {
|
||||
text := strings.Join(NtfyLines(&protocol.SystemStatus{Ntfy: protocol.ServiceStatus{Health: "not configured"}}), "\n")
|
||||
for _, want := range []string{"connected Pipelines server", "docker compose port pipelines 8080", "--url / PIPELINES_URL"} {
|
||||
for _, want := range []string{"Phone notifications are off", "connected Pipelines server", "(optional)", "docker compose port pipelines 8080", "--url / PIPELINES_URL"} {
|
||||
if !strings.Contains(text, want) {
|
||||
t.Fatal("missing endpoint diagnosis", want, text)
|
||||
}
|
||||
|
||||
+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