Documentation
¶
Index ¶
- func BuildSystemPrompt(info SysInfo) string
- func BuildUserPrompt(args []string) string
- func CleanCommand(raw string) string
- func FetchCommand(ctx context.Context, cfg *config.Config, systemPrompt, userPrompt string) (string, error)
- func Run(ctx context.Context, cfg *config.Config, args []string)
- func RunCommand(info SysInfo, command string) int
- type MenuAction
- type SysInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildSystemPrompt ¶
BuildSystemPrompt creates the system message instructing the LLM to return only a shell command.
func BuildUserPrompt ¶
BuildUserPrompt joins the user's CLI args into a single request string.
func CleanCommand ¶
CleanCommand strips markdown code fences from a model response, in case the model disobeys the "no fences" instruction.
func FetchCommand ¶
func FetchCommand(ctx context.Context, cfg *config.Config, systemPrompt, userPrompt string) (string, error)
FetchCommand sends a system+user prompt to the cli-assist model and returns the cleaned command string.
func Run ¶
Run is the entrypoint for --cli-assist mode. It detects the OS/shell, builds a prompt, fetches a command from the LLM, shows an interactive menu, and either executes or exits.
func RunCommand ¶
RunCommand executes the given command in the detected shell. It connects stdin/stdout/stderr directly to the terminal so interactive commands work. Returns the exit code of the process.
Types ¶
type MenuAction ¶
type MenuAction int
MenuAction represents the user's choice from the menu.
const ( ActionExecute MenuAction = iota // Run the command ActionEditPrompt // Re-enter the request text and re-fetch ActionEditCommand // Edit the command inline, then re-show menu ActionQuit // Exit without executing )
type SysInfo ¶
type SysInfo struct {
OS string // "linux", "macos", "windows"
ShellPath string // e.g. "/bin/bash", "C:\Windows\System32\cmd.exe"
ShellName string // e.g. "bash", "zsh", "fish", "powershell", "cmd"
}
SysInfo holds the detected operating system and shell information.
func DetectSysInfo ¶
func DetectSysInfo() SysInfo
DetectSysInfo detects the current OS and user shell at runtime.