common

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package common provides shared functionality for persistence repositories.

Index

Constants

View Source
const (
	DirPerm  = 0o750 // Directory permissions: rwxr-x---
	FilePerm = 0o600 // File permissions: rw-------
)

File permission constants for persistence operations

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
	Marshal        MarshalFunc
}

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) SavePrompt added in v1.1.9

func (r *BasePromptRepository) SavePrompt(config *prompt.Config) error

SavePrompt saves a prompt configuration to disk

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 MarshalFunc added in v1.1.9

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

MarshalFunc is a function that marshals a prompt config to bytes

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