Install shared authoring skill and add retained drafts browser
This commit is contained in:
+6
-21
@@ -1,7 +1,6 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
@@ -9,7 +8,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -47,7 +45,7 @@ func (a App) flags(command string) (*flag.FlagSet, *options) {
|
||||
f.StringVar(&o.name, "name", "", "Pipeline name (or edit ID)")
|
||||
f.StringVar(&o.prompt, "prompt", "", "Request to give OpenCode; omitted asks what to change")
|
||||
f.BoolVar(&o.noOpen, "no-open", false, "Create the draft without opening OpenCode")
|
||||
f.StringVar(&o.opencode, "opencode", envOr("PIPELINES_OPENCODE", "opencode"), "Host OpenCode V2 executable")
|
||||
f.StringVar(&o.opencode, "opencode", envOr("PIPELINES_OPENCODE", "opencode"), "Host OpenCode executable")
|
||||
if command == "new" {
|
||||
f.StringVar(&o.template, "template", "", "Optional template key; omitted starts a one-stage draft")
|
||||
}
|
||||
@@ -521,14 +519,8 @@ func (a App) author(ctx context.Context, command string, pos []string, o *option
|
||||
if o.json || o.noOpen {
|
||||
return fmt.Errorf("new requires a name in noninteractive mode")
|
||||
}
|
||||
fmt.Fprint(a.Err, "New pipeline name: ")
|
||||
name, err := bufio.NewReader(a.In).ReadString('\n')
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
o.name = strings.TrimSpace(name)
|
||||
}
|
||||
if strings.TrimSpace(o.name) == "" || len(o.name) > 200 || strings.ContainsAny(o.name, "\r\n\x00") {
|
||||
if (o.name != "" && strings.TrimSpace(o.name) == "") || len(o.name) > 200 || strings.ContainsAny(o.name, "\r\n\x00") {
|
||||
return fmt.Errorf("name must be 1–200 bytes without line breaks or NUL")
|
||||
}
|
||||
r, err := call(protocol.Message{Type: protocol.List})
|
||||
@@ -570,23 +562,16 @@ func (a App) author(ctx context.Context, command string, pos []string, o *option
|
||||
if o.noOpen {
|
||||
return nil
|
||||
}
|
||||
workspace, err := author.Workspace(d)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
prepareCtx, cancel := context.WithTimeout(ctx, o.timeout)
|
||||
session, err := author.PrepareSession(prepareCtx, o.opencode, workspace, d.Name)
|
||||
cancel()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Give the agent a directly executable command even in an uninstalled source tree.
|
||||
executable, err := os.Executable()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cliCommand := shellQuote(executable) + " --url " + shellQuote(o.url)
|
||||
cmd := exec.CommandContext(ctx, o.opencode, workspace, "--session", session, "--prompt", author.Prompt(d, o.prompt, cliCommand))
|
||||
cmd, err := author.Command(ctx, o.opencode, d, o.prompt, cliCommand)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cmd.Stdin = a.In
|
||||
cmd.Stdout = a.Out
|
||||
cmd.Stderr = a.Err
|
||||
|
||||
Reference in New Issue
Block a user