shell

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package shell implements an interactive REPL session combining conversational AI with plan awareness. It is the backend for the `cloop shell` command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Role    string // "user" or "assistant"
	Content string
}

Message is a single turn in the conversation history.

type Shell

type Shell struct {
	State    *state.ProjectState
	Provider provider.Provider
	Model    string
	Timeout  time.Duration
	History  []Message
	WorkDir  string // project root, used for prompt-stats hint injection

	// OnToken, if set, enables streaming. Each token chunk is passed to this
	// callback as the AI generates its response.
	OnToken func(token string)

	// OnSave is called after any action that mutates state so that the caller
	// can persist the change to disk.
	OnSave func() error
}

Shell holds all state for a running cloop shell session.

func New

func New(s *state.ProjectState, prov provider.Provider, model string) *Shell

New creates a Shell with sensible defaults.

func (*Shell) Run

func (sh *Shell) Run(ctx context.Context, in io.Reader, out io.Writer) error

Run starts the interactive REPL, reading from in and writing to out. It returns when the user types /quit or in reaches EOF.

Jump to

Keyboard shortcuts

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