@@ -2,57 +2,63 @@ package codingcontext
22
33import "path/filepath"
44
5- // DownloadedRulePaths returns the search paths for rule files in downloaded directories
6- func rulePaths ( dir string , home bool ) [] string {
7- if home {
8- return []string {
9- // user
10- filepath . Join ( dir , ".agents" , "rules" ),
11- filepath . Join ( dir , ".claude" , "CLAUDE.md" ),
12- filepath . Join ( dir , ".codex" , "AGENTS.md" ),
13- filepath . Join ( dir , ".gemini" , "GEMINI.md" ),
14- filepath .Join (dir , ".opencode" , "rules" ),
5+ // rulePaths returns the search paths for rule files in a directory.
6+ // It collects rule paths from all agents in the agentsPaths configuration.
7+ func rulePaths ( dir string ) [] string {
8+ var paths []string
9+
10+ // Iterate through all configured agents
11+ for _ , config := range agentsPaths {
12+ // Add each rule path for this agent
13+ for _ , rulePath := range config . rulesPaths {
14+ paths = append ( paths , filepath .Join (dir , rulePath ))
1515 }
1616 }
17- return []string {
18- filepath .Join (dir , ".agents" , "rules" ),
19- filepath .Join (dir , ".cursor" , "rules" ),
20- filepath .Join (dir , ".augment" , "rules" ),
21- filepath .Join (dir , ".windsurf" , "rules" ),
22- filepath .Join (dir , ".opencode" , "agent" ),
23- filepath .Join (dir , ".github" , "copilot-instructions.md" ),
24- filepath .Join (dir , ".gemini" , "styleguide.md" ),
25- filepath .Join (dir , ".github" , "agents" ),
26- filepath .Join (dir , ".augment" , "guidelines.md" ),
27- filepath .Join (dir , "AGENTS.md" ),
28- filepath .Join (dir , "CLAUDE.md" ),
29- filepath .Join (dir , "CLAUDE.local.md" ),
30- filepath .Join (dir , "GEMINI.md" ),
31- filepath .Join (dir , ".cursorrules" ),
32- filepath .Join (dir , ".windsurfrules" ),
33- }
17+
18+ return paths
3419}
3520
36- // taskSearchPaths returns the search paths for task files in a directory
21+ // taskSearchPaths returns the search paths for task files in a directory.
22+ // It collects task paths from all agents in the agentsPaths configuration.
3723func taskSearchPaths (dir string ) []string {
38- return []string {
39- filepath .Join (dir , ".agents" , "tasks" ),
24+ var paths []string
25+
26+ // Iterate through all configured agents
27+ for _ , config := range agentsPaths {
28+ if config .tasksPath != "" {
29+ paths = append (paths , filepath .Join (dir , config .tasksPath ))
30+ }
4031 }
32+
33+ return paths
4134}
4235
43- // commandSearchPaths returns the search paths for command files in a directory
36+ // commandSearchPaths returns the search paths for command files in a directory.
37+ // It collects command paths from all agents in the agentsPaths configuration.
4438func commandSearchPaths (dir string ) []string {
45- return []string {
46- filepath .Join (dir , ".agents" , "commands" ),
47- filepath .Join (dir , ".cursor" , "commands" ),
48- filepath .Join (dir , ".opencode" , "command" ),
39+ var paths []string
40+
41+ // Iterate through all configured agents
42+ for _ , config := range agentsPaths {
43+ if config .commandsPath != "" {
44+ paths = append (paths , filepath .Join (dir , config .commandsPath ))
45+ }
4946 }
47+
48+ return paths
5049}
5150
52- // skillSearchPaths returns the search paths for skill directories in a directory
51+ // skillSearchPaths returns the search paths for skill directories in a directory.
52+ // It collects skill paths from all agents in the agentsPaths configuration.
5353func skillSearchPaths (dir string ) []string {
54- return []string {
55- filepath .Join (dir , ".agents" , "skills" ),
56- filepath .Join (dir , ".cursor" , "skills" ),
54+ var paths []string
55+
56+ // Iterate through all configured agents
57+ for _ , config := range agentsPaths {
58+ if config .skillsPath != "" {
59+ paths = append (paths , filepath .Join (dir , config .skillsPath ))
60+ }
5761 }
62+
63+ return paths
5864}
0 commit comments