Documentation
¶
Index ¶
- func AfterLog()
- func BeforeLog()
- func BuildDataURL(mimeType string, data []byte) string
- func Contains(list []string, item string, ignoreCase bool) bool
- func DecodeBase64String(data string) ([]byte, error)
- func DownloadAndExtractZip(urlStr, destDir string) error
- func EndWithNewline(s string) bool
- func Errorf(cmd *cobra.Command, format string, args ...interface{})
- func Errorln(cmd *cobra.Command, args ...interface{})
- func ExtractThinkTags(content string) (thinking, cleaned string)
- func FormatMinutesSeconds(d time.Duration) string
- func GenerateTempFileName() string
- func GetBase64String(data []byte) string
- func GetFileContent(filePath string) (string, error)
- func GetGitHubZipURL(urlStr string) string
- func GetSanitizeTitle(title string) string
- func GetStringValue(data map[string]any, key string) string
- func GetUserConfigDir() string
- func HasContent(s *string) bool
- func HasGit() bool
- func InitLogger()
- func InjectThinkTags(content, thinking string) string
- func IsEmpty(s string) bool
- func IsGitHubURL(urlStr string) bool
- func JoinFilePath(dir string, filename string) string
- func LogDebugf(format string, args ...interface{})
- func LogDebugln(args ...interface{})
- func LogErrorf(format string, args ...interface{})
- func LogErrorln(args ...interface{})
- func LogInfof(format string, args ...interface{})
- func LogInfoln(args ...interface{})
- func LogSuccessf(format string, args ...interface{})
- func LogSuccessln(args ...interface{})
- func LogWarnf(format string, args ...interface{})
- func LogWarnln(args ...interface{})
- func MakeUserSubDir(subparts ...string) string
- func ParseDataURL(dataURL string) (string, []byte, error)
- func Print(cmd *cobra.Command, args ...interface{})
- func Printf(cmd *cobra.Command, format string, args ...interface{})
- func Println(cmd *cobra.Command, args ...interface{})
- func RegisterLoggerHook(h LoggerHook)
- func SetLoggerLevel(level log.Level)
- func Successf(cmd *cobra.Command, format string, args ...interface{})
- func Successln(cmd *cobra.Command, args ...interface{})
- func TruncateString(s string, maxLen int) string
- func ValidateResourceName(resourceType, name string) error
- func Warnf(cmd *cobra.Command, format string, args ...interface{})
- func Warnln(cmd *cobra.Command, args ...interface{})
- func WriteFileContent(path, content string) error
- type LoggerHook
- type ProgressWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDataURL ¶ added in v1.16.8
BuildDataURL constructs a data URL string from MIME type and raw bytes. Example: "image/png", []byte -> "data:image/png;base64,iVBORw0KGgo..."
func DecodeBase64String ¶ added in v1.16.8
DecodeBase64String decodes a base64 encoded string to raw bytes.
func DownloadAndExtractZip ¶
DownloadAndExtractZip downloads a zip file from the given URL and extracts it to the target directory. It creates the target directory if it doesn't exist. This function expects the zip file to contain a single root directory (like GitHub zips do) and extracts the *contents* of that root directory directly into destDir.
func EndWithNewline ¶ added in v1.15.6
func Errorf ¶ added in v1.15.6
Errorf prints an error message to the command's designated error output stream.
func Errorln ¶ added in v1.15.6
Errorln prints an error message with a newline to the command's error output stream.
func ExtractThinkTags ¶ added in v1.15.6
ExtractThinkTags extracts thinking content from <think>...</think> tags. Some providers (like MiniMax, some Qwen endpoints) embed reasoning content in <think> tags within the regular content field instead of using a separate reasoning_content field.
Returns:
- thinking: the extracted thinking content (empty if no tags found)
- cleaned: the content with <think> tags removed
func FormatMinutesSeconds ¶ added in v1.15.6
func GenerateTempFileName ¶ added in v1.15.6
func GenerateTempFileName() string
func GetBase64String ¶ added in v1.16.8
GetBase64String returns the base64 encoded string of the given data.
func GetFileContent ¶ added in v1.15.6
func GetGitHubZipURL ¶
GetGitHubZipURL converts a GitHub repository clone URL to its zip archive download URL.
func GetSanitizeTitle ¶ added in v1.15.6
func GetStringValue ¶ added in v1.15.6
Helper function to safely extract string values
func GetUserConfigDir ¶ added in v1.15.6
func GetUserConfigDir() string
func HasContent ¶ added in v1.15.6
func HasGit ¶
func HasGit() bool
HasGit checks if the git executable is available in the system PATH.
func InitLogger ¶ added in v1.15.6
func InitLogger()
func InjectThinkTags ¶ added in v1.15.12
InjectThinkTags cleanly prepends reasoning logic wrapped in <think> tags to the primary content area. This is essential for officially preserving continuous "internal monologue" back to OpenRouter/DeepSeek instances within generic API clients that only accept a single `content` string.
func IsGitHubURL ¶
IsGitHubURL checks if the given URL is a standard GitHub repository URL.
func JoinFilePath ¶ added in v1.15.6
func LogDebugln ¶ added in v1.16.16
func LogDebugln(args ...interface{})
func LogErrorln ¶ added in v1.16.16
func LogErrorln(args ...interface{})
func LogSuccessf ¶ added in v1.16.16
func LogSuccessf(format string, args ...interface{})
func LogSuccessln ¶ added in v1.16.16
func LogSuccessln(args ...interface{})
func MakeUserSubDir ¶ added in v1.15.6
func ParseDataURL ¶ added in v1.16.8
ParseDataURL extracts the MIME type and base64-decoded raw bytes from a data URL string. Example: "data:image/png;base64,iVBORw0KGgo..." -> "image/png", []byte, nil
func Print ¶ added in v1.16.16
Print formats and prints text to the command's designated standard output stream.
func Printf ¶ added in v1.16.16
Printf formats and prints text to the command's designated standard output stream.
func Println ¶ added in v1.16.16
Println prints text with a trailing newline to the command's designated standard output stream.
func RegisterLoggerHook ¶ added in v1.15.9
func RegisterLoggerHook(h LoggerHook)
RegisterLoggerHook registers a hook to be called before and after logging.
func SetLoggerLevel ¶ added in v1.15.6
func Successln ¶ added in v1.15.6
Successln prints a success message with a newline to the command's output stream.
func TruncateString ¶ added in v1.15.6
Helper function to truncate strings with ellipsis
func ValidateResourceName ¶ added in v1.15.16
ValidateResourceName checks if the name is filesystem-safe.
func Warnf ¶ added in v1.15.6
Warnf prints a warning message to the command's designated error output stream.
func Warnln ¶ added in v1.15.6
Warnln prints a warning message with a newline to the command's error output stream.
func WriteFileContent ¶ added in v1.16.9
Types ¶
type LoggerHook ¶ added in v1.15.9
type LoggerHook interface {
BeforeLog() bool // Returns true if indicator was active
AfterLog(wasActive bool)
}
LoggerHook defines an interface for external components to intercept logging and handle UI-specific tasks like stopping/restarting indicators.
type ProgressWriter ¶
ProgressWriter tracks the number of bytes written to it.