ports

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package ports defines the interfaces (ports) for the hexagonal architecture.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaudeManager

type ClaudeManager interface {
	// Start spawns Claude CLI with the given prompt.
	Start(ctx context.Context, prompt string) error

	// Stop gracefully terminates the running Claude process.
	Stop(ctx context.Context) error

	// Kill forcefully terminates the Claude process.
	Kill() error

	// State returns the current state.
	State() events.ClaudeState

	// IsRunning returns true if Claude is currently running.
	IsRunning() bool

	// CurrentPrompt returns the current prompt if running.
	CurrentPrompt() string

	// PID returns the process ID if running.
	PID() int
}

ClaudeManager defines the contract for managing Claude CLI.

type EventHub

type EventHub interface {
	// Start begins the event hub.
	Start() error

	// Stop gracefully stops the hub.
	Stop() error

	// Publish sends an event to all subscribers.
	Publish(event events.Event)

	// Subscribe adds a new subscriber.
	Subscribe(sub Subscriber)

	// Unsubscribe removes a subscriber by ID.
	Unsubscribe(id string)

	// SubscriberCount returns the number of active subscribers.
	SubscriberCount() int
}

EventHub defines the contract for event distribution.

type FileWatcher

type FileWatcher interface {
	// Start begins watching the specified directory.
	Start(ctx context.Context) error

	// Stop terminates file watching.
	Stop() error

	// AddIgnorePattern adds a pattern to the ignore list.
	AddIgnorePattern(pattern string)

	// RemoveIgnorePattern removes a pattern from the ignore list.
	RemoveIgnorePattern(pattern string)

	// IsRunning returns true if the watcher is active.
	IsRunning() bool
}

FileWatcher defines the contract for file system monitoring.

type GitFileStatus

type GitFileStatus struct {
	Path        string `json:"path"`
	Status      string `json:"status"` // M, A, D, R, ??, etc.
	IsStaged    bool   `json:"is_staged"`
	IsUntracked bool   `json:"is_untracked"`
}

GitFileStatus represents the status of a file in git.

type GitTracker

type GitTracker interface {
	// Status returns the current git status.
	Status(ctx context.Context) ([]GitFileStatus, error)

	// Diff returns the diff for a specific file.
	Diff(ctx context.Context, path string) (string, error)

	// DiffStaged returns the staged diff for a specific file.
	DiffStaged(ctx context.Context, path string) (string, error)

	// DiffNewFile generates a diff-like output for untracked/new files.
	DiffNewFile(ctx context.Context, path string) (string, error)

	// DiffAll returns diffs for all changed files.
	DiffAll(ctx context.Context) (map[string]string, error)

	// IsGitRepo checks if the configured path is a git repository.
	IsGitRepo() bool

	// GetRepoRoot returns the root path of the git repository.
	GetRepoRoot() string

	// GetRepoName returns the name of the repository.
	GetRepoName() string
}

GitTracker defines the contract for git operations.

type Subscriber

type Subscriber interface {
	// ID returns a unique identifier for this subscriber.
	ID() string

	// Send sends an event to this subscriber.
	// Returns error if the subscriber is closed or the send fails.
	Send(event events.Event) error

	// Close closes the subscriber.
	Close() error

	// Done returns a channel that's closed when the subscriber is done.
	Done() <-chan struct{}
}

Subscriber represents an event subscriber.

Jump to

Keyboard shortcuts

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