Documentation
¶
Overview ¶
Package dependencies provides a centralized dependency container for the CM application. This package follows Go idioms for dependency injection by grouping related dependencies together and providing a fluent API for configuration.
Index ¶
- Variables
- type Dependencies
- func (d *Dependencies) Validate() error
- func (d *Dependencies) WithConfig(cfg config.Manager) *Dependencies
- func (d *Dependencies) WithFS(fs fs.FS) *Dependencies
- func (d *Dependencies) WithGit(git git.Git) *Dependencies
- func (d *Dependencies) WithHookManager(hm hooks.HookManagerInterface) *Dependencies
- func (d *Dependencies) WithLogger(logger logger.Logger) *Dependencies
- func (d *Dependencies) WithPrompt(prompt prompt.Prompter) *Dependencies
- func (d *Dependencies) WithRepositoryProvider(rp repositoryinterfaces.RepositoryProvider) *Dependencies
- func (d *Dependencies) WithStatusManager(sm status.Manager) *Dependencies
- func (d *Dependencies) WithWorkspaceProvider(wp workspaceinterfaces.WorkspaceProvider) *Dependencies
- func (d *Dependencies) WithWorktreeProvider(wp worktreeinterfaces.WorktreeProvider) *Dependencies
Constants ¶
This section is empty.
Variables ¶
var ( ErrFSMissing = errors.New("fs dependency is required but not set") ErrGitMissing = errors.New("git dependency is required but not set") ErrConfigMissing = errors.New("config dependency is required but not set") ErrStatusManagerMissing = errors.New("status manager dependency is required but not set") ErrLoggerMissing = errors.New("logger dependency is required but not set") ErrPromptMissing = errors.New("prompt dependency is required but not set") ErrHookManagerMissing = errors.New("hook manager dependency is required but not set") ErrRepositoryProviderMissing = errors.New("repository provider dependency is required but not set") ErrWorkspaceProviderMissing = errors.New("workspace provider dependency is required but not set") ErrWorktreeProviderMissing = errors.New("worktree provider dependency is required but not set") )
Validation errors for missing dependencies.
Functions ¶
This section is empty.
Types ¶
type Dependencies ¶
type Dependencies struct {
FS fs.FS
Git git.Git
Config config.Manager
StatusManager status.Manager
Logger logger.Logger
Prompt prompt.Prompter
HookManager hooks.HookManagerInterface
RepositoryProvider repositoryinterfaces.RepositoryProvider
WorkspaceProvider workspaceinterfaces.WorkspaceProvider
WorktreeProvider worktreeinterfaces.WorktreeProvider
}
Dependencies holds shared dependencies across the application. This follows the Go idiom of grouping related data together.
func New ¶
func New() *Dependencies
New creates a new Dependencies instance with sensible defaults. This follows Go's convention of New* functions for constructors.
func (*Dependencies) Validate ¶
func (d *Dependencies) Validate() error
Validate checks that all required dependencies are set and returns an error if any are missing.
func (*Dependencies) WithConfig ¶
func (d *Dependencies) WithConfig(cfg config.Manager) *Dependencies
WithConfig sets the config manager and returns the instance for chaining.
func (*Dependencies) WithFS ¶
func (d *Dependencies) WithFS(fs fs.FS) *Dependencies
WithFS sets the filesystem and returns the instance for chaining.
func (*Dependencies) WithGit ¶
func (d *Dependencies) WithGit(git git.Git) *Dependencies
WithGit sets the git instance and returns the instance for chaining.
func (*Dependencies) WithHookManager ¶
func (d *Dependencies) WithHookManager(hm hooks.HookManagerInterface) *Dependencies
WithHookManager sets the hook manager and returns the instance for chaining.
func (*Dependencies) WithLogger ¶
func (d *Dependencies) WithLogger(logger logger.Logger) *Dependencies
WithLogger sets the logger and returns the instance for chaining.
func (*Dependencies) WithPrompt ¶
func (d *Dependencies) WithPrompt(prompt prompt.Prompter) *Dependencies
WithPrompt sets the prompt and returns the instance for chaining.
func (*Dependencies) WithRepositoryProvider ¶
func (d *Dependencies) WithRepositoryProvider(rp repositoryinterfaces.RepositoryProvider) *Dependencies
WithRepositoryProvider sets the repository provider and returns the instance for chaining.
func (*Dependencies) WithStatusManager ¶
func (d *Dependencies) WithStatusManager(sm status.Manager) *Dependencies
WithStatusManager sets the status manager and returns the instance for chaining.
func (*Dependencies) WithWorkspaceProvider ¶
func (d *Dependencies) WithWorkspaceProvider(wp workspaceinterfaces.WorkspaceProvider) *Dependencies
WithWorkspaceProvider sets the workspace provider and returns the instance for chaining.
func (*Dependencies) WithWorktreeProvider ¶
func (d *Dependencies) WithWorktreeProvider(wp worktreeinterfaces.WorktreeProvider) *Dependencies
WithWorktreeProvider sets the worktree provider and returns the instance for chaining.