playbooks

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package playbooks provides management of playbook directories and their files. Playbooks are reusable knowledge containers that users create and manage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileItem

type FileItem struct {
	Playbook   string    `json:"playbook"`
	Path       string    `json:"path"`
	SizeBytes  int64     `json:"size_bytes"`
	ModifiedAt time.Time `json:"modified_at"`
	Summary    string    `json:"summary,omitempty"`
	Content    string    `json:"content,omitempty"`
	// Byte range fields (only set when offset/max_bytes used)
	Offset     int64 `json:"offset,omitempty"`
	TotalBytes int64 `json:"total_bytes,omitempty"`
}

FileItem represents a file within a playbook.

type Playbook

type Playbook struct {
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
}

Playbook represents a playbook directory.

type Service

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

Service provides playbook operations.

func NewService

func NewService(baseDir string, logger *logging.Logger) *Service

NewService creates a new playbooks service.

func (*Service) AppendFile

func (s *Service) AppendFile(playbookName, path, content, summary string) error

AppendFile appends content to a file in a playbook

func (*Service) Create

func (s *Service) Create(name string) error

Create creates a new playbook directory.

func (*Service) Delete

func (s *Service) Delete(name string) error

Delete deletes a playbook and all its contents.

func (*Service) DeleteFile

func (s *Service) DeleteFile(playbookName, path string) error

DeleteFile deletes a file from a playbook.

func (*Service) EditFile

func (s *Service) EditFile(playbookName, path, oldString, newString string, replaceAll bool) error

EditFile performs a search-and-replace edit on a file within a playbook.

func (*Service) Exists

func (s *Service) Exists(name string) bool

Exists checks if a playbook exists.

func (*Service) GetFile

func (s *Service) GetFile(playbookName, path string, offset, maxBytes int64) (*FileItem, error)

GetFile retrieves a file from a playbook with optional byte range. If offset is 0 and maxBytes is 0, returns the entire file. If maxBytes > 0, returns at most maxBytes starting from offset.

func (*Service) List

func (s *Service) List() ([]Playbook, error)

List returns all playbooks.

func (*Service) ListFiles

func (s *Service) ListFiles(playbookName, prefix string) ([]FileItem, error)

ListFiles lists files within a playbook, optionally filtered by prefix.

func (*Service) PutFile

func (s *Service) PutFile(playbookName, path, content, summary string) (bool, error)

PutFile creates or overwrites a file in a playbook.

func (*Service) Rename

func (s *Service) Rename(name, newName string) error

Rename renames a playbook.

func (*Service) RenameFile

func (s *Service) RenameFile(playbookName, fromPath, toPath string) error

RenameFile renames or moves a file within a playbook.

func (*Service) Search

func (s *Service) Search(playbookName, query string, limit, offset int) ([]FileItem, int, error)

Search searches for content in playbook files. If playbookName is empty, searches all playbooks.

Jump to

Keyboard shortcuts

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