ops

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package ops provides shared operations for CLI and MCP server. Both interfaces use the same underlying logic to ensure consistency.

Index

Constants

This section is empty.

Variables

View Source
var DefaultRegistry = NewRegistry()

DefaultRegistry is the global registry used by CLI and MCP.

View Source
var ErrConfirmRequired = errors.New("confirmation required: set confirm=true to apply changes")

ErrConfirmRequired is returned when confirm=false.

View Source
var ErrSlideNotFound = errors.New("slide not found")

ErrSlideNotFound is returned when a slide cannot be found.

Functions

func DetectBackend

func DetectBackend(path string) string

DetectBackend determines the backend from a file path.

Types

type ApplyOptions

type ApplyOptions struct {
	Confirm bool
}

ApplyOptions configures the ApplyChanges operation.

type ApplyResult

type ApplyResult struct {
	Applied bool
	Message string
}

ApplyResult contains the result of an ApplyChanges operation.

func ApplyChanges

func ApplyChanges(ctx context.Context, ref model.Ref, diff *model.Diff, opts ApplyOptions) (*ApplyResult, error)

ApplyChanges applies a diff to the presentation.

func ApplyChangesFromPath

func ApplyChangesFromPath(ctx context.Context, path string, diff *model.Diff, opts ApplyOptions) (*ApplyResult, error)

ApplyChangesFromPath is a convenience function that detects the backend.

type CreateOptions

type CreateOptions struct {
	Backend string
	Path    string
}

CreateOptions configures the CreateDeck operation.

type CreateResult

type CreateResult struct {
	Ref     model.Ref
	Message string
}

CreateResult contains the result of a CreateDeck operation.

func CreateDeck

func CreateDeck(ctx context.Context, deck *model.Deck, opts CreateOptions) (*CreateResult, error)

CreateDeck creates a new presentation.

type GetSlideResult

type GetSlideResult struct {
	Slide  *model.Slide
	Output string
}

GetSlideResult contains the result of a GetSlide operation.

func GetSlide

func GetSlide(ctx context.Context, ref model.Ref, slideID string, f format.Format) (*GetSlideResult, error)

GetSlide returns a single slide by ID.

func GetSlideFromPath

func GetSlideFromPath(ctx context.Context, path, slideID string, f format.Format) (*GetSlideResult, error)

GetSlideFromPath is a convenience function that detects the backend.

type ListSlidesResult

type ListSlidesResult struct {
	Slides []SlideInfo
	Output string
}

ListSlidesResult contains the result of a ListSlides operation.

func ListSlides

func ListSlides(ctx context.Context, ref model.Ref, f format.Format) (*ListSlidesResult, error)

ListSlides returns all slides in a deck.

func ListSlidesFromPath

func ListSlidesFromPath(ctx context.Context, path string, f format.Format) (*ListSlidesResult, error)

ListSlidesFromPath is a convenience function that detects the backend.

type PlanOptions

type PlanOptions struct {
	Format format.Format
}

PlanOptions configures the PlanChanges operation.

type PlanResult

type PlanResult struct {
	Diff   *model.Diff
	Output string
}

PlanResult contains the result of a PlanChanges operation.

func PlanChanges

func PlanChanges(ctx context.Context, ref model.Ref, desired *model.Deck, opts PlanOptions) (*PlanResult, error)

PlanChanges computes the diff between current and desired states.

func PlanChangesFromPath

func PlanChangesFromPath(ctx context.Context, path string, desired *model.Deck, opts PlanOptions) (*PlanResult, error)

PlanChangesFromPath is a convenience function that detects the backend.

type ReadOptions

type ReadOptions struct {
	Format format.Format
}

ReadOptions configures the ReadDeck operation.

type ReadResult

type ReadResult struct {
	Deck   *model.Deck
	Output string
}

ReadResult contains the result of a ReadDeck operation.

func ReadDeck

func ReadDeck(ctx context.Context, ref model.Ref, opts ReadOptions) (*ReadResult, error)

ReadDeck reads a presentation and returns it in the requested format.

func ReadDeckFromPath

func ReadDeckFromPath(ctx context.Context, path string, opts ReadOptions) (*ReadResult, error)

ReadDeckFromPath is a convenience function that detects the backend.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry manages backend implementations.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new backend registry.

func (*Registry) Get

func (r *Registry) Get(name string) (model.Backend, error)

Get retrieves a backend by name.

func (*Registry) List

func (r *Registry) List() []string

List returns all registered backend names.

func (*Registry) Register

func (r *Registry) Register(name string, backend model.Backend)

Register adds a backend to the registry.

type SlideInfo

type SlideInfo struct {
	ID        string `json:"id"`
	SectionID string `json:"section_id"`
	Title     string `json:"title"`
	Layout    string `json:"layout"`
}

SlideInfo provides summary information about a slide.

type UpdateSlideOptions

type UpdateSlideOptions struct {
	Confirm bool
}

UpdateSlideOptions configures the UpdateSlide operation.

type UpdateSlideResult

type UpdateSlideResult struct {
	Updated bool
	Message string
}

UpdateSlideResult contains the result of an UpdateSlide operation.

func UpdateSlide

func UpdateSlide(ctx context.Context, ref model.Ref, slideID string, updates *model.Slide, opts UpdateSlideOptions) (*UpdateSlideResult, error)

UpdateSlide updates a single slide.

Jump to

Keyboard shortcuts

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