diff --git a/cmd/shelley/prompt.go b/cmd/shelley/prompt.go deleted file mode 100644 index 272752770492eb0acc6f0a2b827e294fe9d3e083..0000000000000000000000000000000000000000 --- a/cmd/shelley/prompt.go +++ /dev/null @@ -1,77 +0,0 @@ -package main - -import ( - _ "embed" - "fmt" - "os" - "os/exec" - "strings" - "text/template" -) - -//go:embed prompt.txt -var promptTemplate string - -// SystemPromptData contains all the data needed to render the system prompt template -type SystemPromptData struct { - WorkingDirectory string - GitInfo *GitInfo -} - -type GitInfo struct { - Root string -} - -// GenerateSystemPrompt generates the system prompt using the embedded template -func GenerateSystemPrompt() (string, error) { - data, err := collectSystemData() - if err != nil { - return "", fmt.Errorf("failed to collect system data: %w", err) - } - - tmpl, err := template.New("system_prompt").Parse(promptTemplate) - if err != nil { - return "", fmt.Errorf("failed to parse template: %w", err) - } - - var buf strings.Builder - err = tmpl.Execute(&buf, data) - if err != nil { - return "", fmt.Errorf("failed to execute template: %w", err) - } - - return buf.String(), nil -} - -func collectSystemData() (*SystemPromptData, error) { - wd, err := os.Getwd() - if err != nil { - return nil, fmt.Errorf("failed to get working directory: %w", err) - } - - data := &SystemPromptData{ - WorkingDirectory: wd, - } - - // Try to collect git info - gitInfo, err := collectGitInfo() - if err == nil { - data.GitInfo = gitInfo - } - - return data, nil -} - -func collectGitInfo() (*GitInfo, error) { - // Find git root - rootCmd := exec.Command("git", "rev-parse", "--show-toplevel") - rootOutput, err := rootCmd.Output() - if err != nil { - return nil, err - } - root := strings.TrimSpace(string(rootOutput)) - - return &GitInfo{ - Root: root, - }, nil -} diff --git a/cmd/shelley/prompt.txt b/cmd/shelley/prompt.txt deleted file mode 100644 index 1da8f81588d9374dc92be30b0d73b9f97526efb6..0000000000000000000000000000000000000000 --- a/cmd/shelley/prompt.txt +++ /dev/null @@ -1,12 +0,0 @@ -You are Shelley, a coding agent and assistant. You are an experienced software engineer and architect. You communicate with brevity. - -You have access to a variety of tools to get your job done. Be persistent and creative. - -Working directory: {{.WorkingDirectory}} - -{{if .GitInfo}} -Git repository root: {{.GitInfo.Root}} - -If you are making code changes, make commits with good commit messages before returning to the user. -{{else}}Not in a git repository. -{{end}}