ide

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package ide provides IDE opening functionality through hooks.

Package ide provides IDE opening functionality through hooks.

Index

Constants

View Source
const (
	// CursorName is the name identifier for the Cursor IDE.
	CursorName = "cursor"
	// CursorCommand is the command to open Cursor.
	CursorCommand = "cursor"
)
View Source
const (
	// VSCodeName is the name identifier for the VS Code IDE.
	VSCodeName = "vscode"
	// VSCodeCommand is the command to open VS Code.
	VSCodeCommand = "code"
)
View Source
const (
	// VSCodiumName is the name identifier for the VSCodium IDE.
	VSCodiumName = "vscodium"
	// VSCodiumCommand is the command to open VSCodium.
	VSCodiumCommand = "codium"
)
View Source
const DefaultIDE = VSCodeName

DefaultIDE is the default IDE name used when no IDE is specified.

View Source
const (
	// DummyName is the name identifier for the Dummy IDE.
	DummyName = "dummy"
)

Variables

View Source
var (
	// ErrIDENotInstalled is returned when an IDE is not installed on the system.
	ErrIDENotInstalled = errors.New("IDE not installed")

	// ErrUnsupportedIDE is returned when an IDE is not supported.
	ErrUnsupportedIDE = errors.New("unsupported IDE")

	// ErrIDEExecutionFailed is returned when IDE command execution fails.
	ErrIDEExecutionFailed = errors.New("failed to execute IDE command")

	// ErrWorktreeNotFound is returned when a worktree is not found in status.yaml.
	ErrWorktreeNotFound = errors.New("worktree not found")

	// ErrWorktreePathRequired is returned when the worktreePath parameter is missing.
	ErrWorktreePathRequired = errors.New("cannot open IDE: worktreePath parameter is required")

	// ErrWorktreePathEmpty is returned when the worktreePath parameter is empty.
	ErrWorktreePathEmpty = errors.New("cannot open IDE: worktreePath must be a non-empty string")
)

Functions

This section is empty.

Types

type Cursor

type Cursor struct {
	// contains filtered or unexported fields
}

Cursor represents the Cursor IDE implementation.

func NewCursor

func NewCursor(fs fs.FS) *Cursor

NewCursor creates a new Cursor IDE instance.

func (*Cursor) IsInstalled

func (c *Cursor) IsInstalled() bool

IsInstalled checks if Cursor is installed on the system.

func (*Cursor) Name

func (c *Cursor) Name() string

Name returns the name of the IDE.

func (*Cursor) OpenRepository

func (c *Cursor) OpenRepository(path string) error

OpenRepository opens Cursor with the specified repository path.

type Dummy

type Dummy struct {
	// contains filtered or unexported fields
}

Dummy represents a dummy IDE implementation for testing.

func NewDummy

func NewDummy(fs fs.FS) *Dummy

NewDummy creates a new Dummy IDE instance.

func (*Dummy) IsInstalled

func (d *Dummy) IsInstalled() bool

IsInstalled always returns true for the dummy IDE.

func (*Dummy) Name

func (d *Dummy) Name() string

Name returns the name of the IDE.

func (*Dummy) OpenRepository

func (d *Dummy) OpenRepository(path string) error

OpenRepository does nothing but returns success.

type IDE

type IDE interface {
	// Name returns the name of the IDE
	Name() string

	// IsInstalled checks if the IDE is installed on the system
	IsInstalled() bool

	// OpenRepository opens the IDE with the specified repository path
	OpenRepository(path string) error
}

IDE interface defines the methods that all IDE implementations must provide.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages IDE implementations and provides a unified interface.

func NewManager

func NewManager(params NewManagerParams) *Manager

NewManager creates a new IDE manager with registered IDE implementations.

func (*Manager) GetIDE

func (m *Manager) GetIDE(name string) (IDE, error)

GetIDE returns the IDE implementation for the given name.

func (*Manager) OpenIDE

func (m *Manager) OpenIDE(name, path string) error

OpenIDE opens the specified IDE with the given path.

type ManagerInterface

type ManagerInterface interface {
	// GetIDE returns the IDE implementation for the given name
	GetIDE(name string) (IDE, error)
	// OpenIDE opens the specified IDE with the given path
	OpenIDE(name, path string) error
}

ManagerInterface defines the interface for IDE management.

type NewManagerParams added in v0.26.0

type NewManagerParams struct {
	FS     fs.FS
	Logger logger.Logger
}

NewManagerParams contains the parameters for creating a new IDE manager.

type OpeningHook

type OpeningHook struct {
	IDEManager ManagerInterface
}

OpeningHook provides IDE opening functionality as a post-hook.

func NewOpeningHook

func NewOpeningHook() *OpeningHook

NewOpeningHook creates a new OpeningHook instance and registers it for appropriate operations.

func (*OpeningHook) Execute

func (h *OpeningHook) Execute(_ *hooks.HookContext) error

Execute is a no-op for OpeningHook as it implements specific methods.

func (*OpeningHook) Name

func (h *OpeningHook) Name() string

Name returns the hook name.

func (*OpeningHook) OnError

func (h *OpeningHook) OnError(_ *hooks.HookContext) error

OnError is a no-op for OpeningHook.

func (*OpeningHook) PostExecute

func (h *OpeningHook) PostExecute(ctx *hooks.HookContext) error

PostExecute validates IDE opening parameters and opens the IDE after successful operations.

func (*OpeningHook) PreExecute

func (h *OpeningHook) PreExecute(_ *hooks.HookContext) error

PreExecute is a no-op for OpeningHook.

func (*OpeningHook) Priority

func (h *OpeningHook) Priority() int

Priority returns the hook priority (lower numbers execute first).

func (*OpeningHook) RegisterForOperations

func (h *OpeningHook) RegisterForOperations(registerHook func(operation string, hook hooks.PostHook) error) error

RegisterForOperations registers this hook for the operations that create worktrees.

type VSCode

type VSCode struct {
	// contains filtered or unexported fields
}

VSCode represents the VS Code IDE implementation.

func NewVSCode

func NewVSCode(fs fs.FS) *VSCode

NewVSCode creates a new VS Code IDE instance.

func (*VSCode) IsInstalled

func (v *VSCode) IsInstalled() bool

IsInstalled checks if VS Code is installed on the system.

func (*VSCode) Name

func (v *VSCode) Name() string

Name returns the name of the IDE.

func (*VSCode) OpenRepository

func (v *VSCode) OpenRepository(path string) error

OpenRepository opens VS Code with the specified repository path.

type VSCodium added in v0.27.1

type VSCodium struct {
	// contains filtered or unexported fields
}

VSCodium represents the VSCodium IDE implementation.

func NewVSCodium added in v0.27.1

func NewVSCodium(fs fs.FS) *VSCodium

NewVSCodium creates a new VSCodium IDE instance.

func (*VSCodium) IsInstalled added in v0.27.1

func (v *VSCodium) IsInstalled() bool

IsInstalled checks if VSCodium is installed on the system.

func (*VSCodium) Name added in v0.27.1

func (v *VSCodium) Name() string

Name returns the name of the IDE.

func (*VSCodium) OpenRepository added in v0.27.1

func (v *VSCodium) OpenRepository(path string) error

OpenRepository opens VSCodium with the specified repository path.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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