domain

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package domain implements the core business logic of the application.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidDirPath indicates that the provided directory path is invalid.
	ErrInvalidDirPath = errors.New("invalid directory path")
	// ErrFileOperation indicates a failure during file operations.
	ErrFileOperation = errors.New("file operation failed")
	// ErrTokenization indicates a failure during tokenization.
	ErrTextProcessing = errors.New("text processing failed")
	// ErrEmptyDir indicates that no eligible files were found in the specified
	// directory.
	ErrEmptyDir = errors.New("no eligible files found in directory")
	// ErrTooManyErrors indicates that too many errors occurred during directory
	// processing, leading to an abort.
	ErrTooManyErrors = errors.New("too many errors during directory processing")
	// ErrNoTokensFound indicates that no tokens were found after processing the
	// files in the specified directory.
	ErrNoTokensFound = errors.New("no tokens found in directory")
)

Functions

func ProcessDirectory

func ProcessDirectory(dirPath string) error

ProcessDirectory tokenizes all eligible files in the specified directory and stores the tokens in the database. It returns an error if a set number of errors occur during processing.

func Prompt

func Prompt(dirPath string, maxLen int) (string, error)

Prompt generates a prompt of the maximum specified character length from tokens of the specified directory. This is the main entry point of the domain package.

If the TYPOMAT_PROMPT environment variable is set, its value is used directly as the prompt, bypassing text generation.

Types

type FileStatus

type FileStatus int

FileStatus represents the status of a file with respect to the database.

const (
	// FileStatusUnchanged indicates the file is unchanged since last
	// tokenization.
	FileStatusUnchanged FileStatus = iota
	// FileStatusChanged indicates the file has changed since last tokenization.
	FileStatusChanged
	// FileStatusNew indicates the file is new and not present in the database.
	FileStatusNew
	// FileStatusIneligible indicates the file is ineligible for tokenization.
	FileStatusIneligible
)

Jump to

Keyboard shortcuts

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