common

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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