@@ -112,12 +112,57 @@ func filterAndGetSources(cmd *cobra.Command, projectRoot string, shopCfg *shop.C
112112
113113 onlyExtensions , _ := cmd .PersistentFlags ().GetString ("only-extensions" )
114114 skipExtensions , _ := cmd .PersistentFlags ().GetString ("skip-extensions" )
115+ onlyCustomStatic , _ := cmd .PersistentFlags ().GetBool ("only-custom-static-extensions" )
115116
116117 if onlyExtensions != "" && skipExtensions != "" {
117118 return nil , fmt .Errorf ("only-extensions and skip-extensions cannot be used together" )
118119 }
119120
120- if onlyExtensions == "" && skipExtensions == "" {
121+ if onlyCustomStatic {
122+ logging .FromContext (cmd .Context ()).Infof ("Only including extensions from custom/static-plugins directory" )
123+ logging .FromContext (cmd .Context ()).Debugf ("Found %d total extensions before filtering" , len (sources ))
124+ for _ , s := range sources {
125+ logging .FromContext (cmd .Context ()).Debugf ("Extension: %s, Path: %s" , s .Name , s .Path )
126+ }
127+
128+ sources = slices .DeleteFunc (sources , func (s asset.Source ) bool {
129+ // First try to resolve any symlinks
130+ resolvedPath , err := filepath .EvalSymlinks (s .Path )
131+ if err != nil {
132+ logging .FromContext (cmd .Context ()).Errorf ("Failed to resolve symlink for %s: %v" , s .Path , err )
133+ return true
134+ }
135+
136+ absPath , err := filepath .Abs (resolvedPath )
137+ if err != nil {
138+ logging .FromContext (cmd .Context ()).Errorf ("Failed to get absolute path for %s: %v" , resolvedPath , err )
139+ return true
140+ }
141+
142+ logging .FromContext (cmd .Context ()).Debugf ("Extension %s: Original path: %s, Resolved absolute path: %s" , s .Name , s .Path , absPath )
143+
144+ customStaticDir := filepath .Join ("custom" , "static-plugins" )
145+
146+ isCustomStatic := strings .Contains (absPath , customStaticDir ) || strings .HasSuffix (absPath , customStaticDir )
147+
148+ if ! isCustomStatic {
149+ logging .FromContext (cmd .Context ()).Debugf ("Excluding %s as it's not in custom/static-plugins" , s .Name )
150+ }
151+ return ! isCustomStatic
152+ })
153+
154+ logging .FromContext (cmd .Context ()).Debugf ("Found %d custom/static extensions after filtering" , len (sources ))
155+ for _ , s := range sources {
156+ logging .FromContext (cmd .Context ()).Debugf ("Included extension: %s, Path: %s" , s .Name , s .Path )
157+ }
158+
159+ logging .FromContext (cmd .Context ()).Debugf ("Included extensions:" )
160+ for _ , s := range sources {
161+ logging .FromContext (cmd .Context ()).Debugf (" - %s" , s .Name )
162+ }
163+ }
164+
165+ if onlyExtensions == "" && skipExtensions == "" && ! onlyCustomStatic {
121166 logging .FromContext (cmd .Context ()).Infof ("Excluding extensions based on project config: %s" , strings .Join (shopCfg .Build .ExcludeExtensions , ", " ))
122167 sources = slices .DeleteFunc (sources , func (s asset.Source ) bool {
123168 return slices .Contains (shopCfg .Build .ExcludeExtensions , s .Name )
0 commit comments