oneshot

package
v0.0.0-...-cc4816d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package oneshot is the UNIX-tool entrypoint: accept a prompt (positional arg or stdin), hand it to a Backend, write the result to stdout. The CLI command in cmd/fenster/main.go composes this with backend selection and flag parsing.

Modes:

  • default: print Content followed by "\n"
  • --stream: print content deltas as they arrive (no final newline if we already wrote one)
  • --json: emit a single OpenAI-compatible chat.completion JSON object

The DRY rule: this module never speaks HTTP. It uses Backend directly. The HTTP server in internal/server is a separate consumer of Backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, opts Options) error

Run executes the one-shot flow.

Types

type Options

type Options struct {
	Prompt  string
	System  string
	JSON    bool
	Stream  bool
	Quiet   bool
	Backend backend.Backend
	Stdin   io.Reader // optional; defaults to os.Stdin when nil
	Stdout  io.Writer // defaults to os.Stdout when nil
	Stderr  io.Writer // defaults to os.Stderr when nil
}

Options configures a one-shot invocation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL