a37a6e0934
- 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>
55 lines
1.7 KiB
Go
55 lines
1.7 KiB
Go
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()
|
|
}
|