Remove workspace-root configuration and use client run directories
This commit is contained in:
@@ -24,7 +24,7 @@ with the appropriate permissions. Configuration and data remain per-user.
|
||||
Start explicitly; fresh databases contain no pipelines:
|
||||
|
||||
```sh
|
||||
pipelines serve -workspace-root "$HOME" # foreground server
|
||||
pipelines serve # foreground server
|
||||
# In another terminal:
|
||||
pipelines
|
||||
```
|
||||
@@ -32,12 +32,12 @@ pipelines
|
||||
Optional autostart at login (starts the server now):
|
||||
|
||||
```sh
|
||||
pipelines service enable --workspace-root "$HOME"
|
||||
pipelines service enable
|
||||
pipelines service status
|
||||
```
|
||||
|
||||
Uses user-level systemd on Linux or launchd on macOS; no sudo. Prefer a narrower
|
||||
trusted repository root where possible. Preview with `--print`. Stop any existing
|
||||
Uses user-level systemd on Linux or launchd on macOS; no sudo. Runs use the
|
||||
directory you invoke `pipelines run` from. Preview with `--print`. Stop any existing
|
||||
foreground/legacy server first. Disable with `pipelines service disable` before
|
||||
uninstalling. See [installation](docs/install.md) for environment and boot options.
|
||||
|
||||
|
||||
@@ -24,26 +24,6 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
db := flag.String("db", defaultDB, "SQLite database path (honors XDG_DATA_HOME)")
|
||||
var roots []string
|
||||
flag.Func("workspace-root", "Allow repository runs below this directory (repeatable; default is server working directory)", func(value string) error {
|
||||
absolute, err := filepath.Abs(value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
resolved, err := filepath.EvalSymlinks(absolute)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
info, err := os.Stat(resolved)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !info.IsDir() {
|
||||
return errors.New("workspace root must be a directory")
|
||||
}
|
||||
roots = append(roots, resolved)
|
||||
return nil
|
||||
})
|
||||
flag.Parse()
|
||||
if err := os.MkdirAll(filepath.Dir(*db), 0700); err != nil {
|
||||
log.Fatal(err)
|
||||
@@ -55,7 +35,7 @@ func main() {
|
||||
defer store.Close()
|
||||
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
|
||||
defer stop()
|
||||
srv := &http.Server{Addr: *addr, Handler: server.HandlerForWorkspaces(ctx, store, roots), ReadHeaderTimeout: 5 * time.Second}
|
||||
srv := &http.Server{Addr: *addr, Handler: server.Handler(ctx, store), ReadHeaderTimeout: 5 * time.Second}
|
||||
defer server.WaitRuns(srv.Handler)
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
|
||||
+2
-2
@@ -95,8 +95,8 @@ pipelines run "bug fix" "Fix the layout" --yes --json \
|
||||
--allow-tools --write-paths internal/example.go --request-key my-unique-task
|
||||
```
|
||||
|
||||
Runs default to the current directory and latest accepted version. The server
|
||||
checks allowed workspace roots, including symlink resolution. `--version` chooses
|
||||
Runs default to the client's current directory and latest accepted version.
|
||||
The server resolves that directory without a repository allowlist. `--version` chooses
|
||||
an immutable version in JSON mode. `--yes` never grants tools implicitly.
|
||||
Go-specific file editing and restricted Go shell checks remain in effect.
|
||||
`--wait` polls until terminal status, returns nonzero on failure/cancellation,
|
||||
|
||||
@@ -36,7 +36,7 @@ OS tools. The old managed installation helper remains only for explicit legacy
|
||||
data/lifecycle access; it is not the standard installer.
|
||||
|
||||
Optional autostart is a separate explicit `pipelines service enable` step. It
|
||||
uses the OS user manager directly, requires trusted workspace roots, supports a
|
||||
uses the OS user manager directly, supports a
|
||||
side-effect-free preview, and captures only documented environment settings.
|
||||
Uninstallation refuses to remove binaries while its autostart definition remains;
|
||||
disable the service first. Installation itself still registers or starts nothing.
|
||||
|
||||
+9
-9
@@ -30,14 +30,15 @@ The installer does not hardcode a system destination or run sudo.
|
||||
## Start explicitly
|
||||
|
||||
```sh
|
||||
pipelines serve -workspace-root "$HOME" # foreground server; Ctrl+C stops it
|
||||
pipelines serve # foreground server; Ctrl+C stops it
|
||||
# In another terminal:
|
||||
pipelines
|
||||
```
|
||||
|
||||
The server listens on loopback. Limit `-workspace-root` to trusted repositories;
|
||||
repeat the flag for multiple roots. Omission permits only the server's working
|
||||
directory. Runtime repository requests cannot escape these roots via symlinks.
|
||||
The server listens on loopback. Change into your repository and run a pipeline
|
||||
there; the client sends its current directory to the server. The server's own
|
||||
working directory does not restrict which repositories you can use. Model tool
|
||||
permissions and approved edit paths remain separate, per-run/stage controls.
|
||||
|
||||
The SQLite database uses the standard user data location, honoring `XDG_DATA_HOME`
|
||||
when set. On macOS it uses the user Application Support directory. `-db FILE`
|
||||
@@ -51,19 +52,18 @@ Stop any existing foreground or legacy server first, then explicitly configure
|
||||
the OS user service:
|
||||
|
||||
```sh
|
||||
pipelines service enable --workspace-root "$HOME"
|
||||
pipelines service enable
|
||||
pipelines service status
|
||||
```
|
||||
|
||||
This starts the server now and at subsequent logins. Linux uses
|
||||
`systemctl --user`; macOS uses a LaunchAgent in your user `Library/LaunchAgents`.
|
||||
There is no sudo, Docker dependency, or second supervisor. Choose a narrower root
|
||||
if possible; repeat `--workspace-root` for multiple trusted directories. `--db`
|
||||
There is no sudo, Docker dependency, or second supervisor. `--db`
|
||||
and `--addr` select the database/listen address, just like foreground startup.
|
||||
Re-run enable to update the definition and restart with the new settings.
|
||||
|
||||
```sh
|
||||
pipelines service enable --workspace-root "$HOME/repos" --print # preview only
|
||||
pipelines service enable --print # preview only
|
||||
pipelines service disable # stop and remove
|
||||
```
|
||||
|
||||
@@ -133,6 +133,6 @@ no command infers that directory from an executable location. The old
|
||||
`--system-command`, provisioning, and autostart installer flags have been removed.
|
||||
|
||||
To migrate, stop the old server first, install normal Go binaries, and start with
|
||||
`pipelines serve -db EXISTING_DATABASE -workspace-root TRUSTED_ROOT`. Keep the old
|
||||
`pipelines serve -db EXISTING_DATABASE`. Keep the old
|
||||
data and credentials until you have verified the new setup. There is no automatic
|
||||
purge, database move, login migration, or shared OpenCode service modification.
|
||||
|
||||
@@ -31,3 +31,9 @@ files/symlinks, preview without side effects, and lifecycle calls using a mock O
|
||||
manager. The installed macOS CLI's preview was validated with `plutil -lint`.
|
||||
`GOOS=linux GOARCH=amd64 go build ./cmd/...` also passed. Actual launchd/systemd
|
||||
registration, logout/login restart, and Linux lingering remain **not tested**.
|
||||
|
||||
An isolated installed-CLI check started the server in one directory and invoked
|
||||
`pipelines run` from two other directories. With a mock OpenCode executable, both
|
||||
runs completed and recorded/executed in the client invocation directory. The
|
||||
autostart preview required no repository configuration and passed `plutil -lint`.
|
||||
CLI and dashboard regression tests also check invocation-directory selection.
|
||||
|
||||
@@ -33,7 +33,7 @@ var notes = map[string]string{
|
||||
}
|
||||
|
||||
var serviceHelp = map[string]string{
|
||||
"service": "Configure per-user OS autostart: pipelines service enable --workspace-root DIR. Use --print to preview, service status to inspect, and service disable before uninstalling. Linux uses systemd; macOS uses launchd. No sudo.",
|
||||
"service": "Configure per-user OS autostart: pipelines service enable. Runs use the directory you invoke pipelines run from. Use --print to preview, service status to inspect, and service disable before uninstalling. Linux uses systemd; macOS uses launchd. No sudo.",
|
||||
"serve": "Run the native server in the foreground. Its flags are documented by pipelines serve --help. Installation never starts it automatically.",
|
||||
"start": "Start the per-user native pipeline server and this installation's Docker ntfy together.",
|
||||
"stop": "Stop both services. Active execution is interrupted; file changes are not rolled back.",
|
||||
|
||||
@@ -31,7 +31,7 @@ EXECUTE
|
||||
SERVER / INTERFACE
|
||||
tui Open the dashboard (default with no command)
|
||||
serve Start native server in the foreground (Ctrl+C stops it)
|
||||
service enable Configure user autostart; requires --workspace-root DIR
|
||||
service enable Configure user autostart
|
||||
service disable | status Stop/remove autostart, or inspect OS service status
|
||||
uninstall [--yes] Remove verified Go binaries; retain data and drafts
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ func ServerExecutable(executable string) (string, error) {
|
||||
|
||||
// ServiceCommand uses the OS service manager directly, without a second supervisor.
|
||||
func ServiceCommand(ctx context.Context, executable string, args []string, out, stderr io.Writer) error {
|
||||
help := "Usage: pipelines service enable --workspace-root DIR [--workspace-root DIR] [--db FILE] [--addr HOST:PORT] [--print]\n pipelines service disable | status\nAutostart is per-user, at login. enable starts the server now; --print only previews.\n"
|
||||
help := "Usage: pipelines service enable [--db FILE] [--addr HOST:PORT] [--print]\n pipelines service disable | status\nAutostart is per-user, at login. enable starts the server now; --print only previews.\nRuns use the directory you invoke pipelines run from.\n"
|
||||
if len(args) == 0 || args[0] == "--help" || args[0] == "help" {
|
||||
_, err := io.WriteString(out, help)
|
||||
return err
|
||||
@@ -192,34 +192,14 @@ func ServiceCommand(ctx context.Context, executable string, args []string, out,
|
||||
}
|
||||
db := f.String("db", defaultDB, "SQLite database file")
|
||||
addr := f.String("addr", "127.0.0.1:8080", "Server listen address")
|
||||
var roots []string
|
||||
f.Func("workspace-root", "Trusted repository root (required; repeatable)", func(value string) error {
|
||||
path, err := filepath.Abs(value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
path, err = filepath.EvalSymlinks(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
info, err := os.Stat(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !info.IsDir() {
|
||||
return fmt.Errorf("workspace root must be a directory")
|
||||
}
|
||||
roots = append(roots, path)
|
||||
return nil
|
||||
})
|
||||
if err := f.Parse(args[1:]); err != nil {
|
||||
if err == flag.ErrHelp {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
if len(f.Args()) != 0 || len(roots) == 0 {
|
||||
return fmt.Errorf("service enable requires --workspace-root DIR; no positional arguments")
|
||||
if len(f.Args()) != 0 {
|
||||
return fmt.Errorf("service enable takes no positional arguments")
|
||||
}
|
||||
if os.Getenv("PIPELINES_NTFY_TOKEN") != "" {
|
||||
return fmt.Errorf("use PIPELINES_NTFY_TOKEN_FILE for autostart; inline tokens are not saved")
|
||||
@@ -232,10 +212,11 @@ func ServiceCommand(ctx context.Context, executable string, args []string, out,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d := serviceDefinition{Binary: binary, Directory: roots[0], Args: []string{"-db", database, "-addr", *addr}, Environment: map[string]string{}}
|
||||
for _, root := range roots {
|
||||
d.Args = append(d.Args, "-workspace-root", root)
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d := serviceDefinition{Binary: binary, Directory: home, Args: []string{"-db", database, "-addr", *addr}, Environment: map[string]string{}}
|
||||
for _, key := range serviceEnvironmentKeys {
|
||||
if value, ok := os.LookupEnv(key); ok {
|
||||
d.Environment[key] = value
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestServiceDefinitionsQuotePathsAndKeepEnvironmentLimited(t *testing.T) {
|
||||
d := serviceDefinition{Binary: `/some bin/server`, Directory: `/repo "quoted" 100% $USER`, Args: []string{"-workspace-root", `/repo "quoted" 100% $USER`}, Environment: map[string]string{"PATH": "/usr/bin:/custom bin", "PIPELINES_NTFY_TOKEN_FILE": "/secret & token", "PROVIDER_SECRET": "must-not-export"}}
|
||||
d := serviceDefinition{Binary: `/some bin/server`, Directory: `/repo "quoted" 100% $USER`, Args: []string{"-db", `/repo "quoted" 100% $USER/data.db`}, Environment: map[string]string{"PATH": "/usr/bin:/custom bin", "PIPELINES_NTFY_TOKEN_FILE": "/secret & token", "PROVIDER_SECRET": "must-not-export"}}
|
||||
for _, platform := range []string{"linux", "darwin"} {
|
||||
text, err := d.render(platform)
|
||||
if err != nil {
|
||||
@@ -86,8 +86,7 @@ func TestServiceConfigurationPreviewAndLifecycleWithMockOSManager(t *testing.T)
|
||||
}
|
||||
home := t.TempDir()
|
||||
bin := filepath.Join(home, "bin")
|
||||
root := filepath.Join(home, "repo with spaces")
|
||||
for _, dir := range []string{bin, root} {
|
||||
for _, dir := range []string{bin} {
|
||||
if err := os.MkdirAll(dir, 0700); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -115,10 +114,7 @@ func TestServiceConfigurationPreviewAndLifecycleWithMockOSManager(t *testing.T)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := ServiceCommand(ctx, server, []string{"enable"}, &out, &out); err == nil {
|
||||
t.Fatal("workspace scope must be explicit")
|
||||
}
|
||||
args := []string{"enable", "--workspace-root", root}
|
||||
args := []string{"enable"}
|
||||
if err := ServiceCommand(ctx, server, append(args, "--print"), &out, &out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"git.a-wan.net/alan/pipelines/internal/protocol"
|
||||
"git.a-wan.net/alan/pipelines/internal/stage"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -49,6 +50,17 @@ func TestCLIHeadlessRunInspectionCancellationAndRPC(t *testing.T) {
|
||||
if response.RunDetail.Input["prompt"] != "exact task" || response.RunDetail.AllowTools {
|
||||
t.Fatal("prompt or approval changed", response)
|
||||
}
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cwd, err = filepath.EvalSymlinks(cwd)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if response.RunDetail.Workspace != cwd {
|
||||
t.Fatal("CLI did not use invocation directory", response.RunDetail.Workspace, cwd)
|
||||
}
|
||||
output, err = run("run", "workflow", "exact task", "--yes", "--json", "--request-key", "same-key")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -16,14 +16,13 @@ import (
|
||||
)
|
||||
|
||||
type runner struct {
|
||||
ctx context.Context
|
||||
store *pipeline.Store
|
||||
mu sync.Mutex
|
||||
active map[int64]context.CancelFunc
|
||||
execute func(context.Context, stage.Definition, stage.Values) (stage.Result, error)
|
||||
wg sync.WaitGroup
|
||||
schedulerWG sync.WaitGroup
|
||||
workspaceRoots []string
|
||||
ctx context.Context
|
||||
store *pipeline.Store
|
||||
mu sync.Mutex
|
||||
active map[int64]context.CancelFunc
|
||||
execute func(context.Context, stage.Definition, stage.Values) (stage.Result, error)
|
||||
wg sync.WaitGroup
|
||||
schedulerWG sync.WaitGroup
|
||||
}
|
||||
|
||||
func newRunner(ctx context.Context, s *pipeline.Store) (*runner, error) {
|
||||
@@ -69,24 +68,6 @@ func (r *runner) start(request protocol.Message) (*protocol.RunDetail, error) {
|
||||
if err != nil || !info.IsDir() {
|
||||
return nil, fmt.Errorf("run workspace must be a directory")
|
||||
}
|
||||
allowed := selected == workspace
|
||||
for _, root := range r.workspaceRoots {
|
||||
root, err = filepath.Abs(root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
root, err = filepath.EvalSymlinks(root)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("configured workspace root is unavailable")
|
||||
}
|
||||
rel, err := filepath.Rel(root, selected)
|
||||
if err == nil && rel != ".." && !strings.HasPrefix(rel, ".."+string(os.PathSeparator)) {
|
||||
allowed = true
|
||||
}
|
||||
}
|
||||
if !allowed {
|
||||
return nil, fmt.Errorf("run workspace is outside the server's allowed workspace roots")
|
||||
}
|
||||
workspace = selected
|
||||
}
|
||||
if len(request.WritePaths) > 20 {
|
||||
|
||||
@@ -17,22 +17,12 @@ import (
|
||||
|
||||
// Handler serves the persistent connection. Canceling ctx stops active clients.
|
||||
func Handler(ctx context.Context, stores ...*pipeline.Store) http.Handler {
|
||||
return handler(ctx, nil, stores...)
|
||||
}
|
||||
|
||||
// HandlerForWorkspaces permits run workspaces only below explicitly configured roots.
|
||||
func HandlerForWorkspaces(ctx context.Context, store *pipeline.Store, roots []string) http.Handler {
|
||||
return handler(ctx, roots, store)
|
||||
}
|
||||
|
||||
func handler(ctx context.Context, roots []string, stores ...*pipeline.Store) http.Handler {
|
||||
mux := http.NewServeMux()
|
||||
var runs *runner
|
||||
var runErr error
|
||||
if len(stores) > 0 {
|
||||
runs, runErr = newRunner(ctx, stores[0])
|
||||
if runErr == nil {
|
||||
runs.workspaceRoots = append([]string(nil), roots...)
|
||||
runs.schedulerWG.Add(1)
|
||||
go runs.scheduleLoop()
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRepositoryWorkspaceAllowlistAndAudit(t *testing.T) {
|
||||
func TestClientSelectedRepositoryWorkspaceAndAudit(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
store, err := pipeline.Open(filepath.Join(t.TempDir(), "workspace.db"))
|
||||
@@ -32,11 +32,11 @@ func TestRepositoryWorkspaceAllowlistAndAudit(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
r.workspaceRoots = []string{root}
|
||||
r.execute = func(context.Context, stage.Definition, stage.Values) (stage.Result, error) {
|
||||
return stage.Result{Outcome: "success", Output: stage.Values{"done": true}}, nil
|
||||
}
|
||||
for i, path := range []string{a, b} {
|
||||
os.Symlink(outside, filepath.Join(root, "linked-repo"))
|
||||
for i, path := range []string{a, b, outside, filepath.Join(root, "linked-repo")} {
|
||||
detail, err := r.start(protocol.Message{PipelineID: items[0].ID, Version: 1, RequestKey: path, Input: map[string]any{"prompt": "task"}, Workspace: path})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -51,10 +51,13 @@ func TestRepositoryWorkspaceAllowlistAndAudit(t *testing.T) {
|
||||
t.Fatal("incorrect workspace audit", i, detail)
|
||||
}
|
||||
}
|
||||
os.Symlink(outside, filepath.Join(root, "escape"))
|
||||
for _, path := range []string{outside, filepath.Join(root, "escape"), "relative/repo"} {
|
||||
file := filepath.Join(root, "file")
|
||||
if err := os.WriteFile(file, []byte("not a directory"), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, path := range []string{filepath.Join(root, "missing"), file, "relative/repo"} {
|
||||
if _, err := r.start(protocol.Message{PipelineID: items[0].ID, Version: 1, RequestKey: path, Input: map[string]any{"prompt": "task"}, Workspace: path}); err == nil {
|
||||
t.Fatal("unauthorized workspace accepted", path)
|
||||
t.Fatal("invalid run directory accepted", path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"git.a-wan.net/alan/pipelines/internal/protocol"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/x/ansi"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
@@ -45,6 +46,21 @@ func TestCLIPickerAndMultilinePrompt(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDashboardRunUsesInvocationDirectory(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
m := New(ctx, "")
|
||||
m.detail = &protocol.PipelineDetail{PipelineSummary: protocol.PipelineSummary{ID: 1, Name: "test", Version: 1}}
|
||||
updated, _ := m.beginRun()
|
||||
m = updated.(Model)
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if m.runWorkspace != cwd {
|
||||
t.Fatal("dashboard did not use invocation directory", m.runWorkspace, cwd)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCLISuppliedArgumentsStillRequireConfirmation(t *testing.T) {
|
||||
m := NewRun(context.Background(), "", RunOptions{Pipeline: "test", Prompt: "task", Workspace: "/repos/a"})
|
||||
m.detail = &protocol.PipelineDetail{PipelineSummary: protocol.PipelineSummary{ID: 1, Name: "test", Version: 1}}
|
||||
|
||||
@@ -2,6 +2,7 @@ package tui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -32,6 +33,14 @@ func (m Model) runRequest(request protocol.Message) (tea.Model, tea.Cmd) {
|
||||
m.runError = ""
|
||||
}
|
||||
if request.Type == protocol.RunPipeline {
|
||||
if request.Workspace == "" {
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
m.appendLine("cannot determine current directory: " + err.Error())
|
||||
return m, nil
|
||||
}
|
||||
request.Workspace = cwd
|
||||
}
|
||||
m.runStartRequest = request.ID
|
||||
m.keys.runs = true
|
||||
m.runError = ""
|
||||
@@ -44,6 +53,14 @@ func (m Model) beginRun() (tea.Model, tea.Cmd) {
|
||||
m.appendLine("open an exact pipeline version first")
|
||||
return m, nil
|
||||
}
|
||||
if m.runWorkspace == "" {
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
m.appendLine("cannot determine current directory: " + err.Error())
|
||||
return m, nil
|
||||
}
|
||||
m.runWorkspace = cwd
|
||||
}
|
||||
m.runForm = 1
|
||||
m.runInput = newInput()
|
||||
m.runPrompt = textarea.New()
|
||||
|
||||
+1
-2
@@ -149,8 +149,7 @@ def supervise(config):
|
||||
env.pop("PIPELINES_NTFY_TOKEN", None)
|
||||
with (root / "logs/server.log").open("a") as log:
|
||||
child = subprocess.Popen([str(root / "bin/pipelines-server"), "-addr",
|
||||
f"127.0.0.1:{config['server_port']}", "-db", str(root / "data/pipelines.db"),
|
||||
*sum((["-workspace-root", path] for path in config["workspace_roots"]), [])],
|
||||
f"127.0.0.1:{config['server_port']}", "-db", str(root / "data/pipelines.db")],
|
||||
cwd=config["workspace"], env=env, stdout=log, stderr=log)
|
||||
while child.poll() is None and not stopped:
|
||||
time.sleep(0.25)
|
||||
|
||||
Reference in New Issue
Block a user