prompt

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EstimateTokens

func EstimateTokens(output string) int64

EstimateTokens estimates the number of tokens in a string

func GenerateIgnoreList

func GenerateIgnoreList(repoPath, ignoreFilePath string, useGitignore bool) []string

GenerateIgnoreList generates a list of ignore patterns from the .gptignore file and the .gitignore file. Returns a slice of strings. Will return an empty slice if no ignore files exist.

func MarshalRepo

func MarshalRepo(repo *GitRepo, scrubComments bool) ([]byte, error)

func OutputGitRepo

func OutputGitRepo(repo *GitRepo, preambleFile string, scrubComments bool) (string, error)

OutputGitRepo outputs a Git repository to a text file

Types

type GitFile

type GitFile struct {
	Path     string `json:"path"`     // path to the file relative to the repository root
	Tokens   int64  `json:"tokens"`   // number of tokens in the file
	Contents string `json:"contents"` // contents of the file
}

GitFile is a file in a Git repository

type GitRepo

type GitRepo struct {
	TotalTokens int64     `json:"total_tokens"`
	Files       []GitFile `json:"files"`
	FileCount   int       `json:"file_count"`
}

GitRepo is a Git repository

func ProcessGitRepo

func ProcessGitRepo(repoPath string, ignoreList []string) (*GitRepo, error)

ProcessGitRepo processes a Git repository and returns a GitRepo object

Jump to

Keyboard shortcuts

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