feat: Add IDE setup functionality to jfrog-cli-artifactory#99
feat: Add IDE setup functionality to jfrog-cli-artifactory#99agrasth merged 15 commits intojfrog:mainfrom
Conversation
ad38385 to
62036f6
Compare
- Add VSCode configuration command in artifactory/commands/ide/vscode/ - Add JetBrains configuration command in artifactory/commands/ide/jetbrains/ - Add CLI interfaces for both VSCode and JetBrains IDEs - Register IDE commands in main CLI registry - Implement proper repository validation using utils.ValidateRepoExists - Support complete URL inputs instead of separate repo/server flags - VSCode: Configure extensions service URL - JetBrains: Configure plugin repository URL This moves IDE setup functionality to the correct architectural location following jfrog-cli patterns where Artifactory-specific commands belong in jfrog-cli-artifactory module.
- VS Code and JetBrains commands now work without server authentication - Server details are only required if validation flags are provided - Improves user experience for local IDE configuration - Maintains backward compatibility with existing workflows
- Complete user guide with syntax, examples, and troubleshooting - Cross-platform installation paths and file locations - Repository validation and security considerations - CI/CD integration examples and best practices - Backup and recovery procedures - Enterprise deployment guidelines
b5bb627 to
2d73676
Compare
69326cb to
7fc0a96
Compare
|
|
||
| func GetCommands() []components.Command { | ||
| return []components.Command{ | ||
| commands := []components.Command{ |
There was a problem hiding this comment.
instead of having commands here in artifactory/cli/cli.go it is looking good to move them as separate commands for jfrog-cli similar to lifecycle commands.
There was a problem hiding this comment.
something similar to jf vscode config jf jetbrains config so that the command vscode can have its own sub commands like jf vscode install etc
IDE_SETUP_COMMANDS.md
Outdated
| @@ -0,0 +1,300 @@ | |||
| # JFrog CLI IDE Setup Commands | |||
There was a problem hiding this comment.
is this required? may be this can to documentation.
artifactory/cli/ide/jetbrains/cli.go
Outdated
|
|
||
| func jetbrainsConfigCmd(c *components.Context) error { | ||
| if c.GetNumberOfArgs() == 0 { | ||
| return fmt.Errorf("repository URL is required\n\nUsage: jf rt jetbrains-config <repository-url>\nExample: jf rt jetbrains-config https://mycompany.jfrog.io/artifactory/api/jetbrainsplugins/jetbrains-plugins") |
There was a problem hiding this comment.
there is function to send error message for wrong number of arguments, you can use it.
There was a problem hiding this comment.
Thanks, updated it!
artifactory/cli/ide/jetbrains/cli.go
Outdated
| return fmt.Errorf("repository URL is required\n\nUsage: jf rt jetbrains-config <repository-url>\nExample: jf rt jetbrains-config https://mycompany.jfrog.io/artifactory/api/jetbrainsplugins/jetbrains-plugins") | ||
| } | ||
|
|
||
| repositoryURL := c.GetArgumentAt(0) |
There was a problem hiding this comment.
we have check above with number of arguments as 0 can still the argument can be empty string.
There was a problem hiding this comment.
Thanks, updated it!
artifactory/cli/ide/jetbrains/cli.go
Outdated
|
|
||
| // extractRepoKeyFromRepositoryURL extracts the repository key from a JetBrains repository URL | ||
| // Expected format: https://<server>/artifactory/api/jetbrainsplugins/<repo-key> | ||
| func extractRepoKeyFromRepositoryURL(repositoryURL string) string { |
There was a problem hiding this comment.
isn't there any existing function in jfrog-cli-core which can give us repository name instead of rewriting?
| // getManualSetupInstructions returns manual setup instructions | ||
| func (vc *VscodeCommand) getManualSetupInstructions(serviceURL string) string { | ||
| instructions := fmt.Sprintf(` | ||
| Manual VSCode Setup Instructions: |
There was a problem hiding this comment.
can we group the instructions or similar statements into a single file and use those constants to make it more readable.
| for _, ide := range jc.detectedIDEs { | ||
| log.Info(" " + ide.Name + " " + ide.Version) | ||
| } |
There was a problem hiding this comment.
redundant and can be removed.
| // Sort IDEs by name for consistent output | ||
| sort.Slice(jc.detectedIDEs, func(i, j int) bool { | ||
| return jc.detectedIDEs[i].Name < jc.detectedIDEs[j].Name | ||
| }) |
There was a problem hiding this comment.
what is consistent output?
There was a problem hiding this comment.
The consistent output refers to ensuring that detected IDEs are always displayed in the same alphabetical order by name, regardless of the order they were discovered during the detection process.
| } | ||
| lines = append(lines, "# JFrog Artifactory plugins repository") | ||
| lines = append(lines, fmt.Sprintf("idea.plugins.host=%s", repositoryURL)) | ||
| log.Info(" Added idea.plugins.host property") |
There was a problem hiding this comment.
| log.Info(" Added idea.plugins.host property") | |
| log.Info("Added idea.plugins.host property") |
| configPath = "[JetBrains config directory]/[IDE][VERSION]/idea.properties" | ||
| } | ||
|
|
||
| instructions := fmt.Sprintf(` |
There was a problem hiding this comment.
you can regroup these common instructions.
9c355ba to
1644e2e
Compare
7e443d2 to
a0ed5e9
Compare
…ure modular command registration
…ure modular command registration
bc69d6f to
3db2326
Compare
9e5eee2 to
e4cf3fc
Compare
e4cf3fc to
c7ddf3c
Compare
artifactory/cli/ide/vscode/cli.go
Outdated
| return rtDetails, nil | ||
| } | ||
|
|
||
| func isValidUrl(s string) bool { |
There was a problem hiding this comment.
duplicated function same available in jetbrains as well
There was a problem hiding this comment.
Yeah, thankyou. moved.
|
|
||
| // validateRepository uses the established pattern for repository validation | ||
| func (jc *JetbrainsCommand) validateRepository() error { | ||
| log.Info("Validating repository...") |
There was a problem hiding this comment.
| log.Info("Validating repository...") | |
| log.Debug("Validating repository...") |
|
|
||
| log.Info("VSCode configuration updated successfully. Repository URL:", vc.serviceURL, "- Please restart VSCode to apply changes") | ||
|
|
||
| return nil |
There was a problem hiding this comment.
| log.Info("VSCode configuration updated successfully. Repository URL:", vc.serviceURL, "- Please restart VSCode to apply changes") | |
| return nil | |
| log.Info("VSCode configuration updated successfully. Repository URL:", vc.serviceURL, "- Please restart VSCode to apply changes") | |
| return nil |
cliutils/flagkit/flags.go
Outdated
| lcIncludeRepos: components.NewStringFlag(IncludeRepos, "List of semicolon-separated(;) repositories to include in the promotion. If this property is left undefined, all repositories (except those specifically excluded) are included in the promotion. "+ | ||
| "If one or more repositories are specifically included, all other repositories are excluded.` `", components.SetMandatoryFalse()), | ||
| lcExcludeRepos: components.NewStringFlag(ExcludeRepos, "List of semicolon-separated(;) repositories to exclude from the promotion.` `", components.SetMandatoryFalse()), | ||
| lcExcludeRepos: components.NewStringFlag(ExcludeRepos, "List of semicolon-seperated(;) repositories to exclude from the promotion.` `", components.SetMandatoryFalse()), |
There was a problem hiding this comment.
This spelling was inconsistent, among this file. So corrected it.
There was a problem hiding this comment.
wait I will remove this change, might affect any script
3885547 to
22ac331
Compare
22ac331 to
be890a5
Compare
Add IDE Setup Commands for VSCode and JetBrains IDEs
Summary
This PR introduces new CLI commands for configuring Visual Studio Code and JetBrains IDEs to use JFrog Artifactory as their extension/plugin repository. These commands enable organizations to control and curate the extensions/plugins available to their development teams.
Features Added
1. VSCode Configuration Command (
jf rt vscode-config)product.jsonfile to redirect extension gallery requestsjf rt vscode) and full command name2. JetBrains Configuration Command (
jf rt jetbrains-config)idea.propertiesfile to add custom plugin repository URLjf rt jetbrains) and full command name3. Optional Repository Validation
Technical Implementation
Architecture Overview
The implementation follows the established JFrog CLI plugin architecture pattern:
Key Components
CLI Layer (
artifactory/cli/ide/)Command Layer (
artifactory/commands/ide/)File Operations
VSCode Configuration
product.jsonfile across different installation pathsextensionsGallery.serviceUrlproperty.backupfile before modificationJetBrains Configuration
idea.propertiesfiles for all detected IDE installationsidea.plugins.host.listproperty pointing to Artifactory.backupfiles before modificationOperating System Support
Cross-Platform Path Detection
Repository Validation Integration
Conditional Validation
Validation Flow
Files Added/Modified
New Files Added
Files Modified
Total Code Addition
Command Integration
Registration in CLI Framework
Commands are automatically registered in the JFrog CLI through the existing plugin architecture:
This integration means the commands appear automatically in
jf rt --helpand function as first-class JFrog CLI commands.Security Considerations
File System Security
Documentation
Comprehensive User Guide
Added
IDE_SETUP_COMMANDS.mdproviding:Help Text Integration
--helpRelated PRs
jfrog/jfrog-cli#3027