Skip to content

Commit 14f72d7

Browse files
authored
Add Kiro IDE Support to jf ide setup (jfrog#305)
1 parent c04b9d0 commit 14f72d7

File tree

7 files changed

+115
-27
lines changed

7 files changed

+115
-27
lines changed

ide/cli/cli.go

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,15 @@ package cli
22

33
import (
44
"fmt"
5-
"strings"
65

76
"github.com/jfrog/jfrog-cli-artifactory/ide/commands/aieditorextensions"
87
"github.com/jfrog/jfrog-cli-artifactory/ide/commands/jetbrains"
98
"github.com/jfrog/jfrog-cli-artifactory/ide/docs"
9+
"github.com/jfrog/jfrog-cli-artifactory/ide/ideconsts"
1010
"github.com/jfrog/jfrog-cli-core/v2/plugins/components"
1111
"github.com/jfrog/jfrog-client-go/utils/log"
1212
)
1313

14-
const (
15-
IDENameVSCode = "vscode"
16-
IDENameCode = "code"
17-
IDENameCursor = "cursor"
18-
IDENameWindsurf = "windsurf"
19-
IDENameJetBrains = "jetbrains"
20-
IDENameJB = "jb"
21-
)
22-
23-
func getSupportedIDEs() string {
24-
return fmt.Sprintf("%s, %s, %s, %s", IDENameVSCode, IDENameCursor, IDENameWindsurf, IDENameJetBrains)
25-
}
26-
2714
func GetCommands() []components.Command {
2815
return []components.Command{
2916
{
@@ -49,31 +36,33 @@ func getSetupFlags() []components.Flag {
4936
components.NewStringFlag("url-suffix", "Suffix for the URL. Optional.", components.SetMandatoryFalse()),
5037

5138
// VSCode-specific flags
52-
components.NewStringFlag("product-json-path", "Path to VSCode/Cursor/Windsurf product.json file. If not provided, auto-detects installation.", components.SetMandatoryFalse()),
53-
components.NewStringFlag("update-mode", "VSCode update mode: 'default' (auto-update), 'manual' (prompt for updates), or 'none' (disable updates). Only for VSCode-based IDEs.", components.SetMandatoryFalse()),
39+
components.NewStringFlag("product-json-path", fmt.Sprintf("Path to %s product.json file. If not provided, auto-detects installation.", ideconsts.GetVSCodeBasedIDEsString()), components.SetMandatoryFalse()),
40+
components.NewStringFlag("update-mode", "Update mode: 'default' (auto-update), 'manual' (prompt for updates), or 'none' (disable updates). Only for VSCode-based IDEs.", components.SetMandatoryFalse()),
5441
}
5542

5643
return append(flags, ideSpecificFlags...)
5744
}
5845

5946
func setupCmd(ctx *components.Context) error {
6047
if ctx.GetNumberOfArgs() == 0 {
61-
return fmt.Errorf("IDE_NAME is required. Usage: jf ide setup <IDE_NAME>\nSupported IDEs: %s", getSupportedIDEs())
48+
return fmt.Errorf("IDE_NAME is required. Usage: jf ide setup <IDE_NAME>\nSupported IDEs: %s", ideconsts.GetSupportedIDEsString())
6249
}
6350

64-
ideName := strings.ToLower(ctx.GetArgumentAt(0))
51+
ideName := ctx.GetArgumentAt(0)
6552
log.Debug(fmt.Sprintf("Setting up IDE: %s", ideName))
6653

6754
switch ideName {
68-
case IDENameVSCode, IDENameCode:
55+
case ideconsts.IDENameVSCode, ideconsts.IDENameCode:
6956
return aieditorextensions.SetupVSCode(ctx)
70-
case IDENameCursor:
57+
case ideconsts.IDENameCursor:
7158
return aieditorextensions.SetupCursor(ctx)
72-
case IDENameWindsurf:
59+
case ideconsts.IDENameWindsurf:
7360
return aieditorextensions.SetupWindsurf(ctx)
74-
case IDENameJetBrains, IDENameJB:
61+
case ideconsts.IDENameKiro:
62+
return aieditorextensions.SetupKiro(ctx)
63+
case ideconsts.IDENameJetBrains, ideconsts.IDENameJB:
7564
return jetbrains.SetupJetBrains(ctx)
7665
default:
77-
return fmt.Errorf("unsupported IDE: %s. Supported IDEs: %s", ideName, getSupportedIDEs())
66+
return fmt.Errorf("unsupported IDE: %s. Supported IDEs: %s", ideName, ideconsts.GetSupportedIDEsString())
7867
}
7968
}

ide/commands/aieditorextensions/vscode_fork_registry.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,26 @@ var VSCodeForks = map[string]*VSCodeForkConfig{
8484
ProductJson: "product.json",
8585
SettingsDir: "Windsurf",
8686
},
87+
"kiro": {
88+
Name: "kiro",
89+
DisplayName: "Kiro",
90+
InstallPaths: map[string][]string{
91+
"darwin": {
92+
"/Applications/Kiro.app/Contents/Resources/app",
93+
"~/Applications/Kiro.app/Contents/Resources/app",
94+
},
95+
"windows": {
96+
`%LOCALAPPDATA%\Programs\Kiro\resources\app`,
97+
`C:\Program Files\Kiro\resources\app`,
98+
},
99+
"linux": {
100+
"/usr/share/kiro/resources/app",
101+
"~/.local/share/kiro/resources/app",
102+
},
103+
},
104+
ProductJson: "product.json",
105+
SettingsDir: "Kiro",
106+
},
87107
}
88108

89109
func GetVSCodeFork(name string) (*VSCodeForkConfig, bool) {

ide/commands/aieditorextensions/vscode_fork_test.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ func TestGetVSCodeFork(t *testing.T) {
3131
assert.Equal(t, "windsurf", windsurfConfig.Name)
3232
assert.Equal(t, "Windsurf", windsurfConfig.DisplayName)
3333

34+
// Test getting Kiro config
35+
kiroConfig, exists := GetVSCodeFork("kiro")
36+
assert.True(t, exists)
37+
assert.Equal(t, "kiro", kiroConfig.Name)
38+
assert.Equal(t, "Kiro", kiroConfig.DisplayName)
39+
3440
// Test non-existent fork
3541
_, exists = GetVSCodeFork("nonexistent")
3642
assert.False(t, exists)
@@ -77,6 +83,11 @@ func TestVSCodeForkCommand_CommandName(t *testing.T) {
7783
windsurfConfig, _ := GetVSCodeFork("windsurf")
7884
cmd = NewVSCodeForkCommand(windsurfConfig, "", "", "")
7985
assert.Equal(t, "setup-windsurf", cmd.CommandName())
86+
87+
// Test Kiro command name
88+
kiroConfig, _ := GetVSCodeFork("kiro")
89+
cmd = NewVSCodeForkCommand(kiroConfig, "", "", "")
90+
assert.Equal(t, "setup-kiro", cmd.CommandName())
8091
}
8192

8293
func TestVSCodeForkCommand_SetServerDetails(t *testing.T) {
@@ -271,7 +282,8 @@ func TestVSCodeForkCommand_HandlePermissionError_macOS(t *testing.T) {
271282
func TestSetupVSCodeFork_AllForks(t *testing.T) {
272283
// Test that all registered forks can be retrieved
273284
forks := GetSupportedForks()
274-
assert.GreaterOrEqual(t, len(forks), 3, "Should have at least 3 forks (vscode, cursor, windsurf)")
285+
// Expected number of VSCode-based IDE forks
286+
assert.GreaterOrEqual(t, len(forks), 4, "Should have at least 4 VSCode-based IDE forks")
275287

276288
// Test that each fork has valid configuration
277289
for _, forkName := range forks {

ide/commands/aieditorextensions/vscode_setup.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ func SetupWindsurf(c *components.Context) error {
2121
return setupVSCodeFork(c, "windsurf")
2222
}
2323

24+
// SetupKiro configures Kiro to use JFrog Artifactory
25+
func SetupKiro(c *components.Context) error {
26+
return setupVSCodeFork(c, "kiro")
27+
}
28+
2429
// setupVSCodeFork is a generic setup function for any VSCode-based IDE
2530
func setupVSCodeFork(c *components.Context, forkName string) error {
2631
// Get fork configuration

ide/docs/setup.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
package docs
22

3-
import "github.com/jfrog/jfrog-cli-core/v2/plugins/components"
3+
import (
4+
"fmt"
5+
6+
"github.com/jfrog/jfrog-cli-artifactory/ide/ideconsts"
7+
"github.com/jfrog/jfrog-cli-core/v2/plugins/components"
8+
)
49

510
func GetDescription() string {
611
return "Setup IDE integration with JFrog Artifactory."
@@ -10,7 +15,7 @@ func GetArguments() []components.Argument {
1015
return []components.Argument{
1116
{
1217
Name: "ide-name",
13-
Description: "IDE to setup. Supported: vscode, cursor, windsurf, jetbrains",
18+
Description: fmt.Sprintf("IDE to setup. Supported: %s", ideconsts.GetSupportedIDEsString()),
1419
},
1520
{
1621
Name: "url",

ide/docs/setup/help.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package setup
22

33
import (
4+
"fmt"
5+
"strings"
6+
7+
"github.com/jfrog/jfrog-cli-artifactory/ide/ideconsts"
48
"github.com/jfrog/jfrog-cli-core/v2/plugins/components"
59
)
610

@@ -19,6 +23,7 @@ Supported IDEs:
1923
vscode Visual Studio Code
2024
cursor Cursor IDE
2125
windsurf Windsurf IDE
26+
kiro Kiro IDE
2227
jetbrains JetBrains IDEs (IntelliJ IDEA, PyCharm, WebStorm, etc.)
2328
2429
Examples:
@@ -31,15 +36,25 @@ Examples:
3136
# Setup Windsurf
3237
jf ide setup windsurf --repo-key=windsurf-remote
3338
39+
# Setup Kiro
40+
jf ide setup kiro --repo-key=kiro-remote
41+
3442
# Setup JetBrains
3543
jf ide setup jetbrains --repo-key=jetbrains-remote`
3644
}
3745

3846
func GetArguments() []components.Argument {
47+
// Create a quoted list of IDE names for better readability
48+
ideNames := make([]string, len(ideconsts.SupportedIDEsList))
49+
for i, name := range ideconsts.SupportedIDEsList {
50+
ideNames[i] = fmt.Sprintf("'%s'", name)
51+
}
52+
supportedIDEsDesc := strings.Join(ideNames, ", ")
53+
3954
return []components.Argument{
4055
{
4156
Name: "IDE_NAME",
42-
Description: "The name of the IDE to setup. Supported IDEs are 'vscode', 'cursor', 'windsurf', and 'jetbrains'.",
57+
Description: fmt.Sprintf("The name of the IDE to setup. Supported IDEs are %s.", supportedIDEsDesc),
4358
},
4459
{
4560
Name: "SERVICE_URL",

ide/ideconsts/ideconsts.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package ideconsts
2+
3+
import "strings"
4+
5+
// IDE name constants
6+
const (
7+
IDENameVSCode = "vscode"
8+
IDENameCode = "code"
9+
IDENameCursor = "cursor"
10+
IDENameWindsurf = "windsurf"
11+
IDENameKiro = "kiro"
12+
IDENameJetBrains = "jetbrains"
13+
IDENameJB = "jb"
14+
)
15+
16+
// SupportedIDEsList contains the list of primary IDE names (used for display purposes)
17+
var SupportedIDEsList = []string{
18+
IDENameVSCode,
19+
IDENameCursor,
20+
IDENameWindsurf,
21+
IDENameKiro,
22+
IDENameJetBrains,
23+
}
24+
25+
// VSCodeBasedIDEs contains the list of VSCode-based IDEs (for flags and documentation)
26+
var VSCodeBasedIDEs = []string{
27+
IDENameVSCode,
28+
IDENameCursor,
29+
IDENameWindsurf,
30+
IDENameKiro,
31+
}
32+
33+
// GetSupportedIDEsString returns a comma-separated string of supported IDE names
34+
func GetSupportedIDEsString() string {
35+
return strings.Join(SupportedIDEsList, ", ")
36+
}
37+
38+
// GetVSCodeBasedIDEsString returns a slash-separated string of VSCode-based IDE names
39+
func GetVSCodeBasedIDEsString() string {
40+
return strings.Join(VSCodeBasedIDEs, "/")
41+
}
42+

0 commit comments

Comments
 (0)