cli

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentVersion

func CurrentVersion() string

CurrentVersion returns the binary version string set via SetVersion(). Defaults to "dev" until the cmd/helix/main.go entrypoint threads the ldflag-injected value. Used by internal/mcp/server.go to populate the MCP `Implementation.Version` field so the MCP client identity stays in lockstep with the CLI `--version` output (per RESEARCH.md A6).

func NewRootCommand

func NewRootCommand() *cobra.Command

NewRootCommand creates the root cobra command with all flags. Per D-02: flat CLI with flags, no subcommands.

func SetVersion

func SetVersion(v string)

SetVersion records the binary version string so `helix --version` reports the goreleaser-injected value. Called once from cmd/helix/main.go before Execute(). An empty argument is ignored so callers can pass a possibly-empty ldflag value without clobbering the "dev" default.

Types

type ClaudeCodeRegistrar

type ClaudeCodeRegistrar struct{}

ClaudeCodeRegistrar handles MCP registration for Claude Code (Anthropic CLI agent).

func (*ClaudeCodeRegistrar) Description

func (r *ClaudeCodeRegistrar) Description() string

func (*ClaudeCodeRegistrar) Name

func (r *ClaudeCodeRegistrar) Name() string

func (*ClaudeCodeRegistrar) Register

func (r *ClaudeCodeRegistrar) Register(cfg RegistrationConfig) error

func (*ClaudeCodeRegistrar) Unregister

func (r *ClaudeCodeRegistrar) Unregister(cfg RegistrationConfig) error

type ClaudeDesktopRegistrar

type ClaudeDesktopRegistrar struct{}

ClaudeDesktopRegistrar handles MCP registration for Claude Desktop app. Claude Desktop is global-only (the Global flag is ignored).

func (*ClaudeDesktopRegistrar) Description

func (r *ClaudeDesktopRegistrar) Description() string

func (*ClaudeDesktopRegistrar) Name

func (r *ClaudeDesktopRegistrar) Name() string

func (*ClaudeDesktopRegistrar) Register

func (*ClaudeDesktopRegistrar) Unregister

func (r *ClaudeDesktopRegistrar) Unregister(cfg RegistrationConfig) error

type ClientRegistrar

type ClientRegistrar interface {
	// Name returns the client identifier (e.g., "claude-code").
	Name() string
	// Description returns a one-line description for help output.
	Description() string
	// Register adds Helix as an MCP server for this client.
	Register(cfg RegistrationConfig) error
	// Unregister removes Helix from this client.
	Unregister(cfg RegistrationConfig) error
}

ClientRegistrar handles MCP registration for a specific coding agent.

type GeminiCLIRegistrar

type GeminiCLIRegistrar struct{}

GeminiCLIRegistrar handles MCP registration for Gemini CLI.

func (*GeminiCLIRegistrar) Description

func (r *GeminiCLIRegistrar) Description() string

func (*GeminiCLIRegistrar) Name

func (r *GeminiCLIRegistrar) Name() string

func (*GeminiCLIRegistrar) Register

func (r *GeminiCLIRegistrar) Register(cfg RegistrationConfig) error

func (*GeminiCLIRegistrar) Unregister

func (r *GeminiCLIRegistrar) Unregister(cfg RegistrationConfig) error

type GenericRegistrar

type GenericRegistrar struct{}

GenericRegistrar handles MCP registration for any stdio-based MCP client. Outputs JSON to stdout (default) or writes to a file via --output.

func (*GenericRegistrar) Description

func (r *GenericRegistrar) Description() string

func (*GenericRegistrar) Name

func (r *GenericRegistrar) Name() string

func (*GenericRegistrar) Register

func (r *GenericRegistrar) Register(cfg RegistrationConfig) error

func (*GenericRegistrar) Unregister

func (r *GenericRegistrar) Unregister(cfg RegistrationConfig) error

type JetBrainsRegistrar

type JetBrainsRegistrar struct{}

JetBrainsRegistrar handles MCP registration for JetBrains IDEs via Junie.

func (*JetBrainsRegistrar) Description

func (r *JetBrainsRegistrar) Description() string

func (*JetBrainsRegistrar) Name

func (r *JetBrainsRegistrar) Name() string

func (*JetBrainsRegistrar) Register

func (r *JetBrainsRegistrar) Register(cfg RegistrationConfig) error

func (*JetBrainsRegistrar) Unregister

func (r *JetBrainsRegistrar) Unregister(cfg RegistrationConfig) error

type OpenCodeRegistrar

type OpenCodeRegistrar struct{}

OpenCodeRegistrar handles MCP registration for OpenCode. OpenCode uses "mcp" key (not "mcpServers") and "command" is an array.

func (*OpenCodeRegistrar) Description

func (r *OpenCodeRegistrar) Description() string

func (*OpenCodeRegistrar) Name

func (r *OpenCodeRegistrar) Name() string

func (*OpenCodeRegistrar) Register

func (r *OpenCodeRegistrar) Register(cfg RegistrationConfig) error

func (*OpenCodeRegistrar) Unregister

func (r *OpenCodeRegistrar) Unregister(cfg RegistrationConfig) error

type RegistrationConfig

type RegistrationConfig struct {
	BinaryPath string        // Absolute path to helix binary (resolved via os.Executable + filepath.EvalSymlinks)
	Global     bool          // --global flag
	DryRun     bool          // --dry-run flag
	ProjectDir string        // Current working directory
	OutputPath string        // --output flag (generic client only)
	NoHooks    bool          // --no-hooks flag (skip hook installation)
	Printer    *SetupPrinter // Colored output helper
}

RegistrationConfig holds common registration parameters.

type SetupPrinter

type SetupPrinter struct {
	DryRun bool
}

SetupPrinter handles colored terminal output for setup command. All output goes to os.Stderr (stdout reserved for MCP JSON-RPC and generic client JSON output). Respects NO_COLOR env automatically via fatih/color.

func (*SetupPrinter) DryRunAction

func (p *SetupPrinter) DryRunAction(format string, args ...any)

DryRunAction prints a yellow "[dry-run]" prefix + formatted message to stderr. Only prints when DryRun is true.

func (*SetupPrinter) Failure

func (p *SetupPrinter) Failure(format string, args ...any)

Failure prints a red cross + formatted message to stderr.

func (*SetupPrinter) Info

func (p *SetupPrinter) Info(format string, args ...any)

Info prints a blue arrow + formatted message to stderr.

func (*SetupPrinter) Success

func (p *SetupPrinter) Success(format string, args ...any)

Success prints a green checkmark + formatted message to stderr.

type StatusPrinter

type StatusPrinter struct {
	// Writer is the output destination. Defaults to os.Stderr if nil.
	Writer io.Writer
}

StatusPrinter handles colored terminal output for the status command. All output goes to Writer (defaults to os.Stderr). Respects NO_COLOR env automatically via fatih/color.

func (*StatusPrinter) Failure

func (p *StatusPrinter) Failure(format string, args ...any)

Failure prints a red cross + formatted message.

func (*StatusPrinter) HasFailures

func (p *StatusPrinter) HasFailures(report *lspool.HealthReport) bool

HasFailures returns true if any worker is in failed state or any circuit is open. Used to set exit code 1 per D-07.

func (*StatusPrinter) Info

func (p *StatusPrinter) Info(format string, args ...any)

Info prints a blue arrow + formatted message.

func (*StatusPrinter) PrintReport

func (p *StatusPrinter) PrintReport(report *lspool.HealthReport, verbose bool)

PrintReport formats a HealthReport for terminal display. In default mode (verbose=false), only unhealthy items are shown. If all healthy, the Summary field provides a single-line message per D-11.

func (*StatusPrinter) Success

func (p *StatusPrinter) Success(format string, args ...any)

Success prints a green checkmark + formatted message.

func (*StatusPrinter) Warning

func (p *StatusPrinter) Warning(format string, args ...any)

Warning prints a yellow exclamation mark + formatted message.

type VSCodeRegistrar

type VSCodeRegistrar struct{}

VSCodeRegistrar handles MCP registration for VS Code / Copilot. NOTE: VS Code uses "servers" key, NOT "mcpServers" (Pitfall 1).

func (*VSCodeRegistrar) Description

func (r *VSCodeRegistrar) Description() string

func (*VSCodeRegistrar) Name

func (r *VSCodeRegistrar) Name() string

func (*VSCodeRegistrar) Register

func (r *VSCodeRegistrar) Register(cfg RegistrationConfig) error

func (*VSCodeRegistrar) Unregister

func (r *VSCodeRegistrar) Unregister(cfg RegistrationConfig) error

Jump to

Keyboard shortcuts

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