Documentation
¶
Index ¶
- func AppendFencedCodeBlock(buf *bytes.Buffer, content string, languageHint string)
- func AppendFileMarkerFooter(buf *bytes.Buffer, filePath string)
- func AppendFileMarkerHeader(buf *bytes.Buffer, filePath string)
- func AppendSectionHeader(buf *bytes.Buffer, title string)
- func CaptureCommandOutput(cwd string, commandName string, args ...string) (stdoutStr string, stderrStr string, err error)
- func CaptureGitOutput(cwd string, args ...string) (string, string, error)
- func CheckGitPrereqs() (string, error)
- func CommandExists(name string) bool
- func ExecuteCommand(cwd, commandName string, args ...string) error
- func ExecuteGitCommand(cwd string, args ...string) error
- func GetCurrentBranchName(cwd string) (string, error)
- func IsGitRepo(dir string) bool
- func IsWorkingDirClean(cwd string) (bool, error)
- func LocalBranchExists(cwd, branchName string) (bool, error)
- func ReadFileContent(filePath string) ([]byte, error)
- func WriteBufferToFile(filePath string, buf *bytes.Buffer) error
- type BranchSyncStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendFencedCodeBlock ¶
AppendFencedCodeBlock adds a standard Markdown fenced code block to the buffer.
func AppendFileMarkerFooter ¶
AppendFileMarkerFooter adds the explicit file end marker.
func AppendFileMarkerHeader ¶
AppendFileMarkerHeader adds the explicit file start marker.
func AppendSectionHeader ¶
AppendSectionHeader adds a standard Markdown H3 section header to the buffer.
func CaptureCommandOutput ¶
func CaptureCommandOutput(cwd string, commandName string, args ...string) (stdoutStr string, stderrStr string, err error)
CaptureCommandOutput executes a command and captures its stdout and stderr. Returns stdout string, stderr string, and any error (including *exec.ExitError if command ran but exited non-zero).
func CaptureGitOutput ¶
CaptureGitOutput runs a git command and captures its stdout and stderr. Returns stdout string, stderr string, and any error.
func CheckGitPrereqs ¶
CheckGitPrereqs verifies 'git' command exists and current directory is a Git repo.
func CommandExists ¶
CommandExists checks if a command executable name is found in the system's PATH.
func ExecuteCommand ¶
ExecuteCommand runs an arbitrary command, piping its stdout, stderr, and stdin. It's a utility for commands where output capture isn't needed, just execution. TODO: This function pipes the command's stdio directly. Callers (e.g., commands in cmd/)
should use their ui.Presenter instance to announce the command *before* calling this function if user-facing status information is desired.
func ExecuteGitCommand ¶
ExecuteGitCommand runs a git command, piping stdio.
func GetCurrentBranchName ¶
GetCurrentBranchName retrieves the current Git branch name. Returns an error if in a detached HEAD state or if the branch name cannot be determined.
func IsGitRepo ¶
IsGitRepo checks if a directory contains a .git subdirectory or file (for worktrees).
func IsWorkingDirClean ¶
IsWorkingDirClean checks for staged, unstaged, or untracked files.
func LocalBranchExists ¶
LocalBranchExists checks if a local branch exists by its short name.
func ReadFileContent ¶
ReadFileContent reads the entire content of the file at the specified path. Returns the content as a byte slice or an error if reading fails.
func WriteBufferToFile ¶
WriteBufferToFile writes the content of a bytes.Buffer to the specified file path. It uses default file permissions (0644). It prints informational messages about writing to os.Stdout. TODO: Refactor to remove direct fmt.Printf calls.
Calling commands should use their Presenter for user-facing messages or a Logger for debug/trace information related to file writing. This function should focus solely on writing the file.
Types ¶
type BranchSyncStatus ¶ added in v0.0.2
type BranchSyncStatus int
BranchSyncStatus represents the synchronization state of a local branch relative to its remote.
const ( StatusUpToDate BranchSyncStatus = iota StatusAhead StatusBehind StatusDiverged StatusNoUpstreamOrRemoteMissing StatusError )
func GetLocalBranchSyncStatus ¶ added in v0.0.2
func GetLocalBranchSyncStatus(cwd, localBranchName, remoteName, remoteBranchName string) (status BranchSyncStatus, aheadCount int, behindCount int, err error)
GetLocalBranchSyncStatus compares a local branch with its specified remote-tracking branch. Assumes 'git fetch' has been run recently enough for the remote-tracking ref to be locally available if it exists remotely.
func (BranchSyncStatus) String ¶ added in v0.0.2
func (s BranchSyncStatus) String() string
String provides a human-readable representation of BranchSyncStatus.