tools

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendFencedCodeBlock

func AppendFencedCodeBlock(buf *bytes.Buffer, content string, languageHint string)

AppendFencedCodeBlock adds a standard Markdown fenced code block to the buffer.

func AppendFileMarkerFooter

func AppendFileMarkerFooter(buf *bytes.Buffer, filePath string)

AppendFileMarkerFooter adds the explicit file end marker.

func AppendFileMarkerHeader

func AppendFileMarkerHeader(buf *bytes.Buffer, filePath string)

AppendFileMarkerHeader adds the explicit file start marker.

func AppendSectionHeader

func AppendSectionHeader(buf *bytes.Buffer, title string)

AppendSectionHeader adds a standard Markdown H3 section header to the buffer.

func CaptureCommandOutput

func CaptureCommandOutput(cwd string, commandName string, args ...string) (string, error)

CaptureCommandOutput executes an arbitrary command and captures its stdout. Returns stdout string and potentially an *exec.ExitError if the command exits non-zero.

func CaptureGitOutput

func CaptureGitOutput(cwd string, args ...string) (string, error)

CaptureGitOutput runs a git command and captures its stdout.

func CheckGitPrereqs

func CheckGitPrereqs() (string, error)

CheckGitPrereqs verifies 'git' command exists and current directory is a Git repo.

func CommandExists

func CommandExists(name string) bool

CommandExists checks if a command executable name is found in the system's PATH.

func ExecuteCommand

func ExecuteCommand(cwd, commandName string, args ...string) error

ExecuteCommand runs an arbitrary command, piping stdio. Returns an error if the command fails, including the exit code in the error message.

func ExecuteGitCommand

func ExecuteGitCommand(cwd string, args ...string) error

ExecuteGitCommand runs a git command, piping stdio.

func GetCurrentBranchName

func GetCurrentBranchName(cwd string) (string, error)

GetCurrentBranchName retrieves the current Git branch name.

func IsGitRepo

func IsGitRepo(dir string) bool

IsGitRepo checks if a directory contains a .git subdirectory.

func IsWorkingDirClean

func IsWorkingDirClean(cwd string) (bool, error)

IsWorkingDirClean checks for staged, unstaged, or untracked files.

func LocalBranchExists

func LocalBranchExists(cwd, branchName string) (bool, error)

LocalBranchExists checks if a local branch exists.

func PromptForConfirmation

func PromptForConfirmation(prompt string) (bool, error)

PromptForConfirmation displays a prompt and expects a yes/no answer. Returns true for yes, false for no/default (Enter). Loops on invalid input.

func PromptForInput

func PromptForInput(prompt string) (string, error)

PromptForInput displays a prompt and reads a single line from stdin.

func ReadFileContent

func ReadFileContent(filePath string) ([]byte, error)

ReadFileContent reads the entire content of the file at the specified path.

func ReadMultilineInput

func ReadMultilineInput(eofMarker string) (string, error)

ReadMultilineInput reads multiple lines from stdin until an eofMarker is encountered.

func WriteBufferToFile

func WriteBufferToFile(filePath string, buf *bytes.Buffer) error

WriteBufferToFile writes the content of a bytes.Buffer to the specified file path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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