Documentation
¶
Index ¶
- Constants
- Variables
- func ApplicationError(err error) error
- func CoalesceFocus(focus any) any
- func CoalesceState(state any) any
- func InvalidInput(message string, state any) error
- func MarshalEnvelope(envelope Envelope) ([]byte, error)
- func NormalizeNextActions(next []any) []any
- func SplitStateFocus(state any) (any, any)
- func WriteJSON(w io.Writer, envelope Envelope) error
- type Directive
- type Envelope
- func ClassifyError(err error, ctx UnexpectedContext) Envelope
- func ErrorEnvelope(err error) Envelope
- func ReadEnvelope(state, focus any, next Directive) Envelope
- func UnexpectedErrorEnvelope(err error, ctx UnexpectedContext) Envelope
- func WriteEnvelope(state, focus, result any, next Directive) Envelope
- type Error
- type Failure
- type UnexpectedContext
Constants ¶
const IssueRepoURL = "https://github.com/aitoroses/specctl/issues/new"
IssueRepoURL is the destination for unexpected-error reports.
Variables ¶
var BuildVersion = "dev"
BuildVersion is overridable at link time (-ldflags "-X ...BuildVersion=v1.2.3").
Functions ¶
func ApplicationError ¶
func CoalesceFocus ¶
func CoalesceState ¶
func InvalidInput ¶
func MarshalEnvelope ¶
MarshalEnvelope encodes an envelope to JSON, returning a fixed fallback payload (and a non-nil error) when encoding fails. Callers should always be able to write the returned bytes to the wire, even on failure.
func NormalizeNextActions ¶
func SplitStateFocus ¶
Types ¶
type Directive ¶
type Directive struct {
Mode string `json:"mode"`
Steps []any `json:"steps,omitempty"`
Options []any `json:"options,omitempty"`
}
func ChooseThenSequence ¶
func CoalesceDirective ¶
func DirectiveForReadMode ¶
type Envelope ¶
type Envelope struct {
State any `json:"state"`
Focus any `json:"focus"`
Result any `json:"result,omitempty"`
Next Directive `json:"next"`
Error *Error `json:"error,omitempty"`
}
func ClassifyError ¶
func ClassifyError(err error, ctx UnexpectedContext) Envelope
ClassifyError returns an envelope for any error coming out of the application layer. *Failure values keep their tipified codes; anything else is treated as unexpected and gets the report_issue hint.
func ErrorEnvelope ¶
func ReadEnvelope ¶
func UnexpectedErrorEnvelope ¶
func UnexpectedErrorEnvelope(err error, ctx UnexpectedContext) Envelope
UnexpectedErrorEnvelope produces an envelope for errors that look like bugs in specctl rather than user input problems. It embeds a report_issue step so MCP clients (or CLI consumers) can prompt the user to file a bug with the captured tool/input/error context.