@@ -58,7 +58,7 @@ func getArguments() []components.Argument {
5858
5959// Main command action: orchestrates argument parsing, server config, and command execution
6060func jetbrainsConfigCmd (c * components.Context ) error {
61- repositoryURL , repoKey , err := getJetbrainsRepoKeyAndURL (c )
61+ repoKey , repositoryURL , err := getJetbrainsRepoKeyAndURL (c )
6262 if err != nil {
6363 return err
6464 }
@@ -69,6 +69,11 @@ func jetbrainsConfigCmd(c *components.Context) error {
6969 }
7070
7171 jetbrainsCmd := jetbrains .NewJetbrainsCommand (repositoryURL , repoKey )
72+
73+ // Determine if this is a direct URL (argument provided) vs constructed URL (server-id + repo-key)
74+ isDirectURL := c .GetNumberOfArgs () > 0 && isValidUrl (c .GetArgumentAt (0 ))
75+ jetbrainsCmd .SetDirectURL (isDirectURL )
76+
7277 if rtDetails != nil {
7378 jetbrainsCmd .SetServerDetails (rtDetails )
7479 }
@@ -80,7 +85,7 @@ func jetbrainsConfigCmd(c *components.Context) error {
8085func getJetbrainsRepoKeyAndURL (c * components.Context ) (repoKey , repositoryURL string , err error ) {
8186 if c .GetNumberOfArgs () > 0 && isValidUrl (c .GetArgumentAt (0 )) {
8287 repositoryURL = c .GetArgumentAt (0 )
83- repoKey , err = extractRepoKeyFromRepositoryURL (repositoryURL )
88+ repoKey , err = ide . ExtractRepoKeyFromURL (repositoryURL )
8489 if err != nil {
8590 return
8691 }
@@ -116,23 +121,6 @@ func getJetbrainsRepoKeyAndURL(c *components.Context) (repoKey, repositoryURL st
116121 return
117122}
118123
119- // extractRepoKeyFromRepositoryURL extracts the repo key from a JetBrains plugins repository URL.
120- func extractRepoKeyFromRepositoryURL (repositoryURL string ) (string , error ) {
121- if repositoryURL == "" {
122- return "" , fmt .Errorf ("repository URL is empty" )
123- }
124- trimmed := strings .TrimSuffix (repositoryURL , "/" )
125- parts := strings .Split (trimmed , "/api/jetbrainsplugins/" )
126- if len (parts ) != 2 {
127- return "" , fmt .Errorf ("repository URL does not contain /api/jetbrainsplugins/" )
128- }
129- pathParts := strings .SplitN (parts [1 ], "/" , 2 )
130- if len (pathParts ) == 0 || pathParts [0 ] == "" {
131- return "" , fmt .Errorf ("repository key not found in repository URL" )
132- }
133- return pathParts [0 ], nil
134- }
135-
136124// getJetbrainsServerDetails returns server details for validation, or nil if not available
137125func getJetbrainsServerDetails (c * components.Context ) (* config.ServerDetails , error ) {
138126 if ide .HasServerConfigFlags (c ) {
0 commit comments