@@ -9,6 +9,14 @@ import (
99 "gopkg.in/yaml.v3"
1010)
1111
12+ // OfflineMode indicates if the application is running in offline mode
13+ var OfflineMode bool
14+
15+ // SetOffline sets the offline mode
16+ func SetOffline (offline bool ) {
17+ OfflineMode = offline
18+ }
19+
1220// Repo represents a skill repository
1321type Repo struct {
1422 Name string `yaml:"name"`
@@ -36,30 +44,33 @@ func DefaultToolTargets() []ToolTarget {
3644 // Add DETECTED agents only, not all possible ones.
3745 // This prevents showing clutter like "clawdbot" when not applicable.
3846 // We use the current working directory to detect.
39- if cwd , err := os .Getwd (); err == nil {
40-
41- // DetectExistingToolDirs returns ToolTarget structs created from DefaultToolTargets logic which was cyclical.
42- // We need a helper that creates targets from detected dirs WITHOUT calling DefaultToolTargets.
43- // Let's implement detection logic directly here or fix DetectExistingToolDirs.
44-
45- // Implementation of direct detection to avoid cycle:
46- for _ , name := range GetSupportedAgentNames () {
47- if agentType , ok := ResolveAgentType (name ); ok {
48- config := SupportedAgents [agentType ]
49- // Check if project dir exists
50- // config.ProjectDir is like ".claude/skills"
51- // We check if ".claude" exists
52- agentRootDir := filepath .Dir (config .ProjectDir )
53- if agentRootDir == "." {
54- agentRootDir = config .ProjectDir
55- }
56- if _ , err := os .Stat (filepath .Join (cwd , agentRootDir )); err == nil {
57- // Found!
58- targets = append (targets , ToolTarget {
59- Name : name ,
60- SkillsDir : config .ProjectDir ,
61- Enabled : true ,
62- })
47+
48+ if ! OfflineMode {
49+ if cwd , err := os .Getwd (); err == nil {
50+
51+ // DetectExistingToolDirs returns ToolTarget structs created from DefaultToolTargets logic which was cyclical.
52+ // We need a helper that creates targets from detected dirs WITHOUT calling DefaultToolTargets.
53+ // Let's implement detection logic directly here or fix DetectExistingToolDirs.
54+
55+ // Implementation of direct detection to avoid cycle:
56+ for _ , name := range GetSupportedAgentNames () {
57+ if agentType , ok := ResolveAgentType (name ); ok {
58+ config := SupportedAgents [agentType ]
59+ // Check if project dir exists
60+ // config.ProjectDir is like ".claude/skills"
61+ // We check if ".claude" exists
62+ agentRootDir := filepath .Dir (config .ProjectDir )
63+ if agentRootDir == "." {
64+ agentRootDir = config .ProjectDir
65+ }
66+ if _ , err := os .Stat (filepath .Join (cwd , agentRootDir )); err == nil {
67+ // Found!
68+ targets = append (targets , ToolTarget {
69+ Name : name ,
70+ SkillsDir : config .ProjectDir ,
71+ Enabled : true ,
72+ })
73+ }
6374 }
6475 }
6576 }
0 commit comments