common

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package common provides shared functionality for persistence repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidatePromptConfig

func ValidatePromptConfig(config *prompt.Config) error

ValidatePromptConfig validates the prompt configuration structure

Types

type BasePromptRepository

type BasePromptRepository struct {
	BasePath       string
	TaskTypeToFile map[string]string
	Cache          map[string]*prompt.Config
	Extensions     []string
	Unmarshal      UnmarshalFunc
}

BasePromptRepository provides common prompt repository functionality

func NewBasePromptRepository

func NewBasePromptRepository(basePath string, taskTypeToFile map[string]string, extensions []string, unmarshal UnmarshalFunc) *BasePromptRepository

NewBasePromptRepository creates a new base repository

func (*BasePromptRepository) HasMatchingTaskType

func (r *BasePromptRepository) HasMatchingTaskType(path, taskType string) bool

HasMatchingTaskType checks if a file contains the specified task type

func (*BasePromptRepository) HasValidExtension

func (r *BasePromptRepository) HasValidExtension(path string) bool

HasValidExtension checks if a file has a valid extension

func (*BasePromptRepository) ListPrompts

func (r *BasePromptRepository) ListPrompts() ([]string, error)

ListPrompts returns all available prompt task types

func (*BasePromptRepository) LoadPrompt

func (r *BasePromptRepository) LoadPrompt(taskType string) (*prompt.Config, error)

LoadPrompt loads a prompt configuration by task type

func (*BasePromptRepository) ResolveFilePath

func (r *BasePromptRepository) ResolveFilePath(taskType string) (string, error)

ResolveFilePath finds the file path for a given task type

func (*BasePromptRepository) SearchByContent

func (r *BasePromptRepository) SearchByContent(taskType string) string

SearchByContent searches for files by parsing and checking task type

func (*BasePromptRepository) SearchByFilename

func (r *BasePromptRepository) SearchByFilename(taskType string) string

SearchByFilename searches for files by filename patterns

func (*BasePromptRepository) SearchForPrompt

func (r *BasePromptRepository) SearchForPrompt(taskType string) (string, error)

SearchForPrompt searches for a file matching the task type

type UnmarshalFunc

type UnmarshalFunc func([]byte, interface{}) error

UnmarshalFunc is a function that unmarshals data into a prompt config

Jump to

Keyboard shortcuts

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