configure

package
v0.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigureCmd = &cobra.Command{
	Use:   "configure [client-name]",
	Short: "Configure a client",
	Long:  `Creates the .json configuration for each client, so it can connect to arctl.`,
	Args:  cobra.MaximumNArgs(1),
	Run: func(cmd *cobra.Command, args []string) {

		if len(args) == 0 {
			fmt.Println("Supported clients:")
			for name, configurer := range clientConfigurers {
				fmt.Printf("  %-15s - %s\n", name, configurer.GetClientName())
			}
			fmt.Println("\nUsage:")
			fmt.Println("  arctl configure <client-name>")
			fmt.Println("\nExamples:")
			fmt.Println("  arctl configure cursor")
			fmt.Println("  arctl configure claude-code --port 3000")
			fmt.Println("  arctl configure vscode --port 3000")
			return
		}

		clientName := args[0]

		configurer, ok := clientConfigurers[clientName]
		if !ok {
			log.Fatalf("Client '%s' is not supported. Run 'arctl configure' to see supported clients.", clientName)
		}

		url := fmt.Sprintf("http://localhost:%s/mcp", configurePort)
		if configureURL != "" {
			url = configureURL
		}

		configPath, err := configurer.GetConfigPath()
		if err != nil {
			log.Fatalf("Failed to get config path: %v", err)
		}

		config, err := configurer.CreateConfig(url, configPath)
		if err != nil {
			log.Fatalf("Failed to create %s config: %v", configurer.GetClientName(), err)
		}

		if err := writeConfigFile(configPath, config); err != nil {
			log.Fatalf("Failed to write config file: %v", err)
		}

		fmt.Printf("✓ Configured %s\n", configurer.GetClientName())
	},
}

NewConfigureCmd creates the configure command

Functions

This section is empty.

Types

type ClaudeCodeConfigurer

type ClaudeCodeConfigurer struct{}

ClaudeCodeConfigurer handles Claude Code MCP configuration

func (*ClaudeCodeConfigurer) CreateConfig

func (c *ClaudeCodeConfigurer) CreateConfig(url string, configPath string) (interface{}, error)

func (*ClaudeCodeConfigurer) GetClientName

func (c *ClaudeCodeConfigurer) GetClientName() string

func (*ClaudeCodeConfigurer) GetConfigPath

func (c *ClaudeCodeConfigurer) GetConfigPath() (string, error)

type ClientConfigurer

type ClientConfigurer interface {
	// GetConfigPath returns the path where the config file should be written
	GetConfigPath() (string, error)

	// CreateConfig creates or updates the MCP configuration for the client
	// It should read existing config, merge with the new server, and return the updated config
	CreateConfig(url string, configPath string) (interface{}, error)

	// GetClientName returns the display name of the client
	GetClientName() string
}

ClientConfigurer defines the interface for client-specific MCP configuration

type CursorConfigurer

type CursorConfigurer struct{}

CursorConfigurer handles Cursor MCP configuration

func (*CursorConfigurer) CreateConfig

func (c *CursorConfigurer) CreateConfig(url string, configPath string) (interface{}, error)

func (*CursorConfigurer) GetClientName

func (c *CursorConfigurer) GetClientName() string

func (*CursorConfigurer) GetConfigPath

func (c *CursorConfigurer) GetConfigPath() (string, error)

type VSCodeConfigurer

type VSCodeConfigurer struct{}

VSCodeConfigurer handles VS Code MCP configuration

func (*VSCodeConfigurer) CreateConfig

func (v *VSCodeConfigurer) CreateConfig(url string, configPath string) (interface{}, error)

func (*VSCodeConfigurer) GetClientName

func (v *VSCodeConfigurer) GetClientName() string

func (*VSCodeConfigurer) GetConfigPath

func (v *VSCodeConfigurer) GetConfigPath() (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL