33package cmdgen
44
55import (
6- "encoding/json"
7- "fmt"
86 "log"
97 "syscall/js"
108
@@ -31,15 +29,12 @@ func ConstructCommand(parsedInput *gabs.Container, o *lama2cmd.Opts) ([]string,
3129 log .Fatal ("Failed to parse projects" )
3230 }
3331
34- fmt .Println ("Project count:" , len (projects ))
3532
3633 projectRoot := getProjectRoot ()
3734 if projectRoot == "" {
38- fmt .Println ("DBGYYZ: No project_root meta tag found" )
3935 return res , stdinBody
4036 }
4137
42- fmt .Println ("DBGYYZ: projectRoot:" , projectRoot )
4338
4439 var selectedAuthHeader string
4540
@@ -53,11 +48,9 @@ func ConstructCommand(parsedInput *gabs.Container, o *lama2cmd.Opts) ([]string,
5348 if projectMap ["project_root" ] == projectRoot {
5449 authData , exists := projectMap ["result" ].(map [string ]interface {})["auth" ]
5550 if ! exists {
56- fmt .Println ("DBGYYZ: No auth data found for this project" )
5751 } else {
5852 authArray , ok := authData .([]interface {})
5953 if ! ok {
60- fmt .Println ("DBGYYZ: Auth data is not in expected format" )
6154 return res , stdinBody
6255 }
6356
@@ -70,30 +63,21 @@ func ConstructCommand(parsedInput *gabs.Container, o *lama2cmd.Opts) ([]string,
7063
7164 selected , exists := authMap ["selected" ].(bool )
7265 if exists && selected {
73- authJSON , _ := json .MarshalIndent (authMap , "" , " " )
74- fmt .Println ("DBGYYZ: Selected Auth Data:" , string (authJSON ))
75-
7666 // Construct Authorization header based on type
7767 authType := authMap ["type" ].(string )
7868 authValue := authMap ["value" ].(map [string ]interface {})
79- fmt .Println ("DBGYYZ: authType:" , authType )
80- fmt .Println ("DBGYYZ: authValue:" , authValue )
8169 switch authType {
8270 case "bearer-token" :
8371 if token , ok := authValue ["token" ].(string ); ok {
84- fmt .Println ("DBGYYZ: token:" , token )
8572 selectedAuthHeader = "Authorization: Bearer " + token
8673 }
8774 case "jwt" :
8875 if jwt , ok := authValue ["jwt" ].(string ); ok {
89- fmt .Println ("DBGYYZ: jwt:" , jwt )
9076 selectedAuthHeader = "Authorization: Bearer " + jwt
9177 }
9278 case "api-key" :
9379 if key , ok := authValue ["key" ].(string ); ok {
94- fmt .Println ("DBGYYZ: key:" , key )
9580 if value , ok := authValue ["value" ].(string ); ok {
96- fmt .Println ("DBGYYZ: value:" , value )
9781 selectedAuthHeader = key + ": " + value
9882 }
9983 }
@@ -113,7 +97,6 @@ func ConstructCommand(parsedInput *gabs.Container, o *lama2cmd.Opts) ([]string,
11397 break
11498 }
11599 }
116- fmt .Println ("DBGYYZ: selectedAuthHeader:" , selectedAuthHeader )
117100 // Add the selected authentication method to headers if not already present
118101 if selectedAuthHeader != "" {
119102 authHeaderExists := false
@@ -126,7 +109,6 @@ func ConstructCommand(parsedInput *gabs.Container, o *lama2cmd.Opts) ([]string,
126109
127110 if ! authHeaderExists {
128111 res = append (res , selectedAuthHeader )
129- fmt .Println ("DBGYYZ: Added Auth Header:" , selectedAuthHeader )
130112 }
131113 }
132114
0 commit comments