(path string)
| 212 | return loadSystemPromptTemplateSectionsFromPath(resolveTemplatePathForCWD(cwd)) |
| 213 | } |
| 214 | |
| 215 | func loadSystemPromptTemplateSectionsWithConfig(cwd string, cfg config.Config) ([]PromptSection, string, error) { |
| 216 | if !cfg.IsolatedSkillsOnly { |
| 217 | if path, ok := projectTemplatePathForCWD(cwd); ok { |
| 218 | sections, err := loadSystemPromptTemplateSectionsFromPath(path) |
| 219 | return sections, path, err |
| 220 | } |
| 221 | } |
| 222 | if strings.TrimSpace(cfg.SystemPromptPath) != "" { |
| 223 | if sections, err := loadSystemPromptTemplateSectionsFromPath(cfg.SystemPromptPath); err == nil { |
| 224 | return sections, cfg.SystemPromptPath, nil |
| 225 | } |
| 226 | } |
| 227 | path := resolveTemplatePathForCWD(cwd) |
| 228 | sections, err := loadSystemPromptTemplateSectionsFromPath(path) |
| 229 | return sections, path, err |
| 230 | } |
| 231 | |
| 232 | func loadSystemPromptTemplateSectionsFromPath(path string) ([]PromptSection, error) { |
| 233 | raw, err := os.ReadFile(path) |
| 234 | if err != nil { |
| 235 | return nil, err |
| 236 | } |
| 237 | lines := strings.Split(string(raw), "\n") |
| 238 | currentName := "" |
| 239 | hasCurrentName := false |
| 240 | var sections []PromptSection |
| 241 | var currentLines []string |
| 242 | |
| 243 | for _, line := range lines { |
| 244 | strippedLine := strings.TrimSpace(line) |
| 245 | if strings.HasPrefix(strippedLine, "[SECTION: ") && strings.HasSuffix(strippedLine, "]") { |
| 246 | if hasCurrentName { |
| 247 | sections = append(sections, PromptSection{currentName, strings.TrimSpace(strings.Join(currentLines, "\n")), false}) |
| 248 | } |
| 249 | currentName = strings.TrimSpace(strippedLine[len("[SECTION: ") : len(strippedLine)-1]) |
no outgoing calls
no test coverage detected