Configure full Docker setup and confirm consequential actions
This commit is contained in:
+20
-1
@@ -59,6 +59,7 @@ func (a App) flags(command string) (*flag.FlagSet, *options) {
|
||||
case "template":
|
||||
f.BoolVar(&o.source, "source", false, "Print original Markdown instead of metadata")
|
||||
case "submit":
|
||||
f.BoolVar(&o.yes, "yes", false, "Confirm publication without an interactive prompt")
|
||||
f.StringVar(&o.name, "name", "", "Name for an external Markdown file (managed drafts already know their name)")
|
||||
f.BoolVar(&o.createOnly, "create-only", false, "Reject existing names rather than creating another version")
|
||||
f.IntVar(&o.expected, "expected-version", 0, "Reject if the latest version changed")
|
||||
@@ -67,7 +68,7 @@ func (a App) flags(command string) (*flag.FlagSet, *options) {
|
||||
f.StringVar(&o.name, "pipeline", "", "Exact registered pipeline name or ID")
|
||||
f.StringVar(&o.prompt, "prompt", "", "Task prompt; omitted opens a multiline composer")
|
||||
f.StringVar(&o.workspace, "workspace", "", "Run directory (default: current directory)")
|
||||
f.BoolVar(&o.yes, "yes", false, "Compatibility flag; supplied name/prompt already start immediately")
|
||||
f.BoolVar(&o.yes, "yes", false, "Confirm execution without an interactive prompt")
|
||||
f.BoolVar(&o.allow, "allow-tools", false, "Compatibility flag; stage-declared tools are enabled automatically")
|
||||
f.StringVar(&o.paths, "write-paths", "", "Optional narrower edit scope; default is all files in the run directory")
|
||||
f.StringVar(&o.key, "request-key", "", "Idempotency key (default: generated unique key)")
|
||||
@@ -76,8 +77,11 @@ func (a App) flags(command string) (*flag.FlagSet, *options) {
|
||||
case "runs":
|
||||
f.StringVar(&o.name, "pipeline", "", "Filter by exact pipeline name or ID")
|
||||
case "retry":
|
||||
f.BoolVar(&o.yes, "yes", false, "Confirm retry without an interactive prompt")
|
||||
f.StringVar(&o.key, "request-key", "", "Idempotency key (default: generated unique key)")
|
||||
f.BoolVar(&o.wait, "wait", false, "Wait for the new run to finish")
|
||||
case "cancel", "draft-delete":
|
||||
f.BoolVar(&o.yes, "yes", false, "Confirm this action without an interactive prompt")
|
||||
case "debug":
|
||||
f.StringVar(&o.opencode, "opencode", envOr("PIPELINES_OPENCODE", "opencode"), "Host OpenCode executable")
|
||||
f.BoolVar(&o.noOpen, "no-open", false, "Print the investigation prompt without launching OpenCode")
|
||||
@@ -202,6 +206,9 @@ func (a App) Run(ctx context.Context, args []string) error {
|
||||
if len(pos) != 1 {
|
||||
return fmt.Errorf("draft-delete requires one retained draft path")
|
||||
}
|
||||
if err := a.confirmAction("Delete retained draft "+pos[0]+"?", o.yes); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := draft.Delete(pos[0]); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -396,6 +403,9 @@ func (a App) Run(ctx context.Context, args []string) error {
|
||||
expected = 0
|
||||
}
|
||||
request = protocol.Message{Type: protocol.Submit, Name: name, Source: source, CreateOnly: d.CreateOnly || o.createOnly, ExpectedVersion: expected}
|
||||
if err := a.confirmAction("Publish "+name+" as an immutable version? Included schedules activate on acceptance.", o.yes); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
r, err := call(request)
|
||||
if err != nil {
|
||||
@@ -524,10 +534,16 @@ func (a App) Run(ctx context.Context, args []string) error {
|
||||
}
|
||||
typeName := protocol.GetRun
|
||||
if command == "cancel" {
|
||||
if err := a.confirmAction(fmt.Sprintf("Cancel run #%d? Previous side effects are not undone.", id), o.yes); err != nil {
|
||||
return err
|
||||
}
|
||||
typeName = protocol.CancelRun
|
||||
}
|
||||
key := ""
|
||||
if command == "retry" {
|
||||
if err := a.confirmAction(fmt.Sprintf("Retry failed run #%d as a fresh run? Reuses original input/directory; side effects may repeat.", id), o.yes); err != nil {
|
||||
return err
|
||||
}
|
||||
typeName = protocol.RetryRun
|
||||
key = o.key
|
||||
if key == "" {
|
||||
@@ -759,6 +775,9 @@ func (a App) run(ctx context.Context, pos []string, o *options, call callFunc, r
|
||||
if version == 0 {
|
||||
version = p.Version
|
||||
}
|
||||
if err := a.confirmAction(fmt.Sprintf("Run %s v%d in %s? This may edit files, execute commands and publish notifications.", p.Name, version, workspace), o.yes); err != nil {
|
||||
return err
|
||||
}
|
||||
key := o.key
|
||||
if key == "" {
|
||||
key = fmt.Sprintf("cli-%d-%d", os.Getpid(), time.Now().UnixNano())
|
||||
|
||||
Reference in New Issue
Block a user