Documentation
¶
Overview ¶
Package interactive provides user interaction support for release-agent.
Index ¶
- type Answer
- type CLIPrompter
- func (p *CLIPrompter) Ask(q Question) (Answer, error)
- func (p *CLIPrompter) Confirm(message string) (bool, error)
- func (p *CLIPrompter) Error(message string)
- func (p *CLIPrompter) Info(message string)
- func (p *CLIPrompter) ShowProposal(proposal actions.Proposal) error
- func (p *CLIPrompter) Warn(message string)
- type JSONPrompter
- func (p *JSONPrompter) Ask(q Question) (Answer, error)
- func (p *JSONPrompter) Confirm(message string) (bool, error)
- func (p *JSONPrompter) Error(message string)
- func (p *JSONPrompter) Info(message string)
- func (p *JSONPrompter) ShowProposal(proposal actions.Proposal) error
- func (p *JSONPrompter) Warn(message string)
- type Option
- type Prompter
- type ProposalAction
- type Question
- type QuestionType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Answer ¶
type Answer struct {
QuestionID string // ID of the question being answered
Selected []string // Selected option IDs (for choice types)
Text string // Text response (for text type)
Confirmed bool // Response for confirm type
}
Answer represents a user's response to a question.
type CLIPrompter ¶
type CLIPrompter struct {
// contains filtered or unexported fields
}
CLIPrompter implements Prompter for terminal interaction.
func (*CLIPrompter) Ask ¶
func (p *CLIPrompter) Ask(q Question) (Answer, error)
Ask presents a question and returns the user's answer.
func (*CLIPrompter) Confirm ¶
func (p *CLIPrompter) Confirm(message string) (bool, error)
Confirm asks a yes/no question.
func (*CLIPrompter) Error ¶
func (p *CLIPrompter) Error(message string)
Error displays an error message.
func (*CLIPrompter) Info ¶
func (p *CLIPrompter) Info(message string)
Info displays an informational message.
func (*CLIPrompter) ShowProposal ¶
func (p *CLIPrompter) ShowProposal(proposal actions.Proposal) error
ShowProposal displays a proposed change for review.
func (*CLIPrompter) Warn ¶
func (p *CLIPrompter) Warn(message string)
Warn displays a warning message.
type JSONPrompter ¶
type JSONPrompter struct {
// contains filtered or unexported fields
}
JSONPrompter implements Prompter with JSON input/output for Claude Code integration.
func DefaultJSONPrompter ¶
func DefaultJSONPrompter() *JSONPrompter
DefaultJSONPrompter returns a JSONPrompter using stdout/stdin.
func NewJSONPrompter ¶
func NewJSONPrompter(w io.Writer, r io.Reader) *JSONPrompter
NewJSONPrompter creates a new JSONPrompter.
func (*JSONPrompter) Ask ¶
func (p *JSONPrompter) Ask(q Question) (Answer, error)
Ask presents a question and returns the user's answer via JSON.
func (*JSONPrompter) Confirm ¶
func (p *JSONPrompter) Confirm(message string) (bool, error)
Confirm asks a yes/no question via JSON.
func (*JSONPrompter) Error ¶
func (p *JSONPrompter) Error(message string)
Error displays an error message via JSON.
func (*JSONPrompter) Info ¶
func (p *JSONPrompter) Info(message string)
Info displays an informational message via JSON.
func (*JSONPrompter) ShowProposal ¶
func (p *JSONPrompter) ShowProposal(proposal actions.Proposal) error
ShowProposal displays a proposed change for review via JSON.
func (*JSONPrompter) Warn ¶
func (p *JSONPrompter) Warn(message string)
Warn displays a warning message via JSON.
type Option ¶
type Option struct {
ID string // Unique identifier
Label string // Display text
Description string // Optional description
}
Option represents a choice option for questions.
type Prompter ¶
type Prompter interface {
// Ask presents a question and returns the user's answer.
Ask(q Question) (Answer, error)
// ShowProposal displays a proposed change for review.
ShowProposal(p actions.Proposal) error
// Confirm asks a yes/no question.
Confirm(message string) (bool, error)
// Info displays an informational message.
Info(message string)
// Warn displays a warning message.
Warn(message string)
// Error displays an error message.
Error(message string)
}
Prompter handles user interaction.
type ProposalAction ¶
type ProposalAction int
ProposalAction represents what to do with a proposal.
const ( // ProposalActionApply applies the proposal. ProposalActionApply ProposalAction = iota // ProposalActionSkip skips the proposal. ProposalActionSkip // ProposalActionEdit allows editing before applying. ProposalActionEdit // ProposalActionAbort aborts the entire operation. ProposalActionAbort )
func ReviewProposal ¶
func ReviewProposal(p Prompter, proposal actions.Proposal) (ProposalAction, error)
ReviewProposal presents a proposal and asks for a decision.
func (ProposalAction) String ¶
func (pa ProposalAction) String() string
String returns the string representation of the proposal action.
type Question ¶
type Question struct {
ID string // Unique identifier
Text string // The question text
Type QuestionType // Type of question
Options []Option // Available options (for choice types)
Default string // Default value or option ID
Context string // Additional context (e.g., code snippet)
}
Question represents a question for the user.
type QuestionType ¶
type QuestionType int
QuestionType defines the type of question.
const ( // QuestionTypeSingleChoice allows selecting one option. QuestionTypeSingleChoice QuestionType = iota // QuestionTypeMultiChoice allows selecting multiple options. QuestionTypeMultiChoice // QuestionTypeConfirm is a yes/no question. QuestionTypeConfirm // QuestionTypeText allows free-form text input. QuestionTypeText )
func (QuestionType) String ¶
func (qt QuestionType) String() string
String returns the string representation of the question type.