msgfmt

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const WhiteSpaceChars = " \t\n\r\f\v"

Variables

This section is empty.

Functions

func FormatAgentMessage

func FormatAgentMessage(agentType AgentType, message string, userInput string) string

func IndexSubslice

func IndexSubslice[T comparable](s, sub []T) int

IndexSubslice returns the index of the first instance of sub in s, or -1 if sub is not present in s. It's not the optimal algorithm - KMP would be better - but I don't want to implement anything more complex. If I can find a library that implements a faster algorithm, I'll use it.

func RemoveUserInput

func RemoveUserInput(msgRaw string, userInputRaw string, agentType AgentType) string

RemoveUserInput removes the user input from the message. Goose, Aider, and Claude Code echo back the user's input to make it visible in the terminal. This function makes a best effort attempt to remove it. It assumes that the user input doesn't have any leading or trailing whitespace. Otherwise, the input may not be fully removed from the message. For instance, if there are any leading or trailing lines with only whitespace, and each line of the input in msgRaw is preceded by a character like `>`, these lines will not be removed.

func TrimWhitespace

func TrimWhitespace(msg string) string

Types

type AgentType

type AgentType string
const (
	AgentTypeClaude   AgentType = "claude"
	AgentTypeGoose    AgentType = "goose"
	AgentTypeAider    AgentType = "aider"
	AgentTypeCodex    AgentType = "codex"
	AgentTypeGemini   AgentType = "gemini"
	AgentTypeCopilot  AgentType = "copilot"
	AgentTypeAmp      AgentType = "amp"
	AgentTypeCursor   AgentType = "cursor"
	AgentTypeAuggie   AgentType = "auggie"
	AgentTypeAmazonQ  AgentType = "amazonq"
	AgentTypeOpencode AgentType = "opencode"
	AgentTypeCustom   AgentType = "custom"
)

Jump to

Keyboard shortcuts

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