Run tasks directly with language-independent project tools

This commit is contained in:
2026-10-09 01:48:46 +01:00
parent 998b0941d3
commit ed93d055bf
23 changed files with 170 additions and 156 deletions
+5 -8
View File
@@ -65,9 +65,9 @@ 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, "Start supplied name/prompt without interactive confirmation")
f.BoolVar(&o.allow, "allow-tools", false, "Explicitly approve declared shell/edit tools with --yes")
f.StringVar(&o.paths, "write-paths", "", "Comma-separated exact existing project-local Go files")
f.BoolVar(&o.yes, "yes", false, "Compatibility flag; supplied name/prompt already start immediately")
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)")
f.IntVar(&o.version, "version", 0, "Version to run (default: latest)")
f.BoolVar(&o.wait, "wait", false, "In JSON mode, wait for a terminal run state")
@@ -614,9 +614,6 @@ func (a App) run(ctx context.Context, pos []string, o *options, call callFunc, r
if o.yes && (o.name == "" || strings.TrimSpace(o.prompt) == "") {
return fmt.Errorf("--yes requires a pipeline and nonempty prompt")
}
if o.yes && len(paths) > 0 && !o.allow {
return fmt.Errorf("--write-paths with --yes requires --allow-tools")
}
if !o.json {
if o.name != "" {
p, err := resolve(o.name)
@@ -631,8 +628,8 @@ func (a App) run(ctx context.Context, pos []string, o *options, call callFunc, r
_, err := tea.NewProgram(tui.NewRun(ctx, o.url, tui.RunOptions{Pipeline: o.name, Prompt: o.prompt, Workspace: workspace, Yes: o.yes, AllowTools: o.allow, WritePaths: paths}), tea.WithContext(ctx), tea.WithAltScreen()).Run()
return err
}
if !o.yes {
return fmt.Errorf("noninteractive run requires --yes (tool approval remains separate)")
if o.name == "" || strings.TrimSpace(o.prompt) == "" {
return fmt.Errorf("run --json requires a pipeline and nonempty prompt")
}
p, err := resolve(o.name)
if err != nil {
+2 -2
View File
@@ -13,7 +13,7 @@ var usage = map[string]string{
"export": "export <name|id> [--version N]",
"templates": "templates [--json]",
"template": "template <key> [--source | --json]",
"run": "run [name|id] [prompt] [--yes] [--json [--wait]]",
"run": "run [name|id] [prompt] [--json [--wait]]",
"runs": "runs [--pipeline NAME] [--json]",
"inspect": "inspect <run-id> [--json]",
"cancel": "cancel <run-id> [--json]",
@@ -28,7 +28,7 @@ var notes = map[string]string{
"edit": "Omit the name to open fuzzy selection. Original immutable source is copied to a private draft. OpenCode edits that draft, never the live definition.",
"validate": "Uses the same server parser as submission. Does not persist or activate schedules. Structural validity does not prove runtime/tool availability.",
"submit": "This command is explicit approval to publish; schedules activate on acceptance. Managed drafts provide the name and base-version guard. --force never bypasses validation.",
"run": "Interactive: Enter adds a prompt line, Ctrl+S continues, then type RUN to start. JSON: supply a name/prompt and --yes. Tool approval is separate; cancellation does not undo edits.",
"run": "Runs in your current directory. Supplied name/prompt start immediately; otherwise select a pipeline and send a multiline task with Ctrl+S. Stage tools are enabled automatically; no file list or RUN confirmation. Cancellation does not undo edits.",
"rpc": "Accepts a JSON protocol envelope; '-' reads stdin. Every TUI server operation is available here too. Mutating commands are not dry runs.",
}
+1 -1
View File
@@ -48,7 +48,7 @@ Examples:
pipelines new "weekly digest" --template scheduled-summary --no-open --json
pipelines validate /path/to/draft.md --json
pipelines submit /path/to/draft.md
pipelines run "bug fix" "Fix the layout" --yes --json
pipelines run "bug fix" "Fix the layout" --json
Draft-first: OpenCode edits a private draft; nothing is published automatically.
Every submission is validated server-side. Submission activates any schedules.